From 5ffa4e3e3c853ed75e4f4b441e813252112f2d24 Mon Sep 17 00:00:00 2001 From: Dmitry Gutov Date: Thu, 26 Nov 2015 04:38:17 +0200 Subject: [PATCH] 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. --- lisp/progmodes/etags.el | 16 ++++++++++------ 1 file 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." (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)) -- 2.39.5