Hello all,
I’m successfully using Roam, but have recently introduced a ~/dirB
that I currently use for separate work away from the ~/dirA
home mindset, and never the twain shall meet.
In the effort to allow profiles which do not exist to one another, I have enabled .dir-locals.el to point at ~/dirB
while I’m in it, and that’s working great so far, except for one thing. To get to a complete feature-set, I need to get org-roam-protocol capturing separated, but I can’t quite figure it out.
As some background there, when I use org-roam-capture-extension to the emacs-server and capture a link through the org-roam-protocol, it doesn’t seem to notice or obey any .dir-locals.el, no matter what I try.
Here’s what I thought might trivially work, if a bit ugly, but this does not work:
((nil . ((org-roam-directory . "~/dirB")
(org-roam-db-location . "~/dirB")
;; does NOT work below
(org-roam-capture-ref-templates .
'(("r" "ref" plain "* %U%\n%i) %?"
:target (file+head "~/dirB/web/${slug}.org"
"#+title: ${title}\n#+roam_key: ${ref}\n#+created: %U\n")
:unnarrowed t
:empty-lines-before 2)))
)))
Even restarting the emacs server while in the ~/dirB
fails.
The capture target and any dir-locals do not get updated within the emacs server, but it is critical to my workflow that I can navigate to a work file and set this “work mode” throughout all of the core Roam functionality, preferably via these .dir-locals.el
which have been working so far. If there’s some ELISP fanciness to let the server somehow can delegate to a local variable or function within the capture that could properly procure the correct local variable that might be all I need, but I haven’t found luck in my search to learn how to read from dir-locals within any capture templates.
Code may speak louder than words, so this is fine, if you can write current-org-roam-directory
:
:target (file+head "%(current-org-roam-directory)/web/${slug}.org"
Please offer any suggestions you might have which permit (a) org-roam-protocol to capture to different roam profiles based on where I have navigated to and (b) do not re-introduce work or home profiles to one another or introduce a second capture type – the extension only sends one capture type on one hotkey, which is the ideal workflow.