I love org-roam!
In spacemacs (using org-roam v2), I open a “roam buffer” sidebar with org-roam-buffer-toggle
, which gives me the window with the backlinks on the right half of my frame – the left half containing the current org-roam node I’m looking at.
When I then hit RET on a link in the roam buffer sidebar on the right, that window changes to show the linked node I just navigated to instead of the roam buffer sidebar. The old node I was looking at is still there on the left. I expected it instead to replace the currently shown node in the window on the left with the linked node I just navigated to – so that the sidebar would just stay in the same place forever while the current node on the left updates as I navigate.
I tried in doom and for me it doesn’t replace the “roam buffer”, but seems to open a new window so I have three the first time I click on something in the sidebar (roam buffer sidebar on the right, old node top left, new node bottom left).
Looking at the definition of org-roam-node-visit
and edebug-defun
ing, I’m a little surprised that it ever does anything other than replace the sidebar with the new node if you just hit RET
: pop-to-buffer-same-window
gets used both in spacemacs and doom, and that function as I understand it is supposed to replace the current window (i.e. the sidebar), if possible. To be honest I’m scratching my head why anybody would ever want to replace the sidebar with the new node, either, but hey emacs users are a varied bunch.
I found I had to do this to get it to work as I expect:
(defun my-org-roam-node-visit ()
(interactive)
(org-roam-node-visit (org-roam-node-at-point t) t t))
(define-key org-roam-node-map [remap org-roam-buffer-visit-thing] 'my-org-roam-node-visit)
Digging a bit further in the emacs docs (for pop-to-buffer-same-window
), I think it might be that I’m supposed to “dedicate” the sidebar window to the roam buffer? It took me a very long time to get there! Seems like this would be a good thing to document? I’m still not sure exactly how I should configure this. Even if I did that, I’m not sure I’d get what I expected (maybe I’d get a third window like I got in doom?).
Incidentally, “roam buffer” seems not ideal as a term, since you might expect that to refer to any org buffer that you use with org-roam, not to the sidebar specifically. But that seems to be the only term that org-roam defines to refer to this functionality?