mirror of
https://github.com/doomemacs/doomemacs
synced 2025-08-21 13:53:38 -05:00
refactor!(org): backlinks buffer management
BREAKING CHANGE: The +org-roam-open-buffer-on-find-file variable was renamed to +org-roam-auto-backlinks-buffer *and* is now disabled by default. When this is non-nil, it will open the *org-roam* backlinks side window when roam files are visible, and close it when they aren't. This change also makes this behavior a little more robust, but is understandably not everybody's (read: most people's) cup of tea, so it is now opt-in.
This commit is contained in:
@@ -66,6 +66,27 @@ If there's none, return an empty string."
|
||||
(directory-file-name dir)))
|
||||
|
||||
|
||||
;;
|
||||
;;; Hooks
|
||||
|
||||
;;;###autoload
|
||||
(defun +org-roam-manage-backlinks-buffer-h ()
|
||||
"Open or close roam backlinks buffer depending on visible org-roam buffers.
|
||||
|
||||
Intended to be added to `doom-switch-buffer-hook' in `org-roam-find-file-hook'.
|
||||
Controlled by `+org-roam-open-buffer-on-find-file'."
|
||||
(when (and +org-roam-auto-backlinks-buffer
|
||||
(not org-roam-capture--node) ; not for roam capture buffers
|
||||
(not org-capture-mode) ; not for capture buffers
|
||||
(not (bound-and-true-p +popup-buffer-mode)))
|
||||
(let ((visible-p (eq 'visible (org-roam-buffer--visibility))))
|
||||
(if (cl-some #'org-roam-buffer-p (doom-visible-buffers))
|
||||
(unless visible-p
|
||||
(org-roam-buffer-toggle))
|
||||
(when visible-p
|
||||
(org-roam-buffer-toggle))
|
||||
(unless (doom-buffers-in-mode 'org-mode)
|
||||
(remove-hook 'doom-switch-buffer-hook #'+org-roam-manage-backlinks-buffer-h))))))
|
||||
|
||||
|
||||
;;
|
||||
|
Reference in New Issue
Block a user