aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJuri Linkov2009-07-02 22:47:52 +0000
committerJuri Linkov2009-07-02 22:47:52 +0000
commitc945a962d9fcfb55dae2c9df2f419164258ba360 (patch)
tree46755fd4d8c60827b71167ddbd30d69259b89b98
parent6a013a4918b1103b15d8cecd73a56e7c06bf8fe2 (diff)
downloademacs-c945a962d9fcfb55dae2c9df2f419164258ba360.tar.gz
emacs-c945a962d9fcfb55dae2c9df2f419164258ba360.zip
(async-shell-command): New command.
-rw-r--r--lisp/simple.el17
1 files changed, 17 insertions, 0 deletions
diff --git a/lisp/simple.el b/lisp/simple.el
index 44d3ae5040d..0bdc21a75b0 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -2054,6 +2054,23 @@ to `shell-command-history'."
2054 (or hist 'shell-command-history) 2054 (or hist 'shell-command-history)
2055 args))) 2055 args)))
2056 2056
2057(defun async-shell-command (command &optional output-buffer error-buffer)
2058 "Execute string COMMAND asynchronously in background.
2059
2060Like `shell-command' but if COMMAND doesn't end in ampersand, adds `&'
2061surrounded by whitespace and executes the command asynchronously.
2062The output appears in the buffer `*Async Shell Command*'."
2063 (interactive
2064 (list
2065 (read-shell-command "Async shell command: " nil nil
2066 (and buffer-file-name
2067 (file-relative-name buffer-file-name)))
2068 current-prefix-arg
2069 shell-command-default-error-buffer))
2070 (unless (string-match "&[ \t]*\\'" command)
2071 (setq command (concat command " &")))
2072 (shell-command command output-buffer error-buffer))
2073
2057(defun shell-command (command &optional output-buffer error-buffer) 2074(defun shell-command (command &optional output-buffer error-buffer)
2058 "Execute string COMMAND in inferior shell; display output, if any. 2075 "Execute string COMMAND in inferior shell; display output, if any.
2059With prefix argument, insert the COMMAND's output at point. 2076With prefix argument, insert the COMMAND's output at point.