branch: externals/ace-window
commit 7e0777b39a93c68cb5218a30be3e8c2774bc0a3d
Author: Jack Kamm <[email protected]>
Commit: Oleh Krehel <[email protected]>
ace-window.el (ace-display-buffer): Add
Fixes #187
---
ace-window.el | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/ace-window.el b/ace-window.el
index 3a19324..9cde17f 100644
--- a/ace-window.el
+++ b/ace-window.el
@@ -613,6 +613,22 @@ Amend MODE-LINE to the mode line for the duration of the
selection."
(aw-select " Ace - Delete Other Windows"
#'delete-other-windows))
+;;;###autoload
+(defun ace-display-buffer (buffer alist)
+ "Make `display-buffer' and `pop-to-buffer' select using `ace-window'.
+See sample config for `display-buffer-base-action' and `display-buffer-alist':
+https://github.com/abo-abo/ace-window/wiki/display-buffer."
+ (let* ((aw-ignore-current (cdr (assq 'inhibit-same-window alist)))
+ (rf (cdr (assq 'reusable-frames alist)))
+ (aw-scope (cl-case rf
+ ((nil) 'frame)
+ (visible 'visible)
+ ((0 t) 'global))))
+ (unless (or (<= (length (aw-window-list)) 1)
+ (not aw-scope))
+ (window--display-buffer
+ buffer (aw-select "Ace - Display Buffer") 'reuse))))
+
(declare-function transpose-frame "ext:transpose-frame")
(defun aw-transpose-frame (w)
"Select any window on frame and `tranpose-frame'."