[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 1/3] lisp/progmodes/etags.el clean up code by removing a temporar
From: |
Konstantin Kharlamov |
Subject: |
[PATCH 1/3] lisp/progmodes/etags.el clean up code by removing a temporary |
Date: |
Sat, 16 Mar 2019 04:53:12 +0300 |
---
lisp/progmodes/etags.el | 24 ++++++++++--------------
1 file changed, 10 insertions(+), 14 deletions(-)
diff --git a/lisp/progmodes/etags.el b/lisp/progmodes/etags.el
index c2715be5370..05dc7aa1baf 100644
--- a/lisp/progmodes/etags.el
+++ b/lisp/progmodes/etags.el
@@ -1351,7 +1351,7 @@ etags-goto-tag-location
hits the start of file."
(let ((startpos (cdr (cdr tag-info)))
(line (car (cdr tag-info)))
- offset found pat)
+ offset pat)
(if (eq (car tag-info) t)
;; Direct file tag.
(cond (line (progn (goto-char (point-min))
@@ -1363,7 +1363,6 @@ etags-goto-tag-location
;; since just going around the loop once probably
;; costs about as much as searching 2000 chars.
(setq offset 1000
- found nil
pat (concat (if (eq selective-display t)
"\\(^\\|\^m\\)" "^")
(regexp-quote (car tag-info))))
@@ -1385,19 +1384,16 @@ etags-goto-tag-location
(point)))))
(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))
- (not (bobp))))
- (setq found
- (re-search-forward pat (+ startpos offset) t)
- offset (* 3 offset))) ; expand search window
- (or found
- (re-search-forward pat nil t)
- (user-error "Rerun etags: `%s' not found in %s"
+ (or (looking-at pat) ; Is tag at the specified location?
+ (while (progn
+ (goto-char (- startpos offset))
+ (and (not (bobp))
+ (not (re-search-forward pat (+ startpos offset) t))))
+ (setq offset (* 3 offset))) ; expand search window
+ (re-search-forward pat nil t)
+ (user-error "Rerun etags: `%s' not found in %s"
pat buffer-file-name)))
;; Position point at the right place
;; if the search string matched an extra Ctrl-m at the beginning.
--
2.21.0
- [PATCH 1/3] lisp/progmodes/etags.el clean up code by removing a temporary,
Konstantin Kharlamov <=
[PATCH 2/3] lisp/progmodes/etags.el don't (forward-char) as it's overriden next line, Konstantin Kharlamov, 2019/03/15