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

From: [email-masked] (João Távora)
Date: Thu, 03 Jan 2019 14:24:15 +0000

Hi Juri,

Juri Linkov <[email-masked]> writes:

> 1. simplifies ‘xref--show-pos-in-buf’

... and considerably complexifies xref--show-xref-buffer (more on that
later)

> while at the same time preserves the current behavior and respects
> user's customization of display actions;

That's great!

> 2. makes the xref buffer non-obtrusive like *Completions*
>    in xref--show-xref-buffer;

After a brief look, I'm not sure I like the UI change.  "not sure" is
not an euphemism for "don't like", I'm ust not sold on the idea yet:

* Certainly you don't mean non-obtrusive, you mean "less obtrusive" and
  really it's "slightly less obtrusive".  It does use potentially less
  space and doesn't temporarily use one of your windows if you happen to
  have several.  I agree this is an good advantage.

* But by using less space it is also less useful.  You don't get to see,
  at a glance, a great deal of xrefs.  And xrefs are different from
  completions, they're closer to grep hits.  You wouldn't put *grep*
  hits in such a potentially tiny window, would you?

Then again, perhaps you would, and the whole point of this patch is to
make the UI configurable.  If so, I'd make the original UI the default,
or at least very very easy to bring back.

> 3. turns the existing arg QUIT of xref-goto-xref into a prefix arg,
>    so a natural key sequence ‘C-u RET’ will quit the window.
>    This is similar to the prefix arg of quit-window.

No problem here I think.

> -          (display-buffer buf action))
> +                 `(,(lambda (buf alist)
> +                      (window--display-buffer buf xref--original-window 'reuse alist)))))))
>

Using internal "--" symbols from window.el is a temporary solution I
hope.

> -        (pop-to-buffer (current-buffer))
> +        (pop-to-buffer
> +         (current-buffer)
> +         `((display-buffer--maybe-same-window
> +            display-buffer-reuse-window
> +            display-buffer--maybe-pop-up-frame
> +            display-buffer-below-selected)
> +	   ,(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)))))

Again, too many --, and seems like a lot of repetition from window.el.
Perhaps you want window.el to export a function that encapsulates
all/some of this cruft to pass as ACTION.  Naming that function would be
the hardest problem (best I could do is
display-buffer-use-completions-like-window).

Or maybe put that function in xref.el.  But as I said above, I think we
also need a function that brings back the current default.

João