mirror of
https://github.com/org-roam/org-roam
synced 2025-08-01 12:17:21 -05:00
(feat): allow org-roam-buffer-position
to be a function (#1385)
Co-authored-by: Jethro Kuan <jethrokuan95@gmail.com>
This commit is contained in:
@ -64,11 +64,13 @@ Valid values are
|
||||
* left,
|
||||
* right,
|
||||
* top,
|
||||
* bottom."
|
||||
* bottom,
|
||||
* a function returning one of the above."
|
||||
:type '(choice (const left)
|
||||
(const right)
|
||||
(const top)
|
||||
(const bottom))
|
||||
(const bottom)
|
||||
function)
|
||||
:group 'org-roam)
|
||||
|
||||
(defcustom org-roam-buffer-width 0.33
|
||||
@ -293,14 +295,9 @@ Valid states are 'visible, 'exists and 'none."
|
||||
|
||||
(defun org-roam-buffer--get-create ()
|
||||
"Set up the `org-roam' buffer at `org-roam-buffer-position'."
|
||||
(let ((position
|
||||
(if (member org-roam-buffer-position '(right left top bottom))
|
||||
org-roam-buffer-position
|
||||
(let ((text-quoting-style 'grave))
|
||||
(lwarn '(org-roam) :error
|
||||
"Invalid org-roam-buffer-position: %s. Defaulting to \\='right"
|
||||
org-roam-buffer-position))
|
||||
'right)))
|
||||
(let ((position (if (functionp org-roam-buffer-position)
|
||||
(funcall org-roam-buffer-position)
|
||||
org-roam-buffer-position)))
|
||||
(save-selected-window
|
||||
(-> (get-buffer-create org-roam-buffer)
|
||||
(display-buffer-in-side-window
|
||||
|
Reference in New Issue
Block a user