emacs-orgmode
[Top][All Lists]
Advanced

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

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


From: Christopher M. Miles
Subject: Re: [PATCH 2-v4] New: auto display inline images under subtree when `org-cycle'.
Date: Tue, 04 Oct 2022 15:27:11 +0800
User-agent: mu4e 1.8.9; emacs 29.0.50

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: signature.asc
Description: PGP signature


reply via email to

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