aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDmitry Gutov2015-11-21 01:57:00 +0200
committerDmitry Gutov2015-11-21 01:57:15 +0200
commita5fd38c3a6f263185ce5838010e7a0d64b49bec2 (patch)
tree18809c29cf5674cc7e65ecd200168593728a4054
parent033811ceec6a2b1cb12c14cb932c0bf583e79020 (diff)
downloademacs-a5fd38c3a6f263185ce5838010e7a0d64b49bec2.tar.gz
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.
-rw-r--r--lisp/progmodes/elisp-mode.el1
-rw-r--r--lisp/progmodes/xref.el8
2 files changed, 5 insertions, 4 deletions
diff --git a/lisp/progmodes/elisp-mode.el b/lisp/progmodes/elisp-mode.el
index bf0f4b0c9b9..7e55c8e14bc 100644
--- a/lisp/progmodes/elisp-mode.el
+++ b/lisp/progmodes/elisp-mode.el
@@ -228,7 +228,6 @@ Blank lines separate paragraphs. Semicolons start comments.
228 228
229\\{emacs-lisp-mode-map}" 229\\{emacs-lisp-mode-map}"
230 :group 'lisp 230 :group 'lisp
231 (defvar xref-backend-functions)
232 (defvar project-library-roots-function) 231 (defvar project-library-roots-function)
233 (lisp-mode-variables nil nil 'elisp) 232 (lisp-mode-variables nil nil 'elisp)
234 (add-hook 'after-load-functions #'elisp--font-lock-flush-elisp-buffers) 233 (add-hook 'after-load-functions #'elisp--font-lock-flush-elisp-buffers)
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."
201 201
202;;; API 202;;; API
203 203
204;; We make the etags backend the default for now, until something 204(defvar xref-backend-functions nil
205;; better comes along.
206(defvar xref-backend-functions (list #'xref--etags-backend)
207 "Special hook to find the xref backend for the current context. 205 "Special hook to find the xref backend for the current context.
208Each functions on this hook is called in turn with no arguments 206Each functions on this hook is called in turn with no arguments
209and should return either nil to mean that it is not applicable, 207and should return either nil to mean that it is not applicable,
210or an xref backend, which is a value to be used to dispatch the 208or an xref backend, which is a value to be used to dispatch the
211generic functions.") 209generic functions.")
212 210
211;; We make the etags backend the default for now, until something
212;; better comes along.
213(add-hook 'xref-backend-functions #'xref--etags-backend)
214
213;;;###autoload 215;;;###autoload
214(defun xref-find-backend () 216(defun xref-find-backend ()
215 (run-hook-with-args-until-success 'xref-backend-functions)) 217 (run-hook-with-args-until-success 'xref-backend-functions))