emacs-orgmode
[Top][All Lists]
Advanced

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

[PATCH 4] New: auto display inline images under subtree when `org-cycle'


From: Christopher M. Miles
Subject: [PATCH 4] New: auto display inline images under subtree when `org-cycle'.
Date: Thu, 15 Sep 2022 12:53:06 +0800
User-agent: mu4e 1.8.9; emacs 29.0.50

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.

Attachment: 0001-org.el-Add-hook-function-to-auto-display-inline-imag.patch
Description: Text Data

-- 

[ 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]