Re: Link preview generation with new link preview property

2025-03-29 Thread Ihor Radchenko
Karthik Chikmagalur writes: >> I am looking at this and wonder why not simply change the whole >> org-link-preview file to have (ov image-data-or-path &optional link align >> width) >> arguments. Then, we can make `org-link-preview-image-data' internal and >> only expose `org-link-preview-file'

Re: Link preview generation with new link preview property

2025-03-28 Thread Karthik Chikmagalur
>> @@ -2178,23 +2178,39 @@ (defun org-link-preview-file (ov path link) >> >> This is intended to be used as the `:preview' link property of >> file links, see `org-link-parameters'." >> - (when (display-graphic-p) >> -(require 'image) >> (when-let* ((file-full (expand-file-name path))

Re: Link preview generation with new link preview property

2025-02-23 Thread Ihor Radchenko
Karthik Chikmagalur writes: > I'm not sure about passing "align", as this should be read from the link > attributes. I'm assuming the "width" specified in the link attributes > will apply on top of the width argument to this function? Instead. The idea is to provide overriding alignment/width i

Re: Link preview generation with new link preview property

2025-02-23 Thread Karthik Chikmagalur
> Hmm. Maybe we have a misunderstanding. I was talking about > `org-link-preview-file' signature. Yes, I misunderstood. > With the new signature, (org-link-preview-file ov path link) will be > still ok. The point is that other callers that want to use > `org-link-preview-file' independently may u

Re: Link preview generation with new link preview property

2025-02-23 Thread Ihor Radchenko
Karthik Chikmagalur writes: >> The new signature is (ov image-data-or-path &optional link align width) >> So, LINK becomes optional in a sense that ALIGN+WIDTH may be provided >> instead. >> >> Should be 100% backwards-compatible. > > Is this the new signature for the API, i.e. previewers of all

Re: Link preview generation with new link preview property

2025-02-23 Thread Karthik Chikmagalur
> The new signature is (ov image-data-or-path &optional link align width) > So, LINK becomes optional in a sense that ALIGN+WIDTH may be provided instead. > > Should be 100% backwards-compatible. Is this the new signature for the API, i.e. previewers of all kinds? I don't follow how the preview f

Re: Link preview generation with new link preview property

2025-02-23 Thread Ihor Radchenko
Karthik Chikmagalur writes: >> I am looking at this and wonder why not simply change the whole >> org-link-preview file to have (ov image-data-or-path &optional link align >> width) >> arguments. Then, we can make `org-link-preview-image-data' internal and >> only expose `org-link-preview-file'

Re: Link preview generation with new link preview property

2025-02-23 Thread Karthik Chikmagalur
> I am looking at this and wonder why not simply change the whole > org-link-preview file to have (ov image-data-or-path &optional link align > width) > arguments. Then, we can make `org-link-preview-image-data' internal and > only expose `org-link-preview-file' as the API function. Is this witho

Re: Link preview generation with new link preview property

2025-02-23 Thread Ihor Radchenko
Björn Bidar writes: >>> The thing that confused me, but I think I wasn't aware of not getting it >>> yesterday was that org--create-inline-image creates the actual image >>> object. I was thinking that the image object would have been created in the >>> handler and then passed to the helper funct

Re: Link preview generation with new link preview property

2025-01-21 Thread Björn Bidar
Ihor Radchenko writes: > Björn Bidar writes: > >> The thing that confused me, but I think I wasn't aware of not getting it >> yesterday was that org--create-inline-image creates the actual image >> object. I was thinking that the image object would have been created in the >> handler and then pa

Re: Link preview generation with new link preview property

2025-01-21 Thread Ihor Radchenko
Björn Bidar writes: > The thing that confused me, but I think I wasn't aware of not getting it > yesterday was that org--create-inline-image creates the actual image > object. I was thinking that the image object would have been created in the > handler and then passed to the helper function. Fe

Re: Link preview generation with new link preview property

2025-01-19 Thread Björn Bidar
Ihor Radchenko writes: > Björn Bidar writes: > >>> IMHO, it would be best to pass image file name/raw image data to >>> `org-link-preview-image-data', not an image object and call >>> `org--create-inline-image' from inside `org-link-preview-image-data'. >>> That way, we can automatically obey Or

Re: Link preview generation with new link preview property

2025-01-18 Thread Ihor Radchenko
Björn Bidar writes: >> IMHO, it would be best to pass image file name/raw image data to >> `org-link-preview-image-data', not an image object and call >> `org--create-inline-image' from inside `org-link-preview-image-data'. >> That way, we can automatically obey Org customization wrt image >> ali

Re: Link preview generation with new link preview property

2025-01-18 Thread Björn Bidar
Ihor Radchenko writes: > Björn Bidar writes: > >>> Both alignment and width are derived from LINK AST node. >>> I am not sure what is the problem. >>> AFAIU, Karthik is simply asking why you decided to calculate alignment >>> from LINK, but not width. >> >> My question was because the width is s

Re: Link preview generation with new link preview property

2025-01-04 Thread Ihor Radchenko
Björn Bidar writes: >> Both alignment and width are derived from LINK AST node. >> I am not sure what is the problem. >> AFAIU, Karthik is simply asking why you decided to calculate alignment >> from LINK, but not width. > > My question was because the width is set through the width of the inline

Re: Link preview generation with new link preview property

2025-01-03 Thread Björn Bidar
Ihor Radchenko writes: > Björn Bidar writes: > >>> It looks like you are respecting the alignment specifications, set via >>> org-image-align or the :align property of #+attr_*, but not the :width >>> property. Is the idea that the preview implementation that provides the >>> image should indep

Re: Link preview generation with new link preview property

2024-12-30 Thread Ihor Radchenko
Björn Bidar writes: >> It looks like you are respecting the alignment specifications, set via >> org-image-align or the :align property of #+attr_*, but not the :width >> property. Is the idea that the preview implementation that provides the >> image should independently use org-display-inline-

Re: Link preview generation with new link preview property

2024-12-29 Thread Björn Bidar
Karthik Chikmagalur writes: ... 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. >>> >>> Agree. >>> Would you be interested to create a patch? >> >> Did you thi

Re: Link preview generation with new link preview property

2024-12-26 Thread Karthik Chikmagalur
>>> ... >>> 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. >> >> Agree. >> Would you be interested to create a patch? > > Did you think of something like this? It looks li

Re: Link preview generation with new link preview property

2024-12-23 Thread Björn Bidar
Ihor Radchenko writes: > Karthik Chikmagalur writes: > ... 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. >>> >>> Agree. >>> Would you be interested to creat

Re: Link preview generation with new link preview property

2024-12-21 Thread Ihor Radchenko
Björn Bidar writes: > I'm also wondering how much could there be shared if the thing to be > displayed on the overlay isn't an image. > > The org-image--align function talks about images but ultimately > doesn't do anything specific to image. > I think the alignment the only part which is generic

Re: Link preview generation with new link preview property

2024-12-21 Thread Ihor Radchenko
Karthik Chikmagalur writes: >>> ... >>> 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. >> >> Agree. >> Would you be interested to create a patch? > > Ihor, did you write

Re: Link preview generation with new link preview property

2024-12-21 Thread Ihor Radchenko
Björn Bidar writes: > Anyway it would be a good improvement to include the org-mode api manual > with org-mode similar to how Emacs includes the Elisp manual. Maybe. But we need to write that org-element API manual first. The WORG page is not a manual. It's a mixture of API reference (partial) w

Re: Link preview generation with new link preview property

2024-12-19 Thread Karthik Chikmagalur
>> ... >> 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. > > Agree. > Would you be interested to create a patch? Ihor, did you write a patch for this already? I thought I s

Re: Link preview generation with new link preview property

2024-12-19 Thread Björn Bidar
Karthik Chikmagalur writes: >> 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. > > The API wi

Re: Link preview generation with new link preview property

2024-12-19 Thread Björn Bidar
Ihor Radchenko writes: > Karthik Chikmagalur writes: > >> ... >> 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. > > Agree. > Would you be interested to create a patch? Di

Re: Link preview generation with new link preview property

2024-12-19 Thread Björn Bidar
Ihor Radchenko writes: > Björn Bidar writes: > >>> This is expected. See >>> https://orgmode.org/worg/dev/org-element-api.html#org22c967a >>> You can access the contents by looking at buffer text between >>> :contents-begin and :contents-end. Either directly, or by invoking >>> sub-parser on th

Re: Link preview generation with new link preview property

2024-12-17 Thread Karthik Chikmagalur
> 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. The API will not be changed. Org will provide

Re: Link preview generation with new link preview property

2024-12-17 Thread stardiviner
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] GPG key ID: 47C32433 IRC(

Re: Link preview generation with new link preview property

2024-12-17 Thread Ihor Radchenko
Karthik Chikmagalur writes: > ... > 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. Agree. Would you be interested to create a patch? -- Ihor Radchenko // yantar92, Org mod

Re: Link preview generation with new link preview property

2024-12-17 Thread Ihor Radchenko
Björn Bidar writes: >> This is expected. See >> https://orgmode.org/worg/dev/org-element-api.html#org22c967a >> You can access the contents by looking at buffer text between >> :contents-begin and :contents-end. Either directly, or by invoking >> sub-parser on the text. > > Oh thanks, will look

Re: Link preview generation with new link preview property

2024-12-16 Thread Karthik Chikmagalur
>> 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 c

Re: Link preview generation with new link preview property

2024-12-16 Thread Björn Bidar
Ihor Radchenko writes: > Björn Bidar writes: > >> 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 funct

Re: Link preview generation with new link preview property

2024-12-13 Thread Ihor Radchenko
Björn Bidar writes: > 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--wid

Re: Link preview generation with new link preview property

2024-12-13 Thread Björn Bidar
Karthik Chikmagalur writes: >> The PR do port the package to this new handler property: >> https://github.com/gaoDean/org-remoteimg/pull/4 >> >> However it left me with a few questions: >> - Who is supposed to take care of the scaling/width of the preview >> image, the handler or the caller of

Re: Link preview generation with new link preview property

2024-12-12 Thread Karthik Chikmagalur
> The PR do port the package to this new handler property: > https://github.com/gaoDean/org-remoteimg/pull/4 > > However it left me with a few questions: > - Who is supposed to take care of the scaling/width of the preview > image, the handler or the caller of the handler? The handler is respons

Link preview generation with new link preview property

2024-12-08 Thread Björn Bidar
Hello, I have a few question regarding the new link preview handler property added recently. I ported the org-remoteimg package to it which was quite easy, much cleaner with the new property. The PR do port the package to this new handler property: https://github.com/gaoDean/org-remoteimg/pull/