home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / gnu / emacs / sources / 983 < prev    next >
Encoding:
Text File  |  1993-01-28  |  2.8 KB  |  89 lines

  1. Newsgroups: gnu.emacs.sources
  2. Path: sparky!uunet!panther!mothost!lmpsbbs!mcil.comm.mot.com!avishaiy
  3. From: avishaiy@mcil.comm.mot.com (Avishai Yacobi)
  4. Subject: TAGS stack implementation
  5. Organization: Motorola Communications Israel Ltd., Tel Aviv
  6. Date: Wed, 27 Jan 1993 07:54:43 GMT
  7. Message-ID: <1993Jan27.075443.19777@lmpsbbs.comm.mot.com>
  8. Sender: avishaiy@comm.mot.com (Avishai Yacobi)
  9. Nntp-Posting-Host: 145.9.71.3
  10. Lines: 77
  11.  
  12. Hi everybody,
  13.  
  14. Well, I'm a new member of this news group and I hope that no one
  15. thought about this simple idea before.
  16.  
  17. Here is a package that provides a program tracing facility based
  18. on regular TAGS mechanism.
  19. -- 
  20.  
  21. ----------------------
  22. __ _ _ _ __ ____  __ _
  23.  | | | |  |    |  | \/
  24.    |/_/     ___|_ |  \
  25.  
  26. ........................... cut along dotted line ...........................
  27. ;;;
  28. ;;; TAGS-STACK.EL -- TAGS interface that allows easy tracing of program flow
  29. ;;;
  30.  
  31. ;;; Copyright (C) 1990 Avishai Yacoby
  32.  
  33.  
  34. ;;
  35. ;; This file is not part of the GNU Emacs distribution (yet).
  36. ;;
  37. ;; This file is distributed in the hope that it will be useful,
  38. ;; but WITHOUT ANY WARRANTY.  No author or distributor
  39. ;; accepts responsibility to anyone for the consequences of using it
  40. ;; or for whether it serves any particular purpose or works at all,
  41. ;; unless he says so in writing.  Refer to the GNU Emacs General Public
  42. ;; License for full details.
  43.  
  44. ;; Everyone is granted permission to copy, modify and redistribute
  45. ;; this file, but only under the conditions described in the
  46. ;; GNU Emacs General Public License.   A copy of this license is
  47. ;; supposed to have been given to you along with GNU Emacs so you
  48. ;; can know your rights and responsibilities.  It should be in a
  49. ;; file named COPYING.  Among other things, the copyright notice
  50. ;; and this notice must be preserved on all copies.
  51.  
  52. ; to use this package, load it and bind the functions push-to-tag and my-win-pop
  53. ; to some keys. From now, you can use push-to-tag to trace into a function, and my-win-pop
  54. ; to return from it. When you come to think about it, it works like a "dry" debugging.
  55.  
  56. (defvar tags-stack nil
  57.   "stack for window configurations. Set by push-to-tag and used
  58. by pop-from-tag")
  59.  
  60. (defun my-win-push ()
  61.   (interactive)
  62.   (setq tags-stack
  63.     (cons (cons (current-window-configuration) (point)) tags-stack)))
  64.  
  65. (defun push-to-tag ()
  66.   "save window config. and jump to pointed routine or constant"
  67.   (interactive)
  68.   (my-win-push)
  69.   (find-tag (pointed-object)))
  70.  
  71. (defun my-win-pop ()
  72.   "return to previous window setting"
  73.   (interactive)
  74.   (let ((win-con (car tags-stack)))
  75.     (cond
  76.      (win-con
  77.       (set-window-configuration (car win-con))
  78.       (goto-char (cdr win-con))
  79.       (setq tags-stack (cdr tags-stack)))
  80.      (t
  81.       (message "Bottom of windows stack")))))
  82.  
  83. (defun pointed-object ()
  84.   (forward-char 1)
  85.   (backward-sexp 1)
  86.   (let ((beg (point)))
  87.     (forward-sexp 1)
  88.     (buffer-substring beg (point))))
  89.