[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] emacs-25 5ffa4e3 1/2: Use find-tag-default for xref-backen
From: |
Dmitry Gutov |
Subject: |
[Emacs-diffs] emacs-25 5ffa4e3 1/2: Use find-tag-default for xref-backend-identifier-at-point |
Date: |
Thu, 26 Nov 2015 02:44:16 +0000 |
branch: emacs-25
commit 5ffa4e3e3c853ed75e4f4b441e813252112f2d24
Author: Dmitry Gutov <address@hidden>
Commit: Dmitry Gutov <address@hidden>
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 files changed, 10 insertions(+), 6 deletions(-)
diff --git a/lisp/progmodes/etags.el b/lisp/progmodes/etags.el
index 6a77b1b..2c066df 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))