Open emacsomancer opened 5 years ago
Hi,
You're right, that would be a great feature, but with a quick look, I can't find a way to do that, other than possibly rewriting much of Emacs's lisp-based scrolling code.
Looking at the manual section (emacs)Display
, under Scrolling
, Recentering
, and Auto Scrolling
, it says that the display is recentered, depending on several variables, when point goes off-screen. But from my testing and looking at the code, the recenter
function is not actually called; it all happens in C code from xdisp.c
, and those functions don't seem to be exposed to lisp, so there's no way to advise them, and there don't seem to be any relevant hooks.
I'm guessing that, for someone who knows C and Emacs well, it wouldn't be too difficult to add a before-recenter hook here or there that would allow us to do that. One other thing we'd need, ideally, is to be able to know which way the window is scrolling, so we'd know whether to highlight the top or bottom line. If there were such a hook, maybe its functions could be called with an argument that would reveal that information.
If I'm right that this would be relatively simple and harmless to add to the C code, maybe it would be worth proposing on emacs-devel. Of course, I know little about this side of Emacs, so I may be wrong.
What do you think?
Hi,
Yes, I was hoping that there was already some hook or relevant function for scrolling the page that could be easily leveraged. The C code behind Emacs is mysterious to me, but it sounds like it should be simple enough to add the relevant hook for someone with the right knowledge of C.
I'll leave this as help-wanted for now. :)
Is there any way of getting similar behaviour for
previous-line
/next-line
(C-p
/C-n
) when moving to the next/previous line triggers movement of the text? It would be nice to have a similar sort of indication as for the page/half-page movement. (I'm not sure what function is called whenprevious-line
/next-line
hits a 'scroll boundary'.)