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

(etags-recognize-tags-table): Add that second in find-tag-tag-order,
after tag-exact-match-p.
This commit is contained in:
Roland McGrath 1994-09-23 17:44:56 +00:00
parent c49a777a36
commit eb21e7ae84

View file

@ -950,8 +950,10 @@ See documentation of variable `tags-file-name'."
(find-tag-regexp-tag-order . (tag-re-match-p))
(find-tag-regexp-next-line-after-failure-p . t)
(find-tag-search-function . search-forward)
(find-tag-tag-order . (tag-exact-match-p tag-word-match-p
tag-any-match-p))
(find-tag-tag-order . (tag-exact-match-p
tag-symbol-match-p
tag-word-match-p
tag-any-match-p))
(find-tag-next-line-after-failure-p . nil)
(list-tags-function . etags-list-tags)
(tags-apropos-function . etags-tags-apropos)
@ -1156,20 +1158,22 @@ See documentation of variable `tags-file-name'."
;; (set-syntax-table otable)))))
;;(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.
(defun tag-exact-match-p (tag)
;; The match is really exact if there is an explicit tag name.
(or (and (eq (char-after (point)) ?\001)
(eq (char-after (- (point) (length tag) 1)) ?\177))
;; We are not on the explicit tag name, but perhaps it follows.
(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.
(and (looking-at "\\Sw.*\177") (looking-at "\\S_.*\177")
(save-excursion
(backward-char (1+ (length tag)))
(and (looking-at "\\Sw") (looking-at "\\S_"))))))
(looking-at (concat "[^\177\n]*\177" (regexp-quote tag) "\001"))))
;; t if point is at a tag line that matches TAG as a symbol.
;; point should be just after a string that matches TAG.
(defun tag-symbol-match-p (tag)
(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.