branch: externals/compat commit f74574e3e289a42e4eac62f8b5e1e66d371e29b4 Author: Daniel Mendler <m...@daniel-mendler.de> Commit: Daniel Mendler <m...@daniel-mendler.de>
Minor stylistic improvements --- compat-27.el | 11 +++++------ compat-28.el | 7 +++---- compat-29.el | 4 ++-- 3 files changed, 10 insertions(+), 12 deletions(-) diff --git a/compat-27.el b/compat-27.el index 672a1d0f8e..01af37dee5 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 e630e81c8c..7dcb4ed374 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 efba43304e..5d441a93e1 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)