unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* xref overrides user xref-backend-functions
@ 2015-12-01  6:15 Stephen Leake
  2015-12-01 20:09 ` Dmitry Gutov
  0 siblings, 1 reply; 5+ messages in thread
From: Stephen Leake @ 2015-12-01  6:15 UTC (permalink / raw)
  To: emacs-devel

This commit:

   commit a5fd38c3a6f263185ce5838010e7a0d64b49bec2
   Committer : Dmitry Gutov <dgutov@yandex.ru>
   CommitDate: Sat Nov 21 01:57:15 2015 +0200

      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).

overrides setting xref-backend-functions in ~/.emacs-init. For example,
from emacs 25 -Q, evaluate:

    (progn
     (setq xref-backend-functions (lambda () 'my-xref-backend))
     (require 'xref)
     xref-backend-functions)

This gives:

(etags--xref-backend (lambda nil (quote my-xref-backend)))

which is not what I want.

This needs a comment on why etags--xref-backend is not set in the
default value of the variable; it's not clear to me based on the bug
report, and the bug report is not referenced from the code.


I think a good fix is to not add the hook if already set:

(unless xref-backend-functions
 (add-hook 'xref-backend-functions #'etags--xref-backend))

This works for my use case, and for bug#21964.

An alternate work-around is to require xref before setting
xref-backend-functions.

--
-- Stephe



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2015-12-02 12:13 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <CABr8ebbkBS+45FV-3h5ZuVLMTS3DU53h4OYm9XRuLzp4gQg7BA@mail.gmail.com>
2015-12-02 12:13 ` xref overrides user xref-backend-functions Dmitry Gutov
2015-12-01  6:15 Stephen Leake
2015-12-01 20:09 ` Dmitry Gutov
2015-12-01 23:41   ` Stephen Leake
2015-12-02  2:08     ` Dmitry Gutov

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).