aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJuri Linkov2008-07-29 16:36:42 +0000
committerJuri Linkov2008-07-29 16:36:42 +0000
commit5ec0c8924862df02c885656ed40cfb86d18152c0 (patch)
treea0f1e2b1381cfc713fd4db68fbe5060db538069f
parentc320e90a79d4b7e92aa091b1ed02d65dd388e54c (diff)
downloademacs-5ec0c8924862df02c885656ed40cfb86d18152c0.tar.gz
emacs-5ec0c8924862df02c885656ed40cfb86d18152c0.zip
(dired-do-async-shell-command): New command.
-rw-r--r--lisp/dired-aux.el20
1 files changed, 20 insertions, 0 deletions
diff --git a/lisp/dired-aux.el b/lisp/dired-aux.el
index 76f90cd4f82..87f99cade1c 100644
--- a/lisp/dired-aux.el
+++ b/lisp/dired-aux.el
@@ -490,6 +490,26 @@ FILES are affected."
490 (format prompt (dired-mark-prompt arg files)) 490 (format prompt (dired-mark-prompt arg files))
491 nil nil))) 491 nil nil)))
492 492
493;;;###autoload
494(defun dired-do-async-shell-command (command &optional arg file-list)
495 "Run a shell command COMMAND on the marked files asynchronously.
496
497Like `dired-do-shell-command' but if COMMAND doesn't end in ampersand,
498adds `* &' surrounded by whitespace and executes the command asynchronously.
499The output appears in the buffer `*Async Shell Command*'."
500 (interactive
501 (let ((files (dired-get-marked-files t current-prefix-arg)))
502 (list
503 ;; Want to give feedback whether this file or marked files are used:
504 (dired-read-shell-command "& on %s: " current-prefix-arg files)
505 current-prefix-arg
506 files)))
507 (unless (string-match "[*?][ \t]*\\'" command)
508 (setq command (concat command " *")))
509 (unless (string-match "&[ \t]*\\'" command)
510 (setq command (concat command " &")))
511 (dired-do-shell-command command arg file-list))
512
493;; The in-background argument is only needed in Emacs 18 where 513;; The in-background argument is only needed in Emacs 18 where
494;; shell-command doesn't understand an appended ampersand `&'. 514;; shell-command doesn't understand an appended ampersand `&'.
495;;;###autoload 515;;;###autoload