emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Ihor Radchenko <yantar92@posteo.net>
To: Karthik Chikmagalur <karthikchikmagalur@gmail.com>
Cc: stardiviner <numbchild@gmail.com>, Org mode <emacs-orgmode@gnu.org>
Subject: Re: [PATCH v5] Inline image display as part of a new org-link-preview system
Date: Sat, 21 Sep 2024 10:11:33 +0000	[thread overview]
Message-ID: <87bk0hs4dm.fsf@localhost> (raw)
In-Reply-To: <8734lx4twk.fsf@gmail.com>

Karthik Chikmagalur <karthikchikmagalur@gmail.com> writes:

> If you think it's a good idea, I can add pending previews to the queue
> in a LIFO fashion instead, so that if you call `org-link-preview' in two
> different sections before the first one is done previewing, the later
> one is processed first.

Yes, it would make sense.

> If `org-link-preview-clear' is run in a region where there are previews
> pending, these region-specific previews are removed from the queue.

I tried the following

1. Requests 1000 previews in a buffer
2. Move point to section, request previews on a specific image (not yet displayed)
3. Observe "Preview removed" message, which is confusing as no preview
   is visible at that point.

We need to do something about the logic determining whether any previews
are displayed or not. The current check that preview overlays are
present in requested region is no longer accurate as they may still be
queued and not yet visible to the user, creating impression that there
are no previews yet.

> Note that this new code in `org-link-preview-clear' is not actually
> necessary:
>
>    (when (memq ov org-link-preview-overlays)
>      ;; Remove pending preview tasks between BEG and END
>      (when-let ((spec (cl-find ov org-link-preview--queue
>                                :key #'cadr)))
>        (setq org-link-preview--queue
>              (delq spec org-link-preview--queue)))
>
> This is because the overlay placed over the links for which previews are
> pending are removed anyway.  So when the `--process-queue' function gets
> to that preview-pending link, it skips it since the overlay is gone.
> Also, the complexity of the above code is quadratic, so I can remove it
> if you think it's not required.  I included it to be thorough.

What you say make sense, but see the above - we make certain (now
incorrect) assumptions about `org-link-preview-overlays'. The relevant
parts of the code need to be re-checked.

> Also, I think the variable `org-link-preview-overlays' is actually
> unnecessary.  We can just use an overlay property for link-preview
> overlays and use `overlays-in' and `org-find-overlays', and reduce the
> amount of global state a little bit this way.  Let me know if I should
> remove it.

That might be an option. But we cannot remove it. We can only deprecate
it as of now and only remove in following releases.

>> And please fix the compiler warnings.
>
> As of this patch, I don't see any flymake errors with the
> `elisp-flymake-byte-compile' backend.  Is this not sufficient?
> Byte-compiling in my active Emacs session doesn't work as the state is
> "polluted".  I don't know of a convenient way to byte-compile code in a
> sandbox.

Just run make in Org git repo.

> Please note: I need some help with code style, for example
> `org-link--preview-queue' vs `org-link-preview--queue', etc. Let's
> postpone this particular discussion until after the design is final?

I like org-link-preview-- more, but the most important part is to make
things consistent across the function/variable names.

-- 
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:[~2024-09-21 10:10 UTC|newest]

Thread overview: 61+ 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
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
2023-08-05  5:28                       ` [PATCH v3.2] " Christopher M. Miles
2024-07-22 10:46                         ` Ihor Radchenko
2024-08-01 22:58                           ` [PATCH v4.0] " stardiviner
     [not found]                           ` <66a8b73b.170a0220.383476.996e@mx.google.com>
2024-08-12 10:18                             ` Ihor Radchenko
2024-08-14  2:04                               ` stardiviner
2024-08-18 10:27                                 ` Ihor Radchenko
2024-08-20  2:02                                   ` Karthik Chikmagalur
2024-08-20 15:43                                     ` Karthik Chikmagalur
2024-08-20 18:19                                       ` Ihor Radchenko
2024-08-20 19:46                                         ` Karthik Chikmagalur
2024-08-22 13:19                                           ` Ihor Radchenko
2024-08-23  6:04                                             ` Karthik Chikmagalur
2024-08-23 23:36                                             ` [PATCH v1] Inline image display as part of a new org-link-preview system Karthik Chikmagalur
2024-08-24  1:00                                               ` Karthik Chikmagalur
2024-08-31 14:22                                               ` Ihor Radchenko
2024-08-31 16:41                                                 ` Karthik Chikmagalur
2024-08-31 16:53                                                   ` Ihor Radchenko
2024-08-31 22:37                                                     ` [PATCH v2] " Karthik Chikmagalur
2024-09-01 13:06                                                       ` Ihor Radchenko
2024-09-02 20:13                                                         ` [PATCH v3] " Karthik Chikmagalur
2024-09-08  7:43                                                           ` Ihor Radchenko
2024-09-09  3:21                                                             ` Karthik Chikmagalur
2024-09-09  6:06                                                               ` Ihor Radchenko
2024-09-09  6:30                                                                 ` Karthik Chikmagalur
2024-09-09 16:47                                                                   ` Ihor Radchenko
2024-09-09 19:14                                                                     ` Karthik Chikmagalur
2024-09-10 16:57                                                                       ` Ihor Radchenko
2024-09-10 19:53                                                                         ` Karthik Chikmagalur
2024-09-15  7:51                                                                           ` Ihor Radchenko
2024-09-09 21:45                                                                 ` Karthik Chikmagalur
2024-09-10 16:58                                                                   ` Ihor Radchenko
2024-09-10 17:38                                                                     ` Karthik Chikmagalur
2024-09-10 18:34                                                                       ` Ihor Radchenko
2024-09-10 19:43                                                             ` Karthik Chikmagalur
2024-09-15  8:12                                                               ` Ihor Radchenko
2024-09-15 20:50                                                                 ` Karthik Chikmagalur
2024-09-15 21:57                                                                 ` [PATCH v4] " Karthik Chikmagalur
2024-09-17 18:16                                                                   ` Ihor Radchenko
2024-09-18  1:44                                                                     ` [PATCH v5] " Karthik Chikmagalur
2024-09-21 10:11                                                                       ` Ihor Radchenko [this message]
2024-08-18 10:34                                 ` [FR] Automatically display images in resutls of evaluation (was: [PATCH v4.0] Re: [PATCH] add a function to only refresh inline images under current headline instead of global buffer) Ihor Radchenko
     [not found]                                   ` <66c54dfc.a70a0220.3c823a.2899@mx.google.com>
2024-08-22 13:06                                     ` [FR] Automatically display images in resutls of evaluation Ihor Radchenko
     [not found]                                       ` <66c89411.170a0220.3255c1.0cd5@mx.google.com>
     [not found]                                         ` <87zfor7b04.fsf@localhost>
     [not found]                                           ` <CAL1eYuLOsaS43ahueN4uWiCn+Ykp=p_-t9dzAypKdy1en_53BQ@mail.gmail.com>
2024-09-15 13:33                                             ` [PATCH v3] " 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=87bk0hs4dm.fsf@localhost \
    --to=yantar92@posteo.net \
    --cc=emacs-orgmode@gnu.org \
    --cc=karthikchikmagalur@gmail.com \
    --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).