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

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

bug#20236: 25.0.50; Feature Request: scroll-other-window does not allow


From: Juri Linkov
Subject: bug#20236: 25.0.50; Feature Request: scroll-other-window does not allow setting of scroll function
Date: Thu, 02 Dec 2021 19:41:20 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (x86_64-pc-linux-gnu)

>>> the c-code scroll-other-window functions do not allow specification of
>>> the function to be used for scrolling, which means they have problems
>>> with other-window modes like Info and PDF-View.  It would be
>>> tremendously useful if support for dynamic setting of the
>>> scroll-other-window functions would be allowed (based on the mode of
>>> other-window).
>>
>> Agreed.  Patch welcome.
>
> Hm...  I don't think modes explicitly define a scrolling command -- they
> just rebind <next> etc?
>
> So for this to work, we'd have to introduce a scroll-command variable
> that buffers could set locally, and then have scroll_command call that
> instead of doing its thing if it's set?
>
> Anybody have an opinion here?

Looks like this could be useful in e.g. `follow-mode'.
`follow-mode-map' binds only these keys:

    (define-key map "\C-v"      #'follow-scroll-up)
    (define-key map "\M-v"      #'follow-scroll-down)

So users of follow-mode need to add more customization:

  (with-eval-after-load 'follow
    (define-key follow-mode-map [prior] 'follow-scroll-down)
    (define-key follow-mode-map [next]  'follow-scroll-up))

that still doesn't work in view-mode where
the scrolling key SPC is bound to View-scroll-page-forward.

Oh, wait a sec.  Maybe remapping is sufficient.

And indeed, everything is achievable with just:

  (with-eval-after-load 'follow
    (define-key follow-mode-map [remap scroll-up-command] #'follow-scroll-up)
    (define-key follow-mode-map [remap scroll-down-command] 
#'follow-scroll-down)
    (define-key follow-mode-map [remap View-scroll-page-forward] 
#'follow-scroll-up)
    (define-key follow-mode-map [remap View-scroll-page-forward-set-page-size] 
#'follow-scroll-up)
    (define-key follow-mode-map [remap View-scroll-page-backward] 
#'follow-scroll-down))





reply via email to

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