diff options
| author | Roland McGrath | 1994-02-11 05:54:37 +0000 |
|---|---|---|
| committer | Roland McGrath | 1994-02-11 05:54:37 +0000 |
| commit | b00f856bc3b91713f53e2ead7ca417ba716bbf4c (patch) | |
| tree | fca43d187a3b492e8f18de08ca3e840e895d463b | |
| parent | a86928f70cd8120f99856c5f1b0051dac621c5b5 (diff) | |
| download | emacs-b00f856bc3b91713f53e2ead7ca417ba716bbf4c.tar.gz emacs-b00f856bc3b91713f53e2ead7ca417ba716bbf4c.zip | |
(etags-goto-tag-location): First go directly to STARTPOS and see if PAT is
right there.
| -rw-r--r-- | lisp/progmodes/etags.el | 8 |
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'." | |||
| 959 | (forward-line 1) | 959 | (forward-line 1) |
| 960 | (cons tag-text startpos))) | 960 | (cons tag-text startpos))) |
| 961 | 961 | ||
| 962 | ;; TAG-INFO is a cons (TEXT . POSITION) where TEXT is the initial part of a | ||
| 963 | ;; line containing the tag and POSITION is the character position of TEXT | ||
| 964 | ;; within the file (starting from 1). If the tag isn't exactly at the | ||
| 965 | ;; given position then look around that position using a search window | ||
| 966 | ;; which expands until it hits the start of file. | ||
| 962 | (defun etags-goto-tag-location (tag-info) | 967 | (defun etags-goto-tag-location (tag-info) |
| 963 | (let ((startpos (cdr tag-info)) | 968 | (let ((startpos (cdr tag-info)) |
| 964 | ;; This constant is 1/2 the initial search window. | 969 | ;; This constant is 1/2 the initial search window. |
| @@ -972,6 +977,9 @@ See documentation of variable `tags-file-name'." | |||
| 972 | (regexp-quote (car tag-info))))) | 977 | (regexp-quote (car tag-info))))) |
| 973 | (or startpos | 978 | (or startpos |
| 974 | (setq startpos (point-min))) | 979 | (setq startpos (point-min))) |
| 980 | ;; First see if the tag is right at the specified location. | ||
| 981 | (goto-char startpos) | ||
| 982 | (setq found (looking-at pat)) | ||
| 975 | (while (and (not found) | 983 | (while (and (not found) |
| 976 | (progn | 984 | (progn |
| 977 | (goto-char (- startpos offset)) | 985 | (goto-char (- startpos offset)) |