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

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

Re: Make scroll-{up, down} move point to {start, end} of newly visible t


From: Eli Zaretskii
Subject: Re: Make scroll-{up, down} move point to {start, end} of newly visible text
Date: Thu, 17 Aug 2023 08:18:17 +0300

> From: Spencer Baugh <sbaugh@janestreet.com>
> Date: Wed, 16 Aug 2023 16:32:22 -0400
> 
> Eli Zaretskii <eliz@gnu.org> writes:
> 
> > Either setting next-screen-context-lines to 1 should do what you want,
> > or I still don't understand what you want when scrolling by more than
> > one window-full.
> 
> Well, yes, if next-screen-context-lines is 1 then
> window-end-before-scroll and window-start-after-scroll are the same.  So
> that trivially provides the behavior I described, I suppose...
> 
> But I want the behavior I described even when next-screen-context-lines
> is greater than 1.  (I personally set it to 10.)  In that case,
> window-end-before-scroll and window-start-after-scroll aren't the same,
> and Emacs doesn't behave how I described.

But in that case I don't have a clear idea how to incorporate what you
want in the way scrolling is implemented in Emacs.  The scrolling
functions usually don't move point, they just set the window-start
position according to the scroll-command argument and relevant user
options.  The actual scrolling is done by the display engine during
the next redisplay cycle, and that either leaves point where it was
(if point is still visible) or moves it into the viewport.  This
scrolling is general display feature, it can happen even if something
other than a scrolling command caused it.  Thus, knowing when to move
point to a particular place is not trivial, and would need some
variable exposed to Lisp or something like that, and then some
non-trivial logic to use that.

It is also not clear whether you want this only for scroll commands or
also for other causes of scrolling the window.

Maybe you could do something similar to how
scroll-preserve-screen-position works.

Feel free to work on this, of course.



reply via email to

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