From f67500bfd21a28596c034eed446dc5cbfbe7e987 Mon Sep 17 00:00:00 2001 From: Jonas Bernoulli Date: Sat, 28 Sep 2024 15:45:26 +0200 Subject: [PATCH] Combine some conditionals --- lisp/transient.el | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/lisp/transient.el b/lisp/transient.el index b53ea3d..67d0399 100644 --- a/lisp/transient.el +++ b/lisp/transient.el @@ -1245,9 +1245,9 @@ commands are aliases for." (and (listp val) (not (eq (car val) 'lambda)))) (setq args (plist-put args key (macroexp-quote val)))) ((setq args (plist-put args key val))))))) - (unless (plist-get args :key) - (when-let ((shortarg (plist-get args :shortarg))) - (setq args (plist-put args :key shortarg)))) + (when-let* ((not (plist-get args :key)) + (shortarg (plist-get args :shortarg))) + (setq args (plist-put args :key shortarg))) (list 'list (or level transient--default-child-level) (macroexp-quote (or class 'transient-suffix)) @@ -2197,9 +2197,9 @@ value. Otherwise return CHILDREN as is." (cl-defmethod transient--init-suffix-key ((obj transient-argument)) (if (transient-switches--eieio-childp obj) (cl-call-next-method obj) - (unless (slot-boundp obj 'shortarg) - (when-let ((shortarg (transient--derive-shortarg (oref obj argument)))) - (oset obj shortarg shortarg))) + (when-let* ((not (slot-boundp obj 'shortarg)) + (shortarg (transient--derive-shortarg (oref obj argument)))) + (oset obj shortarg shortarg)) (unless (slot-boundp obj 'key) (if (slot-boundp obj 'shortarg) (oset obj key (oref obj shortarg)) @@ -4227,14 +4227,14 @@ manpage, then try to jump to the correct location." (defun transient--describe-function (fn) (describe-function fn) - (unless (derived-mode-p 'help-mode) - (when-let* ((buf (get-buffer "*Help*")) - (win (or (and buf (get-buffer-window buf)) - (cl-find-if (lambda (win) - (with-current-buffer (window-buffer win) - (derived-mode-p 'help-mode))) - (window-list))))) - (select-window win)))) + (when-let* (((not (derived-mode-p 'help-mode))) + (buf (get-buffer "*Help*")) + (win (or (and buf (get-buffer-window buf)) + (cl-find-if (lambda (win) + (with-current-buffer (window-buffer win) + (derived-mode-p 'help-mode))) + (window-list))))) + (select-window win))) (defun transient--show-manual (manual) (info manual))