Note that this does not affect `org-insert-link` (manually creating
links) where you can still opt for `file:`, `id:` or `denote:`. It only
affects the `org-store-link` system:
- When you call `org-store-link` manually (like you would call it from
an email viewer, a PDF file or elsewhere)
- When you call `org-capture` which uses the `org-store-link` system to
make the "origin" available to the capture template.
Hi,
Denote, uses the `denote:` link type internally.
This patch adds support for `org-store-link` of denote files meaning
that you can call `org-store-link` from a note and get a `denote:` link
instead of the current `file:` link.
The main benefit of a denote link is that it is resilient to renames,
etc. A file link would brake if the note was ever to be renamed.
As a side benefit, as `org-capture` uses `org-store-link` now you can
capture tasks on notes with resilient links!
This may seem related to `denote-link-use-org-id` though that one would
only work with orgmode notes (and, I think, as long as those were
withing `org-directory` when using `id:` links).
This should work with notes in any format, now `org-capture` works and
`org-store-link` too.
The reason I had not implemented this was that I was not sure about its
implications.
For example, a user may want to create a regular Org 'file:' link to a
Denote note from outside their 'denote-directory'. They have a
~/tasks.org where they maintain all their TODOs. Their notes are in
~/Documents/notes and they need to capture a TODO that is related to one
of their Org notes. Since the link will be written in ~/tasks.org only
the 'file:' link type will work. The 'denote:' link type works within
the 'denote-directory'.
The workflow you described is precisely mine:
Having `org-directory` and/or `org-agenda-files` set to something out of
`denote-directory`. And `denote-directory` not being inside any of
those: be able to follow `denote:` links.
Right now if I do `org-capture` to add a task on my tasks file I get
a `file:` link, this is the current behaviour of `org-store-link`
because it does not know any better.
But those links will break if the note is renamed (title or
keywords changed).
As far as I see the `denote:` link will work anywhere as
long as the *target* note is in `denote-directory`. This is because
`denote-link-ol-follow` does not really care about the link location,
only the target.
You can quickly check this by creating an org file inside /tmp or
elsewhere, call `org-insert-link`, insert a `denote:` link and follow it.
Bottom line: `denote:` links should (already) work regardless of where
the link is as long as the target note file is in `denote-directory`.
The main benefit would be that (I believe) most users will expect that
using org-capture from within a Denote note will create a "permanent"
link that does not break if the note title or keywords are changed.
Specially given that `denote:` link type exists, can be inserted and can
be followed and is what `denote-link` inserts.
Does anyone reading this has an opinion on the matter? Do you think
'M-x org-store-link' and, by extension, 'M-x org-capture' should always
store a 'denote:' link type when in the context of our notes? Or should
we keep the 'file:'?