[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v1] Inline image display as part of a new org-link-preview sy
From: |
Ihor Radchenko |
Subject: |
Re: [PATCH v1] Inline image display as part of a new org-link-preview system |
Date: |
Sat, 31 Aug 2024 16:53:57 +0000 |
Karthik Chikmagalur <karthikchikmagalur@gmail.com> writes:
>> We may simply pass the link object to :preview function.
>
> If we pass the link object instead of the overlay, it will be the
> preview function's job to create overlays as needed. This overlay
> should have special properties (like `org-image-overlay') for previewing
> to work correctly.
>
> Q: Is this okay? Or did you mean we can pass both the link and the
> overlay, like this:
>
> (funcall preview-func ov link)
>
> and let the previewer figure out the link type and path details?
No, I meant to pass link object in addition to other parameters:
(funcall preview-func ov path link)
We need to pass PATH because we use special rules to derive it. It is
not simply LINK :path property.
>>> * lisp/org-keys.el: Bind `C-c C-x C-v' to new command
>>> `org-link-preview', which has the same prefix arg behaviors as
>>> `org-latex-preview'.
>>
>> Didn't we discuss changes to the behavior?
>
> Yes, those changes have been implemented, please see the docstring for
> org-link-preview. The behavior is identical to that of
> org-latex-preview, but in addition the 1 and the 11 numeric prefix args
> are handled specially.
Then, the commit message is not accurate.
>>> + (if-let ((file-full
>>> + (if (equal "attachment" linktype)
>>> + (progn
>>> + (require 'org-attach)
>>> + (ignore-errors (org-attach-expand path)))
>>> + (expand-file-name path)))
>>
>> I'd rather put this part into org-attach, as a separate function that
>> calls `org-link-preview-file'.
>
> Q: I don't follow. Right now `org-link-preview-file' is the :preview
> org-link-parameter of file links and attachments. Could you explain how
> this indirection should work instead?
What I meant is that org-attach will define a custom
`org-attach-preview-file' function that will compute the filename, and
then internally call `org-link-preview-file'. Then, attachment: link
will have :preview set to `org-attach-preview-file'. This way, you will
not need to require org-attach from ol and ol from org-attach
simultaneously. (no cyclic dependencies, please)
--
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>
- Re: [PATCH v4.0] Re: [PATCH] add a function to only refresh inline images under current headline instead of global buffer, (continued)
- Re: [PATCH v4.0] Re: [PATCH] add a function to only refresh inline images under current headline instead of global buffer, Karthik Chikmagalur, 2024/08/19
- Re: [PATCH v4.0] Re: [PATCH] add a function to only refresh inline images under current headline instead of global buffer, Karthik Chikmagalur, 2024/08/20
- Re: [PATCH v4.0] Re: [PATCH] add a function to only refresh inline images under current headline instead of global buffer, Ihor Radchenko, 2024/08/20
- Re: [PATCH v4.0] Re: [PATCH] add a function to only refresh inline images under current headline instead of global buffer, Karthik Chikmagalur, 2024/08/20
- Re: [PATCH v4.0] Re: [PATCH] add a function to only refresh inline images under current headline instead of global buffer, Ihor Radchenko, 2024/08/22
- Re: [PATCH v4.0] Re: [PATCH] add a function to only refresh inline images under current headline instead of global buffer, Karthik Chikmagalur, 2024/08/23
- [PATCH v1] Inline image display as part of a new org-link-preview system, Karthik Chikmagalur, 2024/08/23
- Re: [PATCH v1] Inline image display as part of a new org-link-preview system, Karthik Chikmagalur, 2024/08/23
- Re: [PATCH v1] Inline image display as part of a new org-link-preview system, Ihor Radchenko, 2024/08/31
- Re: [PATCH v1] Inline image display as part of a new org-link-preview system, Karthik Chikmagalur, 2024/08/31
- Re: [PATCH v1] Inline image display as part of a new org-link-preview system,
Ihor Radchenko <=
- Re: [PATCH v2] Inline image display as part of a new org-link-preview system, Karthik Chikmagalur, 2024/08/31
- [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, 2024/08/18
- Message not available
- Re: [FR] Automatically display images in resutls of evaluation, Ihor Radchenko, 2024/08/22