* [QUESTION] How to specific image size attributes under headline scope? @ 2021-11-22 6:34 Christopher M. Miles 2021-11-22 18:31 ` Timothy ` (3 more replies) 0 siblings, 4 replies; 43+ messages in thread From: Christopher M. Miles @ 2021-11-22 6:34 UTC (permalink / raw) To: Org Mode [-- Attachment #1: Type: text/plain, Size: 749 bytes --] There is attributes setting above image link to specify image inline preview size. Like this: #+begin_src org ,#+ATTR_ORG: :width 500 ,#+ATTR_LATEX: :width 5.0in ,#+ATTR_HTML: :width 500px [[file:kk/88320740_p0.jpg]] #+end_src When I put it on beginning of org document, then preview inline images, but those global attributes not affected. The inline images still display in actual image size. I want to specify image size under headline properties. Is it possible to do this? -- [ stardiviner ] I try to make every word tell the meaning that I want to express. Blog: https://stardiviner.github.io/ IRC(freenode): stardiviner, Matrix: stardiviner GPG: F09F650D7D674819892591401B5DF1C95AE89AC3 [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 488 bytes --] ^ permalink raw reply [flat|nested] 43+ messages in thread
* Re: [QUESTION] How to specific image size attributes under headline scope? 2021-11-22 6:34 [QUESTION] How to specific image size attributes under headline scope? Christopher M. Miles @ 2021-11-22 18:31 ` Timothy 2022-08-18 12:44 ` Christopher M. Miles [not found] ` <m2o7whra7j.fsf@numbchild> 2022-09-11 2:20 ` [SOLVED] " Christopher M. Miles ` (2 subsequent siblings) 3 siblings, 2 replies; 43+ messages in thread From: Timothy @ 2021-11-22 18:31 UTC (permalink / raw) To: numbchild; +Cc: emacs-orgmode [-- Attachment #1: Type: text/plain, Size: 283 bytes --] Hi Christopher, > I want to specify image size under headline properties. Is it possible to do > this? As I understand org.el, this is solely governed by `org-display-inline-image--width', which only looks at `#+attr_*' keywords when setting an image width. All the best, Timothy ^ permalink raw reply [flat|nested] 43+ messages in thread
* Re: [QUESTION] How to specific image size attributes under headline scope? 2021-11-22 18:31 ` Timothy @ 2022-08-18 12:44 ` Christopher M. Miles [not found] ` <m2o7whra7j.fsf@numbchild> 1 sibling, 0 replies; 43+ messages in thread From: Christopher M. Miles @ 2022-08-18 12:44 UTC (permalink / raw) To: Timothy; +Cc: numbchild, emacs-orgmode [-- Attachment #1: Type: text/plain, Size: 749 bytes --] Timothy <tecosaur@gmail.com> writes: > Hi Christopher, > >> I want to specify image size under headline properties. Is it possible to do >> this? > > As I understand org.el, this is solely governed by > `org-display-inline-image--width', which only looks at `#+attr_*' keywords when > setting an image width. > > All the best, > Timothy Yes, what about letting org-mode support headline level image size specification? Is this a good idea and easy to implement? -- [ stardiviner ] I try to make every word tell the meaning that I want to express without misunderstanding. Blog: https://stardiviner.github.io/ IRC(libera.chat, freenode): stardiviner, Matrix: stardiviner GPG: F09F650D7D674819892591401B5DF1C95AE89AC3 [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 487 bytes --] ^ permalink raw reply [flat|nested] 43+ messages in thread
[parent not found: <m2o7whra7j.fsf@numbchild>]
* Re: [QUESTION] How to specific image size attributes under headline scope? [not found] ` <m2o7whra7j.fsf@numbchild> @ 2022-08-22 17:10 ` Timothy 2022-08-23 0:24 ` Christopher M. Miles 0 siblings, 1 reply; 43+ messages in thread From: Timothy @ 2022-08-22 17:10 UTC (permalink / raw) To: numbchild; +Cc: emacs-orgmode [-- Attachment #1: Type: text/plain, Size: 656 bytes --] Hi Christopher, >>> I want to specify image size under headline properties. Is it possible to do >>> this? >> >> As I understand org.el, this is solely governed by >> `org-display-inline-image–width’, which only looks at `#+attr_*’ keywords when >> setting an image width. >> >> All the best, >> Timothy > > Yes, what about letting org-mode support headline level image size specification? > Is this a good idea and easy to implement? Hmm, so would this basically be setting all images within a certain section to inherit a different `org-image-actual-width' / `org-latex-image-default-width' parameter? All the best, Timothy ^ permalink raw reply [flat|nested] 43+ messages in thread
* Re: [QUESTION] How to specific image size attributes under headline scope? 2022-08-22 17:10 ` Timothy @ 2022-08-23 0:24 ` Christopher M. Miles 0 siblings, 0 replies; 43+ messages in thread From: Christopher M. Miles @ 2022-08-23 0:24 UTC (permalink / raw) To: Timothy; +Cc: numbchild, emacs-orgmode [-- Attachment #1: Type: text/plain, Size: 1825 bytes --] Timothy <orgmode@tec.tecosaur.net> writes: > Hi Christopher, > >>>> I want to specify image size under headline properties. Is it possible to do >>>> this? >>> >>> As I understand org.el, this is solely governed by >>> `org-display-inline-image–width’, which only looks at `#+attr_*’ keywords when >>> setting an image width. >>> >>> All the best, >>> Timothy >> >> Yes, what about letting org-mode support headline level image size specification? >> Is this a good idea and easy to implement? > > Hmm, so would this basically be setting all images within a certain section to > inherit a different `org-image-actual-width' / `org-latex-image-default-width' > parameter? > > All the best, > Timothy Yes, like this: #+begin_src org ,* headline 1 This image will be displayed in 200 width. ,#+ATTR_ORG: :width 200 ,#+ATTR_LATEX: :width 2.0in ,#+ATTR_HTML: :width 200px [[file:kk.png]] This image will be displayed in 600 width, it has no manually specified image size, it will use ~org-image-actual-width~. [[file:kk.png]] ,** headline 2 :PROPERTIES: :IMAGE-WIDTH: 500 :END: This image will be displayed in 200 width. ,#+ATTR_ORG: :width 200 ,#+ATTR_LATEX: :width 2.0in ,#+ATTR_HTML: :width 200px [[file:kk.png]] This image will be displayed in 500 width, it has no manually specified image size, it will use "headline 2" scope property ":IMAGE-WIDTH: 500". This is what I want. (I assume there is a new property which maybe named like :IMAGE-WIDTH:.) [[file:kk.png]] #+end_src -- [ stardiviner ] I try to make every word tell the meaning that I want to express without misunderstanding. Blog: https://stardiviner.github.io/ IRC(libera.chat, freenode): stardiviner, Matrix: stardiviner GPG: F09F650D7D674819892591401B5DF1C95AE89AC3 [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 487 bytes --] ^ permalink raw reply [flat|nested] 43+ messages in thread
* [SOLVED] Re: [QUESTION] How to specific image size attributes under headline scope? 2021-11-22 6:34 [QUESTION] How to specific image size attributes under headline scope? Christopher M. Miles 2021-11-22 18:31 ` Timothy @ 2022-09-11 2:20 ` Christopher M. Miles 2022-09-11 2:25 ` Christopher M. Miles [not found] ` <631d472b.c80a0220.2b4b2.bf86SMTPIN_ADDED_BROKEN@mx.google.com> 3 siblings, 0 replies; 43+ messages in thread From: Christopher M. Miles @ 2022-09-11 2:20 UTC (permalink / raw) Cc: Christopher M. Miles, emacs-orgmode [-- Attachment #1: Type: text/plain, Size: 3664 bytes --] "Christopher M. Miles" <numbchild@gmail.com> writes: > [[PGP Signed Part:Undecided]] > There is attributes setting above image link to specify image inline preview size. Like this: > > #+begin_src org > ,#+ATTR_ORG: :width 500 > ,#+ATTR_LATEX: :width 5.0in > ,#+ATTR_HTML: :width 500px > [[file:kk/88320740_p0.jpg]] > > #+end_src > > When I put it on beginning of org document, then preview inline images, but those global attributes > not affected. The inline images still display in actual image size. I want to specify image size > under headline properties. Is it possible to do this? I implemented this feature by written a hook. Hope this can be helpful for someone who also has this needs. Here is the code: #+begin_src emacs-lisp ;;; auto display inline images under current TAB cycle expanded "visible" subtree. (defun org-display-subtree-with-inline-images (&optional state) "Toggle the display of inline images under current expanded visible subtree. INCLUDE-LINKED is passed to `org-display-inline-images'." (interactive) ;; (not (memq state '(overview folded contents))) ; global state change (let ((display-inline-images-local (lambda (beg end) (org-display-inline-images t t beg end) ;; display number of inline images which is intersection of two image overlays lists. ;; (message "%d images displayed inline" ;; (length (cl-intersection org-inline-image-overlays (overlays-in beg end)))) )) (hide-inline-images-local (lambda () (setq org-inline-image-overlays nil) ; (org-remove-inline-images) (message "Inline image display turned off"))) (inline-image-width-override ; get headline property value as inline image width. (lambda () ;; The property "INLINE-IMAGE-WIDTH" value should be integer. (let* ((property-value (ignore-errors (org-property-or-variable-value 'INLINE-IMAGE-WIDTH))) (width-integer (or (and property-value (if (numberp property-value) property-value (string-to-number property-value))) (- (/ (window-width (selected-window) t) 2) 100)))) (setq-local org-image-actual-width width-integer))))) (pcase state ('children (save-excursion (save-restriction (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'. (funcall display-inline-images-local (point-min) (progn (org-next-visible-heading 1) (point)))))) ('subtree (save-excursion (save-restriction (org-narrow-to-subtree) (funcall inline-image-width-override) ;; If has nested headlines, also inline display images under all sub-headlines. (funcall display-inline-images-local (point-min) (point-max))))) ('folded (funcall hide-inline-images-local))))) (add-to-list 'org-default-properties "INLINE-IMAGE-WIDTH") (add-hook 'org-cycle-hook #'org-display-subtree-with-inline-images) (define-key org-mode-map (kbd "C-c C-x C-v") 'org-display-subtree-with-inline-images) #+end_src -- [ stardiviner ] I try to make every word tell the meaning that I want to express without misunderstanding. Blog: https://stardiviner.github.io/ IRC(libera.chat, freenode): stardiviner, Matrix: stardiviner GPG: F09F650D7D674819892591401B5DF1C95AE89AC3 [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 487 bytes --] ^ permalink raw reply [flat|nested] 43+ messages in thread
* [SOLVED] Re: [QUESTION] How to specific image size attributes under headline scope? 2021-11-22 6:34 [QUESTION] How to specific image size attributes under headline scope? Christopher M. Miles 2021-11-22 18:31 ` Timothy 2022-09-11 2:20 ` [SOLVED] " Christopher M. Miles @ 2022-09-11 2:25 ` Christopher M. Miles [not found] ` <631d472b.c80a0220.2b4b2.bf86SMTPIN_ADDED_BROKEN@mx.google.com> 3 siblings, 0 replies; 43+ messages in thread From: Christopher M. Miles @ 2022-09-11 2:25 UTC (permalink / raw) Cc: Christopher M. Miles, emacs-orgmode [-- Attachment #1: Type: text/plain, Size: 3664 bytes --] "Christopher M. Miles" <numbchild@gmail.com> writes: > [[PGP Signed Part:Undecided]] > There is attributes setting above image link to specify image inline preview size. Like this: > > #+begin_src org > ,#+ATTR_ORG: :width 500 > ,#+ATTR_LATEX: :width 5.0in > ,#+ATTR_HTML: :width 500px > [[file:kk/88320740_p0.jpg]] > > #+end_src > > When I put it on beginning of org document, then preview inline images, but those global attributes > not affected. The inline images still display in actual image size. I want to specify image size > under headline properties. Is it possible to do this? I implemented this feature by written a hook. Hope this can be helpful for someone who also has this needs. Here is the code: #+begin_src emacs-lisp ;;; auto display inline images under current TAB cycle expanded "visible" subtree. (defun org-display-subtree-with-inline-images (&optional state) "Toggle the display of inline images under current expanded visible subtree. INCLUDE-LINKED is passed to `org-display-inline-images'." (interactive) ;; (not (memq state '(overview folded contents))) ; global state change (let ((display-inline-images-local (lambda (beg end) (org-display-inline-images t t beg end) ;; display number of inline images which is intersection of two image overlays lists. ;; (message "%d images displayed inline" ;; (length (cl-intersection org-inline-image-overlays (overlays-in beg end)))) )) (hide-inline-images-local (lambda () (setq org-inline-image-overlays nil) ; (org-remove-inline-images) (message "Inline image display turned off"))) (inline-image-width-override ; get headline property value as inline image width. (lambda () ;; The property "INLINE-IMAGE-WIDTH" value should be integer. (let* ((property-value (ignore-errors (org-property-or-variable-value 'INLINE-IMAGE-WIDTH))) (width-integer (or (and property-value (if (numberp property-value) property-value (string-to-number property-value))) (- (/ (window-width (selected-window) t) 2) 100)))) (setq-local org-image-actual-width width-integer))))) (pcase state ('children (save-excursion (save-restriction (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'. (funcall display-inline-images-local (point-min) (progn (org-next-visible-heading 1) (point)))))) ('subtree (save-excursion (save-restriction (org-narrow-to-subtree) (funcall inline-image-width-override) ;; If has nested headlines, also inline display images under all sub-headlines. (funcall display-inline-images-local (point-min) (point-max))))) ('folded (funcall hide-inline-images-local))))) (add-to-list 'org-default-properties "INLINE-IMAGE-WIDTH") (add-hook 'org-cycle-hook #'org-display-subtree-with-inline-images) (define-key org-mode-map (kbd "C-c C-x C-v") 'org-display-subtree-with-inline-images) #+end_src -- [ stardiviner ] I try to make every word tell the meaning that I want to express without misunderstanding. Blog: https://stardiviner.github.io/ IRC(libera.chat, freenode): stardiviner, Matrix: stardiviner GPG: F09F650D7D674819892591401B5DF1C95AE89AC3 [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 487 bytes --] ^ permalink raw reply [flat|nested] 43+ messages in thread
[parent not found: <631d472b.c80a0220.2b4b2.bf86SMTPIN_ADDED_BROKEN@mx.google.com>]
* Re: [SOLVED] Re: [QUESTION] How to specific image size attributes under headline scope? [not found] ` <631d472b.c80a0220.2b4b2.bf86SMTPIN_ADDED_BROKEN@mx.google.com> @ 2022-09-11 12:34 ` Ihor Radchenko 2022-09-12 1:54 ` [PATCH] " Christopher M. Miles ` (3 more replies) 0 siblings, 4 replies; 43+ messages in thread From: Ihor Radchenko @ 2022-09-11 12:34 UTC (permalink / raw) To: Christopher M. Miles; +Cc: emacs-orgmode "Christopher M. Miles" <numbchild@gmail.com> writes: >> When I put it on beginning of org document, then preview inline images, but those global attributes >> not affected. The inline images still display in actual image size. I want to specify image size >> under headline properties. Is it possible to do this? > > I implemented this feature by written a hook. Hope this can be helpful > for someone who also has this needs. Here is the code: This looks useful. Would you be interested to write a patch? -- Ihor Radchenko, 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 ^ permalink raw reply [flat|nested] 43+ messages in thread
* [PATCH] Re: [SOLVED] Re: [QUESTION] How to specific image size attributes under headline scope? 2022-09-11 12:34 ` Ihor Radchenko @ 2022-09-12 1:54 ` Christopher M. Miles 2022-09-12 1:59 ` [PATCH] New: auto display inline images under subtree when `org-cycle' Christopher M. Miles ` (2 subsequent siblings) 3 siblings, 0 replies; 43+ messages in thread From: Christopher M. Miles @ 2022-09-12 1:54 UTC (permalink / raw) To: Ihor Radchenko; +Cc: Christopher M. Miles, emacs-orgmode [-- Attachment #1.1: Type: text/plain, Size: 569 bytes --] Ihor Radchenko <yantar92@gmail.com> writes: > "Christopher M. Miles" <numbchild@gmail.com> writes: > >>> When I put it on beginning of org document, then preview inline images, but those global attributes >>> not affected. The inline images still display in actual image size. I want to specify image size >>> under headline properties. Is it possible to do this? >> >> I implemented this feature by written a hook. Hope this can be helpful >> for someone who also has this needs. Here is the code: > > This looks useful. > Would you be interested to write a patch? [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #1.2: 0001-org.el-Add-hook-function-to-auto-display-inline-imag.patch --] [-- Type: text/x-patch, Size: 4279 bytes --] From 2ba9c048dd2609eb22a3924dd15f041b648ef859 Mon Sep 17 00:00:00 2001 From: stardiviner <numbchild@gmail.com> Date: Mon, 12 Sep 2022 09:45:09 +0800 Subject: [PATCH] org.el: Add hook function to auto display inline images of subtree * lisp/org.el (org-display-subtree-with-inline-images): Add an option and hook function to auto display of inline images under current expanded visible subtree. --- lisp/org.el | 59 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) diff --git a/lisp/org.el b/lisp/org.el index 6e6c437d5..594006551 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -1108,6 +1108,14 @@ the following lines anywhere in the buffer: :version "24.1" :type 'boolean) +(defcustom org-cycle-display-inline-images nil + "Non-nil means show inline images when `org-cycle'. +When this is t, org-mode will add function +`org-display-subtree-with-inline-images' on hook `org-cycle-hook'." + :group 'org-startup + :version "24.1" + :type 'boolean) + (defcustom org-startup-with-latex-preview nil "Non-nil means preview LaTeX fragments when loading a new Org file. @@ -16284,6 +16292,57 @@ buffer boundaries with possible narrowing." (mapc #'delete-overlay org-inline-image-overlays) (setq org-inline-image-overlays nil)) +(defun org-display-subtree-with-inline-images (&optional state) + "Toggle the display of inline images under current expanded visible subtree. +This hook function will auto display or hide inline images after `org-cycle'. +It is used to hook on `org-cycle-hook'. +The function behavior is controlled by `org-cycle-display-inline-images'." + (interactive) + ;; (not (memq state '(overview folded contents))) ; global state change + (when org-cycle-display-inline-images + (let ((display-inline-images-local + (lambda (beg end) + (org-display-inline-images t t beg end) + ;; display number of inline images which is intersection of two image overlays lists. + ;; (message "%d images displayed inline" + ;; (length (cl-intersection org-inline-image-overlays (overlays-in beg end)))) + )) + (hide-inline-images-local + (lambda () + (setq org-inline-image-overlays nil) ; (org-remove-inline-images) + (message "Inline image display turned off"))) + (inline-image-width-override ; get headline property value as inline image width. + (lambda () + ;; The property "INLINE-IMAGE-WIDTH" value should be integer. Reference `org-display-inline-image--width'. + (let* ((property-value (ignore-errors (org-property-or-variable-value 'INLINE-IMAGE-WIDTH))) + (width-integer (or (and property-value + (if (numberp property-value) property-value (string-to-number property-value))) + (- (/ (window-width (selected-window) t) 2) 100)))) + (setq-local org-image-actual-width width-integer))))) + (pcase state + ('children + (save-excursion + (save-restriction + (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'. + (funcall display-inline-images-local (point-min) (progn (org-next-visible-heading 1) (point)))))) + ('subtree + (save-excursion + (save-restriction + (org-narrow-to-subtree) + (funcall inline-image-width-override) + ;; If has nested headlines, also inline display images under all sub-headlines. + (funcall display-inline-images-local (point-min) (point-max))))) + ('folded + (funcall hide-inline-images-local)) + ('nil (funcall 'org-toggle-inline-images)))))) + +(add-hook 'org-cycle-hook #'org-display-subtree-with-inline-images) + +(add-to-list 'org-default-properties "INLINE-IMAGE-WIDTH") + (defvar org-self-insert-command-undo-counter 0) (defvar org-speed-command nil) -- 2.37.2 [-- Attachment #1.3: Type: text/plain, Size: 267 bytes --] -- [ stardiviner ] I try to make every word tell the meaning that I want to express without misunderstanding. Blog: https://stardiviner.github.io/ IRC(libera.chat, freenode): stardiviner, Matrix: stardiviner GPG: F09F650D7D674819892591401B5DF1C95AE89AC3 [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 487 bytes --] ^ permalink raw reply related [flat|nested] 43+ messages in thread
* [PATCH] New: auto display inline images under subtree when `org-cycle'. 2022-09-11 12:34 ` Ihor Radchenko 2022-09-12 1:54 ` [PATCH] " Christopher M. Miles @ 2022-09-12 1:59 ` Christopher M. Miles [not found] ` <m2wna9bbc2.fsf@numbchild> [not found] ` <631e92ee.050a0220.f9c18.92f5SMTPIN_ADDED_BROKEN@mx.google.com> 3 siblings, 0 replies; 43+ messages in thread From: Christopher M. Miles @ 2022-09-12 1:59 UTC (permalink / raw) To: Ihor Radchenko; +Cc: Christopher M. Miles, emacs-orgmode [-- Attachment #1.1: Type: text/plain, Size: 663 bytes --] Ihor Radchenko <yantar92@gmail.com> writes: > "Christopher M. Miles" <numbchild@gmail.com> writes: > >>> When I put it on beginning of org document, then preview inline images, but those global attributes >>> not affected. The inline images still display in actual image size. I want to specify image size >>> under headline properties. Is it possible to do this? >> >> I implemented this feature by written a hook. Hope this can be helpful >> for someone who also has this needs. Here is the code: > > This looks useful. > Would you be interested to write a patch? The is the new patch which updated the defcustom variable docstring has correct description. [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #1.2: 0001-org.el-Add-hook-function-to-auto-display-inline-imag.patch --] [-- Type: text/x-patch, Size: 4271 bytes --] From 4f66d9d10de5593b863da605ddc375d8f2e06456 Mon Sep 17 00:00:00 2001 From: stardiviner <numbchild@gmail.com> Date: Mon, 12 Sep 2022 09:45:09 +0800 Subject: [PATCH] org.el: Add hook function to auto display inline images of subtree * lisp/org.el (org-display-subtree-with-inline-images): Add an option and hook function to auto display of inline images under current expanded visible subtree. --- lisp/org.el | 58 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) diff --git a/lisp/org.el b/lisp/org.el index 6e6c437d5..92086704e 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -1108,6 +1108,13 @@ the following lines anywhere in the buffer: :version "24.1" :type 'boolean) +(defcustom org-cycle-display-inline-images nil + "Non-nil means auto display inline images under subtree when `org-cycle' +by the function `org-display-subtree-with-inline-images' on hook `org-cycle-hook'." + :group 'org-startup + :version "24.1" + :type 'boolean) + (defcustom org-startup-with-latex-preview nil "Non-nil means preview LaTeX fragments when loading a new Org file. @@ -16284,6 +16291,57 @@ buffer boundaries with possible narrowing." (mapc #'delete-overlay org-inline-image-overlays) (setq org-inline-image-overlays nil)) +(defun org-display-subtree-with-inline-images (&optional state) + "Toggle the display of inline images under current expanded visible subtree. +This hook function will auto display or hide inline images after `org-cycle'. +It is used to hook on `org-cycle-hook'. +The function behavior is controlled by `org-cycle-display-inline-images'." + (interactive) + ;; (not (memq state '(overview folded contents))) ; global state change + (when org-cycle-display-inline-images + (let ((display-inline-images-local + (lambda (beg end) + (org-display-inline-images t t beg end) + ;; display number of inline images which is intersection of two image overlays lists. + ;; (message "%d images displayed inline" + ;; (length (cl-intersection org-inline-image-overlays (overlays-in beg end)))) + )) + (hide-inline-images-local + (lambda () + (setq org-inline-image-overlays nil) ; (org-remove-inline-images) + (message "Inline image display turned off"))) + (inline-image-width-override ; get headline property value as inline image width. + (lambda () + ;; The property "INLINE-IMAGE-WIDTH" value should be integer. Reference `org-display-inline-image--width'. + (let* ((property-value (ignore-errors (org-property-or-variable-value 'INLINE-IMAGE-WIDTH))) + (width-integer (or (and property-value + (if (numberp property-value) property-value (string-to-number property-value))) + (- (/ (window-width (selected-window) t) 2) 100)))) + (setq-local org-image-actual-width width-integer))))) + (pcase state + ('children + (save-excursion + (save-restriction + (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'. + (funcall display-inline-images-local (point-min) (progn (org-next-visible-heading 1) (point)))))) + ('subtree + (save-excursion + (save-restriction + (org-narrow-to-subtree) + (funcall inline-image-width-override) + ;; If has nested headlines, also inline display images under all sub-headlines. + (funcall display-inline-images-local (point-min) (point-max))))) + ('folded + (funcall hide-inline-images-local)) + ('nil (funcall 'org-toggle-inline-images)))))) + +(add-hook 'org-cycle-hook #'org-display-subtree-with-inline-images) + +(add-to-list 'org-default-properties "INLINE-IMAGE-WIDTH") + (defvar org-self-insert-command-undo-counter 0) (defvar org-speed-command nil) -- 2.37.2 [-- Attachment #1.3: Type: text/plain, Size: 267 bytes --] -- [ stardiviner ] I try to make every word tell the meaning that I want to express without misunderstanding. Blog: https://stardiviner.github.io/ IRC(libera.chat, freenode): stardiviner, Matrix: stardiviner GPG: F09F650D7D674819892591401B5DF1C95AE89AC3 [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 487 bytes --] ^ permalink raw reply related [flat|nested] 43+ messages in thread
[parent not found: <m2wna9bbc2.fsf@numbchild>]
* [ISSUE] Re: [PATCH] New: auto display inline images under subtree when `org-cycle'. [not found] ` <m2wna9bbc2.fsf@numbchild> @ 2022-09-12 6:03 ` Christopher M. Miles 0 siblings, 0 replies; 43+ messages in thread From: Christopher M. Miles @ 2022-09-12 6:03 UTC (permalink / raw) To: Ihor Radchenko; +Cc: Christopher M. Miles, emacs-orgmode [-- Attachment #1: Type: text/plain, Size: 1554 bytes --] "Christopher M. Miles" <numbchild@gmail.com> writes: > [[PGP Signed Part:Undecided]] > > Ihor Radchenko <yantar92@gmail.com> writes: > >> "Christopher M. Miles" <numbchild@gmail.com> writes: >> >>>> When I put it on beginning of org document, then preview inline images, but those global attributes >>>> not affected. The inline images still display in actual image size. I want to specify image size >>>> under headline properties. Is it possible to do this? >>> >>> I implemented this feature by written a hook. Hope this can be helpful >>> for someone who also has this needs. Here is the code: >> >> This looks useful. >> Would you be interested to write a patch? > > The is the new patch which updated the defcustom variable docstring has correct description. > > [2. text/x-patch; 0001-org.el-Add-hook-function-to-auto-display-inline-imag.patch]... I found an issue of this patch, this patch logic will ignore existing ~#+ATTR_ORG:~ size. How to let this patch code also obey the ~#+ATTR_ORG:~ size too? For example: * heading 1 :PROPERTIES: :INLINE-IMAGE-WIDTH: 100 :END: #+ATTR_ORG: :width 300 #+ATTR_LATEX: :width 3.0in #+ATTR_HTML: :width 300px [[file:image-displayed-in-300-width.png]] [[file:image-displayed-in-100-width.png]] -- [ stardiviner ] I try to make every word tell the meaning that I want to express without misunderstanding. Blog: https://stardiviner.github.io/ IRC(libera.chat, freenode): stardiviner, Matrix: stardiviner GPG: F09F650D7D674819892591401B5DF1C95AE89AC3 [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 487 bytes --] ^ permalink raw reply [flat|nested] 43+ messages in thread
[parent not found: <631e92ee.050a0220.f9c18.92f5SMTPIN_ADDED_BROKEN@mx.google.com>]
* Re: [PATCH] New: auto display inline images under subtree when `org-cycle'. [not found] ` <631e92ee.050a0220.f9c18.92f5SMTPIN_ADDED_BROKEN@mx.google.com> @ 2022-09-12 10:51 ` Ihor Radchenko 2022-09-13 1:09 ` [PATCH 2] " Christopher M. Miles [not found] ` <m2leqogiz8.fsf@numbchild> 0 siblings, 2 replies; 43+ messages in thread From: Ihor Radchenko @ 2022-09-12 10:51 UTC (permalink / raw) To: Christopher M. Miles; +Cc: emacs-orgmode "Christopher M. Miles" <numbchild@gmail.com> writes: > Ihor Radchenko <yantar92@gmail.com> writes: > >> "Christopher M. Miles" <numbchild@gmail.com> writes: >> >>>> When I put it on beginning of org document, then preview inline images, but those global attributes >>>> not affected. The inline images still display in actual image size. I want to specify image size >>>> under headline properties. Is it possible to do this? >>> >>> I implemented this feature by written a hook. Hope this can be helpful >>> for someone who also has this needs. Here is the code: >> >> This looks useful. >> Would you be interested to write a patch? > > The is the new patch which updated the defcustom variable docstring has correct description. Thanks for the patch! Before extending org-cycle functionality, let's first try to sort out subtree-level setting of the image size. In the patch, you are suggesting to use INLINE-IMAGE-WIDTH property. However, if we apply the patch as is, this property will only be useful when calling a single function - `org-display-subtree-with-inline-images'. It is not ideal. If we introduce subtree-level setting for inline image size, it should also work when displaying inline images by other existing means (org-toggle-inline-images). Instead of working around the existing code of `org-display-inline-images' and setting a custom `org-image-actual-width' variable in buffer, it is much better to change `org-display-inline-images' directly. At the end, the patch is not bound to your personal config - feel free to alter the existing Org functions. Similarly, you do not need to do (add-to-list 'org-default-properties "INLINE-IMAGE-WIDTH") Simply change the default value of `org-default-properties'. Finally, it will be more consistent to name the property closer to the variable name: ORG-IMAGE-ACTUAL-WIDTH. -- Ihor Radchenko, 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 ^ permalink raw reply [flat|nested] 43+ messages in thread
* [PATCH 2] New: auto display inline images under subtree when `org-cycle'. 2022-09-12 10:51 ` Ihor Radchenko @ 2022-09-13 1:09 ` Christopher M. Miles [not found] ` <m2leqogiz8.fsf@numbchild> 1 sibling, 0 replies; 43+ messages in thread From: Christopher M. Miles @ 2022-09-13 1:09 UTC (permalink / raw) To: Ihor Radchenko; +Cc: Christopher M. Miles, emacs-orgmode [-- Attachment #1.1: Type: text/plain, Size: 3164 bytes --] Ihor Radchenko <yantar92@gmail.com> writes: > "Christopher M. Miles" <numbchild@gmail.com> writes: > >> Ihor Radchenko <yantar92@gmail.com> writes: >> >>> "Christopher M. Miles" <numbchild@gmail.com> writes: >>> >>>>> When I put it on beginning of org document, then preview inline images, but those global attributes >>>>> not affected. The inline images still display in actual image size. I want to specify image size >>>>> under headline properties. Is it possible to do this? >>>> >>>> I implemented this feature by written a hook. Hope this can be helpful >>>> for someone who also has this needs. Here is the code: >>> >>> This looks useful. >>> Would you be interested to write a patch? >> >> The is the new patch which updated the defcustom variable docstring has correct description. > > Thanks for the patch! > Before extending org-cycle functionality, let's first try to sort out > subtree-level setting of the image size. This is implemented by retrieve subtree-level property value in function ~~org-display-inline-image--width~~. I submitted two separated patches. > > In the patch, you are suggesting to use INLINE-IMAGE-WIDTH property. > However, if we apply the patch as is, this property will only be useful > when calling a single function - > `org-display-subtree-with-inline-images'. > It is not ideal. The patch's purpose is auto display inline images when [TAB] (~org-cycle~) expanding heading or subtrees. Not for global ~org-toggle-inline-images~. Also, introduce a new extra argument "~state~" for ~org-display-inline-images~ like bellowing is not ideal. I think should separate the ~org-cycle~ logic instead of put in ~org-display-inline-images~. In global scope, ~org-toggle-inline-images~ already respect the updated function ~org-display-inline-image--width~, it should respect the subtree property width. #+begin_src emacs-lisp ;; V ;; ----- (defun org-display-inline-images (&optional state include-linked refresh beg end) ...) #+end_src *NOTE*: Because ~org-cycle-hook~ will pass a ~state~ variable to hook function. > > If we introduce subtree-level setting for inline image size, it should > also work when displaying inline images by other existing means > (org-toggle-inline-images). This is implemented by retrieve subtree-level property value in function ~~org-display-inline-image--width~~. > > Instead of working around the existing code of > `org-display-inline-images' and setting a custom > `org-image-actual-width' variable in buffer, it is much better to change > `org-display-inline-images' directly. At the end, the patch is not bound > to your personal config - feel free to alter the existing Org functions. This is implemented by retrieve subtree-level property value in function ~~org-display-inline-image--width~~. > > Similarly, you do not need to do > (add-to-list 'org-default-properties "INLINE-IMAGE-WIDTH") > Simply change the default value of `org-default-properties'. Updated > > Finally, it will be more consistent to name the property closer to the > variable name: ORG-IMAGE-ACTUAL-WIDTH. Updated [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #1.2: subtree-level property width support --] [-- Type: text/x-patch, Size: 2436 bytes --] From cc322145c2248e95bc76fee7e6d33f575d93e79f Mon Sep 17 00:00:00 2001 From: stardiviner <numbchild@gmail.com> Date: Mon, 12 Sep 2022 09:45:09 +0800 Subject: [PATCH 1/2] org.el: Support subtree-level image width specification * lisp/org.el (org-display-inline-image--width): Detect subtree-level property "ORG-IMAGE-ACTUAL-WIDTH" value as image width before fallback. --- lisp/org.el | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/lisp/org.el b/lisp/org.el index 6e6c437d5..70333c609 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -12199,7 +12199,8 @@ but in some other way.") "EXPORT_OPTIONS" "EXPORT_TEXT" "EXPORT_FILE_NAME" "EXPORT_TITLE" "EXPORT_AUTHOR" "EXPORT_DATE" "UNNUMBERED" "ORDERED" "NOBLOCKING" "COOKIE_DATA" "LOG_INTO_DRAWER" "REPEAT_TO_STATE" - "CLOCK_MODELINE_TOTAL" "STYLE" "HTML_CONTAINER_CLASS") + "CLOCK_MODELINE_TOTAL" "STYLE" "HTML_CONTAINER_CLASS" + "ORG-IMAGE-ACTUAL-WIDTH") "Some properties that are used by Org mode for various purposes. Being in this list makes sure that they are offered for completion.") @@ -16241,14 +16242,19 @@ buffer boundaries with possible narrowing." (org-element-property :begin par) (re-search-forward attr-re par-end t))) (match-string 1))) + ;; support subtree-level property "ORG-IMAGE-ACTUAL-WIDTH" specified width. + (subtree-property-width + (ignore-errors (org-property-or-variable-value 'ORG-IMAGE-ACTUAL-WIDTH))) (width (cond ;; Treat :width t as if `org-image-actual-width' were t. ((string= attr-width "t") nil) - ;; Fallback to `org-image-actual-width' if no interprable width is given. ((or (null attr-width) (string-match-p "\\`[^0-9]" attr-width)) - (car org-image-actual-width)) + ;; Try to use subtree-level width before fallback. + (or subtree-property-width + ;; Fallback to `org-image-actual-width' if no interprable width is given. + (car org-image-actual-width))) ;; Convert numeric widths to numbers, converting percentages. ((string-match-p "\\`[0-9.]+%" attr-width) (/ (string-to-number attr-width) 100.0)) -- 2.37.2 [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #1.3: org-cycle-hook function support --] [-- Type: text/x-patch, Size: 2997 bytes --] From 98babf12b2d9dbc38250186e0284fad6d937e3f3 Mon Sep 17 00:00:00 2001 From: stardiviner <numbchild@gmail.com> Date: Tue, 13 Sep 2022 09:04:03 +0800 Subject: [PATCH 2/2] org.el: Add hook function to auto display inline images of subtree * lisp/org.el (org-display-subtree-with-inline-images): Add an option and hook function to auto display of inline images under current expanded visible subtree. --- lisp/org.el | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/lisp/org.el b/lisp/org.el index 70333c609..30716c04e 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -1108,6 +1108,13 @@ the following lines anywhere in the buffer: :version "24.1" :type 'boolean) +(defcustom org-cycle-display-inline-images nil + "Non-nil means auto display inline images under subtree when `org-cycle' +by the function `org-display-subtree-with-inline-images' on hook `org-cycle-hook'." + :group 'org-startup + :version "24.1" + :type 'boolean) + (defcustom org-startup-with-latex-preview nil "Non-nil means preview LaTeX fragments when loading a new Org file. @@ -16216,6 +16223,38 @@ buffer boundaries with possible narrowing." (overlay-put ov 'keymap image-map)) (push ov org-inline-image-overlays)))))))))))))))) +(defun org-display-subtree-inline-images (&optional state) + "Toggle the display of inline images under current expanded visible subtree. +This hook function will auto display or hide inline images after `org-cycle'. +It is used to hook on `org-cycle-hook'. +The function behavior is controlled by `org-cycle-display-inline-images'." + (interactive) + (when (and org-cycle-display-inline-images + ;; not global state change from `org-cycle-global'. + (not (memq state '(overview contents all)))) + (pcase state + ('children + (save-excursion + (save-restriction + (org-narrow-to-subtree) + ;; If has nested headlines, beg,end only from parent headling + ;; to first child headline which reference to upper let-binding + ;; `org-next-visible-heading'. + (org-display-inline-images t t (point-min) (progn (org-next-visible-heading 1) (point)))))) + ('subtree + (save-excursion + (save-restriction + (org-narrow-to-subtree) + ;; If has nested headlines, also display inline images under all subtrees. + (org-display-inline-images t t (point-min) (point-max))))) + ('folded + (org-narrow-to-subtree) + (mapc #'delete-overlay (overlays-in (point-min) (point-max)))) + ('nil (funcall 'org-toggle-inline-images)) + (t nil)))) + +(add-hook 'org-cycle-hook #'org-display-subtree-inline-images) + (defvar visual-fill-column-width) ; Silence compiler warning (defun org-display-inline-image--width (link) "Determine the display width of the image LINK, in pixels. -- 2.37.2 [-- Attachment #1.4: Type: text/plain, Size: 269 bytes --] -- [ stardiviner ] I try to make every word tell the meaning that I want to express without misunderstanding. Blog: https://stardiviner.github.io/ IRC(libera.chat, freenode): stardiviner, Matrix: stardiviner GPG: F09F650D7D674819892591401B5DF1C95AE89AC3 [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 487 bytes --] ^ permalink raw reply related [flat|nested] 43+ messages in thread
[parent not found: <m2leqogiz8.fsf@numbchild>]
* [PATCH 3] New: auto display inline images under subtree when `org-cycle'. [not found] ` <m2leqogiz8.fsf@numbchild> @ 2022-09-13 1:48 ` Christopher M. Miles [not found] ` <631fe1c9.050a0220.3ab2b.3f52SMTPIN_ADDED_BROKEN@mx.google.com> 1 sibling, 0 replies; 43+ messages in thread From: Christopher M. Miles @ 2022-09-13 1:48 UTC (permalink / raw) To: Ihor Radchenko; +Cc: Christopher M. Miles, emacs-orgmode [-- Attachment #1.1: Type: text/plain, Size: 183 bytes --] "Christopher M. Miles" <numbchild@gmail.com> writes: Ihor, My new patch still have some issue in the 'fold state which I added "FIXME" marker. Hope can get some solution from you. [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #1.2: 0001-org.el-Support-subtree-level-image-width-specificati.patch --] [-- Type: text/x-patch, Size: 2436 bytes --] From 4a56ec6b09e09d92a81e3aa72f4197d716d0ca87 Mon Sep 17 00:00:00 2001 From: stardiviner <numbchild@gmail.com> Date: Mon, 12 Sep 2022 09:45:09 +0800 Subject: [PATCH 1/2] org.el: Support subtree-level image width specification * lisp/org.el (org-display-inline-image--width): Detect subtree-level property "ORG-IMAGE-ACTUAL-WIDTH" value as image width before fallback. --- lisp/org.el | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/lisp/org.el b/lisp/org.el index 4eef56f45..07c86229b 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -12128,7 +12128,8 @@ but in some other way.") "EXPORT_OPTIONS" "EXPORT_TEXT" "EXPORT_FILE_NAME" "EXPORT_TITLE" "EXPORT_AUTHOR" "EXPORT_DATE" "UNNUMBERED" "ORDERED" "NOBLOCKING" "COOKIE_DATA" "LOG_INTO_DRAWER" "REPEAT_TO_STATE" - "CLOCK_MODELINE_TOTAL" "STYLE" "HTML_CONTAINER_CLASS") + "CLOCK_MODELINE_TOTAL" "STYLE" "HTML_CONTAINER_CLASS" + "ORG-IMAGE-ACTUAL-WIDTH") "Some properties that are used by Org mode for various purposes. Being in this list makes sure that they are offered for completion.") @@ -16164,14 +16165,19 @@ buffer boundaries with possible narrowing." (org-element-property :begin par) (re-search-forward attr-re par-end t))) (match-string 1))) + ;; support subtree-level property "ORG-IMAGE-ACTUAL-WIDTH" specified width. + (subtree-property-width + (ignore-errors (org-property-or-variable-value 'ORG-IMAGE-ACTUAL-WIDTH))) (width (cond ;; Treat :width t as if `org-image-actual-width' were t. ((string= attr-width "t") nil) - ;; Fallback to `org-image-actual-width' if no interprable width is given. ((or (null attr-width) (string-match-p "\\`[^0-9]" attr-width)) - (car org-image-actual-width)) + ;; Try to use subtree-level width before fallback. + (or subtree-property-width + ;; Fallback to `org-image-actual-width' if no interprable width is given. + (car org-image-actual-width))) ;; Convert numeric widths to numbers, converting percentages. ((string-match-p "\\`[0-9.]+%" attr-width) (/ (string-to-number attr-width) 100.0)) -- 2.37.2 [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #1.3: 0002-org.el-Add-hook-function-to-auto-display-inline-imag.patch --] [-- Type: text/x-patch, Size: 3177 bytes --] From 2fc76c4581b60c6631186bfdc489732075432c26 Mon Sep 17 00:00:00 2001 From: stardiviner <numbchild@gmail.com> Date: Tue, 13 Sep 2022 09:04:03 +0800 Subject: [PATCH 2/2] org.el: Add hook function to auto display inline images of subtree * lisp/org.el (org-display-subtree-with-inline-images): Add an option and hook function to auto display of inline images under current expanded visible subtree. --- lisp/org.el | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/lisp/org.el b/lisp/org.el index 07c86229b..0bd942e07 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -1104,6 +1104,13 @@ the following lines anywhere in the buffer: :version "24.1" :type 'boolean) +(defcustom org-cycle-display-inline-images nil + "Non-nil means auto display inline images under subtree when `org-cycle' +by the function `org-display-subtree-with-inline-images' on hook `org-cycle-hook'." + :group 'org-startup + :version "24.1" + :type 'boolean) + (defcustom org-startup-with-latex-preview nil "Non-nil means preview LaTeX fragments when loading a new Org file. @@ -16139,6 +16146,42 @@ buffer boundaries with possible narrowing." (overlay-put ov 'keymap image-map)) (push ov org-inline-image-overlays)))))))))))))))) +(defun org-display-subtree-inline-images (&optional state) + "Toggle the display of inline images under current expanded visible subtree. +This hook function will auto display or hide inline images after `org-cycle'. +It is used to hook on `org-cycle-hook'. +The function behavior is controlled by `org-cycle-display-inline-images'." + (interactive) + (when (and org-cycle-display-inline-images + ;; not global state change from `org-cycle-global'. + (not (memq state '(overview contents all)))) + (pcase state + ('children + (save-excursion + (save-restriction + (org-narrow-to-subtree) + ;; If has nested headlines, beg,end only from parent headling + ;; to first child headline which reference to upper let-binding + ;; `org-next-visible-heading'. + (org-display-inline-images t t (point-min) (progn (org-next-visible-heading 1) (point)))))) + ('subtree + (save-excursion + (save-restriction + (org-narrow-to-subtree) + ;; If has nested headlines, also display inline images under all subtrees. + (org-display-inline-images t t (point-min) (point-max))))) + ('folded + ;; (save-excursion + ;; (save-restriction + ;; (org-narrow-to-subtree) + ;; ;; FIXME: this will auto expand heading caused `org-cycle' folded failed. + ;; (mapc #'delete-overlay (overlays-in (point-min) (point-max))))) + ) + ('nil (funcall 'org-toggle-inline-images)) + (t nil)))) + +(add-hook 'org-cycle-hook #'org-display-subtree-inline-images) + (defvar visual-fill-column-width) ; Silence compiler warning (defun org-display-inline-image--width (link) "Determine the display width of the image LINK, in pixels. -- 2.37.2 [-- Attachment #1.4: Type: text/plain, Size: 269 bytes --] -- [ stardiviner ] I try to make every word tell the meaning that I want to express without misunderstanding. Blog: https://stardiviner.github.io/ IRC(libera.chat, freenode): stardiviner, Matrix: stardiviner GPG: F09F650D7D674819892591401B5DF1C95AE89AC3 [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 487 bytes --] ^ permalink raw reply related [flat|nested] 43+ messages in thread
[parent not found: <631fe1c9.050a0220.3ab2b.3f52SMTPIN_ADDED_BROKEN@mx.google.com>]
* Re: [PATCH 3] New: auto display inline images under subtree when `org-cycle'. [not found] ` <631fe1c9.050a0220.3ab2b.3f52SMTPIN_ADDED_BROKEN@mx.google.com> @ 2022-09-15 3:27 ` Ihor Radchenko 2022-09-15 4:53 ` [PATCH 4] " Christopher M. Miles [not found] ` <6322b0a8.050a0220.59bb8.6923SMTPIN_ADDED_BROKEN@mx.google.com> 0 siblings, 2 replies; 43+ messages in thread From: Ihor Radchenko @ 2022-09-15 3:27 UTC (permalink / raw) To: Christopher M. Miles; +Cc: emacs-orgmode "Christopher M. Miles" <numbchild@gmail.com> writes: > Ihor, My new patch still have some issue in the 'fold state which I > added "FIXME" marker. Hope can get some solution from you. I will comment only on the first patch for now. > "EXPORT_OPTIONS" "EXPORT_TEXT" "EXPORT_FILE_NAME" > "EXPORT_TITLE" "EXPORT_AUTHOR" "EXPORT_DATE" "UNNUMBERED" > "ORDERED" "NOBLOCKING" "COOKIE_DATA" "LOG_INTO_DRAWER" "REPEAT_TO_STATE" > - "CLOCK_MODELINE_TOTAL" "STYLE" "HTML_CONTAINER_CLASS") > + "CLOCK_MODELINE_TOTAL" "STYLE" "HTML_CONTAINER_CLASS" > + "ORG-IMAGE-ACTUAL-WIDTH") This change should also be mentioned in the commit message. > @@ -16164,14 +16165,19 @@ buffer boundaries with possible narrowing." > (org-element-property :begin par) > (re-search-forward attr-re par-end t))) > (match-string 1))) > + ;; support subtree-level property "ORG-IMAGE-ACTUAL-WIDTH" specified width. > + (subtree-property-width > + (ignore-errors (org-property-or-variable-value 'ORG-IMAGE-ACTUAL-WIDTH))) You are checking the property too late. I suggest to let-bind org-image-actual-width around the whole `cond' instead. That way, subtree-local value of ORG-IMAGE-ACTUAL-WIDTH will have an effect of setting `org-image-actual-width' value. Also, is there any particular reason why you wrap `org-property-or-variable-value' into `ignore-errors'? Finally, you can simply do (org-property-or-variable-value 'org-image-actual-width) It will return the property value _or_ org-image-actual-width value. > - (car org-image-actual-width)) > + ;; Try to use subtree-level width before fallback. > + (or subtree-property-width > + ;; Fallback to `org-image-actual-width' if no interprable width is given. > + (car org-image-actual-width))) With my last suggestion, this code will not be needed. Also, this change should be documented in etc/NEWS and also in "12.7 Images" section of the manual. -- Ihor Radchenko, 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 ^ permalink raw reply [flat|nested] 43+ messages in thread
* [PATCH 4] New: auto display inline images under subtree when `org-cycle'. 2022-09-15 3:27 ` Ihor Radchenko @ 2022-09-15 4:53 ` Christopher M. Miles [not found] ` <6322b0a8.050a0220.59bb8.6923SMTPIN_ADDED_BROKEN@mx.google.com> 1 sibling, 0 replies; 43+ messages in thread From: Christopher M. Miles @ 2022-09-15 4:53 UTC (permalink / raw) To: Ihor Radchenko; +Cc: Christopher M. Miles, emacs-orgmode [-- Attachment #1.1: Type: text/plain, Size: 2681 bytes --] Ihor Radchenko <yantar92@gmail.com> writes: > "Christopher M. Miles" <numbchild@gmail.com> writes: > >> Ihor, My new patch still have some issue in the 'fold state which I >> added "FIXME" marker. Hope can get some solution from you. > > I will comment only on the first patch for now. > >> "EXPORT_OPTIONS" "EXPORT_TEXT" "EXPORT_FILE_NAME" >> "EXPORT_TITLE" "EXPORT_AUTHOR" "EXPORT_DATE" "UNNUMBERED" >> "ORDERED" "NOBLOCKING" "COOKIE_DATA" "LOG_INTO_DRAWER" "REPEAT_TO_STATE" >> - "CLOCK_MODELINE_TOTAL" "STYLE" "HTML_CONTAINER_CLASS") >> + "CLOCK_MODELINE_TOTAL" "STYLE" "HTML_CONTAINER_CLASS" >> + "ORG-IMAGE-ACTUAL-WIDTH") > > This change should also be mentioned in the commit message. Done > >> @@ -16164,14 +16165,19 @@ buffer boundaries with possible narrowing." >> (org-element-property :begin par) >> (re-search-forward attr-re par-end t))) >> (match-string 1))) >> + ;; support subtree-level property "ORG-IMAGE-ACTUAL-WIDTH" specified width. >> + (subtree-property-width >> + (ignore-errors (org-property-or-variable-value 'ORG-IMAGE-ACTUAL-WIDTH))) > > You are checking the property too late. I suggest to let-bind > org-image-actual-width around the whole `cond' instead. > > That way, subtree-local value of ORG-IMAGE-ACTUAL-WIDTH will have an > effect of setting `org-image-actual-width' value. Done > > Also, is there any particular reason why you wrap > `org-property-or-variable-value' into `ignore-errors'? Remove, I originally use another property keyword instead of ORG-IMAGE-ACTUAL-WIDTH, so ~org-property-or-variable-value~ will raise error if property does not exist. SO I added ~ignore-errors~. Now removed. > > Finally, you can simply do > > (org-property-or-variable-value 'org-image-actual-width) > > It will return the property value _or_ org-image-actual-width value. > Done >> - (car org-image-actual-width)) >> + ;; Try to use subtree-level width before fallback. >> + (or subtree-property-width >> + ;; Fallback to `org-image-actual-width' if no interprable width is given. >> + (car org-image-actual-width))) > > With my last suggestion, this code will not be needed. Done > > Also, this change should be documented in etc/NEWS and also in > "12.7 Images" section of the manual. Done. (the manual, you mean org-manual.org right? I found too many documents under doc/ folder, confused for a while....) P.S: I merged two commits into one for clear. [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #1.2: 0001-org.el-Add-hook-function-to-auto-display-inline-imag.patch --] [-- Type: text/x-patch, Size: 10536 bytes --] From 4ba9bb3063bde50511457b1d30f1299a85e3ffaf Mon Sep 17 00:00:00 2001 From: stardiviner <numbchild@gmail.com> Date: Mon, 12 Sep 2022 09:45:09 +0800 Subject: [PATCH] org.el: Add hook function to auto display inline images of subtree * lisp/org.el (org-display-subtree-with-inline-images): Add an option and hook function to auto display of inline images under current expanded visible subtree. * lisp/org.el (org-display-inline-image--width): support subtree-level property "ORG-IMAGE-ACTUAL-WIDTH" specified width. * lisp/org.el (org-default-properties): Add a new property in to override global org-image-actual-width subtree level. --- doc/org-manual.org | 5 ++ etc/ORG-NEWS | 5 ++ lisp/org.el | 133 ++++++++++++++++++++++++++++++--------------- 3 files changed, 100 insertions(+), 43 deletions(-) diff --git a/doc/org-manual.org b/doc/org-manual.org index a37b8390c..77274e250 100644 --- a/doc/org-manual.org +++ b/doc/org-manual.org @@ -11314,6 +11314,11 @@ command: startup by configuring the variable ~org-startup-with-inline-images~[fn:119]. +If you want to override global variable ~org-image-actual-width~ of +inline image display width, you can specify property +"=ORG-IMAGE-ACTUAL-WIDTH=" in subtree level. It will only affect +inline images under the specified subtree. + ** Captions :PROPERTIES: :DESCRIPTION: Describe tables, images... diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS index a7f32671e..42e7e4292 100644 --- a/etc/ORG-NEWS +++ b/etc/ORG-NEWS @@ -296,6 +296,11 @@ headings in HTML export. Use the header argument =:var x=code-block[]= or : #+CALL: fn(x=code-block[]) to pass the contents of a named code block as a string argument. +*** New default property =ORG-IMAGE-ACTUAL-WIDTH= for overriding global ~org-image-actual-width~ + +The subtree-level property "ORG-IMAGE-ACTUAL-WIDTH" can override the +global variable ~org-image-actual-width~ settings for inline images +width under current property specified subtree. ** New options *** New custom settings =org-icalendar-scheduled-summary-prefix= and =org-icalendar-deadline-summary-prefix= diff --git a/lisp/org.el b/lisp/org.el index 6e6c437d5..98cac1c1c 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -1108,6 +1108,13 @@ the following lines anywhere in the buffer: :version "24.1" :type 'boolean) +(defcustom org-cycle-display-inline-images nil + "Non-nil means auto display inline images under subtree when `org-cycle' +by the function `org-display-subtree-with-inline-images' on hook `org-cycle-hook'." + :group 'org-startup + :version "24.1" + :type 'boolean) + (defcustom org-startup-with-latex-preview nil "Non-nil means preview LaTeX fragments when loading a new Org file. @@ -12199,7 +12206,8 @@ but in some other way.") "EXPORT_OPTIONS" "EXPORT_TEXT" "EXPORT_FILE_NAME" "EXPORT_TITLE" "EXPORT_AUTHOR" "EXPORT_DATE" "UNNUMBERED" "ORDERED" "NOBLOCKING" "COOKIE_DATA" "LOG_INTO_DRAWER" "REPEAT_TO_STATE" - "CLOCK_MODELINE_TOTAL" "STYLE" "HTML_CONTAINER_CLASS") + "CLOCK_MODELINE_TOTAL" "STYLE" "HTML_CONTAINER_CLASS" + "ORG-IMAGE-ACTUAL-WIDTH") "Some properties that are used by Org mode for various purposes. Being in this list makes sure that they are offered for completion.") @@ -16215,6 +16223,42 @@ buffer boundaries with possible narrowing." (overlay-put ov 'keymap image-map)) (push ov org-inline-image-overlays)))))))))))))))) +(defun org-display-subtree-inline-images (&optional state) + "Toggle the display of inline images under current expanded visible subtree. +This hook function will auto display or hide inline images after `org-cycle'. +It is used to hook on `org-cycle-hook'. +The function behavior is controlled by `org-cycle-display-inline-images'." + (interactive) + (when (and org-cycle-display-inline-images + ;; not global state change from `org-cycle-global'. + (not (memq state '(overview contents all)))) + (pcase state + ('children + (save-excursion + (save-restriction + (org-narrow-to-subtree) + ;; If has nested headlines, beg,end only from parent headling + ;; to first child headline which reference to upper let-binding + ;; `org-next-visible-heading'. + (org-display-inline-images t t (point-min) (progn (org-next-visible-heading 1) (point)))))) + ('subtree + (save-excursion + (save-restriction + (org-narrow-to-subtree) + ;; If has nested headlines, also display inline images under all subtrees. + (org-display-inline-images t t (point-min) (point-max))))) + ('folded + ;; (save-excursion + ;; (save-restriction + ;; (org-narrow-to-subtree) + ;; ;; FIXME: this will auto expand heading caused `org-cycle' folded failed. + ;; (mapc #'delete-overlay (overlays-in (point-min) (point-max))))) + ) + ('nil (funcall 'org-toggle-inline-images)) + (_ nil)))) + +(add-hook 'org-cycle-hook #'org-display-subtree-inline-images) + (defvar visual-fill-column-width) ; Silence compiler warning (defun org-display-inline-image--width (link) "Determine the display width of the image LINK, in pixels. @@ -16228,48 +16272,51 @@ buffer boundaries with possible narrowing." If the value is a float between 0 and 2, it interpreted as that proportion of the text width in the buffer." ;; Apply `org-image-actual-width' specifications. - (cond - ((eq org-image-actual-width t) nil) - ((listp org-image-actual-width) - (let* ((case-fold-search t) - (par (org-element-lineage link '(paragraph))) - (attr-re "^[ \t]*#\\+attr_.*?: +.*?:width +\\(\\S-+\\)") - (par-end (org-element-property :post-affiliated par)) - ;; Try to find an attribute providing a :width. - (attr-width - (when (and par (org-with-point-at - (org-element-property :begin par) - (re-search-forward attr-re par-end t))) - (match-string 1))) - (width - (cond - ;; Treat :width t as if `org-image-actual-width' were t. - ((string= attr-width "t") nil) - ;; Fallback to `org-image-actual-width' if no interprable width is given. - ((or (null attr-width) - (string-match-p "\\`[^0-9]" attr-width)) - (car org-image-actual-width)) - ;; Convert numeric widths to numbers, converting percentages. - ((string-match-p "\\`[0-9.]+%" attr-width) - (/ (string-to-number attr-width) 100.0)) - (t (string-to-number attr-width))))) - (if (and (floatp width) (<= 0.0 width 2.0)) - ;; A float in [0,2] should be interpereted as this portion of - ;; the text width in the window. This works well with cases like - ;; #+attr_latex: :width 0.X\{line,page,column,etc.}width, - ;; as the "0.X" is pulled out as a float. We use 2 as the upper - ;; bound as cases such as 1.2\linewidth are feasible. - (round (* width - (window-pixel-width) - (/ (or (and (bound-and-true-p visual-fill-column-mode) - (or visual-fill-column-width auto-fill-function)) - (when auto-fill-function fill-column) - (- (window-text-width) (line-number-display-width))) - (float (window-total-width))))) - width))) - ((numberp org-image-actual-width) - org-image-actual-width) - (t nil))) + ;; support subtree-level property "ORG-IMAGE-ACTUAL-WIDTH" specified width. + (let ((org-image-actual-width (org-property-or-variable-value 'org-image-actual-width))) + (cond + ((eq org-image-actual-width t) nil) + ((listp org-image-actual-width) + (let* ((case-fold-search t) + (par (org-element-lineage link '(paragraph))) + (attr-re "^[ \t]*#\\+attr_.*?: +.*?:width +\\(\\S-+\\)") + (par-end (org-element-property :post-affiliated par)) + ;; Try to find an attribute providing a :width. + (attr-width + (when (and par (org-with-point-at + (org-element-property :begin par) + (re-search-forward attr-re par-end t))) + (match-string 1))) + (width + (cond + ;; Treat :width t as if `org-image-actual-width' were t. + ((string= attr-width "t") nil) + ((or (null attr-width) + (string-match-p "\\`[^0-9]" attr-width)) + ;; Try to use subtree-level width before fallback. + ;; Fallback to `org-image-actual-width' if no interprable width is given. + (car org-image-actual-width)) + ;; Convert numeric widths to numbers, converting percentages. + ((string-match-p "\\`[0-9.]+%" attr-width) + (/ (string-to-number attr-width) 100.0)) + (t (string-to-number attr-width))))) + (if (and (floatp width) (<= 0.0 width 2.0)) + ;; A float in [0,2] should be interpereted as this portion of + ;; the text width in the window. This works well with cases like + ;; #+attr_latex: :width 0.X\{line,page,column,etc.}width, + ;; as the "0.X" is pulled out as a float. We use 2 as the upper + ;; bound as cases such as 1.2\linewidth are feasible. + (round (* width + (window-pixel-width) + (/ (or (and (bound-and-true-p visual-fill-column-mode) + (or visual-fill-column-width auto-fill-function)) + (when auto-fill-function fill-column) + (- (window-text-width) (line-number-display-width))) + (float (window-total-width))))) + width))) + ((numberp org-image-actual-width) + org-image-actual-width) + (t nil)))) (defun org-display-inline-remove-overlay (ov after _beg _end &optional _len) "Remove inline-display overlay if a corresponding region is modified." -- 2.37.2 [-- Attachment #1.3: Type: text/plain, Size: 267 bytes --] -- [ stardiviner ] I try to make every word tell the meaning that I want to express without misunderstanding. Blog: https://stardiviner.github.io/ IRC(libera.chat, freenode): stardiviner, Matrix: stardiviner GPG: F09F650D7D674819892591401B5DF1C95AE89AC3 [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 487 bytes --] ^ permalink raw reply related [flat|nested] 43+ messages in thread
[parent not found: <6322b0a8.050a0220.59bb8.6923SMTPIN_ADDED_BROKEN@mx.google.com>]
* Re: [PATCH 4] New: auto display inline images under subtree when `org-cycle'. [not found] ` <6322b0a8.050a0220.59bb8.6923SMTPIN_ADDED_BROKEN@mx.google.com> @ 2022-09-15 8:47 ` Ihor Radchenko 2022-09-15 9:43 ` [PATCH 5] " Christopher M. Miles [not found] ` <6322f5ad.c80a0220.5e936.823eSMTPIN_ADDED_BROKEN@mx.google.com> 0 siblings, 2 replies; 43+ messages in thread From: Ihor Radchenko @ 2022-09-15 8:47 UTC (permalink / raw) To: Christopher M. Miles; +Cc: emacs-orgmode "Christopher M. Miles" <numbchild@gmail.com> writes: >> Also, this change should be documented in etc/NEWS and also in >> "12.7 Images" section of the manual. > > Done. (the manual, you mean org-manual.org right? I found too many > documents under doc/ folder, confused for a while....) I meant doc/org-manual.org Note doc/Documentation_Standards.org for the conventions we use in the manual. Your patch does not follow those conventions (double space between sentences). > P.S: I merged two commits into one for clear. Let's not do it. They are two distinct changes and I will have significant comments regarding subtree cycling. (I had plans to implement <TAB> cycling at point for images, and we may as well take this chance to create some generic infrastructure for showing/hiding the inline images). For now, lets sort out the ORG-IMAGE-ACTUAL-WIDTH property and get it merges. Then, we can move ahead to the subtree cycling feature. > * lisp/org.el (org-display-inline-image--width): support subtree-level ^S > +If you want to override global variable ~org-image-actual-width~ of > +inline image display width, you can specify property > +"=ORG-IMAGE-ACTUAL-WIDTH=" in subtree level. It will only affect > +inline images under the specified subtree. Could you also add a paragraph describing what org-image-actual-width does? > +*** New default property =ORG-IMAGE-ACTUAL-WIDTH= for overriding global ~org-image-actual-width~ I think that people may be confused by "default property" here. Just say "new property". > +The subtree-level property "ORG-IMAGE-ACTUAL-WIDTH" can override the > +global variable ~org-image-actual-width~ settings for inline images > +width under current property specified subtree. It is not necessarily subtree-level. You can as well set it in document-wide property drawer. Just say "The new property ... overrides ...". -- Ihor Radchenko, 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 ^ permalink raw reply [flat|nested] 43+ messages in thread
* [PATCH 5] New: auto display inline images under subtree when `org-cycle'. 2022-09-15 8:47 ` Ihor Radchenko @ 2022-09-15 9:43 ` Christopher M. Miles [not found] ` <6322f5ad.c80a0220.5e936.823eSMTPIN_ADDED_BROKEN@mx.google.com> 1 sibling, 0 replies; 43+ messages in thread From: Christopher M. Miles @ 2022-09-15 9:43 UTC (permalink / raw) To: Ihor Radchenko; +Cc: Christopher M. Miles, emacs-orgmode [-- Attachment #1.1: Type: text/plain, Size: 2414 bytes --] Sorry for this hard work on this patch. And thanks for your carefully code reviewing. I have not contribute to org-mode for a long time, already forgot most guidelines. Regards Ihor Radchenko <yantar92@gmail.com> writes: > "Christopher M. Miles" <numbchild@gmail.com> writes: > >>> Also, this change should be documented in etc/NEWS and also in >>> "12.7 Images" section of the manual. >> >> Done. (the manual, you mean org-manual.org right? I found too many >> documents under doc/ folder, confused for a while....) > > I meant doc/org-manual.org > Note doc/Documentation_Standards.org for the conventions we use in the > manual. Your patch does not follow those conventions (double space > between sentences). Done > >> P.S: I merged two commits into one for clear. > > Let's not do it. They are two distinct changes and I will have > significant comments regarding subtree cycling. (I had plans to > implement <TAB> cycling at point for images, and we may as well take this > chance to create some generic infrastructure for showing/hiding the > inline images). > > For now, lets sort out the ORG-IMAGE-ACTUAL-WIDTH property and get it > merges. Then, we can move ahead to the subtree cycling feature. > Ok, I will submit the first patch of new property at first. If you're going to implement this <TAB> cycling inline image display feature, that's great! >> * lisp/org.el (org-display-inline-image--width): support subtree-level > ^S > >> +If you want to override global variable ~org-image-actual-width~ of >> +inline image display width, you can specify property >> +"=ORG-IMAGE-ACTUAL-WIDTH=" in subtree level. It will only affect >> +inline images under the specified subtree. > > Could you also add a paragraph describing what org-image-actual-width > does? Done in doc/org-manual.org > >> +*** New default property =ORG-IMAGE-ACTUAL-WIDTH= for overriding global ~org-image-actual-width~ > > I think that people may be confused by "default property" here. Just say > "new property". Done > >> +The subtree-level property "ORG-IMAGE-ACTUAL-WIDTH" can override the >> +global variable ~org-image-actual-width~ settings for inline images >> +width under current property specified subtree. > > It is not necessarily subtree-level. You can as well set it in > document-wide property drawer. Just say "The new property ... > overrides ...". Done [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #1.2: 0001-org.el-Support-subtree-level-org-image-actual-width-.patch --] [-- Type: text/x-patch, Size: 8384 bytes --] From 1bc3224220ec71292e08ebc6b25e0064f7243f2e Mon Sep 17 00:00:00 2001 From: stardiviner <numbchild@gmail.com> Date: Thu, 15 Sep 2022 17:25:13 +0800 Subject: [PATCH] org.el: Support subtree-level org-image-actual-width overriding * lisp/org.el (org-display-inline-image--width): Support new property "ORG-IMAGE-ACTUAL-WIDTH" overriding global variable `org-image-actual-width'. --- doc/org-manual.org | 21 +++++++++++ etc/ORG-NEWS | 4 +++ lisp/org.el | 89 ++++++++++++++++++++++++---------------------- 3 files changed, 71 insertions(+), 43 deletions(-) diff --git a/doc/org-manual.org b/doc/org-manual.org index a37b8390c..2d2b93694 100644 --- a/doc/org-manual.org +++ b/doc/org-manual.org @@ -11314,6 +11314,27 @@ command: startup by configuring the variable ~org-startup-with-inline-images~[fn:119]. + #+vindex: org-image-actual-width + Control the display size of inline images. + The value can be bellowing formats: + - When non-nil, use the actual width of images when inlining them. + - When set to a number, use imagemagick (when available) to set the + image's width to this value. + - When set to a number in a list, try to get the width from any + =#+ATTR.*= keyword if it matches a width specification like: + #+ATTR_HTML: :width 300px + and fall back on that number if none is found. + - When set to nil, try to get the width from an =#+ATTR.*= keyword + and fall back on the original width if none is found. + - When set to any other non-nil value, always use the image width. + + This requires Emacs >= 24.1, built with imagemagick support. + + #+cindex: @samp{NOBLOCKING}, property + If you want to override the global variable ~org-image-actual-width~ + of inline image display width, you can specify property + "=ORG-IMAGE-ACTUAL-WIDTH=". + ** Captions :PROPERTIES: :DESCRIPTION: Describe tables, images... diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS index a7f32671e..f30809973 100644 --- a/etc/ORG-NEWS +++ b/etc/ORG-NEWS @@ -296,6 +296,10 @@ headings in HTML export. Use the header argument =:var x=code-block[]= or : #+CALL: fn(x=code-block[]) to pass the contents of a named code block as a string argument. +*** New property =ORG-IMAGE-ACTUAL-WIDTH= for overriding global ~org-image-actual-width~ + +The new property "=ORG-IMAGE-ACTUAL-WIDTH=" can override the global +variable ~org-image-actual-width~ value for inline images display width. ** New options *** New custom settings =org-icalendar-scheduled-summary-prefix= and =org-icalendar-deadline-summary-prefix= diff --git a/lisp/org.el b/lisp/org.el index 6e6c437d5..d2d66038d 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -12199,7 +12199,8 @@ but in some other way.") "EXPORT_OPTIONS" "EXPORT_TEXT" "EXPORT_FILE_NAME" "EXPORT_TITLE" "EXPORT_AUTHOR" "EXPORT_DATE" "UNNUMBERED" "ORDERED" "NOBLOCKING" "COOKIE_DATA" "LOG_INTO_DRAWER" "REPEAT_TO_STATE" - "CLOCK_MODELINE_TOTAL" "STYLE" "HTML_CONTAINER_CLASS") + "CLOCK_MODELINE_TOTAL" "STYLE" "HTML_CONTAINER_CLASS" + "ORG-IMAGE-ACTUAL-WIDTH") "Some properties that are used by Org mode for various purposes. Being in this list makes sure that they are offered for completion.") @@ -16228,48 +16229,50 @@ buffer boundaries with possible narrowing." If the value is a float between 0 and 2, it interpreted as that proportion of the text width in the buffer." ;; Apply `org-image-actual-width' specifications. - (cond - ((eq org-image-actual-width t) nil) - ((listp org-image-actual-width) - (let* ((case-fold-search t) - (par (org-element-lineage link '(paragraph))) - (attr-re "^[ \t]*#\\+attr_.*?: +.*?:width +\\(\\S-+\\)") - (par-end (org-element-property :post-affiliated par)) - ;; Try to find an attribute providing a :width. - (attr-width - (when (and par (org-with-point-at - (org-element-property :begin par) - (re-search-forward attr-re par-end t))) - (match-string 1))) - (width - (cond - ;; Treat :width t as if `org-image-actual-width' were t. - ((string= attr-width "t") nil) - ;; Fallback to `org-image-actual-width' if no interprable width is given. - ((or (null attr-width) - (string-match-p "\\`[^0-9]" attr-width)) - (car org-image-actual-width)) - ;; Convert numeric widths to numbers, converting percentages. - ((string-match-p "\\`[0-9.]+%" attr-width) - (/ (string-to-number attr-width) 100.0)) - (t (string-to-number attr-width))))) - (if (and (floatp width) (<= 0.0 width 2.0)) - ;; A float in [0,2] should be interpereted as this portion of - ;; the text width in the window. This works well with cases like - ;; #+attr_latex: :width 0.X\{line,page,column,etc.}width, - ;; as the "0.X" is pulled out as a float. We use 2 as the upper - ;; bound as cases such as 1.2\linewidth are feasible. - (round (* width - (window-pixel-width) - (/ (or (and (bound-and-true-p visual-fill-column-mode) - (or visual-fill-column-width auto-fill-function)) - (when auto-fill-function fill-column) - (- (window-text-width) (line-number-display-width))) - (float (window-total-width))))) - width))) - ((numberp org-image-actual-width) - org-image-actual-width) - (t nil))) + ;; support subtree-level property "ORG-IMAGE-ACTUAL-WIDTH" specified width. + (let ((org-image-actual-width (org-property-or-variable-value 'org-image-actual-width))) + (cond + ((eq org-image-actual-width t) nil) + ((listp org-image-actual-width) + (let* ((case-fold-search t) + (par (org-element-lineage link '(paragraph))) + (attr-re "^[ \t]*#\\+attr_.*?: +.*?:width +\\(\\S-+\\)") + (par-end (org-element-property :post-affiliated par)) + ;; Try to find an attribute providing a :width. + (attr-width + (when (and par (org-with-point-at + (org-element-property :begin par) + (re-search-forward attr-re par-end t))) + (match-string 1))) + (width + (cond + ;; Treat :width t as if `org-image-actual-width' were t. + ((string= attr-width "t") nil) + ;; Fallback to `org-image-actual-width' if no interprable width is given. + ((or (null attr-width) + (string-match-p "\\`[^0-9]" attr-width)) + (car org-image-actual-width)) + ;; Convert numeric widths to numbers, converting percentages. + ((string-match-p "\\`[0-9.]+%" attr-width) + (/ (string-to-number attr-width) 100.0)) + (t (string-to-number attr-width))))) + (if (and (floatp width) (<= 0.0 width 2.0)) + ;; A float in [0,2] should be interpereted as this portion of + ;; the text width in the window. This works well with cases like + ;; #+attr_latex: :width 0.X\{line,page,column,etc.}width, + ;; as the "0.X" is pulled out as a float. We use 2 as the upper + ;; bound as cases such as 1.2\linewidth are feasible. + (round (* width + (window-pixel-width) + (/ (or (and (bound-and-true-p visual-fill-column-mode) + (or visual-fill-column-width auto-fill-function)) + (when auto-fill-function fill-column) + (- (window-text-width) (line-number-display-width))) + (float (window-total-width))))) + width))) + ((numberp org-image-actual-width) + org-image-actual-width) + (t nil)))) (defun org-display-inline-remove-overlay (ov after _beg _end &optional _len) "Remove inline-display overlay if a corresponding region is modified." -- 2.37.2 [-- Attachment #1.3: Type: text/plain, Size: 267 bytes --] -- [ stardiviner ] I try to make every word tell the meaning that I want to express without misunderstanding. Blog: https://stardiviner.github.io/ IRC(libera.chat, freenode): stardiviner, Matrix: stardiviner GPG: F09F650D7D674819892591401B5DF1C95AE89AC3 [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 487 bytes --] ^ permalink raw reply related [flat|nested] 43+ messages in thread
[parent not found: <6322f5ad.c80a0220.5e936.823eSMTPIN_ADDED_BROKEN@mx.google.com>]
* [PATCH v6] Re: [PATCH 5] New: auto display inline images under subtree when `org-cycle'. [not found] ` <6322f5ad.c80a0220.5e936.823eSMTPIN_ADDED_BROKEN@mx.google.com> @ 2022-09-20 7:01 ` Ihor Radchenko 2022-09-20 11:32 ` [PATCH v6] " Christopher M. Miles [not found] ` <6329c8b0.050a0220.412d.0a6cSMTPIN_ADDED_BROKEN@mx.google.com> 0 siblings, 2 replies; 43+ messages in thread From: Ihor Radchenko @ 2022-09-20 7:01 UTC (permalink / raw) To: Christopher M. Miles; +Cc: emacs-orgmode [-- Attachment #1: Type: text/plain, Size: 522 bytes --] "Christopher M. Miles" <numbchild@gmail.com> writes: > Ok, I will submit the first patch of new property at first. If you're > going to implement this <TAB> cycling inline image display feature, > that's great! The changes to the manual are confusing after exporting. Note that #+vindex: org-image-actual-width will not be visible in html/pdf export. They only serve as info search nodes and do not appear in the actual text. I am attaching an alternative version of the patch. Let me know if you have any objections. [-- Attachment #2: v6-0001-org.el-Support-subtree-level-org-image-actual-wid.patch --] [-- Type: text/x-patch, Size: 34756 bytes --] From 475c607f874e4e78c1e13d15e36ae894b121acad Mon Sep 17 00:00:00 2001 Message-Id: <475c607f874e4e78c1e13d15e36ae894b121acad.1663656903.git.yantar92@gmail.com> From: stardiviner <numbchild@gmail.com> Date: Thu, 15 Sep 2022 17:25:13 +0800 Subject: [PATCH v6] org.el: Support subtree-level org-image-actual-width overriding * lisp/org.el (org-display-inline-image--width): Support new property "ORG-IMAGE-ACTUAL-WIDTH" overriding global variable `org-image-actual-width'. --- doc/org-manual.org | 186 +++++++++++++++++++++++++-------------------- etc/ORG-NEWS | 4 + lisp/org.el | 90 +++++++++++----------- 3 files changed, 155 insertions(+), 125 deletions(-) diff --git a/doc/org-manual.org b/doc/org-manual.org index a37b8390c..4c9c087a7 100644 --- a/doc/org-manual.org +++ b/doc/org-manual.org @@ -11314,6 +11314,24 @@ ** Images startup by configuring the variable ~org-startup-with-inline-images~[fn:119]. + + #+vindex: org-image-actual-width + #+cindex: @samp{ORG-IMAGE-ACTUAL-WIDTH}, property + By default, Org mode displays inline images according to their actual width. + You can customize the displayed image width using ~org-image-actual-width~ variable (globally) or =ORG-IMAGE-ACTUAL-WIDTH= property (subtree-level)[fn:120]. + Their value can be the following: + - (default) Non-nil, use the actual width of images when inlining them. + - When set to a number, use imagemagick (when available) to set the + image's width to this value. + - When set to a number in a list, try to get the width from any + =#+ATTR.*= keyword if it matches a width specification like: + #+begin_example + ,#+ATTR_HTML: :width 300px + #+end_example + and fall back on that number if none is found. + - When set to nil, try to get the width from an =#+ATTR.*= keyword + and fall back on the original width if none is found. + ** Captions :PROPERTIES: :DESCRIPTION: Describe tables, images... @@ -11404,7 +11422,7 @@ ** Creating Footnotes #+vindex: org-footnote-define-inline #+vindex: org-footnote-section Otherwise, create a new footnote. Depending on the variable - ~org-footnote-define-inline~[fn:120], the definition is placed right + ~org-footnote-define-inline~[fn:121], the definition is placed right into the text as part of the reference, or separately into the location determined by the variable ~org-footnote-section~. @@ -11419,7 +11437,7 @@ ** Creating Footnotes | {{{kbd(d)}}} | Delete the footnote at point, including definition and references. | #+vindex: org-footnote-auto-adjust - Depending on the variable ~org-footnote-auto-adjust~[fn:121], + Depending on the variable ~org-footnote-auto-adjust~[fn:122], renumbering and sorting footnotes can be automatic after each insertion or deletion. @@ -11609,7 +11627,7 @@ ** Export Settings #+cindex: @samp{DATE}, keyword #+vindex: org-export-date-timestamp-format - A date or a time-stamp[fn:122]. + A date or a time-stamp[fn:123]. - =EMAIL= :: @@ -11624,7 +11642,7 @@ ** Export Settings Language to use for translating certain strings (~org-export-default-language~). With =#+LANGUAGE: fr=, for example, Org translates =Table of contents= to the French =Table des - matières=[fn:123]. + matières=[fn:124]. - =SELECT_TAGS= :: @@ -11901,7 +11919,7 @@ ** Table of Contents #+cindex: excluding entries from table of contents #+cindex: table of contents, exclude entries Org includes both numbered and unnumbered headlines in the table of -contents[fn:124]. If you need to exclude an unnumbered headline, +contents[fn:125]. If you need to exclude an unnumbered headline, along with all its children, set the =UNNUMBERED= property to =notoc= value. @@ -12020,7 +12038,7 @@ ** Include Files | =#+INCLUDE: "~/.emacs" :lines "10-"= | Include lines from 10 to EOF | Inclusions may specify a file-link to extract an object matched by -~org-link-search~[fn:125] (see [[*Search Options in File Links]]). The +~org-link-search~[fn:126] (see [[*Search Options in File Links]]). The ranges for =:lines= keyword are relative to the requested element. Therefore, @@ -12060,7 +12078,7 @@ ** Macro Replacement : #+MACRO: name replacement text; $1, $2 are arguments #+texinfo: @noindent -which can be referenced using ={{{name(arg1, arg2)}}}=[fn:126]. For +which can be referenced using ={{{name(arg1, arg2)}}}=[fn:127]. For example #+begin_example @@ -12179,7 +12197,7 @@ ** Comment Lines Finally, a =COMMENT= keyword at the beginning of an entry, but after any other keyword or priority cookie, comments out the entire subtree. In this case, the subtree is not exported and no code block within it -is executed either[fn:127]. The command below helps changing the +is executed either[fn:128]. The command below helps changing the comment status of a headline. - {{{kbd(C-c ;)}}} (~org-toggle-comment~) :: @@ -12451,7 +12469,7 @@ *** Frames and Blocks in Beamer - Org exports a Beamer frame's objects as block environments. Org can enforce wrapping in special block types when =BEAMER_ENV= property - is set[fn:128]. For valid values see + is set[fn:129]. For valid values see ~org-beamer-environments-default~. To add more values, see ~org-beamer-environments-extra~. #+vindex: org-beamer-environments-default @@ -13039,7 +13057,7 @@ *** Math formatting in HTML export #+vindex: org-html-mathjax-options~ LaTeX math snippets (see [[*LaTeX fragments]]) can be displayed in two different ways on HTML pages. The default is to use the [[https://www.mathjax.org][MathJax]], -which should work out of the box with Org[fn:129][fn:130]. Some MathJax +which should work out of the box with Org[fn:130][fn:131]. Some MathJax display options can be configured via ~org-html-mathjax-options~, or in the buffer. For example, with the following settings, @@ -13051,7 +13069,7 @@ *** Math formatting in HTML export #+texinfo: @noindent equation labels are displayed on the left margin and equations are five em from the left margin. In addition, it loads the two MathJax -extensions =cancel.js= and =noErrors.js=[fn:131]. +extensions =cancel.js= and =noErrors.js=[fn:132]. #+vindex: org-html-mathjax-template See the docstring of ~org-html-mathjax-options~ for all supported @@ -13114,7 +13132,7 @@ *** CSS support #+vindex: org-export-html-todo-kwd-class-prefix #+vindex: org-export-html-tag-class-prefix You can modify the CSS style definitions for the exported file. The -HTML exporter assigns the following special CSS classes[fn:132] to +HTML exporter assigns the following special CSS classes[fn:133] to appropriate parts of the document---your style specifications may change these, in addition to any of the standard classes like for headlines, tables, etc. @@ -13351,7 +13369,7 @@ *** LaTeX/PDF export commands Org file. See the docstring for the ~org-latex-default-packages-alist~ for loading packages with certain compilers. Also see ~org-latex-bibtex-compiler~ to set the -bibliography compiler[fn:133]. +bibliography compiler[fn:134]. *** LaTeX specific export settings :PROPERTIES: @@ -13889,7 +13907,7 @@ *** Source blocks in LaTeX export packages for customization of that specific source block. In the example below, the =:options= are set for Engraved or Minted. Minted is a source code highlighting LaTeX package with many configurable -options[fn:134]. Both Minted and Engraved are built on [[https://www.ctan.org/pkg/fvextra][fvextra]], and +options[fn:135]. Both Minted and Engraved are built on [[https://www.ctan.org/pkg/fvextra][fvextra]], and so support many of the same options. #+begin_example @@ -14142,7 +14160,7 @@ ** OpenDocument Text Export The ODT export back-end handles creating of OpenDocument Text (ODT) format. Documents created by this exporter use the -{{{cite(OpenDocument-v1.2 specification)}}}[fn:135] and are compatible +{{{cite(OpenDocument-v1.2 specification)}}}[fn:136] and are compatible with LibreOffice 3.4. *** Pre-requisites for ODT export @@ -14543,7 +14561,7 @@ **** LaTeX math snippets variables ~org-latex-to-mathml-convert-command~ and ~org-latex-to-mathml-jar-file~. - If you prefer to use MathToWeb[fn:136] as your converter, you can + If you prefer to use MathToWeb[fn:137] as your converter, you can configure the above variables as shown below. #+begin_src emacs-lisp @@ -14554,7 +14572,7 @@ **** LaTeX math snippets #+end_src #+texinfo: @noindent - or, to use LaTeXML[fn:137] instead, + or, to use LaTeXML[fn:138] instead, #+begin_src emacs-lisp (setq org-latex-to-mathml-convert-command @@ -14873,7 +14891,7 @@ **** Customizing tables in ODT export tables, see [[*Tables in ODT export]]. This feature closely mimics the way table templates are defined in the -OpenDocument-v1.2 specification[fn:138]. +OpenDocument-v1.2 specification[fn:139]. #+vindex: org-odt-table-styles For quick preview of this feature, install the settings below and export the @@ -14907,7 +14925,7 @@ **** Customizing tables in ODT export To use this feature proceed as follows: -1. Create a table template[fn:139]. +1. Create a table template[fn:140]. A table template is set of =table-cell= and =paragraph= styles for each of the following table cell categories: @@ -14946,7 +14964,7 @@ **** Customizing tables in ODT export =</office:automatic-styles>= element of the content template file (see [[x-orgodtcontenttemplate-xml][Factory styles]]). -2. Define a table style[fn:140]. +2. Define a table style[fn:141]. #+vindex: org-odt-table-styles To define a table style, create an entry for the style in the @@ -16177,7 +16195,7 @@ *** Publishing action ~org-org-publish-to-org~. This produces =file.org= and puts it in the publishing directory. If you want a htmlized version of this file, set the parameter ~:htmlized-source~ to ~t~. It produces -=file.org.html= in the publishing directory[fn:141]. +=file.org.html= in the publishing directory[fn:142]. Other files like images only need to be copied to the publishing destination; for this you can use ~org-publish-attachment~. For @@ -17795,13 +17813,13 @@ *** How to evaluate source code #+kindex: C-c C-v e #+findex: org-babel-execute-src-block Org provides many ways to execute code blocks. {{{kbd(C-c C-c)}}} or -{{{kbd(C-c C-v e)}}} with the point on a code block[fn:142] calls the +{{{kbd(C-c C-v e)}}} with the point on a code block[fn:143] calls the ~org-babel-execute-src-block~ function, which executes the code in the block, collects the results, and inserts them in the buffer. #+cindex: @samp{CALL}, keyword #+vindex: org-babel-inline-result-wrap -By calling a named code block[fn:143] from an Org mode buffer or +By calling a named code block[fn:144] from an Org mode buffer or a table. Org can call the named code blocks from the current Org mode buffer or from the "Library of Babel" (see [[*Library of Babel]]). @@ -18002,7 +18020,7 @@ *** Collection - =value= :: - Default for most Babel libraries[fn:143]. Functional mode. Org + Default for most Babel libraries[fn:144]. Functional mode. Org gets the value by wrapping the code in a function definition in the language of the source block. That is why when using =:results value=, code should execute like a function and return a value. For @@ -18731,7 +18749,7 @@ ** Noweb Reference Syntax #+cindex: @samp{noweb-ref}, header argument Source code blocks can include references to other source code blocks, -using a noweb[fn:144] style syntax: +using a noweb[fn:145] style syntax: : <<CODE-BLOCK-ID>> @@ -19259,7 +19277,7 @@ ** Structure Templates ~org-structure-template-alist~ and ~org-tempo-keywords-alist~. For example, {{{kbd(< s TAB)}}} creates a code block. Enable it by customizing ~org-modules~ or add =(require 'org-tempo)= to your Emacs -init file[fn:145]. +init file[fn:146]. #+attr_texinfo: :columns 0.1 0.9 | {{{kbd(a)}}} | =#+BEGIN_EXPORT ascii= ... =#+END_EXPORT= | @@ -19339,7 +19357,7 @@ *** Org Indent Mode To display the buffer in the indented view, activate Org Indent minor mode, using {{{kbd(M-x org-indent-mode)}}}. Text lines that are not headlines are prefixed with virtual spaces to vertically align with -the headline text[fn:146]. +the headline text[fn:147]. #+vindex: org-indent-indentation-per-level To make more horizontal space, the headlines are shifted by two @@ -19367,9 +19385,9 @@ *** Hard indentation It is possible to use hard spaces to achieve the indentation instead, if the bare ASCII file should have the indented look also outside -Emacs[fn:147]. With Org's support, you have to indent all lines to +Emacs[fn:148]. With Org's support, you have to indent all lines to line up with the outline headers. You would use these -settings[fn:148]: +settings[fn:149]: #+begin_src emacs-lisp (setq org-adapt-indentation t @@ -19640,7 +19658,7 @@ ** Summary of In-Buffer Settings #+vindex: org-startup-indented Dynamic virtual indentation is controlled by the variable - ~org-startup-indented~[fn:149]. + ~org-startup-indented~[fn:150]. | =indent= | Start with Org Indent mode turned on. | | =noindent= | Start with Org Indent mode turned off. | @@ -20498,7 +20516,7 @@ *** Setting up the staging area #+vindex: org-mobile-directory The mobile application needs access to a file directory on -a server[fn:150] to interact with Emacs. Pass its location through +a server[fn:151] to interact with Emacs. Pass its location through the ~org-mobile-directory~ variable. If you can mount that directory locally just set the variable to point to that directory: @@ -20519,7 +20537,7 @@ *** Setting up the staging area requires OpenSSL installed on the local computer. To turn on encryption, set the same password in the mobile application and in Emacs. Set the password in the variable -~org-mobile-use-encryption~[fn:151]. Note that even after the mobile +~org-mobile-use-encryption~[fn:152]. Note that even after the mobile application encrypts the file contents, the file name remains visible on the file systems of the local computer, the server, and the mobile device. @@ -20535,15 +20553,15 @@ *** Pushing to the mobile application ~org-mobile-files~ into the staging area. Files include agenda files (as listed in ~org-agenda-files~). Customize ~org-mobile-files~ to add other files. File names are staged with paths relative to -~org-directory~, so all files should be inside this directory[fn:152]. +~org-directory~, so all files should be inside this directory[fn:153]. Push creates a special Org file =agendas.org= with custom agenda views -defined by the user[fn:153]. +defined by the user[fn:154]. Finally, Org writes the file =index.org=, containing links to other files. The mobile application reads this file first from the server to determine what other files to download for agendas. For faster -downloads, it is expected to only read files whose checksums[fn:154] +downloads, it is expected to only read files whose checksums[fn:155] have changed. *** Pulling from the mobile application @@ -20560,7 +20578,7 @@ *** Pulling from the mobile application 1. #+vindex: org-mobile-inbox-for-pull - Org moves all entries found in =mobileorg.org=[fn:155] and appends + Org moves all entries found in =mobileorg.org=[fn:156] and appends them to the file pointed to by the variable ~org-mobile-inbox-for-pull~. It should reside neither in the staging area nor on the server. Each captured entry and each @@ -20854,9 +20872,9 @@ *** A LaTeX example of radio tables #+cindex: @LaTeX{}, and Orgtbl mode To wrap a source table in LaTeX, use the =comment= environment -provided by =comment.sty=[fn:156]. To activate it, put +provided by =comment.sty=[fn:157]. To activate it, put ~\usepackage{comment}~ in the document header. Orgtbl mode inserts -a radio table skeleton[fn:157] with the command {{{kbd(M-x +a radio table skeleton[fn:158] with the command {{{kbd(M-x orgtbl-insert-radio-table)}}}, which prompts for a table name. For example, if =salesfigures= is the name, the template inserts: @@ -20875,7 +20893,7 @@ *** A LaTeX example of radio tables ~orgtbl-to-latex~ to convert the table to LaTeX format, then insert the table at the target (receive) location named =salesfigures=. Now the table is ready for data entry. It can even use spreadsheet -features[fn:158]: +features[fn:159]: #+begin_example % BEGIN RECEIVE ORGTBL salesfigures @@ -21091,7 +21109,7 @@ ** Special Agenda Views #+vindex: org-agenda-skip-function #+vindex: org-agenda-skip-function-global Org provides a special hook to further limit items in agenda views: -~agenda~, ~agenda*~[fn:159], ~todo~, ~alltodo~, ~tags~, ~tags-todo~, +~agenda~, ~agenda*~[fn:160], ~todo~, ~alltodo~, ~tags~, ~tags-todo~, ~tags-tree~. Specify a custom function that tests inclusion of every matched item in the view. This function can also skip as much as is needed. @@ -21134,7 +21152,7 @@ ** Special Agenda Views #+vindex: org-agenda-skip-function Search for entries with a limit set on levels for the custom search. This is a general approach to creating custom searches in Org. To -include all levels, use =LEVEL>0=[fn:160]. Then to selectively pick +include all levels, use =LEVEL>0=[fn:161]. Then to selectively pick the matched entries, use ~org-agenda-skip-function~, which also accepts Lisp forms, such as ~org-agenda-skip-entry-if~ and ~org-agenda-skip-subtree-if~. For example: @@ -22258,6 +22276,7 @@ * Footnotes #+findex: org-anniversary #+findex: org-cyclic #+findex: org-block + [fn:60] When working with the standard diary expression functions, you need to be very careful with the order of the arguments. That order depends evilly on the variable ~calendar-date-style~. For example, to @@ -22496,140 +22515,143 @@ * Footnotes within a buffer with the =STARTUP= options =inlineimages= and =noinlineimages=. -[fn:120] The corresponding in-buffer setting is: =#+STARTUP: fninline= +[fn:120] The width can be customized in Emacs >= 24.1, built with +imagemagick support. + +[fn:121] The corresponding in-buffer setting is: =#+STARTUP: fninline= or =#+STARTUP: nofninline=. -[fn:121] The corresponding in-buffer options are =#+STARTUP: fnadjust= +[fn:122] The corresponding in-buffer options are =#+STARTUP: fnadjust= and =#+STARTUP: nofnadjust=. -[fn:122] The variable ~org-export-date-timestamp-format~ defines how +[fn:123] The variable ~org-export-date-timestamp-format~ defines how this timestamp are exported. -[fn:123] For export to LaTeX format---or LaTeX-related formats such as +[fn:124] For export to LaTeX format---or LaTeX-related formats such as Beamer---, the =org-latex-package-alist= variable needs further configuration. See [[LaTeX specific export settings]]. -[fn:124] At the moment, some export back-ends do not obey this +[fn:125] At the moment, some export back-ends do not obey this specification. For example, LaTeX export excludes every unnumbered headline from the table of contents. -[fn:125] Note that ~org-link-search-must-match-exact-headline~ is +[fn:126] Note that ~org-link-search-must-match-exact-headline~ is locally bound to non-~nil~. Therefore, ~org-link-search~ only matches headlines and named elements. -[fn:126] Since commas separate the arguments, commas within arguments +[fn:127] Since commas separate the arguments, commas within arguments have to be escaped with the backslash character. So only those backslash characters before a comma need escaping with another backslash character. -[fn:127] For a less drastic behavior, consider using a select tag (see +[fn:128] For a less drastic behavior, consider using a select tag (see [[*Export Settings]]) instead. -[fn:128] If =BEAMER_ENV= is set, Org export adds =B_environment= tag +[fn:129] If =BEAMER_ENV= is set, Org export adds =B_environment= tag to make it visible. The tag serves as a visual aid and has no semantic relevance. -[fn:129] By default Org loads MathJax from [[https://cdnjs.com][cdnjs.com]] as recommended by +[fn:130] By default Org loads MathJax from [[https://cdnjs.com][cdnjs.com]] as recommended by [[https://www.mathjax.org][MathJax]]. -[fn:130] Please note that exported formulas are part of an HTML +[fn:131] Please note that exported formulas are part of an HTML document, and that signs such as =<=, =>=, or =&= have special meanings. See [[http://docs.mathjax.org/en/latest/input/tex/html.html#tex-and-latex-in-html-documents][MathJax TeX and LaTeX in HTML documents]]. -[fn:131] See [[http://docs.mathjax.org/en/latest/input/tex/extensions.html#tex-and-latex-extensions][TeX and LaTeX extensions]] in the [[http://docs.mathjax.org][MathJax manual]] to learn +[fn:132] See [[http://docs.mathjax.org/en/latest/input/tex/extensions.html#tex-and-latex-extensions][TeX and LaTeX extensions]] in the [[http://docs.mathjax.org][MathJax manual]] to learn about extensions. -[fn:132] If the classes on TODO keywords and tags lead to conflicts, +[fn:133] If the classes on TODO keywords and tags lead to conflicts, use the variables ~org-html-todo-kwd-class-prefix~ and ~org-html-tag-class-prefix~ to make them unique. -[fn:133] This does not allow setting different bibliography compilers +[fn:134] This does not allow setting different bibliography compilers for different files. However, "smart" LaTeX compilation systems, such as latexmk, can select the correct bibliography compiler. -[fn:134] Minted uses an external Python package for code highlighting, +[fn:135] Minted uses an external Python package for code highlighting, which requires the flag =-shell-escape= to be added to ~org-latex-pdf-process~. -[fn:135] See [[http://docs.oasis-open.org/office/v1.2/OpenDocument-v1.2.html][Open Document Format for Office Applications +[fn:136] See [[http://docs.oasis-open.org/office/v1.2/OpenDocument-v1.2.html][Open Document Format for Office Applications (OpenDocument) Version 1.2]]. -[fn:136] See [[http://www.mathtoweb.com/cgi-bin/mathtoweb_home.pl][MathToWeb]]. +[fn:137] See [[http://www.mathtoweb.com/cgi-bin/mathtoweb_home.pl][MathToWeb]]. -[fn:137] See [[http://dlmf.nist.gov/LaTeXML/]]. +[fn:138] See [[http://dlmf.nist.gov/LaTeXML/]]. -[fn:138] [[http://docs.oasis-open.org/office/v1.2/OpenDocument-v1.2.html][OpenDocument-v1.2 Specification]] +[fn:139] [[http://docs.oasis-open.org/office/v1.2/OpenDocument-v1.2.html][OpenDocument-v1.2 Specification]] -[fn:139] See the =<table:table-template>= element of the +[fn:140] See the =<table:table-template>= element of the OpenDocument-v1.2 specification. -[fn:140] See the attributes =table:template-name=, +[fn:141] See the attributes =table:template-name=, =table:use-first-row-styles=, =table:use-last-row-styles=, =table:use-first-column-styles=, =table:use-last-column-styles=, =table:use-banding-rows-styles=, and =table:use-banding-column-styles= of the =<table:table>= element in the OpenDocument-v1.2 specification. -[fn:141] If the publishing directory is the same as the source +[fn:142] If the publishing directory is the same as the source directory, =file.org= is exported as =file.org.org=, so you probably do not want to do this. -[fn:142] The option ~org-babel-no-eval-on-ctrl-c-ctrl-c~ can be used +[fn:143] The option ~org-babel-no-eval-on-ctrl-c-ctrl-c~ can be used to remove code evaluation from the {{{kbd(C-c C-c)}}} key binding. -[fn:143] Actually, the constructs =call_<name>()= and =src_<lang>{}= +[fn:144] Actually, the constructs =call_<name>()= and =src_<lang>{}= are not evaluated when they appear in a keyword (see [[*Summary of In-Buffer Settings]]). -[fn:144] For noweb literate programming details, see +[fn:145] For noweb literate programming details, see http://www.cs.tufts.edu/~nr/noweb/. -[fn:145] For more information, please refer to the commentary section +[fn:146] For more information, please refer to the commentary section in =org-tempo.el=. -[fn:146] Org Indent mode also sets ~wrap-prefix~ correctly for +[fn:147] Org Indent mode also sets ~wrap-prefix~ correctly for indenting and wrapping long lines of headlines or text. This minor mode also handles Visual Line mode and directly applied settings through ~word-wrap~. -[fn:147] This works, but requires extra effort. Org Indent mode is +[fn:148] This works, but requires extra effort. Org Indent mode is more convenient for most applications. -[fn:148] ~org-adapt-indentation~ can also be set to ='headline-data=, +[fn:149] ~org-adapt-indentation~ can also be set to ='headline-data=, in which case only data lines below the headline will be indented. -[fn:149] Note that Org Indent mode also sets the ~wrap-prefix~ +[fn:150] Note that Org Indent mode also sets the ~wrap-prefix~ property, such that Visual Line mode (or purely setting ~word-wrap~) wraps long lines, including headlines, correctly indented. -[fn:150] For a server to host files, consider using a WebDAV server, +[fn:151] For a server to host files, consider using a WebDAV server, such as [[https://nextcloud.com][Nextcloud]]. Additional help is at this [[https://orgmode.org/worg/org-faq.html#mobileorg_webdav][FAQ entry]]. -[fn:151] If Emacs is configured for safe storing of passwords, then +[fn:152] If Emacs is configured for safe storing of passwords, then configure the variable ~org-mobile-encryption-password~; please read the docstring of that variable. -[fn:152] Symbolic links in ~org-directory~ need to have the same name +[fn:153] Symbolic links in ~org-directory~ need to have the same name as their targets. -[fn:153] While creating the agendas, Org mode forces =ID= properties +[fn:154] While creating the agendas, Org mode forces =ID= properties on all referenced entries, so that these entries can be uniquely identified if Org Mobile flags them for further action. To avoid setting properties configure the variable ~org-mobile-force-id-on-agenda-items~ to ~nil~. Org mode then relies on outline paths, assuming they are unique. -[fn:154] Checksums are stored automatically in the file +[fn:155] Checksums are stored automatically in the file =checksums.dat=. -[fn:155] The file will be empty after this operation. +[fn:156] The file will be empty after this operation. -[fn:156] https://www.ctan.org/pkg/comment +[fn:157] https://www.ctan.org/pkg/comment -[fn:157] By default this works only for LaTeX, HTML, and Texinfo. +[fn:158] By default this works only for LaTeX, HTML, and Texinfo. Configure the variable ~orgtbl-radio-table-templates~ to install templates for other modes. -[fn:158] If the =TBLFM= keyword contains an odd number of dollar +[fn:159] If the =TBLFM= keyword contains an odd number of dollar characters, this may cause problems with Font Lock in LaTeX mode. As shown in the example you can fix this by adding an extra line inside the =comment= environment that is used to balance the dollar @@ -22637,9 +22659,9 @@ * Footnotes a much better solution is to add the =comment= environment to the variable ~LaTeX-verbatim-environments~. -[fn:159] The ~agenda*~ view is the same as ~agenda~ except that it +[fn:160] The ~agenda*~ view is the same as ~agenda~ except that it only considers /appointments/, i.e., scheduled and deadline items that have a time specification =[h]h:mm= in their time-stamps. -[fn:160] Note that, for ~org-odd-levels-only~, a level number +[fn:161] Note that, for ~org-odd-levels-only~, a level number corresponds to order in the hierarchy, not to the number of stars. diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS index a7f32671e..d9b41515b 100644 --- a/etc/ORG-NEWS +++ b/etc/ORG-NEWS @@ -296,6 +296,10 @@ headings in HTML export. Use the header argument =:var x=code-block[]= or : #+CALL: fn(x=code-block[]) to pass the contents of a named code block as a string argument. +*** New property =ORG-IMAGE-ACTUAL-WIDTH= for overriding global ~org-image-actual-width~ + +The new property =ORG-IMAGE-ACTUAL-WIDTH= can override the global +variable ~org-image-actual-width~ value for inline images display width. ** New options *** New custom settings =org-icalendar-scheduled-summary-prefix= and =org-icalendar-deadline-summary-prefix= diff --git a/lisp/org.el b/lisp/org.el index a50921519..bba1b5233 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -12224,7 +12224,8 @@ (defconst org-default-properties "EXPORT_OPTIONS" "EXPORT_TEXT" "EXPORT_FILE_NAME" "EXPORT_TITLE" "EXPORT_AUTHOR" "EXPORT_DATE" "UNNUMBERED" "ORDERED" "NOBLOCKING" "COOKIE_DATA" "LOG_INTO_DRAWER" "REPEAT_TO_STATE" - "CLOCK_MODELINE_TOTAL" "STYLE" "HTML_CONTAINER_CLASS") + "CLOCK_MODELINE_TOTAL" "STYLE" "HTML_CONTAINER_CLASS" + "ORG-IMAGE-ACTUAL-WIDTH") "Some properties that are used by Org mode for various purposes. Being in this list makes sure that they are offered for completion.") @@ -16255,48 +16256,51 @@ (defun org-display-inline-image--width (link) If the value is a float between 0 and 2, it interpreted as that proportion of the text width in the buffer." ;; Apply `org-image-actual-width' specifications. - (cond - ((eq org-image-actual-width t) nil) - ((listp org-image-actual-width) - (let* ((case-fold-search t) - (par (org-element-lineage link '(paragraph))) - (attr-re "^[ \t]*#\\+attr_.*?: +.*?:width +\\(\\S-+\\)") - (par-end (org-element-property :post-affiliated par)) - ;; Try to find an attribute providing a :width. - (attr-width - (when (and par (org-with-point-at - (org-element-property :begin par) - (re-search-forward attr-re par-end t))) - (match-string 1))) - (width - (cond - ;; Treat :width t as if `org-image-actual-width' were t. - ((string= attr-width "t") nil) - ;; Fallback to `org-image-actual-width' if no interprable width is given. - ((or (null attr-width) - (string-match-p "\\`[^0-9]" attr-width)) - (car org-image-actual-width)) - ;; Convert numeric widths to numbers, converting percentages. - ((string-match-p "\\`[0-9.]+%" attr-width) - (/ (string-to-number attr-width) 100.0)) - (t (string-to-number attr-width))))) - (if (and (floatp width) (<= 0.0 width 2.0)) - ;; A float in [0,2] should be interpereted as this portion of - ;; the text width in the window. This works well with cases like - ;; #+attr_latex: :width 0.X\{line,page,column,etc.}width, - ;; as the "0.X" is pulled out as a float. We use 2 as the upper - ;; bound as cases such as 1.2\linewidth are feasible. - (round (* width - (window-pixel-width) - (/ (or (and (bound-and-true-p visual-fill-column-mode) - (or visual-fill-column-width auto-fill-function)) - (when auto-fill-function fill-column) - (- (window-text-width) (line-number-display-width))) - (float (window-total-width))))) - width))) - ((numberp org-image-actual-width) - org-image-actual-width) - (t nil))) + ;; Support subtree-level property "ORG-IMAGE-ACTUAL-WIDTH" specified + ;; width. + (let ((org-image-actual-width (org-property-or-variable-value 'org-image-actual-width))) + (cond + ((eq org-image-actual-width t) nil) + ((listp org-image-actual-width) + (let* ((case-fold-search t) + (par (org-element-lineage link '(paragraph))) + (attr-re "^[ \t]*#\\+attr_.*?: +.*?:width +\\(\\S-+\\)") + (par-end (org-element-property :post-affiliated par)) + ;; Try to find an attribute providing a :width. + (attr-width + (when (and par (org-with-point-at + (org-element-property :begin par) + (re-search-forward attr-re par-end t))) + (match-string 1))) + (width + (cond + ;; Treat :width t as if `org-image-actual-width' were t. + ((string= attr-width "t") nil) + ;; Fallback to `org-image-actual-width' if no interprable width is given. + ((or (null attr-width) + (string-match-p "\\`[^0-9]" attr-width)) + (car org-image-actual-width)) + ;; Convert numeric widths to numbers, converting percentages. + ((string-match-p "\\`[0-9.]+%" attr-width) + (/ (string-to-number attr-width) 100.0)) + (t (string-to-number attr-width))))) + (if (and (floatp width) (<= 0.0 width 2.0)) + ;; A float in [0,2] should be interpereted as this portion of + ;; the text width in the window. This works well with cases like + ;; #+attr_latex: :width 0.X\{line,page,column,etc.}width, + ;; as the "0.X" is pulled out as a float. We use 2 as the upper + ;; bound as cases such as 1.2\linewidth are feasible. + (round (* width + (window-pixel-width) + (/ (or (and (bound-and-true-p visual-fill-column-mode) + (or visual-fill-column-width auto-fill-function)) + (when auto-fill-function fill-column) + (- (window-text-width) (line-number-display-width))) + (float (window-total-width))))) + width))) + ((numberp org-image-actual-width) + org-image-actual-width) + (t nil)))) (defun org-display-inline-remove-overlay (ov after _beg _end &optional _len) "Remove inline-display overlay if a corresponding region is modified." -- 2.35.1 [-- Attachment #3: Type: text/plain, Size: 207 bytes --] -- Ihor Radchenko, 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 ^ permalink raw reply related [flat|nested] 43+ messages in thread
* Re: [PATCH v6] New: auto display inline images under subtree when `org-cycle'. 2022-09-20 7:01 ` [PATCH v6] " Ihor Radchenko @ 2022-09-20 11:32 ` Christopher M. Miles [not found] ` <6329c8b0.050a0220.412d.0a6cSMTPIN_ADDED_BROKEN@mx.google.com> 1 sibling, 0 replies; 43+ messages in thread From: Christopher M. Miles @ 2022-09-20 11:32 UTC (permalink / raw) To: Ihor Radchenko; +Cc: Christopher M. Miles, emacs-orgmode [-- Attachment #1: Type: text/plain, Size: 37144 bytes --] I checked out your patch, it's fine to me. Should be fine to apply. Ihor Radchenko <yantar92@gmail.com> writes: > "Christopher M. Miles" <numbchild@gmail.com> writes: > >> Ok, I will submit the first patch of new property at first. If you're >> going to implement this <TAB> cycling inline image display feature, >> that's great! > > The changes to the manual are confusing after exporting. Note that > > #+vindex: org-image-actual-width will not be visible in html/pdf export. > They only serve as info search nodes and do not appear in the actual > > text. > > I am attaching an alternative version of the patch. Let me know if you > have any objections. > > From 475c607f874e4e78c1e13d15e36ae894b121acad Mon Sep 17 00:00:00 2001 > Message-Id: <475c607f874e4e78c1e13d15e36ae894b121acad.1663656903.git.yantar92@gmail.com> > From: stardiviner <numbchild@gmail.com> > Date: Thu, 15 Sep 2022 17:25:13 +0800 > Subject: [PATCH v6] org.el: Support subtree-level org-image-actual-width > overriding > > * lisp/org.el (org-display-inline-image--width): Support new property > "ORG-IMAGE-ACTUAL-WIDTH" overriding global variable > `org-image-actual-width'. > --- > doc/org-manual.org | 186 +++++++++++++++++++++++++-------------------- > etc/ORG-NEWS | 4 + > lisp/org.el | 90 +++++++++++----------- > 3 files changed, 155 insertions(+), 125 deletions(-) > > diff --git a/doc/org-manual.org b/doc/org-manual.org > index a37b8390c..4c9c087a7 100644 > --- a/doc/org-manual.org > +++ b/doc/org-manual.org > @@ -11314,6 +11314,24 @@ ** Images > startup by configuring the variable > ~org-startup-with-inline-images~[fn:119]. > > + > + #+vindex: org-image-actual-width > + #+cindex: @samp{ORG-IMAGE-ACTUAL-WIDTH}, property > + By default, Org mode displays inline images according to their actual width. > + You can customize the displayed image width using ~org-image-actual-width~ variable (globally) or =ORG-IMAGE-ACTUAL-WIDTH= property (subtree-level)[fn:120]. > + Their value can be the following: > + - (default) Non-nil, use the actual width of images when inlining them. > + - When set to a number, use imagemagick (when available) to set the > + image's width to this value. > + - When set to a number in a list, try to get the width from any > + =#+ATTR.*= keyword if it matches a width specification like: > + #+begin_example > + ,#+ATTR_HTML: :width 300px > + #+end_example > + and fall back on that number if none is found. > + - When set to nil, try to get the width from an =#+ATTR.*= keyword > + and fall back on the original width if none is found. > + > ** Captions > :PROPERTIES: > :DESCRIPTION: Describe tables, images... > @@ -11404,7 +11422,7 @@ ** Creating Footnotes > #+vindex: org-footnote-define-inline > #+vindex: org-footnote-section > Otherwise, create a new footnote. Depending on the variable > - ~org-footnote-define-inline~[fn:120], the definition is placed right > + ~org-footnote-define-inline~[fn:121], the definition is placed right > into the text as part of the reference, or separately into the > location determined by the variable ~org-footnote-section~. > > @@ -11419,7 +11437,7 @@ ** Creating Footnotes > | {{{kbd(d)}}} | Delete the footnote at point, including definition and references. | > > #+vindex: org-footnote-auto-adjust > - Depending on the variable ~org-footnote-auto-adjust~[fn:121], > + Depending on the variable ~org-footnote-auto-adjust~[fn:122], > renumbering and sorting footnotes can be automatic after each > insertion or deletion. > > @@ -11609,7 +11627,7 @@ ** Export Settings > > #+cindex: @samp{DATE}, keyword > #+vindex: org-export-date-timestamp-format > - A date or a time-stamp[fn:122]. > + A date or a time-stamp[fn:123]. > > - =EMAIL= :: > > @@ -11624,7 +11642,7 @@ ** Export Settings > Language to use for translating certain strings > (~org-export-default-language~). With =#+LANGUAGE: fr=, for > example, Org translates =Table of contents= to the French =Table des > - matières=[fn:123]. > + matières=[fn:124]. > > - =SELECT_TAGS= :: > > @@ -11901,7 +11919,7 @@ ** Table of Contents > #+cindex: excluding entries from table of contents > #+cindex: table of contents, exclude entries > Org includes both numbered and unnumbered headlines in the table of > -contents[fn:124]. If you need to exclude an unnumbered headline, > +contents[fn:125]. If you need to exclude an unnumbered headline, > along with all its children, set the =UNNUMBERED= property to =notoc= > value. > > @@ -12020,7 +12038,7 @@ ** Include Files > | =#+INCLUDE: "~/.emacs" :lines "10-"= | Include lines from 10 to EOF | > > Inclusions may specify a file-link to extract an object matched by > -~org-link-search~[fn:125] (see [[*Search Options in File Links]]). The > +~org-link-search~[fn:126] (see [[*Search Options in File Links]]). The > ranges for =:lines= keyword are relative to the requested element. > Therefore, > > @@ -12060,7 +12078,7 @@ ** Macro Replacement > : #+MACRO: name replacement text; $1, $2 are arguments > > #+texinfo: @noindent > -which can be referenced using ={{{name(arg1, arg2)}}}=[fn:126]. For > +which can be referenced using ={{{name(arg1, arg2)}}}=[fn:127]. For > example > > #+begin_example > @@ -12179,7 +12197,7 @@ ** Comment Lines > Finally, a =COMMENT= keyword at the beginning of an entry, but after > any other keyword or priority cookie, comments out the entire subtree. > In this case, the subtree is not exported and no code block within it > -is executed either[fn:127]. The command below helps changing the > +is executed either[fn:128]. The command below helps changing the > comment status of a headline. > > - {{{kbd(C-c ;)}}} (~org-toggle-comment~) :: > @@ -12451,7 +12469,7 @@ *** Frames and Blocks in Beamer > > - Org exports a Beamer frame's objects as block environments. Org can > enforce wrapping in special block types when =BEAMER_ENV= property > - is set[fn:128]. For valid values see > + is set[fn:129]. For valid values see > ~org-beamer-environments-default~. To add more values, see > ~org-beamer-environments-extra~. > #+vindex: org-beamer-environments-default > @@ -13039,7 +13057,7 @@ *** Math formatting in HTML export > #+vindex: org-html-mathjax-options~ > LaTeX math snippets (see [[*LaTeX fragments]]) can be displayed in two > different ways on HTML pages. The default is to use the [[https://www.mathjax.org][MathJax]], > -which should work out of the box with Org[fn:129][fn:130]. Some MathJax > +which should work out of the box with Org[fn:130][fn:131]. Some MathJax > display options can be configured via ~org-html-mathjax-options~, or > in the buffer. For example, with the following settings, > > @@ -13051,7 +13069,7 @@ *** Math formatting in HTML export > #+texinfo: @noindent > equation labels are displayed on the left margin and equations are > five em from the left margin. In addition, it loads the two MathJax > -extensions =cancel.js= and =noErrors.js=[fn:131]. > +extensions =cancel.js= and =noErrors.js=[fn:132]. > > #+vindex: org-html-mathjax-template > See the docstring of ~org-html-mathjax-options~ for all supported > @@ -13114,7 +13132,7 @@ *** CSS support > #+vindex: org-export-html-todo-kwd-class-prefix > #+vindex: org-export-html-tag-class-prefix > You can modify the CSS style definitions for the exported file. The > -HTML exporter assigns the following special CSS classes[fn:132] to > +HTML exporter assigns the following special CSS classes[fn:133] to > appropriate parts of the document---your style specifications may > change these, in addition to any of the standard classes like for > headlines, tables, etc. > @@ -13351,7 +13369,7 @@ *** LaTeX/PDF export commands > Org file. See the docstring for the > ~org-latex-default-packages-alist~ for loading packages with certain > compilers. Also see ~org-latex-bibtex-compiler~ to set the > -bibliography compiler[fn:133]. > +bibliography compiler[fn:134]. > > *** LaTeX specific export settings > :PROPERTIES: > @@ -13889,7 +13907,7 @@ *** Source blocks in LaTeX export > packages for customization of that specific source block. In the > example below, the =:options= are set for Engraved or Minted. Minted > is a source code highlighting LaTeX package with many configurable > -options[fn:134]. Both Minted and Engraved are built on [[https://www.ctan.org/pkg/fvextra][fvextra]], and > +options[fn:135]. Both Minted and Engraved are built on [[https://www.ctan.org/pkg/fvextra][fvextra]], and > so support many of the same options. > > #+begin_example > @@ -14142,7 +14160,7 @@ ** OpenDocument Text Export > > The ODT export back-end handles creating of OpenDocument Text (ODT) > format. Documents created by this exporter use the > -{{{cite(OpenDocument-v1.2 specification)}}}[fn:135] and are compatible > +{{{cite(OpenDocument-v1.2 specification)}}}[fn:136] and are compatible > with LibreOffice 3.4. > > *** Pre-requisites for ODT export > @@ -14543,7 +14561,7 @@ **** LaTeX math snippets > variables ~org-latex-to-mathml-convert-command~ and > ~org-latex-to-mathml-jar-file~. > > - If you prefer to use MathToWeb[fn:136] as your converter, you can > + If you prefer to use MathToWeb[fn:137] as your converter, you can > configure the above variables as shown below. > > #+begin_src emacs-lisp > @@ -14554,7 +14572,7 @@ **** LaTeX math snippets > #+end_src > > #+texinfo: @noindent > - or, to use LaTeXML[fn:137] instead, > + or, to use LaTeXML[fn:138] instead, > > #+begin_src emacs-lisp > (setq org-latex-to-mathml-convert-command > @@ -14873,7 +14891,7 @@ **** Customizing tables in ODT export > tables, see [[*Tables in ODT export]]. > > This feature closely mimics the way table templates are defined in the > -OpenDocument-v1.2 specification[fn:138]. > +OpenDocument-v1.2 specification[fn:139]. > > #+vindex: org-odt-table-styles > For quick preview of this feature, install the settings below and export the > @@ -14907,7 +14925,7 @@ **** Customizing tables in ODT export > > To use this feature proceed as follows: > > -1. Create a table template[fn:139]. > +1. Create a table template[fn:140]. > > A table template is set of =table-cell= and =paragraph= styles for > each of the following table cell categories: > @@ -14946,7 +14964,7 @@ **** Customizing tables in ODT export > =</office:automatic-styles>= element of the content template file > (see [[x-orgodtcontenttemplate-xml][Factory styles]]). > > -2. Define a table style[fn:140]. > +2. Define a table style[fn:141]. > > #+vindex: org-odt-table-styles > To define a table style, create an entry for the style in the > @@ -16177,7 +16195,7 @@ *** Publishing action > ~org-org-publish-to-org~. This produces =file.org= and puts it in the > publishing directory. If you want a htmlized version of this file, > set the parameter ~:htmlized-source~ to ~t~. It produces > -=file.org.html= in the publishing directory[fn:141]. > +=file.org.html= in the publishing directory[fn:142]. > > Other files like images only need to be copied to the publishing > destination; for this you can use ~org-publish-attachment~. For > @@ -17795,13 +17813,13 @@ *** How to evaluate source code > #+kindex: C-c C-v e > #+findex: org-babel-execute-src-block > Org provides many ways to execute code blocks. {{{kbd(C-c C-c)}}} or > -{{{kbd(C-c C-v e)}}} with the point on a code block[fn:142] calls the > +{{{kbd(C-c C-v e)}}} with the point on a code block[fn:143] calls the > ~org-babel-execute-src-block~ function, which executes the code in the > block, collects the results, and inserts them in the buffer. > > #+cindex: @samp{CALL}, keyword > #+vindex: org-babel-inline-result-wrap > -By calling a named code block[fn:143] from an Org mode buffer or > +By calling a named code block[fn:144] from an Org mode buffer or > a table. Org can call the named code blocks from the current Org mode > buffer or from the "Library of Babel" (see [[*Library of Babel]]). > > @@ -18002,7 +18020,7 @@ *** Collection > > - =value= :: > > - Default for most Babel libraries[fn:143]. Functional mode. Org > + Default for most Babel libraries[fn:144]. Functional mode. Org > gets the value by wrapping the code in a function definition in the > language of the source block. That is why when using =:results > value=, code should execute like a function and return a value. For > @@ -18731,7 +18749,7 @@ ** Noweb Reference Syntax > > #+cindex: @samp{noweb-ref}, header argument > Source code blocks can include references to other source code blocks, > -using a noweb[fn:144] style syntax: > +using a noweb[fn:145] style syntax: > > : <<CODE-BLOCK-ID>> > > @@ -19259,7 +19277,7 @@ ** Structure Templates > ~org-structure-template-alist~ and ~org-tempo-keywords-alist~. For > example, {{{kbd(< s TAB)}}} creates a code block. Enable it by > customizing ~org-modules~ or add =(require 'org-tempo)= to your Emacs > -init file[fn:145]. > +init file[fn:146]. > > #+attr_texinfo: :columns 0.1 0.9 > | {{{kbd(a)}}} | =#+BEGIN_EXPORT ascii= ... =#+END_EXPORT= | > @@ -19339,7 +19357,7 @@ *** Org Indent Mode > To display the buffer in the indented view, activate Org Indent minor > mode, using {{{kbd(M-x org-indent-mode)}}}. Text lines that are not > headlines are prefixed with virtual spaces to vertically align with > -the headline text[fn:146]. > +the headline text[fn:147]. > > #+vindex: org-indent-indentation-per-level > To make more horizontal space, the headlines are shifted by two > @@ -19367,9 +19385,9 @@ *** Hard indentation > > It is possible to use hard spaces to achieve the indentation instead, > if the bare ASCII file should have the indented look also outside > -Emacs[fn:147]. With Org's support, you have to indent all lines to > +Emacs[fn:148]. With Org's support, you have to indent all lines to > line up with the outline headers. You would use these > -settings[fn:148]: > +settings[fn:149]: > > #+begin_src emacs-lisp > (setq org-adapt-indentation t > @@ -19640,7 +19658,7 @@ ** Summary of In-Buffer Settings > > #+vindex: org-startup-indented > Dynamic virtual indentation is controlled by the variable > - ~org-startup-indented~[fn:149]. > + ~org-startup-indented~[fn:150]. > > | =indent= | Start with Org Indent mode turned on. | > | =noindent= | Start with Org Indent mode turned off. | > @@ -20498,7 +20516,7 @@ *** Setting up the staging area > > #+vindex: org-mobile-directory > The mobile application needs access to a file directory on > -a server[fn:150] to interact with Emacs. Pass its location through > +a server[fn:151] to interact with Emacs. Pass its location through > the ~org-mobile-directory~ variable. If you can mount that directory > locally just set the variable to point to that directory: > > @@ -20519,7 +20537,7 @@ *** Setting up the staging area > requires OpenSSL installed on the local computer. To turn on > encryption, set the same password in the mobile application and in > Emacs. Set the password in the variable > -~org-mobile-use-encryption~[fn:151]. Note that even after the mobile > +~org-mobile-use-encryption~[fn:152]. Note that even after the mobile > application encrypts the file contents, the file name remains visible > on the file systems of the local computer, the server, and the mobile > device. > @@ -20535,15 +20553,15 @@ *** Pushing to the mobile application > ~org-mobile-files~ into the staging area. Files include agenda files > (as listed in ~org-agenda-files~). Customize ~org-mobile-files~ to > add other files. File names are staged with paths relative to > -~org-directory~, so all files should be inside this directory[fn:152]. > +~org-directory~, so all files should be inside this directory[fn:153]. > > Push creates a special Org file =agendas.org= with custom agenda views > -defined by the user[fn:153]. > +defined by the user[fn:154]. > > Finally, Org writes the file =index.org=, containing links to other > files. The mobile application reads this file first from the server > to determine what other files to download for agendas. For faster > -downloads, it is expected to only read files whose checksums[fn:154] > +downloads, it is expected to only read files whose checksums[fn:155] > have changed. > > *** Pulling from the mobile application > @@ -20560,7 +20578,7 @@ *** Pulling from the mobile application > > 1. > #+vindex: org-mobile-inbox-for-pull > - Org moves all entries found in =mobileorg.org=[fn:155] and appends > + Org moves all entries found in =mobileorg.org=[fn:156] and appends > them to the file pointed to by the variable > ~org-mobile-inbox-for-pull~. It should reside neither in the > staging area nor on the server. Each captured entry and each > @@ -20854,9 +20872,9 @@ *** A LaTeX example of radio tables > #+cindex: @LaTeX{}, and Orgtbl mode > > To wrap a source table in LaTeX, use the =comment= environment > -provided by =comment.sty=[fn:156]. To activate it, put > +provided by =comment.sty=[fn:157]. To activate it, put > ~\usepackage{comment}~ in the document header. Orgtbl mode inserts > -a radio table skeleton[fn:157] with the command {{{kbd(M-x > +a radio table skeleton[fn:158] with the command {{{kbd(M-x > orgtbl-insert-radio-table)}}}, which prompts for a table name. For > example, if =salesfigures= is the name, the template inserts: > > @@ -20875,7 +20893,7 @@ *** A LaTeX example of radio tables > ~orgtbl-to-latex~ to convert the table to LaTeX format, then insert > the table at the target (receive) location named =salesfigures=. Now > the table is ready for data entry. It can even use spreadsheet > -features[fn:158]: > +features[fn:159]: > > #+begin_example > % BEGIN RECEIVE ORGTBL salesfigures > @@ -21091,7 +21109,7 @@ ** Special Agenda Views > #+vindex: org-agenda-skip-function > #+vindex: org-agenda-skip-function-global > Org provides a special hook to further limit items in agenda views: > -~agenda~, ~agenda*~[fn:159], ~todo~, ~alltodo~, ~tags~, ~tags-todo~, > +~agenda~, ~agenda*~[fn:160], ~todo~, ~alltodo~, ~tags~, ~tags-todo~, > ~tags-tree~. Specify a custom function that tests inclusion of every > matched item in the view. This function can also skip as much as is > needed. > @@ -21134,7 +21152,7 @@ ** Special Agenda Views > #+vindex: org-agenda-skip-function > Search for entries with a limit set on levels for the custom search. > This is a general approach to creating custom searches in Org. To > -include all levels, use =LEVEL>0=[fn:160]. Then to selectively pick > +include all levels, use =LEVEL>0=[fn:161]. Then to selectively pick > the matched entries, use ~org-agenda-skip-function~, which also > accepts Lisp forms, such as ~org-agenda-skip-entry-if~ and > ~org-agenda-skip-subtree-if~. For example: > @@ -22258,6 +22276,7 @@ * Footnotes > #+findex: org-anniversary > #+findex: org-cyclic > #+findex: org-block > + > [fn:60] When working with the standard diary expression functions, you > need to be very careful with the order of the arguments. That order > depends evilly on the variable ~calendar-date-style~. For example, to > @@ -22496,140 +22515,143 @@ * Footnotes > within a buffer with the =STARTUP= options =inlineimages= and > =noinlineimages=. > > -[fn:120] The corresponding in-buffer setting is: =#+STARTUP: fninline= > +[fn:120] The width can be customized in Emacs >= 24.1, built with > +imagemagick support. > + > +[fn:121] The corresponding in-buffer setting is: =#+STARTUP: fninline= > or =#+STARTUP: nofninline=. > > -[fn:121] The corresponding in-buffer options are =#+STARTUP: fnadjust= > +[fn:122] The corresponding in-buffer options are =#+STARTUP: fnadjust= > and =#+STARTUP: nofnadjust=. > > -[fn:122] The variable ~org-export-date-timestamp-format~ defines how > +[fn:123] The variable ~org-export-date-timestamp-format~ defines how > this timestamp are exported. > > -[fn:123] For export to LaTeX format---or LaTeX-related formats such as > +[fn:124] For export to LaTeX format---or LaTeX-related formats such as > Beamer---, the =org-latex-package-alist= variable needs further > configuration. See [[LaTeX specific export settings]]. > > -[fn:124] At the moment, some export back-ends do not obey this > +[fn:125] At the moment, some export back-ends do not obey this > specification. For example, LaTeX export excludes every unnumbered > headline from the table of contents. > > -[fn:125] Note that ~org-link-search-must-match-exact-headline~ is > +[fn:126] Note that ~org-link-search-must-match-exact-headline~ is > locally bound to non-~nil~. Therefore, ~org-link-search~ only matches > headlines and named elements. > > -[fn:126] Since commas separate the arguments, commas within arguments > +[fn:127] Since commas separate the arguments, commas within arguments > have to be escaped with the backslash character. So only those > backslash characters before a comma need escaping with another > backslash character. > > -[fn:127] For a less drastic behavior, consider using a select tag (see > +[fn:128] For a less drastic behavior, consider using a select tag (see > [[*Export Settings]]) instead. > > -[fn:128] If =BEAMER_ENV= is set, Org export adds =B_environment= tag > +[fn:129] If =BEAMER_ENV= is set, Org export adds =B_environment= tag > to make it visible. The tag serves as a visual aid and has no > semantic relevance. > > -[fn:129] By default Org loads MathJax from [[https://cdnjs.com][cdnjs.com]] as recommended by > +[fn:130] By default Org loads MathJax from [[https://cdnjs.com][cdnjs.com]] as recommended by > [[https://www.mathjax.org][MathJax]]. > > -[fn:130] Please note that exported formulas are part of an HTML > +[fn:131] Please note that exported formulas are part of an HTML > document, and that signs such as =<=, =>=, or =&= have special > meanings. See [[http://docs.mathjax.org/en/latest/input/tex/html.html#tex-and-latex-in-html-documents][MathJax TeX and LaTeX in HTML documents]]. > > -[fn:131] See [[http://docs.mathjax.org/en/latest/input/tex/extensions.html#tex-and-latex-extensions][TeX and LaTeX extensions]] in the [[http://docs.mathjax.org][MathJax manual]] to learn > +[fn:132] See [[http://docs.mathjax.org/en/latest/input/tex/extensions.html#tex-and-latex-extensions][TeX and LaTeX extensions]] in the [[http://docs.mathjax.org][MathJax manual]] to learn > about extensions. > > -[fn:132] If the classes on TODO keywords and tags lead to conflicts, > +[fn:133] If the classes on TODO keywords and tags lead to conflicts, > use the variables ~org-html-todo-kwd-class-prefix~ and > ~org-html-tag-class-prefix~ to make them unique. > > -[fn:133] This does not allow setting different bibliography compilers > +[fn:134] This does not allow setting different bibliography compilers > for different files. However, "smart" LaTeX compilation systems, such > as latexmk, can select the correct bibliography compiler. > > -[fn:134] Minted uses an external Python package for code highlighting, > +[fn:135] Minted uses an external Python package for code highlighting, > which requires the flag =-shell-escape= to be added to > ~org-latex-pdf-process~. > > -[fn:135] See [[http://docs.oasis-open.org/office/v1.2/OpenDocument-v1.2.html][Open Document Format for Office Applications > +[fn:136] See [[http://docs.oasis-open.org/office/v1.2/OpenDocument-v1.2.html][Open Document Format for Office Applications > (OpenDocument) Version 1.2]]. > > -[fn:136] See [[http://www.mathtoweb.com/cgi-bin/mathtoweb_home.pl][MathToWeb]]. > +[fn:137] See [[http://www.mathtoweb.com/cgi-bin/mathtoweb_home.pl][MathToWeb]]. > > -[fn:137] See [[http://dlmf.nist.gov/LaTeXML/]]. > +[fn:138] See [[http://dlmf.nist.gov/LaTeXML/]]. > > -[fn:138] [[http://docs.oasis-open.org/office/v1.2/OpenDocument-v1.2.html][OpenDocument-v1.2 Specification]] > +[fn:139] [[http://docs.oasis-open.org/office/v1.2/OpenDocument-v1.2.html][OpenDocument-v1.2 Specification]] > > -[fn:139] See the =<table:table-template>= element of the > +[fn:140] See the =<table:table-template>= element of the > OpenDocument-v1.2 specification. > > -[fn:140] See the attributes =table:template-name=, > +[fn:141] See the attributes =table:template-name=, > =table:use-first-row-styles=, =table:use-last-row-styles=, > =table:use-first-column-styles=, =table:use-last-column-styles=, > =table:use-banding-rows-styles=, and =table:use-banding-column-styles= > of the =<table:table>= element in the OpenDocument-v1.2 specification. > > -[fn:141] If the publishing directory is the same as the source > +[fn:142] If the publishing directory is the same as the source > directory, =file.org= is exported as =file.org.org=, so you probably > do not want to do this. > > -[fn:142] The option ~org-babel-no-eval-on-ctrl-c-ctrl-c~ can be used > +[fn:143] The option ~org-babel-no-eval-on-ctrl-c-ctrl-c~ can be used > to remove code evaluation from the {{{kbd(C-c C-c)}}} key binding. > > -[fn:143] Actually, the constructs =call_<name>()= and =src_<lang>{}= > +[fn:144] Actually, the constructs =call_<name>()= and =src_<lang>{}= > are not evaluated when they appear in a keyword (see [[*Summary of > In-Buffer Settings]]). > > -[fn:144] For noweb literate programming details, see > +[fn:145] For noweb literate programming details, see > http://www.cs.tufts.edu/~nr/noweb/. > > -[fn:145] For more information, please refer to the commentary section > +[fn:146] For more information, please refer to the commentary section > in =org-tempo.el=. > > -[fn:146] Org Indent mode also sets ~wrap-prefix~ correctly for > +[fn:147] Org Indent mode also sets ~wrap-prefix~ correctly for > indenting and wrapping long lines of headlines or text. This minor > mode also handles Visual Line mode and directly applied settings > through ~word-wrap~. > > -[fn:147] This works, but requires extra effort. Org Indent mode is > +[fn:148] This works, but requires extra effort. Org Indent mode is > more convenient for most applications. > > -[fn:148] ~org-adapt-indentation~ can also be set to ='headline-data=, > +[fn:149] ~org-adapt-indentation~ can also be set to ='headline-data=, > in which case only data lines below the headline will be indented. > > -[fn:149] Note that Org Indent mode also sets the ~wrap-prefix~ > +[fn:150] Note that Org Indent mode also sets the ~wrap-prefix~ > property, such that Visual Line mode (or purely setting ~word-wrap~) > wraps long lines, including headlines, correctly indented. > > -[fn:150] For a server to host files, consider using a WebDAV server, > +[fn:151] For a server to host files, consider using a WebDAV server, > such as [[https://nextcloud.com][Nextcloud]]. Additional help is at this [[https://orgmode.org/worg/org-faq.html#mobileorg_webdav][FAQ entry]]. > > -[fn:151] If Emacs is configured for safe storing of passwords, then > +[fn:152] If Emacs is configured for safe storing of passwords, then > configure the variable ~org-mobile-encryption-password~; please read > the docstring of that variable. > > -[fn:152] Symbolic links in ~org-directory~ need to have the same name > +[fn:153] Symbolic links in ~org-directory~ need to have the same name > as their targets. > > -[fn:153] While creating the agendas, Org mode forces =ID= properties > +[fn:154] While creating the agendas, Org mode forces =ID= properties > on all referenced entries, so that these entries can be uniquely > identified if Org Mobile flags them for further action. To avoid > setting properties configure the variable > ~org-mobile-force-id-on-agenda-items~ to ~nil~. Org mode then relies > on outline paths, assuming they are unique. > > -[fn:154] Checksums are stored automatically in the file > +[fn:155] Checksums are stored automatically in the file > =checksums.dat=. > > -[fn:155] The file will be empty after this operation. > +[fn:156] The file will be empty after this operation. > > -[fn:156] https://www.ctan.org/pkg/comment > +[fn:157] https://www.ctan.org/pkg/comment > > -[fn:157] By default this works only for LaTeX, HTML, and Texinfo. > +[fn:158] By default this works only for LaTeX, HTML, and Texinfo. > Configure the variable ~orgtbl-radio-table-templates~ to install > templates for other modes. > > -[fn:158] If the =TBLFM= keyword contains an odd number of dollar > +[fn:159] If the =TBLFM= keyword contains an odd number of dollar > characters, this may cause problems with Font Lock in LaTeX mode. As > shown in the example you can fix this by adding an extra line inside > the =comment= environment that is used to balance the dollar > @@ -22637,9 +22659,9 @@ * Footnotes > a much better solution is to add the =comment= environment to the > variable ~LaTeX-verbatim-environments~. > > -[fn:159] The ~agenda*~ view is the same as ~agenda~ except that it > +[fn:160] The ~agenda*~ view is the same as ~agenda~ except that it > only considers /appointments/, i.e., scheduled and deadline items that > have a time specification =[h]h:mm= in their time-stamps. > > -[fn:160] Note that, for ~org-odd-levels-only~, a level number > +[fn:161] Note that, for ~org-odd-levels-only~, a level number > corresponds to order in the hierarchy, not to the number of stars. > diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS > index a7f32671e..d9b41515b 100644 > --- a/etc/ORG-NEWS > +++ b/etc/ORG-NEWS > @@ -296,6 +296,10 @@ headings in HTML export. > Use the header argument =:var x=code-block[]= or > : #+CALL: fn(x=code-block[]) > to pass the contents of a named code block as a string argument. > +*** New property =ORG-IMAGE-ACTUAL-WIDTH= for overriding global ~org-image-actual-width~ > + > +The new property =ORG-IMAGE-ACTUAL-WIDTH= can override the global > +variable ~org-image-actual-width~ value for inline images display width. > > ** New options > *** New custom settings =org-icalendar-scheduled-summary-prefix= and =org-icalendar-deadline-summary-prefix= > diff --git a/lisp/org.el b/lisp/org.el > index a50921519..bba1b5233 100644 > --- a/lisp/org.el > +++ b/lisp/org.el > @@ -12224,7 +12224,8 @@ (defconst org-default-properties > "EXPORT_OPTIONS" "EXPORT_TEXT" "EXPORT_FILE_NAME" > "EXPORT_TITLE" "EXPORT_AUTHOR" "EXPORT_DATE" "UNNUMBERED" > "ORDERED" "NOBLOCKING" "COOKIE_DATA" "LOG_INTO_DRAWER" "REPEAT_TO_STATE" > - "CLOCK_MODELINE_TOTAL" "STYLE" "HTML_CONTAINER_CLASS") > + "CLOCK_MODELINE_TOTAL" "STYLE" "HTML_CONTAINER_CLASS" > + "ORG-IMAGE-ACTUAL-WIDTH") > "Some properties that are used by Org mode for various purposes. > Being in this list makes sure that they are offered for completion.") > > @@ -16255,48 +16256,51 @@ (defun org-display-inline-image--width (link) > If the value is a float between 0 and 2, it interpreted as that proportion > of the text width in the buffer." > ;; Apply `org-image-actual-width' specifications. > - (cond > - ((eq org-image-actual-width t) nil) > - ((listp org-image-actual-width) > - (let* ((case-fold-search t) > - (par (org-element-lineage link '(paragraph))) > - (attr-re "^[ \t]*#\\+attr_.*?: +.*?:width +\\(\\S-+\\)") > - (par-end (org-element-property :post-affiliated par)) > - ;; Try to find an attribute providing a :width. > - (attr-width > - (when (and par (org-with-point-at > - (org-element-property :begin par) > - (re-search-forward attr-re par-end t))) > - (match-string 1))) > - (width > - (cond > - ;; Treat :width t as if `org-image-actual-width' were t. > - ((string= attr-width "t") nil) > - ;; Fallback to `org-image-actual-width' if no interprable width is given. > - ((or (null attr-width) > - (string-match-p "\\`[^0-9]" attr-width)) > - (car org-image-actual-width)) > - ;; Convert numeric widths to numbers, converting percentages. > - ((string-match-p "\\`[0-9.]+%" attr-width) > - (/ (string-to-number attr-width) 100.0)) > - (t (string-to-number attr-width))))) > - (if (and (floatp width) (<= 0.0 width 2.0)) > - ;; A float in [0,2] should be interpereted as this portion of > - ;; the text width in the window. This works well with cases like > - ;; #+attr_latex: :width 0.X\{line,page,column,etc.}width, > - ;; as the "0.X" is pulled out as a float. We use 2 as the upper > - ;; bound as cases such as 1.2\linewidth are feasible. > - (round (* width > - (window-pixel-width) > - (/ (or (and (bound-and-true-p visual-fill-column-mode) > - (or visual-fill-column-width auto-fill-function)) > - (when auto-fill-function fill-column) > - (- (window-text-width) (line-number-display-width))) > - (float (window-total-width))))) > - width))) > - ((numberp org-image-actual-width) > - org-image-actual-width) > - (t nil))) > + ;; Support subtree-level property "ORG-IMAGE-ACTUAL-WIDTH" specified > + ;; width. > + (let ((org-image-actual-width (org-property-or-variable-value 'org-image-actual-width))) > + (cond > + ((eq org-image-actual-width t) nil) > + ((listp org-image-actual-width) > + (let* ((case-fold-search t) > + (par (org-element-lineage link '(paragraph))) > + (attr-re "^[ \t]*#\\+attr_.*?: +.*?:width +\\(\\S-+\\)") > + (par-end (org-element-property :post-affiliated par)) > + ;; Try to find an attribute providing a :width. > + (attr-width > + (when (and par (org-with-point-at > + (org-element-property :begin par) > + (re-search-forward attr-re par-end t))) > + (match-string 1))) > + (width > + (cond > + ;; Treat :width t as if `org-image-actual-width' were t. > + ((string= attr-width "t") nil) > + ;; Fallback to `org-image-actual-width' if no interprable width is given. > + ((or (null attr-width) > + (string-match-p "\\`[^0-9]" attr-width)) > + (car org-image-actual-width)) > + ;; Convert numeric widths to numbers, converting percentages. > + ((string-match-p "\\`[0-9.]+%" attr-width) > + (/ (string-to-number attr-width) 100.0)) > + (t (string-to-number attr-width))))) > + (if (and (floatp width) (<= 0.0 width 2.0)) > + ;; A float in [0,2] should be interpereted as this portion of > + ;; the text width in the window. This works well with cases like > + ;; #+attr_latex: :width 0.X\{line,page,column,etc.}width, > + ;; as the "0.X" is pulled out as a float. We use 2 as the upper > + ;; bound as cases such as 1.2\linewidth are feasible. > + (round (* width > + (window-pixel-width) > + (/ (or (and (bound-and-true-p visual-fill-column-mode) > + (or visual-fill-column-width auto-fill-function)) > + (when auto-fill-function fill-column) > + (- (window-text-width) (line-number-display-width))) > + (float (window-total-width))))) > + width))) > + ((numberp org-image-actual-width) > + org-image-actual-width) > + (t nil)))) > > (defun org-display-inline-remove-overlay (ov after _beg _end &optional _len) > "Remove inline-display overlay if a corresponding region is modified." > -- > 2.35.1 -- [ stardiviner ] I try to make every word tell the meaning that I want to express without misunderstanding. Blog: https://stardiviner.github.io/ IRC(libera.chat, freenode): stardiviner, Matrix: stardiviner GPG: F09F650D7D674819892591401B5DF1C95AE89AC3 [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 487 bytes --] ^ permalink raw reply [flat|nested] 43+ messages in thread
[parent not found: <6329c8b0.050a0220.412d.0a6cSMTPIN_ADDED_BROKEN@mx.google.com>]
* Re: [PATCH v6] New: auto display inline images under subtree when `org-cycle'. [not found] ` <6329c8b0.050a0220.412d.0a6cSMTPIN_ADDED_BROKEN@mx.google.com> @ 2022-09-21 7:54 ` Ihor Radchenko 2022-09-28 12:55 ` [PATCH 2-v1] " Christopher M. Miles [not found] ` <633454e3.050a0220.7278b.1fa5SMTPIN_ADDED_BROKEN@mx.google.com> 0 siblings, 2 replies; 43+ messages in thread From: Ihor Radchenko @ 2022-09-21 7:54 UTC (permalink / raw) To: Christopher M. Miles; +Cc: emacs-orgmode "Christopher M. Miles" <numbchild@gmail.com> writes: > I checked out your patch, it's fine to me. Should be fine to apply. Done. Applied onto main. https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=95df82c5fcf926088da2aaab9354a902956ae881 Going back to cycling inline image visibility now. I think that the first step should be extending `org-remove-inline-images' and `org-display-inline-images' to work on regions. `org-display-inline-images' already provides BEG and END optional arguments, but it currently clears all the images in buffer unconditionally. We will need to make `org-remove-inline-images' work on region and modify `org-display-inline-images' to not affect images outside the provided region. Then, we can modify `org-toggle-inline-images' accordingly and make use of it in org-cycle.el to toggle images in section/subtree. -- Ihor Radchenko, 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 ^ permalink raw reply [flat|nested] 43+ messages in thread
* [PATCH 2-v1] New: auto display inline images under subtree when `org-cycle'. 2022-09-21 7:54 ` Ihor Radchenko @ 2022-09-28 12:55 ` Christopher M. Miles [not found] ` <633454e3.050a0220.7278b.1fa5SMTPIN_ADDED_BROKEN@mx.google.com> 1 sibling, 0 replies; 43+ messages in thread From: Christopher M. Miles @ 2022-09-28 12:55 UTC (permalink / raw) To: Ihor Radchenko; +Cc: Christopher M. Miles, emacs-orgmode [-- Attachment #1.1: Type: text/plain, Size: 376 bytes --] Ok, I created the patch for subtree cycling display inline images. Tested by edebug when org cycling, it should works fine. I don't know how to write test for this. But I got a little problem: When ~org-fold-core-style~ is ~'overlays~, the ~delete-overlay~ will cause subtree unfolded. More detailed check out the "org.el" function ~org-remove-inline-images~ in my patch. [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #1.2: 0001-org.el-Support-auto-display-inline-images-when-cycli.patch --] [-- Type: text/x-patch, Size: 6781 bytes --] From 173772d166c9974db1a76f59fe58988fe8da401a Mon Sep 17 00:00:00 2001 From: stardiviner <numbchild@gmail.com> 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. --- lisp/org-cycle.el | 36 ++++++++++++++++++++++++++++++++++-- lisp/org-keys.el | 2 +- lisp/org.el | 25 +++++++++++++++++-------- 3 files changed, 52 insertions(+), 11 deletions(-) diff --git a/lisp/org-cycle.el b/lisp/org-cycle.el index 656ca83f2..da7a7a34e 100644 --- a/lisp/org-cycle.el +++ b/lisp/org-cycle.el @@ -208,8 +208,9 @@ the values `folded', `children', or `subtree'." :type 'hook) (defcustom org-cycle-hook '(org-cycle-hide-archived-subtrees - org-cycle-show-empty-lines - org-cycle-optimize-window-after-visibility-change) + org-cycle-show-empty-lines + org-cycle-optimize-window-after-visibility-change + 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,12 @@ normal outline commands like `show-all', but not with the cycling commands." :group 'org-cycle :type 'boolean) +(defcustom org-cycle-inline-images-display nil + "Non-nil means auto display inline images under subtree when cycling." + :group 'org-startup + :group 'org-cycle + :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 +783,31 @@ STATE should be one of the symbols listed in the docstring of "Subtree is archived and stays closed. Use \ `\\[org-cycle-force-archived]' to cycle it anyway.")))))) +(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 + (save-excursion + (save-restriction + (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 + (save-excursion + (save-restriction + (org-narrow-to-subtree) + ;; If has nested headlines, also inline display images under all sub-headlines. + (org-display-inline-images nil nil (point-min) (point-max))))) + ('folded + (org-narrow-to-subtree) + (org-remove-inline-images (point-min) (point-max)))))) + (provide 'org-cycle) ;;; org-cycle.el ends here diff --git a/lisp/org-keys.el b/lisp/org-keys.el index d65379a72..79e34cbd1 100644 --- 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" ()) -(declare-function org-toggle-inline-images "org" (&optional include-linked)) +(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..e7eba25cc 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -16071,16 +16071,16 @@ SNIPPETS-P indicates if this is run to create snippet images for HTML." (defvar-local org-inline-image-overlays nil) -(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 - (org-remove-inline-images) + (org-remove-inline-images beg end) (when (called-interactively-p 'interactive) (message "Inline image display turned off"))) - (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 default to the buffer boundaries with possible narrowing." (interactive "P") (when (display-graphic-p) - (unless refresh - (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,20 @@ buffer boundaries with possible narrowing." (delete ov org-inline-image-overlays) (delete-overlay ov)))) -(defun org-remove-inline-images () +(defun org-remove-inline-images (&optional beg end) "Remove inline display of images." (interactive) - (mapc #'delete-overlay org-inline-image-overlays) - (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) + (delete ov org-inline-image-overlays)) + (mapc #'delete-overlay overlays) + ;; FIXME: `org-cycle-display-inline-images' can't fold because `delete-overlay' will unfold subtree. + (when (eq org-fold-core-style 'overlays) + ;; FIXME: don't know how to get the correct `spec'. + (let ((spec (alist-get 'org-fold-hidden org-fold-core--specs))) + (org-fold-core-region beg end t spec))))) (defvar org-self-insert-command-undo-counter 0) (defvar org-speed-command nil) -- 2.37.2 [-- Attachment #1.3: Type: text/plain, Size: 1240 bytes --] Ihor Radchenko <yantar92@gmail.com> writes: > "Christopher M. Miles" <numbchild@gmail.com> writes: > >> I checked out your patch, it's fine to me. Should be fine to apply. > > Done. > Applied onto main. > https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=95df82c5fcf926088da2aaab9354a902956ae881 > > Going back to cycling inline image visibility now. > > I think that the first step should be extending > `org-remove-inline-images' and `org-display-inline-images' to work on > regions. `org-display-inline-images' already provides BEG and END > optional arguments, but it currently clears all the images in buffer > unconditionally. > > We will need to make `org-remove-inline-images' work on region and > modify `org-display-inline-images' to not affect images outside the > provided region. > > Then, we can modify `org-toggle-inline-images' accordingly and make use > of it in org-cycle.el to toggle images in section/subtree. -- [ stardiviner ] I try to make every word tell the meaning that I want to express without misunderstanding. Blog: https://stardiviner.github.io/ IRC(libera.chat, freenode): stardiviner, Matrix: stardiviner GPG: F09F650D7D674819892591401B5DF1C95AE89AC3 [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 487 bytes --] ^ permalink raw reply related [flat|nested] 43+ messages in thread
[parent not found: <633454e3.050a0220.7278b.1fa5SMTPIN_ADDED_BROKEN@mx.google.com>]
* Re: [PATCH 2-v1] New: auto display inline images under subtree when `org-cycle'. [not found] ` <633454e3.050a0220.7278b.1fa5SMTPIN_ADDED_BROKEN@mx.google.com> @ 2022-09-29 3:05 ` Ihor Radchenko 2022-09-29 6:06 ` Christopher M. Miles ` (2 more replies) 0 siblings, 3 replies; 43+ messages in thread From: Ihor Radchenko @ 2022-09-29 3:05 UTC (permalink / raw) To: Christopher M. Miles; +Cc: emacs-orgmode "Christopher M. Miles" <numbchild@gmail.com> writes: > Ok, I created the patch for subtree cycling display inline images. > Tested by edebug when org cycling, it should works fine. I don't know > how to write test for this. Thanks for the update! For tests, you will need to test the existence of image overlays. You can refer to test-org-fold/org-fold-reveal-broken-structure but need to test overlays-at instead of just org-invisible-p. > But I got a little problem: > > When ~org-fold-core-style~ is ~'overlays~, the ~delete-overlay~ will > cause subtree unfolded. More detailed check out the "org.el" function > ~org-remove-inline-images~ in my patch. I will comment in the code. > (defcustom org-cycle-hook '(org-cycle-hide-archived-subtrees > - org-cycle-show-empty-lines > - org-cycle-optimize-window-after-visibility-change) > + org-cycle-show-empty-lines > + org-cycle-optimize-window-after-visibility-change > + 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,12 @@ normal outline commands like `show-all', but not with the cycling commands." > :group 'org-cycle > :type 'boolean) > > +(defcustom org-cycle-inline-images-display nil > + "Non-nil means auto display inline images under subtree when cycling." > + :group 'org-startup > + :group 'org-cycle > + :type 'boolean) You are providing both hook and a customization. It is redundant. Users can already remove the hook when desired. In this area, we generally do not use custom variables (see M-x customize-group org-cycle). So, it is better to use hook. > -(defun org-remove-inline-images () > +(defun org-remove-inline-images (&optional beg end) > "Remove inline display of images." > (interactive) > - (mapc #'delete-overlay org-inline-image-overlays) > - (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) > + (delete ov org-inline-image-overlays)) > + (mapc #'delete-overlay overlays) > + ;; FIXME: `org-cycle-display-inline-images' can't fold because `delete-overlay' will unfold subtree. > + (when (eq org-fold-core-style 'overlays) > + ;; FIXME: don't know how to get the correct `spec'. > + (let ((spec (alist-get 'org-fold-hidden org-fold-core--specs))) > + (org-fold-core-region beg end t spec))))) You can just (dolist (ov overlays) (when (memq ov org-inline-image-overlays) (setq org-inline-image-overlays (delq ov org-inline-image-overlays)) (delete-overlay ov))) Note that `delete' and `delq' are not safe to use on their own. You should always use (setq foo (delq 'member foo)). It is detailed in the docstring. -- Ihor Radchenko, 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 ^ permalink raw reply [flat|nested] 43+ messages in thread
* Re: [PATCH 2-v1] New: auto display inline images under subtree when `org-cycle'. 2022-09-29 3:05 ` Ihor Radchenko @ 2022-09-29 6:06 ` Christopher M. Miles 2022-09-29 6:57 ` [PATCH 2-v1 (test v1)] " Christopher M. Miles [not found] ` <63353c69.370a0220.67788.e8a1SMTPIN_ADDED_BROKEN@mx.google.com> 2 siblings, 0 replies; 43+ messages in thread From: Christopher M. Miles @ 2022-09-29 6:06 UTC (permalink / raw) To: Ihor Radchenko; +Cc: Christopher M. Miles, emacs-orgmode [-- Attachment #1: Type: text/plain, Size: 4178 bytes --] Ihor Radchenko <yantar92@gmail.com> writes: I got a new problem in patch, the (point-max) in function ~org-cycle-display-inline-images~ SOMETIMES return EOF error instead of correct max point value when org-cycle `state' is ~'folded~. I can't find out what caused this even using Edebug. Do you have any clue? > "Christopher M. Miles" <numbchild@gmail.com> writes: > >> Ok, I created the patch for subtree cycling display inline images. >> Tested by edebug when org cycling, it should works fine. I don't know >> how to write test for this. > > Thanks for the update! > > For tests, you will need to test the existence of image overlays. > You can refer to test-org-fold/org-fold-reveal-broken-structure but > need to test overlays-at instead of just org-invisible-p. > I will try to write tests later. >> But I got a little problem: >> >> When ~org-fold-core-style~ is ~'overlays~, the ~delete-overlay~ will >> cause subtree unfolded. More detailed check out the "org.el" function >> ~org-remove-inline-images~ in my patch. > > I will comment in the code. > >> (defcustom org-cycle-hook '(org-cycle-hide-archived-subtrees >> - org-cycle-show-empty-lines >> - org-cycle-optimize-window-after-visibility-change) >> + org-cycle-show-empty-lines >> + org-cycle-optimize-window-after-visibility-change >> + 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,12 @@ normal outline commands like `show-all', but not with the cycling commands." >> :group 'org-cycle >> :type 'boolean) >> >> +(defcustom org-cycle-inline-images-display nil >> + "Non-nil means auto display inline images under subtree when cycling." >> + :group 'org-startup >> + :group 'org-cycle >> + :type 'boolean) > > You are providing both hook and a customization. It is redundant. Users > can already remove the hook when desired. I mock this style from a very similar existing hook function ~org-cycle-hide-archived-subtrees~ and custom variable ~org-cycle-open-archived-trees~. I think removing a hook function from ~org-cycle-hook~ is a way, but not as convenient as defcustom option. (P.S: I think users prefer this defcustom customization style.) > > In this area, we generally do not use custom variables (see M-x > customize-group org-cycle). So, it is better to use hook. > >> -(defun org-remove-inline-images () >> +(defun org-remove-inline-images (&optional beg end) >> "Remove inline display of images." >> (interactive) >> - (mapc #'delete-overlay org-inline-image-overlays) >> - (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) >> + (delete ov org-inline-image-overlays)) >> + (mapc #'delete-overlay overlays) >> + ;; FIXME: `org-cycle-display-inline-images' can't fold because `delete-overlay' will unfold subtree. >> + (when (eq org-fold-core-style 'overlays) >> + ;; FIXME: don't know how to get the correct `spec'. >> + (let ((spec (alist-get 'org-fold-hidden org-fold-core--specs))) >> + (org-fold-core-region beg end t spec))))) > > You can just > > (dolist (ov overlays) > (when (memq ov org-inline-image-overlays) > (setq org-inline-image-overlays (delq ov org-inline-image-overlays)) > (delete-overlay ov))) Done > Note that `delete' and `delq' are not safe to use on their own. You > should always use (setq foo (delq 'member foo)). It is detailed in the > docstring. Thanks for teaching. -- [ stardiviner ] I try to make every word tell the meaning that I want to express without misunderstanding. Blog: https://stardiviner.github.io/ IRC(libera.chat, freenode): stardiviner, Matrix: stardiviner GPG: F09F650D7D674819892591401B5DF1C95AE89AC3 [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 487 bytes --] ^ permalink raw reply [flat|nested] 43+ messages in thread
* Re: [PATCH 2-v1 (test v1)] New: auto display inline images under subtree when `org-cycle'. 2022-09-29 3:05 ` Ihor Radchenko 2022-09-29 6:06 ` Christopher M. Miles @ 2022-09-29 6:57 ` Christopher M. Miles [not found] ` <63353c69.370a0220.67788.e8a1SMTPIN_ADDED_BROKEN@mx.google.com> 2 siblings, 0 replies; 43+ messages in thread From: Christopher M. Miles @ 2022-09-29 6:57 UTC (permalink / raw) To: Ihor Radchenko; +Cc: Christopher M. Miles, emacs-orgmode [-- Attachment #1: Type: text/plain, Size: 2476 bytes --] Ihor Radchenko <yantar92@gmail.com> writes: > "Christopher M. Miles" <numbchild@gmail.com> writes: > >> Ok, I created the patch for subtree cycling display inline images. >> Tested by edebug when org cycling, it should works fine. I don't know >> how to write test for this. > > Thanks for the update! > > For tests, you will need to test the existence of image overlays. > You can refer to test-org-fold/org-fold-reveal-broken-structure but > need to test overlays-at instead of just org-invisible-p. I write a testing prototype, got a problem which I marked TODO in code. And can you check whether my tests correct? Thanks #+begin_src emacs-lisp ;;; TODO: reference `test-org-fold/org-fold-reveal-broken-structure' (ert-deftest test-org-fold/org-fold-display-inline-images () "Test inline images displaying when cycling." (let ((org-fold-core-style 'text-properties) (org-cycle-inline-images-display t)) ;; `org-cycle' -(state)-> `'children' display child inline images. (org-test-with-temp-text "<point>* Heading 1 [[file:image.png]]" (org-overview) (org-cycle) (org-next-link) (should (overlays-at (point))) (org-toggle-inline-images) (should-not (overlays-at (point)))) ;; `org-cycle' -(state)-> `'subtree' display subtrees inline images. (org-test-with-temp-text "<point>* Heading 1 [[file:image.png]] ** Subheading 1 [[file:image2.png]] ** Subheading 2 [[file:image3.png]]" (org-overview) (org-cycle) (org-cycle) (org-next-link) (org-next-link) (should (overlays-at (point))) (org-toggle-inline-images) (should-not (overlays-at (point)))) ;; `org-cycle' -(state)-> `'folded' remove inline image overlays. (org-test-with-temp-text "<point>* Heading 1 [[file:image.png]] ** Subheading 1 [[file:image2.png]] ** Subheading 2 [[file:image3.png]]" (org-overview) (org-cycle) (org-cycle) (org-cycle) ;; TODO: how to detect inline image overlays are deleted after folded? (should (overlays-at (point))) (org-toggle-inline-images) (should-not (overlays-at (point)))))) #+end_src -- [ stardiviner ] I try to make every word tell the meaning that I want to express without misunderstanding. Blog: https://stardiviner.github.io/ IRC(libera.chat, freenode): stardiviner, Matrix: stardiviner GPG: F09F650D7D674819892591401B5DF1C95AE89AC3 [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 487 bytes --] ^ permalink raw reply [flat|nested] 43+ messages in thread
[parent not found: <63353c69.370a0220.67788.e8a1SMTPIN_ADDED_BROKEN@mx.google.com>]
* Re: [PATCH 2-v1] New: auto display inline images under subtree when `org-cycle'. [not found] ` <63353c69.370a0220.67788.e8a1SMTPIN_ADDED_BROKEN@mx.google.com> @ 2022-09-30 3:19 ` Ihor Radchenko 2022-09-30 8:27 ` [PATCH 2-v2] " Christopher M. Miles [not found] ` <6336a955.050a0220.4e72e.2b23SMTPIN_ADDED_BROKEN@mx.google.com> 0 siblings, 2 replies; 43+ messages in thread From: Ihor Radchenko @ 2022-09-30 3:19 UTC (permalink / raw) To: Christopher M. Miles; +Cc: emacs-orgmode "Christopher M. Miles" <numbchild@gmail.com> writes: > Ihor Radchenko <yantar92@gmail.com> writes: > > I got a new problem in patch, the (point-max) in function > ~org-cycle-display-inline-images~ SOMETIMES return EOF error instead of > correct max point value when org-cycle `state' is ~'folded~. I can't > find out what caused this even using Edebug. Do you have any clue? Maybe because the 'folded branch in that function is not wrapped into `save-restriction'? >> You are providing both hook and a customization. It is redundant. Users >> can already remove the hook when desired. > > I mock this style from a very similar existing hook function > ~org-cycle-hide-archived-subtrees~ and custom variable > ~org-cycle-open-archived-trees~. I think removing a hook function from > ~org-cycle-hook~ is a way, but not as convenient as defcustom option. > (P.S: I think users prefer this defcustom customization style.) I see your point. I agree that having a variable is better and also leaves an option to introduce in-buffer setting for this. Let's leave the hook part for now - if we want to alter it, we may need to re-consider all the default hooks. -- Ihor Radchenko, 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 ^ permalink raw reply [flat|nested] 43+ messages in thread
* Re: [PATCH 2-v2] New: auto display inline images under subtree when `org-cycle'. 2022-09-30 3:19 ` [PATCH 2-v1] " Ihor Radchenko @ 2022-09-30 8:27 ` Christopher M. Miles [not found] ` <6336a955.050a0220.4e72e.2b23SMTPIN_ADDED_BROKEN@mx.google.com> 1 sibling, 0 replies; 43+ messages in thread From: Christopher M. Miles @ 2022-09-30 8:27 UTC (permalink / raw) To: Ihor Radchenko; +Cc: Christopher M. Miles, emacs-orgmode [-- Attachment #1.1: Type: text/plain, Size: 619 bytes --] Ihor Radchenko <yantar92@gmail.com> writes: > "Christopher M. Miles" <numbchild@gmail.com> writes: > >> Ihor Radchenko <yantar92@gmail.com> writes: >> >> I got a new problem in patch, the (point-max) in function >> ~org-cycle-display-inline-images~ SOMETIMES return EOF error instead of >> correct max point value when org-cycle `state' is ~'folded~. I can't >> find out what caused this even using Edebug. Do you have any clue? > > Maybe because the 'folded branch in that function is not wrapped into > `save-restriction'? > Ah, Indeed, I forgot to wrap it. Now I fixed this error. I attached new version patch. [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #1.2: 0001-org.el-Support-auto-display-inline-images-when-cycli.patch --] [-- Type: text/x-patch, Size: 8922 bytes --] From 570551a39038cf4190cd7cb453a8d059326b9dcb Mon Sep 17 00:00:00 2001 From: stardiviner <numbchild@gmail.com> 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-images): Add test for inline image displaying when cycling. --- lisp/org-cycle.el | 41 ++++++++++++++++++++++++++++-- lisp/org-keys.el | 2 +- lisp/org.el | 21 +++++++++------ testing/lisp/test-org-fold.el | 48 +++++++++++++++++++++++++++++++++++ 4 files changed, 101 insertions(+), 11 deletions(-) diff --git a/lisp/org-cycle.el b/lisp/org-cycle.el index 656ca83f2..6204b8a4f 100644 --- a/lisp/org-cycle.el +++ b/lisp/org-cycle.el @@ -208,8 +208,9 @@ the values `folded', `children', or `subtree'." :type 'hook) (defcustom org-cycle-hook '(org-cycle-hide-archived-subtrees - org-cycle-show-empty-lines - org-cycle-optimize-window-after-visibility-change) + org-cycle-show-empty-lines + org-cycle-optimize-window-after-visibility-change + 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,12 @@ normal outline commands like `show-all', but not with the cycling commands." :group 'org-cycle :type 'boolean) +(defcustom org-cycle-inline-images-display nil + "Non-nil means auto display inline images under subtree when cycling." + :group 'org-startup + :group 'org-cycle + :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 +783,36 @@ STATE should be one of the symbols listed in the docstring of "Subtree is archived and stays closed. Use \ `\\[org-cycle-force-archived]' to cycle it anyway.")))))) +(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 + (save-excursion + (save-restriction + (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 + (save-excursion + (save-restriction + (org-narrow-to-subtree) + ;; If has nested headlines, also inline display images under all sub-headlines. + (org-display-inline-images nil nil (point-min) (point-max))))) + ('folded + (save-excursion + (save-restriction + (org-narrow-to-subtree) + ;; FIXME: sometimes `point-max' is EOF. + (if (numberp (point-max)) + (org-remove-inline-images (point-min) (point-max)) + (ignore)))))))) + (provide 'org-cycle) ;;; org-cycle.el ends here diff --git a/lisp/org-keys.el b/lisp/org-keys.el index d65379a72..79e34cbd1 100644 --- 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" ()) -(declare-function org-toggle-inline-images "org" (&optional include-linked)) +(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 --- a/lisp/org.el +++ b/lisp/org.el @@ -16071,16 +16071,16 @@ SNIPPETS-P indicates if this is run to create snippet images for HTML." (defvar-local org-inline-image-overlays nil) -(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 - (org-remove-inline-images) + (org-remove-inline-images beg end) (when (called-interactively-p 'interactive) (message "Inline image display turned off"))) - (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 default to the buffer boundaries with possible narrowing." (interactive "P") (when (display-graphic-p) - (unless refresh - (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)))) -(defun org-remove-inline-images () +(defun org-remove-inline-images (&optional beg end) "Remove inline display of images." (interactive) - (mapc #'delete-overlay org-inline-image-overlays) - (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))))) (defvar org-self-insert-command-undo-counter 0) (defvar org-speed-command nil) diff --git a/testing/lisp/test-org-fold.el b/testing/lisp/test-org-fold.el index 0fa800dee..5c47cafb4 100644 --- a/testing/lisp/test-org-fold.el +++ b/testing/lisp/test-org-fold.el @@ -604,6 +604,54 @@ Unfolded Paragraph. (org-fold-check-before-invisible-edit kind) (should (org-invisible-p (1- (point)))))))))) +;;; TODO: reference `test-org-fold/org-fold-reveal-broken-structure' +(ert-deftest test-org-fold/org-fold-display-inline-images () + "Test inline images displaying when cycling." + (let ((org-fold-core-style 'text-properties) + (org-cycle-inline-images-display t)) + ;; `org-cycle' -(state)-> `'children' display child inline images. + (org-test-with-temp-text + "<point>* Heading 1 +[[file:image.png]]" + (org-overview) + (org-cycle) + (org-next-link) + (should (overlays-at (point))) + (org-toggle-inline-images) + (should-not (overlays-at (point)))) + ;; `org-cycle' -(state)-> `'subtree' display subtrees inline images. + (org-test-with-temp-text + "<point>* Heading 1 +[[file:image.png]] +** Subheading 1 +[[file:image2.png]] +** Subheading 2 +[[file:image3.png]]" + (org-overview) + (org-cycle) + (org-cycle) + (org-next-link) + (org-next-link) + (should (overlays-at (point))) + (org-toggle-inline-images) + (should-not (overlays-at (point)))) + ;; `org-cycle' -(state)-> `'folded' remove inline image overlays. + (org-test-with-temp-text + "<point>* Heading 1 +[[file:image.png]] +** Subheading 1 +[[file:image2.png]] +** Subheading 2 +[[file:image3.png]]" + (org-overview) + (org-cycle) + (org-cycle) + (org-cycle) + ;; TODO: how to detect inline image overlays are deleted after folded? + (should (overlays-at (point))) + (org-toggle-inline-images) + (should-not (overlays-at (point)))))) + (provide 'test-org-fold) ;;; test-org-fold.el ends here -- 2.37.2 [-- Attachment #1.3: Type: text/plain, Size: 1005 bytes --] >>> You are providing both hook and a customization. It is redundant. Users >>> can already remove the hook when desired. >> >> I mock this style from a very similar existing hook function >> ~org-cycle-hide-archived-subtrees~ and custom variable >> ~org-cycle-open-archived-trees~. I think removing a hook function from >> ~org-cycle-hook~ is a way, but not as convenient as defcustom option. >> (P.S: I think users prefer this defcustom customization style.) > > I see your point. > I agree that having a variable is better and also leaves an option to > introduce in-buffer setting for this. > > Let's leave the hook part for now - if we want to alter it, we may need > to re-consider all the default hooks. Thanks -- [ stardiviner ] I try to make every word tell the meaning that I want to express without misunderstanding. Blog: https://stardiviner.github.io/ IRC(libera.chat, freenode): stardiviner, Matrix: stardiviner GPG: F09F650D7D674819892591401B5DF1C95AE89AC3 [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 487 bytes --] ^ permalink raw reply related [flat|nested] 43+ messages in thread
[parent not found: <6336a955.050a0220.4e72e.2b23SMTPIN_ADDED_BROKEN@mx.google.com>]
* Re: [PATCH 2-v2] New: auto display inline images under subtree when `org-cycle'. [not found] ` <6336a955.050a0220.4e72e.2b23SMTPIN_ADDED_BROKEN@mx.google.com> @ 2022-10-01 3:16 ` Ihor Radchenko 2022-10-01 9:51 ` [PATCH 2-v3] " Christopher M. Miles [not found] ` <63380f57.370a0220.a9d9a.dee8SMTPIN_ADDED_BROKEN@mx.google.com> 0 siblings, 2 replies; 43+ messages in thread From: Ihor Radchenko @ 2022-10-01 3:16 UTC (permalink / raw) To: Christopher M. Miles; +Cc: emacs-orgmode "Christopher M. Miles" <numbchild@gmail.com> writes: > I attached new version patch. Thanks! > +(defcustom org-cycle-inline-images-display nil > + "Non-nil means auto display inline images under subtree when cycling." > + :group 'org-startup > + :group 'org-cycle > + :type 'boolean) Please add :package-version tag as well. > + ('folded > + (save-excursion > + (save-restriction > + (org-narrow-to-subtree) > + ;; FIXME: sometimes `point-max' is EOF. Do you still need this FIXME? Also, you can use `org-with-wide-buffer' instead of save-excursion/restriction. > +;;; TODO: reference `test-org-fold/org-fold-reveal-broken-structure' > +(ert-deftest test-org-fold/org-fold-display-inline-images () > + "Test inline images displaying when cycling." > + (let ((org-fold-core-style 'text-properties) Why do you need to set `org-fold-core-style' explicitly here? > + (org-cycle-inline-images-display t)) > + ;; `org-cycle' -(state)-> `'children' display child inline images. > + (org-test-with-temp-text > + "<point>* Heading 1 > +[[file:image.png]]" This will not work in real tests. image.png will not exist. You will need to provide a reference image in testing/examples > + ;; `org-cycle' -(state)-> `'folded' remove inline image overlays. > + (org-test-with-temp-text > + "<point>* Heading 1 > +[[file:image.png]] > +** Subheading 1 > +[[file:image2.png]] > +** Subheading 2 > +[[file:image3.png]]" > + (org-overview) > + (org-cycle) > + (org-cycle) > + (org-cycle) > + ;; TODO: how to detect inline image overlays are deleted after folded? > + (should (overlays-at (point))) > + (org-toggle-inline-images) > + (should-not (overlays-at (point)))))) This latest test will not work. The point is at BOB. -- Ihor Radchenko, 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 ^ permalink raw reply [flat|nested] 43+ messages in thread
* Re: [PATCH 2-v3] New: auto display inline images under subtree when `org-cycle'. 2022-10-01 3:16 ` Ihor Radchenko @ 2022-10-01 9:51 ` Christopher M. Miles [not found] ` <63380f57.370a0220.a9d9a.dee8SMTPIN_ADDED_BROKEN@mx.google.com> 1 sibling, 0 replies; 43+ messages in thread From: Christopher M. Miles @ 2022-10-01 9:51 UTC (permalink / raw) To: Ihor Radchenko; +Cc: Christopher M. Miles, emacs-orgmode [-- Attachment #1.1: Type: text/plain, Size: 28 bytes --] I attached the new patch. [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #1.2: 0001-org.el-Support-auto-display-inline-images-when-cycli.patch --] [-- Type: text/x-patch, Size: 20036 bytes --] From 67a00b91f53412435a5fd29406cf583a85f2de6d Mon Sep 17 00:00:00 2001 From: stardiviner <numbchild@gmail.com> 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-images): Add test for inline image displaying when cycling. --- etc/ORG-NEWS | 4 ++ 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 | 49 ++++++++++++++++++ 6 files changed, 103 insertions(+), 11 deletions(-) create mode 100755 testing/examples/images/Org mode logo mono-color.png diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS index cab64317f..ec2764b3b 100644 --- a/etc/ORG-NEWS +++ b/etc/ORG-NEWS @@ -307,6 +307,10 @@ to pass the contents of a named code block as a string argument. The new property =ORG-IMAGE-ACTUAL-WIDTH= can override the global variable ~org-image-actual-width~ value for inline images display width. +*** 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-display~. + *** New ~org-babel-tangle-finished-hook~ hook run at the very end of ~org-babel-tangle~ 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 --- a/lisp/org-cycle.el +++ b/lisp/org-cycle.el @@ -208,8 +208,9 @@ the values `folded', `children', or `subtree'." :type 'hook) (defcustom org-cycle-hook '(org-cycle-hide-archived-subtrees - org-cycle-show-empty-lines - org-cycle-optimize-window-after-visibility-change) + org-cycle-show-empty-lines + org-cycle-optimize-window-after-visibility-change + 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) +(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 docstring of "Subtree is archived and stays closed. Use \ `\\[org-cycle-force-archived]' to cycle it anyway.")))))) +(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 sub-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) ;;; org-cycle.el ends here diff --git a/lisp/org-keys.el b/lisp/org-keys.el index d65379a72..79e34cbd1 100644 --- 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" ()) -(declare-function org-toggle-inline-images "org" (&optional include-linked)) +(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 --- a/lisp/org.el +++ b/lisp/org.el @@ -16071,16 +16071,16 @@ SNIPPETS-P indicates if this is run to create snippet images for HTML." (defvar-local org-inline-image-overlays nil) -(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 - (org-remove-inline-images) + (org-remove-inline-images beg end) (when (called-interactively-p 'interactive) (message "Inline image display turned off"))) - (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 default to the buffer boundaries with possible narrowing." (interactive "P") (when (display-graphic-p) - (unless refresh - (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)))) -(defun org-remove-inline-images () +(defun org-remove-inline-images (&optional beg end) "Remove inline display of images." (interactive) - (mapc #'delete-overlay org-inline-image-overlays) - (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))))) (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..9ac57e6a205257fd2fd21944a025190aa2f2db49 GIT binary patch literal 7523 zcmV-p9h~BcP)<h;3K|Lk000e1NJLTq004gg004vt1^@s6x#;xC00006VoOIv0RI60 z0RN!9r;`8x010qNS#tmY3ljhU3ljkVnw%H_000McNliru-UA2#E(`i0Rb&7F9Pmj* zK~#9!?VWjaT=kXbKli;_RoZ1Owk*pVHjC|GjNP%p32}xH2%(42B+ewHGb90QPSV}U z%sF&2Jvr$~LiY^WSiGFj-AU-4^d#wS2nkDo1h82pFkXQeTaslhmMmFYsn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eup{K}Ej&hWv9OWoSIl2(({{sZ59n%b9$Nm5S002ovPDHLkV1oBJp5p)j literal 0 HcmV?d00001 diff --git a/testing/lisp/test-org-fold.el b/testing/lisp/test-org-fold.el index 0fa800dee..ffcfde56b 100644 --- a/testing/lisp/test-org-fold.el +++ b/testing/lisp/test-org-fold.el @@ -604,6 +604,55 @@ Unfolded Paragraph. (org-fold-check-before-invisible-edit kind) (should (org-invisible-p (1- (point)))))))))) +(ert-deftest test-org-fold/org-fold-display-inline-images () + "Test inline images displaying when cycling." + (let* ((org-cycle-inline-images-display t) + (images-dir (expand-file-name "examples/images/" org-test-dir)) + (org-logo-image (expand-file-name "Org mode logo mono-color.png" images-dir))) + ;; `org-cycle' -(state)-> `'children' display child inline images. + (org-test-with-temp-text + (format "<point>* Heading 1 +[[file:%s]]" org-logo-image) + (org-overview) + (org-cycle) + (org-next-link) + (should (overlays-at (point))) + (org-toggle-inline-images) + (should-not (overlays-at (point)))) + + ;; `org-cycle' -(state)-> `'subtree' display subtrees inline images. + (org-test-with-temp-text + (format "<point>* 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-next-link) + (org-next-link) + (should (overlays-at (point))) + (org-toggle-inline-images) + (should-not (overlays-at (point)))) + + ;; `org-cycle' -(state)-> `'folded' remove inline image overlays. + ;; (org-test-with-temp-text + ;; (format "<point>* 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 after folded? + ;; ) + )) + (provide 'test-org-fold) ;;; test-org-fold.el ends here -- 2.37.2 [-- Attachment #1.3: Type: text/plain, Size: 21071 bytes --] Ihor Radchenko <yantar92@gmail.com> writes: > "Christopher M. Miles" <numbchild@gmail.com> writes: > >> I attached new version patch. > > Thanks! > >> +(defcustom org-cycle-inline-images-display nil >> + "Non-nil means auto display inline images under subtree when cycling." >> + :group 'org-startup >> + :group 'org-cycle >> + :type 'boolean) > > Please add :package-version tag as well. > Done >> + ('folded >> + (save-excursion >> + (save-restriction >> + (org-narrow-to-subtree) >> + ;; FIXME: sometimes `point-max' is EOF. > > Do you still need this FIXME? > Also, you can use `org-with-wide-buffer' instead of > save-excursion/restriction. > Done >> +;;; TODO: reference `test-org-fold/org-fold-reveal-broken-structure' >> +(ert-deftest test-org-fold/org-fold-display-inline-images () >> + "Test inline images displaying when cycling." >> + (let ((org-fold-core-style 'text-properties) > > Why do you need to set `org-fold-core-style' explicitly here? > Removed, Done >> + (org-cycle-inline-images-display t)) >> + ;; `org-cycle' -(state)-> `'children' display child inline images. >> + (org-test-with-temp-text >> + "<point>* Heading 1 >> +[[file:image.png]]" > > This will not work in real tests. image.png will not exist. > You will need to provide a reference image in testing/examples > Added image file and link now. >> + ;; `org-cycle' -(state)-> `'folded' remove inline image overlays. >> + (org-test-with-temp-text >> + "<point>* Heading 1 >> +[[file:image.png]] >> +** Subheading 1 >> +[[file:image2.png]] >> +** Subheading 2 >> +[[file:image3.png]]" >> + (org-overview) >> + (org-cycle) >> + (org-cycle) >> + (org-cycle) >> + ;; TODO: how to detect inline image overlays are deleted after folded? >> + (should (overlays-at (point))) >> + (org-toggle-inline-images) >> + (should-not (overlays-at (point)))))) > > This latest test will not work. The point is at BOB. I commented out the third test if someone can do this. I don't now how to test in fold state. ================================================================================================== 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. #+begin_example ~/Code/Emacs/org-mode:subtree-display-inline-images λ make test /Applications/Xcode.app/Contents/Developer/usr/bin/make -C doc clean; /Applications/Xcode.app/Contents/Developer/usr/bin/make -C lisp clean; rm -f *.pdf *.html *.info *_letter.tex org-version.inc org-version.tex \ *.aux *.cp *.cps *.dvi *.fn *.fns *.ky *.kys *.pg *.pgs *.toc \ *.tp *.tps *.vr *.vrs *.log *.ps rm -f org-version.el org-loaddefs.el org-version.elc org-loaddefs.elc org-install.elc rm -f *.elc /Applications/Xcode.app/Contents/Developer/usr/bin/make -C lisp compile rm -f org-version.el org-loaddefs.el org-version.elc org-loaddefs.elc org-install.elc org-version: 9.6-pre (release_9.5.5-845-g67a00b) Loading /Users/stardiviner/Code/Emacs/org-mode/lisp/org-compat.el (source)... Loading /Users/stardiviner/Code/Emacs/org-mode/mk/org-fixup.el (source)... org-loaddefs: 9.6-pre (release_9.5.5-845-g67a00b) Loading /Users/stardiviner/Code/Emacs/org-mode/lisp/org-compat.el (source)... Loading /Users/stardiviner/Code/Emacs/org-mode/mk/org-fixup.el (source)... /Applications/Xcode.app/Contents/Developer/usr/bin/make compile-dirall ==================== dirall ==================== Checking /Users/stardiviner/Code/Emacs/org-mode/lisp... Compiling /Users/stardiviner/Code/Emacs/org-mode/lisp/ob-C.el... Compiling /Users/stardiviner/Code/Emacs/org-mode/lisp/ob-R.el... Compiling /Users/stardiviner/Code/Emacs/org-mode/lisp/ob-awk.el... Compiling /Users/stardiviner/Code/Emacs/org-mode/lisp/ob-calc.el... Compiling /Users/stardiviner/Code/Emacs/org-mode/lisp/ob-clojure.el... Compiling /Users/stardiviner/Code/Emacs/org-mode/lisp/ob-comint.el... Compiling /Users/stardiviner/Code/Emacs/org-mode/lisp/ob-core.el... Compiling /Users/stardiviner/Code/Emacs/org-mode/lisp/ob-css.el... Compiling /Users/stardiviner/Code/Emacs/org-mode/lisp/ob-ditaa.el... Compiling /Users/stardiviner/Code/Emacs/org-mode/lisp/ob-dot.el... Compiling /Users/stardiviner/Code/Emacs/org-mode/lisp/ob-emacs-lisp.el... Compiling /Users/stardiviner/Code/Emacs/org-mode/lisp/ob-eshell.el... Compiling /Users/stardiviner/Code/Emacs/org-mode/lisp/ob-eval.el... Compiling /Users/stardiviner/Code/Emacs/org-mode/lisp/ob-exp.el... Compiling /Users/stardiviner/Code/Emacs/org-mode/lisp/ob-forth.el... Compiling /Users/stardiviner/Code/Emacs/org-mode/lisp/ob-fortran.el... Compiling /Users/stardiviner/Code/Emacs/org-mode/lisp/ob-gnuplot.el... Compiling /Users/stardiviner/Code/Emacs/org-mode/lisp/ob-groovy.el... Compiling /Users/stardiviner/Code/Emacs/org-mode/lisp/ob-haskell.el... Compiling /Users/stardiviner/Code/Emacs/org-mode/lisp/ob-java.el... Compiling /Users/stardiviner/Code/Emacs/org-mode/lisp/ob-js.el... Compiling /Users/stardiviner/Code/Emacs/org-mode/lisp/ob-julia.el... Compiling /Users/stardiviner/Code/Emacs/org-mode/lisp/ob-latex.el... Compiling /Users/stardiviner/Code/Emacs/org-mode/lisp/ob-lilypond.el... Compiling /Users/stardiviner/Code/Emacs/org-mode/lisp/ob-lisp.el... Compiling /Users/stardiviner/Code/Emacs/org-mode/lisp/ob-lob.el... Compiling /Users/stardiviner/Code/Emacs/org-mode/lisp/ob-lua.el... Compiling /Users/stardiviner/Code/Emacs/org-mode/lisp/ob-makefile.el... Compiling /Users/stardiviner/Code/Emacs/org-mode/lisp/ob-matlab.el... Compiling /Users/stardiviner/Code/Emacs/org-mode/lisp/ob-maxima.el... Compiling /Users/stardiviner/Code/Emacs/org-mode/lisp/ob-ocaml.el... Compiling /Users/stardiviner/Code/Emacs/org-mode/lisp/ob-octave.el... Compiling /Users/stardiviner/Code/Emacs/org-mode/lisp/ob-org.el... Compiling /Users/stardiviner/Code/Emacs/org-mode/lisp/ob-perl.el... Compiling /Users/stardiviner/Code/Emacs/org-mode/lisp/ob-plantuml.el... Compiling /Users/stardiviner/Code/Emacs/org-mode/lisp/ob-processing.el... Compiling /Users/stardiviner/Code/Emacs/org-mode/lisp/ob-python.el... Compiling /Users/stardiviner/Code/Emacs/org-mode/lisp/ob-ref.el... Compiling /Users/stardiviner/Code/Emacs/org-mode/lisp/ob-ruby.el... Compiling /Users/stardiviner/Code/Emacs/org-mode/lisp/ob-sass.el... Compiling /Users/stardiviner/Code/Emacs/org-mode/lisp/ob-scheme.el... Compiling /Users/stardiviner/Code/Emacs/org-mode/lisp/ob-screen.el... Compiling /Users/stardiviner/Code/Emacs/org-mode/lisp/ob-sed.el... Compiling /Users/stardiviner/Code/Emacs/org-mode/lisp/ob-shell.el... Compiling /Users/stardiviner/Code/Emacs/org-mode/lisp/ob-sql.el... Compiling /Users/stardiviner/Code/Emacs/org-mode/lisp/ob-sqlite.el... Compiling /Users/stardiviner/Code/Emacs/org-mode/lisp/ob-table.el... Compiling /Users/stardiviner/Code/Emacs/org-mode/lisp/ob-tangle.el... Compiling /Users/stardiviner/Code/Emacs/org-mode/lisp/ob.el... Compiling /Users/stardiviner/Code/Emacs/org-mode/lisp/oc-basic.el... Compiling /Users/stardiviner/Code/Emacs/org-mode/lisp/oc-biblatex.el... Compiling /Users/stardiviner/Code/Emacs/org-mode/lisp/oc-bibtex.el... Compiling /Users/stardiviner/Code/Emacs/org-mode/lisp/oc-csl.el... Compiling /Users/stardiviner/Code/Emacs/org-mode/lisp/oc-natbib.el... Compiling /Users/stardiviner/Code/Emacs/org-mode/lisp/oc.el... Compiling /Users/stardiviner/Code/Emacs/org-mode/lisp/ol-bbdb.el... Compiling /Users/stardiviner/Code/Emacs/org-mode/lisp/ol-bibtex.el... Compiling /Users/stardiviner/Code/Emacs/org-mode/lisp/ol-docview.el... Compiling /Users/stardiviner/Code/Emacs/org-mode/lisp/ol-doi.el... Compiling /Users/stardiviner/Code/Emacs/org-mode/lisp/ol-eshell.el... Compiling /Users/stardiviner/Code/Emacs/org-mode/lisp/ol-eww.el... Compiling /Users/stardiviner/Code/Emacs/org-mode/lisp/ol-gnus.el... Compiling /Users/stardiviner/Code/Emacs/org-mode/lisp/ol-info.el... Compiling /Users/stardiviner/Code/Emacs/org-mode/lisp/ol-irc.el... Compiling /Users/stardiviner/Code/Emacs/org-mode/lisp/ol-man.el... Compiling /Users/stardiviner/Code/Emacs/org-mode/lisp/ol-mhe.el... Compiling /Users/stardiviner/Code/Emacs/org-mode/lisp/ol-rmail.el... Compiling /Users/stardiviner/Code/Emacs/org-mode/lisp/ol-w3m.el... Compiling /Users/stardiviner/Code/Emacs/org-mode/lisp/ol.el... Compiling /Users/stardiviner/Code/Emacs/org-mode/lisp/org-agenda.el... Compiling /Users/stardiviner/Code/Emacs/org-mode/lisp/org-archive.el... Compiling /Users/stardiviner/Code/Emacs/org-mode/lisp/org-attach-git.el... Compiling /Users/stardiviner/Code/Emacs/org-mode/lisp/org-attach.el... Compiling /Users/stardiviner/Code/Emacs/org-mode/lisp/org-capture.el... Compiling /Users/stardiviner/Code/Emacs/org-mode/lisp/org-clock.el... Compiling /Users/stardiviner/Code/Emacs/org-mode/lisp/org-colview.el... Compiling /Users/stardiviner/Code/Emacs/org-mode/lisp/org-compat.el... Compiling /Users/stardiviner/Code/Emacs/org-mode/lisp/org-crypt.el... Compiling /Users/stardiviner/Code/Emacs/org-mode/lisp/org-ctags.el... Compiling /Users/stardiviner/Code/Emacs/org-mode/lisp/org-cycle.el... Compiling /Users/stardiviner/Code/Emacs/org-mode/lisp/org-datetree.el... Compiling /Users/stardiviner/Code/Emacs/org-mode/lisp/org-duration.el... Compiling /Users/stardiviner/Code/Emacs/org-mode/lisp/org-element.el... In org-element--cache-active-p: org-element.el:5682:11: Warning: defsubst `org-element--cache-active-p' was used before it was defined Compiling /Users/stardiviner/Code/Emacs/org-mode/lisp/org-entities.el... Compiling /Users/stardiviner/Code/Emacs/org-mode/lisp/org-faces.el... Compiling /Users/stardiviner/Code/Emacs/org-mode/lisp/org-feed.el... Compiling /Users/stardiviner/Code/Emacs/org-mode/lisp/org-fold-core.el... Compiling /Users/stardiviner/Code/Emacs/org-mode/lisp/org-fold.el... Compiling /Users/stardiviner/Code/Emacs/org-mode/lisp/org-footnote.el... Compiling /Users/stardiviner/Code/Emacs/org-mode/lisp/org-goto.el... Compiling /Users/stardiviner/Code/Emacs/org-mode/lisp/org-habit.el... Compiling /Users/stardiviner/Code/Emacs/org-mode/lisp/org-id.el... Compiling /Users/stardiviner/Code/Emacs/org-mode/lisp/org-indent.el... Compiling /Users/stardiviner/Code/Emacs/org-mode/lisp/org-inlinetask.el... Compiling /Users/stardiviner/Code/Emacs/org-mode/lisp/org-keys.el... Compiling /Users/stardiviner/Code/Emacs/org-mode/lisp/org-lint.el... Compiling /Users/stardiviner/Code/Emacs/org-mode/lisp/org-list.el... Compiling /Users/stardiviner/Code/Emacs/org-mode/lisp/org-loaddefs.el... Compiling /Users/stardiviner/Code/Emacs/org-mode/lisp/org-macro.el... Compiling /Users/stardiviner/Code/Emacs/org-mode/lisp/org-macs.el... Compiling /Users/stardiviner/Code/Emacs/org-mode/lisp/org-mobile.el... Compiling /Users/stardiviner/Code/Emacs/org-mode/lisp/org-mouse.el... Compiling /Users/stardiviner/Code/Emacs/org-mode/lisp/org-num.el... Compiling /Users/stardiviner/Code/Emacs/org-mode/lisp/org-pcomplete.el... Compiling /Users/stardiviner/Code/Emacs/org-mode/lisp/org-persist.el... Compiling /Users/stardiviner/Code/Emacs/org-mode/lisp/org-plot.el... Compiling /Users/stardiviner/Code/Emacs/org-mode/lisp/org-protocol.el... Compiling /Users/stardiviner/Code/Emacs/org-mode/lisp/org-refile.el... Compiling /Users/stardiviner/Code/Emacs/org-mode/lisp/org-src.el... Compiling /Users/stardiviner/Code/Emacs/org-mode/lisp/org-table.el... Compiling /Users/stardiviner/Code/Emacs/org-mode/lisp/org-tempo.el... Compiling /Users/stardiviner/Code/Emacs/org-mode/lisp/org-timer.el... Compiling /Users/stardiviner/Code/Emacs/org-mode/lisp/org-version.el... Compiling /Users/stardiviner/Code/Emacs/org-mode/lisp/org.el... Compiling /Users/stardiviner/Code/Emacs/org-mode/lisp/ox-ascii.el... Compiling /Users/stardiviner/Code/Emacs/org-mode/lisp/ox-beamer.el... Compiling /Users/stardiviner/Code/Emacs/org-mode/lisp/ox-html.el... Compiling /Users/stardiviner/Code/Emacs/org-mode/lisp/ox-icalendar.el... Compiling /Users/stardiviner/Code/Emacs/org-mode/lisp/ox-koma-letter.el... Compiling /Users/stardiviner/Code/Emacs/org-mode/lisp/ox-latex.el... Compiling /Users/stardiviner/Code/Emacs/org-mode/lisp/ox-man.el... Compiling /Users/stardiviner/Code/Emacs/org-mode/lisp/ox-md.el... Compiling /Users/stardiviner/Code/Emacs/org-mode/lisp/ox-odt.el... Compiling /Users/stardiviner/Code/Emacs/org-mode/lisp/ox-org.el... Compiling /Users/stardiviner/Code/Emacs/org-mode/lisp/ox-publish.el... Compiling /Users/stardiviner/Code/Emacs/org-mode/lisp/ox-texinfo.el... Compiling /Users/stardiviner/Code/Emacs/org-mode/lisp/ox.el... Done (Total of 125 files compiled, 2 skipped) install -m 755 -d /var/folders/ym/f3v5_yk1279g5ls70x3hzblh0000gn/T//tmp-orgtest TMPDIR=/var/folders/ym/f3v5_yk1279g5ls70x3hzblh0000gn/T//tmp-orgtest emacs -Q -batch --eval '(setq vc-handled-backends nil org-startup-folded nil)' --eval '(add-to-list '"'"'load-path (concat default-directory "lisp"))' --eval '(add-to-list '"'"'load-path (concat default-directory "testing"))' -l org-batch-test-init --eval '(setq org-batch-test t org-babel-load-languages (quote ( (awk . t) (C . t) (fortran . t) (maxima . t) (lilypond . t) (octave . t) (perl . t) (python . t) (vala . t) (emacs-lisp . t) (shell . t) (org . t))) org-test-select-re "\\(org\\|ob\\)" )' -l org-loaddefs.el -l cl -l testing/org-test.el -l ert -l org -l ox --eval '(org-test-run-batch-tests org-test-select-re)' Package cl is deprecated Error: file-missing ("Cannot open load file" "No such file or directory" "ob-vala") mapbacktrace(#f(compiled-function (evald func args flags) #<bytecode -0xc87083326512f81>)) debug-early-backtrace() debug-early(error (file-missing "Cannot open load file" "No such file or directory" "ob-vala")) require(ob-vala) org-babel-do-load-languages(org-babel-load-languages ((awk . t) (C . t) (fortran . t) (maxima . t) (lilypond . t) (octave . t) (perl . t) (python . t) (vala . t) (emacs-lisp . t) (shell . t) (org . t))) custom-initialize-reset(org-babel-load-languages (funcall #'#f(compiled-function () #<bytecode 0x1dc00016fe914>))) custom-declare-variable(org-babel-load-languages (funcall #'#f(compiled-function () #<bytecode 0x1dc00016fe914>)) "Languages which can be evaluated in Org buffers.\n\\<org-mode-map>\nThis list can be used to load support for any of the available\nlanguages with babel support (see info node `(org) Languages'). Each\nlanguage will depend on a different set of system executables and/or\nEmacs modes.\n\nWhen a language is \"loaded\", code blocks in that language can\nbe evaluated with `org-babel-execute-src-block', which is bound\nby default to \\[org-ctrl-c-ctrl-c].\n\nThe `org-babel-no-eval-on-ctrl-c-ctrl-c' option can be set to\nremove code block evaluation from \\[org-ctrl-c-ctrl-c]. By\ndefault, only Emacs Lisp is loaded, since it has no specific\nrequirement." :group org-babel :set org-babel-do-load-languages :version "24.1" :type (alist :tag "Babel Languages" :key-type (choice (const :tag "Awk" awk) (const :tag "C" C) (const :tag "R" R) (const :tag "Calc" calc) (const :tag "Clojure" clojure) (const :tag "CSS" css) (const :tag "Ditaa" ditaa) (const :tag "Dot" dot) (const :tag "Emacs Lisp" emacs-lisp) (const :tag "Forth" forth) (const :tag "Fortran" fortran) (const :tag "Gnuplot" gnuplot) (const :tag "Haskell" haskell) (const :tag "Java" java) (const :tag "Javascript" js) (const :tag "LaTeX" latex) (const :tag "Lilypond" lilypond) (const :tag "Lisp" lisp) (const :tag "Makefile" makefile) (const :tag "Maxima" maxima) (const :tag "Matlab" matlab) (const :tag "Ocaml" ocaml) (const :tag "Octave" octave) (const :tag "Org" org) (const :tag "Perl" perl) (const :tag "Pico Lisp" picolisp) (const :tag "PlantUML" plantuml) (const :tag "Python" python) (const :tag "Ruby" ruby) (const :tag "Sass" sass) (const :tag "Scala" scala) (const :tag "Scheme" scheme) (const :tag "Screen" screen) (const :tag "Shell Script" shell) (const :tag "Sql" sql) (const :tag "Sqlite" sqlite) (const :tag "Stan" stan)) :value-type (boolean :tag "Activate" :value t))) byte-code("\300\301\302\303\304DD\305\306\307\310\311\312\313\314\315&\13\210\300\316\302\303\317DD\320\314\321\312\313\306\322&\11\210\323\324\325\"\210\323\326\325\"\207" [custom-declare-variable org-babel-load-languages funcall function #f(compiled-function () #<bytecode 0x1dc00016fe914>) "Languages which can be evaluated in Org buffers.\n\\<org-mode-map>\nThis list can be used to load support for any of the available\nlanguages with babel support (see info node `(org) Languages'). Each\nlanguage will depend on a different set of system executables and/or\nEmacs modes.\n\nWhen a language is \"loaded\", code blocks in that language can\nbe evaluated with `org-babel-execute-src-block', which is bound\nby default to \\[org-ctrl-c-ctrl-c].\n\nThe `org-babel-no-eval-on-ctrl-c-ctrl-c' option can be set to\nremove code block evaluation from \\[org-ctrl-c-ctrl-c]. By\ndefault, only Emacs Lisp is loaded, since it has no specific\nrequirement." :group org-babel :set org-babel-do-load-languages :version "24.1" :type (alist :tag "Babel Languages" :key-type (choice (const :tag "Awk" awk) (const :tag "C" C) (const :tag "R" R) (const :tag "Calc" calc) (const :tag "Clojure" clojure) (const :tag "CSS" css) (const :tag "Ditaa" ditaa) (const :tag "Dot" dot) (const :tag "Emacs Lisp" emacs-lisp) (const :tag "Forth" forth) (const :tag "Fortran" fortran) (const :tag "Gnuplot" gnuplot) (const :tag "Haskell" haskell) (const :tag "Java" java) (const :tag "Javascript" js) (const :tag "LaTeX" latex) (const :tag "Lilypond" lilypond) (const :tag "Lisp" lisp) (const :tag "Makefile" makefile) (const :tag "Maxima" maxima) (const :tag "Matlab" matlab) (const :tag "Ocaml" ocaml) (const :tag "Octave" octave) (const :tag "Org" org) (const :tag "Perl" perl) (const :tag "Pico Lisp" picolisp) (const :tag "PlantUML" plantuml) (const :tag "Python" python) (const :tag "Ruby" ruby) (const :tag "Sass" sass) (const :tag "Scala" scala) (const :tag "Scheme" scheme) (const :tag "Screen" screen) (const :tag "Shell Script" shell) (const :tag "Sql" sql) (const :tag "Sqlite" sqlite) (const :tag "Stan" stan)) :value-type (boolean :tag "Activate" :value t)) org-clone-delete-id #f(compiled-function () #<bytecode 0x1dc00016fe914>) "Remove ID property of clones of a subtree.\nWhen non-nil, clones of a subtree don't inherit the ID property.\nOtherwise they inherit the ID property with a new unique\nidentifier." boolean org-id autoload org-release "org-version.el" org-git-version] 12) require(org) eval-buffer(#<buffer *load*> nil "/Users/stardiviner/Code/Emacs/org-mode/testing/org-test.el" nil t) load-with-code-conversion("/Users/stardiviner/Code/Emacs/org-mode/testing/org-test.el" "/Users/stardiviner/Code/Emacs/org-mode/testing/org-test.el" nil t) load("/Users/stardiviner/Code/Emacs/org-mode/testing/org-test.el" nil t) command-line-1(("--eval" "(setq vc-handled-backends nil org-startup-folded nil)" "--eval" "(add-to-list 'load-path (concat default-directory \"lisp\"))" "--eval" "(add-to-list 'load-path (concat default-directory \"testing\"))" "-l" "org-batch-test-init" "--eval" "(setq org-batch-test t org-babel-load-languages (quote ( (awk . t) (C . t) (fortran . t) (maxima . t) (lilypond . t) (octave . t) (perl . t) (python . t) (vala . t) (emacs-lisp . t) (shell . t) (org . t))) org-test-select-re \"\\\\(org\\\\|ob\\\\)\" )" "-l" "org-loaddefs.el" "-l" "cl" "-l" "testing/org-test.el" "-l" "ert" "-l" "org" "-l" "ox" "--eval" "(org-test-run-batch-tests org-test-select-re)")) command-line() normal-top-level() Cannot open load file: No such file or directory, ob-vala make: *** [test] Error 255 ~/Code/Emacs/org-mode:subtree-display-inline-images λ #+end_example ================================================================================================== So I use another method =[M-x ert-run-tests-interactively]=. The first test is passed, but the second test failed. I got bellowing error output. I don't know why it failed. Ihor, If you can fix this test, please tell me. Thanks #+begin_example Selector: test-org-fold/org-fold-display-inline-images Passed: 0 Failed: 1 (1 unexpected) Skipped: 0 Total: 1/1 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 -- [ stardiviner ] I try to make every word tell the meaning that I want to express without misunderstanding. Blog: https://stardiviner.github.io/ IRC(libera.chat, freenode): stardiviner, Matrix: stardiviner GPG: F09F650D7D674819892591401B5DF1C95AE89AC3 [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 487 bytes --] ^ permalink raw reply related [flat|nested] 43+ messages in thread
[parent not found: <63380f57.370a0220.a9d9a.dee8SMTPIN_ADDED_BROKEN@mx.google.com>]
* Re: [PATCH 2-v3] New: auto display inline images under subtree when `org-cycle'. [not found] ` <63380f57.370a0220.a9d9a.dee8SMTPIN_ADDED_BROKEN@mx.google.com> @ 2022-10-03 3:21 ` Ihor Radchenko 2022-10-03 4:37 ` [PATCH 2-v4] " Christopher M. Miles [not found] ` <633a67d8.050a0220.733e8.e57dSMTPIN_ADDED_BROKEN@mx.google.com> 0 siblings, 2 replies; 43+ messages in thread From: Ihor Radchenko @ 2022-10-03 3:21 UTC (permalink / raw) To: Christopher M. Miles; +Cc: emacs-orgmode "Christopher M. Miles" <numbchild@gmail.com> 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-display~. > + 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). > + > + ;; `org-cycle' -(state)-> `'folded' remove inline image overlays. > + ;; (org-test-with-temp-text > + ;; (format "<point>* 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 after folded? > I commented out the third test if someone can do this. I don't now how to test in fold state. You can, for example, check org-inline-image-overlays and (overlays-in (point-min) (point-max)) > > 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. > 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'. -- 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> ^ permalink raw reply [flat|nested] 43+ messages in thread
* Re: [PATCH 2-v4] New: auto display inline images under subtree when `org-cycle'. 2022-10-03 3:21 ` Ihor Radchenko @ 2022-10-03 4:37 ` Christopher M. Miles [not found] ` <633a67d8.050a0220.733e8.e57dSMTPIN_ADDED_BROKEN@mx.google.com> 1 sibling, 0 replies; 43+ messages in thread From: Christopher M. Miles @ 2022-10-03 4:37 UTC (permalink / raw) To: Ihor Radchenko; +Cc: Christopher M. Miles, emacs-orgmode [-- Attachment #1.1: Type: text/plain, Size: 71 bytes --] Finally finished and passed the test. Here I attached the new patch. [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #1.2: 0001-org.el-Support-auto-display-inline-images-when-cycli.patch --] [-- Type: text/x-patch, Size: 21705 bytes --] From c36122f818289cbd26026ae75ce480b03e03f61a Mon Sep 17 00:00:00 2001 From: stardiviner <numbchild@gmail.com> 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-images): Add test for inline image displaying when cycling. --- 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 --- 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]. + #+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)}}} :: #+cindex: global visibility states @@ -11332,6 +11339,11 @@ command: - When set to nil, try to get the width from an =#+ATTR.*= keyword and fall back on the original width if none is found. +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 --- 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 =ORG-IMAGE-ACTUAL-WIDTH= can override the global variable ~org-image-actual-width~ value for inline images display width. +*** New ~org-cycle-hook~ function ~org-cycle-display-inline-images~ for auto 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~ 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 --- a/lisp/org-cycle.el +++ b/lisp/org-cycle.el @@ -208,8 +208,9 @@ the values `folded', `children', or `subtree'." :type 'hook) (defcustom org-cycle-hook '(org-cycle-hide-archived-subtrees - org-cycle-show-empty-lines - org-cycle-optimize-window-after-visibility-change) + org-cycle-show-empty-lines + org-cycle-optimize-window-after-visibility-change + 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) +(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 docstring of "Subtree is archived and stays closed. Use \ `\\[org-cycle-force-archived]' to cycle it anyway.")))))) +(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 sub-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) ;;; org-cycle.el ends here diff --git a/lisp/org-keys.el b/lisp/org-keys.el index d65379a72..79e34cbd1 100644 --- 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" ()) -(declare-function org-toggle-inline-images "org" (&optional include-linked)) +(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 --- a/lisp/org.el +++ b/lisp/org.el @@ -16071,16 +16071,16 @@ SNIPPETS-P indicates if this is run to create snippet images for HTML." (defvar-local org-inline-image-overlays nil) -(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 - (org-remove-inline-images) + (org-remove-inline-images beg end) (when (called-interactively-p 'interactive) (message "Inline image display turned off"))) - (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 default to the buffer boundaries with possible narrowing." (interactive "P") (when (display-graphic-p) - (unless refresh - (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)))) -(defun org-remove-inline-images () +(defun org-remove-inline-images (&optional beg end) "Remove inline display of images." (interactive) - (mapc #'delete-overlay org-inline-image-overlays) - (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))))) (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..9ac57e6a205257fd2fd21944a025190aa2f2db49 GIT binary patch literal 7523 zcmV-p9h~BcP)<h;3K|Lk000e1NJLTq004gg004vt1^@s6x#;xC00006VoOIv0RI60 z0RN!9r;`8x010qNS#tmY3ljhU3ljkVnw%H_000McNliru-UA2#E(`i0Rb&7F9Pmj* zK~#9!?VWjaT=kXbKli;_RoZ1Owk*pVHjC|GjNP%p32}xH2%(42B+ewHGb90QPSV}U z%sF&2Jvr$~LiY^WSiGFj-AU-4^d#wS2nkDo1h82pFkXQeTaslhmMmFYsn+*?^T+R3 zk}OMhl`WNItL{04QK?k#_ulvZ?tbqNa+ISS<tRrv%2AGTl%pJ7m?XJJFtcdEf(1G7 zXDa9-f>O!?BnSQlOp6yU#&MjHpxYv{0PriN-m`O$=)$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`66<g0eztn z@qg<$&WpBf4_W$$4<8=)J9FTl2jbnbEL_)3y;TEz#)$YOKpXG_;Kx8uI-uut{&}#| zQ-C{;gNV!lHUhUBOI`tw0^b4ZQ-9~WE=^5MX<cL5?ff6DTVYnF^y*wFYc6D<BEns7 zygA|5`@rVSMvM+WiXB_GOeyGIua{&pnR=@dxE1&!@ILe2Vc<Tc)XzjDoc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;U=#Jv~XZf|S0xy;?T|(R5y*ZsfooVN`ZS35p zWAV1`;d>sPr1>^_gleXg4=_(ll^poz1C2_?97i8S^jY*-GntTIDd;+QFbDqm#sDLj zK%q;tZvp-<X`VC%ctyZ<RSx{~l?lYQu*C*Fn)D7M3Hs9bb2nxA<-k8r>BR>h#C3*_ zZwo8ey%+crI&FM9N@}r@+xh1=18m<uqz1&Y6sTXIPYFL=lipy;;m?78fv5pJ_{joz z2|ZH&&2c{72k`vXtvT>77zWt#5K6hJGZuCmJK)_hKHAL;BWoty<j!qdagvFYHh%;7 z>L{?2WN;o`4*c_sUipWIhmOkH^4yjufFF+dbp%~jo&*1awgG_6AKnZ)E12rk=tUQD z=D@$8RlwFQX514Uz(1I`Q>SO;z`x*cdN`8vwDJEN74)kd_!mCCI6Sqw6`cdvE8vJF zIq+u&sg#w!2c6DExo!^pnL&bb1>kk#{;_ig1$ba)MKe!@-%<cC0R2kMy!)TAJKsqp tQiFeup{K}Ej&hWv9OWoSIl2(({{sZ59n%b9$Nm5S002ovPDHLkV1oBJp5p)j literal 0 HcmV?d00001 diff --git a/testing/lisp/test-org-fold.el b/testing/lisp/test-org-fold.el index 0fa800dee..c1c9e835e 100644 --- a/testing/lisp/test-org-fold.el +++ b/testing/lisp/test-org-fold.el @@ -604,6 +604,58 @@ Unfolded Paragraph. (org-fold-check-before-invisible-edit kind) (should (org-invisible-p (1- (point)))))))))) +(ert-deftest test-org-fold/org-fold-display-inline-images () + "Test inline images displaying when cycling." + (let* ((org-cycle-inline-images-display t) + (images-dir (expand-file-name "examples/images/" org-test-dir)) + (org-logo-image (expand-file-name "Org mode logo mono-color.png" images-dir))) + ;; `org-cycle' -(state)-> `'children' display child inline images. + (org-test-with-temp-text + (format "<point>* 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)))) + + ;; `org-cycle' -(state)-> `'subtree' display subtrees inline images. + (org-test-with-temp-text + (format "<point>* 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)))) + + ;; `org-cycle' -(state)-> `'folded' remove inline image overlays. + (org-test-with-temp-text + (format "<point>* 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) ;;; test-org-fold.el ends here -- 2.37.2 [-- Attachment #1.3: Type: text/plain, Size: 2801 bytes --] Ihor Radchenko <yantar92@gmail.com> writes: > "Christopher M. Miles" <numbchild@gmail.com> 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-display~. >> + > > 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 >> + >> + ;; `org-cycle' -(state)-> `'folded' remove inline image overlays. >> + ;; (org-test-with-temp-text >> + ;; (format "<point>* 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 after folded? > >> I commented out the third test if someone can do this. I don't now how to 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. -- [ stardiviner ] I try to make every word tell the meaning that I want to express without misunderstanding. Blog: https://stardiviner.github.io/ IRC(libera.chat, freenode): stardiviner, Matrix: stardiviner GPG: F09F650D7D674819892591401B5DF1C95AE89AC3 [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 487 bytes --] ^ permalink raw reply related [flat|nested] 43+ messages in thread
[parent not found: <633a67d8.050a0220.733e8.e57dSMTPIN_ADDED_BROKEN@mx.google.com>]
* Re: [PATCH 2-v4] New: auto display inline images under subtree when `org-cycle'. [not found] ` <633a67d8.050a0220.733e8.e57dSMTPIN_ADDED_BROKEN@mx.google.com> @ 2022-10-04 4:36 ` Ihor Radchenko 2022-10-04 7:27 ` Christopher M. Miles [not found] ` <633be6d3.370a0220.4060.bacdSMTPIN_ADDED_BROKEN@mx.google.com> 0 siblings, 2 replies; 43+ messages in thread From: Ihor Radchenko @ 2022-10-04 4:36 UTC (permalink / raw) To: Christopher M. Miles; +Cc: emacs-orgmode [-- Attachment #1: Type: text/plain, Size: 1067 bytes --] "Christopher M. Miles" <numbchild@gmail.com> writes: > I think the patch is finished. Please review, Ihor. Thanks for helping. Thanks for the update! I have cleaned the manual and ORG-NEWS wordings. Upon reading the exported version of the manual, I realized that the part in 2.2.1 Global and local cycling section sounds very awkward and that we do not mention other cycle hooks like hiding archived subtrees there. So, I decided to remove it. I also rewrote the other part in a bit more direct tone and moved the index entry. (In general, it is useful to try reading the exported version of the manual with the additions to check if things are still coherent - manual is not just a collection of independent statements; we need to make sure that it is not confusing the new readers). I also updated the commit message adding the CHANGELOG entries about the manual and ORG-NEWS. However, upon testing your patch, tests are still failing on my side. Can you please investigate? I am attaching the updated version of the patch with my amendments. Best, Ihor [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #2: 0001-org.el-Support-auto-display-inline-images-when-cycli.patch --] [-- Type: text/x-patch, Size: 20865 bytes --] From ab303eb5c007822d045f5e6ba3f00779c0abf1bc Mon Sep 17 00:00:00 2001 Message-Id: <ab303eb5c007822d045f5e6ba3f00779c0abf1bc.1664857900.git.yantar92@gmail.com> From: stardiviner <numbchild@gmail.com> 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-images): Add test for inline image displaying when cycling. * doc/org-manual.org (Exporting): * etc/ORG-NEWS: Document the new option. --- doc/org-manual.org | 6 ++ etc/ORG-NEWS | 7 +++ 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, 115 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 a5fec8cf9..ec838df97 100644 --- a/doc/org-manual.org +++ b/doc/org-manual.org @@ -11470,6 +11470,12 @@ ** Images - When set to nil, try to get the width from an =#+ATTR.*= keyword and fall back on the original width if none is found. + +#+vindex: org-cycle-inline-images-display +Inline images can also be displayed when cycling the folding state. +When custom option ~org-cycle-inline-images-display~ is set, the +visible inline images under subtree will be displayed automatically. + ** Captions :PROPERTIES: :DESCRIPTION: Describe tables, images... diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS index 4728528f8..75a77378a 100644 --- a/etc/ORG-NEWS +++ b/etc/ORG-NEWS @@ -307,6 +307,13 @@ to pass the contents of a named code block as a string argument. The new property =ORG-IMAGE-ACTUAL-WIDTH= can override the global variable ~org-image-actual-width~ value for inline images display width. +*** Outline cycling can now include inline image visibility + +New ~org-cycle-hook~ function ~org-cycle-display-inline-images~ for +auto-displaying inline images in the visible parts of the subtree. +This behavior is controlled by new custom option +~org-cycle-inline-images-display~. + *** New ~org-babel-tangle-finished-hook~ hook run at the very end of ~org-babel-tangle~ 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 --- a/lisp/org-cycle.el +++ b/lisp/org-cycle.el @@ -208,8 +208,9 @@ (defcustom org-cycle-pre-hook nil :type 'hook) (defcustom org-cycle-hook '(org-cycle-hide-archived-subtrees - org-cycle-show-empty-lines - org-cycle-optimize-window-after-visibility-change) + org-cycle-show-empty-lines + org-cycle-optimize-window-after-visibility-change + 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 @@ (defcustom org-cycle-open-archived-trees nil :group 'org-cycle :type 'boolean) +(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 @@ (defun org-cycle-hide-archived-subtrees (state) "Subtree is archived and stays closed. Use \ `\\[org-cycle-force-archived]' to cycle it anyway.")))))) +(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 sub-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) ;;; org-cycle.el ends here diff --git a/lisp/org-keys.el b/lisp/org-keys.el index d65379a72..79e34cbd1 100644 --- a/lisp/org-keys.el +++ b/lisp/org-keys.el @@ -204,7 +204,7 @@ (declare-function org-toggle-checkbox "org" (&optional toggle-presence)) (declare-function org-toggle-radio-button "org" (&optional arg)) (declare-function org-toggle-comment "org" ()) (declare-function org-toggle-fixed-width "org" ()) -(declare-function org-toggle-inline-images "org" (&optional include-linked)) +(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 d438e76b1..26c6f50d8 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -16075,16 +16075,16 @@ (defun org-normalize-color (value) (defvar-local org-inline-image-overlays nil) -(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 - (org-remove-inline-images) + (org-remove-inline-images beg end) (when (called-interactively-p 'interactive) (message "Inline image display turned off"))) - (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" @@ -16174,8 +16174,8 @@ (defun org-display-inline-images (&optional include-linked refresh beg end) buffer boundaries with possible narrowing." (interactive "P") (when (display-graphic-p) - (unless refresh - (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)) @@ -16326,11 +16326,16 @@ (defun org-display-inline-remove-overlay (ov after _beg _end &optional _len) (delete ov org-inline-image-overlays) (delete-overlay ov)))) -(defun org-remove-inline-images () +(defun org-remove-inline-images (&optional beg end) "Remove inline display of images." (interactive) - (mapc #'delete-overlay org-inline-image-overlays) - (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))))) (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..9ac57e6a205257fd2fd21944a025190aa2f2db49 GIT binary patch literal 7523 zcmV-p9h~BcP)<h;3K|Lk000e1NJLTq004gg004vt1^@s6x#;xC00006VoOIv0RI60 z0RN!9r;`8x010qNS#tmY3ljhU3ljkVnw%H_000McNliru-UA2#E(`i0Rb&7F9Pm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Uz(1I`Q>SO;z`x*cdN`8vwDJEN74)kd_!mCCI6Sqw6`cdvE8vJF zIq+u&sg#w!2c6DExo!^pnL&bb1>kk#{;_ig1$ba)MKe!@-%<cC0R2kMy!)TAJKsqp tQiFeup{K}Ej&hWv9OWoSIl2(({{sZ59n%b9$Nm5S002ovPDHLkV1oBJp5p)j literal 0 HcmV?d00001 diff --git a/testing/lisp/test-org-fold.el b/testing/lisp/test-org-fold.el index 0fa800dee..c1c9e835e 100644 --- a/testing/lisp/test-org-fold.el +++ b/testing/lisp/test-org-fold.el @@ -604,6 +604,58 @@ (ert-deftest test-org-fold/org-catch-invisible-edits () (org-fold-check-before-invisible-edit kind) (should (org-invisible-p (1- (point)))))))))) +(ert-deftest test-org-fold/org-fold-display-inline-images () + "Test inline images displaying when cycling." + (let* ((org-cycle-inline-images-display t) + (images-dir (expand-file-name "examples/images/" org-test-dir)) + (org-logo-image (expand-file-name "Org mode logo mono-color.png" images-dir))) + ;; `org-cycle' -(state)-> `'children' display child inline images. + (org-test-with-temp-text + (format "<point>* 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)))) + + ;; `org-cycle' -(state)-> `'subtree' display subtrees inline images. + (org-test-with-temp-text + (format "<point>* 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)))) + + ;; `org-cycle' -(state)-> `'folded' remove inline image overlays. + (org-test-with-temp-text + (format "<point>* 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) ;;; test-org-fold.el ends here -- 2.35.1 [-- Attachment #3: Type: text/plain, Size: 225 bytes --] -- 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> ^ permalink raw reply related [flat|nested] 43+ messages in thread
* Re: [PATCH 2-v4] New: auto display inline images under subtree when `org-cycle'. 2022-10-04 4:36 ` Ihor Radchenko @ 2022-10-04 7:27 ` Christopher M. Miles [not found] ` <633be6d3.370a0220.4060.bacdSMTPIN_ADDED_BROKEN@mx.google.com> 1 sibling, 0 replies; 43+ messages in thread From: Christopher M. Miles @ 2022-10-04 7:27 UTC (permalink / raw) To: Ihor Radchenko; +Cc: Christopher M. Miles, emacs-orgmode [-- Attachment #1: Type: text/plain, Size: 4428 bytes --] Ihor Radchenko <yantar92@gmail.com> writes: > "Christopher M. Miles" <numbchild@gmail.com> writes: > >> I think the patch is finished. Please review, Ihor. Thanks for helping. > > Thanks for the update! > I have cleaned the manual and ORG-NEWS wordings. > > Upon reading the exported version of the manual, I realized that the > part in 2.2.1 Global and local cycling section sounds very awkward and > that we do not mention other cycle hooks like hiding archived > subtrees there. So, I decided to remove it. > > I also rewrote the other part in a bit more direct tone and moved the > index entry. > > (In general, it is useful to try reading the exported version of the > manual with the additions to check if things are still coherent - manual > is not just a collection of independent statements; we need to make sure > that it is not confusing the new readers). > > I also updated the commit message adding the CHANGELOG entries about the > manual and ORG-NEWS. > It's OK. > I am attaching the updated version of the patch with my amendments. Applied your updated patch. > However, upon testing your patch, tests are still failing on my side. > Can you please investigate? But If I use [M-x ert] to run the test "test-org-fold/org-fold-display-inline-images" is passed. Here is the steps: 1. [M-x load-file RET /path/to/org-mode/testing/org-test.el RET] 2. [C-M-x] to evaluate the target test 3. [M-x ert RET test-org-fold/org-fold-display-inline-images RET] to run this test I attached the uploaded screencast video link to prove it passed. https://share.cleanshot.com/tvUUoQ I tried many different other API functions to cycle or fold/unfold, but none of them works under command "make test" or command "make BTEST_RE="test-org-fold/org-fold-display-inline-images" test-dirty". I have nothing brain to think for this test now. Really can't figure out why this image is not displayed as overlay. Can you help me to fix this test? #+begin_src emacs-lisp (ert-deftest test-org-fold/org-fold-display-inline-images () "Test inline images displaying when cycling." (let* ((org-cycle-inline-images-display t) (images-dir (expand-file-name "examples/images/" org-test-dir)) (org-logo-image (expand-file-name "Org mode logo mono-color.png" images-dir))) ;; `org-cycle' -(state)-> `'children' display child inline images. (org-test-with-temp-text (format "<point>* Heading 1 [[file:%s]] " org-logo-image) (org-overview) (org-cycle) ;; (org-cycle-internal-local) ;; (run-hook-with-args 'org-cycle-hook 'children) ;; (org-cycle-display-inline-images 'children) (org-next-link) ;; (should org-inline-image-overlays) (should (overlays-at (point))) (org-toggle-inline-images) (should-not (overlays-at (point)))) ;; `org-cycle' -(state)-> `'subtree' display subtrees inline images. (org-test-with-temp-text (format "<point>* 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-internal-global) ;; (run-hook-with-args 'org-cycle-hook 'subtree) (org-next-link) (org-next-link) ;; (should org-inline-image-overlays) (should (overlays-at (point))) (org-toggle-inline-images) (should-not (overlays-at (point)))) ;; `org-cycle' -(state)-> `'folded' remove inline image overlays. (org-test-with-temp-text (format "<point>* 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)))))) #+end_src -- [ stardiviner ] I try to make every word tell the meaning that I want to express without misunderstanding. Blog: https://stardiviner.github.io/ IRC(libera.chat, freenode): stardiviner, Matrix: stardiviner GPG: F09F650D7D674819892591401B5DF1C95AE89AC3 [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 487 bytes --] ^ permalink raw reply [flat|nested] 43+ messages in thread
[parent not found: <633be6d3.370a0220.4060.bacdSMTPIN_ADDED_BROKEN@mx.google.com>]
* Re: [PATCH 2-v4] New: auto display inline images under subtree when `org-cycle'. [not found] ` <633be6d3.370a0220.4060.bacdSMTPIN_ADDED_BROKEN@mx.google.com> @ 2022-10-08 7:53 ` Ihor Radchenko 2022-10-08 9:50 ` Christopher M. Miles [not found] ` <634149f4.c80a0220.1376.e564SMTPIN_ADDED_BROKEN@mx.google.com> 0 siblings, 2 replies; 43+ messages in thread From: Ihor Radchenko @ 2022-10-08 7:53 UTC (permalink / raw) To: Christopher M. Miles; +Cc: emacs-orgmode "Christopher M. Miles" <numbchild@gmail.com> writes: >> However, upon testing your patch, tests are still failing on my side. >> Can you please investigate? > > But If I use [M-x ert] to run the test "test-org-fold/org-fold-display-inline-images" is passed. > Here is the steps: > 1. [M-x load-file RET /path/to/org-mode/testing/org-test.el RET] > 2. [C-M-x] to evaluate the target test > 3. [M-x ert RET test-org-fold/org-fold-display-inline-images RET] to run this test > > I attached the uploaded screencast video link to prove it passed. > > https://share.cleanshot.com/tvUUoQ > > I tried many different other API functions to cycle or fold/unfold, but none > of them works under command "make test" or command > "make BTEST_RE="test-org-fold/org-fold-display-inline-images" test-dirty". > > I have nothing brain to think for this test now. Really can't figure out > why this image is not displayed as overlay. Can you help me to fix this test? The problem is with batch mode. `create-image' will return nil in batch mode and hence no overlays are ever created even though `org-display-inline-images' does get called. I think that the best we can do in this situation is mocking `create-image' in batch mode to return non-nil using `cl-letf'. -- 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> ^ permalink raw reply [flat|nested] 43+ messages in thread
* Re: [PATCH 2-v4] New: auto display inline images under subtree when `org-cycle'. 2022-10-08 7:53 ` Ihor Radchenko @ 2022-10-08 9:50 ` Christopher M. Miles [not found] ` <634149f4.c80a0220.1376.e564SMTPIN_ADDED_BROKEN@mx.google.com> 1 sibling, 0 replies; 43+ messages in thread From: Christopher M. Miles @ 2022-10-08 9:50 UTC (permalink / raw) To: Ihor Radchenko; +Cc: Christopher M. Miles, emacs-orgmode [-- Attachment #1: Type: text/plain, Size: 2005 bytes --] Ihor Radchenko <yantar92@gmail.com> writes: > "Christopher M. Miles" <numbchild@gmail.com> writes: > >>> However, upon testing your patch, tests are still failing on my side. >>> Can you please investigate? >> >> But If I use [M-x ert] to run the test "test-org-fold/org-fold-display-inline-images" is passed. >> Here is the steps: >> 1. [M-x load-file RET /path/to/org-mode/testing/org-test.el RET] >> 2. [C-M-x] to evaluate the target test >> 3. [M-x ert RET test-org-fold/org-fold-display-inline-images RET] to run this test >> >> I attached the uploaded screencast video link to prove it passed. >> >> https://share.cleanshot.com/tvUUoQ >> >> I tried many different other API functions to cycle or fold/unfold, but none >> of them works under command "make test" or command >> "make BTEST_RE="test-org-fold/org-fold-display-inline-images" test-dirty". >> >> I have nothing brain to think for this test now. Really can't figure out >> why this image is not displayed as overlay. Can you help me to fix this test? > > The problem is with batch mode. `create-image' will return nil in batch > mode and hence no overlays are ever created even though > `org-display-inline-images' does get called. I see, no wonder that failed for command "make test" but success in "[M-x ert]". > I think that the best we can do in this situation is mocking > `create-image' in batch mode to return non-nil using `cl-letf'. I checked the `create-image' in image.el source code, don't know how to mocking this. I have no experience and idea about this. I also searched org testing. Have not found similar situations. If you have idea how to write this test, I suggest pass this word to you. What do you think? -- [ stardiviner ] I try to make every word tell the meaning that I want to express without misunderstanding. Blog: https://stardiviner.github.io/ IRC(libera.chat, freenode): stardiviner, Matrix: stardiviner GPG: F09F650D7D674819892591401B5DF1C95AE89AC3 [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 487 bytes --] ^ permalink raw reply [flat|nested] 43+ messages in thread
[parent not found: <634149f4.c80a0220.1376.e564SMTPIN_ADDED_BROKEN@mx.google.com>]
* Re: [PATCH 2-v4] New: auto display inline images under subtree when `org-cycle'. [not found] ` <634149f4.c80a0220.1376.e564SMTPIN_ADDED_BROKEN@mx.google.com> @ 2022-10-09 7:21 ` Ihor Radchenko 2022-10-10 8:40 ` Christopher M. Miles [not found] ` <m2v8os5aqy.fsf@numbchild> 0 siblings, 2 replies; 43+ messages in thread From: Ihor Radchenko @ 2022-10-09 7:21 UTC (permalink / raw) To: Christopher M. Miles; +Cc: emacs-orgmode "Christopher M. Miles" <numbchild@gmail.com> writes: >> I think that the best we can do in this situation is mocking >> `create-image' in batch mode to return non-nil using `cl-letf'. > > I checked the `create-image' in image.el source code, don't know how to > mocking this. I have no experience and idea about this. I also searched > org testing. Have not found similar situations. > > If you have idea how to write this test, I suggest pass this word to > you. What do you think? I imagine something like ;; Mock `create-image' to work noninteractively. (cl-letf (((symbol-function 'create-image) (lambda (&rest _) `(image :type "dummy" :data "dummy")))) <your test code here>) -- 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> ^ permalink raw reply [flat|nested] 43+ messages in thread
* Re: [PATCH 2-v4] New: auto display inline images under subtree when `org-cycle'. 2022-10-09 7:21 ` Ihor Radchenko @ 2022-10-10 8:40 ` Christopher M. Miles [not found] ` <m2v8os5aqy.fsf@numbchild> 1 sibling, 0 replies; 43+ messages in thread From: Christopher M. Miles @ 2022-10-10 8:40 UTC (permalink / raw) To: Ihor Radchenko; +Cc: Christopher M. Miles, emacs-orgmode [-- Attachment #1: Type: text/plain, Size: 14959 bytes --] Ihor Radchenko <yantar92@gmail.com> writes: > "Christopher M. Miles" <numbchild@gmail.com> writes: > >>> I think that the best we can do in this situation is mocking >>> `create-image' in batch mode to return non-nil using `cl-letf'. >> >> I checked the `create-image' in image.el source code, don't know how to >> mocking this. I have no experience and idea about this. I also searched >> org testing. Have not found similar situations. >> >> If you have idea how to write this test, I suggest pass this word to >> you. What do you think? > > I imagine something like > > ;; Mock `create-image' to work noninteractively. > (cl-letf (((symbol-function 'create-image) > (lambda (&rest _) > `(image :type "dummy" :data "dummy")))) > <your test code here>) After wrapped your cl-letf redefining function binding. Still failed on test. Here is the new test code: #+begin_src emacs-lisp (ert-deftest test-org-fold/org-fold-display-inline-images () "Test inline images displaying when cycling." ;; Mock `create-image' to work noninteractively. (cl-letf (((symbol-function 'create-image) (lambda (&rest _) `(image :type "dummy" :data "dummy")))) (let* ((org-cycle-inline-images-display t) (images-dir (expand-file-name "examples/images/" org-test-dir)) (org-logo-image (expand-file-name "Org mode logo mono-color.png" images-dir))) ;; `org-cycle' -(state)-> `'children' display child inline images. (org-test-with-temp-text (format "<point>* Heading 1 [[file:%s]] " org-logo-image) (org-overview) ;; (org-cycle) ;; (org-cycle-internal-local) ;; (org-cycle-display-inline-images 'children) (org-fold-show-children) (run-hook-with-args 'org-cycle-hook 'children) (org-next-link) (should org-inline-image-overlays) (should (overlays-at (point))) (org-toggle-inline-images) (should-not (overlays-at (point)))) ;; `org-cycle' -(state)-> `'subtree' display subtrees inline images. (org-test-with-temp-text (format "<point>* 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-internal-global) (org-fold-show-subtree) (run-hook-with-args 'org-cycle-hook 'subtree) (org-next-link) (org-next-link) ;; (should org-inline-image-overlays) (should (overlays-at (point))) (org-toggle-inline-images) (should-not (overlays-at (point)))) ;; `org-cycle' -(state)-> `'folded' remove inline image overlays. (org-test-with-temp-text (format "<point>* 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))))))) #+end_src And failed after command: #+begin_src shell make BTEST_RE="test-org-fold/org-fold-display-inline-images" test-dirty #+end_src Here is the output: #+begin_example ~/Code/Emacs/org-mode:main*:1 λ make BTEST_RE="test-org-fold/org-fold-display-inline-images" test-dirty install -m 755 -d /var/folders/ym/f3v5_yk1279g5ls70x3hzblh0000gn/T//tmp-orgtest TMPDIR=/var/folders/ym/f3v5_yk1279g5ls70x3hzblh0000gn/T//tmp-orgtest emacs -Q -batch --eval '(setq vc-handled-backends nil org-startup-folded nil org-element-cache-persistent nil)' --eval '(add-to-list '"'"'load-path (concat default-directory "lisp"))' --eval '(add-to-list '"'"'load-path (concat default-directory "testing"))' -l org-batch-test-init --eval '(setq org-batch-test t org-babel-load-languages (quote ( (awk . t) (C . t) (fortran . t) (maxima . t) (lilypond . t) (octave . t) (perl . t) (python . t) (emacs-lisp . t) (shell . t) (org . t))) org-test-select-re "test-org-fold/org-fold-display-inline-images" )' -l org-loaddefs.el -l cl -l testing/org-test.el -l ert -l org -l ox -l ol --eval '(org-test-run-batch-tests org-test-select-re)' Package cl is deprecated Source file `/Users/stardiviner/Code/Emacs/org-mode/lisp/org.el' newer than byte-compiled file; using older file Source file `/Users/stardiviner/Code/Emacs/org-mode/lisp/org-compat.el' newer than byte-compiled file; using older file Source file `/Users/stardiviner/Code/Emacs/org-mode/lisp/org-macs.el' newer than byte-compiled file; using older file Source file `/Users/stardiviner/Code/Emacs/org-mode/lisp/org-keys.el' newer than byte-compiled file; using older file Source file `/Users/stardiviner/Code/Emacs/org-mode/lisp/oc.el' newer than byte-compiled file; using older file Source file `/Users/stardiviner/Code/Emacs/org-mode/lisp/ol.el' newer than byte-compiled file; using older file Source file `/Users/stardiviner/Code/Emacs/org-mode/lisp/org-table.el' newer than byte-compiled file; using older file Source file `/Users/stardiviner/Code/Emacs/org-mode/lisp/org-cycle.el' newer than byte-compiled file; using older file Source file `/Users/stardiviner/Code/Emacs/org-mode/lisp/ob-awk.el' newer than byte-compiled file; using older file Source file `/Users/stardiviner/Code/Emacs/org-mode/lisp/ob-core.el' newer than byte-compiled file; using older file Source file `/Users/stardiviner/Code/Emacs/org-mode/lisp/ob-comint.el' newer than byte-compiled file; using older file Source file `/Users/stardiviner/Code/Emacs/org-mode/lisp/ob-exp.el' newer than byte-compiled file; using older file Source file `/Users/stardiviner/Code/Emacs/org-mode/lisp/ob-ref.el' newer than byte-compiled file; using older file Source file `/Users/stardiviner/Code/Emacs/org-mode/lisp/org-src.el' newer than byte-compiled file; using older file Source file `/Users/stardiviner/Code/Emacs/org-mode/lisp/ob-maxima.el' newer than byte-compiled file; using older file Source file `/Users/stardiviner/Code/Emacs/org-mode/lisp/ob-lilypond.el' newer than byte-compiled file; using older file Source file `/Users/stardiviner/Code/Emacs/org-mode/lisp/ob-octave.el' newer than byte-compiled file; using older file Source file `/Users/stardiviner/Code/Emacs/org-mode/lisp/ob-emacs-lisp.el' newer than byte-compiled file; using older file Source file `/Users/stardiviner/Code/Emacs/org-mode/lisp/org-list.el' newer than byte-compiled file; using older file Source file `/Users/stardiviner/Code/Emacs/org-mode/lisp/org-pcomplete.el' newer than byte-compiled file; using older file Source file `/Users/stardiviner/Code/Emacs/org-mode/lisp/org-macro.el' newer than byte-compiled file; using older file Source file `/Users/stardiviner/Code/Emacs/org-mode/lisp/org-id.el' newer than byte-compiled file; using older file Source file `/Users/stardiviner/Code/Emacs/org-mode/lisp/org-refile.el' newer than byte-compiled file; using older file Source file `/Users/stardiviner/Code/Emacs/org-mode/lisp/org.el' newer than byte-compiled file; using older file Source file `/Users/stardiviner/Code/Emacs/org-mode/lisp/ol-doi.el' newer than byte-compiled file; using older file Source file `/Users/stardiviner/Code/Emacs/org-mode/lisp/ol-irc.el' newer than byte-compiled file; using older file Source file `/Users/stardiviner/Code/Emacs/org-mode/lisp/org-element.el' newer than byte-compiled file; using older file Source file `/Users/stardiviner/Code/Emacs/org-mode/lisp/ox.el' newer than byte-compiled file; using older file Source file `/Users/stardiviner/Code/Emacs/org-mode/lisp/ox-html.el' newer than byte-compiled file; using older file Source file `/Users/stardiviner/Code/Emacs/org-mode/lisp/ox-icalendar.el' newer than byte-compiled file; using older file Source file `/Users/stardiviner/Code/Emacs/org-mode/lisp/org-agenda.el' newer than byte-compiled file; using older file Source file `/Users/stardiviner/Code/Emacs/org-mode/lisp/ol.el' newer than byte-compiled file; using older file Finding ID locations (1/26 files): /Users/stardiviner/Code/Emacs/org-mode/testing/examples/setupfile3.org Finding ID locations (2/26 files): /Users/stardiviner/Code/Emacs/org-mode/testing/examples/setupfile.org Finding ID locations (3/26 files): /Users/stardiviner/Code/Emacs/org-mode/testing/examples/property-inheritance.org Finding ID locations (4/26 files): /Users/stardiviner/Code/Emacs/org-mode/testing/examples/org-exp.org Finding ID locations (5/26 files): /Users/stardiviner/Code/Emacs/org-mode/testing/examples/ob-shell-test.org Finding ID locations (6/26 files): /Users/stardiviner/Code/Emacs/org-mode/testing/examples/ob-sed-test.org Finding ID locations (7/26 files): /Users/stardiviner/Code/Emacs/org-mode/testing/examples/ob-screen-test.org Finding ID locations (8/26 files): /Users/stardiviner/Code/Emacs/org-mode/testing/examples/ob-octave-test.org Finding ID locations (9/26 files): /Users/stardiviner/Code/Emacs/org-mode/testing/examples/ob-maxima-test.org Finding ID locations (10/26 files): /Users/stardiviner/Code/Emacs/org-mode/testing/examples/ob-lilypond-test.org Finding ID locations (11/26 files): /Users/stardiviner/Code/Emacs/org-mode/testing/examples/ob-lilypond-broken.org Finding ID locations (12/26 files): /Users/stardiviner/Code/Emacs/org-mode/testing/examples/ob-header-arg-defaults.org Finding ID locations (13/26 files): /Users/stardiviner/Code/Emacs/org-mode/testing/examples/ob-fortran-test.org Finding ID locations (14/26 files): /Users/stardiviner/Code/Emacs/org-mode/testing/examples/ob-awk-test.org Finding ID locations (15/26 files): /Users/stardiviner/Code/Emacs/org-mode/testing/examples/ob-C-test.org Finding ID locations (16/26 files): /Users/stardiviner/Code/Emacs/org-mode/testing/examples/normal.org Finding ID locations (17/26 files): /Users/stardiviner/Code/Emacs/org-mode/testing/examples/no-heading.org Finding ID locations (18/26 files): /Users/stardiviner/Code/Emacs/org-mode/testing/examples/macro-templates.org Finding ID locations (19/26 files): /Users/stardiviner/Code/Emacs/org-mode/testing/examples/links.org Finding ID locations (20/26 files): /Users/stardiviner/Code/Emacs/org-mode/testing/examples/link-in-heading.org Finding ID locations (21/26 files): /Users/stardiviner/Code/Emacs/org-mode/testing/examples/include2.org Finding ID locations (22/26 files): /Users/stardiviner/Code/Emacs/org-mode/testing/examples/include.org Finding ID locations (23/26 files): /Users/stardiviner/Code/Emacs/org-mode/testing/examples/babel.org Finding ID locations (24/26 files): /Users/stardiviner/Code/Emacs/org-mode/testing/examples/babel-dangerous.org Finding ID locations (25/26 files): /Users/stardiviner/Code/Emacs/org-mode/testing/examples/attachments.org Finding ID locations (26/26 files): /Users/stardiviner/Code/Emacs/org-mode/testing/examples/agenda-file.org 26 files scanned, 14 files contains IDs, and 58 IDs found. 0 source block added to Library of Babel Source file `/Users/stardiviner/Code/Emacs/org-mode/lisp/ob-sed.el' newer than byte-compiled file; using older file Source file `/Users/stardiviner/Code/Emacs/org-mode/lisp/org-inlinetask.el' newer than byte-compiled file; using older file Source file `/Users/stardiviner/Code/Emacs/org-mode/lisp/org-capture.el' newer than byte-compiled file; using older file Source file `/Users/stardiviner/Code/Emacs/org-mode/lisp/org-clock.el' newer than byte-compiled file; using older file Source file `/Users/stardiviner/Code/Emacs/org-mode/lisp/org-feed.el' newer than byte-compiled file; using older file Local variables list is not properly terminated Source file `/Users/stardiviner/Code/Emacs/org-mode/lisp/org-lint.el' newer than byte-compiled file; using older file selected tests: test-org-fold/org-fold-display-inline-images Running 1 tests (2022-10-10 16:31:04+0800, selector `"test-org-fold/org-fold-display-inline-images"') Test test-org-fold/org-fold-display-inline-images backtrace: signal(ert-test-failed (((should org-inline-image-overlays) :form or ert-fail(((should org-inline-image-overlays) :form org-inline-image- (if (unwind-protect (setq value-12536 org-inline-image-overlays) (se (let (form-description-12537) (if (unwind-protect (setq value-12536 (let ((value-12536 (gensym "ert-form-evaluation-aborted-"))) (let (f (progn (org-mode) (let ((point (string-match "<point>" inside-text)) (unwind-protect (progn (org-mode) (let ((point (string-match "<point (save-current-buffer (set-buffer temp-buffer) (unwind-protect (progn (let ((temp-buffer (generate-new-buffer " *temp*" t))) (save-current (let ((inside-text (if (stringp (format "<point>* Heading 1\n[[file: (let* ((org-cycle-inline-images-display t) (images-dir (expand-file- (progn (fset 'create-image vnew) (let* ((org-cycle-inline-images-dis (unwind-protect (progn (fset 'create-image vnew) (let* ((org-cycle-i (let* ((vnew #'(lambda (&rest _) '(image :type "dummy" :data "dummy" (closure (t) nil (let* ((vnew #'(lambda (&rest _) '(image :type "dum ert--run-test-internal(#s(ert--test-execution-info :test ... :result ert-run-test(#s(ert-test :name test-org-fold/org-fold-display-inline ert-run-or-rerun-test(#s(ert--stats :selector "test-org-fold/..." :t ert-run-tests("test-org-fold/org-fold-display-inline-images" #f(comp ert-run-tests-batch("test-org-fold/org-fold-display-inline-images") ert-run-tests-batch-and-exit("test-org-fold/org-fold-display-inline- (let ((org-id-track-globally t) (org-test-selector (if org-test-sele org-test-run-batch-tests("test-org-fold/org-fold-display-inline-imag eval((org-test-run-batch-tests org-test-select-re) t) command-line-1(("--eval" "(setq vc-handled-backends nil org-startup- command-line() normal-top-level() Test test-org-fold/org-fold-display-inline-images condition: (ert-test-failed ((should org-inline-image-overlays) :form org-inline-image-overlays :value nil)) FAILED 1/1 test-org-fold/org-fold-display-inline-images (0.001214 sec) at ../lisp/test-org-fold.el:607 Ran 1 tests, 0 results as expected, 1 unexpected (2022-10-10 16:31:04+0800, 0.166044 sec) 1 unexpected results: FAILED test-org-fold/org-fold-display-inline-images ((should org-inline-image-overlays) :form org-inline-image-overlays :value nil) make: *** [test-dirty] Error 1 ~/Code/Emacs/org-mode:main*:1 λ #+end_example -- [ stardiviner ] I try to make every word tell the meaning that I want to express without misunderstanding. Blog: https://stardiviner.github.io/ IRC(libera.chat, freenode): stardiviner, Matrix: stardiviner GPG: F09F650D7D674819892591401B5DF1C95AE89AC3 [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 487 bytes --] ^ permalink raw reply [flat|nested] 43+ messages in thread
[parent not found: <m2v8os5aqy.fsf@numbchild>]
* Re: [PATCH 2-v4] New: auto display inline images under subtree when `org-cycle'. [not found] ` <m2v8os5aqy.fsf@numbchild> @ 2022-10-22 1:29 ` Christopher M. Miles 2022-10-23 4:33 ` Ihor Radchenko 0 siblings, 1 reply; 43+ messages in thread From: Christopher M. Miles @ 2022-10-22 1:29 UTC (permalink / raw) To: Ihor Radchenko; +Cc: Christopher M. Miles, emacs-orgmode [-- Attachment #1: Type: text/plain, Size: 15614 bytes --] Whether can this patch be merged at first, put the test in future to finish? In recent days, I still have not figured out this image overlays test. "Christopher M. Miles" <numbchild@gmail.com> writes: > [[PGP Signed Part:Undecided]] > > Ihor Radchenko <yantar92@gmail.com> writes: > >> "Christopher M. Miles" <numbchild@gmail.com> writes: >> >>>> I think that the best we can do in this situation is mocking >>>> `create-image' in batch mode to return non-nil using `cl-letf'. >>> >>> I checked the `create-image' in image.el source code, don't know how to >>> mocking this. I have no experience and idea about this. I also searched >>> org testing. Have not found similar situations. >>> >>> If you have idea how to write this test, I suggest pass this word to >>> you. What do you think? >> >> I imagine something like >> >> ;; Mock `create-image' to work noninteractively. >> (cl-letf (((symbol-function 'create-image) >> (lambda (&rest _) >> `(image :type "dummy" :data "dummy")))) >> <your test code here>) > > After wrapped your cl-letf redefining function binding. Still failed on test. > > Here is the new test code: > > #+begin_src emacs-lisp > (ert-deftest test-org-fold/org-fold-display-inline-images () > "Test inline images displaying when cycling." > ;; Mock `create-image' to work noninteractively. > (cl-letf (((symbol-function 'create-image) > (lambda (&rest _) `(image :type "dummy" :data "dummy")))) > (let* ((org-cycle-inline-images-display t) > (images-dir (expand-file-name "examples/images/" org-test-dir)) > (org-logo-image (expand-file-name "Org mode logo mono-color.png" images-dir))) > ;; `org-cycle' -(state)-> `'children' display child inline images. > (org-test-with-temp-text > (format "<point>* Heading 1 > [[file:%s]] > " org-logo-image) > (org-overview) > ;; (org-cycle) > ;; (org-cycle-internal-local) > ;; (org-cycle-display-inline-images 'children) > (org-fold-show-children) > (run-hook-with-args 'org-cycle-hook 'children) > (org-next-link) > (should org-inline-image-overlays) > (should (overlays-at (point))) > (org-toggle-inline-images) > (should-not (overlays-at (point)))) > > ;; `org-cycle' -(state)-> `'subtree' display subtrees inline images. > (org-test-with-temp-text > (format "<point>* 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-internal-global) > (org-fold-show-subtree) > (run-hook-with-args 'org-cycle-hook 'subtree) > (org-next-link) > (org-next-link) > ;; (should org-inline-image-overlays) > (should (overlays-at (point))) > (org-toggle-inline-images) > (should-not (overlays-at (point)))) > > ;; `org-cycle' -(state)-> `'folded' remove inline image overlays. > (org-test-with-temp-text > (format "<point>* 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))))))) > #+end_src > > > And failed after command: > > #+begin_src shell > make BTEST_RE="test-org-fold/org-fold-display-inline-images" test-dirty > #+end_src > > > Here is the output: > > #+begin_example > ~/Code/Emacs/org-mode:main*:1 λ make BTEST_RE="test-org-fold/org-fold-display-inline-images" test-dirty > install -m 755 -d /var/folders/ym/f3v5_yk1279g5ls70x3hzblh0000gn/T//tmp-orgtest > TMPDIR=/var/folders/ym/f3v5_yk1279g5ls70x3hzblh0000gn/T//tmp-orgtest emacs -Q -batch --eval '(setq vc-handled-backends nil org-startup-folded nil org-element-cache-persistent nil)' --eval '(add-to-list '"'"'load-path (concat default-directory "lisp"))' --eval '(add-to-list '"'"'load-path (concat default-directory "testing"))' -l org-batch-test-init --eval '(setq org-batch-test t org-babel-load-languages (quote ( (awk . t) (C . t) (fortran . t) (maxima . t) (lilypond . t) (octave . t) (perl . t) (python . t) (emacs-lisp . t) (shell . t) (org . t))) org-test-select-re "test-org-fold/org-fold-display-inline-images" )' -l org-loaddefs.el -l cl -l testing/org-test.el -l ert -l org -l ox -l ol --eval '(org-test-run-batch-tests org-test-select-re)' > Package cl is deprecated > Source file `/Users/stardiviner/Code/Emacs/org-mode/lisp/org.el' newer than byte-compiled file; using older file > Source file `/Users/stardiviner/Code/Emacs/org-mode/lisp/org-compat.el' newer than byte-compiled file; using older file > Source file `/Users/stardiviner/Code/Emacs/org-mode/lisp/org-macs.el' newer than byte-compiled file; using older file > Source file `/Users/stardiviner/Code/Emacs/org-mode/lisp/org-keys.el' newer than byte-compiled file; using older file > Source file `/Users/stardiviner/Code/Emacs/org-mode/lisp/oc.el' newer than byte-compiled file; using older file > Source file `/Users/stardiviner/Code/Emacs/org-mode/lisp/ol.el' newer than byte-compiled file; using older file > Source file `/Users/stardiviner/Code/Emacs/org-mode/lisp/org-table.el' newer than byte-compiled file; using older file > Source file `/Users/stardiviner/Code/Emacs/org-mode/lisp/org-cycle.el' newer than byte-compiled file; using older file > Source file `/Users/stardiviner/Code/Emacs/org-mode/lisp/ob-awk.el' newer than byte-compiled file; using older file > Source file `/Users/stardiviner/Code/Emacs/org-mode/lisp/ob-core.el' newer than byte-compiled file; using older file > Source file `/Users/stardiviner/Code/Emacs/org-mode/lisp/ob-comint.el' newer than byte-compiled file; using older file > Source file `/Users/stardiviner/Code/Emacs/org-mode/lisp/ob-exp.el' newer than byte-compiled file; using older file > Source file `/Users/stardiviner/Code/Emacs/org-mode/lisp/ob-ref.el' newer than byte-compiled file; using older file > Source file `/Users/stardiviner/Code/Emacs/org-mode/lisp/org-src.el' newer than byte-compiled file; using older file > Source file `/Users/stardiviner/Code/Emacs/org-mode/lisp/ob-maxima.el' newer than byte-compiled file; using older file > Source file `/Users/stardiviner/Code/Emacs/org-mode/lisp/ob-lilypond.el' newer than byte-compiled file; using older file > Source file `/Users/stardiviner/Code/Emacs/org-mode/lisp/ob-octave.el' newer than byte-compiled file; using older file > Source file `/Users/stardiviner/Code/Emacs/org-mode/lisp/ob-emacs-lisp.el' newer than byte-compiled file; using older file > Source file `/Users/stardiviner/Code/Emacs/org-mode/lisp/org-list.el' newer than byte-compiled file; using older file > Source file `/Users/stardiviner/Code/Emacs/org-mode/lisp/org-pcomplete.el' newer than byte-compiled file; using older file > Source file `/Users/stardiviner/Code/Emacs/org-mode/lisp/org-macro.el' newer than byte-compiled file; using older file > Source file `/Users/stardiviner/Code/Emacs/org-mode/lisp/org-id.el' newer than byte-compiled file; using older file > Source file `/Users/stardiviner/Code/Emacs/org-mode/lisp/org-refile.el' newer than byte-compiled file; using older file > Source file `/Users/stardiviner/Code/Emacs/org-mode/lisp/org.el' newer than byte-compiled file; using older file > Source file `/Users/stardiviner/Code/Emacs/org-mode/lisp/ol-doi.el' newer than byte-compiled file; using older file > Source file `/Users/stardiviner/Code/Emacs/org-mode/lisp/ol-irc.el' newer than byte-compiled file; using older file > Source file `/Users/stardiviner/Code/Emacs/org-mode/lisp/org-element.el' newer than byte-compiled file; using older file > Source file `/Users/stardiviner/Code/Emacs/org-mode/lisp/ox.el' newer than byte-compiled file; using older file > Source file `/Users/stardiviner/Code/Emacs/org-mode/lisp/ox-html.el' newer than byte-compiled file; using older file > Source file `/Users/stardiviner/Code/Emacs/org-mode/lisp/ox-icalendar.el' newer than byte-compiled file; using older file > Source file `/Users/stardiviner/Code/Emacs/org-mode/lisp/org-agenda.el' newer than byte-compiled file; using older file > Source file `/Users/stardiviner/Code/Emacs/org-mode/lisp/ol.el' newer than byte-compiled file; using older file > Finding ID locations (1/26 files): /Users/stardiviner/Code/Emacs/org-mode/testing/examples/setupfile3.org > Finding ID locations (2/26 files): /Users/stardiviner/Code/Emacs/org-mode/testing/examples/setupfile.org > Finding ID locations (3/26 files): /Users/stardiviner/Code/Emacs/org-mode/testing/examples/property-inheritance.org > Finding ID locations (4/26 files): /Users/stardiviner/Code/Emacs/org-mode/testing/examples/org-exp.org > Finding ID locations (5/26 files): /Users/stardiviner/Code/Emacs/org-mode/testing/examples/ob-shell-test.org > Finding ID locations (6/26 files): /Users/stardiviner/Code/Emacs/org-mode/testing/examples/ob-sed-test.org > Finding ID locations (7/26 files): /Users/stardiviner/Code/Emacs/org-mode/testing/examples/ob-screen-test.org > Finding ID locations (8/26 files): /Users/stardiviner/Code/Emacs/org-mode/testing/examples/ob-octave-test.org > Finding ID locations (9/26 files): /Users/stardiviner/Code/Emacs/org-mode/testing/examples/ob-maxima-test.org > Finding ID locations (10/26 files): /Users/stardiviner/Code/Emacs/org-mode/testing/examples/ob-lilypond-test.org > Finding ID locations (11/26 files): /Users/stardiviner/Code/Emacs/org-mode/testing/examples/ob-lilypond-broken.org > Finding ID locations (12/26 files): /Users/stardiviner/Code/Emacs/org-mode/testing/examples/ob-header-arg-defaults.org > Finding ID locations (13/26 files): /Users/stardiviner/Code/Emacs/org-mode/testing/examples/ob-fortran-test.org > Finding ID locations (14/26 files): /Users/stardiviner/Code/Emacs/org-mode/testing/examples/ob-awk-test.org > Finding ID locations (15/26 files): /Users/stardiviner/Code/Emacs/org-mode/testing/examples/ob-C-test.org > Finding ID locations (16/26 files): /Users/stardiviner/Code/Emacs/org-mode/testing/examples/normal.org > Finding ID locations (17/26 files): /Users/stardiviner/Code/Emacs/org-mode/testing/examples/no-heading.org > Finding ID locations (18/26 files): /Users/stardiviner/Code/Emacs/org-mode/testing/examples/macro-templates.org > Finding ID locations (19/26 files): /Users/stardiviner/Code/Emacs/org-mode/testing/examples/links.org > Finding ID locations (20/26 files): /Users/stardiviner/Code/Emacs/org-mode/testing/examples/link-in-heading.org > Finding ID locations (21/26 files): /Users/stardiviner/Code/Emacs/org-mode/testing/examples/include2.org > Finding ID locations (22/26 files): /Users/stardiviner/Code/Emacs/org-mode/testing/examples/include.org > Finding ID locations (23/26 files): /Users/stardiviner/Code/Emacs/org-mode/testing/examples/babel.org > Finding ID locations (24/26 files): /Users/stardiviner/Code/Emacs/org-mode/testing/examples/babel-dangerous.org > Finding ID locations (25/26 files): /Users/stardiviner/Code/Emacs/org-mode/testing/examples/attachments.org > Finding ID locations (26/26 files): /Users/stardiviner/Code/Emacs/org-mode/testing/examples/agenda-file.org > 26 files scanned, 14 files contains IDs, and 58 IDs found. > 0 source block added to Library of Babel > Source file `/Users/stardiviner/Code/Emacs/org-mode/lisp/ob-sed.el' newer than byte-compiled file; using older file > Source file `/Users/stardiviner/Code/Emacs/org-mode/lisp/org-inlinetask.el' newer than byte-compiled file; using older file > Source file `/Users/stardiviner/Code/Emacs/org-mode/lisp/org-capture.el' newer than byte-compiled file; using older file > Source file `/Users/stardiviner/Code/Emacs/org-mode/lisp/org-clock.el' newer than byte-compiled file; using older file > Source file `/Users/stardiviner/Code/Emacs/org-mode/lisp/org-feed.el' newer than byte-compiled file; using older file > Local variables list is not properly terminated > Source file `/Users/stardiviner/Code/Emacs/org-mode/lisp/org-lint.el' newer than byte-compiled file; using older file > selected tests: test-org-fold/org-fold-display-inline-images > Running 1 tests (2022-10-10 16:31:04+0800, selector `"test-org-fold/org-fold-display-inline-images"') > Test test-org-fold/org-fold-display-inline-images backtrace: > signal(ert-test-failed (((should org-inline-image-overlays) :form or > ert-fail(((should org-inline-image-overlays) :form org-inline-image- > (if (unwind-protect (setq value-12536 org-inline-image-overlays) (se > (let (form-description-12537) (if (unwind-protect (setq value-12536 > (let ((value-12536 (gensym "ert-form-evaluation-aborted-"))) (let (f > (progn (org-mode) (let ((point (string-match "<point>" inside-text)) > (unwind-protect (progn (org-mode) (let ((point (string-match "<point > (save-current-buffer (set-buffer temp-buffer) (unwind-protect (progn > (let ((temp-buffer (generate-new-buffer " *temp*" t))) (save-current > (let ((inside-text (if (stringp (format "<point>* Heading 1\n[[file: > (let* ((org-cycle-inline-images-display t) (images-dir (expand-file- > (progn (fset 'create-image vnew) (let* ((org-cycle-inline-images-dis > (unwind-protect (progn (fset 'create-image vnew) (let* ((org-cycle-i > (let* ((vnew #'(lambda (&rest _) '(image :type "dummy" :data "dummy" > (closure (t) nil (let* ((vnew #'(lambda (&rest _) '(image :type "dum > ert--run-test-internal(#s(ert--test-execution-info :test ... :result > ert-run-test(#s(ert-test :name test-org-fold/org-fold-display-inline > ert-run-or-rerun-test(#s(ert--stats :selector "test-org-fold/..." :t > ert-run-tests("test-org-fold/org-fold-display-inline-images" #f(comp > ert-run-tests-batch("test-org-fold/org-fold-display-inline-images") > ert-run-tests-batch-and-exit("test-org-fold/org-fold-display-inline- > (let ((org-id-track-globally t) (org-test-selector (if org-test-sele > org-test-run-batch-tests("test-org-fold/org-fold-display-inline-imag > eval((org-test-run-batch-tests org-test-select-re) t) > command-line-1(("--eval" "(setq vc-handled-backends nil org-startup- > command-line() > normal-top-level() > Test test-org-fold/org-fold-display-inline-images condition: > (ert-test-failed > ((should org-inline-image-overlays) > :form org-inline-image-overlays :value nil)) > FAILED 1/1 test-org-fold/org-fold-display-inline-images (0.001214 sec) at ../lisp/test-org-fold.el:607 > > Ran 1 tests, 0 results as expected, 1 unexpected (2022-10-10 16:31:04+0800, 0.166044 sec) > > 1 unexpected results: > FAILED test-org-fold/org-fold-display-inline-images ((should org-inline-image-overlays) :form org-inline-image-overlays :value nil) > > make: *** [test-dirty] Error 1 > ~/Code/Emacs/org-mode:main*:1 λ > #+end_example -- [ stardiviner ] I try to make every word tell the meaning that I want to express without misunderstanding. Blog: https://stardiviner.github.io/ IRC(libera.chat, freenode): stardiviner, Matrix: stardiviner GPG: F09F650D7D674819892591401B5DF1C95AE89AC3 [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 487 bytes --] ^ permalink raw reply [flat|nested] 43+ messages in thread
* Re: [PATCH 2-v4] New: auto display inline images under subtree when `org-cycle'. 2022-10-22 1:29 ` Christopher M. Miles @ 2022-10-23 4:33 ` Ihor Radchenko 2022-10-23 7:14 ` Christopher M. Miles 0 siblings, 1 reply; 43+ messages in thread From: Ihor Radchenko @ 2022-10-23 4:33 UTC (permalink / raw) To: Christopher M. Miles; +Cc: Ihor Radchenko, emacs-orgmode "Christopher M. Miles" <numbchild@gmail.com> writes: > Whether can this patch be merged at first, put the test in future to > finish? In recent days, I still have not figured out this image overlays > test. Sure. Can you please send the final version of the patch and the working tests? -- 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> ^ permalink raw reply [flat|nested] 43+ messages in thread
* Re: [PATCH 2-v4] New: auto display inline images under subtree when `org-cycle'. 2022-10-23 4:33 ` Ihor Radchenko @ 2022-10-23 7:14 ` Christopher M. Miles 2022-10-25 7:23 ` Ihor Radchenko 0 siblings, 1 reply; 43+ messages in thread From: Christopher M. Miles @ 2022-10-23 7:14 UTC (permalink / raw) To: Ihor Radchenko; +Cc: Christopher M. Miles, Ihor Radchenko, emacs-orgmode [-- Attachment #1.1: Type: text/plain, Size: 426 bytes --] Ihor Radchenko <yantar92@posteo.net> writes: > "Christopher M. Miles" <numbchild@gmail.com> writes: > >> Whether can this patch be merged at first, put the test in future to >> finish? In recent days, I still have not figured out this image overlays >> test. > > Sure. Can you please send the final version of the patch and the working > tests? I separated code patch and test into two patches. You can apply selectively. [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #1.2: 0001-org.el-Support-auto-display-inline-images-when-cycli.patch --] [-- Type: text/x-patch, Size: 18565 bytes --] From 2beacea9082e7eddd5db426cd180ea42ebb46656 Mon Sep 17 00:00:00 2001 From: stardiviner <numbchild@gmail.com> Date: Tue, 4 Oct 2022 12:36:32 +0800 Subject: [PATCH 1/2] 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. * doc/org-manual.org (Exporting): * etc/ORG-NEWS: Document the new option. --- doc/org-manual.org | 6 +++ etc/ORG-NEWS | 7 ++++ 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 6 files changed, 63 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 ad584d7a5..18a050069 100644 --- a/doc/org-manual.org +++ b/doc/org-manual.org @@ -11489,6 +11489,12 @@ command: - When set to nil, try to get the width from an =#+ATTR.*= keyword and fall back on the original width if none is found. + +#+vindex: org-cycle-inline-images-display +Inline images can also be displayed when cycling the folding state. +When custom option ~org-cycle-inline-images-display~ is set, the +visible inline images under subtree will be displayed automatically. + ** Captions :PROPERTIES: :DESCRIPTION: Describe tables, images... diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS index c18c03725..d87b49bd3 100644 --- a/etc/ORG-NEWS +++ b/etc/ORG-NEWS @@ -307,6 +307,13 @@ to pass the contents of a named code block as a string argument. The new property =ORG-IMAGE-ACTUAL-WIDTH= can override the global variable ~org-image-actual-width~ value for inline images display width. +*** Outline cycling can now include inline image visibility + +New ~org-cycle-hook~ function ~org-cycle-display-inline-images~ for +auto-displaying inline images in the visible parts of the subtree. +This behavior is controlled by new custom option +~org-cycle-inline-images-display~. + *** New ~org-babel-tangle-finished-hook~ hook run at the very end of ~org-babel-tangle~ 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 c1caa3fdc..14388caaf 100644 --- a/lisp/org-cycle.el +++ b/lisp/org-cycle.el @@ -208,8 +208,9 @@ the values `folded', `children', or `subtree'." :type 'hook) (defcustom org-cycle-hook '(org-cycle-hide-archived-subtrees - org-cycle-show-empty-lines - org-cycle-optimize-window-after-visibility-change) + org-cycle-show-empty-lines + org-cycle-optimize-window-after-visibility-change + 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) +(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. @@ -775,6 +783,32 @@ STATE should be one of the symbols listed in the docstring of "Subtree is archived and stays closed. Use \ `\\[org-cycle-force-archived]' to cycle it anyway.")))))) +(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 sub-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) ;;; org-cycle.el ends here diff --git a/lisp/org-keys.el b/lisp/org-keys.el index d65379a72..79e34cbd1 100644 --- 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" ()) -(declare-function org-toggle-inline-images "org" (&optional include-linked)) +(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 8191f0860..1cf091f58 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -16079,16 +16079,16 @@ SNIPPETS-P indicates if this is run to create snippet images for HTML." (defvar-local org-inline-image-overlays nil) -(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 - (org-remove-inline-images) + (org-remove-inline-images beg end) (when (called-interactively-p 'interactive) (message "Inline image display turned off"))) - (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" @@ -16178,8 +16178,8 @@ BEG and END define the considered part. They default to the buffer boundaries with possible narrowing." (interactive "P") (when (display-graphic-p) - (unless refresh - (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)) @@ -16329,11 +16329,16 @@ buffer boundaries with possible narrowing." (delete ov org-inline-image-overlays) (delete-overlay ov))) -(defun org-remove-inline-images () +(defun org-remove-inline-images (&optional beg end) "Remove inline display of images." (interactive) - (mapc #'delete-overlay org-inline-image-overlays) - (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))))) (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..9ac57e6a205257fd2fd21944a025190aa2f2db49 GIT binary patch literal 7523 zcmV-p9h~BcP)<h;3K|Lk000e1NJLTq004gg004vt1^@s6x#;xC00006VoOIv0RI60 z0RN!9r;`8x010qNS#tmY3ljhU3ljkVnw%H_000McNliru-UA2#E(`i0Rb&7F9Pmj* zK~#9!?VWjaT=kXbKli;_RoZ1Owk*pVHjC|GjNP%p32}xH2%(42B+ewHGb90QPSV}U z%sF&2Jvr$~LiY^WSiGFj-AU-4^d#wS2nkDo1h82pFkXQeTaslhmMmFYsn+*?^T+R3 zk}OMhl`WNItL{04QK?k#_ulvZ?tbqNa+ISS<tRrv%2AGTl%pJ7m?XJJFtcdEf(1G7 zXDa9-f>O!?BnSQlOp6yU#&MjHpxYv{0PriN-m`O$=)$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`66<g0eztn z@qg<$&WpBf4_W$$4<8=)J9FTl2jbnbEL_)3y;TEz#)$YOKpXG_;Kx8uI-uut{&}#| zQ-C{;gNV!lHUhUBOI`tw0^b4ZQ-9~WE=^5MX<cL5?ff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jVkeUzuWpE@KexX1JgIT*!mY@*T*D{b|nxt3gkt`lGQ227${s`w60g zZtASdfj{k;ppJQ0t^x!R!cHRoyk*;U=#Jv~XZf|S0xy;?T|(R5y*ZsfooVN`ZS35p zWAV1`;d>sPr1>^_gleXg4=_(ll^poz1C2_?97i8S^jY*-GntTIDd;+QFbDqm#sDLj zK%q;tZvp-<X`VC%ctyZ<RSx{~l?lYQu*C*Fn)D7M3Hs9bb2nxA<-k8r>BR>h#C3*_ zZwo8ey%+crI&FM9N@}r@+xh1=18m<uqz1&Y6sTXIPYFL=lipy;;m?78fv5pJ_{joz z2|ZH&&2c{72k`vXtvT>77zWt#5K6hJGZuCmJK)_hKHAL;BWoty<j!qdagvFYHh%;7 z>L{?2WN;o`4*c_sUipWIhmOkH^4yjufFF+dbp%~jo&*1awgG_6AKnZ)E12rk=tUQD z=D@$8RlwFQX514Uz(1I`Q>SO;z`x*cdN`8vwDJEN74)kd_!mCCI6Sqw6`cdvE8vJF zIq+u&sg#w!2c6DExo!^pnL&bb1>kk#{;_ig1$ba)MKe!@-%<cC0R2kMy!)TAJKsqp tQiFeup{K}Ej&hWv9OWoSIl2(({{sZ59n%b9$Nm5S002ovPDHLkV1oBJp5p)j literal 0 HcmV?d00001 -- 2.38.0 [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #1.3: 0002-test-org-fold.el-Add-test-for-inline-image-displayin.patch --] [-- Type: text/x-patch, Size: 3176 bytes --] From a81a187de9f4aa9f208bfe6931d577733b6f6f0c Mon Sep 17 00:00:00 2001 From: stardiviner <numbchild@gmail.com> Date: Sun, 23 Oct 2022 15:11:56 +0800 Subject: [PATCH 2/2] test-org-fold.el: Add test for inline image displaying when cycling * testing/lisp/test-org-fold.el (test-org-fold/org-fold-display-inline-images): Add unit test for inline image displaying when cycling. --- testing/lisp/test-org-fold.el | 61 +++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) diff --git a/testing/lisp/test-org-fold.el b/testing/lisp/test-org-fold.el index 8b19ffbc9..664be4551 100644 --- a/testing/lisp/test-org-fold.el +++ b/testing/lisp/test-org-fold.el @@ -662,6 +662,67 @@ Unfolded Paragraph. (org-fold-check-before-invisible-edit kind) (should (org-invisible-p (1- (point)))))))))) +(ert-deftest test-org-fold/org-fold-display-inline-images () + "Test inline images displaying when cycling." + (let* ((org-cycle-inline-images-display t) + (images-dir (expand-file-name "examples/images/" org-test-dir)) + (org-logo-image (expand-file-name "Org mode logo mono-color.png" images-dir))) + ;; `org-cycle' -(state)-> `'children' display child inline images. + (org-test-with-temp-text + (format "<point>* Heading 1 +[[file:%s]] +" org-logo-image) + (org-overview) + ;; (org-cycle) + ;; (org-cycle-internal-local) + ;; (org-cycle-display-inline-images 'children) + (org-fold-show-children) + (run-hook-with-args 'org-cycle-hook 'children) + (org-next-link) + (should org-inline-image-overlays) + (should (overlays-at (point))) + (org-toggle-inline-images) + (should-not (overlays-at (point)))) + + ;; `org-cycle' -(state)-> `'subtree' display subtrees inline images. + (org-test-with-temp-text + (format "<point>* 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-internal-global) + (org-fold-show-subtree) + (run-hook-with-args 'org-cycle-hook 'subtree) + (org-next-link) + (org-next-link) + ;; (should org-inline-image-overlays) + (should (overlays-at (point))) + (org-toggle-inline-images) + (should-not (overlays-at (point)))) + + ;; `org-cycle' -(state)-> `'folded' remove inline image overlays. + (org-test-with-temp-text + (format "<point>* 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) ;;; test-org-fold.el ends here -- 2.38.0 [-- Attachment #1.4: Type: text/plain, Size: 267 bytes --] -- [ stardiviner ] I try to make every word tell the meaning that I want to express without misunderstanding. Blog: https://stardiviner.github.io/ IRC(libera.chat, freenode): stardiviner, Matrix: stardiviner GPG: F09F650D7D674819892591401B5DF1C95AE89AC3 [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 487 bytes --] ^ permalink raw reply related [flat|nested] 43+ messages in thread
* Re: [PATCH 2-v4] New: auto display inline images under subtree when `org-cycle'. 2022-10-23 7:14 ` Christopher M. Miles @ 2022-10-25 7:23 ` Ihor Radchenko 2022-10-25 14:22 ` [PATCH v3] " Christopher M. Miles 0 siblings, 1 reply; 43+ messages in thread From: Ihor Radchenko @ 2022-10-25 7:23 UTC (permalink / raw) To: Christopher M. Miles; +Cc: Ihor Radchenko, emacs-orgmode "Christopher M. Miles" <numbchild@gmail.com> writes: >> Sure. Can you please send the final version of the patch and the working >> tests? > > I separated code patch and test into two patches. You can apply selectively. Sorry, I was not very clear. I meant to remove that patch that fails due to noninteractive and leave the rest. > doc/org-manual.org | 6 +++ > etc/ORG-NEWS | 7 ++++ > 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 The image should belong to the test patch. -- 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> ^ permalink raw reply [flat|nested] 43+ messages in thread
* Re: [PATCH v3] New: auto display inline images under subtree when `org-cycle'. 2022-10-25 7:23 ` Ihor Radchenko @ 2022-10-25 14:22 ` Christopher M. Miles 2022-10-26 4:50 ` Ihor Radchenko 0 siblings, 1 reply; 43+ messages in thread From: Christopher M. Miles @ 2022-10-25 14:22 UTC (permalink / raw) To: Ihor Radchenko; +Cc: Christopher M. Miles, Ihor Radchenko, emacs-orgmode [-- Attachment #1.1: Type: text/plain, Size: 897 bytes --] Ihor Radchenko <yantar92@posteo.net> writes: > "Christopher M. Miles" <numbchild@gmail.com> writes: > >>> Sure. Can you please send the final version of the patch and the working >>> tests? >> >> I separated code patch and test into two patches. You can apply selectively. > > Sorry, I was not very clear. > I meant to remove that patch that fails due to noninteractive and leave > the rest. > Updated, I deleted testing and marked as TODO. >> doc/org-manual.org | 6 +++ >> etc/ORG-NEWS | 7 ++++ >> 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 > > The image should belong to the test patch. Updated. [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #1.2: 0001-org.el-Support-auto-display-inline-images-when-cycli.patch --] [-- Type: text/x-patch, Size: 8169 bytes --] From 4cdf69001832bcc180e7c607c15c44c484954c82 Mon Sep 17 00:00:00 2001 From: stardiviner <numbchild@gmail.com> Date: Tue, 4 Oct 2022 12:36:32 +0800 Subject: [PATCH 1/2] 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. * doc/org-manual.org (Exporting): * etc/ORG-NEWS: Document the new option. --- doc/org-manual.org | 6 ++++++ etc/ORG-NEWS | 7 +++++++ lisp/org-cycle.el | 38 ++++++++++++++++++++++++++++++++++++-- lisp/org-keys.el | 2 +- lisp/org.el | 21 +++++++++++++-------- 5 files changed, 63 insertions(+), 11 deletions(-) diff --git a/doc/org-manual.org b/doc/org-manual.org index ad584d7a5..18a050069 100644 --- a/doc/org-manual.org +++ b/doc/org-manual.org @@ -11489,6 +11489,12 @@ command: - When set to nil, try to get the width from an =#+ATTR.*= keyword and fall back on the original width if none is found. + +#+vindex: org-cycle-inline-images-display +Inline images can also be displayed when cycling the folding state. +When custom option ~org-cycle-inline-images-display~ is set, the +visible inline images under subtree will be displayed automatically. + ** Captions :PROPERTIES: :DESCRIPTION: Describe tables, images... diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS index c18c03725..d87b49bd3 100644 --- a/etc/ORG-NEWS +++ b/etc/ORG-NEWS @@ -307,6 +307,13 @@ to pass the contents of a named code block as a string argument. The new property =ORG-IMAGE-ACTUAL-WIDTH= can override the global variable ~org-image-actual-width~ value for inline images display width. +*** Outline cycling can now include inline image visibility + +New ~org-cycle-hook~ function ~org-cycle-display-inline-images~ for +auto-displaying inline images in the visible parts of the subtree. +This behavior is controlled by new custom option +~org-cycle-inline-images-display~. + *** New ~org-babel-tangle-finished-hook~ hook run at the very end of ~org-babel-tangle~ 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 c1caa3fdc..14388caaf 100644 --- a/lisp/org-cycle.el +++ b/lisp/org-cycle.el @@ -208,8 +208,9 @@ the values `folded', `children', or `subtree'." :type 'hook) (defcustom org-cycle-hook '(org-cycle-hide-archived-subtrees - org-cycle-show-empty-lines - org-cycle-optimize-window-after-visibility-change) + org-cycle-show-empty-lines + org-cycle-optimize-window-after-visibility-change + 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) +(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. @@ -775,6 +783,32 @@ STATE should be one of the symbols listed in the docstring of "Subtree is archived and stays closed. Use \ `\\[org-cycle-force-archived]' to cycle it anyway.")))))) +(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 sub-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) ;;; org-cycle.el ends here diff --git a/lisp/org-keys.el b/lisp/org-keys.el index d65379a72..79e34cbd1 100644 --- 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" ()) -(declare-function org-toggle-inline-images "org" (&optional include-linked)) +(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 8191f0860..1cf091f58 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -16079,16 +16079,16 @@ SNIPPETS-P indicates if this is run to create snippet images for HTML." (defvar-local org-inline-image-overlays nil) -(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 - (org-remove-inline-images) + (org-remove-inline-images beg end) (when (called-interactively-p 'interactive) (message "Inline image display turned off"))) - (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" @@ -16178,8 +16178,8 @@ BEG and END define the considered part. They default to the buffer boundaries with possible narrowing." (interactive "P") (when (display-graphic-p) - (unless refresh - (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)) @@ -16329,11 +16329,16 @@ buffer boundaries with possible narrowing." (delete ov org-inline-image-overlays) (delete-overlay ov))) -(defun org-remove-inline-images () +(defun org-remove-inline-images (&optional beg end) "Remove inline display of images." (interactive) - (mapc #'delete-overlay org-inline-image-overlays) - (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))))) (defvar org-self-insert-command-undo-counter 0) (defvar org-speed-command nil) -- 2.38.0 [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #1.3: 0002-test-org-fold.el-Add-test-for-inline-image-displayin.patch --] [-- Type: text/x-patch, Size: 12385 bytes --] From cd39d9d4797771bcd7f95b207f7d7174ad4d6736 Mon Sep 17 00:00:00 2001 From: stardiviner <numbchild@gmail.com> Date: Sun, 23 Oct 2022 15:11:56 +0800 Subject: [PATCH 2/2] test-org-fold.el: Add test for inline image displaying when cycling * testing/lisp/test-org-fold.el (test-org-fold/org-fold-display-inline-images): Add unit test for inline image displaying when cycling. --- .../images/Org mode logo mono-color.png | Bin 0 -> 7523 bytes testing/lisp/test-org-fold.el | 29 ++++++++++++++++++ 2 files changed, 29 insertions(+) create mode 100755 testing/examples/images/Org mode logo mono-color.png 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..9ac57e6a205257fd2fd21944a025190aa2f2db49 GIT binary patch literal 7523 zcmV-p9h~BcP)<h;3K|Lk000e1NJLTq004gg004vt1^@s6x#;xC00006VoOIv0RI60 z0RN!9r;`8x010qNS#tmY3ljhU3ljkVnw%H_000McNliru-UA2#E(`i0Rb&7F9Pmj* zK~#9!?VWjaT=kXbKli;_RoZ1Owk*pVHjC|GjNP%p32}xH2%(42B+ewHGb90QPSV}U z%sF&2Jvr$~LiY^WSiGFj-AU-4^d#wS2nkDo1h82pFkXQeTaslhmMmFYsn+*?^T+R3 zk}OMhl`WNItL{04QK?k#_ulvZ?tbqNa+ISS<tRrv%2AGTl%pJ7m?XJJFtcdEf(1G7 zXDa9-f>O!?BnSQlOp6yU#&MjHpxYv{0PriN-m`O$=)$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`66<g0eztn z@qg<$&WpBf4_W$$4<8=)J9FTl2jbnbEL_)3y;TEz#)$YOKpXG_;Kx8uI-uut{&}#| zQ-C{;gNV!lHUhUBOI`tw0^b4ZQ-9~WE=^5MX<cL5?ff6DTVYnF^y*wFYc6D<BEns7 zygA|5`@rVSMvM+WiXB_GOeyGIua{&pnR=@dxE1&!@ILe2Vc<Tc)XzjDocdroyM4;R z|Jy5;P!#kd>NE>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=2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ey%+crI&FM9N@}r@+xh1=18m<uqz1&Y6sTXIPYFL=lipy;;m?78fv5pJ_{joz z2|ZH&&2c{72k`vXtvT>77zWt#5K6hJGZuCmJK)_hKHAL;BWoty<j!qdagvFYHh%;7 z>L{?2WN;o`4*c_sUipWIhmOkH^4yjufFF+dbp%~jo&*1awgG_6AKnZ)E12rk=tUQD z=D@$8RlwFQX514Uz(1I`Q>SO;z`x*cdN`8vwDJEN74)kd_!mCCI6Sqw6`cdvE8vJF zIq+u&sg#w!2c6DExo!^pnL&bb1>kk#{;_ig1$ba)MKe!@-%<cC0R2kMy!)TAJKsqp tQiFeup{K}Ej&hWv9OWoSIl2(({{sZ59n%b9$Nm5S002ovPDHLkV1oBJp5p)j literal 0 HcmV?d00001 diff --git a/testing/lisp/test-org-fold.el b/testing/lisp/test-org-fold.el index 8b19ffbc9..955ebc417 100644 --- a/testing/lisp/test-org-fold.el +++ b/testing/lisp/test-org-fold.el @@ -662,6 +662,35 @@ Unfolded Paragraph. (org-fold-check-before-invisible-edit kind) (should (org-invisible-p (1- (point)))))))))) +(ert-deftest test-org-fold/org-fold-display-inline-images () + "Test inline images displaying when cycling." + (let* ((org-cycle-inline-images-display t) + (images-dir (expand-file-name "examples/images/" org-test-dir)) + (org-logo-image (expand-file-name "Org mode logo mono-color.png" images-dir))) + ;; `org-cycle' -(state)-> `'children' display child inline images. + ;; TODO: + + ;; `org-cycle' -(state)-> `'subtree' display subtrees inline images. + ;; TODO: + + ;; `org-cycle' -(state)-> `'folded' remove inline image overlays. + (org-test-with-temp-text + (format "<point>* 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) ;;; test-org-fold.el ends here -- 2.38.0 [-- Attachment #1.4: Type: text/plain, Size: 267 bytes --] -- [ stardiviner ] I try to make every word tell the meaning that I want to express without misunderstanding. Blog: https://stardiviner.github.io/ IRC(libera.chat, freenode): stardiviner, Matrix: stardiviner GPG: F09F650D7D674819892591401B5DF1C95AE89AC3 [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 487 bytes --] ^ permalink raw reply related [flat|nested] 43+ messages in thread
* Re: [PATCH v3] New: auto display inline images under subtree when `org-cycle'. 2022-10-25 14:22 ` [PATCH v3] " Christopher M. Miles @ 2022-10-26 4:50 ` Ihor Radchenko 0 siblings, 0 replies; 43+ messages in thread From: Ihor Radchenko @ 2022-10-26 4:50 UTC (permalink / raw) To: Christopher M. Miles; +Cc: Ihor Radchenko, emacs-orgmode "Christopher M. Miles" <numbchild@gmail.com> writes: >> Sorry, I was not very clear. >> I meant to remove that patch that fails due to noninteractive and leave >> the rest. >> > > Updated, I deleted testing and marked as TODO. > Applied onto main. https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=46b71f910844c14d8db1feb54c07de26d101cc05 https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=87e50f467add3ddca635d32f97b9bd6061008faa Thanks for your contribution! -- 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> ^ permalink raw reply [flat|nested] 43+ messages in thread
end of thread, other threads:[~2022-10-26 4:50 UTC | newest] Thread overview: 43+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2021-11-22 6:34 [QUESTION] How to specific image size attributes under headline scope? Christopher M. Miles 2021-11-22 18:31 ` Timothy 2022-08-18 12:44 ` Christopher M. Miles [not found] ` <m2o7whra7j.fsf@numbchild> 2022-08-22 17:10 ` Timothy 2022-08-23 0:24 ` Christopher M. Miles 2022-09-11 2:20 ` [SOLVED] " Christopher M. Miles 2022-09-11 2:25 ` Christopher M. Miles [not found] ` <631d472b.c80a0220.2b4b2.bf86SMTPIN_ADDED_BROKEN@mx.google.com> 2022-09-11 12:34 ` Ihor Radchenko 2022-09-12 1:54 ` [PATCH] " Christopher M. Miles 2022-09-12 1:59 ` [PATCH] New: auto display inline images under subtree when `org-cycle' Christopher M. Miles [not found] ` <m2wna9bbc2.fsf@numbchild> 2022-09-12 6:03 ` [ISSUE] " Christopher M. Miles [not found] ` <631e92ee.050a0220.f9c18.92f5SMTPIN_ADDED_BROKEN@mx.google.com> 2022-09-12 10:51 ` Ihor Radchenko 2022-09-13 1:09 ` [PATCH 2] " Christopher M. Miles [not found] ` <m2leqogiz8.fsf@numbchild> 2022-09-13 1:48 ` [PATCH 3] " Christopher M. Miles [not found] ` <631fe1c9.050a0220.3ab2b.3f52SMTPIN_ADDED_BROKEN@mx.google.com> 2022-09-15 3:27 ` Ihor Radchenko 2022-09-15 4:53 ` [PATCH 4] " Christopher M. Miles [not found] ` <6322b0a8.050a0220.59bb8.6923SMTPIN_ADDED_BROKEN@mx.google.com> 2022-09-15 8:47 ` Ihor Radchenko 2022-09-15 9:43 ` [PATCH 5] " Christopher M. Miles [not found] ` <6322f5ad.c80a0220.5e936.823eSMTPIN_ADDED_BROKEN@mx.google.com> 2022-09-20 7:01 ` [PATCH v6] " Ihor Radchenko 2022-09-20 11:32 ` [PATCH v6] " Christopher M. Miles [not found] ` <6329c8b0.050a0220.412d.0a6cSMTPIN_ADDED_BROKEN@mx.google.com> 2022-09-21 7:54 ` Ihor Radchenko 2022-09-28 12:55 ` [PATCH 2-v1] " Christopher M. Miles [not found] ` <633454e3.050a0220.7278b.1fa5SMTPIN_ADDED_BROKEN@mx.google.com> 2022-09-29 3:05 ` Ihor Radchenko 2022-09-29 6:06 ` Christopher M. Miles 2022-09-29 6:57 ` [PATCH 2-v1 (test v1)] " Christopher M. Miles [not found] ` <63353c69.370a0220.67788.e8a1SMTPIN_ADDED_BROKEN@mx.google.com> 2022-09-30 3:19 ` [PATCH 2-v1] " Ihor Radchenko 2022-09-30 8:27 ` [PATCH 2-v2] " Christopher M. Miles [not found] ` <6336a955.050a0220.4e72e.2b23SMTPIN_ADDED_BROKEN@mx.google.com> 2022-10-01 3:16 ` Ihor Radchenko 2022-10-01 9:51 ` [PATCH 2-v3] " Christopher M. Miles [not found] ` <63380f57.370a0220.a9d9a.dee8SMTPIN_ADDED_BROKEN@mx.google.com> 2022-10-03 3:21 ` Ihor Radchenko 2022-10-03 4:37 ` [PATCH 2-v4] " Christopher M. Miles [not found] ` <633a67d8.050a0220.733e8.e57dSMTPIN_ADDED_BROKEN@mx.google.com> 2022-10-04 4:36 ` Ihor Radchenko 2022-10-04 7:27 ` Christopher M. Miles [not found] ` <633be6d3.370a0220.4060.bacdSMTPIN_ADDED_BROKEN@mx.google.com> 2022-10-08 7:53 ` Ihor Radchenko 2022-10-08 9:50 ` Christopher M. Miles [not found] ` <634149f4.c80a0220.1376.e564SMTPIN_ADDED_BROKEN@mx.google.com> 2022-10-09 7:21 ` Ihor Radchenko 2022-10-10 8:40 ` Christopher M. Miles [not found] ` <m2v8os5aqy.fsf@numbchild> 2022-10-22 1:29 ` Christopher M. Miles 2022-10-23 4:33 ` Ihor Radchenko 2022-10-23 7:14 ` Christopher M. Miles 2022-10-25 7:23 ` Ihor Radchenko 2022-10-25 14:22 ` [PATCH v3] " Christopher M. Miles 2022-10-26 4:50 ` Ihor Radchenko
Code repositories for project(s) associated with this public inbox https://git.savannah.gnu.org/cgit/emacs/org-mode.git This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).