Autocreation of headlines in org-roam-dailies-capture-templates

Hi,
I was wondering if there’s a way to have the dailies capture auto-create the node specified in :olp if it’s missing?
I believe this feature would be doable in usual org-capture with the “file+headline” target.

I’m trying the example given in the docs, and getting an obvious “Heading not found on Level 1: Lab Notes”.

(setq org-roam-dailies-capture-templates
      '(("l" "lab" entry
         #'org-roam-capture--get-point
         "* %?"
         :file-name "daily/%<%Y-%m-%d>"
         :head "#+title: %<%Y-%m-%d>\n"
         :olp ("Lab notes"))

        ("j" "journal" entry
         #'org-roam-capture--get-point
         "* %?"
         :file-name "daily/%<%Y-%m-%d>"
         :head "#+title: %<%Y-%m-%d>\n"
         :olp ("Journal"))))

This should be the case since (feat): capture: create OLP if does not exist (#1270) · org-roam/org-roam@b1608bf · GitHub. Are you using a current enough version of org-roam?

Works on my machine (the setq part is copy and paste from your post above).

As @brab suggests, perhaps updating Org-roam might fix the issue?

Right, I’m using the MELPA version, which is at 1.2.3. Thanks a lot guys

One more question, what advantages does the dailies capture system convey vs the usual org capture?
I understand the need for a modification of it for the “find file” capture, but for the dailies I can’t really see what bonus we’re getting by using the tweaked template (at the expense of not getting free upgrades as Org does).

Edit: To answer my own question, the chief benifit is being able to add a one time header and use expansion in the filename

I am crafting my own way to work with Org and Org-roam so I cannot really answer this question.

I don’t really use various “capture” functions Org and Org-roam provide at the moment (still learning). I don’t use org-roam-dailies, but I find your use of it for lab notes fascinating (I’m not a lab scientist, so it’s just outsider curiosity).

I’m not sure what you mean by “at the expense of not getting free upgrades as Org does”, though. I’m using MELPA for most of my “third-party” packages including Org-roam, and I get free upgrades as they improve. I updates them regularly (weekly at least). Both Org-roam and Org have active on-going developments, at different paces. I see that Org-roam’s current pace is much faster than that of Org. Maybe it’s different if you use Org’s its own repository (I only use MELPA and the one I don’t need to explicitly set, GNU?).

You might be using MELPA Stable, if you say you are on Org-roam version 1.2.3. My Org-roam is on org-roam-20210128.1341 (updated on 28 January 2021); I got it from MELPA, not MELPA Stable.

but I find your use of it for lab notes fascinating (I’m not a lab scientist, so it’s just outsider curiosity).

Full disclosure, neither am I, at least not anymore :slight_smile: That’s just an example from the docs.

at the expense of not getting free upgrades as Org does

I meant to say that by “going their own way” with a custom capture template system, they will miss out on any additional features that are added to Org at a later date.

So for example, at the moment you have to use the “function” target in the template to deal with which file to actually capture into, which means you can’t use the builtin (to Org) feature of targeting a headline.

But, as the docs say, there is no way to do what they want using the usual org-capture syntax, so outside of upstreaming some improvements, there’s no real way to do what I want.

As it happens, I don’t at present, use any exotic org-capture targets that aren’t captured by the :olp paramter, so it’s fine.

I think now my primary concern is: I only want one capture key, spread across usual org capture templates, and the org roam dailies.

I think that seems doable with just a bit of hacking around though.

You might be using MELPA Stable, if you say you are on Org-roam version 1.2.3.

Aha, right you are, thanks for that.

New to Emacs, so I went for stable, but this is not the first time I’ve come across people saying they just use MELPA, maybe I’ll bump it up my package-archive-priorities list.

Thanks!

1 Like

Probably. That’s Emacs :wink:

Having been going along with Org-roam since its early days, I feel confident that if there is to be some future improvements in the upstream Org Mode relevant/overlapping with Org-roam, someone in the community will very likely create a PR to take advantage of them and align Org-roam with the upstream. At least for now.

Of course, this is not a guarantee; for now, though, Org-roam seems to be getting a lot of blessings from not just the author (Jethro), and maintainers (Jethro and Zaeph), but also other contributors with technical skills (see the commit history in the GitHub repo :tada:).

I could not help it. Here is my take on this: