diff --git a/dired-aux.el b/dired-aux.el index 1c10990..7f5775c 100644 --- a/dired-aux.el +++ b/dired-aux.el @@ -674,15 +674,22 @@ This normally reads using `read-shell-command', but if the offer a smarter default choice of shell command." (minibuffer-with-setup-hook (lambda () - (setq-local dired-aux-files files) - (setq-local minibuffer-default-add-function - #'minibuffer-default-add-dired-shell-commands)) + (setq-local dired-aux-files files) + (setq-local minibuffer-default-add-function + #'minibuffer-default-add-dired-shell-commands)) (setq prompt (format prompt (dired-mark-prompt arg files))) - (if (functionp 'dired-guess-shell-command) - (dired-mark-pop-up nil 'shell files - 'dired-guess-shell-command prompt files) - (dired-mark-pop-up nil 'shell files - 'read-shell-command prompt nil nil)))) + (let (command) + (setq command + (if (functionp 'dired-guess-shell-command) + (dired-mark-pop-up nil 'shell files + 'dired-guess-shell-command prompt files) + (dired-mark-pop-up nil 'shell files + 'read-shell-command prompt nil nil))) + (when (string-empty-p command) + (user-error "No command entered. Nothing to do!")) + (unless (executable-find command) + (user-error "Not a valid command!")) + command))) ;;;###autoload (defun dired-do-async-shell-command (command &optional arg file-list)