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: Mon, 03 Oct 2022 12:37:48 +0800
User-agent: mu4e 1.8.9; emacs 29.0.50

Finally finished and passed the test. Here I attached the new patch.

Attachment: 0001-org.el-Support-auto-display-inline-images-when-cycli.patch
Description: Text Data

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


reply via email to

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