home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: gnu.emacs.sources
- Path: sparky!uunet!panther!mothost!lmpsbbs!mcil.comm.mot.com!avishaiy
- From: avishaiy@mcil.comm.mot.com (Avishai Yacobi)
- Subject: TAGS stack implementation
- Organization: Motorola Communications Israel Ltd., Tel Aviv
- Date: Wed, 27 Jan 1993 07:54:43 GMT
- Message-ID: <1993Jan27.075443.19777@lmpsbbs.comm.mot.com>
- Sender: avishaiy@comm.mot.com (Avishai Yacobi)
- Nntp-Posting-Host: 145.9.71.3
- Lines: 77
-
- Hi everybody,
-
- Well, I'm a new member of this news group and I hope that no one
- thought about this simple idea before.
-
- Here is a package that provides a program tracing facility based
- on regular TAGS mechanism.
- --
-
- ----------------------
- __ _ _ _ __ ____ __ _
- | | | | | | | \/
- |/_/ ___|_ | \
-
- ........................... cut along dotted line ...........................
- ;;;
- ;;; TAGS-STACK.EL -- TAGS interface that allows easy tracing of program flow
- ;;;
-
- ;;; Copyright (C) 1990 Avishai Yacoby
-
-
- ;;
- ;; This file is not part of the GNU Emacs distribution (yet).
- ;;
- ;; This file is distributed in the hope that it will be useful,
- ;; but WITHOUT ANY WARRANTY. No author or distributor
- ;; accepts responsibility to anyone for the consequences of using it
- ;; or for whether it serves any particular purpose or works at all,
- ;; unless he says so in writing. Refer to the GNU Emacs General Public
- ;; License for full details.
-
- ;; Everyone is granted permission to copy, modify and redistribute
- ;; this file, but only under the conditions described in the
- ;; GNU Emacs General Public License. A copy of this license is
- ;; supposed to have been given to you along with GNU Emacs so you
- ;; can know your rights and responsibilities. It should be in a
- ;; file named COPYING. Among other things, the copyright notice
- ;; and this notice must be preserved on all copies.
-
- ; to use this package, load it and bind the functions push-to-tag and my-win-pop
- ; to some keys. From now, you can use push-to-tag to trace into a function, and my-win-pop
- ; to return from it. When you come to think about it, it works like a "dry" debugging.
-
- (defvar tags-stack nil
- "stack for window configurations. Set by push-to-tag and used
- by pop-from-tag")
-
- (defun my-win-push ()
- (interactive)
- (setq tags-stack
- (cons (cons (current-window-configuration) (point)) tags-stack)))
-
- (defun push-to-tag ()
- "save window config. and jump to pointed routine or constant"
- (interactive)
- (my-win-push)
- (find-tag (pointed-object)))
-
- (defun my-win-pop ()
- "return to previous window setting"
- (interactive)
- (let ((win-con (car tags-stack)))
- (cond
- (win-con
- (set-window-configuration (car win-con))
- (goto-char (cdr win-con))
- (setq tags-stack (cdr tags-stack)))
- (t
- (message "Bottom of windows stack")))))
-
- (defun pointed-object ()
- (forward-char 1)
- (backward-sexp 1)
- (let ((beg (point)))
- (forward-sexp 1)
- (buffer-substring beg (point))))
-