aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTino Calancha2017-06-26 17:20:42 +0900
committerTino Calancha2017-06-26 17:20:42 +0900
commitb9e17e2dc6ed81a32b3baca5d49dbde362477dbe (patch)
treef5b1e9a02fbe6c7929d8aeaa7dccbc2a374c0196
parent6dd0462f5a67e8306eb8681cd02668810ce93a96 (diff)
downloademacs-b9e17e2dc6ed81a32b3baca5d49dbde362477dbe.tar.gz
emacs-b9e17e2dc6ed81a32b3baca5d49dbde362477dbe.zip
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'.
-rw-r--r--lisp/dired-aux.el45
1 files changed, 22 insertions, 23 deletions
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."
707 (let* ((on-each (not (string-match-p dired-star-subst-regexp command))) 707 (let* ((on-each (not (string-match-p dired-star-subst-regexp command)))
708 (no-subst (not (string-match-p dired-quark-subst-regexp command))) 708 (no-subst (not (string-match-p dired-quark-subst-regexp command)))
709 (star (string-match-p "\\*" command)) 709 (star (string-match-p "\\*" command))
710 (qmark (string-match-p "\\?" command))) 710 (qmark (string-match-p "\\?" command))
711 ;; Get confirmation for wildcards that may have been meant 711 ;; Get confirmation for wildcards that may have been meant
712 ;; to control substitution of a file name or the file name list. 712 ;; to control substitution of a file name or the file name list.
713 (if (cond ((not (or on-each no-subst)) 713 (ok (cond ((not (or on-each no-subst))
714 (error "You can not combine `*' and `?' substitution marks")) 714 (error "You can not combine `*' and `?' substitution marks"))
715 ((and star on-each) 715 ((and star on-each)
716 (y-or-n-p (format-message 716 (y-or-n-p (format-message
717 "Confirm--do you mean to use `*' as a wildcard? "))) 717 "Confirm--do you mean to use `*' as a wildcard? ")))
718 ((and qmark no-subst) 718 ((and qmark no-subst)
719 (y-or-n-p (format-message 719 (y-or-n-p (format-message
720 "Confirm--do you mean to use `?' as a wildcard? "))) 720 "Confirm--do you mean to use `?' as a wildcard? ")))
721 (t)) 721 (t))))
722 (if on-each 722 (when ok
723 (dired-bunch-files 723 (if on-each
724 (- 10000 (length command)) 724 (dired-bunch-files (- 10000 (length command))
725 (lambda (&rest files) 725 (lambda (&rest files)
726 (dired-run-shell-command 726 (dired-run-shell-command
727 (dired-shell-stuff-it command files t arg))) 727 (dired-shell-stuff-it command files t arg)))
728 nil 728 nil file-list)
729 file-list) 729 ;; execute the shell command
730 ;; execute the shell command 730 (dired-run-shell-command
731 (dired-run-shell-command 731 (dired-shell-stuff-it command file-list nil arg))))))
732 (dired-shell-stuff-it command file-list nil arg))))))
733 732
734;; Might use {,} for bash or csh: 733;; Might use {,} for bash or csh:
735(defvar dired-mark-prefix "" 734(defvar dired-mark-prefix ""