Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!bbn!jr@bbn.com From: jr@bbn.com (John Robinson) Newsgroups: comp.emacs Subject: Re: finding right tag out of many Message-ID: <39150@bbn.COM> Date: 26 Apr 89 16:38:06 GMT References: <41011@oliveb.olivetti.com> Sender: news@bbn.COM Reply-To: jr@bbn.com (John Robinson) Organization: BBN Systems and Technologies Corporation, Cambridge MA Lines: 31 In-reply-to: kupfer@orc.olivetti.com (Mike Kupfer) In article <41011@oliveb.olivetti.com>, kupfer@orc (Mike Kupfer) writes: >I just had the unhappy experience of looking for "get" in some kernel >sources. There were 155 tags matching "get", and the one I wanted was >around the 130th. Slogging through the other entries with C-u M-. was >not a great deal of fun. Is there some clever use of the (GNU Emacs) >tags package that would avoid this, or is it time to make the find-tag >smarter (e.g., by first looking for an "exact" match)? You can go a long way by changing find-tag to call re-search-forward instead of search-forward. Once you do this, you have to know the structure of TAGS files to really do what you want, but it isn't that hard to learn. Once having done this, you might want to add more cleverness to find-tag so it always manages NOT to match in the tag location info. find-tag-exactly could probably work simply by surrounding your tag in \W escapes, except that this might match "get_" forms. You can either change the character syntax of _ temporarily, or know that it is sufficient to look for "^get " (for a C function) or " get " for a lisp defun... A sexier approach might be to use occur-menu on the TAGS file itself; then you would need a (find-TAGS-tag) function to jump from the tag you wanted (in the TAGS file) to its place in the source. Or better would be to combine them into a tags-occur-menu. Any volunteers? -- /jr jr@bbn.com or bbn!jr C'mon big money!