[Emacs] Make org-roam-buffer work with frame-mode
This commit is contained in:
parent
05d4080f2c
commit
b3bbd07670
@ -3659,7 +3659,34 @@ alphanumeric characters only."
|
|||||||
(use-package emacsql-sqlite-builtin
|
(use-package emacsql-sqlite-builtin
|
||||||
:demand t)
|
:demand t)
|
||||||
(setq org-roam-database-connector 'sqlite-builtin))
|
(setq org-roam-database-connector 'sqlite-builtin))
|
||||||
(org-roam-db-autosync-mode +1))
|
(org-roam-db-autosync-mode +1)
|
||||||
|
|
||||||
|
(defun imalison:frames-displaying-buffer (buf)
|
||||||
|
"Return a list of frames in which BUF is displayed."
|
||||||
|
(let ((target-buffer (if (bufferp buf) buf (get-buffer buf))))
|
||||||
|
(if target-buffer
|
||||||
|
(delq nil
|
||||||
|
(mapcar (lambda (frame)
|
||||||
|
(if (get-buffer-window target-buffer frame)
|
||||||
|
frame))
|
||||||
|
(frame-list)))
|
||||||
|
nil)))
|
||||||
|
|
||||||
|
(defun imalison:org-roam-frame-based-buffer-visibility-fn ()
|
||||||
|
(cond
|
||||||
|
((--any (funcall frame-mode-is-frame-viewable-fn it)
|
||||||
|
(imalison:frames-displaying-buffer org-roam-buffer)) 'visible)
|
||||||
|
((get-buffer org-roam-buffer) 'exists)
|
||||||
|
(t 'none)))
|
||||||
|
|
||||||
|
(use-package frame-mode
|
||||||
|
:demand t
|
||||||
|
:config
|
||||||
|
(progn
|
||||||
|
(emit-variable-set-mode
|
||||||
|
imalison:org-roam-set-frame-visibility-mode
|
||||||
|
org-roam-buffer-visibility-fn 'imalison:org-roam-frame-based-buffer-visibility-fn)
|
||||||
|
(emit-make-mode-dependent imalison:org-roam-set-frame-visibility-mode frame-mode))))
|
||||||
:custom
|
:custom
|
||||||
(org-roam-directory (file-truename "~/org/roam/")))
|
(org-roam-directory (file-truename "~/org/roam/")))
|
||||||
#+end_src
|
#+end_src
|
||||||
|
Loading…
Reference in New Issue
Block a user