I would like all org-roam buffers to automatically go into a
org-roam-mode is a global minor mode, so I can't use that as a way to detect whether a new buffer is for org-roam.
I tried this:
(defun my/roam-buffer (_buffer state) (let ((name (buffer-file-name))) (when (and name (s-contains-p "/org-roam/" name)) (if (null state) 't state)))) (with-eval-after-load 'org-roam (setq org-roam-db-location (expand-file-name "~/.org-roam.sqlite")) (persp-def-auto-persp "org-roam" :parameters '((dont-save-to-file . t)) :predicate 'my/roam-buffer :dyn-env '(after-switch-to-buffer-functions ;; prevent recursion (persp-add-buffer-on-find-file nil) persp-add-buffer-on-after-change-major-mode) :hooks '(after-switch-to-buffer-functions) :switch 'frame))
nil. I'm guessing that's because initially when the buffer is created (again I'm guessing persp is hooking into that), it's not linked to a file yet?
How can I achieve what I want?