Subject: Re: bug#33992: 27.0.50; xref-find-definitions wastes too much space

From: Dmitry Gutov <[email-masked]>
Date: Fri, 5 Apr 2019 02:06:57 +0300

On 04.04.2019 23:49, Juri Linkov wrote:

>> Does it feel the same way to you?
> 
> The difference is that completions pop up in a small unobtrusive window.

Small window? I usually have a side-by-side fullscreen split, and if I 
initiate completion in one of the windows, *Completion* takes up the 
whole other window. Temporarily, of course.

> But this should be easy to do in xref now too.
> 
> Thanks to João, we now have configurable window management in xref,
> so I tried different customizations, and one of the most appealing
> is this:
> 
>    (defun display-buffer-condition-xref (buffer-name _action)
>      (and (string-match-p "\\`\\*\\(xref\\)\\*\\(\\|<[0-9]+>\\)\\'"
>                           buffer-name)
>           (memq this-command '(xref-find-definitions))))
> 
>    (defun display-buffer-condition-from-xref (_buffer-name _action)
>      (string-match-p "\\`\\*\\(xref\\)\\*\\(\\|<[0-9]+>\\)\\'"
>                      (buffer-name (current-buffer))))

This function seems unused.

>    (setq display-buffer-alist
>       '((display-buffer-condition-xref
>          display-buffer-in-direction

And this function is undefined in my Emacs.

>         (direction . below) (window-height . fit-window-to-buffer))))
> 
>    (with-eval-after-load 'xref
>      (define-key xref--button-map [(control ?m)] #'xref-quit-and-goto-xref))
> 
> How do you like that?

I might, but since I can't really try your customization myself yet, 
I'll repeat a question you might be familiar with already:

   Will this also affect xref-find-references and project-find-regexp?