GNU bug report logs -
#22404
25.1.50; Forcing `window-scroll-functions` to run.
Previous Next
Full log
View this message in rfc822 format
Thank you, Eli, for taking a look at this feature request.
The post-command-hook ("PCH") is only sufficient to return the correct window-start and window-end when no scrolling occurs. If I attach a function to the PCH that places overlays, then I would need to know programmatically with 100% certainty whether the window-scroll-functions ("WSF") will be running one or more times subsequent to the PCH. If the WSF will be running one or more times subsequent to the PCH, then I want to programmatically *prevent* overlays from being placed with the PCH -- i.e., so that they can instead be placed by the WSF. If the WSF will run more than once, then I want to wait until the last time it runs to place my overlays -- i.e., because start/end have changed since the first time WSF ran. E.g., point was partially visible and redisplay brings it into full view.
I was not able to come up with a 100% reliable test from the PCH that tells me whether WSF will be running one or more times subsequent thereto. So, I am using the following work-around to force the WSF to run all the time. The problem remaining is that I still need a reliable test to determine whether the WSF will be running more than once, so that I can delay my overlay function until the last call. The feature request is essentially: trigger WSF (similar to set-window-buffer), but there is no need to set-window-buffer and there is no need to run the window-configuration-change-hook. If there is any way you can think of to programmatically know with 100% certainty whether the WSF will be running more than one time, your help would be greatly appreciated.
(setq scroll-conservatively 101)
(defun pch-fn ()
(let ((window-configuration-change-hook nil))
(set-window-buffer (selected-window) (current-buffer) 'keep-margins)))
(add-hook 'post-command-hook 'pch-fn nil 'local)
(defun wsf-fn (win start)
(message "win: %s | start: %s | end: %s" win start (window-end win t)))
(add-hook 'window-scroll-functions 'wsf-fn nil 'local)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
At Tue, 19 Jan 2016 19:50:08 +0200,
Eli Zaretskii wrote:
>
> * * *
>
> 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 97 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.