branch: externals/window-commander
commit 84b5f5fc4b791159c4e5610fc8371f234693ef51
Author: Daniel Semyonov <[email protected]>
Commit: Daniel Semyonov <[email protected]>

    * window-commander.el (wincom-define-window-command): Fix keyword args
---
 window-commander.el | 29 +++++++++++++++++++++--------
 1 file changed, 21 insertions(+), 8 deletions(-)

diff --git a/window-commander.el b/window-commander.el
index 0c804e6ee7..bc178050f7 100644
--- a/window-commander.el
+++ b/window-commander.el
@@ -351,15 +351,14 @@ When it's non-nil, allow the minibuffer to be selected by
 
 For more information, see info node `(window-commander) Window Commands'.
 
-\(fn NAME (WINDOW [PREFIX]) [DOCSTRING] [KEYWORD-ARG...] BODY...)"
-  (declare (debug (&define name listp [&optional stringp]
-                           def-body keywordp t))
+\(fn NAME (WINDOW [PREFIX]) [DOCSTRING] [KEYWORD ARG]... BODY...)"
+  (declare (debug (&define name lambda-list [&optional stringp]
+                           [&rest (gate keywordp form)] def-body))
            (doc-string 3) (indent defun))
   (let* ((window (car args)) (prefix (cadr args))
-         (docstring (car body)) minibuffer)
-    (and (stringp docstring) (pop body))
-    (while-let (((keywordp (car body))) (form (pop body)))
-      (and (eq form :minibuffer) (setq minibuffer (car body))))
+         (docstring (car body))
+         (kargs (if (keywordp (car body)) body (cdr body)))
+         (minibuffer (plist-get kargs :minibuffer)))
     `(defun ,name ,(and prefix `(,prefix))
        ,(when (stringp docstring) (format "%s
 
@@ -378,7 +377,21 @@ window command is chosen.
        (interactive ,(and prefix "P"))
        (if-let ((f (lambda (,window)
                      ,@body))
-                ((>= wincom-window-count wincom-minimum)))
+                ((>= wincom-window-count
+                     ;; Raise the minimum by one if the current
+                     ;; command excludes the minibuffer and it's in scope.
+                     (if-let (((not ,minibuffer))
+                              (m (active-minibuffer-window))
+                              (c (window-frame m))
+                              (s wincom-scope)
+                              (v (or (frame-visible-p c) (eq s t)))
+                              ((or (eq s t)
+                                   (equal c (selected-frame))
+                                   (and (eq v 'icon) (eq s 0))
+                                   (and (eq v t)
+                                        (or (eq s 'visible) (eq s 0))))))
+                         (1+ wincom-minimum)
+                       wincom-minimum))))
            (wincom-run-window-command f)
          (funcall f (next-window nil (unless ,minibuffer 'exclude)
                                  (wincom--get-scope)))))))

Reply via email to