emacs-orgmode
[Top][All Lists]
Advanced

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

[PATCH v3.1] Re: [PATCH] add a function to only refresh inline images un


From: Christopher M. Miles
Subject: [PATCH v3.1] Re: [PATCH] add a function to only refresh inline images under current headline instead of global buffer
Date: Tue, 01 Aug 2023 20:17:04 +0800
User-agent: mu4e 1.11.6; emacs 30.0.50

Ihor Radchenko <yantar92@posteo.net> writes:

> "Christopher M. Miles" <numbchild@gmail.com> writes:
>
>>> This is not a toggle. This is unconditional refresh.
>>>
>> Yes, indeed it's a unconditional refresh. It does not match the meaning of 
>> word "toggle".
>>
>> Seems need to detect whether has image overlays in region. I added this
>> detection in new patch. Like bellowing:
>>
>> #+begin_src emacs-lisp
>> ...
>> ((use-region-p)
>>     (if (seq-contains-p
>>          (mapcar
>>           (lambda (ov)
>>             (plist-get (overlay-properties ov) 'org-image-overlay))
>>           (overlays-in beg end))
>>          t)
>
> You can just use `org--inline-image-overlays'.
>

Aha, I forget this API function, I applied in new patch.

>>> And there is no clean way to allow INCLUDE-LINKED while keeping
>>> consistency with latex preview commands.
>>
>> About the INCLUDE-LINKED argument, I don't know how to process it. In
>> theory, it should be handled by function org-display-inline-images
>> instead of org-toggle-inline-images. If you have improvements on it, can
>> you add code on my patch?
>
> The problem here is backwards compatibility. `org-toggle-inline-images'
> is bound to C-c C-x C-v and people may be used to C-u C-c C-x C-v
> displaying linked images like
>
> [[https://orgmode.org/resources/img/org-mode-unicorn.svg][description]]
>
> I will need to think more how to approach this.
>

Indeed.

>>> What we might do here is making a new defcustom that will control
>>> whether linked images should be displayed. Then, something like C-1
>>> org-toggle-inline-images could toggle that defcustom and refresh all the
>>> image previews in buffer (if any).
>>>
>>> WDYT?
>>
>> Refreshing all image previews in buffer is same as old behavior.
>
> Sure. But the idea of this specific C-1 prefix argument is to toggle the
> hypothetical defcustom `org-inline-images-include-linked'. If we flip it
> we may need to remove/add linked image previews or otherwise risk users
> being confused by the defcustom not taking effect.

I checked source code, don't know where to insert this functionality.
Is it be in `org-display-inline-images` or somewhere else?
I will find time to checking code whether can add this in another patch.
If you have plan for this, let me know.

I think current patch is ready for merging now. WDYT?

Attachment: 0001-org-Improve-inline-images-displaying-like-LaTeX-prev.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]