nvim-orgmode / nvim-orgmode/orgmode

Create orgfile links with relative paths (org-link-file-path-type)

Open
#1,114 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Lua
Stars
3.9k
Forks
190
Avg merge
2d 13h
Merged PRs (30d)
7

Description

Does this feature exist in Emacs orgmode core?

Yes

Orgmode link

org-link-file-path-type in ol.el - controls whether links created via org-store-link use relative or absolute file paths.

Additional context

org_store_link and get_link() always produce absolute file paths:

[[file:/home/user/notes/work.org::*My headline][My headline]]

Emacs has org-link-file-path-type to control this:

Value Behavior
adaptive (default) Relative for same/sub dirs, absolute otherwise
relative Always relative to current file
absolute Absolute with ~/

So linking between files in the same directory would give [[file:work.org::*My headline]] instead.

Back when we fixed relative link navigation (#583), we only covered the reading side. The writing side behind org_store_link still hardcodes absolute paths. A small helper in links/init.lua could apply the configured format before building the file: link.

I would like to have this for telescope-orgmode's insert-link. I could work around it downstream, but since it's part of Emacs orgmode core it makes sense to have it here. Happy to do a PR.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in links/init.lua, especially org_store_link and get_link, and compare their current absolute-path behavior with Emacs org-link-file-path-type. Verify that generated file links follow the adaptive, relative, and absolute settings, including files in the same directory.

Written by the indexing model from the issue text.

Assessment

Tech stack
lua, neovim
Domain
tooling
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.