From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: =?UTF-8?Q?Cl=c3=a9ment_Pit--Claudel?= Newsgroups: gmane.emacs.devel Subject: Re: Use cases for post-redisplay hooks Date: Thu, 7 Jul 2016 12:08:09 -0400 Message-ID: <577E7E69.6090000@gmail.com> References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="aFLdXr77u3RQKUVndKmd6MIsRU3SIEc8M" X-Trace: ger.gmane.org 1467907788 24321 80.91.229.3 (7 Jul 2016 16:09:48 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 7 Jul 2016 16:09:48 +0000 (UTC) Cc: Eli Zaretskii , emacs-devel@gnu.org To: Keith David Bershatsky , Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Jul 07 18:09:39 2016 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1bLBru-0005AM-Qx for ged-emacs-devel@m.gmane.org; Thu, 07 Jul 2016 18:09:38 +0200 Original-Received: from localhost ([::1]:40967 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bLBru-0000vJ-4M for ged-emacs-devel@m.gmane.org; Thu, 07 Jul 2016 12:09:38 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:46237) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bLBqk-0000sT-S6 for emacs-devel@gnu.org; Thu, 07 Jul 2016 12:08:27 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bLBqe-0001WB-Mx for emacs-devel@gnu.org; Thu, 07 Jul 2016 12:08:25 -0400 Original-Received: from mout.kundenserver.de ([217.72.192.75]:50059) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bLBqe-0001Vo-Cc; Thu, 07 Jul 2016 12:08:20 -0400 Original-Received: from [18.189.62.212] ([18.189.62.212]) by mrelayeu.kundenserver.de (mreue102) with ESMTPSA (Nemesis) id 0M3Sim-1bcrFt1iXQ-00qyjD; Thu, 07 Jul 2016 18:08:13 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.8.0 In-Reply-To: X-Provags-ID: V03:K0:7Il8dd4lxx7qVHTtDCsUJF59WwkXSOp4Ji91iJRGuy9rZ6u849Z lXf9d+PoHywQpswBAc3uGlcatOIxvJocWA2HbsUMvMI+XlCr7hYYUOAIBNqph+TdwUUklAa hCuctLCX4ZsKdbTnY2ccqmf4tRQtmBSEEmpId1pRhskDyYO5ncZsTZmBGpikzJd2qCtBJZl gTFjLGxvQmCjumCxhun4w== X-UI-Out-Filterresults: notjunk:1;V01:K0:svgLkgHpMWg=:wxJschpqwB32Fxg1d81Rmc KteHg4mTuGOpcZkZkm85oXBidl6PaH7lm2C6AK4Tb+w3RZB6YuMD5smij40SaTOS76tUmrRiX 8MKO4nMsbaWSFf3Rc7k9JtOFTiWCOSt5Nvcd22ekn4i4a5UvTc7P9ePqA+q9uAiNA4OOw6k79 4ii3CKPUROHclf/5GdPtGFjqS0x4wnSVM+jZaJ31FY6G1pLV7wua2iQyjSlD7rQY78l7EH0KZ KlExQ336ImOYXIGXUmEe8KfUoQws/KAPSJPeoCyaKSyYz5paLjnntKEckTjncnWnS6coazG6x LFTpV7re43PkXBBrvUlgbyXMyTRCDZ/3MKbfIQAkoIaCOdhoqzgQy1XmzQLq/Hda79TDv/X+y QYkGzf9QuGri/g74YIW0RLg4+viGoX8EznWhk/iwTdqzKTY/TGTP9l39i/sjjVZCymMaRXKcU hWd9xe/CytjJQVEESzy7HwXR49xuYAUAQnXicwFPggnEsPjyp/38HN0NqgBjfk6wzsq3D+wGu ApYjZMDAZzPIkM+6AU6nk1wX2XMGJ+biMXao9uGZOAvxnLDqfxx7ZIfEYKuj3Ucw47QyrtYUW AeO9qzRnfuoCKsoANRvVS54n9QjkGc9pkDdRDgsUoCufWGIO8O7Gurzrxx2jm4KnPJ9vx4yX1 mceISsK3+lLgu6ujHKd4Po36fdDdAEAqUqDXpbFN3FzyzWAgB8hV+oM4JATl2HiBRRgE= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 217.72.192.75 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:205344 Archived-At: This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --aFLdXr77u3RQKUVndKmd6MIsRU3SIEc8M Content-Type: multipart/mixed; boundary="enithdG2cnQGLD1aVBU847hcQQvIh6hq4" From: =?UTF-8?Q?Cl=c3=a9ment_Pit--Claudel?= To: Keith David Bershatsky , Stefan Monnier Cc: emacs-devel@gnu.org, Eli Zaretskii Message-ID: <577E7E69.6090000@gmail.com> Subject: Re: Use cases for post-redisplay hooks References: In-Reply-To: --enithdG2cnQGLD1aVBU847hcQQvIh6hq4 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable 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=C3=A9ment 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 gen= eral, 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' f= lag to t, and after completing the calculations (from whichever other hoo= k you're using for them) switch `needs-recalculation' to nil. If the func= tion 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=C3=A9ment. --enithdG2cnQGLD1aVBU847hcQQvIh6hq4-- --aFLdXr77u3RQKUVndKmd6MIsRU3SIEc8M Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.22 (GNU/Linux) iQIcBAEBAgAGBQJXfn5pAAoJEPqg+cTm90wj5n4P/0ecSv5i9Na4OQfNk8ZFFp96 sMmKfSFBICviC3NggGz+E6taUYMejR6447V1TuNJJBoP0D49t0GEWgMXFSRknpAF oG6KGYqym8CXj5afKi335UvXKVYquIcK5KV3gWA57/gqrUj8sq50R2BwleFBJs/y u0FCehV/xpzhWok/f4iPIjMOA87MTipUu5XtCIh8lI+PKvSB5Bp+UvjKKPAn46t9 sLbPVjAKPpRzcqnIFOtjnmuSfNdKqxzBnsd6MYwkOvjl+s9W5E2JdTeMwmD2Ml2t RNksSGpZCfbZkP0llIhRdfe9QFGyGaY0e4u+IhERV9C3lLkY30EEViIOfvGUV2/R 0kjjzdMiMjM8vONnYHgIMXmJ6vAeaJs50HtTg7AzLs9F2E5FYxyoW02WNSwKjuhX h+aTcRFGpk5vUqIyL9Zy11nIdJHq5rfMNLCHSiqnYNLc3+LJehEvDkIP6YxKpUkZ 2B2ClPg9e/ZaVja/a4OoTBbCdsubrwNSSo0qc33bteWH+IqZ22wsqMdwuEmCU38S Qj6oQ7suAkPfVUvpjarJ6PegbJnE1ZlwLrwMJ0g0DyTAcq2BxR3AveW1okq+oL9i BihKYJ68xsypCyfmNEDMHdecMrYGOj/JYqZdX41aNmzkHXuAj9/OpP2NW8FhWrVJ 7ecdRNxLKQGtGVMisxNi =gCoJ -----END PGP SIGNATURE----- --aFLdXr77u3RQKUVndKmd6MIsRU3SIEc8M--