Use find-tag-default for xref-backend-identifier-at-point
* lisp/progmodes/etags.el (find-tag-tag) (tags-completion-at-point-function): Extract common code as find-tag--default. (xref-backend-identifier-at-point): Define in terms of the new function.
This commit is contained in:
parent
54e8c7bd3a
commit
5ffa4e3e3c
1 changed files with 10 additions and 6 deletions
|
@ -799,9 +799,7 @@ If no tags table is loaded, do nothing and return nil."
|
|||
(let ((completion-ignore-case (if (memq tags-case-fold-search '(t nil))
|
||||
tags-case-fold-search
|
||||
case-fold-search))
|
||||
(pattern (funcall (or find-tag-default-function
|
||||
(get major-mode 'find-tag-default-function)
|
||||
#'find-tag-default)))
|
||||
(pattern (find-tag--default))
|
||||
beg)
|
||||
(when pattern
|
||||
(save-excursion
|
||||
|
@ -818,9 +816,7 @@ If no tags table is loaded, do nothing and return nil."
|
|||
(let* ((completion-ignore-case (if (memq tags-case-fold-search '(t nil))
|
||||
tags-case-fold-search
|
||||
case-fold-search))
|
||||
(default (funcall (or find-tag-default-function
|
||||
(get major-mode 'find-tag-default-function)
|
||||
'find-tag-default)))
|
||||
(default (find-tag--default))
|
||||
(spec (completing-read (if default
|
||||
(format "%s (default %s): "
|
||||
(substring string 0 (string-match "[ :]+\\'" string))
|
||||
|
@ -832,6 +828,11 @@ If no tags table is loaded, do nothing and return nil."
|
|||
(or default (user-error "There is no default tag"))
|
||||
spec)))
|
||||
|
||||
(defun find-tag--default ()
|
||||
(funcall (or find-tag-default-function
|
||||
(get major-mode 'find-tag-default-function)
|
||||
'find-tag-default)))
|
||||
|
||||
(defvar last-tag nil
|
||||
"Last tag found by \\[find-tag].")
|
||||
|
||||
|
@ -2084,6 +2085,9 @@ for \\[find-tag] (which see)."
|
|||
tag-implicit-name-match-p)
|
||||
"Tag order used in `xref-backend-definitions' to look for definitions.")
|
||||
|
||||
(cl-defmethod xref-backend-identifier-at-point ((_backend (eql etags)))
|
||||
(find-tag--default))
|
||||
|
||||
(cl-defmethod xref-backend-identifier-completion-table ((_backend (eql etags)))
|
||||
(tags-lazy-completion-table))
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue