[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] emacs/lisp simple.el
From: |
Juri Linkov |
Subject: |
[Emacs-diffs] emacs/lisp simple.el |
Date: |
Thu, 02 Jul 2009 22:47:53 +0000 |
CVSROOT: /sources/emacs
Module name: emacs
Changes by: Juri Linkov <jurta> 09/07/02 22:47:53
Modified files:
lisp : simple.el
Log message:
(async-shell-command): New command.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/emacs/lisp/simple.el?cvsroot=emacs&r1=1.988&r2=1.989
Patches:
Index: simple.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/simple.el,v
retrieving revision 1.988
retrieving revision 1.989
diff -u -b -r1.988 -r1.989
--- simple.el 13 Jun 2009 18:56:11 -0000 1.988
+++ simple.el 2 Jul 2009 22:47:52 -0000 1.989
@@ -2054,6 +2054,23 @@
(or hist 'shell-command-history)
args)))
+(defun async-shell-command (command &optional output-buffer error-buffer)
+ "Execute string COMMAND asynchronously in background.
+
+Like `shell-command' but if COMMAND doesn't end in ampersand, adds `&'
+surrounded by whitespace and executes the command asynchronously.
+The output appears in the buffer `*Async Shell Command*'."
+ (interactive
+ (list
+ (read-shell-command "Async shell command: " nil nil
+ (and buffer-file-name
+ (file-relative-name buffer-file-name)))
+ current-prefix-arg
+ shell-command-default-error-buffer))
+ (unless (string-match "&[ \t]*\\'" command)
+ (setq command (concat command " &")))
+ (shell-command command output-buffer error-buffer))
+
(defun shell-command (command &optional output-buffer error-buffer)
"Execute string COMMAND in inferior shell; display output, if any.
With prefix argument, insert the COMMAND's output at point.
- [Emacs-diffs] emacs/lisp simple.el,
Juri Linkov <=