aboutsummaryrefslogtreecommitdiffstats
path: root/doc
diff options
context:
space:
mode:
authorEli Zaretskii2008-10-20 19:47:54 +0000
committerEli Zaretskii2008-10-20 19:47:54 +0000
commita873ee3dea608126b079c08788855cd5b8ac3701 (patch)
treea0cc32cbfbf736ca2a122d608eb1f1d6958addaf /doc
parent403b14d14814050e45227206e8484200273c947a (diff)
downloademacs-a873ee3dea608126b079c08788855cd5b8ac3701.tar.gz
emacs-a873ee3dea608126b079c08788855cd5b8ac3701.zip
(Shell Arguments): Document `split-string-and-unquote' and
`combine-and-quote-strings'.
Diffstat (limited to 'doc')
-rw-r--r--doc/lispref/processes.texi37
1 files changed, 37 insertions, 0 deletions
diff --git a/doc/lispref/processes.texi b/doc/lispref/processes.texi
index 76916043987..9e6642143a5 100644
--- a/doc/lispref/processes.texi
+++ b/doc/lispref/processes.texi
@@ -194,6 +194,43 @@ a shell command:
194@end example 194@end example
195@end defun 195@end defun
196 196
197@cindex quoting and unquoting shell command line
198 The following two functions help creating shell commands from
199individual argument strings and taking shell command lines apart into
200individual arguments.
201
202@defun split-string-and-unquote string &optional separators
203This function splits @var{string} into substrings at matches for the
204regular expression @var{separators}, like @code{split-string} does
205(@pxref{Creating Strings}), but it additionally removes quoting from
206the substrings. It then makes a list of the substrings and returns
207it.
208
209If @var{separators} is omitted or nil, it defaults to @code{"\\s-+"},
210which is a regular expression that matches one or more characters with
211whitespace syntax (@pxref{Syntax Class Table}).
212
213The quoting this function supports is of 2 styles: by enclosing a
214whole string in double quotes @code{"@dots{}"}, or by quoting
215individual characters with a backslash escape @samp{\}. The latter is
216also used in Lisp strings, so this function can handle those as well.
217@end defun
218
219@defun combine-and-quote-strings list-of-strings &optional separator
220This function concatenates @var{list-of-strings} into a single string,
221quoting each string in the list that needs quoting as it goes. It
222also sticks the @var{separator} string in between each pair of strings
223in the result, and returns that result. If @var{separator} is omitted
224or @code{nil}, it defaults to a blank @code{" "}.
225
226The strings in @var{list-of-strings} that need quoting are those that
227include @var{separator} as their substring. Quoting a string encloses
228it in double quotes @code{"@dots{}"}. In the simplest case, if you
229are consing a shell command from the individual command-line
230arguments, every argument that includes embedded blanks will be
231quoted.
232@end defun
233
197@node Synchronous Processes 234@node Synchronous Processes
198@section Creating a Synchronous Process 235@section Creating a Synchronous Process
199@cindex synchronous subprocess 236@cindex synchronous subprocess