Commit eb21e7ae authored by Roland McGrath's avatar Roland McGrath
Browse files

(tag-symbol-match-p): New function.

(etags-recognize-tags-table): Add that second in find-tag-tag-order,
after tag-exact-match-p.
parent c49a777a
...@@ -950,8 +950,10 @@ See documentation of variable `tags-file-name'." ...@@ -950,8 +950,10 @@ See documentation of variable `tags-file-name'."
(find-tag-regexp-tag-order . (tag-re-match-p)) (find-tag-regexp-tag-order . (tag-re-match-p))
(find-tag-regexp-next-line-after-failure-p . t) (find-tag-regexp-next-line-after-failure-p . t)
(find-tag-search-function . search-forward) (find-tag-search-function . search-forward)
(find-tag-tag-order . (tag-exact-match-p tag-word-match-p (find-tag-tag-order . (tag-exact-match-p
tag-any-match-p)) tag-symbol-match-p
tag-word-match-p
tag-any-match-p))
(find-tag-next-line-after-failure-p . nil) (find-tag-next-line-after-failure-p . nil)
(list-tags-function . etags-list-tags) (list-tags-function . etags-list-tags)
(tags-apropos-function . etags-tags-apropos) (tags-apropos-function . etags-tags-apropos)
...@@ -1156,20 +1158,22 @@ See documentation of variable `tags-file-name'." ...@@ -1156,20 +1158,22 @@ See documentation of variable `tags-file-name'."
;; (set-syntax-table otable))))) ;; (set-syntax-table otable)))))
;;(put 'tags-with-syntax 'edebug-form-spec '(&rest form)) ;;(put 'tags-with-syntax 'edebug-form-spec '(&rest form))
;; t if point is at a tag line that matches TAG "exactly". ;; t if point is at a tag line that matches TAG exactly.
;; point should be just after a string that matches TAG. ;; point should be just after a string that matches TAG.
(defun tag-exact-match-p (tag) (defun tag-exact-match-p (tag)
;; The match is really exact if there is an explicit tag name. ;; The match is really exact if there is an explicit tag name.
(or (and (eq (char-after (point)) ?\001) (or (and (eq (char-after (point)) ?\001)
(eq (char-after (- (point) (length tag) 1)) ?\177)) (eq (char-after (- (point) (length tag) 1)) ?\177))
;; We are not on the explicit tag name, but perhaps it follows. ;; We are not on the explicit tag name, but perhaps it follows.
(looking-at (concat "[^\177\n]*\177" (regexp-quote tag) "\001")) (looking-at (concat "[^\177\n]*\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. ;; t if point is at a tag line that matches TAG as a symbol.
(and (looking-at "\\Sw.*\177") (looking-at "\\S_.*\177") ;; point should be just after a string that matches TAG.
(save-excursion (defun tag-symbol-match-p (tag)
(backward-char (1+ (length tag))) (and (looking-at "\\Sw.*\177") (looking-at "\\S_.*\177")
(and (looking-at "\\Sw") (looking-at "\\S_")))))) (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. ;; t if point is at a tag line that matches TAG as a word.
;; point should be just after a string that matches TAG. ;; point should be just after a string that matches TAG.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment