I've been trying to find a solution for this for a few days, and I keep running into questions I can't seem to answer.
My eventual goal is to capture a daily note in org roam, either with a custom function, or with the default org-roam-dailies-capture-today-function. I would then like a link to this note to appear in a separate, unopened file.
I have managed to piece together a function that asks for two roam nodes and pastes a link to one into the other, without opening the file (I used org-roam-node-read to select nodes and save them to variables, then read ID, title, and file path from those variables, with append-to-file to paste the link). This function, hypothetically, does exactly what I want except that it prompts me for file names.
Ideally, I would be able to capture a daily note and have the link automatically appear in a predetermined file. Some issues I ran into while trying to implement this:
- There doesn't appear to be an applicable hook for capturing a daily note. I found org-roam-dailies-find-file-hook, which seems like it should work based on the help information - but when I tested it with an arbitrary function it just didn't do anything? (I used "(message "hello")", for what its worth).
- I couldn't find a way to get the node information for the current buffer. org-roam-node-read was literally all I could find, which returns the roam node variable exactly as I want, but it prompts the user for a file - I want to be able to run the command based on current buffer (or some other way to specify today's daily note).
- I couldn't find a way to programmatically execute the node-read command (I tried C-x M-: and it gave me "(eval-expression '(org-roam-node-read) nil nil 127)", which neither worked, nor changed when I chose other files.
I'm very confused. I'm sure I'm missing something obvious since it makes no sense for there to just not be a function to get the current node info, but I can't find anything even remotely useful online.
Edit: I managed to find org-roam-node-read--completions, which gives an alist made up of (what appears to be) pairs of hash tables for every node in the database. My latest thought is that I use elisp to make a string with the current date, then could search that list for a node name that matches that string. I've never worked with hash tables before though, and I'm not quite sure how i could even search the alist, since both elements in the alist pair appear to be hash tables (the first starts with "#(", which i'm not sure of, and the second starts with "#s(" which is definitely a hash table)