emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 2-v3] New: auto display inline images under subtree when `org


From: Ihor Radchenko
Subject: Re: [PATCH 2-v3] New: auto display inline images under subtree when `org-cycle'.
Date: Mon, 03 Oct 2022 11:21:45 +0800

"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>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]