GNU bug report logs -
#74361
[PATCH] New option xref-navigation-display-window-action
Previous Next
Full log
Message #32 received at 74361 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
On 16/11/2024 21:12, Juri Linkov wrote:
> Instead of a new option and 'switch-to-buffer',
> a simpler way would be allow the users just to
> customize the category with 'display-buffer-same-window':
>
> (setq display-buffer-alist '(((category . xref)
> (display-buffer-same-window))))
>
> It works nicely when (category . xref) is added to the same place
> like in your patch in 'xref--show-pos-in-buf':
>
> ```
> diff --git a/lisp/progmodes/xref.el b/lisp/progmodes/xref.el
> index cf061a18ee0..0193c2e35e0 100644
> --- a/lisp/progmodes/xref.el
> +++ b/lisp/progmodes/xref.el
> @@ -689,7 +689,7 @@ xref--show-pos-in-buf
> (eq (window-buffer xref--original-window) buf)))
> `((xref--display-buffer-in-window)
> (window . ,xref--original-window))))))
> - (with-selected-window (display-buffer buf action)
> + (with-selected-window (display-buffer buf (append action '((category . xref))))
> (xref--goto-char pos)
> (run-hooks 'xref-after-jump-hook)
> (selected-window))))
> ```
Thanks! That covers the code path which uses 'display-buffer', and we
also need to handle xref-pop-to-location, which calls switch-to-buffer
now. Does
(pop-to-buffer buf '((display-buffer-same-window) (category . xref)))
look compatible enough?
Also, when using the suggested change in xref--show-pos-in-buf, if we
simply annotate it with 'category' in the display-buffer call, this also
extends to the scenarios where xref--original-window-intent is non-nil.
See the attached patch where we make sure to exclude those cases. I
suppose that loses the semantic consistency, though:
xref-find-definitions-other-window and xref-find-definitions-other-frame
are "xref" commands but they will call 'display-buffer' without 'category'.
The corresponding customization (described in the first message) can be:
(setq display-buffer-alist '(((category . xref)
(display-buffer-reuse-window
display-buffer-use-some-window))))
[xref-display-buffer-with-category.diff (text/x-patch, attachment)]
This bug report was last modified 171 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.