[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/swsw dd9520bf53 1/2: Change some instances of 'if' and 'le
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/swsw dd9520bf53 1/2: Change some instances of 'if' and 'let' to use 'if-let' |
Date: |
Thu, 9 Jun 2022 02:59:06 -0400 (EDT) |
branch: elpa/swsw
commit dd9520bf53c5a45a67dbddf877da2ba217fb9b18
Author: Daniel Semyonov <daniel@dsemy.com>
Commit: Daniel Semyonov <daniel@dsemy.com>
Change some instances of 'if' and 'let' to use 'if-let'
* swsw.el (swsw--get-id-length, swsw--next-id, swsw-delete): Replace
'if' and 'let' combination with 'if-let'.
---
swsw.el | 23 ++++++++++++-----------
1 file changed, 12 insertions(+), 11 deletions(-)
diff --git a/swsw.el b/swsw.el
index 1739b79751..71ddc5bb06 100644
--- a/swsw.el
+++ b/swsw.el
@@ -167,9 +167,10 @@ If set to `lighter', use a mode line lighter."
(defun swsw--get-id-length ()
"Return the current length of a window ID."
- (let ((windows (length (window-list-1 nil nil (swsw--get-scope)))))
- (if (= windows 1) 1 ; If there is only one window, return 1.
- (ceiling (log windows (length swsw-id-chars))))))
+ (if-let ((windows (length (window-list-1 nil nil (swsw--get-scope))))
+ ((= windows 1)))
+ 1 ; If there is only one window, return 1.
+ (ceiling (log windows (length swsw-id-chars)))))
(defun swsw--next-id ()
"Get the next available ID."
@@ -315,9 +316,9 @@ This command is intended to be used only when swsw mode is
enabled."
(declare (modes swsw-mode)
(interactive-only t))
(interactive)
- (let ((window (active-minibuffer-window)))
- (if window (select-window window)
- (user-error "There is no active minibuffer window"))))
+ (if-let ((window (active-minibuffer-window)))
+ (select-window window)
+ (user-error "There is no active minibuffer window")))
(defun swsw-delete ()
"Start window deletion.
@@ -329,11 +330,11 @@ This command is intended to be used only when swsw mode
is enabled."
(declare (modes swsw-mode)
(interactive-only t))
(interactive)
- (if (< swsw-window-count 3)
- (let ((window (next-window nil nil (swsw--get-scope))))
- (unless (or (minibufferp (window-buffer window))
- (minibufferp)) ; Selected window.
- (delete-window window)))
+ (if-let (((< swsw-window-count 3))
+ (window (next-window nil nil (swsw--get-scope))))
+ (unless (or (minibufferp (window-buffer window))
+ (minibufferp)) ; Selected window.
+ (delete-window window))
(swsw-run-window-command #'delete-window)))
(defvar swsw-command-map