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 15:44:13 -0400 Message-ID: <577EB10D.9060505@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="DERQSX4hFcjnboeTmgu12GbxbdIlPkhmI" X-Trace: ger.gmane.org 1467920716 3942 80.91.229.3 (7 Jul 2016 19:45:16 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 7 Jul 2016 19:45:16 +0000 (UTC) Cc: Eli Zaretskii , Stefan Monnier , emacs-devel@gnu.org To: Keith David Bershatsky Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Jul 07 21:45:07 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 1bLFEQ-0006VB-FH for ged-emacs-devel@m.gmane.org; Thu, 07 Jul 2016 21:45:06 +0200 Original-Received: from localhost ([::1]:41961 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bLFEP-0007h9-E2 for ged-emacs-devel@m.gmane.org; Thu, 07 Jul 2016 15:45:05 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:45786) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bLFDs-0007gr-0R for emacs-devel@gnu.org; Thu, 07 Jul 2016 15:44:33 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bLFDq-00009Z-29 for emacs-devel@gnu.org; Thu, 07 Jul 2016 15:44:30 -0400 Original-Received: from mout.kundenserver.de ([212.227.17.13]:58375) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bLFDj-000083-PN; Thu, 07 Jul 2016 15:44:24 -0400 Original-Received: from [18.189.62.212] ([18.189.62.212]) by mrelayeu.kundenserver.de (mreue103) with ESMTPSA (Nemesis) id 0M1hZS-1ba2Je30n4-00tk07; Thu, 07 Jul 2016 21:44:17 +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:2HCwUKPw0OnRDu5iocaN1Q1ReKPzamhLIrUgHDQ13L15eqBGiYX Y2ZohRyacWD7wLF4AYon1BedreG7fX7TkaZLtt1vPV0Iru4rk0OtSwKveqjcpVVRvMWqGPL eiR7+bQMp6ARZ1uNoS1FNdU2E7g/fuvrIK21v9DdaJw59i+7eD/lbhyeRsw21tpQp2p5C+L HhTZlyig0hRbZuZuz5nCw== X-UI-Out-Filterresults: notjunk:1;V01:K0:BhOqH3u9Krg=:9y8KflxN7yGkQuqM+bAJqm Z0Dat6YezSLJS6yvNduBLDmQ0q5BIux8ZRnHyjEf2BHXVeMy+rprc33GGcdJOC2WigTPW0GtD GmsiDK/DP7SgkdBOHTwVCbU9DuC1LbYtZOkAbUSPz7BpStSHDbmt6Fww/p81gi2B2GqpO9Ca8 1b2ZzqYGGHcwYBjAA0nTsOtjz2ZpMad4SPOs02E2cQNSLbf/xdeRWemeADIrm6O+QBhsaydUY Q4+qANPxsmpnQEKXryogKHM8PKfHjqcvsLs9/o9KAPpHKPbOVc+8MUOS0EOW1FXjDZ6mYqXYl +WLCJvT1DnGdTiiQ7LOfGzJWObz3R0KGlo1IpiVD1jL6RxROm0Z2mwkzFHjBez1ubbr9pYpha iNJduWxJPltxQGUdda8U16gV9EBNT1RlUpV9UAnp/3U5ktOLYKKc38dK3AzhkYU4FUHzl//Fa 5dbz24H5B2M++oSbaRIfV8J0k6MiRD6ARLEE0RT4JvpjV8Pce5E7YE6A96HToHbHQLzMLCx/A EtskHxjtfUeyZmB0aqdBf7QWyUY0fiedU/xESSR9XRZlyhmtZRahlBIMmhBrM7x3s4BtUYJ8n 4567bdmAxwFv0dGd67gFz8XysoxmscBtG+Cp2qyQIO8JCzvpzmB+2hpzmjWR34vdblwN/aFeU ziKcL/+60ILZ+p9rBGJfXd28/wy9J4F+YpIzqUB8dRHz7tktHoqb/cE5ITgqMXnAGe3E= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 212.227.17.13 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:205371 Archived-At: This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --DERQSX4hFcjnboeTmgu12GbxbdIlPkhmI Content-Type: multipart/mixed; boundary="kNFcR9Wto9hhWBnpbasfp0JFX3qr0CsMI" From: =?UTF-8?Q?Cl=c3=a9ment_Pit--Claudel?= To: Keith David Bershatsky Cc: emacs-devel@gnu.org, Eli Zaretskii , Stefan Monnier Message-ID: <577EB10D.9060505@gmail.com> Subject: Re: Use cases for post-redisplay hooks References: In-Reply-To: --kNFcR9Wto9hhWBnpbasfp0JFX3qr0CsMI Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable But I meant =C2=AD=E2=80=94 can't you update this flag yourself, and do a= t 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 th= e 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 u= pon those values being correct. A counter, however, may not be a reliabl= e indicator of the above test. >=20 > [My assumption is that overlays could be placed before the screen visua= lly refreshes, so that the overlays are visually present when redisplay f= inishes.] >=20 > Keith >=20 > ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; >=20 > At Thu, 7 Jul 2016 12:08:09 -0400, > Cl=C3=A9ment 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=C3=A9ment had initially categorized m= y >>> 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 th= ere 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 f= unction doing the calculations is called when `needs-recalculation' is ni= l, then can exit immediately. >> >> Or is there something more complex that I'm missing? >> >> Cl=C3=A9ment. >> >> [2 OpenPGP digital signature ] >=20 --kNFcR9Wto9hhWBnpbasfp0JFX3qr0CsMI-- --DERQSX4hFcjnboeTmgu12GbxbdIlPkhmI 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) iQIcBAEBAgAGBQJXfrEOAAoJEPqg+cTm90wj20AP/AnS/KMABecrm6a7rpLyzuv6 tg34H1aBnqjf5FRgyd8TcqPahl5sgBq7/lMv3jaICcb/9Aw7xgnE7M/iQw3HCqK1 dIkse7L0RLAiovzL1Sewfo+49VZhdU25uflfpW2+NMUfdBYsLHGMqyKtcHCmATOn Yksj5x7iMrheFgVv2X4ANHHasw3WadZr8wiRSCnMNuaqd3B1LS11OXTkEBpSSVtF UrzJc9nkcQK0SO7edIhdRgj8zVGcigcdShv5WmFukWSru9CzlzFdUaIclHd6lFWs j+vwmtYycgNJg7H1qfwvUdVH0G3hL2U/oXnssjXC8aNJrG2hqF4YdQHBecKEq4Bi bd8nBlpjgFkJyTLB78NcRAFSAPt5Xlh5wniLD2oAoV9IrsCik5to4NRUvUxsHZk7 zRbL32i28dh5AJ1daQYUS5YCnnQGh8O31xUFzjS/sdKhHRga5rNCECfH5F9944zW 4hx7OUFFJoSH6Df+Vf2tBGq9u6P1BE/fECbWlyMWARQ5amFSmWY+EVr41pi+hBBy 00fB1uiP/SNL3QqIiwXZsmZ9ARtTxLbI6Wo+GF7Ah4/8OBS92MVBE2rSvuEewf9s ddT7gouCToI++bkPWHEPZ4a/mLJhaKTVky4Zfvk8r/D5GXddYFd9FZQv6MS/xMT8 1NWztEtzmMn2m+oEAWky =xWqT -----END PGP SIGNATURE----- --DERQSX4hFcjnboeTmgu12GbxbdIlPkhmI--