Is it possible to use a capture template that can reference a variable once captured, so an author can be used for both the file name and text in the note?
Edit: Changed the code to use push instead of setf – the properties of the node (org-roam-node-properties) may not be nil if you are capturing to an existing node. I think we should use push to add to the list rather than set it anew.
I also changed the template org file – note author uses ${prop-name}, different from your original (not sure if the original way works – didn’t test).
* Source:
Author: ${author}
Title: ${title}
Basically, you can use your capture-template as is. Just add the method and change the org file.
The error seems to be suggesting that Emacs does not know about org-roam-node-properties. I cannot be certain from this error message alone. I don’t know how to repeoduce this error—the code just works now as it did before.
If my understanding is correct, then the error means that org-roam has not been loaded yet. The reason why I say this is because org-roam-node-properties is part of org-roam.
I suggest you test the code after you explicitly load org-roam (e.g. with M-x load-library).
Does this make sense to you? Do you know how to move forward?
Absolutely, this makes sense. As you mentioned, I am using doom emacs and am loading these in an (after! org) block, which likely is the difference. I have checked and explicitly loaded org-roam, org-roam-properties but still run into the same issue.
While working through this I did rewrite a new configuration which does work for me, so I’ll share it here if others are looking for similar functionality in the future. It does work slightly differently than described. It uses concatenation to dynamically generate titles/file names, the only awkward part is because I’m prompted for a node on capture, I have to arrow up so that none are selected before going to the template.
For this awkwardness, you might like to create your own command. This way you can skip the initial selection of a node / title. See below. You can evaluate this expression; it works on my end. I think you have the skill to adapt it.