summaryrefslogtreecommitdiff
path: root/lisp/progmodes
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>1994-02-11 05:54:37 +0000
committerRoland McGrath <roland@gnu.org>1994-02-11 05:54:37 +0000
commitb00f856bc3b91713f53e2ead7ca417ba716bbf4c (patch)
treefca43d187a3b492e8f18de08ca3e840e895d463b /lisp/progmodes
parenta86928f70cd8120f99856c5f1b0051dac621c5b5 (diff)
downloademacs-b00f856bc3b91713f53e2ead7ca417ba716bbf4c.tar.gz
(etags-goto-tag-location): First go directly to STARTPOS and see if PAT is
right there.
Diffstat (limited to 'lisp/progmodes')
-rw-r--r--lisp/progmodes/etags.el8
1 files changed, 8 insertions, 0 deletions
diff --git a/lisp/progmodes/etags.el b/lisp/progmodes/etags.el
index ebfdb910cb6..378965b2e08 100644
--- a/lisp/progmodes/etags.el
+++ b/lisp/progmodes/etags.el
@@ -959,6 +959,11 @@ See documentation of variable `tags-file-name'."
(forward-line 1)
(cons tag-text startpos)))
+;; TAG-INFO is a cons (TEXT . POSITION) where TEXT is the initial part of a
+;; line containing the tag and POSITION is the character position of TEXT
+;; within the file (starting from 1). If the tag isn't exactly at the
+;; given position then look around that position using a search window
+;; which expands until it hits the start of file.
(defun etags-goto-tag-location (tag-info)
(let ((startpos (cdr tag-info))
;; This constant is 1/2 the initial search window.
@@ -972,6 +977,9 @@ See documentation of variable `tags-file-name'."
(regexp-quote (car tag-info)))))
(or startpos
(setq startpos (point-min)))
+ ;; First see if the tag is right at the specified location.
+ (goto-char startpos)
+ (setq found (looking-at pat))
(while (and (not found)
(progn
(goto-char (- startpos offset))