summaryrefslogtreecommitdiff
path: root/lisp/progmodes/xref.el
diff options
context:
space:
mode:
authorDmitry Gutov <dgutov@yandex.ru>2015-11-21 01:57:00 +0200
committerDmitry Gutov <dgutov@yandex.ru>2015-11-21 01:57:15 +0200
commita5fd38c3a6f263185ce5838010e7a0d64b49bec2 (patch)
tree18809c29cf5674cc7e65ecd200168593728a4054 /lisp/progmodes/xref.el
parent033811ceec6a2b1cb12c14cb932c0bf583e79020 (diff)
downloademacs-a5fd38c3a6f263185ce5838010e7a0d64b49bec2.tar.gz
emacs-a5fd38c3a6f263185ce5838010e7a0d64b49bec2.tar.bz2
emacs-a5fd38c3a6f263185ce5838010e7a0d64b49bec2.zip
Add xref--etags-backend to xref-backing-functions using add-hook
* lisp/progmodes/xref.el (xref-backend-functions): Move the default value into a separate `add-hook' call (bug#21964). * lisp/progmodes/elisp-mode.el (emacs-lisp-mode): Don't declare the xref-backend-functions variable. It doesn't make any difference.
Diffstat (limited to 'lisp/progmodes/xref.el')
-rw-r--r--lisp/progmodes/xref.el8
1 files changed, 5 insertions, 3 deletions
diff --git a/lisp/progmodes/xref.el b/lisp/progmodes/xref.el
index dcaffa4bbfb..c5518907aec 100644
--- a/lisp/progmodes/xref.el
+++ b/lisp/progmodes/xref.el
@@ -201,15 +201,17 @@ LENGTH is the match length, in characters."
;;; API
-;; We make the etags backend the default for now, until something
-;; better comes along.
-(defvar xref-backend-functions (list #'xref--etags-backend)
+(defvar xref-backend-functions nil
"Special hook to find the xref backend for the current context.
Each functions on this hook is called in turn with no arguments
and should return either nil to mean that it is not applicable,
or an xref backend, which is a value to be used to dispatch the
generic functions.")
+;; We make the etags backend the default for now, until something
+;; better comes along.
+(add-hook 'xref-backend-functions #'xref--etags-backend)
+
;;;###autoload
(defun xref-find-backend ()
(run-hook-with-args-until-success 'xref-backend-functions))