emacs-bug-tracker
[Top][All Lists]
Advanced

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

[debbugs-tracker] bug#33992: closed (27.0.50; xref-find-definitions wast


From: GNU bug Tracking System
Subject: [debbugs-tracker] bug#33992: closed (27.0.50; xref-find-definitions wastes too much space)
Date: Tue, 28 May 2019 20:48:03 +0000

Your message dated Tue, 28 May 2019 23:35:16 +0300
with message-id <address@hidden>
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
address@hidden)


-- 
33992: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=33992
GNU Bug Tracking System
Contact address@hidden with problems
--- Begin Message --- Subject: 27.0.50; xref-find-definitions wastes too much space Date: Sun, 06 Jan 2019 01:43:35 +0200 User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (x86_64-pc-linux-gnu)
Tags: patch
Severity: wishlist
X-Debbugs-CC: João Távora <address@hidden>, Dmitry Gutov <address@hidden>

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:

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)

--- End Message ---
--- Begin Message --- Subject: Re: bug#33992: 27.0.50; xref-find-definitions wastes too much space Date: Tue, 28 May 2019 23:35:16 +0300 User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (x86_64-pc-linux-gnu)
>> 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)))))


--- End Message ---

reply via email to

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