emacs-devel
[Top][All Lists]
Advanced

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

Re: Bad moves with xref-find-definitions


From: João Távora
Subject: Re: Bad moves with xref-find-definitions
Date: Sat, 25 Apr 2015 19:56:39 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (darwin)

On Sat, Apr 25, 2015 at 6:42 PM, Vitalie Spinu <address@hidden> wrote:
> C-u is an awkward solution. You always have to think before the actual
> key press. 

You don't have to really. If you make a mistake,press M-, to get back. 

I used to feel like you and then quickly got used to the new behaviour. 
The speed up really is worth it. 

> So please. Could you please bring the standard Emacs UI back?

Please don't. Or at least make it customizable. If you do, I vote
to keep the current behaviour the default.

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?

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.

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.

Thanks,
João

diff --git a/lisp/apropos.el b/lisp/apropos.el
index 023ba4b..b91c77a 100644
--- a/lisp/apropos.el
+++ b/lisp/apropos.el
@@ -1140,8 +1140,9 @@ If non-nil, TEXT is a string that will be printed as a 
heading."
          (apropos-print-doc 6 'apropos-face t)
          (apropos-print-doc 5 'apropos-widget t)
          (apropos-print-doc 4 'apropos-plist nil))
-        (set (make-local-variable 'truncate-partial-width-windows) t)
-        (set (make-local-variable 'truncate-lines) t))))
+        (setq-local truncate-partial-width-windows t)
+        (setq-local truncate-lines t)
+        (setq-local xref-find-function #'elisp-xref-find))))
   (prog1 apropos-accumulator
     (setq apropos-accumulator ())))    ; permit gc
 
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)
                          (point))))
        (pop tem))))
-  (debugger-make-xrefs))
+  (debugger-make-xrefs)
+  (setq-local xref-find-function #'elisp-xref-find))
 
 (defun debugger-make-xrefs (&optional buffer)
   "Attach cross-references to function names in the `*Backtrace*' buffer."
diff --git a/lisp/help.el b/lisp/help.el
index fb1719a..3980f21 100644
--- a/lisp/help.el
+++ b/lisp/help.el
@@ -1346,6 +1346,15 @@ the help window if the current value of the user option
        (with-output-to-temp-buffer " *Char Help*"
          (princ msg)))))
 
+(defun help--setup-xref-find-function (&rest _args)
+  (with-current-buffer (help-buffer)
+    (setq-local xref-find-function #'elisp-xref-find)))
+
+(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)
+

 ;; The following functions used to be in help-fns.el, which is not preloaded.
 ;; But for various reasons, they are more widely needed, so they were




reply via email to

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