[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Use cases for post-redisplay hooks
From: |
Clément Pit--Claudel |
Subject: |
Re: Use cases for post-redisplay hooks |
Date: |
Thu, 7 Jul 2016 15:44:13 -0400 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.8.0 |
But I meant — can't you update this flag yourself, and do at most one
recalculation per command loop?
On 2016-07-07 13:53, Keith David Bershatsky wrote:
> Yes, a `needs-recalculation` flag would be very useful -- i.e., when the
> values for `window-start` and `window-end` are correct and not going to
> change, then run the Lisp function (attached to the hook) that depends upon
> those values being correct. A counter, however, may not be a reliable
> indicator of the above test.
>
> [My assumption is that overlays could be placed before the screen visually
> refreshes, so that the overlays are visually present when redisplay finishes.]
>
> Keith
>
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
>
> At Thu, 7 Jul 2016 12:08:09 -0400,
> Clément Pit--Claudel wrote:
>>
>> On 2016-07-04 18:50, Keith David Bershatsky wrote:
>>> The reason I mentioned the `window-scroll-functions` hook was an
>>> assumption (on my part) that Clément had initially categorized my
>>> potential usage of the proposed `post-redisplay-hook` as only
>>> relating to scrolling. I just wanted to clarify / differentiate my
>>> proposed use case as needing `window-start` and `window-end` each
>>> command loop.
>>
>> IIUC then the post-redisplay-hook thing wouldn't work very nicely: in
>> general, it's going to run more often than once per command loop cycle.
>>
>>> With respect to the hook running more than once each command loop, it
>>> is only a problem for me because my calculations are costly time-wise
>>> (e.g., `vertical-motion'). So, I only want to do it one time each
>>> command loop.
>>
>> Would registering a post-command hook and incrementing a counter in there
>> help? You would then predicate your costly calculations on the value of that
>> counter having changed since the last time the calculations ran.
>>
>> Even simpler: in a pre/post-command hook switch a `needs-recalculation' flag
>> to t, and after completing the calculations (from whichever other hook
>> you're using for them) switch `needs-recalculation' to nil. If the function
>> doing the calculations is called when `needs-recalculation' is nil, then can
>> exit immediately.
>>
>> Or is there something more complex that I'm missing?
>>
>> Clément.
>>
>> [2 OpenPGP digital signature <application/pgp-signature (7bit)>]
>
signature.asc
Description: OpenPGP digital signature
- Re: Use cases for post-redisplay hooks, (continued)
- Re: Use cases for post-redisplay hooks, Clément Pit--Claudel, 2016/07/10
- Re: Use cases for post-redisplay hooks, Keith David Bershatsky, 2016/07/04
- Re: Use cases for post-redisplay hooks, Keith David Bershatsky, 2016/07/04
- Re: Use cases for post-redisplay hooks, Keith David Bershatsky, 2016/07/05
- Re: Use cases for post-redisplay hooks, Keith David Bershatsky, 2016/07/07
- Re: Use cases for post-redisplay hooks,
Clément Pit--Claudel <=
- Re: Use cases for post-redisplay hooks, Keith David Bershatsky, 2016/07/07