Re: [PATCH v3] Inline image display as part of a new org-link-preview system

2024-09-15 Thread Karthik Chikmagalur
>>> Image cache is cleared _only_ with REFRESH argument. >>> I think that makes sense, right? >> >> Yes. But `org-link-preview-region' is always called with the REFRESH >> argument set to `t' though. > > Sure. What's a problem with that? Why flush Emacs' entire image cache to preview images in on

Re: [PATCH v3] Inline image display as part of a new org-link-preview system

2024-09-15 Thread Ihor Radchenko
Karthik Chikmagalur writes: >> Image cache is cleared _only_ with REFRESH argument. >> I think that makes sense, right? > > Yes. But `org-link-preview-region' is always called with the REFRESH > argument set to `t' though. Sure. What's a problem with that? In theory, we might not need to clear

Re: [PATCH v3] Inline image display as part of a new org-link-preview system

2024-09-15 Thread Ihor Radchenko
Karthik Chikmagalur writes: >> So, I thought that you are probably the best person to design such >> things :) > > Unfortunately I don't think I'm good at designing flexible async APIs, > at least in Emacs. (The LaTeX preview system is being tuned for > speed/lag-free performance, not flexibilit

Re: [PATCH v3] Inline image display as part of a new org-link-preview system

2024-09-10 Thread Karthik Chikmagalur
> The best test for the design is actually using it for things. > If you have some feature you want to use org-async for, we can merge > that feature + org-async. Only LaTeX previews for now. As you may be aware, the patchset also includes asynchronous pdf exports (using org-async), which makes a

Re: [PATCH v3] Inline image display as part of a new org-link-preview system

2024-09-10 Thread Karthik Chikmagalur
Latest iteration of patch attached. +BEG and END define the considered part. They default to the +buffer boundaries with possible narrowing." + (interactive "P") + (when (display-graphic-p) >>> >>> Do we need it here? You check graphics both here and later in the >>> preview

Re: [PATCH v3] Inline image display as part of a new org-link-preview system

2024-09-10 Thread Ihor Radchenko
Karthik Chikmagalur writes: >>> since the previews are place asynchronously. It always reports "no >>> images to display inline". Should I remove this messaging, or find a >>> way to run this from the final async chunk? The code gets a little >>> convoluted when I do the latter. >> >> I am a b

Re: [PATCH v3] Inline image display as part of a new org-link-preview system

2024-09-10 Thread Karthik Chikmagalur
>> Another problem: this top level chunk no longer works >> >> [...] >> >> since the previews are place asynchronously. It always reports "no >> images to display inline". Should I remove this messaging, or find a >> way to run this from the final async chunk? The code gets a little >> convolute

Re: [PATCH v3] Inline image display as part of a new org-link-preview system

2024-09-10 Thread Ihor Radchenko
Karthik Chikmagalur writes: > Another problem: this top level chunk no longer works > > (when interactive? > (let ((new (org-link-preview--get-overlays beg end))) > (message > (if new >(format "[%s] %d images displayed inline %s" >scope (length new) >

Re: [PATCH v3] Inline image display as part of a new org-link-preview system

2024-09-10 Thread Ihor Radchenko
Karthik Chikmagalur writes: >> Hmm... Not sure. I feel that we are going too far. >> Maybe we should use org-pending >> >> after it is finalized. > > Interesting, I didn't know about org-pending. At first I thought this > wou

Re: [PATCH v3] Inline image display as part of a new org-link-preview system

2024-09-09 Thread Karthik Chikmagalur
>> ... >> Do you mean something like this? >> >> (while (re-search-forward org-link-any-re end t) >> ;; Make overlay ov here >> ;; Find path, link and preview-func here >> >> (push (list ov preview-func path link) previews-remaining)) >> >> (dolist (preview-data-chunk (seq-partition previews-

Re: [PATCH v3] Inline image display as part of a new org-link-preview system

2024-09-09 Thread Karthik Chikmagalur
> Hmm... Not sure. I feel that we are going too far. > Maybe we should use org-pending > > after it is finalized. Interesting, I didn't know about org-pending. At first I thought this would overlap with the org-async, the proc

Re: [PATCH v3] Inline image display as part of a new org-link-preview system

2024-09-09 Thread Ihor Radchenko
Karthik Chikmagalur writes: >>> Do you mean something like this? >>> >>> (while (re-search-forward org-link-any-re end t) >>> ;; Make overlay ov here >>> ;; Find path, link and preview-func here >>> >>> (push (list ov preview-func path link) previews-remaining)) >>> >>> (dolist (preview-dat

Re: [PATCH v3] Inline image display as part of a new org-link-preview system

2024-09-08 Thread Karthik Chikmagalur
>> Do you mean something like this? >> >> (while (re-search-forward org-link-any-re end t) >> ;; Make overlay ov here >> ;; Find path, link and preview-func here >> >> (push (list ov preview-func path link) previews-remaining)) >> >> (dolist (preview-data-chunk (seq-partition previews-remaini

Re: [PATCH v3] Inline image display as part of a new org-link-preview system

2024-09-08 Thread Ihor Radchenko
Karthik Chikmagalur writes: >> I mostly meant calling preview-func asynchronously, while idle, spaced >> out, spending not longer than a fraction of second to call several >> preview-funcs. >> Spacing might then be controlled by the users. > ... > Do you mean something like this? > > (while (re-s

Re: [PATCH v3] Inline image display as part of a new org-link-preview system

2024-09-08 Thread Karthik Chikmagalur
>> I'm not sure how to solve this problem. Here's what I'm picturing -- >> note that this doesn't actually avoid the process sentinel pile-up: >> >> The preview provider should return its callback function to Org so Org >> can run it at its convenience. >> >> Org runs (funcall #'preview-func ov pa

Re: [PATCH v3] Inline image display as part of a new org-link-preview system

2024-09-08 Thread Ihor Radchenko
Karthik Chikmagalur writes: >>> +BEG and END define the considered part. They default to the >>> +buffer boundaries with possible narrowing." >>> + (interactive "P") >>> + (when (display-graphic-p) >> >> Do we need it here? You check graphics both here and later in the >> preview function. We

Re: [PATCH v3] Inline image display as part of a new org-link-preview system

2024-09-02 Thread Karthik Chikmagalur
New patch version attached. Not all your points were addressed, please check my comments below. >> Subject: [PATCH] org-link: Move inline image display to org-link > > The patch does a lot more than merely "moving" things around. Please, > name it accordingly. Maybe something like > >New cust