Cursor placed at the start of the last header line prevents use of templates
iod-ine opened this issue · 3 comments
When a new note is created, the cursor is placed at the beginning of the line with the last entry in the YAML header. With the default config for a template markdown note, which in my Doom setup looks like
(setq org-roam-capture-templates
'(("d" "default" plain
""
:target (file+head "${slug}.md"
"---\ntitle: ${title}\nid: %<%Y-%m-%dT%H%M%S>\ncategory: #draft\n---\n")
:immediate-finish t
:unnarrowed t)))
the new note is opened like this:
When I try to use a template instead of an empty string either using a single string
(setq org-roam-capture-templates
'(("d" "default" plain
"- `Relevant notes`\n\n# ${title}\n\n%?\n\n*Reference (Author, Date)*"
:target (file+head "${slug}.md"
"---\ntitle: ${title}\nid: %<%Y-%m-%dT%H%M%S>\ncategory: #draft\n---\n")
:immediate-finish t
:unnarrowed t)))
or a template file with the same content as that string
(setq org-roam-capture-templates
'(("d" "default" plain
(file "~/Documents/Slip-box/Templates/Zettel.md")
:target (file+head "${slug}.md"
"---\ntitle: ${title}\nid: %<%Y-%m-%dT%H%M%S>\ncategory: #draft\n---\n")
:immediate-finish t
:unnarrowed t)))
the content is inserted at this cursor position like this:
Note how within this incorrectly inserted template the cursor is positioned as expected at the %?
.
With plain org-roam templates defined like this work fine. Sorry if this is a misconfiguration on my part, I am very new to Emacs.
I have just realized that the problem is in the :immediate-finish t
.
So problem solved for you? It’s not part of Md-roam and I don’t have a problem. Not sure what I can do to help you…