bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


From: Juri Linkov
Subject: bug#44611: Prefix arg for xref-goto-xref
Date: Tue, 16 Mar 2021 20:15:22 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu)

> I want to propose another alternative: to implement C-u RET
> not only for compilation-mode, but also for e.g. occur-mode,
> maybe current-prefix-arg could be handled in 'next-error-found'
> by adding to the end:
>
>   (when (and current-prefix-arg from-buffer (not (eq from-buffer to-buffer)))
>     (let ((window (get-buffer-window from-buffer)))
>       (with-selected-window window
>         (quit-restore-window window))))

Actually, 'window' should be checked with window-live-p,
because 'xref-goto-xref' could already quit the window.

> So since 'C-u M-g n' is already taken, an alternative is 'C-0 M-g n'.
> If 'C-0' makes no sense for 'C-0 M-g n', it could be used to close the window.
> Or maybe 'C-0 M-g n' still makes sense, e.g. to redisplay the current 
> location?

I withdraw this proposal because it's easy to do this in the init file:

  (defun next-error-quit-window ()
    (when (and (eq current-prefix-arg 0)
               (not (eq next-error-last-buffer (current-buffer))))
      (let ((window (get-buffer-window next-error-last-buffer)))
        (when (window-live-p window)
          (with-selected-window window
            (quit-restore-window window))))))

  (add-hook 'next-error-hook 'next-error-quit-window)

> BTW, here are the commands that work like TAB in grep-mode.
> I propose to install this patch, so at least users could bind them
> in own init files:

Now pushed to master.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]