aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Mendler <mail@daniel-mendler.de>2023-01-21 10:43:45 +0100
committerDaniel Mendler <mail@daniel-mendler.de>2023-01-21 11:01:43 +0100
commitf74574e3e289a42e4eac62f8b5e1e66d371e29b4 (patch)
treee67d2d55eaec07ec91027b5a25bb7aaa9cfd5254
parentffb28c74428c77a2dce2513e70b04e79d9a10605 (diff)
Minor stylistic improvements
-rw-r--r--compat-27.el11
-rw-r--r--compat-28.el7
-rw-r--r--compat-29.el4
3 files changed, 10 insertions, 12 deletions
diff --git a/compat-27.el b/compat-27.el
index 672a1d0..01af37d 100644
--- a/compat-27.el
+++ b/compat-27.el
@@ -102,8 +102,8 @@ Letter-case is significant, but text properties are ignored."
((listp keymap)
(catch 'found
(dolist (map keymap)
- (let ((fn (lookup-key map key accept-default)))
- (when fn (throw 'found fn))))))
+ (when-let ((fn (lookup-key map key accept-default)))
+ (throw 'found fn)))))
((signal 'wrong-type-argument (list 'keymapp keymap)))))
;;;; Defined in timefns.c
@@ -322,10 +322,9 @@ that was current when the minibuffer was activated."
When used in a minibuffer window, select the window selected just before
the minibuffer was activated, and execute the forms."
(declare (indent 0) (debug t))
- `(let ((window (minibuffer-selected-window)))
- (when window
- (with-selected-window window
- ,@body))))
+ `(when-let ((window (minibuffer-selected-window)))
+ (with-selected-window window
+ ,@body)))
;;;; Defined in image.el
diff --git a/compat-28.el b/compat-28.el
index e630e81..7dcb4ed 100644
--- a/compat-28.el
+++ b/compat-28.el
@@ -506,10 +506,9 @@ as the new values of the bound variables in the recursive invocation."
sets))
(cons 'setq (apply #'nconc (nreverse sets)))))
(`(throw ',quit ,expr))))))
- (let ((tco-body (funcall tco (macroexpand-all (macroexp-progn body)))))
- (when tco-body
- (setq body `((catch ',quit
- (while t (let ,rargs ,@(macroexp-unprogn tco-body))))))))
+ (when-let ((tco-body (funcall tco (macroexpand-all (macroexp-progn body)))))
+ (setq body `((catch ',quit
+ (while t (let ,rargs ,@(macroexp-unprogn tco-body)))))))
(let ((expand (macroexpand-all (macroexp-progn body) (list (cons name macro)))))
(if total-tco
`(let ,bindings ,expand)
diff --git a/compat-29.el b/compat-29.el
index efba433..5d441a9 100644
--- a/compat-29.el
+++ b/compat-29.el
@@ -550,7 +550,7 @@ the symbol of the calling function, for example."
(file-attribute-modification-time fileattr))))
(sym (concat (symbol-name tag) "@" file))
(cachedattr (gethash sym file-has-changed-p--hash-table)))
- (when (not (equal attr cachedattr))
+ (unless (equal attr cachedattr)
(puthash sym attr file-has-changed-p--hash-table))))
;;;; Defined in keymap.el
@@ -1068,7 +1068,7 @@ command exists in this specific map, but it doesn't have the
(while defs
(setq key (pop defs))
(pop defs)
- (when (not (eq key :menu))
+ (unless (eq key :menu)
(if (member key seen-keys)
(error "Duplicate definition for key '%s' in keymap '%s'"
key variable-name)