Karthik Chikmagalur <karthikchikmaga...@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>