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

From: Keith David Bershatsky <[email-masked]>
Date: Fri, 13 Jun 2014 14:19:21 -0700

The custom minor-mode that I am working places overlays between `window-start` and `window-end`, and is triggered upon a variety of occurrences.  The three general categories that trigger removal / placement of overlays are:  (1) buffer modification; (2) window modification; (3) cursor movement.  The overlays draw three categories:  (1) end of line indicators (e.g., pilcrow, or single-angle [for cursor eol]); (2) a horizontal line at the current cursor position that spans the entire window-width (excluding the line numbers and fringes); and, (3) a vertical line aligned with the cursor stretching from the top to bottom of the window (excluding the headline where I have Tabbar). To make the minor mode as efficient as possible (in terms of time needed to remove / place the overlays), I am limiting the area to only the visible window.

The goal is to have the new overlays placed before the redisplay occurs -- this avoids a brief glimpse of the naked buffer once the prior overlays have been removed (and before the new overlays are laid).  Prior to the existence of the `test-mode` that I sent over a short while ago (based on the help that you and Stefan have so graciously provided), I was forcing a redisplay (whenever point moved outside of the *old* visible window limits) in order to obtain the *new* `window-start` and *new* `window-end`.  It looks as if the `test-mode` concept will resolve the issue by handling the two different conditions separately -- i.e., point inside the *old* window limits, versus point outside thereof.

---------------------------------------

On Jun 13, 2014, at 1:54 PM, Eli Zaretskii wrote:

>> From: Keith David Bershatsky <[email-masked]>
>> Date: Fri, 13 Jun 2014 11:24:01 -0700
>> Cc: [email-masked]
>> 
>> I believe splitting up the work between the two hooks may be possible -- I will need to revise the conditions once I identify additional situations.  As far as I can tell, the `window-scroll-functions` hook is NOT triggered when `point` STAYS between *old* `window-start` and *old* `window-end`.  So when `point` STAYS between *old* `window-start` and *old* `window-end`, I will need to use the `post-command-hook`.  When point moves BEYOND *old* `window-start` or `*old* `window-end`, then the `window-scroll-functions` hook can take over -- with a forced new `(window-end nil t)`.
> 
> Why do you care about the situation where point stays inside the same
> window limits?