From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Evgeny Zajcev Newsgroups: gmane.emacs.devel Subject: Re: Lazy image converters Date: Mon, 17 Feb 2020 14:02:37 +0300 Message-ID: References: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="000000000000eb7ea4059ec37e30" Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="109715"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Mon Feb 17 12:05:06 2020 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1j3eD4-000SR0-08 for ged-emacs-devel@m.gmane-mx.org; Mon, 17 Feb 2020 12:05:06 +0100 Original-Received: from localhost ([::1]:43582 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j3eD3-0003L8-1p for ged-emacs-devel@m.gmane-mx.org; Mon, 17 Feb 2020 06:05:05 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:35546) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j3eAu-00018e-4R for emacs-devel@gnu.org; Mon, 17 Feb 2020 06:02:54 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j3eAt-0004Ex-0h for emacs-devel@gnu.org; Mon, 17 Feb 2020 06:02:52 -0500 Original-Received: from mail-lj1-x231.google.com ([2a00:1450:4864:20::231]:35970) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1j3eAs-0004DS-NB for emacs-devel@gnu.org; Mon, 17 Feb 2020 06:02:50 -0500 Original-Received: by mail-lj1-x231.google.com with SMTP id r19so18337838ljg.3 for ; Mon, 17 Feb 2020 03:02:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=PygqKo+GWn/Tn2OFGUNBiBlhTkySNPCSMwSwjzdcO5U=; b=N6WBU4Kie3RHBYHCho38ZdyH0oOYhL+iSwRfp8RdC0W1ms32yjzEwArUGBMr2EQAhm 3TrSw+rT7FM67HOR4lwuAY4iLcYJ5rEujnQ5TBJ/K8atCmfvvGF1Ts2oW15SRLVG0Q1I gnGEPiPpqOV4TZxAU6bhHP7cqWMoz3vUwfL8D9MdEnaWHeJZYPqmHf8tMo9P2Enfy3KT wV5XMZ8HC6oxuugiOe2BhZW4eviTC7KnkRqTxiDlyM6VdoUZtnTuUgk2DYGDyL0qxJW3 vMvRkMxc3nHJZezxZsCfFxuLhlNc5yJUo7KUofOOsOnFSzQr0ASjm03KtvFr/N8V5rFS jT/A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=PygqKo+GWn/Tn2OFGUNBiBlhTkySNPCSMwSwjzdcO5U=; b=tNp+vJPtZGi6g91n8faR4MzbxhTukgKOxdTJukS9v+JwSXV8IUVY9F77vMZuExlTo3 WBJrIGVytX5Xt6F5KXlDkenJVNFQ60hxaOWyBecGg0nUUn3Bgv6b/iTDvPozyG98/oe9 0oJihInXBD2VuVI+08Y6fR3EZvxGSFTZwDmJlTMJ1m5PGxO505N7Zdq/yJZqTFBy4V+x dwyYRFgBoemd8r/oahFIwc/M3dYWjs8KGiUPyz5jMsryoN6WdzSlh8e4JjYECmrA8Nw+ CKLOo1dMtsldH48BVGE0e/mHMF9rhmUBh1dg0zfQG2rcCI+8bCcXNUM9B8oF1QcsibuP 3pCA== X-Gm-Message-State: APjAAAVzoc6bcSK6dyqvpcvSW1IA/WWK776K9gBH9MqNepk0pVinDjGc HB/tEd1TpZzqAc6buDMVMDWVPv6wVpmeaCTs591V0Q== X-Google-Smtp-Source: APXvYqxkgMFeoW3DmG4YzDOc/8AuNOu06LgCjZcIiBkJhN3zkotuo/xOhZ+o1AKlsPVXRGD5HP78WNY0a+XdpBFrrzw= X-Received: by 2002:a2e:8188:: with SMTP id e8mr9683683ljg.57.1581937368726; Mon, 17 Feb 2020 03:02:48 -0800 (PST) In-Reply-To: X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::231 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 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-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:244978 Archived-At: --000000000000eb7ea4059ec37e30 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable =D0=B2=D1=81, 16 =D1=84=D0=B5=D0=B2=D1=80. 2020 =D0=B3. =D0=B2 18:20, Stefa= n Monnier : > > What if we have a lazy image, so its FILE-OR-DATA is calculated at > > redisplay time. 'image-convert' could utilize this. One of the > approaches > > to lazy images is to allow FILE-OR-DATA to be a function returning actu= al > > file or data. Redisplay could call this func and substitute the value = of > > FILE-OR-DATA in image spec with the results, kind of caching the result= s. > > It's definitely worth a try. > I just realized another benefit of such an approach. There is a long-standing bug in Emacs - when an image file is silently removed, there is no way to hook on this, so empty square displays in place of the image. In case of the function as FILE-OR-DATA, redisplay may call it once again if corresponding image file has been removed. Maybe we can do that using the existing jit-lock hook? > I'll look at it, thanks --=20 lg --000000000000eb7ea4059ec37e30 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable


=
=D0=B2=D1=81, 16 =D1=84=D0=B5=D0=B2= =D1=80. 2020 =D0=B3. =D0=B2 18:20, Stefan Monnier <monnier@iro.umontreal.ca>:
> What if we have a lazy image,= so its FILE-OR-DATA is calculated at
> redisplay time.=C2=A0 'image-convert' could utilize this.=C2= =A0 One of the approaches
> to lazy images is to allow FILE-OR-DATA to be a function returning act= ual
> file or data.=C2=A0 Redisplay could call this func and substitute the = value of
> FILE-OR-DATA in image spec with the results, kind of caching the resul= ts.

It's definitely worth a try.

I just= realized another benefit of such an approach.=C2=A0 There is a long-standi= ng bug in Emacs - when an image file is silently removed, there is no way t= o hook on this, so empty square displays in place of the image.=C2=A0 In ca= se of the function as FILE-OR-DATA, redisplay may call it once again if cor= responding image file has been removed.

Maybe we can do that using the existing jit-lock hook?

I'll look at it, thanks

--
lg
--000000000000eb7ea4059ec37e30--