Subject: Re: bug#17678: 24.4.50; Feature Request -- calculate new `window-start` & `window-end` before visual redisplay

From: Eli Zaretskii <[email-masked]>
Date: Fri, 13 Jun 2014 23:59:33 +0300

> From: Stefan Monnier <[email-masked]>
> Cc: [email-masked],  [email-masked]
> Date: Fri, 13 Jun 2014 14:47:05 -0400
> 
> >> > Not necessarily: there are the w->optional_new_start and
> >> > w-> force_start flags, which determine what redisplay does with
> >> > window-start in these cases.
> >> > Also, the window-start could be set to a value that leaves point out
> >> > of the displayed area, in which case it won't be in effect.
> >> Right, but these fall back into the case where redisplay performs
> >> a second pass trough the window/buffer, so it's similar to the scrolling
> >> case, right?
> > Not necessarily, AFAIR.  Sometimes these situations are detected and
> > handled on the fly.
> 
> Aha!  Could you add comment somewhere in xdisp.c discussing the above
> issues about how/when is window-start obeyed and when it's not and
> when that causes a second pass and when that's handled on the fly?

I will see what I can do.

> Could be.  But I already find it hard to know what can be done with
> window-scroll-functions because it's not clear exactly when it's called,
> in 2 sense:
> - it's not clear exactly when it is called and when it is not.
> - it's not clear exactly at which stage of redisplay it is called
>   (e.g. what has already been processed, what hasn't; will any and all
>   modifications caused by window-scroll-functions be reflected on screen
>   at the end of the current redisplay, or will some of it only be
>   handled by the next redisplay?  If so, which do and which don't?)

I'm not sure I follow.  Redisplay, at the level we are talking, has no
stages.  It goes through all the windows on every frame, and does for
each window what it thinks has to be done in that window.  A process
of redisplaying a window is done in one go, there are no stages or
phases in it.  The window-scroll-functions are called when redisplay
thinks it will scroll the window in order to redisplay it.

Which modifications in window-scroll-functions did you have in mind?