all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Keith David Bershatsky <esq@lawlist.com>
To: "Clément Pit--Claudel" <clement.pit@gmail.com>
Cc: Michael Heerdegen <eliz@gnu.org>,
	Stefan Monnier <monnier@iro.umontreal.ca>,
	emacs-devel@gnu.org
Subject: Re: Use cases for post-redisplay hooks
Date: Thu, 07 Jul 2016 10:53:29 -0700	[thread overview]
Message-ID: <m24m81cp2e.wl%esq@lawlist.com> (raw)

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)>]



             reply	other threads:[~2016-07-07 17:53 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-07 17:53 Keith David Bershatsky [this message]
2016-07-07 19:44 ` Use cases for post-redisplay hooks Clément Pit--Claudel
  -- strict thread matches above, loose matches on Subject: below --
2016-07-07 20:19 Keith David Bershatsky
2016-07-05 17:45 Keith David Bershatsky
2016-07-04 22:50 Keith David Bershatsky
2016-07-05  8:12 ` Stefan Monnier
2016-07-07 16:08 ` Clément Pit--Claudel
2016-07-04 21:42 Keith David Bershatsky
2016-07-04 22:06 ` Stefan Monnier
2016-07-05  2:35 ` Eli Zaretskii
2016-07-04 16:39 Clément Pit--Claudel
2016-07-04 17:02 ` Eli Zaretskii
2016-07-04 17:15   ` Clément Pit--Claudel
2016-07-04 21:45 ` Stefan Monnier
2016-07-10 22:17 ` Clément Pit--Claudel
2016-07-11  3:34   ` Stefan Monnier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m24m81cp2e.wl%esq@lawlist.com \
    --to=esq@lawlist.com \
    --cc=clement.pit@gmail.com \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.