I'm a beginner at elisp and I'd like your input on my strategy for writing some code for my org/org-roam setup.
I have a file called inbox.org, that I capture stuff into when I'm on the go (via Plain Org). It's structured like this:
#+title: Capture inbox
* First thing I captured
Some text
* Second thing I captured
etc
I also use the org-roam dailies feature, where I create a new daily note every day. My template for dailies looks like this:
#+title: %<%Y-%m-%d (%a)>
#+location: %(gt/daily-location)
#+weather: %(gt/daily-weather)
* Diary
(gt/daily-* are helper functions that I wrote, these basically run shell scripts and insert the output)
Here's what I would like to do: I want to add a new tree to my daily file called Inbox and move all the trees out of inbox.org into that tree in my daily file. Once that's done, I want my inbox.org to contain only its title (#+title: Capture inbox) and nothing else.
I have two ideas on how to do this:
Add another helper function call to my daily template, that will open
inbox.org, and return the raw contents. That's easy enough to do, but the formatting is messy: top level headers from my inbox file will be at the top level of my daily note as well, and not under theInboxtree as I would like.Hook into the
org-roam-dailies-find-file-hook, which is triggered whenever you open a daily file. In that case, I would have to somehow check if the daily file opened is for today, if it's just being created (rather than me coming back to it later, when I would not want to insert the contents ofinbox.org), etc.
The second option feels like the start of a cleaner solution, but I'm not sure how to proceed. Would anyone have any advice on how this could be accomplished?