emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] emacs-25 51fd4a0: Adhere closer to the "implicit tag name"


From: Dmitry Gutov
Subject: [Emacs-diffs] emacs-25 51fd4a0: Adhere closer to the "implicit tag name" definition
Date: Sun, 22 Nov 2015 04:33:54 +0000

branch: emacs-25
commit 51fd4a01395885077909c60b17ae3d7d42b8bb0a
Author: Dmitry Gutov <address@hidden>
Commit: Dmitry Gutov <address@hidden>

    Adhere closer to the "implicit tag name" definition
    
    * lisp/progmodes/etags.el (etags-tags-completion-table):
    Adhere closer to the "implicit tag name" definition.  Simplify
    the regexp.  Search for the explicit tag name first, and when
    not found, search locally for the implicit one.  (Bug#21934)
---
 lisp/progmodes/etags.el |   27 ++++++++++++---------------
 1 files changed, 12 insertions(+), 15 deletions(-)

diff --git a/lisp/progmodes/etags.el b/lisp/progmodes/etags.el
index dd84754..6a77b1b 100644
--- a/lisp/progmodes/etags.el
+++ b/lisp/progmodes/etags.el
@@ -1260,24 +1260,21 @@ buffer-local values of tags table format variables."
          (point-min) (point-max))))
     (save-excursion
       (goto-char (point-min))
-      ;; This monster regexp matches an etags tag line.
-      ;;   \1 is the string to match;
-      ;;   \2 is not interesting;
-      ;;   \3 is the guessed tag name; XXX guess should be better eg DEFUN
-      ;;   \4 is not interesting;
-      ;;   \5 is the explicitly-specified tag name.
-      ;;   \6 is the line to start searching at;
-      ;;   \7 is the char to start searching at.
+      ;; This regexp matches an explicit tag name or the place where
+      ;; it would start.
       (while (re-search-forward
-             "^\\(\\([^\177]*[^-a-zA-Z0-9_+*$:\177]+\\)?\
-\\([-a-zA-Z0-9_+*$?:]+\\)[^-a-zA-Z0-9_+*$?:\177]*\\)\177\
-\\(\\([^\n\001]+\\)\001\\)?\\([0-9]+\\)?,\\([0-9]+\\)?\n"
+              "[\f\t\n\r()=,; ]?\177\\\(?:\\([^\n\001]+\\)\001\\)?"
              nil t)
-       (push   (prog1 (if (match-beginning 5)
+       (push   (prog1 (if (match-beginning 1)
                           ;; There is an explicit tag name.
-                          (buffer-substring (match-beginning 5) (match-end 5))
-                        ;; No explicit tag name.  Best guess.
-                        (buffer-substring (match-beginning 3) (match-end 3)))
+                          (buffer-substring (match-beginning 1) (match-end 1))
+                        ;; No explicit tag name.  Backtrack a little,
+                         ;; and look for the implicit one.
+                         (goto-char (match-beginning 0))
+                         (skip-chars-backward "^\f\t\n\r()=,; ")
+                         (prog1
+                             (buffer-substring (point) (match-beginning 0))
+                           (goto-char (match-end 0))))
                  (progress-reporter-update progress-reporter (point)))
                table)))
     table))



reply via email to

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