Trouble Getting :prepend property to work in Org-Roam-Capture Template

Hi Everyone,

I’ve been happily using org-roam for nearly three years now, and one of the weirder uses I have put it to is to use the capture template for creating blog posts that all live in one big org file. I am not sure why, but it seems like the “:prepend” property on my capture template has stopped working as expected, and my attempts to work out why have been unsuccessful. I haven’t yet tried starting up emacs with a minimal config to see if the same problem shows up there, as I thought I’d make sure I wasn’t missing something stupid.

To lessen the chance that something else in my capture template was causing the issue, I created a “test” capture template with minimal features:

          ("t" "Test" plain "** ${title}\nI am trying to get the prepend property to work. %?"
           :target (file+head+olp "Undertakings/test.org"
                                  "#+title: ${title}\n"
                                  ("Main"))
           :prepend t)

Expected behavior is that a new entry will be created with the headline text of the expanded title, and that this entry will be placed as the first level 2 headline after the level 1 headline “Main.” Instead, I get the entry as the last entry, as I would expect without the prepend property.

Any thoughts on how to fix this, or what documentation to dig into besides the org-capture-templates and org-roam-capture-templates man pages would be most appreciated.

Thanks,
Jeff

It works on my end. See below – note the number on the right. First one (number 1) is at the bottom; the second (number 2) has been prepended.

I think there are three moving parts for capture:

  1. Org
  2. Org-roam
  3. Your config (including framework such as Doom)

2 has not changed for a long time (refer to history).

Perhaps 1? You might be on the bleeding edge commit of Org. Otherwise check your config and/or the framework you use.

My org version when I did this test is as follows:
Org mode version 9.6.3 (release_9.6.3-2-gf2949d @ /usr/local/share/emacs/29.0.90/lisp/org/)

Thanks very much, too bad it’s not the easy “you missed this one dumb thing” fix I hoped for!

I’m running Org version 9.5 via Straight.el as my package manager, and I have Emacs 28.0.5 .0 (9.0) for MacOs, and Org-Roam 2.0.0. Looks like I need to start wading into my config to see if I can isolate what’s going on here.

Thanks again for your help, I’ll post here when I workout what’s going on.

Before wading into your config, perhaps you might like to try emacs -q to see if it is somewhere in your installation?

Or… just to add to my previous comment, if the problem is the org version, simply upgrading it might solve your problem.

It is rather difficult to influence the behavior of prepend with configuration, so I suspect you might have gotten an unlucky commit?

Thank you! I updated my straight.el config to look for the direct org package (rather than MELPA), and I tweaked my org-roam config (use-package-straight 'org), where I had previously specified the branch “v2” (which I put in when the upgrade happened), but now I switched to :branch "Main". Something between those two seems to have fixed things, so thanks very much for suggesting the simple fix of updating.

1 Like