emacs-orgmode
[Top][All Lists]
Advanced

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

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


From: Ihor Radchenko
Subject: Re: [PATCH 2-v2] New: auto display inline images under subtree when `org-cycle'.
Date: Sat, 01 Oct 2022 11:16:07 +0800

"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



reply via email to

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