I don't think so, my package org-link-beautify ported to the new
:preview mechanism. The file preview not always image. Could be text, or
icon etc. So pass in image object is not a good idea. It will limit
preview functionality extensibility.

[stardiviner]           <Hack this world!>      GPG key ID: 47C32433
IRC(freeenode): stardiviner                     Twitter:  @numbchild
Key fingerprint = 9BAA 92BC CDDD B9EF 3B36  CB99 B8C4 B8E5 47C3 2433
Blog: http://stardiviner.github.io/


On Tue, Dec 17, 2024 at 11:43 AM Karthik Chikmagalur <
karthikchikmaga...@gmail.com> wrote:

> >> Would it be possible to also handle image data in the function or
> >> refactor the org-link-preview-file function in a way that the geometry
> >> handling is done in a helper function which can be reused by other
> >> handlers.
> >
> > There is such function: `org-display-inline-image--width'.
> > We may consider exposing it as public function.
>
> This will not be enough, we will also have to expose `org-image--align'
> and the alignment code:
>
> (when align
>   (overlay-put
>    ov 'before-string
>    (propertize
>     " " 'face 'default
>     'display
>     (pcase align
>       ("center" `(space :align-to (- center (0.5 . ,image))))
>       ("right"  `(space :align-to (- right ,image)))))))
>
> I don't think we can expect third party packages to figure out and
> reimplement Org's image alignment logic.
>
> Considering this, it might be better to just split
> `org-link-preview-file' into two public functions, where the "inside"
> function accepts an image instead of a file.
>
> Karthik
>
>

Reply via email to