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: Redisplay hook Date: Mon, 4 Jul 2016 17:00:18 -0400 Message-ID: <577ACE62.8030504@gmail.com> References: <577814F4.8060500@gmail.com> <8360sns8nj.fsf@gnu.org> <57789637.8020204@gmail.com> <83twg7qi5t.fsf@gnu.org> <5779A83D.6020201@gmail.com> <83twg6p1kd.fsf@gnu.org> <577A89CB.7050502@gmail.com> <7B54BCE8-0822-4BFF-A6B4-6A6284814CC8@gmail.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="2ipCtsDtT7G48oE8wJ90IIwaLaB9sAHmT" X-Trace: ger.gmane.org 1467666053 18662 80.91.229.3 (4 Jul 2016 21:00:53 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 4 Jul 2016 21:00:53 +0000 (UTC) Cc: Eli Zaretskii , Stefan Monnier , emacs-devel@gnu.org To: Robert Weiner Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Jul 04 23:00:44 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 1bKAyw-0001UO-8A for ged-emacs-devel@m.gmane.org; Mon, 04 Jul 2016 23:00:43 +0200 Original-Received: from localhost ([::1]:50488 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bKAyv-000180-FS for ged-emacs-devel@m.gmane.org; Mon, 04 Jul 2016 17:00:41 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:58886) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bKAyp-00016w-Pr for emacs-devel@gnu.org; Mon, 04 Jul 2016 17:00:36 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bKAyn-0004DY-GF for emacs-devel@gnu.org; Mon, 04 Jul 2016 17:00:34 -0400 Original-Received: from mout.kundenserver.de ([212.227.17.10]:53204) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bKAyg-0004Cd-Eb; Mon, 04 Jul 2016 17:00:26 -0400 Original-Received: from [18.189.1.110] ([18.189.1.110]) by mrelayeu.kundenserver.de (mreue104) with ESMTPSA (Nemesis) id 0MPGgy-1bFnGP1dUu-004OxA; Mon, 04 Jul 2016 23:00:21 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.8.0 In-Reply-To: <7B54BCE8-0822-4BFF-A6B4-6A6284814CC8@gmail.com> X-Provags-ID: V03:K0:jUMq2CUhTXlGU6IQfPgABYMFLOXLV7hmpSbsjOmNEd2OgMGi0wV CWCRVH7u/AmzSbKUV1SkcKmPaSJmcZG6vxefT/Q+bhwKqVmtxeqDnNWe6JeopnCxsNtjmgE Pte9k6ueMq9nf9PEWKXJ12a3lhV1qP+weD7oGVB/95kb3Lf61fBvQgtBDKgXdjWjnPI03Xr W0h/P9qG4EE15hKVc17QA== X-UI-Out-Filterresults: notjunk:1;V01:K0:tP9V130OSmQ=:q2VI2vuJRzW+9TzvsFULaA shCMYQWzpHvSBWpacNUoLJn2Q1NwCEDylpG6jiGqJrv/YZM/VNq811cQ2ZEj2n3tHYRGCOdI9 uSbjvfJX2em6Zv2gCmz5RtdU7LAeaJXo53pym9Vk0MVVs7r+Bz0i+eEVNN5B+mUwYngyY4mmy IFPRh8Sht3MA/aR+xMadExrL6ednMX5NdCKY6UDFbnnsc7obHxGDMPCdzB9NGuMsaNfvupIjJ rtLckHvLoVcavd5MKXcJ5KvanJ0L/gmS1FUwxBQAaQAjnN7GWLqluoOkiUDhNViAAplHNhgsr As2q6nQJXSYsVRpaqudcMNM6/Ti9nAG1HEs/s4fi8kntv/YGqR1lYZlRLbvfRegjHWo8z+/aQ T8EY4eioWKi5PSq2ImXyBO803Npez3jfjiVwt+eGHREFVANqMsbgxEitMdVZElmtz6z6sw6S/ 5wcyCoYb+0XonH5dRhvQfsi/tUEYwIfVmiRxC8+c1/dE2U4PjW0JEOwVBL4CJW3Zv+YKv6oUU WnrD/hY7CHaZwtTeCxs8i7x5nrVOU6lr4R9BP5VC8J7cn704LAnUogzOFtiU3SKR6Q5iiQp75 UeyliaD1n4fBwqj8I3yjBHS+0fDMrQxvr/O47YR/5rrr8Fwx0Z6tHazRrLIxCt7cCi+/5/HyG NxfOu0UVotKE16j/cFFEntHbtXa6/wHwckkc2fyU1vuH2u1mnCoIEHsZHfNfoLVquhUQ= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 212.227.17.10 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:205147 Archived-At: This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --2ipCtsDtT7G48oE8wJ90IIwaLaB9sAHmT Content-Type: multipart/mixed; boundary="nq16cFFdJD9EwGot2mV6pWsNJdBQVBdIX" From: =?UTF-8?Q?Cl=c3=a9ment_Pit--Claudel?= To: Robert Weiner Cc: Stefan Monnier , Eli Zaretskii , emacs-devel@gnu.org Message-ID: <577ACE62.8030504@gmail.com> Subject: Re: Redisplay hook References: <577814F4.8060500@gmail.com> <8360sns8nj.fsf@gnu.org> <57789637.8020204@gmail.com> <83twg7qi5t.fsf@gnu.org> <5779A83D.6020201@gmail.com> <83twg6p1kd.fsf@gnu.org> <577A89CB.7050502@gmail.com> <7B54BCE8-0822-4BFF-A6B4-6A6284814CC8@gmail.com> In-Reply-To: <7B54BCE8-0822-4BFF-A6B4-6A6284814CC8@gmail.com> --nq16cFFdJD9EwGot2mV6pWsNJdBQVBdIX Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 2016-07-04 16:37, Robert Weiner wrote: >> Additionally, since Emacs is driving, I can record plenty of >> per-frame data, such as which key is being pressed with each frame. >> Here's an example, which was fairly easy to assemble using this new >> hook and a bit of ImageMagick: >> http://web.mit.edu/cpitcla/www/emacs-screencast-annot.gif (it may >> take a bit of time to load). What do you think of the result? >=20 > This is great and I would love to see this as a package and see it > explained in more detail.. A simple way to capture Emacs > screencasts, potentially with an audio overlay, would lead to many > more demonstrations of Emacs packages leading to broader > understanding and usage. Thanks Bob :) Here's a quick outline of how it's done; hopefully we can implement the necessary hook, and then I'll make an ELPA package out of i= t. Essentially, my code adds two hooks: - A pre-command-hook, to update a variable tracking (this-command-keys-ve= ctor) - A post-display-hook, to capture screenshots. The post-display hook records the current time and the current value of (this-command-keys-vector), then synchronously calls =E2=80=98xwd=E2=80=99= to take a screenshot (=E2=80=98import=E2=80=99 would also work, but it is much slower). The re= sulting file name is saved into a list of captured frames (annotated with the current time and= value of (this-command-keys-vector)) Finally, to finish the capture, I run a humongous ImageMagick command to = stitch together all frames and add text overlays. The delay between consecutive= frames is computed using the timestamps recorded in each frame. The implementation of the full thing is pretty short (about 200 lines), a= nd it works fairly well. The one downside is that the temporary files that it generates tend to take a lot of space (about 3.5MB per screenshot). Savin= g compressed screenshots is possible, but it tends to slow Emacs down more significantly. Of course, one could imagine capturing uncompressed frame= s, and compressing them in a separate thread; I have not investigated this optio= n yet. Alternatively, one could measure the time taken to capture the frame, and= adjust inter-frames delays in proportion when generating the movie. I'll send the code once I have a bit of time to clean it up. Cheers, Cl=C3=A9ment. --nq16cFFdJD9EwGot2mV6pWsNJdBQVBdIX-- --2ipCtsDtT7G48oE8wJ90IIwaLaB9sAHmT 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) iQIcBAEBAgAGBQJXes5iAAoJEPqg+cTm90wjoakP/i02CejDZrXYKeWJhZLpIFJh q19SXrx82yGqjsIztd9JjsNvo2M9dmlaN7XTVL2o0UQtoArIleMfnGdOYybTSBeE HbYuB+nhR2LZWM6FV9u9l+KkNskvKgf/kkbdTbNYw46NLC0rmCbkfs4llfjqay3m AFTQbyYVzx4hgJk6XPNk58VWpc2KFR35rhdjXtSMPjDZHsLUvnYgM7tNLz8jN1DP n5l6ZUSCY69AEB0cdyFc9vM9q9hFBUkmtmrb101LFE/siezrtMpZ9ADJ5nHdgE7G xgN54+QFuqd7wOaBC3GoOJ5A8aDudOJZwer7E5CX5hyNJKDac4i6OB835hI934Vf 8O0wZLXgTgDC+mVLg8eZqgXMDavJYSc5wemQ9BObdM1afYBTfNonjQfYaDOj/Nv2 wXMePWicgGyZju4WB703Rr2hMPtIY49Vq0VA8meZS4aTI0X+HrUVdyYcJvor9o7m dJmSzgl0rIPGEFzdi5c7Xq5vZiESn5FtjUoChN3cRRRs6IoEhCU0ejQ2Ix9PaFKL B3phvJ542a3hVOwF8fWLqdisIdEtoKI3kiCpgPANx0nbk322No/3bx0KN97QmBEc ZbxBJYQUX6C/fss0+GWJy8/4xWtn90YngLZ5Xgjx9m+OYbpAdVHP540FKh70C/sM aFVOi54FEETWEUEi89Be =TyWt -----END PGP SIGNATURE----- --2ipCtsDtT7G48oE8wJ90IIwaLaB9sAHmT--