(fix)capture: always trigger :if-new template for existing nodes#1807
(fix)capture: always trigger :if-new template for existing nodes#1807jethrokuan merged 3 commits intomasterfrom
Conversation
Previously, if org-roam-capture- would be triggered for an existing node it would just move the point to the beginning of the node, ignoring the target from the :if-new part of the template. This patch will now also run the :if-new part of the template for existing nodes, just like it does right now in case of daily templates (which happened to be never recognized as existing nodes during the capture process).
|
@jethrokuan This is already existing behavior for dailies, but I didn't realize that it doesn't work with the normal capture templates, so it fixes that. So for example, given the next template: ("pt" "Project note" entry
"* TODO %?"
:if-new (file+head+olp "%<%Y%m%d%H%M%S>-${slug}.org" "#+title: ${title}" ("Tasks"))
:unnarrowed t)and a similar template for daily, a daily template would properly keep create new TODO entry for existing "Tasks" heading given the same daily date, while in case of the normal capture it would do the next for a new node: And then running the same template for the same node would yield: I didn't notice any regression, but just in case would like to pass through your review. |
|
I was a little confused when you said "always trigger :if-new on existing nodes" because it sounds like the opposite of what |
Oh, I agree with all that. I think #1804 provides perfect opportunity to pull the trigger for the rename. My preference would be s/:if-new/:target, which would be also semantically (given |
Previously, if org-roam-capture- would be triggered for an existing node
it would just move the point to the beginning of the node, ignoring the
target from the :if-new part of the template.
This patch will now also run the :if-new part of the template for
existing nodes, just like it does right now in case of daily
templates (which happened to be never recognized as existing nodes
during the capture process).