Subject: bug#44611: Prefix arg for xref-goto-xref

From: Dmitry Gutov <[email-masked]>
Date: Fri, 13 Nov 2020 13:20:41 +0200

Hi Juri,

On 13.11.2020 10:18, Juri Linkov wrote:
> I recall endless discussions about xref in the past.
> But now I realized that xref-goto-xref just misses
> an obvious thing, and nothing more is needed.

Sounds promising!

> Like e.g. 'quit-window' allows using a prefix argument
> to change its behavior by relying on (interactive "P"),
> xref-goto-xref should do the same:

The proposed change is not quite the same (bury instead of kill), but if 
it really helps, go ahead.

Please also note that instead of 'C-u RET' you can use 'TAB' already: 
it's bound to xref-quit-and-goto-xref which calls xref-goto-xref with 
QUIT=t.

> diff --git a/lisp/progmodes/xref.el b/lisp/progmodes/xref.el
> index a1c4c08c26..e1dd6e56bb 100644
> --- a/lisp/progmodes/xref.el
> +++ b/lisp/progmodes/xref.el
> @@ -600,9 +600,9 @@ xref--item-at-point
>   
>   (defun xref-goto-xref (&optional quit)
>     "Jump to the xref on the current line and select its window.
> -Non-interactively, non-nil QUIT means to first quit the *xref*
> -buffer."
> -  (interactive)
> +Non-interactively, non-nil QUIT, or interactively, with prefix argument
> +means to first quit the *xref* buffer."
> +  (interactive "P")
>     (let* ((buffer (current-buffer))
>            (xref (or (xref--item-at-point)
>                      (user-error "No reference at point")))