all messages for Emacs-related lists mirrored at yhetil.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
[parent not found: <CABr8ebbkBS+45FV-3h5ZuVLMTS3DU53h4OYm9XRuLzp4gQg7BA@mail.gmail.com>]

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 --
2015-12-01  6:15 xref overrides user xref-backend-functions Stephen Leake
2015-12-01 20:09 ` Dmitry Gutov
2015-12-01 23:41   ` Stephen Leake
2015-12-02  2:08     ` Dmitry Gutov
     [not found] <CABr8ebbkBS+45FV-3h5ZuVLMTS3DU53h4OYm9XRuLzp4gQg7BA@mail.gmail.com>
2015-12-02 12:13 ` Dmitry Gutov

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.