[Top][All Lists]

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

Re: Bad moves with xref-find-definitions

From: Dmitry Gutov
Subject: Re: Bad moves with xref-find-definitions
Date: Sun, 26 Apr 2015 02:50:51 +0300
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:36.0) Gecko/20100101 Thunderbird/36.0

On 04/25/2015 09:56 PM, address@hidden (João Távora) wrote:

While we're on the subject, is a patch welcome to set
`xref-find-function' to `elisp-xref-find' more pervasively in the
apropos, debugger and help buffers?

I'm fine with that, but the effect will also make it harder for Eli to undo that change. :) Dunno how important that is.

See http://debbugs.gnu.org/19466.

The patch attached does this to a certain degree, but takes some care to
not do this is the major mode's definitions, since in theory these modes
could be used for something other than emacs-lisp.

Makes sense.

On the other hand, should we care? Currently, M-. in the *Help* buffer
always prompts to find a tag, which is less useful (if not useless) than
having it try to navigate to an elisp symbol definition.

If you run 'make tags', it'll create lisp/TAGS linked with src/TAGS, the former containing the core Lisp definitions. Though not any third-party ones.

diff --git a/lisp/emacs-lisp/debug.el b/lisp/emacs-lisp/debug.el
index ce5c786..7585215 100644
--- a/lisp/emacs-lisp/debug.el
+++ b/lisp/emacs-lisp/debug.el
@@ -338,7 +338,8 @@ That buffer should be current already."
                        (with-current-buffer (car tem)
        (pop tem))))
-  (debugger-make-xrefs))
+  (debugger-make-xrefs)
+  (setq-local xref-find-function #'elisp-xref-find))

Both this and the other places should probably set xref-identifier-completion-table-function as well. You could extract those three lines from emacs-lisp-mode.

+(advice-add 'describe-mode :after #'help--setup-xref-find-function)
+(advice-add 'describe-function :after #'help--setup-xref-find-function)
+(advice-add 'describe-variable :after #'help--setup-xref-find-function)
+(advice-add 'describe-bindings :after #'help--setup-xref-find-function)

Why not add the call to the command definitions directly?

reply via email to

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