1 new commit in XEmacs:
https://bitbucket.org/xemacs/xemacs/changeset/965a9ddc915a/
changeset: 965a9ddc915a
user: matsl
date: 2012-10-13 01:09:35
summary: Introduce call-process-shell-command from GNU.
Thanks GNU. Used in recent versions of org-mode.
2012-10-13 Mats Lidell <matsl(a)xemacs.org>
* process.el (call-process-shell-command): New function from GNU.
2012-10-13 Mats Lidell <matsl(a)xemacs.org>
* lispref/processes.texi (Synchronous Processes): New function
call-process-shell-command.
2012-10-13 Mats Lidell <matsl(a)xemacs.org>
* automated/process-tests.el: Simple test cases for
call-process-shell-command.
affected #: 6 files
diff -r c6b1500299a7dc7c7fd5476d169a2478555dcf37 -r
965a9ddc915a9a300afedd57e4bd43d69ea4f2d0 lisp/ChangeLog
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,7 @@
+2012-10-13 Mats Lidell <matsl(a)xemacs.org>
+
+ * process.el (call-process-shell-command): New function from GNU.
+
2012-09-18 Mats Lidell <matsl(a)xemacs.org>
* window-xemacs.el (recenter-positions): New defcustom.
diff -r c6b1500299a7dc7c7fd5476d169a2478555dcf37 -r
965a9ddc915a9a300afedd57e4bd43d69ea4f2d0 lisp/process.el
--- a/lisp/process.el
+++ b/lisp/process.el
@@ -1,6 +1,6 @@
;;; process.el --- commands for subprocesses; split out of simple.el
-;; Copyright (C) 1985-7, 1993,4, 1997, 2011 Free Software Foundation, Inc.
+;; Copyright (C) 1985-7, 1993,4, 1997, 2011, 2012 Free Software Foundation, Inc.
;; Copyright (C) 1995, 2000, 2001, 2002 Ben Wing.
;; Author: Ben Wing
@@ -81,6 +81,34 @@
(start-process name buffer shell-file-name shell-command-switch
(mapconcat #'identity args " ")))
+(defun call-process-shell-command (command &optional infile buffer display
+ &rest args)
+ "Execute the shell command COMMAND synchronously in separate process.
+The remaining arguments are optional.
+The program's input comes from file INFILE (nil means `/dev/null').
+Insert output in BUFFER before point; t means current buffer;
+ nil for BUFFER means discard it; 0 means discard and don't wait.
+BUFFER can also have the form (REAL-BUFFER STDERR-FILE); in that case,
+REAL-BUFFER says what to do with standard output, as above,
+while STDERR-FILE says what to do with standard error in the child.
+STDERR-FILE may be nil (discard standard error output),
+t (mix it with ordinary output), or a file name string.
+
+Fourth arg DISPLAY non-nil means redisplay buffer as output is inserted.
+Remaining arguments are strings passed as additional arguments for COMMAND.
+Wildcards and redirection are handled as usual in the shell.
+
+If BUFFER is 0, `call-process-shell-command' returns immediately with value nil.
+Otherwise it waits for COMMAND to terminate and returns a numeric exit
+status or a signal description string.
+If you quit, the process is killed with SIGINT, or SIGKILL if you quit again."
+ ;; We used to use `exec' to replace the shell with the command,
+ ;; but that failed to handle (...) and semicolon, etc.
+ (call-process shell-file-name
+ infile buffer display
+ shell-command-switch
+ (mapconcat 'identity (cons command args) " ")))
+
(defun process-synchronize-point (proc)
"Set the point(s) in buffer and stderr-buffer according to the process
mark."
;; We need this because the documentation says to insert *BEFORE* point,
diff -r c6b1500299a7dc7c7fd5476d169a2478555dcf37 -r
965a9ddc915a9a300afedd57e4bd43d69ea4f2d0 man/ChangeLog
--- a/man/ChangeLog
+++ b/man/ChangeLog
@@ -1,3 +1,8 @@
+2012-10-13 Mats Lidell <matsl(a)xemacs.org>
+
+ * lispref/processes.texi (Synchronous Processes): New function
+ call-process-shell-command.
+
2012-09-18 Mats Lidell <matsl(a)xemacs.org>
* lispref/windows.texi (Vertical Scrolling): Added
diff -r c6b1500299a7dc7c7fd5476d169a2478555dcf37 -r
965a9ddc915a9a300afedd57e4bd43d69ea4f2d0 man/lispref/processes.texi
--- a/man/lispref/processes.texi
+++ b/man/lispref/processes.texi
@@ -309,6 +309,13 @@
@end smallexample
@end defun
+@defun call-process-shell-command command &optional infile destination display
&rest args
+This function executes the shell command @var{command} synchronously.
+The final arguments @var{args} are additional arguments to add at the
+end of @var{command}. The other arguments are handled as in
+@code{call-process}.
+@end defun
+
@node MS-DOS Subprocesses
@section MS-DOS Subprocesses
diff -r c6b1500299a7dc7c7fd5476d169a2478555dcf37 -r
965a9ddc915a9a300afedd57e4bd43d69ea4f2d0 tests/ChangeLog
--- a/tests/ChangeLog
+++ b/tests/ChangeLog
@@ -1,3 +1,8 @@
+2012-10-13 Mats Lidell <matsl(a)xemacs.org>
+
+ * automated/process-tests.el: Simple test cases for
+ call-process-shell-command.
+
2012-09-02 Aidan Kehoe <kehoea(a)parhasard.net>
* automated/regexp-tests.el:
diff -r c6b1500299a7dc7c7fd5476d169a2478555dcf37 -r
965a9ddc915a9a300afedd57e4bd43d69ea4f2d0 tests/automated/process-tests.el
--- a/tests/automated/process-tests.el
+++ b/tests/automated/process-tests.el
@@ -1,4 +1,4 @@
-;; Copyright (C) 2011 Free Software Foundation, Inc.
+;; Copyright (C) 2011, 2012 Free Software Foundation, Inc.
;; Author: Mats Lidell <matsl(a)xemacs.org>
;; Maintainer:
@@ -67,4 +67,18 @@
(with-current-buffer "Output buffer"
(goto-char (point-min))
(Assert (looking-at "foobar")))
-)
+ )
+
+;; call-process-shell-command
+(when (equal system-type 'linux)
+ (setenv "LANG" "C")
+
+ ;; Output one line
+ (Assert (= 0 (call-process-shell-command "echo hello")))
+
+ ;; Output to stderr but no error buffer
+ (Assert (= 0 (call-process-shell-command "echo -e \"barefoot\nfoobar\n\"
1>&2" nil "Output buffer")))
+ (with-current-buffer "Output buffer"
+ (goto-char (point-min))
+ (Assert (looking-at "barefoot\n")))
+ )
Repository URL:
https://bitbucket.org/xemacs/xemacs/
--
This is a commit notification from
bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
_______________________________________________
XEmacs-Patches mailing list
XEmacs-Patches(a)xemacs.org
http://lists.xemacs.org/mailman/listinfo/xemacs-patches