Path: utzoo!utgpu!attcan!uunet!yale!Ram-Ashwin From: Ram-Ashwin@cs.yale.edu (Ashwin Ram) Newsgroups: comp.emacs Subject: Re: How to find 'defuns' in GNU Emacs source Message-ID: <34466@yale-celray.yale.UUCP> Date: 29 Jul 88 15:14:51 GMT References: <638@novavax.UUCP> <27626@bbn.COM> Sender: root@yale.UUCP Reply-To: Ram-Ashwin@cs.yale.edu (Ashwin Ram) Organization: Computer Science, Yale University, New Haven, CT 06520-2158 Lines: 36 In-reply-to: mesard@bbn.com (Wayne Mesard) In article <27626@bbn.COM>, mesard@bbn (Wayne Mesard) writes: > 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.) > > (defun find-emacs-tag (emacs-tagname &optional next other-window) > (interactive ...) > (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) > ) > )) I like the idea; I use something similar myself but I hadn't thought of the last-tag idea. However, to improve on this code, one could do: (interactive ...) (let ((tags-file-name "/usr/local/emacs/lisp/TAGS") (last-tag last-emacs-tag)) (find-tag emacs-tagname next other-window) (setq last-emacs-tag last-tag)) This is a lot simpler, doesn't require the old-* variables, and will do the same thing. There is no need to do the setq's explicitly since that's part of LET's job. -- Ashwin. ARPA: Ram-Ashwin@cs.yale.edu UUCP: {decvax,ucbvax,harvard,cmcl2,...}!yale!Ram-Ashwin BITNET: Ram@yalecs