GNU bug report logs -
#33992
27.0.50; xref-find-definitions wastes too much space
Previous Next
Reported by: Juri Linkov <juri <at> linkov.net>
Date: Sat, 5 Jan 2019 23:51:01 UTC
Severity: wishlist
Tags: patch
Found in version 27.0.50
Done: Juri Linkov <juri <at> linkov.net>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
[Message part 1 (text/plain, inline)]
Your message dated Tue, 28 May 2019 23:35:16 +0300
with message-id <871s0ifj1k.fsf <at> mail.linkov.net>
and subject line Re: bug#33992: 27.0.50; xref-find-definitions wastes too much space
has caused the debbugs.gnu.org bug report #33992,
regarding 27.0.50; xref-find-definitions wastes too much space
to be marked as done.
(If you believe you have received this mail in error, please contact
help-debbugs <at> gnu.org.)
--
33992: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=33992
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
[Message part 3 (text/plain, inline)]
Tags: patch
Severity: wishlist
X-Debbugs-CC: João Távora <joaotavora <at> gmail.com>, Dmitry Gutov <dgutov <at> yandex.ru>
As noted in bug#33870 the buffer produced by xref-find-definitions
(bound to ‘M-.’) has a transient nature like the *Completions* buffer.
Therefore it makes sense not to waste its space needlessly:
[display-action-alist.patch (text/x-diff, inline)]
diff --git a/lisp/progmodes/xref.el b/lisp/progmodes/xref.el
index 87ce2299c5..169f49a348 100644
--- a/lisp/progmodes/xref.el
+++ b/lisp/progmodes/xref.el
@@ -782,7 +773,7 @@ xref--show-xref-buffer
(erase-buffer)
(xref--insert-xrefs xref-alist)
(xref--xref-buffer-mode)
- (pop-to-buffer (current-buffer))
+ (pop-to-buffer (current-buffer) (assoc-default 'display-action-alist alist))
(goto-char (point-min))
(setq xref--original-window (assoc-default 'window alist)
xref--original-window-intent (assoc-default 'display-action alist))
@@ -808,12 +799,15 @@ xref--show-xrefs
(cond
((and (not (cdr xrefs)) (not always-show-list))
(xref-push-marker-stack)
- (xref--pop-to-location (car xrefs) display-action))
+ (xref--pop-to-location (car xrefs) (unless (listp display-action) display-action)))
(t
(xref-push-marker-stack)
(funcall xref-show-xrefs-function xrefs
`((window . ,(selected-window))
- (display-action . ,display-action))))))
+ (display-action
+ . ,(unless (listp display-action) display-action))
+ (display-action-alist
+ . ,(when (listp display-action) display-action)))))))
(defun xref--prompt-p (command)
(or (eq xref-prompt-for-identifier t)
@@ -864,7 +858,7 @@ xref-find-definitions
Otherwise, display the list of the possible definitions in a
buffer where the user can select from the list."
(interactive (list (xref--read-identifier "Find definitions of: ")))
- (xref--find-definitions identifier nil))
+ (xref--find-definitions identifier '((display-buffer-maybe-below-selected))))
;;;###autoload
(defun xref-find-definitions-other-window (identifier)
[Message part 5 (message/rfc822, inline)]
>> A patch is proposed in a separate bug#35737.
I'm closing this request because now xref is customizable enough.
And we have no more opinions for changing the default behavior.
FWIW, this is what I currently use to customize xref-find-definitions
to act more like Completions:
(custom-set-variables
'(display-buffer-alist
'((display-buffer-to-xref-p display-buffer-in-direction
(direction . below)
(window-height . fit-window-to-buffer)))))
(defun display-buffer-to-xref-p (buffer-name _action)
(and (string-match-p "\\`\\*\\(xref\\)\\*\\(\\|<[0-9]+>\\)\\'"
buffer-name)
(memq this-command '(xref-find-definitions))))
(with-eval-after-load 'xref
(defvar xref--original-command nil)
(advice-add 'xref-find-definitions :after
(lambda (&rest _args)
(with-current-buffer (window-buffer)
(setq-local xref--original-command 'xref-find-definitions))))
(define-key xref--button-map [(control ?m)]
(lambda ()
(interactive)
(if (memq xref--original-command '(xref-find-definitions))
(call-interactively 'xref-quit-and-goto-xref)
(setq xref--original-window nil)
(call-interactively 'xref-goto-xref)))))
This bug report was last modified 6 years and 33 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.