I found that the templates hardcodes "@{citekey}" in property drawers, which might cause bad alignment if users already have other configs related to property drawers:
Would it better to use the function 'org-roam-ref-add' at the end of the (let-form) instead?
From:
(defun citar-org-roam--create-capture-note (citekey entry)
"Open or create org-roam node for CITEKEY and ENTRY."
;; adapted from https://jethrokuan.github.io/org-roam-guide/#orgc48eb0d
(let ((title (citar-format--entry
citar-org-roam-note-title-template entry)))
(org-roam-capture-
:templates
'(("r" "reference" plain "%?" :if-new
(file+head
;; REVIEW not sure the file name shoud be citekey alone.
"%(concat
(when citar-org-roam-subdir (concat citar-org-roam-subdir \"/\")) \"${citekey}.org\")"
":PROPERTIES:
:ROAM_REFS: @${citekey}
:END:
#+title: ${title}\n")
:immediate-finish t
:unnarrowed t))
:info (list :citekey citekey)
:node (org-roam-node-create :title title)
:props '(:finalize find-file))))
To
(defun citar-org-roam--create-capture-note (citekey entry)
"Open or create org-roam node for CITEKEY and ENTRY."
;; adapted from https://jethrokuan.github.io/org-roam-guide/#orgc48eb0d
(let ((title (citar-format--entry
citar-org-roam-note-title-template entry)))
(org-roam-capture-
:templates
'(("r" "reference" plain "%?" :if-new
(file+head
;; REVIEW not sure the file name shoud be citekey alone.
"%(concat
(when citar-org-roam-subdir (concat citar-org-roam-subdir \"/\")) \"${citekey}.org\")"
"#+title: ${title}\n")
:immediate-finish t
:unnarrowed t))
:info (list :citekey citekey)
:node (org-roam-node-create :title title)
:props '(:finalize find-file))
;; add citekey with builtin function for better alignment
(org-roam-ref-add (concat "@" citekey))))
https://github.com/emacs-citar/citar-org-roam/blob/7920084d53087b1dff26a6664bcafc4841271579/citar-org-roam.el#L187-L190
Hi Bruce, thanks for the great package.
I found that the templates hardcodes "@{citekey}" in property drawers, which might cause bad alignment if users already have other configs related to property drawers:
Would it better to use the function 'org-roam-ref-add' at the end of the (let-form) instead?
From:
To
Turns out better alignment:
Edit 1: rewording.
Best, Zheng