[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

xref overrides user xref-backend-functions

From: Stephen Leake
Subject: xref overrides user xref-backend-functions
Date: Tue, 01 Dec 2015 00:15:26 -0600
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (windows-nt)

This commit:

   commit a5fd38c3a6f263185ce5838010e7a0d64b49bec2
   Committer : Dmitry Gutov <address@hidden>
   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:

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

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

-- Stephe

reply via email to

[Prev in Thread] Current Thread [Next in Thread]