emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Should org-link-parser add type "file" when link has no "file:" pref


From: Ihor Radchenko
Subject: Re: Should org-link-parser add type "file" when link has no "file:" prefix?
Date: Fri, 29 Dec 2023 14:49:31 +0000

Joseph Turner <joseph@ushin.org> writes:

> 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]]".

Thanks for reporting!
Fixed, on main.
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=d15e52fef

> 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:

I do not recommend such approach. From the point of view of most of the
Org mode code, it makes no difference whether file link has file: or
not. So, you may face unexpected issues.

It would be more reliable to provide a separate link type.
We might even extend the special file+application: link type syntax that
already allows special behavior for opening file links.

-- 
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>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]