orgmode
orgmode copied to clipboard
Support `olp` and `datetree` template targets.
Does this feature exist in Emacs orgmode core?
Yes
Orgmode link
Feature value
No response
Additional context
Currently, the template headline
option takes a string
and the first matching section is returned as the target. This section can be at any depth. However, if we have non-unique section headlines but unique paths, we may want to be able to target specific paths. The org manual refers to this as olp
in the link above.
Right now, it seem like all of the machinery is in place to support olp
quite easily. Instead of accepting a string
, headline
could accept string|string[]
and when matching, we could just follow the parent
pointers in Section
to check that the path matches.
For the datetree
feature, right now it is only possible to recreate a datetree
for every entry. That is, using templates, we could create entries that look like this:
* 2023
** 2023-02 February
*** 2023-02-23 Thursday
**** [2023-02-23 Thu 00:10] first entry
but the second entry using the same template will recreate the entire tree. Using datetree
as it is implemented in emacs, the second entry should be a sibling of the first entry (if it is created on the same date). This seems like it would be a bit trickier to support as the headlines are created on demand, but if the datetree
path partially exists for the current date, it only creates the part that does not exist yet and files the subtree under the appropriate existing section.
As an aside, it looks emacs implementation of datetree
contains a lot of redundant information, but this repeated information is quite useful for agenda views and archival purposes.