Article View: gnu.emacs.bug
Article #99668file-of-tag
From: macrakis
Date: Fri, 29 Jun 1990 14:01
Date: Fri, 29 Jun 1990 14:01
34 lines
1916 bytes
1916 bytes
GNU Emacs 18.53.11 on NeXT 1.0.1
I don't understand why file-of-tag scans ALL the file headers in the
buffer up to the current one. Isn't \n\f\n guaranteed to occur only
between tag subfiles? (If not, why is it there at all?) In which
case, the following code is clearer (also smaller and faster).
It would be nice, by the way, if data structures (e.g. TAGS table,
byte-compile string) were systematically documented somewhere
independently of the code that manipulates them.
(defun file-of-tag ()
"Return the file name of the file whose tags point is within.
Assumes the tag table is the current buffer.
File name returned is relative to tag table file's directory."
(save-excursion
(search-backward "\n\f\n")
(forward-char 3)
(buffer-substring (point)
(progn (skip-chars-forward "^,\n")
(point)))))
If we can assume that \f appears only between tag subfiles, then:
(defun file-of-tag ()
"Return the file name of the file whose tags point is within.
Assumes the tag table is the current buffer.
File name returned is relative to tag table file's directory."
(save-excursion
(skip-chars-backward "^\f")
(forward-char 1)
(buffer-substring (point)
(progn (skip-chars-forward "^,\n")
(point)))))
Technical Details
Message-ID:
<9006291435.AA02004@.dupuis.gr.osf.org.>Path:
arc1-ca.pugleaf.net!gmdzi!unido!mcsun!uunet!cs.utexas.edu!tut.cis.ohio-state.edu!ri.osf.fr!macrakisShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fb2f1,c04a781196c90c6b,start X-Google-Attributes: gidfb2f1,public X-Google-ArrivalTime: 1990-06-30 00:28:16 PST Path: arc1-ca.pugleaf.net!gmdzi!unido!mcsun!uunet!cs.utexas.edu!tut.cis.ohio-state.edu!ri.osf.fr!macrakis From: macrakis@ri.osf.fr Newsgroups: gnu.emacs.bug Subject: file-of-tag Message-ID: <9006291435.AA02004@.dupuis.gr.osf.org.> Date: 29 Jun 90 14:01:40 GMT Sender: daemon@tut.cis.ohio-state.edu Distribution: gnu Organization: GNUs Not Usenet Lines: 34 Posted: Fri Jun 29 15:01:40 1990 X-Unparsable-Date: Fri, 29 Jun 90 15:35:18 GMT+0100