[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 2] New: auto display inline images under subtree when `org-cycle'
From: |
Christopher M. Miles |
Subject: |
[PATCH 2] New: auto display inline images under subtree when `org-cycle'. |
Date: |
Tue, 13 Sep 2022 09:09:08 +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 Radchenko <yantar92@gmail.com> writes:
>>
>>> "Christopher M. Miles" <numbchild@gmail.com> writes:
>>>
>>>>> When I put it on beginning of org document, then preview inline images,
>>>>> but those global attributes
>>>>> not affected. The inline images still display in actual image size. I
>>>>> want to specify image size
>>>>> under headline properties. Is it possible to do this?
>>>>
>>>> I implemented this feature by written a hook. Hope this can be helpful
>>>> for someone who also has this needs. Here is the code:
>>>
>>> This looks useful.
>>> Would you be interested to write a patch?
>>
>> The is the new patch which updated the defcustom variable docstring has
>> correct description.
>
> Thanks for the patch!
> Before extending org-cycle functionality, let's first try to sort out
> subtree-level setting of the image size.
This is implemented by retrieve subtree-level property value in function
~~org-display-inline-image--width~~.
I submitted two separated patches.
>
> In the patch, you are suggesting to use INLINE-IMAGE-WIDTH property.
> However, if we apply the patch as is, this property will only be useful
> when calling a single function -
> `org-display-subtree-with-inline-images'.
> It is not ideal.
The patch's purpose is auto display inline images when [TAB] (~org-cycle~)
expanding heading or
subtrees. Not for global ~org-toggle-inline-images~. Also, introduce a new
extra argument "~state~" for
~org-display-inline-images~ like bellowing is not ideal. I think should
separate the ~org-cycle~ logic
instead of put in ~org-display-inline-images~. In global scope,
~org-toggle-inline-images~ already
respect the updated function ~org-display-inline-image--width~, it should
respect the subtree property width.
#+begin_src emacs-lisp
;; V
;; -----
(defun org-display-inline-images (&optional state include-linked refresh beg
end)
...)
#+end_src
*NOTE*: Because ~org-cycle-hook~ will pass a ~state~ variable to hook function.
>
> If we introduce subtree-level setting for inline image size, it should
> also work when displaying inline images by other existing means
> (org-toggle-inline-images).
This is implemented by retrieve subtree-level property value in function
~~org-display-inline-image--width~~.
>
> Instead of working around the existing code of
> `org-display-inline-images' and setting a custom
> `org-image-actual-width' variable in buffer, it is much better to change
> `org-display-inline-images' directly. At the end, the patch is not bound
> to your personal config - feel free to alter the existing Org functions.
This is implemented by retrieve subtree-level property value in function
~~org-display-inline-image--width~~.
>
> Similarly, you do not need to do
> (add-to-list 'org-default-properties "INLINE-IMAGE-WIDTH")
> Simply change the default value of `org-default-properties'.
Updated
>
> Finally, it will be more consistent to name the property closer to the
> variable name: ORG-IMAGE-ACTUAL-WIDTH.
Updated
0001-org.el-Support-subtree-level-image-width-specificati.patch
Description: subtree-level property width support
0002-org.el-Add-hook-function-to-auto-display-inline-imag.patch
Description: org-cycle-hook function support
--
[ 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
signature.asc
Description: PGP signature
- [SOLVED] Re: [QUESTION] How to specific image size attributes under headline scope?, Christopher M. Miles, 2022/09/10
- [SOLVED] Re: [QUESTION] How to specific image size attributes under headline scope?, Christopher M. Miles, 2022/09/10
- Re: [SOLVED] Re: [QUESTION] How to specific image size attributes under headline scope?, Ihor Radchenko, 2022/09/11
- [PATCH] Re: [SOLVED] Re: [QUESTION] How to specific image size attributes under headline scope?, Christopher M. Miles, 2022/09/11
- [PATCH] New: auto display inline images under subtree when `org-cycle'., Christopher M. Miles, 2022/09/11
- Message not available
- Message not available
- Message not available
- Re: [PATCH 3] New: auto display inline images under subtree when `org-cycle'., Ihor Radchenko, 2022/09/14
- [PATCH 4] New: auto display inline images under subtree when `org-cycle'., Christopher M. Miles, 2022/09/15
- Message not available
- Re: [PATCH 4] New: auto display inline images under subtree when `org-cycle'., Ihor Radchenko, 2022/09/15
- [PATCH 5] New: auto display inline images under subtree when `org-cycle'., Christopher M. Miles, 2022/09/15
- Message not available
- [PATCH v6] Re: [PATCH 5] New: auto display inline images under subtree when `org-cycle'., Ihor Radchenko, 2022/09/20
- Re: [PATCH v6] New: auto display inline images under subtree when `org-cycle'., Christopher M. Miles, 2022/09/20
- Message not available
- Re: [PATCH v6] New: auto display inline images under subtree when `org-cycle'., Ihor Radchenko, 2022/09/21
- [PATCH 2-v1] New: auto display inline images under subtree when `org-cycle'., Christopher M. Miles, 2022/09/28
- Message not available
- Re: [PATCH 2-v1] New: auto display inline images under subtree when `org-cycle'., Ihor Radchenko, 2022/09/28