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

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

[nongnu] elpa/swsw 1411a6314c 116/146: * swsw.el (swsw--update-window):


From: ELPA Syncer
Subject: [nongnu] elpa/swsw 1411a6314c 116/146: * swsw.el (swsw--update-window): Use 'when-let' instead of 'let' and 'when'
Date: Wed, 25 May 2022 02:59:53 -0400 (EDT)

branch: elpa/swsw
commit 1411a6314c1a81b2a3bc63d410ee8ac43a78a93d
Author: Daniel Semyonov <daniel@dsemy.com>
Commit: Daniel Semyonov <daniel@dsemy.com>

    * swsw.el (swsw--update-window): Use 'when-let' instead of 'let' and 'when'
---
 swsw.el | 35 +++++++++++++++++------------------
 1 file changed, 17 insertions(+), 18 deletions(-)

diff --git a/swsw.el b/swsw.el
index c223610a75..4d2c06f3e1 100644
--- a/swsw.el
+++ b/swsw.el
@@ -184,24 +184,23 @@ If set to `lighter', use a mode line lighter."
 
 (defun swsw--update-window (window)
   "Update information for WINDOW."
-  (let ((id (if (window-minibuffer-p window)
-                (progn
-                  (setq swsw-window-count (1+ swsw-window-count))
-                  nil)
-              (swsw--next-id))))
-    (when id
-      ;; Create a key sequence from the ID, which corresponds to a
-      ;; command which calls the last command (with the corresponding
-      ;; window as the sole argument).
-      ;; This allows controlling which command is invoked when
-      ;; choosing an ID by setting `this-command' in a command which
-      ;; sets the transient map to `swsw--id-map'.
-      (define-key swsw--id-map (apply #'vector id)
-        `(lambda ()
-           (interactive)
-           (funcall last-command ,window)))
-      (set-window-parameter window 'swsw-id id)
-      (setq swsw-window-count (1+ swsw-window-count)))))
+  (when-let ((id (if (window-minibuffer-p window)
+                     (progn
+                       (setq swsw-window-count (1+ swsw-window-count))
+                       nil)
+                   (swsw--next-id))))
+    ;; Create a key sequence from the ID, which corresponds to a
+    ;; command which calls the last command (with the corresponding
+    ;; window as the sole argument).
+    ;; This allows controlling which command is invoked when
+    ;; choosing an ID by setting `this-command' in a command which
+    ;; sets the transient map to `swsw--id-map'.
+    (define-key swsw--id-map (apply #'vector id)
+      `(lambda ()
+         (interactive)
+         (funcall last-command ,window)))
+    (set-window-parameter window 'swsw-id id)
+    (setq swsw-window-count (1+ swsw-window-count))))
 
 (defun swsw--update (&optional _frame)
   "Update information for all windows."



reply via email to

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