emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Should org-link-parser add type "file" when link has no "file:" prefix?
@ 2023-12-29  4:12 Joseph Turner
  2023-12-29 14:49 ` Ihor Radchenko
  0 siblings, 1 reply; 15+ messages in thread
From: Joseph Turner @ 2023-12-29  4:12 UTC (permalink / raw)
  To: emacs-orgmode; +Cc: Adam Porter

Hello!

I expect the following to return "[[/foobar]]":

(with-temp-buffer
  (delay-mode-hooks (org-mode))
  (insert "[[/foobar]]")
  (goto-char (point-min))
  (let ((link (org-element-link-parser)))
    (org-element-link-interpreter link nil)))

Instead, it returns "[[file:/foobar]]".

In hyperdrive.el currently, "[[/foobar]]" and "[[file:/foobar]]" have
different meanings: a link with no protocol prefix, like "[[/foobar]]",
points to a file inside of the same hyperdrive (virtual p2p folder),
whereas a link with the "file" protocol prefix, like "[[file:/foobar]]",
points to a file on the local filesystem:

https://git.sr.ht/~ushin/hyperdrive.el/tree/33d8cef0507fbbe25839a019b5c42fda862ac4de/item/hyperdrive-org.el#L137

In org-transclusion.el, org-element-context is used to parse a link, and
then org-element-link-interpreter is used to insert it into a buffer:

https://github.com/nobiot/org-transclusion/blob/b10d4de93c6c0523bd4e7e72c11ef3a9a5630370/org-transclusion.el#L372

The problem is that the "file" protocol prefix is added to links which
have no protocol prefix.  When you call org-transclusion-make-from-link
with point on "[[/foobar]]", org-transclusion.el ends up inserting this:

#+transclude: [[file:/foobar]]

which, at least with hyperdrive.el, doesn't point to the same file as

#+transclude: [[/foobar]]

All suggestions are welcome!

Thank you!!!

Joseph


^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2024-02-02 15:58 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-12-29  4:12 Should org-link-parser add type "file" when link has no "file:" prefix? Joseph Turner
2023-12-29 14:49 ` Ihor Radchenko
2023-12-29 22:05   ` Joseph Turner
2023-12-30 21:12     ` Joseph Turner
2023-12-31 15:07     ` Ihor Radchenko
2024-01-01  6:52       ` Joseph Turner
2024-01-02 13:20         ` Ihor Radchenko
2024-01-14  7:10           ` Joseph Turner
2024-01-16 13:40             ` Ihor Radchenko
2024-01-16 20:16               ` Joseph Turner
2024-01-17 13:15                 ` Ihor Radchenko
2024-01-31 22:10                   ` joseph
2024-02-01 12:23                     ` Ihor Radchenko
2024-02-02  4:35                       ` joseph
2024-02-02 16:01                         ` Ihor Radchenko

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).