emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Ihor Radchenko <yantar92@posteo.net>
To: "Christopher M. Miles" <numbchild@gmail.com>
Cc: Org mode <emacs-orgmode@gnu.org>
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	[thread overview]
Message-ID: <87il9zgpdp.fsf@localhost> (raw)
In-Reply-To: <64c8a313.a70a0220.93ee0.14fb@mx.google.com>

"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>


  reply	other threads:[~2023-08-01  8:05 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-15  3:28 [PATCH] add a function to only refresh inline images under current headline instead of global buffer Christopher M. Miles
2023-05-15 11:08 ` Ihor Radchenko
2023-05-15 13:01   ` Christopher M. Miles
2023-05-15 14:00   ` [PATCH v2] " Christopher M. Miles
2023-05-16  9:17     ` Ihor Radchenko
2023-05-16 12:18       ` Christopher M. Miles
2023-07-24 11:25         ` Ihor Radchenko
2023-08-01  4:40           ` [PATCH v3] " Christopher M. Miles
2023-08-01  8:04             ` Ihor Radchenko [this message]
2023-08-01 12:17               ` [PATCH v3.1] " Christopher M. Miles
2023-08-01 14:09                 ` Ihor Radchenko
2023-08-01 15:22                   ` Christopher M. Miles
2023-08-01 15:46                   ` Christopher M. Miles
2023-08-02 16:08                     ` Ihor Radchenko
2023-08-04  6:30                       ` Christopher M. Miles
2023-08-02  7:26                 ` Ihor Radchenko
2023-08-02 15:44                   ` Christopher M. Miles
2023-08-04  8:20                     ` Ihor Radchenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87il9zgpdp.fsf@localhost \
    --to=yantar92@posteo.net \
    --cc=emacs-orgmode@gnu.org \
    --cc=numbchild@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).