[Top][All Lists]

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

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

From: Konstantin Kharlamov
Subject: [PATCH v2] lisp/progmodes/etags.el improve match by string trimming
Date: Sat, 16 Mar 2019 05:13:33 +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

Sorry, I didn't test the last change on (looking-at pat) removal, it
still does matching. Fixed here.

 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..0e0e649a5d5 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 (string-trim (regexp-quote (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

reply via email to

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