aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDmitry Gutov2015-11-26 04:38:17 +0200
committerDmitry Gutov2015-11-26 04:38:31 +0200
commit5ffa4e3e3c853ed75e4f4b441e813252112f2d24 (patch)
treee3586eeb8e05f50697c0cdfd62a92f6a4acfcf36
parent54e8c7bd3afd9d5b3a4642fb36291e3e16813af3 (diff)
downloademacs-5ffa4e3e3c853ed75e4f4b441e813252112f2d24.tar.gz
emacs-5ffa4e3e3c853ed75e4f4b441e813252112f2d24.zip
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.
-rw-r--r--lisp/progmodes/etags.el16
1 files changed, 10 insertions, 6 deletions
diff --git a/lisp/progmodes/etags.el b/lisp/progmodes/etags.el
index 6a77b1b2456..2c066df90bc 100644
--- a/lisp/progmodes/etags.el
+++ b/lisp/progmodes/etags.el
@@ -799,9 +799,7 @@ If no tags table is loaded, do nothing and return nil."
799 (let ((completion-ignore-case (if (memq tags-case-fold-search '(t nil)) 799 (let ((completion-ignore-case (if (memq tags-case-fold-search '(t nil))
800 tags-case-fold-search 800 tags-case-fold-search
801 case-fold-search)) 801 case-fold-search))
802 (pattern (funcall (or find-tag-default-function 802 (pattern (find-tag--default))
803 (get major-mode 'find-tag-default-function)
804 #'find-tag-default)))
805 beg) 803 beg)
806 (when pattern 804 (when pattern
807 (save-excursion 805 (save-excursion
@@ -818,9 +816,7 @@ If no tags table is loaded, do nothing and return nil."
818 (let* ((completion-ignore-case (if (memq tags-case-fold-search '(t nil)) 816 (let* ((completion-ignore-case (if (memq tags-case-fold-search '(t nil))
819 tags-case-fold-search 817 tags-case-fold-search
820 case-fold-search)) 818 case-fold-search))
821 (default (funcall (or find-tag-default-function 819 (default (find-tag--default))
822 (get major-mode 'find-tag-default-function)
823 'find-tag-default)))
824 (spec (completing-read (if default 820 (spec (completing-read (if default
825 (format "%s (default %s): " 821 (format "%s (default %s): "
826 (substring string 0 (string-match "[ :]+\\'" string)) 822 (substring string 0 (string-match "[ :]+\\'" string))
@@ -832,6 +828,11 @@ If no tags table is loaded, do nothing and return nil."
832 (or default (user-error "There is no default tag")) 828 (or default (user-error "There is no default tag"))
833 spec))) 829 spec)))
834 830
831(defun find-tag--default ()
832 (funcall (or find-tag-default-function
833 (get major-mode 'find-tag-default-function)
834 'find-tag-default)))
835
835(defvar last-tag nil 836(defvar last-tag nil
836 "Last tag found by \\[find-tag].") 837 "Last tag found by \\[find-tag].")
837 838
@@ -2084,6 +2085,9 @@ for \\[find-tag] (which see)."
2084 tag-implicit-name-match-p) 2085 tag-implicit-name-match-p)
2085 "Tag order used in `xref-backend-definitions' to look for definitions.") 2086 "Tag order used in `xref-backend-definitions' to look for definitions.")
2086 2087
2088(cl-defmethod xref-backend-identifier-at-point ((_backend (eql etags)))
2089 (find-tag--default))
2090
2087(cl-defmethod xref-backend-identifier-completion-table ((_backend (eql etags))) 2091(cl-defmethod xref-backend-identifier-completion-table ((_backend (eql etags)))
2088 (tags-lazy-completion-table)) 2092 (tags-lazy-completion-table))
2089 2093