GNU bug report logs -
#22404
25.1.50; Forcing `window-scroll-functions` to run.
Previous Next
Full log
View this message in rfc822 format
> Date: Mon, 18 Jan 2016 21:49:40 -0800
> From: Keith David Bershatsky <esq <at> lawlist.com>
>
> As a feature request, please consider adding an alternative method to force the `window-scroll-functions` hook to run -- but NOT more than it would normally run. [In other words, it shouldn't run 3 times.] I only found `(set-window-buffer (selected-window) (current-buffer))` as a viable means to achieve this goal. `run-window-scroll-functions` runs immediately and is not a viable substitute for this feature request. Some users may not wish to `set-window-buffer` or run the `window-configuration-change-hook` to achieve this feature request.
>
> In my particular use case, I want to run a custom function only one time per command loop that is dependent upon the new `window-start` and `window-end`, which is only reliably available to the user after the `post-command-hook` has run its course. My function is too costly time-wise to run more than once each command loop. I have tried, to no avail, to come up with a test to ascertain with 100% accuracy (from the `post-command-hook`) to guess whether the `window-scroll-functions` hook will run and/or whether it will run more than one time (e.g., when cursor/point is partially visible). I played around with `(pos-visible-in-window-p nil nil t)` and whether it returned a length of 0, 2 or 6 -- however, from the `post-command-hook`, that is insufficient to ascertain with 100% accuracy whether the `window-scroll-functions` hook will run once or twice or not at all. The solution, I believe, is to force the `window-scroll-functions` hook to run during every redisplay -- but not more than it would normally run.
>
> In other words, I want the `window-scroll-functions` hook to run every command loop when my custom minor-mode is active -- or twice if point/cursor is only partially visible (at the bottom of the window) and needs to be moved up a smidgen by redisplay.
>
> Background: my custom function is a cross-hairs created with overlays that works with `word-wrap` -- the vertical line is XPM that matches the character and color underneath.
Can you please tell more details about the problem you have? I;ve
read this description several times, and couldn't figure out why are
you having problems.
For example, why can't you run your function from the
post-command-hook directly? If you want it to run after all the hook
functions finished, you can use the APPEND argument to add-hook,
right?
Or if the above somehow doesn't work, what about pre-command-hook?
And those are just 2 random thoughts that went through my head while I
was reading your request.
Thanks.
This bug report was last modified 9 years and 96 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.