Hi!
I mainly see three use cases for capture:
- A: add a template to an existing predefined file,
- B: add a template to a new file,
- C: add a template to an existing random file.
I would say that org-capture / org-capture-templates fit great for A, and org-roam-capture / org-roam-capture-templates fit great for B, but I would expect org-roam-capture / org-roam-capture-templates to also fit for case C.
To be precise, I’d like to add some common sections to my roam files and I’d like to be able to capture directly to those sections. For example, if I find an interesting article Z about X but I would like to read it when dealing with X, I’d like to start a capture where I can select the node X, and then write some info about Z, so that it gets stored as:
* All about X
** X1
** X2
* Read it Later
** Y
** Z
My captured note here.
With M-x org-roam-capture
, I am asked for a node, and then for a template. But IMHO the documentation is not clear about how this case is managed. I can do some testing, but I wonder whether this case is considered, and how it is dealt with for the different :target
options.
For example, if I use the default template in an existing node it allows me to capture ‘plain’ at the start of the file just after the properties.
("d" "default" plain "%?"
:target (file+head "%<%Y%m%d%H%M%S>-${slug}.org" "#+title: ${title}\n")
:unnarrowed t)
This one seems to fit my case, using a nil
path, not to be used to create new files:
("r" "Read it later" entry "* %?"
:target (file+olp nil ("Read it later"))
:unnarrowed t)
However I’m allowed to use it with a new file and the error management does not look good.
Besides, it would make more sense to me first to select the template, and then to choose whether a new node or an existing node would be used. I figure out that at the moment org-roam is calling to org-capture
, so that’s not possible right now. This is something that would make org-protocol much more powerful. As a workaround for org-protocol, I can just open the node in Emacs and call org-capture
using then variable buffer-file-name
as file path in the template (org-capture: prompt for a target file - Emacs Stack Exchange).
To sum up,
- are the org-roam-capture-templates designed to be used in random files?
- in such case, do you think the documentation (both manual and variable doc) is clear enough about it?
- is there a nice way to define a ‘null path’ template that is not designed/allowed to be used for a new file?
- is there a nice way to use org-protocol to fill up an existing roam file with a ‘null path’ template?
Regards