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

From: Keith David Bershatsky <[email-masked]>
Date: Fri, 29 Jan 2016 07:54:08 -0800

In reading the comments in `xdisp.c`, there is a lot of mention about checking to see if the function that ran changed `window-start` and whether the cursor is still visible.  In my own tests over the past few days, I created something just like `post-redisplay-hook` that runs towards the end of redisplay.  I felt that my own feeble attempt to create the equivalent of the `post-redisplay-hook` had no checking built-in (due to lack knowledge / experience on my part).

So, I love the idea of a `post-redisplay-hook`, but think there probably needs to be some type of check to see whether the function that ran from it did some things that require certain recalculations -- e.g., maybe cursor was moved and is no longer partially or fully visible (there is even a setting I discovered where a user can decide that a partially visible cursor is just fine), maybe some text was inserted prior to window-start (which means the prior value is outdated), etc.

Sorry that I didn't understand your previous comments about the `pre-command-hook` potentially being a substitute for the contemplated `post-redisplay-hook`.  Michael is correct -- the goal is generally to have the screen looking perfectly once redisplay concludes and the `pre-command-hook` (after the fact) can't accomplish that goal.  When switching windows, the `pre-command-hook` will also have the wrong window in mind -- the correct window/buffer needs to be determined after the main command finishes.

Attached is an example of what I have been using for the past few days while I continue my ongoing tinkering -- it creates a new animal just like `window-scroll-functions` but with a different name.

Keith

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

At Fri, 29 Jan 2016 16:37:16 +0200,
Eli Zaretskii wrote:
> 
> > From: Michael Heerdegen <[email-masked]>
> > Cc: Keith David Bershatsky <[email-masked]>,  [email-masked]
> > Date: Fri, 29 Jan 2016 13:00:42 +0100
> > 
> > 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.
> 
> Then maybe we need a post-redisplay-hook.