From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id qOCYMw5oOmPzaQEAbAwnHQ (envelope-from ) for ; Mon, 03 Oct 2022 06:41:50 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id qLuzMw5oOmMBfgEA9RJhRA (envelope-from ) for ; Mon, 03 Oct 2022 06:41:50 +0200 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 4403D1771B for ; Mon, 3 Oct 2022 06:41:50 +0200 (CEST) Received: from localhost ([::1]:47214 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ofDH3-0006vS-Bx for larch@yhetil.org; Mon, 03 Oct 2022 00:41:49 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:52160) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ofDG8-0006vH-Ki for emacs-orgmode@gnu.org; Mon, 03 Oct 2022 00:40:53 -0400 Received: from [2409:8a28:603a:44b0:52d2:f5ff:fe16:c591] (port=50934 helo=Mac-mini.local) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ofDG0-0001Sy-Hz for emacs-orgmode@gnu.org; Mon, 03 Oct 2022 00:40:52 -0400 Received: by Mac-mini.local (Postfix, from userid 501) id C9E4866A8962; Mon, 3 Oct 2022 12:40:35 +0800 (CST) References: <87h71ew0m0.fsf@localhost> <631e92ee.050a0220.f9c18.92f5SMTPIN_ADDED_BROKEN@mx.google.com> <87y1uovp9w.fsf@localhost> <631fe1c9.050a0220.3ab2b.3f52SMTPIN_ADDED_BROKEN@mx.google.com> <87bkrhwc42.fsf@localhost> <6322b0a8.050a0220.59bb8.6923SMTPIN_ADDED_BROKEN@mx.google.com> <87y1uluir1.fsf@localhost> <6322f5ad.c80a0220.5e936.823eSMTPIN_ADDED_BROKEN@mx.google.com> <878rmesf64.fsf@localhost> <6329c8b0.050a0220.412d.0a6cSMTPIN_ADDED_BROKEN@mx.google.com> <87tu51xivh.fsf@localhost> <633454e3.050a0220.7278b.1fa5SMTPIN_ADDED_BROKEN@mx.google.com> <87y1u298yn.fsf@localhost> <63353c69.370a0220.67788.e8a1SMTPIN_ADDED_BROKEN@mx.google.com> <87o7ux4khz.fsf@localhost> <6336a955.050a0220.4e72e.2b23SMTPIN_ADDED_BROKEN@mx.google.com> <87bkqw2pzc.fsf@localhost> <63380f57.370a0220.a9d9a.dee8SMTPIN_ADDED_BROKEN@mx.google.com> <878rlxzj5i.fsf@localhost> User-agent: mu4e 1.8.9; emacs 29.0.50 From: "Christopher M. Miles" To: Ihor Radchenko Cc: "Christopher M. Miles" , emacs-orgmode@gnu.org Subject: Re: [PATCH 2-v4] New: auto display inline images under subtree when `org-cycle'. Date: Mon, 03 Oct 2022 12:37:48 +0800 In-reply-to: <878rlxzj5i.fsf@localhost> Message-ID: MIME-Version: 1.0 Content-Type: multipart/signed; boundary="==-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" X-Host-Lookup-Failed: Reverse DNS lookup failed for 2409:8a28:603a:44b0:52d2:f5ff:fe16:c591 (deferred) Received-SPF: softfail client-ip=2409:8a28:603a:44b0:52d2:f5ff:fe16:c591; envelope-from=numbchild@gmail.com; helo=Mac-mini.local X-Spam_score_int: 18 X-Spam_score: 1.8 X-Spam_bar: + X-Spam_report: (1.8 / 5.0 requ) BAYES_00=-1.9, DKIM_ADSP_CUSTOM_MED=0.001, FORGED_GMAIL_RCVD=1, FREEMAIL_FROM=0.001, MSGID_MULTIPLE_AT=1, NML_ADSP_CUSTOM_MED=0.9, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPOOFED_FREEMAIL_NO_RDNS=0.001, T_SPF_TEMPERROR=0.01 autolearn=no 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: , Reply-To: numbchild@gmail.com Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Migadu-Flow: FLOW_IN X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1664772110; h=from:from:sender:sender:reply-to: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; bh=P07K6WJ4KaEx1utd1Eh9wq1daIBxARjvxJRp+MIfn7k=; b=iDcVtg1xvN69qcxEitZqa8V18UDGPJzxemFBfgLXkpQZCIvniS2WfLilnMCgS8KV6FP3gY z/lM28Bgw1uSOLe/MCLCzbWP7mAzBLs5FRbmkdzpklIRyNnmO/T3gzkh9zK8sYJcWp2OJI 2rWVR9ovCkCAnJeyq/OFQYUjUurF8N/fzaevfZCY/thUlebppPMLBpx+dj8ZIxJpgHnPvH dBcLrWLiM9GZ/wMrsN8Lu0/d15iihqpFfBUAmGuqN9BPqWyRyKLtF7qYSVXhM+19Ms9lxL MlaLZ6K5Zfuh/PJIoLkkgU+n0Fr0YJKJ/1+hLUpg+sjxT7kbI/YIE2r1lNs7tQ== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1664772110; a=rsa-sha256; cv=none; b=eFZaimJYZY6qy6RwhYEnT9LXfKWS0i7j1BEgtME8vtjCxQAHOuEKCKbfxViopiB4O0FY+H Fxhw48GhXG8MXldYgcSrcG5HkSURNSu6skf6MNXDkn7/IOjHwgymQp9AIqve+36F7eTbId JgxGJXTxebXbNKvRTfnyIYMYqhjNYPuNOHHcRw2dXpQnU7Kcs6PrpqNQK3CfwBGRVccuwg Nt8gpTQ876IjFbzn+DK1CVKHH3kls2N5o7CqphJqtjbVBni9mNjRK+gy0jAij+xi6MvUWt 7W+4Ohbvctf1GALEyOIYnvaj22jIFbJiejtKIGzwMNMGtyyBKjdNaJLRIvq0zg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; dmarc=fail reason="SPF not aligned (relaxed), No valid DKIM" header.from=gmail.com (policy=none); 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" X-Migadu-Spam-Score: 0.75 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=fail reason="SPF not aligned (relaxed), No valid DKIM" header.from=gmail.com (policy=none); 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" X-Migadu-Queue-Id: 4403D1771B X-Spam-Score: 0.75 X-Migadu-Scanner: scn0.migadu.com X-TUID: 284lMmu7QFRz --==-=-= Content-Type: multipart/mixed; boundary="=-=-=" --=-=-= Content-Type: text/plain Finally finished and passed the test. Here I attached the new patch. --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-org.el-Support-auto-display-inline-images-when-cycli.patch Content-Transfer-Encoding: quoted-printable From=20c36122f818289cbd26026ae75ce480b03e03f61a Mon Sep 17 00:00:00 2001 From: stardiviner Date: Wed, 28 Sep 2022 20:46:52 +0800 Subject: [PATCH] org.el: Support auto display inline images when cycling * lisp/org.el (org-toggle-inline-images): Support region. (org-display-inline-images): Fix refresh argument logic. (org-remove-inline-images): Support region. * lisp/org-keys.el (org-toggle-inline-images): Update arguments. * lisp/org-cycle.el (org-cycle-inline-images-display): Add new option to control whether auto display inline images when cycling. (org-cycle-display-inline-images): Add new hook function to auto display inline images when cycling. (org-cycle-hook): Add `org-cycle-display-inline-images' into cycling hook by default. * testing/lisp/test-org-fold.el (test-org-fold/org-fold-display-inline-imag= es): Add test for inline image displaying when cycling. =2D-- doc/org-manual.org | 12 ++++ etc/ORG-NEWS | 5 ++ lisp/org-cycle.el | 38 ++++++++++++- lisp/org-keys.el | 2 +- lisp/org.el | 21 ++++--- .../images/Org mode logo mono-color.png | Bin 0 -> 7523 bytes testing/lisp/test-org-fold.el | 52 ++++++++++++++++++ 7 files changed, 119 insertions(+), 11 deletions(-) create mode 100755 testing/examples/images/Org mode logo mono-color.png diff --git a/doc/org-manual.org b/doc/org-manual.org index ab8a295e5..ec5b729be 100644 =2D-- a/doc/org-manual.org +++ b/doc/org-manual.org @@ -475,6 +475,13 @@ Org uses just two commands, bound to {{{kbd(TAB)}}} and #+vindex: org-cycle-emulate-tab Point must be on a headline for this to work[fn:4]. =20 + #+vindex: org-cycle-inline-images-display + Outline cycling can now include inline image visibility. You can + enable this behavior by setting custom option + ~org-cycle-inline-images-display~ to non-~nil~. After enabled, when + you pressed {{{kbd(TAB)}}} on headline, the inline images under + subtree will be displayed automatically based on the ~org-cycle~ state. + - {{{kbd(S-TAB)}}} (~org-global-cycle~), {{{kbd(C-u TAB)}}} :: =20 #+cindex: global visibility states @@ -11332,6 +11339,11 @@ command: - When set to nil, try to get the width from an =3D#+ATTR.*=3D keyword and fall back on the original width if none is found. =20 +Inline images under subtree can be auto displayed by enabling custom +option ~org-cycle-inline-images-display~. After enabled, when you +pressed {{{kbd(TAB)}}} on headline, the inline images under subtree +will be displayed automatically based on the ~org-cycle~ state. + ** Captions :PROPERTIES: :DESCRIPTION: Describe tables, images... diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS index cab64317f..8832a5beb 100644 =2D-- a/etc/ORG-NEWS +++ b/etc/ORG-NEWS @@ -307,6 +307,11 @@ to pass the contents of a named code block as a string= argument. The new property =3DORG-IMAGE-ACTUAL-WIDTH=3D can override the global variable ~org-image-actual-width~ value for inline images display width. =20 +*** New ~org-cycle-hook~ function ~org-cycle-display-inline-images~ for au= to displaying subtree inline images + +Outline cycling can now include inline image visibility. This behavior +is controlled by custom option ~org-cycle-inline-images-display~. + *** New ~org-babel-tangle-finished-hook~ hook run at the very end of ~org-= babel-tangle~ =20 This provides a proper counterpart to ~org-babel-pre-tangle-hook~, as diff --git a/lisp/org-cycle.el b/lisp/org-cycle.el index 656ca83f2..212d25a44 100644 =2D-- a/lisp/org-cycle.el +++ b/lisp/org-cycle.el @@ -208,8 +208,9 @@ the values `folded', `children', or `subtree'." :type 'hook) =20 (defcustom org-cycle-hook '(org-cycle-hide-archived-subtrees =2D org-cycle-show-empty-lines =2D org-cycle-optimize-window-after-visibility-change) + org-cycle-show-empty-lines + org-cycle-optimize-window-after-visibility-cha= nge + org-cycle-display-inline-images) "Hook that is run after `org-cycle' has changed the buffer visibility. The function(s) in this hook must accept a single argument which indicates the new state that was set by the most recent `org-cycle' command. The @@ -229,6 +230,13 @@ normal outline commands like `show-all', but not with = the cycling commands." :group 'org-cycle :type 'boolean) =20 +(defcustom org-cycle-inline-images-display nil + "Non-nil means auto display inline images under subtree when cycling." + :group 'org-startup + :group 'org-cycle + :package-version '(Org . "9.6") + :type 'boolean) + (defvar org-cycle-tab-first-hook nil "Hook for functions to attach themselves to TAB. See `org-ctrl-c-ctrl-c-hook' for more information. @@ -776,6 +784,32 @@ STATE should be one of the symbols listed in the docst= ring of "Subtree is archived and stays closed. Use \ `\\[org-cycle-force-archived]' to cycle it anyway.")))))) =20 +(defun org-cycle-display-inline-images (state) + "Auto display inline images under subtree when cycling. +It works when `org-cycle-inline-images-display' is non-nil." + (when org-cycle-inline-images-display + (pcase state + ('children + (org-with-wide-buffer + (org-narrow-to-subtree) + ;; If has nested headlines, beg,end only from parent headline + ;; to first child headline which reference to upper + ;; let-binding `org-next-visible-heading'. + (org-display-inline-images + nil nil + (point-min) (progn (org-next-visible-heading 1) (point))))) + ('subtree + (org-with-wide-buffer + (org-narrow-to-subtree) + ;; If has nested headlines, also inline display images under all s= ub-headlines. + (org-display-inline-images nil nil (point-min) (point-max)))) + ('folded + (org-with-wide-buffer + (org-narrow-to-subtree) + (if (numberp (point-max)) + (org-remove-inline-images (point-min) (point-max)) + (ignore))))))) + (provide 'org-cycle) =20 ;;; org-cycle.el ends here diff --git a/lisp/org-keys.el b/lisp/org-keys.el index d65379a72..79e34cbd1 100644 =2D-- a/lisp/org-keys.el +++ b/lisp/org-keys.el @@ -204,7 +204,7 @@ (declare-function org-toggle-radio-button "org" (&optional arg)) (declare-function org-toggle-comment "org" ()) (declare-function org-toggle-fixed-width "org" ()) =2D(declare-function org-toggle-inline-images "org" (&optional include-link= ed)) +(declare-function org-toggle-inline-images "org" (&optional include-linked= beg end)) (declare-function org-latex-preview "org" (&optional arg)) (declare-function org-toggle-narrow-to-subtree "org" ()) (declare-function org-toggle-ordered-property "org" ()) diff --git a/lisp/org.el b/lisp/org.el index 036384a04..36db62f0c 100644 =2D-- a/lisp/org.el +++ b/lisp/org.el @@ -16071,16 +16071,16 @@ SNIPPETS-P indicates if this is run to create sni= ppet images for HTML." =20 (defvar-local org-inline-image-overlays nil) =20 =2D(defun org-toggle-inline-images (&optional include-linked) +(defun org-toggle-inline-images (&optional include-linked beg end) "Toggle the display of inline images. INCLUDE-LINKED is passed to `org-display-inline-images'." (interactive "P") (if org-inline-image-overlays (progn =2D (org-remove-inline-images) + (org-remove-inline-images beg end) (when (called-interactively-p 'interactive) (message "Inline image display turned off"))) =2D (org-display-inline-images include-linked) + (org-display-inline-images include-linked nil beg end) (when (called-interactively-p 'interactive) (message (if org-inline-image-overlays (format "%d images displayed inline" @@ -16170,8 +16170,8 @@ BEG and END define the considered part. They defau= lt to the buffer boundaries with possible narrowing." (interactive "P") (when (display-graphic-p) =2D (unless refresh =2D (org-remove-inline-images) + (when refresh + (org-remove-inline-images beg end) (when (fboundp 'clear-image-cache) (clear-image-cache))) (let ((end (or end (point-max)))) (org-with-point-at (or beg (point-min)) @@ -16322,11 +16322,16 @@ buffer boundaries with possible narrowing." (delete ov org-inline-image-overlays) (delete-overlay ov)))) =20 =2D(defun org-remove-inline-images () +(defun org-remove-inline-images (&optional beg end) "Remove inline display of images." (interactive) =2D (mapc #'delete-overlay org-inline-image-overlays) =2D (setq org-inline-image-overlays nil)) + (let* ((beg (or beg (point-min))) + (end (or end (point-max))) + (overlays (overlays-in beg end))) + (dolist (ov overlays) + (when (memq ov org-inline-image-overlays) + (setq org-inline-image-overlays (delq ov org-inline-image-overlays= )) + (delete-overlay ov))))) =20 (defvar org-self-insert-command-undo-counter 0) (defvar org-speed-command nil) diff --git a/testing/examples/images/Org mode logo mono-color.png b/testing= /examples/images/Org mode logo mono-color.png new file mode 100755 index 0000000000000000000000000000000000000000..9ac57e6a205257fd2fd21944a02= 5190aa2f2db49 GIT binary patch literal 7523 zcmV-p9h~BcP)O!?BnSQlOp6yU#&MjHpxYv{0PriN-m`O$=3D)$Ch3m2l4LiGL?5qY18Tn{9G z{XjIg^DjWqN6`x4&wx1auS%)+3`68}{)MR14P6HOSKuPxUzAdhib&k!@sLO)XlQ82 zfqwz+^oxNn0M`M}0Y6Ym9ZCJNp`l^ugPz>uJHK^0kkaiJnVtS$fL7ohrPNa*;))0& z!l6Tla(@2#F5cy2Cv6e%IpFg^2-pfd0Cc37qot*Vcszc}cjdr8KmBxo`66NE>eAPy*xX7Mpefl@9H{;`dN-Q5|jAy81j>d)Rb{8b7pzZVsYvt!%V z>0rps0&W4m1YBXTiUGd>{th^hvh+v0aOqOk#Qt|zUrN5$J_$H;L&d-xV4l%uRY0*4 z0?LC0B!K~-%jmae^XgEd21G2rd~r33YH(c=3D2>KN(TB7MMLjmvVt)z#9slR3gtty#Dv{5-~SvS$G_WLEFn;?|75TZ~g=3DY zRaHZh7I+Z2!Tj6^d=3DNNtCY?V@a^NOC4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pE@KexX1JgIT*!mY@*T*D{b|nxt3gkt`lGQ227${s`w60g zZtASdfj{k;ppJQ0t^x!R!cHRoyk*;U=3D#Jv~XZf|S0xy;?T|(R5y*ZsfooVN`ZS35p zWAV1`;d>sPr1>^_gleXg4=3D_(ll^poz1C2_?97i8S^jY*-GntTIDd;+QFbDqm#sDLj zK%q;tZvp-BR>h#C3*_ zZwo8ey%+crI&FM9N@}r@+xh1=3D18m77zWt#5K6hJGZuCmJK)_hKHAL;BWotyL{?2WN;o`4*c_sUipWIhmOkH^4yjufFF+dbp%~jo&*1awgG_6AKnZ)E12rk=3DtUQD z=3DD@$8RlwFQX514Uz(1I`Q>SO;z`x*cdN`8vwDJEN74)kd_!mCCI6Sqw6`cdvE8vJF zIq+u&sg#w!2c6DExo!^pnL&bb1>kk#{;_ig1$ba)MKe!@-% `'children' display child inline images. + (org-test-with-temp-text + (format "* Heading 1 +[[file:%s]]" org-logo-image) + (org-overview) + (org-fold-show-children) + (run-hook-with-args 'org-cycle-hook 'children) + (org-next-link) + (should (overlays-at (point))) + (org-toggle-inline-images) + (should-not (overlays-at (point)))) +=20=20=20=20 + ;; `org-cycle' -(state)-> `'subtree' display subtrees inline images. + (org-test-with-temp-text + (format "* Heading 1 +[[file:%s]] +** Subheading 1 +[[file:%s]] +** Subheading 2 +[[file:%s]]" org-logo-image org-logo-image org-logo-image) + (org-overview) + (org-fold-show-subtree) + (run-hook-with-args 'org-cycle-hook 'subtree) + (org-next-link) + (org-next-link) + (should (overlays-at (point))) + (org-toggle-inline-images) + (should-not (overlays-at (point)))) +=20=20=20=20 + ;; `org-cycle' -(state)-> `'folded' remove inline image overlays. + (org-test-with-temp-text + (format "* Heading 1 +[[file:%s]] +** Subheading 1 +[[file:%s]] +** Subheading 2 +[[file:%s]]" org-logo-image org-logo-image org-logo-image) + (org-overview) + (org-show-subtree) + (org-fold-subtree t) + (run-hook-with-args 'org-cycle-hook 'folded) + (should (null org-inline-image-overlays)) + (should (null (overlays-in (point-min) (point-max)))) + (org-show-subtree) + (should-not org-inline-image-overlays) + (should-not (overlays-in (point-min) (point-max)))))) + (provide 'test-org-fold) =20 ;;; test-org-fold.el ends here =2D-=20 2.37.2 --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Ihor Radchenko writes: > "Christopher M. Miles" writes: > >> +*** New ~org-cycle-hook~ function ~org-cycle-display-inline-images~ for= auto displaying subtree inline images >> + >> +This behavior is toggled by custom option ~org-cycle-inline-images-disp= lay~. >> + > > I'd be a bit more direct. Something like "Outline cycling can now > include inline image visibility". > > Also, it is a good idea to document the new feature in the manual (12.7 > Images section and 2.2.1 Global and local cycling section). > Done >> +=20=20=20=20 >> + ;; `org-cycle' -(state)-> `'folded' remove inline image overlays. >> + ;; (org-test-with-temp-text >> + ;; (format "* Heading 1 >> + ;; [[file:%s]] >> + ;; ** Subheading 1 >> + ;; [[file:%s]] >> + ;; ** Subheading 2 >> + ;; [[file:%s]]" org-logo-image org-logo-image org-logo-image) >> + ;; (org-overview) >> + ;; (org-cycle) >> + ;; (org-cycle) >> + ;; (org-cycle) >> + ;; ;; TODO: how to detect inline image overlays are deleted a= fter folded? > >> I commented out the third test if someone can do this. I don't now how t= o test in fold state. > > You can, for example, check org-inline-image-overlays and (overlays-in > (point-min) (point-max)) > Done >> >> Because I got error when running command "make test". I checked org-mode >> source code repo, the ob-vala.el is removed, don't know where it is >> introduced. > > I've seen this around the time we removed org-contrib. > I suggest you to re-clone Org repo into a clean folder. > Done >> Started at: 2022-10-01 17:46:30+0800 >> Finished. >> Finished at: 2022-10-01 17:46:31+0800 >> >> F >> >> F test-org-fold/org-fold-display-inline-images >> Test inline images displaying when cycling. >> (ert-test-failed >> ((should >> (overlays-at >> (point))) >> :form >> (overlays-at 130) >> :value nil)) >> #+end_example > > Please do not use org-cycle in tests. It is an interactive command and > makes a number of assumptions about `this-command' and `last-command' > values. Instead, prefer more direct `org-show-subtree'/`org-show-children= '. The hook function is on ~org-cycle-hook~, so I use ~org-show-subtree~ + ~(run-hook-with-args 'org-cycle-hook 'subtree)~ now. This solution solved the problem. Thanks for hint. I think the patch is finished. Please review, Ihor. Thanks for helping. =2D-=20 [ stardiviner ] I try to make every word tell the meaning that I want to express without mi= sunderstanding. Blog: https://stardiviner.github.io/ IRC(libera.chat, freenode): stardiviner, Matrix: stardiviner GPG: F09F650D7D674819892591401B5DF1C95AE89AC3 --=-=-=-- --==-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAEBCAAdFiEE8J9lDX1nSBmJJZFAG13xyVromsMFAmM6Z8MACgkQG13xyVro msNgwggAo5zyy/YeCsnX7fQ8TKoTtdsD/w6me/YqPiaX55Yw1hf2+FIpkvQCarTV H93gh6QkqiQnVtoO51rBoK5Izs0YECIKLwxAe14MipjhyJSrvarrxEGxm3FYUTDZ 326rOK1vNmdJXCi8r+oZDl2z9jI5hjf5Asg03S+lP6zZKZs1ZRDhQFSpCjO0WC/G kMRO1KXVYjqE/WdwtznxY0GFmwSnR8LhiHxGjMsot9qckAzKqu3ujl3LUl3sdIW+ UPJy1mLoAC0CXFKMDEL/MVhtA4rhWLx5BvGbcLcg+mxbjH56EDeBwAeXLp1zM0D1 JjFnIghS/aYOmHvZ9f6DH/ybshhUxw== =VhAG -----END PGP SIGNATURE----- --==-=-=--