Subject: bug#33870: 27.0.50; xref-goto-xref not configurable

From: Juri Linkov <[email-masked]>
Date: Mon, 28 Jan 2019 22:07:20 +0200

>> 1. avoid using dotted pair notation that often causes problems;
>
> You probably mean separate 'direction' and 'window' entries instead of
> the (direction . (WIN . DIR)).  But we didn't find a good term for
> denoting the reference window and the two inherently belong together.

I think your idea of combining them is good.

>> 2. instead of asking the user to invent a value to use for the selected window,
>>     allow omitting it in this case, by reversing WIN and DIR, for example:
>>
>>     display-buffer-in-direction (direction DIR WIN)
>>     display-buffer-in-direction (direction up main)
>>     display-buffer-in-direction (direction up) -- by default means
>>                                                   from the selected window
>
> We can do that.
>
>> PS: what about 'resize-to-fit'?  I guess it's impossible to implement it
>> as an alist, because currently fit-window-to-buffer/preserve-size usually
>> are used as an argument of the macro 'with-displayed-buffer-window'.
>
> If we don't implement it already via the window-height/window-width
> entries we can add a window-size entry.  But I forgot what you wanted
> here.

Currently it requires too much boilerplate code to do such simple things
as displaying the buffer below/bottom with resizing to fit its height.
Please grep “-at-bottom” and “-below-selected” for the current cases,
they are all ugly: some of them use ‘with-displayed-buffer-window’ with

  '((window-height . fit-window-to-buffer)
    (preserve-size . (nil . t)))

some are more uglier

  ,(if temp-buffer-resize-mode
       '(window-height . resize-temp-buffer-window)
     '(window-height . fit-window-to-buffer))
  ,(when temp-buffer-resize-mode
     '(preserve-size . (nil . t)))

some use the macro ‘with-current-buffer-window’, some use
‘pop-to-buffer’ with ‘display-buffer-below-selected’ action.

Do you think it's possible to generalize all these cases
to use simpler display actions/alists?