[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/helm ad5a61d42d: Change helm-window-show-buffers-function
|
From: |
ELPA Syncer |
|
Subject: |
[nongnu] elpa/helm ad5a61d42d: Change helm-window-show-buffers-function default value |
|
Date: |
Sat, 27 May 2023 02:00:55 -0400 (EDT) |
branch: elpa/helm
commit ad5a61d42d2ecaa940a4a4ada6d2fac0dedbd5c7
Author: Thierry Volpiatto <thievol@posteo.net>
Commit: Thierry Volpiatto <thievol@posteo.net>
Change helm-window-show-buffers-function default value
Use a new function that decide how to split according to number of
candidates.
---
helm-utils.el | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/helm-utils.el b/helm-utils.el
index 92c8ab0257..772a53bf3d 100644
--- a/helm-utils.el
+++ b/helm-utils.el
@@ -282,11 +282,13 @@ behavior is the same as with a nil value."
(const :tag "Split window horizontally" nil)
(symbol :tag "Guess how to split window" 'decide)))
-(defcustom helm-window-show-buffers-function #'helm-window-default-split-fn
+(defcustom helm-window-show-buffers-function #'helm-window-decide-split-fn
"The default function to use when opening several buffers at once.
It is typically used to rearrange windows."
:group 'helm-utils
:type '(choice
+ (function :tag "Decide how to split according to number of
candidates"
+ helm-window-decide-split-fn)
(function :tag "Split windows vertically or horizontally"
helm-window-default-split-fn)
(function :tag "Split in alternate windows"
@@ -346,6 +348,15 @@ If a prefix arg is given split windows vertically."
;; e.g. '("tab-bar.el" "*scratch*, helm-buffers.el").
thereis (member buffer-name (split-string name ", " t))))
+(defun helm-window-decide-split-fn (candidates &optional other-window-fn)
+ "Try to find the best split window fn according to the number of CANDIDATES."
+ (let ((fn (cond ((> (length candidates) 3)
+ #'helm-window-mosaic-fn)
+ ((> (length candidates) 2)
+ #'helm-window-alternate-split-fn)
+ (t #'helm-window-default-split-fn))))
+ (funcall fn candidates other-window-fn)))
+
(defun helm-window-default-split-fn (candidates &optional other-window-fn)
"Split windows in one direction and balance them.
| [Prev in Thread] |
Current Thread |
[Next in Thread] |
- [nongnu] elpa/helm ad5a61d42d: Change helm-window-show-buffers-function default value,
ELPA Syncer <=