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,
|
* left,
|
||||||
* right,
|
* right,
|
||||||
* top,
|
* top,
|
||||||
* bottom."
|
* bottom,
|
||||||
|
* a function returning one of the above."
|
||||||
:type '(choice (const left)
|
:type '(choice (const left)
|
||||||
(const right)
|
(const right)
|
||||||
(const top)
|
(const top)
|
||||||
(const bottom))
|
(const bottom)
|
||||||
|
function)
|
||||||
:group 'org-roam)
|
:group 'org-roam)
|
||||||
|
|
||||||
(defcustom org-roam-buffer-width 0.33
|
(defcustom org-roam-buffer-width 0.33
|
||||||
@ -293,14 +295,9 @@ Valid states are 'visible, 'exists and 'none."
|
|||||||
|
|
||||||
(defun org-roam-buffer--get-create ()
|
(defun org-roam-buffer--get-create ()
|
||||||
"Set up the `org-roam' buffer at `org-roam-buffer-position'."
|
"Set up the `org-roam' buffer at `org-roam-buffer-position'."
|
||||||
(let ((position
|
(let ((position (if (functionp org-roam-buffer-position)
|
||||||
(if (member org-roam-buffer-position '(right left top bottom))
|
(funcall org-roam-buffer-position)
|
||||||
org-roam-buffer-position
|
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)))
|
|
||||||
(save-selected-window
|
(save-selected-window
|
||||||
(-> (get-buffer-create org-roam-buffer)
|
(-> (get-buffer-create org-roam-buffer)
|
||||||
(display-buffer-in-side-window
|
(display-buffer-in-side-window
|
||||||
|
Reference in New Issue
Block a user