emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/window-commander a46fab04cd 168/170: Improve implementa


From: ELPA Syncer
Subject: [elpa] externals/window-commander a46fab04cd 168/170: Improve implementation of keywords in 'wincom-define-window-command'
Date: Wed, 28 Jun 2023 19:00:37 -0400 (EDT)

branch: externals/window-commander
commit a46fab04cdf20f60b7a81088667d79977df71ca3
Author: Daniel Semyonov <daniel@dsemy.com>
Commit: Daniel Semyonov <daniel@dsemy.com>

    Improve implementation of keywords in 'wincom-define-window-command'
    
    * wincom.el (wincom-define-window-command): Change order of docstring
    and keyword args, parse keyword args in a way which should make it
    easier to add more.
    (wincom-select): Switch placement of docstring and ':minibuffer'.
    * wincom.texi (Window commands): Update for changes.
---
 wincom.el   | 14 +++++++-------
 wincom.texi |  2 +-
 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/wincom.el b/wincom.el
index fe20200cc5..ad068da3a2 100644
--- a/wincom.el
+++ b/wincom.el
@@ -340,15 +340,15 @@ 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]) [KEYWORD-ARG...] [DOCSTRING] BODY...)"
+\(fn NAME (WINDOW [PREFIX]) [DOCSTRING] [KEYWORD-ARG...] BODY...)"
   (declare (debug (&define name listp [&optional stringp]
                            def-body keywordp t))
            (doc-string 3) (indent defun))
-  (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)))
+  (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))))
     `(defun ,name ,(and prefix `(,prefix))
        ,(when (stringp docstring) (format "%s
 
@@ -373,8 +373,8 @@ window command is chosen.
                                  (wincom--get-scope)))))))
 
 (wincom-define-window-command wincom-select (window)
-  :minibuffer t
   "Select a window."
+  :minibuffer t
   (select-window window))
 
 (wincom-define-window-command wincom-delete (window)
diff --git a/wincom.texi b/wincom.texi
index d62e373626..4faeacf719 100644
--- a/wincom.texi
+++ b/wincom.texi
@@ -303,7 +303,7 @@ active). It can be used to change the behavior of window 
commands (or
 display functions, @xref{ID display}).
 @end defvar
 
-@defmac wincom-define-window-command name (window [prefix] [minibuffer]) 
docstring body...
+@defmac wincom-define-window-command name (window [prefix]) [docstring] 
[keyword-arg...] body...
 Define NAME as a window command with DOCSTRING as its documentation
 string.  PREFIX (a symbol) is passed as an argument to the command
 (when not omitted or nil), with its value being the raw prefix



reply via email to

[Prev in Thread] Current Thread [Next in Thread]