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

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

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


From: Eli Zaretskii
Subject: bug#22404: 25.1.50; Forcing `window-scroll-functions` to run.
Date: Thu, 21 Jan 2016 22:28:05 +0200

> Date:  Thu, 21 Jan 2016 11:54:30 -0800
> From:  Keith David Bershatsky <esq@lawlist.com>
> Cc:  22404@debbugs.gnu.org
> 
> The calculations (primarily because of `vertical-motion`) are too costly 
> time-wise to perform more than once during each command loop because it slows 
> down performance.
> 
> If I run the calculations from the `post-command-hook`, I will have wasted 
> precious time IF the `window-scroll-functions` hook will be running.  IF the 
> `window-scroll-functions` hook will be running, then the `window-start` and 
> `window-end` obtained from the `post-command-hook` will be wrong -- so there 
> is no point using those PCH wrong numbers.
> 
> If I run the calculations from the INITIAL run of the 
> `window-scroll-functions` hook, I will have wasted precious time IF the WSF 
> hook will be running a SECOND time.  [WSF runs a SECOND time if point was 
> PARTIALLY visible.]  IF the WSF will be running more than one time, then the 
> INITIAL values for `window-start` and `window-end` will be wrong -- so there 
> is no point using those WSF wrong numbers.  Instead, I have to wait until the 
> LAST call on the WSF when the final correct values for `window-start` and 
> `window-end` can be truly ascertained.
> 
> Without the benefit of feature request 22404, there are a couple of options 
> that are not ideal.

What do you need from window-scroll-functions?  Only the correct
values of window-start and window-end?  Or something else?

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?

Finally, wouldn't running from pre-command-hook solve the problem?
The values of window-start and window-end are known by then, and you
can record the old values to compare them against new, to know when
they change.  No?





reply via email to

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