From: Tino Calancha Date: Mon, 26 Jun 2017 08:20:42 +0000 (+0900) Subject: Prefer `when' instead of 1-branch `if' X-Git-Tag: emacs-26.0.90~521^2~11^2~39 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=b9e17e2dc6ed81a32b3baca5d49dbde362477dbe;p=emacs.git Prefer `when' instead of 1-branch `if' * lisp/dired-aux.el (dired-do-shell-command): Store condition value in local variable ok. Use `when' instead of 1-branch `if'. --- diff --git a/lisp/dired-aux.el b/lisp/dired-aux.el index aede83e61cc..121bebeb651 100644 --- a/lisp/dired-aux.el +++ b/lisp/dired-aux.el @@ -707,29 +707,28 @@ can be produced by `dired-get-marked-files', for example." (let* ((on-each (not (string-match-p dired-star-subst-regexp command))) (no-subst (not (string-match-p dired-quark-subst-regexp command))) (star (string-match-p "\\*" command)) - (qmark (string-match-p "\\?" command))) - ;; Get confirmation for wildcards that may have been meant - ;; to control substitution of a file name or the file name list. - (if (cond ((not (or on-each no-subst)) - (error "You can not combine `*' and `?' substitution marks")) - ((and star on-each) - (y-or-n-p (format-message - "Confirm--do you mean to use `*' as a wildcard? "))) - ((and qmark no-subst) - (y-or-n-p (format-message - "Confirm--do you mean to use `?' as a wildcard? "))) - (t)) - (if on-each - (dired-bunch-files - (- 10000 (length command)) - (lambda (&rest files) - (dired-run-shell-command - (dired-shell-stuff-it command files t arg))) - nil - file-list) - ;; execute the shell command - (dired-run-shell-command - (dired-shell-stuff-it command file-list nil arg)))))) + (qmark (string-match-p "\\?" command)) + ;; Get confirmation for wildcards that may have been meant + ;; to control substitution of a file name or the file name list. + (ok (cond ((not (or on-each no-subst)) + (error "You can not combine `*' and `?' substitution marks")) + ((and star on-each) + (y-or-n-p (format-message + "Confirm--do you mean to use `*' as a wildcard? "))) + ((and qmark no-subst) + (y-or-n-p (format-message + "Confirm--do you mean to use `?' as a wildcard? "))) + (t)))) + (when ok + (if on-each + (dired-bunch-files (- 10000 (length command)) + (lambda (&rest files) + (dired-run-shell-command + (dired-shell-stuff-it command files t arg))) + nil file-list) + ;; execute the shell command + (dired-run-shell-command + (dired-shell-stuff-it command file-list nil arg)))))) ;; Might use {,} for bash or csh: (defvar dired-mark-prefix ""