[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v3] Re: [PATCH] add a function to only refresh inline images
From: |
Ihor Radchenko |
Subject: |
Re: [PATCH v3] Re: [PATCH] add a function to only refresh inline images under current headline instead of global buffer |
Date: |
Tue, 01 Aug 2023 08:04:18 +0000 |
"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'.
>> 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.
>> 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.
--
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>