I have a fairly complex journal template which I use with org-roam-dailies via org-roam-dailies-capture. For all intents and purposes, I am fairly certain you can just think of this as org-capture.

An issue is that this template includes interactive elements (like checkboxes) which I can't use while in the capture buffer. So my (acceptable) workaround is to capture, visit the heading, then subtree narrow to ignore other headers. Switching to the heading in a dedicated buffer is also desirable because I sometimes spend a lot of time in this template (it is a "planning" entry).

Is there a way to do this in an elisp function? I believe I must use the capture functionality provided to remain consistent with my other file+datetree-templated captures, but if someone can think of a workaround without using org-capture, I can update the title to reflect the answer.

  • Finishing the capture with C-u C-u C-c C-c will take you to the note you just added. You can then org-narrow-to-subtree with C-x n s.
    – NickD
    Commented Dec 19, 2023 at 17:01
  • Thank you for the pointer! I'm looking for a way to do this programmatically, but reviewing the org-capture page, I think one solution could be to finish the capture with some: (defun my/fin () (org-capture-finalize '(4)) (org-narrow-to-subtree)), but I think a better solution set up this finalizer for my specific template.
    – stites
    Commented Dec 20, 2023 at 1:25

1 Answer 1


Thanks to @NickD's suggestion, I found a way to do this.

In the capture templates you can add a :after-finalize function. To resolve the question, I was able to encode the steps @NickD pointed out in a lambda: (lambda () (interactive) (org-capture '(16)) (org-narrow-to-subtree))

Additionally, I added :immediate-finish t which automates all of the manual steps of my org-capture and brings me directly to a narrowed header.

("p" "plan" entry "~/org/daily.org"
  :target (file+datetree "* lots of planning stuff..." week)
  :immediate-finish t
  :after-finalize (lambda () (interactive) (org-capture '(16)) (org-narrow-to-subtree))

It's worth pointing out that I could not get :jump-to-captured working with :after-finalize org-narrow-to-subtree, even though this seemed like a cleaner solution.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.