aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/progmodes
diff options
context:
space:
mode:
authorRoland McGrath <[email protected]>1993-09-06 22:15:21 +0000
committerRoland McGrath <[email protected]>1993-09-06 22:15:21 +0000
commitadd3312f115db81c30b3e1405a5edcb5be8bbda0 (patch)
tree28d1964acc8149978d0341b9658dd0fd5102ba21 /lisp/progmodes
parent338819bcd0ba2ea3dff2bd9173633338af4bbda1 (diff)
(tag-exact-match-p): Return true if TAG is the explicit tag name.
Diffstat (limited to 'lisp/progmodes')
-rw-r--r--lisp/progmodes/etags.el12
1 files changed, 8 insertions, 4 deletions
diff --git a/lisp/progmodes/etags.el b/lisp/progmodes/etags.el
index 452d9adfd0..93fa039c50 100644
--- a/lisp/progmodes/etags.el
+++ b/lisp/progmodes/etags.el
@@ -1070,10 +1070,14 @@ See documentation of variable `tags-file-name'."
;; t if point is at a tag line that matches TAG "exactly".
;; point should be just after a string that matches TAG.
(defun tag-exact-match-p (tag)
- (and (looking-at "\\Sw.*\177") (looking-at "\\S_.*\177") ;not a symbol char
- (save-excursion
- (backward-char (1+ (length tag)))
- (and (looking-at "\\Sw") (looking-at "\\S_")))))
+ ;; The match is really exact if there is an explicit tag name.
+ (or (looking-at (concat "[^\177]*\177" (regexp-quote tag) "\001"))
+ ;; We also call it "exact" if it is surrounded by symbol boundaries.
+ ;; This is needed because etags does not always generate explicit names.
+ (and (looking-at "\\Sw.*\177") (looking-at "\\S_.*\177")
+ (save-excursion
+ (backward-char (1+ (length tag)))
+ (and (looking-at "\\Sw") (looking-at "\\S_"))))))
;; t if point is at a tag line that matches TAG as a word.
;; point should be just after a string that matches TAG.