emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH v3] lisp/progmodes/etags.el improve match by string trimming


From: Konstantin Kharlamov
Subject: [PATCH v3] lisp/progmodes/etags.el improve match by string trimming
Date: Sun, 17 Mar 2019 05:38:34 +0300

Not only this improves general usability, but also works around existing
bug in anjuta-tagsĀ¹

1: https://gitlab.gnome.org/GNOME/anjuta/issues/8
---

v3: swap regexp-quote and string-trim, that works faster

 lisp/progmodes/etags.el | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/lisp/progmodes/etags.el b/lisp/progmodes/etags.el
index 62637414ef8..d5162f01e47 100644
--- a/lisp/progmodes/etags.el
+++ b/lisp/progmodes/etags.el
@@ -1363,9 +1363,10 @@ etags-goto-tag-location
       ;; since just going around the loop once probably
       ;; costs about as much as searching 2000 chars.
       (setq offset 1000
-           pat (concat (if (eq selective-display t)
-                           "\\(^\\|\^m\\)" "^")
-                       (regexp-quote (car tag-info))))
+            ;; Improve the match by trimming the pattern. It's
+            ;; impossible anyway that 2 tags would only differ by
+            ;; trailing whitespace.
+           pat (regexp-quote (string-trim (car tag-info))))
       ;; The character position in the tags table is 0-origin and counts CRs.
       ;; Convert it to a 1-origin Emacs character position.
       (when startpos
-- 
2.21.0




reply via email to

[Prev in Thread] Current Thread [Next in Thread]