branch: externals/window-commander
commit 902030f0a16b648988988d8531d7504812775f22
Author: Daniel Semyonov <[email protected]>
Commit: Daniel Semyonov <[email protected]>
Allow selection of minibuffer in defined win command by keyword arg
* NEWS: Update.
* wincom.el (wincom-define-window-command): Accept minibuffer argument
as keyword arg instead of positional arg.
(wincom-select): Switch to keyword arg.
---
NEWS | 2 ++
wincom.el | 18 ++++++++++++------
2 files changed, 14 insertions(+), 6 deletions(-)
diff --git a/NEWS b/NEWS
index cd2b70cacd..1ea870875a 100644
--- a/NEWS
+++ b/NEWS
@@ -5,6 +5,8 @@ See the end of the file for an explanation of the versioning
scheme.
** Rename to Window Commander.
** Remove functions and vars obsoleted in version 2.x.
+** Accept a ':minibuffer' keyword argument for 'wincom-define-window-command'
+instead of using a positional argument.
* 2.3
diff --git a/wincom.el b/wincom.el
index 8a9983dee4..fe20200cc5 100644
--- a/wincom.el
+++ b/wincom.el
@@ -334,16 +334,21 @@ window and the raw prefix argument, respectively.
If PREFIX is omitted or nil, the resulting command will not accept a
prefix argument.
-If MINIBUFFER is non-nil, allow the minibuffer to be selected by
+Currently, only a single KEYWORD-ARG is recognized, `:minibuffer':
+When it's non-nil, allow the minibuffer to be selected by
`next-window' (when there are less than `wincom-minimum' tracked windows).
For more information, see info node `(Window Commander) Window Commands'.
-\(fn NAME (WINDOW [PREFIX] [MINIBUFFER]) [DOCSTRING] BODY...)"
- (declare (debug (&define [&name symbolp] listp [&optional stringp] def-body))
+\(fn NAME (WINDOW [PREFIX]) [KEYWORD-ARG...] [DOCSTRING] BODY...)"
+ (declare (debug (&define name listp [&optional stringp]
+ def-body keywordp t))
(doc-string 3) (indent defun))
- (let* ((docstring (car body)) (window (car args))
- (prefix (cadr args)) (minibuffer (caddr args)))
+ (let* ((first (car body))
+ (minibuffer (and (eq first :minibuffer) (cadr body)))
+ (docstring (if (stringp first) first
+ (and minibuffer (caddr body))))
+ (window (car args)) (prefix (cadr args)))
`(defun ,name ,(and prefix `(,prefix))
,(when (stringp docstring) (format "%s
@@ -367,7 +372,8 @@ window command is chosen.
(funcall f (next-window nil (unless ,minibuffer 'exclude)
(wincom--get-scope)))))))
-(wincom-define-window-command wincom-select (window nil t)
+(wincom-define-window-command wincom-select (window)
+ :minibuffer t
"Select a window."
(select-window window))