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: Lazy image converters Date: Wed, 12 Feb 2020 17:11:02 +0300 Message-ID: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="000000000000873a49059e618b79" Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="51393"; mail-complaints-to="usenet@ciao.gmane.io" To: emacs-devel Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Wed Feb 12 15:11:50 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 1j1sk2-000DHV-9Y for ged-emacs-devel@m.gmane-mx.org; Wed, 12 Feb 2020 15:11:50 +0100 Original-Received: from localhost ([::1]:38634 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j1sk1-0005Dq-B2 for ged-emacs-devel@m.gmane-mx.org; Wed, 12 Feb 2020 09:11:49 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:43901) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j1sjV-0004mf-6w for emacs-devel@gnu.org; Wed, 12 Feb 2020 09:11:18 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j1sjU-00049A-7a for emacs-devel@gnu.org; Wed, 12 Feb 2020 09:11:17 -0500 Original-Received: from mail-lj1-x229.google.com ([2a00:1450:4864:20::229]:40685) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1j1sjT-00047Q-UO for emacs-devel@gnu.org; Wed, 12 Feb 2020 09:11:16 -0500 Original-Received: by mail-lj1-x229.google.com with SMTP id n18so2468062ljo.7 for ; Wed, 12 Feb 2020 06:11:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=UooANAzBPsdwT2ocDzgBEZlNWB/H11X6MzMAvASmSo0=; b=ra+et/u/WwBEctTQmu/vdx4dNXAltSDuLDcIbTVZgSEySp4xwfwMM5YcOTCbEsBzpF kMpxNeu+r7zSGb3QamnkavGB11b+wbcVyvP45DMOiqVH0IdVQXYhHN4uMSAJh1oHHAmi PZfHLRMbZyCDYGrIXxlIkockWc1WoiXbVRXKQhtd95RKzapqH/+fAn+e+SjO4nGM8yjf mn4QKuNVBpNPm3MqM98LIHS/xvzWI3xdhew0O1Rl3jTJrv0vZ9t0hH8JizjEgxsfoqgo Mg3hFIPBlsf/c2gIVVb3hozNwt6JBs1WH0uRfcjR7pWC2cef4mGg6YQwOkZqYhj2LP5S EUqA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=UooANAzBPsdwT2ocDzgBEZlNWB/H11X6MzMAvASmSo0=; b=QfwOi/INJIQSn1m7+vxbMd4fu4BlB5qhvtwrGqCyMJrNaI13/7YTiCatPF7Tcx8KsM QjehKEj67MhSTfuVP6SKfW75VT95BN7tGQkdhC59m1+5qf8qcp/haOfLYcYITMO46EKW czWQcnsMPLq9OLjKBIIDNB0ugvXSc32/UaqY5+pPi9yDeJUIiNiJdo1y21Q3EQE/P8nm yOLZUN59F7JtSh4mpqVupK4NhYcvXsuGxh6aHJoOGh7aGiOJuwBV1T2e9MjSNI0OM88t qZ1Xt7fyqi5IStTKUH8k0pz6suFNdW4sbP4Mirfb3OmQ2HYZm+qSj6RUT3NG/W0OGf2W 3aOA== X-Gm-Message-State: APjAAAXi13zjVRHMLyzih3oFq6wXIxZVfNlfQXNUQqdBt4ef71T7O/9h djLeYBzr1mzWSJ9OkLtrTuMdqnwnLpLoVi7Yxmd1ug== X-Google-Smtp-Source: APXvYqyJzzeKOvPUUHdDq4ajtrBK/ubXKVOx6lSQ+YMgXM2MjaQY1y24/Y5GW1j2fxeTXsk0+rC/1fhJqRGKBJqkVp4= X-Received: by 2002:a2e:8e2a:: with SMTP id r10mr7530727ljk.219.1581516673463; Wed, 12 Feb 2020 06:11:13 -0800 (PST) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::229 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:244915 Archived-At: --000000000000873a49059e618b79 Content-Type: text/plain; charset="UTF-8" It is a nice feature in Emacs 27 - 'image-convert' type for the images. To convert unsupported images to format Emacs can understand. Normally image creation (with 'create-image') is a very lightweight process, Emacs don't read the files or do any heavy things. All heavy things are done in redisplay, so you could create and insert 1000 images in the buffer with a couple of them visible and this will be fast. However, with 'image-convert' images, this won't work, because heavy things are done in the 'create-image', not in redisplay. So Emacs will convert 1000 images at once. 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 actual 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 results. What do you think? Thanks -- lg --000000000000873a49059e618b79 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
It is a nice feature in Emacs 27 - 'image-convert'= type for the images.=C2=A0 =C2=A0 To convert unsupported images to format = Emacs can understand.

Normally image creation (with '= ;create-image') is a very lightweight process, Emacs don't read the= files or do any heavy things.=C2=A0 All heavy things are done in redisplay= , so you could create and insert 1000 images in the buffer with a couple of= them visible and this will be fast.

However, with= 'image-convert' images, this won't work, because heavy things = are done in the 'create-image', not in redisplay.=C2=A0 So Emacs wi= ll convert 1000 images at once.

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 actual 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 results.
=

What do=C2=A0you think?

T= hanks

--
lg
--000000000000873a49059e618b79--