all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Clément Pit--Claudel" <clement.pit@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: emacs-devel@gnu.org
Subject: Re: Redisplay hook
Date: Sun, 3 Jul 2016 20:05:17 -0400	[thread overview]
Message-ID: <5779A83D.6020201@gmail.com> (raw)
In-Reply-To: <83twg7qi5t.fsf@gnu.org>


[-- Attachment #1.1.1: Type: text/plain, Size: 1466 bytes --]

On 2016-07-03 03:45, Eli Zaretskii wrote:
>> Cc: emacs-devel@gnu.org
>> From: Clément Pit--Claudel <clement.pit@gmail.com>
>> Date: Sun, 3 Jul 2016 00:36:07 -0400
>>
>> It's true :) I'd like to make screencasts (gifs) by saving a picture of an Emacs window or frame after each redisplay (I tried a number of programs that record screencasts, but they all gave disappointing results; by saving a picture (and a timestamp) after each redisplay, I might get much better results).
> 
> As a temporary measure, try calling your code from the function
> update_end (you will have to modify the C sources for that).

Thanks for the pointer. I applied the attached patch, and it works very nicely. Could we refine it into a proper feature and apply it to master? Or are there reasons against a post-display hook?

> I think such an application needs to hook into the GUI system, not
> into Emacs.  That's because, at least on X, AFAIK Emacs doesn't
> necessarily flush the queue of X commands each time it finishes
> redisplay, so you may be disappointed by the results anyway.

It actually works very nicely :) Out of luck, maybe? In any case, I've uploaded a screencast generated by saving a screenshot at the end of each redisplay cycle to http://web.mit.edu/cpitcla/www/emacs-screencast.gif . Let me know what you think! It behaves nicely wrt, for example, the pulsing of xref-find-definition or the animations of M-x butterfly.

Cheers,
Clément.

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.1.2: 0001-Add-a-post_display_hook.patch --]
[-- Type: text/x-diff; name="0001-Add-a-post_display_hook.patch", Size: 1234 bytes --]

From c9cfc3e17b5bddb3a19951344da8d1c947d56643 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Cl=C3=A9ment=20Pit--Claudel?= <clement.pitclaudel@live.com>
Date: Sun, 3 Jul 2016 19:58:35 -0400
Subject: [PATCH] Add a post_display_hook

---
 src/xterm.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/src/xterm.c b/src/xterm.c
index 9fb19a1..f8e3ef0 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -1230,8 +1230,11 @@ x_update_end (struct frame *f)
   XFlush (FRAME_X_DISPLAY (f));
   unblock_input ();
 #endif
-}
 
+  block_input ();
+  run_hook(Qpost_redisplay_hook);
+  unblock_input ();
+}
 
 /* This function is called from various places in xdisp.c
    whenever a complete update has been performed.  */
@@ -12739,6 +12742,12 @@ With MS Windows or Nextstep, the value is t.  */);
 #endif
 
   DEFSYM (Qmodifier_value, "modifier-value");
+  DEFSYM (Qpost_redisplay_hook, "post-redisplay-hook");
+
+  DEFVAR_LISP ("post-redisplay-hook", Vpost_redisplay_hook,
+    doc: /* Hook run at end of redisplay.  */);
+  Vpost_redisplay_hook = Qnil;
+
   DEFSYM (Qalt, "alt");
   Fput (Qalt, Qmodifier_value, make_number (alt_modifier));
   DEFSYM (Qhyper, "hyper");
-- 
2.9.0


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

  parent reply	other threads:[~2016-07-04  0:05 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-02 19:24 Redisplay hook Clément Pit--Claudel
2016-07-03  3:27 ` Eli Zaretskii
2016-07-03  4:36   ` Clément Pit--Claudel
2016-07-03  7:45     ` Eli Zaretskii
2016-07-03 14:23       ` Clément Pit--Claudel
2016-07-03 14:51         ` Clément Pit--Claudel
2016-07-03 15:37         ` Eli Zaretskii
2016-07-04  0:05       ` Clément Pit--Claudel [this message]
2016-07-04  2:41         ` Eli Zaretskii
2016-07-04  4:31           ` Clément Pit--Claudel
2016-07-04 14:47             ` Eli Zaretskii
2016-07-04 16:14               ` Clément Pit--Claudel
2016-07-04 16:24                 ` Eli Zaretskii
2016-07-04  7:55           ` Stefan Monnier
2016-07-04 14:52             ` Eli Zaretskii
2016-07-04 16:07             ` Clément Pit--Claudel
2016-07-04 20:37               ` Robert Weiner
2016-07-04 21:00                 ` Clément Pit--Claudel
2016-07-04 21:28                   ` Robert Weiner
2016-07-04 21:50                     ` Clément Pit--Claudel
2016-07-04 21:29                   ` Drew Adams
2016-07-04 21:36                     ` Clément Pit--Claudel
2016-07-04 21:57                   ` raman
2016-07-04 22:11                     ` Clément Pit--Claudel
2016-07-05 22:59                   ` Richard Stallman
2016-07-05 23:47                     ` Clément Pit--Claudel
2016-07-03 22:34   ` Richard Stallman
2016-07-04  0:09     ` Clément Pit--Claudel
2016-07-04  2:42       ` Eli Zaretskii
2016-07-04  0:22     ` Mark Oteiza
2016-07-04  2:42       ` Eli Zaretskii
2016-07-04  7:59         ` Andreas Schwab
2016-07-04 14:52           ` Eli Zaretskii

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=5779A83D.6020201@gmail.com \
    --to=clement.pit@gmail.com \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    /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.