From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0.migadu.com ([2001:41d0:303:e16b::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms13.migadu.com with LMTPS id wF4SOBoRvGayZgEAqHPOHw:P1 (envelope-from ) for ; Wed, 14 Aug 2024 02:06:19 +0000 Received: from aspmx1.migadu.com ([2001:41d0:303:e16b::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0.migadu.com with LMTPS id wF4SOBoRvGayZgEAqHPOHw (envelope-from ) for ; Wed, 14 Aug 2024 04:06:19 +0200 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=ConPeLYo; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org"; dmarc=pass (policy=none) header.from=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1723601178; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=00nHXIwvOnt1n/8mCN5Ca5/kYwBOzG/Y7lF7lpbT3SU=; b=kzD+tSn5I9Nv7PD1dAxArq1Obdulnv87mt7/ItdQeusEOYd7WZxd88LW46sYd0SvqSwYhw 9uqa592Kf8ZUU8QZ1FLB+NYr3ZboPiMe3Svjy8mOzLcmV3T/DO1xy7dSHv1T6ZW0tiqh0u tMHJgXqukt9rcDNHrliKFRhlUcY+1YHxyyeb8Sxu0xskMFrs0YYwsGvAoow5G8VfTM0IzT HSCteBQYNJxKZKTmh0EXGQYG8Hz2f6JVsst5kuWIzqssyTT5uCutwucITR0J9SMHg3C3iv ywreRxZgU/T5NtUK0AKcm94OiBEoudyRlfBylWXCvaB+ggIb3qhtXHxnrgeT7A== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=ConPeLYo; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org"; dmarc=pass (policy=none) header.from=gmail.com ARC-Seal: i=1; s=key1; d=yhetil.org; t=1723601178; a=rsa-sha256; cv=none; b=K7VSmYcq2b5frfbhY+/sNXBw99pLRgmLpZMFChMAy78rYlpIBfprtTKuY6Cq5/AxO1/0Vz z8rw5caXNl142stJrjDxOpN+5amUeiQKkAW5VoH4tvKaz7gc93hZtKs+cnxDEI3OekfQET 6Ow7SFNHgNwDJSWSFW20zMvhIoR0exoFv+U1X2CIAAADFsoO7qG7dlbg3q9387j9k2mGji q6EaCFis1KOV8Qf5aC7E5+NXm/37t+P6MVbHUOFd+trLAqCEGy3durwlANy9O6IKZUfxyF cbNY4kORz7z7WKR12cDLxWH/eZ4sWeAKAiRBJC9WWMbNf3U9evcpRzxm71uaWA== Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 6DC096DC3E for ; Wed, 14 Aug 2024 04:06:18 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1se3OC-0005hQ-GS; Tue, 13 Aug 2024 22:05:28 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1se3O9-0005Sr-47 for emacs-orgmode@gnu.org; Tue, 13 Aug 2024 22:05:26 -0400 Received: from mail-lj1-x22c.google.com ([2a00:1450:4864:20::22c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1se3O6-0006K3-Tf for emacs-orgmode@gnu.org; Tue, 13 Aug 2024 22:05:24 -0400 Received: by mail-lj1-x22c.google.com with SMTP id 38308e7fff4ca-2f0dfdc9e16so71798341fa.2 for ; Tue, 13 Aug 2024 19:05:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1723601120; x=1724205920; darn=gnu.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=00nHXIwvOnt1n/8mCN5Ca5/kYwBOzG/Y7lF7lpbT3SU=; b=ConPeLYoS2nGKqHWD9ncrYNV7cx9Nq1RSTRSa49oF8PJpLrZDk3YUec+gQkRp+/IVA wXl9VI5rofvdxjQchc8J2HSM3g3j8DQtrrXkgdmnxb03KFASea6tmQRrkc+g4ITOzN3G F9gq7W7DRTcZfNt1MLZ51GHwCp96Un6/JFe7xQgtf9BibOPKPECMiTtc4D4ageLWavje 2cRqw6nIgKyEVo73ExJXHDxBHVmghnUbeRaa9AI9G6eoLcPdwqCShqHJofcQsQtLIINV /IO+hg0blOaOOoA/kc9yQJhSp4+5GgzhPB2wSUuDj4FO69Qf3P532rb0/uAs9ZDaXgV4 CW0g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723601120; x=1724205920; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=00nHXIwvOnt1n/8mCN5Ca5/kYwBOzG/Y7lF7lpbT3SU=; b=V+HM7RVOHd563OJNk64AR7YF1HJp5rerOrKG4szEKK3NSNXaDH33AVS68r+M574EI0 90nHMwCXC+8x8o5bc5tWCu685QKAMCLbniqPjapovzlKcRQEiJb7OGkRxoJDj3vtcab/ 97a5p10AD1fg5e+L7b04D0v5ZsOnkzCTScppt0AAU9ehRTXsZ/lTqQOssbmW2xPJxMvg 2t3YyG1SOAAku2ScR32WNnGRGaWBluWsvxqpV6682WrrZN0EG7ewLdqJ2UjkKmevHtP9 xkfG/IrMl1DWlT060WXnmzGObdPq38kEoZtynJI2eZFtXlO5JIY+wF0GOD7J4Oa8U6J2 v39Q== X-Gm-Message-State: AOJu0Yxi11kqYo6ho1mNVDXW1rW0/lpf6LxMhmhYXDvsdbcFpplewIfb Q6BjzSZYfCDTSWEkcXJex4vzmLFVM3TlL2Am8EWQyaMfurCho4YnzgCSbUDNJbVJZ8HGozO0lk8 Bi3ZFkOFmtv3A3a2HxSHEmyzwbg== X-Google-Smtp-Source: AGHT+IHIoI4ZCTpHyFrs76x2xEnQ3Jdc1Et4Jxc9nIfs67idSGrupPGY7f0M340jqX62sl4mVUU7wxdhKO4I22YUTj0= X-Received: by 2002:a2e:b8c4:0:b0:2ee:7a54:3b08 with SMTP id 38308e7fff4ca-2f3aa1a56demr7771281fa.3.1723601119071; Tue, 13 Aug 2024 19:05:19 -0700 (PDT) MIME-Version: 1.0 References: <6461a84b.a70a0220.b6d36.5d00@mx.google.com> <87sfbxhmxe.fsf@localhost> <64623c09.170a0220.52bf9.9437@mx.google.com> <87y1lo4ou1.fsf@localhost> <646379fc.620a0220.c0ae4.9fb2@mx.google.com> <87zg3l1rgb.fsf@localhost> <64c8a313.a70a0220.93ee0.14fb@mx.google.com> <87il9zgpdp.fsf@localhost> <64c905d7.170a0220.f434a.fddb@mx.google.com> <87o7jpoqfl.fsf@localhost> <64cc9b8a.170a0220.dfa99.2e18@mx.google.com> <87msz7kym0.fsf@localhost> <669882e5.050a0220.8ff6d.33c6@mx.google.com> <871q3logb9.fsf@localhost> <66a8b73b.170a0220.383476.996e@mx.google.com> <87o75yhwnu.fsf@localhost> In-Reply-To: <87o75yhwnu.fsf@localhost> From: stardiviner Date: Wed, 14 Aug 2024 10:04:52 +0800 Message-ID: Subject: Re: [PATCH v4.0] Re: [PATCH] add a function to only refresh inline images under current headline instead of global buffer To: Ihor Radchenko Cc: Org mode Content-Type: multipart/alternative; boundary="0000000000006fd66d061f9b28e4" Received-SPF: pass client-ip=2a00:1450:4864:20::22c; envelope-from=numbchild@gmail.com; helo=mail-lj1-x22c.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: emacs-orgmode-bounces+larch=yhetil.org@gnu.org X-Migadu-Country: US X-Migadu-Flow: FLOW_IN X-Migadu-Queue-Id: 6DC096DC3E X-Migadu-Scanner: mx13.migadu.com X-Migadu-Spam-Score: -9.78 X-Spam-Score: -9.78 X-TUID: iJomwwweGqaF --0000000000006fd66d061f9b28e4 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable I agree with your patch solution. I have tested fine. Thanks for your re-write. I have an idea, would you like to add an function in bellowing: #+begin_src emacs-lisp (defun org-toggle-inline-images-in-results () "Toggle inline images in babel source block results." (save-excursion ;; [C-c C-v C-o] `org-babel-open-src-block-result' (let ((begin (org-babel-where-is-src-block-result)) (end (progn (end-of-line) (skip-chars-forward " \r\t\n") (looking-at org-link-bracket-re) ;; (org-babel-read-result) (point)))) (org-toggle-inline-images-command nil begin end)))) (add-hook 'org-babel-after-execute-hook 'org-toggle-inline-images-in-results) #+end_src WDYT? after all I originally propose this patch for this purpose to improve the babel result inline image toggle displaying performance. [stardiviner] GPG key ID: 47C32433 IRC(freeenode): stardiviner Twitter: @numbchild Key fingerprint =3D 9BAA 92BC CDDD B9EF 3B36 CB99 B8C4 B8E5 47C3 2433 Blog: http://stardiviner.github.io/ On Mon, Aug 12, 2024 at 6:17=E2=80=AFPM Ihor Radchenko wrote: > "Christopher M. Miles" writes: > > >> What about the following treatment of ARG: > >> > >> 1. No argument, no region selected :: toggle (display or hide dwim) > images in current section > >> 2. No argument, region selected: toggle images in region > >> 3. C-u argument :: toggle images in the whole buffer > >> 4. C-u C-u argument, no region selected :: unconditionally hide images > in the buffer > >> 5. M-1 argument, no region selected :: display images in current > section with INCLUDE-LINKED > >> 6. M-1 argument, region selected :: ... in region ... > >> 7. M-11 argument :: ... in the whole buffer ... > >> 8. Any other argument :: treat as INCLUDE-LINKED =3D t > >> > >> And please document all the new arguments in the manual and > etc/ORG-NEWS file. > > > > I followed you upper 8 conditions to re-write my patch. > > Except the 8. condition I'm not sure I understand correctly. > > And I extend 1. condition to support the inline image link at point > toggle displaying. > > ... > > I do not like the code repetitions in the patch and relying upon > `use-region-p' even for non-interactive use. > > I am attaching a complete rewrite of your idea. > Please let me know if my patch does everything you want to include into > the command. > > Note that I went with a new idea of introducing a branch new function > instead of changing `org-toggle-inline-images'. This way, existing > users of `org-toggle-inline-images' will not be affected at all. We are > just changing the default C-c C-x C-v binding. This way, the breakage > is a little as possible. > > > -- > Ihor Radchenko // yantar92, > Org mode contributor, > Learn more about Org mode at . > Support Org development at , > or support my work at > --0000000000006fd66d061f9b28e4 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
I agree with your patch solution. I have tested fine. Than= ks for your re-write.

I have an idea, would you like to add an funct= ion in bellowing:

#+begin_src emacs-lisp
(defun org-toggle-inline= -images-in-results ()
=C2=A0 "Toggle inline images in babel source = block results."
=C2=A0 (save-excursion
=C2=A0 =C2=A0 ;; [C-c C-v= C-o] `org-babel-open-src-block-result'
=C2=A0 =C2=A0 (let ((begin (= org-babel-where-is-src-block-result))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= (end (progn
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0(end-of-line)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0(skip-chars-forward " \r\t\n")
=C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(looking-at org-link-bracket-re)
= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0;; (org-babel= -read-result)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0(point))))
=C2=A0 =C2=A0 =C2=A0 (org-toggle-inline-images-command = nil begin end))))

(add-hook 'org-babel-after-execute-hook 'o= rg-toggle-inline-images-in-results)
#+end_src

WDYT? after all I o= riginally propose this patch for this purpose to
improve the babel resul= t inline image toggle displaying performance.


[stardiviner]= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 <Hack this = world!>=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 GPG key ID: 47C32433
IRC(freeen= ode): stardiviner =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 Twitter:=C2=A0 @n= umbchild
Key fingerprint =3D 9BAA 92BC CDDD B9EF 3B36=C2=A0 CB99 B8C4 B8= E5 47C3 2433
Blog: http://stardiviner.github.io/
<= br>

On Mon, Aug 12, 2024 at 6:17=E2=80=AFPM Ihor Radchenko <yantar92@posteo.net> wrote:
"Christopher M. Miles&quo= t; <numbchild@g= mail.com> writes:

>> What about the following treatment of ARG:
>>
>> 1. No argument, no region selected :: toggle (display or hide dwim= ) images in current section
>> 2. No argument, region selected: toggle images in region
>> 3. C-u argument :: toggle images in the whole buffer
>> 4. C-u C-u argument, no region selected :: unconditionally hide im= ages in the buffer
>> 5. M-1 argument, no region selected :: display images in current s= ection with INCLUDE-LINKED
>> 6. M-1 argument, region selected :: ... in region ...
>> 7. M-11 argument :: ... in the whole buffer ...
>> 8. Any other argument :: treat as INCLUDE-LINKED =3D t
>>
>> And please document all the new arguments in the manual and etc/OR= G-NEWS file.
>
> I followed you upper 8 conditions to re-write my patch.
> Except the 8. condition I'm not sure I understand correctly.
> And I extend 1. condition to support the inline image link at point to= ggle displaying.
> ...

I do not like the code repetitions in the patch and relying upon
`use-region-p' even for non-interactive use.

I am attaching a complete rewrite of your idea.
Please let me know if my patch does everything you want to include into
the command.

Note that I went with a new idea of introducing a branch new function
instead of changing `org-toggle-inline-images'.=C2=A0 This way, existin= g
users of `org-toggle-inline-images' will not be affected at all.=C2=A0 = We are
just changing the default C-c C-x C-v binding.=C2=A0 This way, the breakage=
is a little as possible.


--
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,=
or support my work at <https://liberapay.com/yantar92>
--0000000000006fd66d061f9b28e4--