gnohz
1
I would like to add aliases in my template.
I tried “+roam_aliases:”, like this:
(setq org-roam-capture-templates
'(
;; other templates
("r" "ref" plain
"%?"
:if-new (file+head "./ref_notes/${slug}.org"
"#+title: ${title}\n#+roam_aliases: ${citekey}\n")
:unnarrowed t)))
But it was added outside the PROPERTY block. So the file cannot be found using “org-roam-node-find”.
nobiot
3
I suggest you try like Jethro does (adding the whole property drawer directly in the template) and see if this works for you…
nobiot
4
org-capture-fill-template: Wrong type argument: stringp, nil
is typically caused by missing closing parentheses.
Thanks for the reply. I use Shift+5 and rainbow-paranthesis to find the correct pairs. Seems OK to me.
Here is the snippet
("x" "test" plain
"\n* Source\nAuthor: %^{Author}\nTitle: ${title}\nDOI: [[https://doi.org/%^{DOI}][%\\2]]\n%?"
:if-new (file+head "%<%Y%m%d%H%M%S>-${slug}.org"
":PROPERTIES:
:ROAM_ALIASES: %\\2
:END:
#+title: ${title}
#+date: %U
#+filetags: X")
:unnarrowed t)
and here is the full org part including the snipped
(use-package org-roam
:init ; is called before the package is loaded
(setq org-roam-v2-ack t) ; do not show migration warning after startup
:custom
(org-roam-directory "~/tab-cloud/my.org-roam")
(org-roam-completion-everywhere t) ; use compleation-at-point NOT only
; between brackets
(org-roam-capture-templates ; Keep in mind: store that templates in .org
; files. Use (file "filename.org") for that.
'(
("d" "default" plain ; default incl. date
"%?"
:if-new (file+head "%<%Y%m%d%H%M%S>-${slug}.org"
"#+title: ${title}\n#+date: %U")
:unnarrowed t)
("x" "test" plain
"\n* Source\nAuthor: %^{Author}\nTitle: ${title}\nDOI: [[https://doi.org/%^{DOI}][%\\2]]\n%?"
:if-new (file+head "%<%Y%m%d%H%M%S>-${slug}.org"
":PROPERTIES:
:ROAM_ALIASES: %\\2
:END:
#+title: ${title}
#+date: %U
#+filetags: X")
:unnarrowed t)
("b" "Bibliographic notes" plain
"\n* Source\nAuthor: %^{Author}\nTitle: ${title}\nYear: %^{Year}\nDOI: [[https://doi.org/%^{DOI}][%\\3]]\n\n* Summary\n\n%?"
:if-new (file+head "%<%Y%m%d%H%M%S>-${slug}.org"
"#+title: ${title}\n#+date: %U\n#+filetags: Bib")
:unnarrowed t)
("p" "project" plain ; see +filetags
"* Goals\n\n%?\n\n* Tasks\n\n** TODO Add initial tasks\n\n* Dates\n\n"
:if-new (file+head "%<%Y%m%d%H%M%S>-${slug}.org" "#+title: ${title}\n#+filetags: Project")
:unnarrowed t)
("w" "Wiki" plain
"%?"
:if-new (file+head "%<%Y%m%d%H%M%S>-${slug}.org"
"#+title: ${title}\n#+date: %U\n#+filetags: Wiki")
:unnarrowed t)
("m" "Meta" plain
"* ${title}\nSammelbecken zum Thema\n%?"
:if-new (file+head "%<%Y%m%d%H%M%S>-${slug}.org"
"#+title: ${title}\n#+date: %U\n#+filetags: Meta")
:unnarrowed t)
)
)
:bind (("C-c n l" . org-roam-buffer-toggle)
("C-c n f" . org-roam-node-find)
("C-c n i" . org-roam-node-insert)
:map org-mode-map
("C-M-i" . completion-at-point)
;:map org-roam-dailies-map
;("Y" . org-roam-dailies-capture-yesterday) ; means "C-c n d Y"
;("T" . org-roam-dailies-capture-tomorrow)
)
;:bind-keymap
;("C-c n d" . org-roam-dailies-map)
:config
;(require 'org-roam-dailies)
; Show +FILETAG in node list
; https://github.com/org-roam/org-roam/commit/6f5d65abd9e707b3fdb10092a9fef3b739e143dd
(setq fill-prefix "") ;; see https://emacs.stackexchange.com/a/38943/12999
(setq org-roam-node-display-template
(concat "${title:*} "
(propertize "${tags:20}" 'face 'org-tag)))
(org-roam-db-autosync-mode)
)
1 Like