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

From: Eli Zaretskii <[email-masked]>
Date: Thu, 21 Jan 2016 19:41:20 +0200

> Date:  Wed, 20 Jan 2016 18:32:40 -0800
> From:  Keith David Bershatsky <[email-masked]>
> Cc:  [email-masked]
> 
> `set-window-start` (without the third option) would indeed trigger the WSF because it contains a key ingredient:  `w->force_start = true`.
> 
> Because the second argument (i.e., POS) cannot be known from the PCH when point has moved beyond the visible window, `set-window-start` is not a viable substitute for this feature request.

Then I'm afraid I must insist on understanding your needs better.  I
still don't, not even after re-reading your description several times.

Maybe you could describe your use case from a different perspective:
instead of telling how you tried to make sure window-scroll-functions
are run exactly once, perhaps try to describe the problem for which
you needed to invoke window-scroll-functions in the first place.
After all, window-scroll-functions is just the means towards some
specific goal.  And I don't think I understand the goal.

Once you described what you are trying to accomplish, it might be
easier to understand how you arrived at window-scroll-functions and
the need to run them when you do.

> The attached patch is an example of an implementation of this feature request.  I created a new function called `force-wsf`, whose sole purpose is to trigger the WSF to run during redisplay -- after the PCH has already finished.  As noted in a previous e-mail, `run-window-scroll-functions` doesn't accomplish what `force-wsf` can achieve because the former runs the function attached to the WSF immediately -- instead of waiting until later on during redisplay when the correct values of `window-start` and `window-end` are ascertainable.

I'd prefer to understand the need before we discuss the
implementation.

> I would, however, still like to come up with a test at the C-source code level that tells me whether the WSF will run more than one time

I think this is fundamentally impossible.  But I didn't yet take a
good enough look at the involved code, so maybe I'm missing something.

Thanks.