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

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

bug#46119: 28.0.50; this-error-recenter


From: Juri Linkov
Subject: bug#46119: 28.0.50; this-error-recenter
Date: Sat, 30 Jan 2021 20:40:09 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu)

>> Like C-M-v/C-M-S-v and M-PgUp/M-PgDown can scroll up/down other window
>> in any mode, you can use such code to recenter other window everywhere:
>>
>>   (with-selected-window (other-window-for-scrolling) (recenter-top-bottom))
>
> Yeah, it makes sense.  The only thing is that it makes harder to find
> the right name for this command;  I think by improving the docstring
> makes more clear what is this about.

Indeed, then it has no relation to errors at all.

Like the existing command scroll-other-window-down bound to 'S-C-M-v',
a new command could be named recenter-other-window bound to 'S-C-l'.

> How does it look now?:
>
> (defun this-error-recenter (&optional arg)
>   "Recenter the current displayed error in the `next-error' buffer.
> If called not from a `next-error' buffer, then it just calls
> `recenter-top-bottom' in the other window."
>   (interactive "P")
>   (if (not (or (eq major-mode 'occur-mode) (derived-mode-p 
> 'compilation-mode)))
>       (with-selected-window (other-window-for-scrolling) (recenter-top-bottom 
> arg))
>     (funcall next-error-function 0 nil)
>     (recenter-top-bottom arg)
>     (pop-to-buffer next-error-last-buffer)))

But then no special case is needed for occur/compilation-mode.





reply via email to

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