Repository navigation
fix(links): Resolve bare file: paths from org file - #1198
Merged
Merged
Conversation
A file: link without a ./ prefix, like the ones Emacs writes, opened relative to the working directory instead of the directory of the org file. Org mode treats such a path as relative to the file that holds the link. Bare paths after file: now resolve like ./ paths. Links without the file: prefix are unchanged, since a bare link there is a headline search. The shared path helper keeps returning nothing for bare paths, because other callers rely on that. AI-assisted: Claude Code
kristijanhusak
approved these changes
Oct 12, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Relative
file:links written the way the Org manual writes them resolve against the wrong directory. Currently[[file:foo.org]]opensfoo.orgrelative to Neovim's working directory instead of the org file's directory. But the Org manual treatsfile:papers/last.pdfand./papers/last.pdfas the same link.get_file_pathpasses a bare path on unchanged, so Vim resolves it against the working directory. That is right for links withoutfile:, where a bare word is a headline search, butfile:links go through the same code.Bare
file:paths now get a./prefix before they resolve, as:tanglepaths already do.