branch: externals/transient commit 91febebcc837d0d0d915a3ab7a421ae41376e6ad Author: Jonas Bernoulli <jo...@bernoul.li> Commit: Jonas Bernoulli <jo...@bernoul.li>
Use _ in all non-binding entries in the varlist of COND-let forms This was not done until now because doing so resulted in a warning because the macro expansion did not actually leave any variables unused. This was fixed in Emacs 30.1 and the previous commit backports that for older releases. Without consistently using `_' one would always have to count parens to be sure whether a member of the varlist does or does not bind a variable. It is very easy to make mistake when writing or reading such forms if `_' is not consistently used in the non-binding cases. --- lisp/transient.el | 64 +++++++++++++++++++++++++++---------------------------- 1 file changed, 32 insertions(+), 32 deletions(-) diff --git a/lisp/transient.el b/lisp/transient.el index a40217c8c0..347ede467b 100644 --- a/lisp/transient.el +++ b/lisp/transient.el @@ -1568,7 +1568,7 @@ Intended for use in a group's `:setup-children' function." suffix prefix loc "suffixes and groups cannot be siblings")) (t - (when-let* (((not (eq keep-other 'always))) + (when-let* ((_(not (eq keep-other 'always))) (bindingp (listp suf)) (key (transient--suffix-key suf)) (conflict (car (transient--locate-child prefix key))) @@ -2503,12 +2503,12 @@ value. Otherwise return CHILDREN as is.") (pcase-let* ((`[,class ,args ,children] spec) (level (or (plist-get args :level) transient--default-child-level))) - (and-let* (((transient--use-level-p level)) + (and-let* ((_(transient--use-level-p level)) (obj (apply class :parent parent :level level args)) - ((transient--use-suffix-p obj)) - ((prog1 t - (when (transient--inapt-suffix-p obj) - (oset obj inapt t)))) + (_(transient--use-suffix-p obj)) + (_(prog1 t + (when (transient--inapt-suffix-p obj) + (oset obj inapt t)))) (suffixes (mapcan (lambda (c) (transient--init-child levels c obj)) (transient-setup-children obj children)))) (progn @@ -2562,9 +2562,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) - (when-let* (((not (slot-boundp obj 'shortarg))) + (when-let* ((_(not (slot-boundp obj 'shortarg))) (argument (oref obj argument)) - ((stringp argument)) + (_(stringp argument)) (shortarg (transient--derive-shortarg argument))) (oset obj shortarg shortarg)) (unless (slot-boundp obj 'key) @@ -2647,9 +2647,9 @@ value. Otherwise return CHILDREN as is.") :inapt-if-derived :inapt-if-not-derived)))) (defun transient--load-command-if-autoload (cmd) - (when-let* (((symbolp cmd)) + (when-let* ((_(symbolp cmd)) (fn (symbol-function cmd)) - ((autoloadp fn))) + (_(autoloadp fn))) (transient--debug " autoload %s" cmd) (autoload-do-load fn))) @@ -3933,7 +3933,7 @@ prompt." (cl-defmethod transient-infix-set :after ((obj transient-argument) value) "Unset incompatible infix arguments." - (when-let* ((value) + (when-let* ((_ value) (val (transient-infix-value obj)) (arg (if (slot-boundp obj 'argument) (oref obj argument) @@ -3947,15 +3947,15 @@ prompt." (and (not (equal val arg)) (mapcan (apply-partially filter val) spec))))) (dolist (obj transient--suffixes) - (when-let* (((cl-typep obj 'transient-argument)) + (when-let* ((_(cl-typep obj 'transient-argument)) (val (transient-infix-value obj)) (arg (if (slot-boundp obj 'argument) (oref obj argument) (oref obj argument-format))) - ((if (equal val arg) - (member arg incomp) - (or (member val incomp) - (member arg incomp))))) + (_(if (equal val arg) + (member arg incomp) + (or (member val incomp) + (member arg incomp))))) (transient-infix-set obj nil))))) (defun transient-prefix-set (value) @@ -4142,13 +4142,13 @@ Append \"=\ to ARG to indicate that it is an option." ;;; Return (defun transient-init-return (obj) - (when-let* ((transient--stack) + (when-let* ((_ transient--stack) (command (oref obj command)) (suffix-obj (transient-suffix-object command)) - ((memq (if (slot-boundp suffix-obj 'transient) - (oref suffix-obj transient) - (oref transient-current-prefix transient-suffix)) - (list t 'recurse #'transient--do-recurse)))) + (_(memq (if (slot-boundp suffix-obj 'transient) + (oref suffix-obj transient) + (oref transient-current-prefix transient-suffix)) + (list t 'recurse #'transient--do-recurse)))) (oset obj return t))) ;;; Scope @@ -4690,15 +4690,15 @@ apply the face `transient-unreachable' to the complete string." (and (slot-boundp transient--prefix 'suffix-description) (funcall (oref transient--prefix suffix-description) obj))))) - (when-let* ((transient--docsp) - ((slot-boundp obj 'command)) + (when-let* ((_ transient--docsp) + (_(slot-boundp obj 'command)) (cmd (oref obj command)) - ((not (memq 'transient--default-infix-command - (function-alias-p cmd)))) + (_(not (memq 'transient--default-infix-command + (function-alias-p cmd)))) (docstr (ignore-errors (documentation cmd))) (docstr (string-trim (substring docstr 0 (string-match "\\.?\n" docstr)))) - ((not (equal docstr "")))) + (_(not (equal docstr "")))) (setq desc (format-spec transient-show-docstring-format `((?c . ,desc) (?s . ,docstr))))) @@ -4776,7 +4776,7 @@ apply the face `transient-unreachable' to the complete string." desc))) (cl-defmethod transient--get-face ((obj transient-suffix) slot) - (and-let* (((slot-boundp obj slot)) + (and-let* ((_(slot-boundp obj slot)) (face (slot-value obj slot))) (if (and (not (facep face)) (functionp face)) @@ -5073,11 +5073,11 @@ This is used when a tooltip is needed.") (summary) ((documentation command) (car (split-string (documentation command) "\n"))))) - ((stringp doc)) - ((not (equal doc - (car (split-string (documentation - 'transient--default-infix-command) - "\n")))))) + (_(stringp doc)) + (_(not (equal doc + (car (split-string (documentation + 'transient--default-infix-command) + "\n")))))) (when (string-suffix-p "." doc) (setq doc (substring doc 0 -1))) (if return