Subject: Re: bug#22404: 25.1.50; Forcing `window-scroll-functions` to run.

From: Michael Heerdegen <[email-masked]>
Date: Fri, 29 Jan 2016 13:00:42 +0100

Eli Zaretskii <[email-masked]> writes:

> The other thing I still don't understand is how forcing
> window-scroll-functions to run could fix your problem or _avoiding_
> extra calculations.  Where and under what conditions would you call
> the function that forces Emacs to run window-scroll-functions?
> Doesn't that waste processing in those cases where normally
> window-scroll-functions didn't need to be run (because window-start
> and window-end don't change)?  IOW, aren't you running those costly
> calculations from window-scroll-functions?

FWIW, I ran into this class of problems for several times: after
scrolling had been happening, I want to do something with the newly
visible area of the buffer (e.g., place overlays).

The main problem here is that even when window-scroll-function run,
AFAIK the value of `window-end' can still be outdated, even when called
with the update argument.

I didn't need to use post-command-hook in my cases, so it's a bit
different from what Keith wants.

Anyway, using pre-command-hook is too late for us: it's not executed
unless the next input arrives, so you have to hit a key until
decorations or whatever get updated.

The only solution I know of is to do things in a timer, which works, but
not nicely (you sometimes get delays).

Regards,

Michael.