Path: utzoo!utgpu!attcan!uunet!lll-winken!lll-tis!ames!think!husc6!bbn!bbn.com!mesard From: mesard@bbn.com (Wayne Mesard) Newsgroups: comp.emacs Subject: Re: How to find 'defuns' in GNU Emacs source Message-ID: <27626@bbn.COM> Date: 28 Jul 88 19:51:35 GMT References: <638@novavax.UUCP> Sender: news@bbn.COM Lines: 61 From article <638@novavax.UUCP>, by weiner@novavax.UUCP (Bob Weiner): > > To find the defun associated with any GNU Emacs function follow these > steps at the shell level: > > 1. cd /lisp > > 2. /etc/etags *.el ../src/*.[ch] > > This gets all function definitions written in lisp or C. To add to Bob's excellent idea, I've whipped up the enclosed function. It does tag searches on Emacs source while preserving the current tags environment. (So you can interleave tags searches on GNU code and your own code.) Note that the path to the Emacs tags table is hard-wired (in the first setq). You may need to change that. I have this bound to C-c . in my .emacs. Enjoy. ===============================SNIP========================== (autoload 'find-tag-tag "tags" "This hack is here because there's no provide in tags.el!") (defvar last-emacs-tag nil "Tag found by the last find-emacs-tag.") (defun find-emacs-tag (emacs-tagname &optional next other-window) "Invoke find-tag on EMACS-TAGNAME using the Emacs tag table. The state of the tags variables (tags-file-name and last-tag) are preserved so that a user can interleave calls to find-tag and find-emacs-tag. If second arg NEXT is non-nil (interactively, with prefix arg), searches for the next tag in the tag table that matches the tagname used in the previous find-emacs-tag." (interactive (if current-prefix-arg '(nil t) (find-tag-tag "Find Emacs tag: "))) (let ((old-tags-file-name tags-file-name) (old-last-tag last-tag)) (setq tags-file-name "/usr/local/emacs/lisp/TAGS" last-tag last-emacs-tag) (unwind-protect (find-tag emacs-tagname next other-window) (setq last-emacs-tag last-tag last-tag old-last-tag tags-file-name old-tags-file-name) ) )) -- unsigned *Wayne_Mesard(); MESARD@BBN.COM BBN, Cambridge, MA [B]oth [Democratic] candidates are fluent in Spanish; it remains to be seen if one of the Republican candidates will be fluent in English. -George Will