From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: How to find out whether an image is displayed anywhere? Date: Mon, 04 Jul 2011 15:15:54 -0400 Message-ID: References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1309807138 19270 80.91.229.12 (4 Jul 2011 19:18:58 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Mon, 4 Jul 2011 19:18:58 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Jul 04 21:18:52 2011 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1QdofU-0007eU-Bq for ged-emacs-devel@m.gmane.org; Mon, 04 Jul 2011 21:18:52 +0200 Original-Received: from localhost ([::1]:48381 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QdofT-00007W-Af for ged-emacs-devel@m.gmane.org; Mon, 04 Jul 2011 15:18:51 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:60366) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qdocf-0007vg-LL for emacs-devel@gnu.org; Mon, 04 Jul 2011 15:16:01 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Qdoce-0004Ha-AL for emacs-devel@gnu.org; Mon, 04 Jul 2011 15:15:57 -0400 Original-Received: from ironport2-out.teksavvy.com ([206.248.154.183]:4712 helo=ironport2-out.pppoe.ca) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qdoce-0004HN-1E for emacs-devel@gnu.org; Mon, 04 Jul 2011 15:15:56 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AtwHACMQEk5FxIxr/2dsb2JhbABTmQmOcniIesEkhjYEnlyELA X-IronPort-AV: E=Sophos;i="4.65,474,1304308800"; d="scan'208";a="120408838" Original-Received: from 69-196-140-107.dsl.teksavvy.com (HELO pastel.home) ([69.196.140.107]) by ironport2-out.pppoe.ca with ESMTP/TLS/ADH-AES256-SHA; 04 Jul 2011 15:15:54 -0400 Original-Received: by pastel.home (Postfix, from userid 20848) id 774F058DBA; Mon, 4 Jul 2011 15:15:54 -0400 (EDT) In-Reply-To: (Lars Magne Ingebrigtsen's message of "Thu, 30 Jun 2011 20:44:59 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 206.248.154.183 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 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-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:141552 Archived-At: >> Or maybe better: after the animation timer fires don't >> change the image yet but instead only remove the fontified property and >> then change the image from fontification-functions). > I'm not familiar (at all) with the jit-lock functions, but if you think > that's possible, I'm all for it. :-) But I'm not the person to > implement something like that. > It sounds like it could be kept nicely local to image.el, though, so the > users of the animated pictures don't have to care. Indeed. It would look something like: - change the code that updates the image so that instead of actually updating the image, it just sets a `image-upon-redisplay-function' text-property on the image, whose value is a function that actually updates the image. - call (jit-lock-register #'image-update-animations) somewhere. - write image-update-animations which just looks for the image-upon-redisplay-function properties in the specified region and calls the corresponding function. There are still some issues with respect to timer management (you may want not to use a repeating timer but instead to re-arm the timer manually from the image-upon-redisplay-function). Stefan