My elisp isn’t the best, so I would appreciate if someone could tell me what I’m doing wrong.
(defun buffer-exists (bufname doathing)
"Helper function to do something if bufname
exists and current buffer is org file."
(when (and (string-match "^.*\.org$"
(buffer-name)) (not (eq nil (get-buffer
bufname))))
(funcall doathing)))
(defun org-roam-backlinks ()
"Redisplays buffer as long as current buffer
is not *org-roam* and *org-roam* buffer exists"
(buffer-exists "*org-roam*"
'org-roam-buffer--redisplay-h))
(add-hook 'post-command-hook 'org-roam-backlinks)
org-roam-buffer-toggle: Launch an Org-roam buffer that tracks the node currently at point. This means that the content of the buffer changes as the point is moved, if necessary.
Just overriding org-roam-buffer--redisplay-h seems to do the job
(defun org-roam-buffer--redisplay-h ()
"Reconstruct the persistent `org-roam-buffer'.
This needs to be quick or infrequent, because this designed to
run at `post-command-hook'."
(and (get-buffer-window org-roam-buffer :all-frames) ;;<- just added an additional argument to `get-buffer-window'
(org-roam-buffer-persistent-redisplay)))
Unfortunately, no. org-roam-buffer-toggle does display *org-roam* and will refresh backlinks for a given node visited in a buffer in the same frame. Unless *org-roam* is present in both frames, it won’t work across frames, which seems kindof redundant. Really, I would just like the option to open a frame with a sole window just for backlinks. If I replace the above code with (org-roam-db-autosync-mode) it behaves the same way. Is this just expected behaviour for org-roam?
Edit: sorry, I didn’t see your reply. I’ll try that out.