Open elsehow opened 3 years ago
Hi, I'm glad you like the package!
This is something that was possible by default in ORB <v0.6, when there was a separate variable orb-templates
. When upgrading ORB to support Org-roam v2 I decided to remove this variable and put ORB templates in org-roam-capture-templates
. I find this way to be more consistent with the overall design because ORB is an extension to Org-roam and just makes Org-roam templates BibTex aware. Moreover, it was always possible to use org-roam-capture-templates
for ORB, it's just that there was yet another templates variable around.
On the other hand, there is indeed very little sense in going through template selection again and again, especially if only one template is used for ORB. I'm well aware of it and I actually wanted to fix it quite some time ago. Unfortunately, I don't have time now to introduce new features and won't be able to work on it at least for the next 3 weeks. So it should probably wait. I will however gladly accept a pull request if you are willing to do it yourself. Please see this discussion for what I wanted to do.
Basically, the idea was to introduce some kind of a marker keyword in org-roam-capture-templates
to filter templates according to some context. For a full support of such a feature some changes need to be made in Org-roam, but ORB can easily do it's own filtering for just the case you described without the need for any upstream patches.
(setq org-roam-capture-templates
'(;; find node template
("d" "default" plain "%?" :if-new
(file+head "%<%Y%m%d%H%M%S>-${slug}.org" "#+title: ${title}\n")
:unnarrowed t)
;; dailies template
("r" "reference template" plain "* %?"
:if-new
(file+head "path/to/notes/${citekey}.org" "#+title: ${title}\n")
:type org-roam-bibtex))) ;; <= type marker
Makes perfect sense. Thanks for the thorough response. I'll have a crack at this if I ever have the time!
Hey @myshevchuk, I was thinking of implementing your :type
suggestion in Org-roam to get rid of the various different variables that hold capture templates, but it's not obvious how would then each extension supply its own default templates? Pushing on load would be a gamble, because the user may not want to have them. Checking for whether the matching key was occupied before pushing is still a bad idea, because the user can set their templates to a different key from the default one. Don't forget that org-roam-capture-templates
can be set before extensions are loaded.
I guess each extension that supplies capture templates can provide its own variable with a boolean value, e.g. org-roam-dailies-install-default-templates
and then conditionally react to it during the loading, but I'm not sure about that. Alternatively, Org-roam itself can provide something like this:
(defconst org-roam-capture-exclude-default-templates nil
...)
Where each value would be either, a corresponding :type
of the template or feature name (e.g. org-roam-dailies
, org-roam-bibtex
and so on), with a special value t
to get rid all of them. Extensions would then react on load to the state of this variable.
Do you happen to have better suggestions, that wouldn't be at the same time more complicated? If not, what's your preference? I'm leaning so far towards org-roam-capture-exclude-default-templates
, since that's something that you learn once and know how to deal, plus each extension wouldn't need to reimplement its own similar mechanism.
I still like the idea of allowing the selection of a default template. I use a single template for my notes created through org-roam-bibtex, and it would be nice not to have to select the template each time. Also, now we have to select the template even when opening a note that already exists.
Hi @Wetlize that's good news to hear. I fully agree that "unauthorized" pushing of the default template should be avoided while trying to guess what the user wants unless they tell it explicitly may be error-prone and unnecessarily complicated.
I like the idea of a single variable that would signal an extension whether it should load its templates. That's the simplest solution in this case. Org-roam doesn't even need to be aware of the extensions - this variable would just hold a list of symbols and each extension would than look up its own symbol. If it were up to me, I'd make it an including rather than excluding option, e.g. (defcustom org-roam-capture-load-default-templates t ...)
, but that's just a matter of taste of course.
Hi @jmburgos
Also, now we have to select the template even when opening a note that already exists.
Do you mean that when you use helm-bibtex
or similar to access a note that already exists, the note is not opened but instead a new capture is initiated? That's something that should not happen. Please share your config on Slack, I'll look into it.
Yes @myshevchuk, that is what is happening to me. I will post my config on Slack. Thank you for looking into this.
Thank you for this fantastic package!
Is your feature request related to a problem? Please describe.
I'm always frustrated when I insert a citation for which I have no notes, do
org-ref-open-notes-at-point
, and then have to specify which template to use for my org-roam-bibtex notes.Describe the solution you'd like
When I do
org-ref-open-notes-at-point
, I would like to create a new note with my specified org-roam-bibtex template.Describe alternatives you've considered I have considered hacking the
org-ref-open-notes-at-point
method, but it seems like a common enough issue that it ought to be supported.