reddit / emacs

How do I create org-roam dailies with a template file?

Future-Fisherman · 2022-12-23 14:31
Hi, I have something like this in my doom emacs config.el file: (setq org-roam-dailies-capture-templates '(("d" "default" entry "* Section 1\n** Section 1.1\n* Section 2\n" :target (file+head "%<%Y-%m-%d>.org" "#+title: %<%Y-%m-%d>\n")))) And this will pre-write the **"\* Section 1\\n\*\* Section 1.1\\n\* Section 2\\n"** string into every new daily capture that I make. I would like to use a template file instead of this, so that every time I capture a daily it will pre-write whatever is in some "[template.org](https://template.org)" file. I have searched everywhere for an answer but I can't seem to find any. I appreciate any help
phr46 · 2022-12-23 14:53
(setq org-roam-dailies-capture-templates '(("d" "default" entry (file "~/template.org") :target (file+head "%<%Y-%m-%d>.org" "#+title: %<%Y-%m-%d>\n")))) This works for org-capture-templates too BTW. It's easy to miss in the middle of the big docs for these variables.
Future-Fisherman · 2022-12-23 15:01
I get the following error: Error running timer ‘org-reveal’: (wrong-type-argument number-or-marker-p nil)
phr46 · 2022-12-23 15:12
I don't use org-reveal, and it looks like it's for making slideshows. It shouldn't have anything to do with this. Are you getting this every time you try to make an org-roam capture? Does the capture fail to go through because of it?
Future-Fisherman · 2022-12-23 15:18
Yes, basically any command org-roam-dailies-capture will fail and not even open a file because of this error above..
phr46 · 2022-12-23 15:25
I don't know, it works fine for me. If I have a \~/template.org file, it works perfectly. If I remove the file, then the capture works but substitutes the text with "\* Template file \~/template.org not found" If I change the template file to not be an org entry, as in just a "hello" instead of "\* hello", then I get an error "Capture template 'd': Template is not a valid Org entry or tree" But I don't see the one you mentioned. It's got to be something else different in the config :(
Future-Fisherman · 2022-12-23 15:58
The problem was my template file. I just put something like "123" in it to test and it didn't work. When I changed it to "\* 123" it does work now
holmus-hiddyn · 2022-12-25 19:55
agh, thank you, this was driving me insane and I had no idea why I was seeing it