Ihor Radchenko writes: > "Christopher M. Miles" 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?