Is it possible to have nested capture keys? for example, if you want to create a capture template for programming (p): python(pp), c(pc), ruby (pr), etc. I know this can be done in orgmode but not sure if it is possible for org-roam.
Thanks
Is it possible to have nested capture keys? for example, if you want to create a capture template for programming (p): python(pp), c(pc), ruby (pr), etc. I know this can be done in orgmode but not sure if it is possible for org-roam.
Thanks
Yes, it’s possible. Org-roam-capture-templates are just an extension to Org-capture-templates.
Thank you. Is this shown in the manual on how to do this? Can you please point an example?
Yes, evaluate this expression: (info "(Org)Template elements")
. Also consult the docstring C-h v org-capture-templates
.
(setq org-roam-capture-templates
'(("d" "default" ...)
("p" "Programming")
("pp" "python" ...)
("pc" "c" ...)
("pr" "r" ...)
...etc...))
You define the group as a list of two elements (KEY NAME)
, then define actual templates as usual using a two-letter sequence for the key.
Thank you. I set it similar to my orgmode capture template and was getting all sorts of error which prompted me to post the question. I will read the docstring and try again. Thanks for your time.
Here is another example showing daily templates. You can see that I have some key bindings for various customer meetings. I have the customers organized alphabetically so when I have two customers that share the first few characters I create a deeper nest.
See wmcdir
(work, meeting customer, d (first letter of customer name), i (second letter of customer name), r (capture tempalte for customer starting with dir). The trick is that you have to have an entry for each branch point. So I have wm
for work meetings and wmc
for Customer (under work meetings) and wmcd
for work meetings for customers that start with the letter d.
(setq org-roam-dailies-capture-templates
`(
("j" "Journal" entry
"* %?"
:if-new (file+head ,(expand-file-name "journal/%<%Y-%m-%d>.org" org-roam-dailies-directory)
"#+title: %<%A, %B %d %Y>")
:clock-in nil
:clock-resume nil
)
("w" "Work" )
("wl" "Log" entry
"* %?"
:if-new (file+head ,(expand-file-name "work/%<%Y-%m-%d>.org" org-roam-dailies-directory)
"#+title: Work log for %<%Y-%m-%d>")
:clock-in t
:clock-resume t
)
("we" "Email" entry
"* Respond to %:fromname Re: %:subject\n%a\n#+begin_quote\n %i\n#+end_quote\n\n%?"
:if-new (file+head ,(expand-file-name "work/%<%Y-%m-%d>.org" org-roam-dailies-directory)
"#+title: Work log for %<%Y-%m-%d>")
:clock-in t
:clock-resume t
)
("wm" "Work Meetings")
("wmc" "Customer")
("wmca" "A" plain
(file "~/org/roam/daily/my-company/meetings/customer/TEMPLATE")
:if-new (file+head ,(expand-file-name "my-company/meetings/customer/A/%<%Y-%m-%d>.org" org-roam-dailies-directory)
"#+PROPERTY: CUSTOMER A\n#+PROPERTY: MAIL_TO My Team <my@team.tld>\n#+PROPERTY: MAIL_SUBJECT Meeting notes: Customer Sync w/ A\n#+PROPERTY: MAIL_FROM Nick Anderson <nick@cmdln.org>\n#+title: Customer Sync with A %<%A, %B %d, %Y>\n#+filetags: :CFEngine:customer_meeting:customer:\n")
:unnarrowed t
:append t
)
("wmcd" "D")
("wmcdi" "i")
("wmcdir" "Dirasto" plain
(file "~/org/roam/daily/my-company/meetings/customer/TEMPLATE")
:if-new (file+head ,(expand-file-name "my-company/meetings/customer/Dirasto/%<%Y-%m-%d>.org" org-roam-dailies-directory)
"#+PROPERTY: CUSTOMER Dirasto\n#+PROPERTY:\nMAIL_TO: My Team <my@team.tld>\n#+PROPERTY: MAIL_SUBJECT Meeting notes: Customer Sync w/ Dirasto\n#+PROPERTY: MAIL_FROM Nick Anderson <nick@cmdln.org>\n#+title: Customer Sync with Dirasto %<%A, %B %d, %Y>\n#+filetags: :customer_meeting:customer:\n")
:unnarrowed t
:append t
)
("wmcdis" "District Five" plain
(file "~/org/roam/daily/my-company/meetings/customer/TEMPLATE" )
:if-new (file+head ,(expand-file-name "my-company/meetings/customer/District_Five/%<%Y-%m-%d>.org" org-roam-dailies-directory)
"#+PROPERTY: CUSTOMER District Five\n#+PROPERTY:\n MAIL_TO: Team <my@team.tld>\n#+PROPERTY: MAIL_SUBJECT Meeting notes: Customer Sync w/ District Five\n#+PROPERTY: MAIL_FROM Nick Anderson <nick@cmdln.org>\n#+title: Customer Sync with District Five %<%A, %B %d, %Y>\n#+filetags: ::customer_meeting:customer:\n")
:unnarrowed t
:append t
))