aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric S. Raymond1991-12-08 10:11:17 +0000
committerEric S. Raymond1991-12-08 10:11:17 +0000
commita71a736b8bf7f690345649309032f2840ce3c555 (patch)
tree813f58e9b5a71b81be0f17e96f3ebf40e2a3a5d3
parente15bee3f9698fa643407510aba7057be3204acc2 (diff)
downloademacs-a71a736b8bf7f690345649309032f2840ce3c555.tar.gz
emacs-a71a736b8bf7f690345649309032f2840ce3c555.zip
*** empty log message ***
-rw-r--r--lisp/progmodes/etags.el45
1 files changed, 45 insertions, 0 deletions
diff --git a/lisp/progmodes/etags.el b/lisp/progmodes/etags.el
index 705a688c574..15181e899d7 100644
--- a/lisp/progmodes/etags.el
+++ b/lisp/progmodes/etags.el
@@ -136,6 +136,51 @@ File names returned are absolute."
136 default 136 default
137 spec)))) 137 spec))))
138 138
139(defun find-tag-noselect (tagname exact &optional next)
140 "Find a tag and return its buffer, but don't select or display it."
141 (let (buffer file linebeg startpos)
142 (save-excursion
143 (visit-tags-table-buffer)
144 (if (not next)
145 (goto-char (point-min))
146 (setq tagname last-tag))
147 (setq last-tag tagname)
148 (while (progn
149 (if (not (search-forward
150 (if exact (concat tagname "(") tagname)
151 nil t))
152 (error "No %sentries containing %s"
153 (if next "more " "") tagname))
154 (not (looking-at "[^\n\177]*\177"))))
155 (search-forward "\177")
156 (setq file (expand-file-name (file-of-tag)
157 (file-name-directory tags-file-name)))
158 (setq linebeg
159 (buffer-substring (1- (point))
160 (save-excursion (beginning-of-line) (point))))
161 (search-forward ",")
162 (setq startpos (read (current-buffer)))
163 (prog1
164 (set-buffer (find-file-noselect file))
165 (widen)
166 (push-mark)
167 (let ((offset 1000)
168 found
169 (pat (concat "^" (regexp-quote linebeg))))
170 (or startpos (setq startpos (point-min)))
171 (while (and (not found)
172 (progn
173 (goto-char (- startpos offset))
174 (not (bobp))))
175 (setq found
176 (re-search-forward pat (startpos offset) t))
177 (setq offset (* 3 offset)))
178 (or found
179 (re-search-forward pat nil t)
180 (error "%s not found in %s" pat file)))
181 (beginning-of-line)))
182 ))
183
139;;;###autoload 184;;;###autoload
140(defun find-tag (tagname &optional next other-window) 185(defun find-tag (tagname &optional next other-window)
141 "Find tag (in current tag table) whose name contains TAGNAME. 186 "Find tag (in current tag table) whose name contains TAGNAME.