diff options
| author | Eli Zaretskii | 2008-10-20 19:47:54 +0000 |
|---|---|---|
| committer | Eli Zaretskii | 2008-10-20 19:47:54 +0000 |
| commit | a873ee3dea608126b079c08788855cd5b8ac3701 (patch) | |
| tree | a0cc32cbfbf736ca2a122d608eb1f1d6958addaf /doc | |
| parent | 403b14d14814050e45227206e8484200273c947a (diff) | |
| download | emacs-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.texi | 37 |
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 | ||
| 199 | individual argument strings and taking shell command lines apart into | ||
| 200 | individual arguments. | ||
| 201 | |||
| 202 | @defun split-string-and-unquote string &optional separators | ||
| 203 | This function splits @var{string} into substrings at matches for the | ||
| 204 | regular expression @var{separators}, like @code{split-string} does | ||
| 205 | (@pxref{Creating Strings}), but it additionally removes quoting from | ||
| 206 | the substrings. It then makes a list of the substrings and returns | ||
| 207 | it. | ||
| 208 | |||
| 209 | If @var{separators} is omitted or nil, it defaults to @code{"\\s-+"}, | ||
| 210 | which is a regular expression that matches one or more characters with | ||
| 211 | whitespace syntax (@pxref{Syntax Class Table}). | ||
| 212 | |||
| 213 | The quoting this function supports is of 2 styles: by enclosing a | ||
| 214 | whole string in double quotes @code{"@dots{}"}, or by quoting | ||
| 215 | individual characters with a backslash escape @samp{\}. The latter is | ||
| 216 | also 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 | ||
| 220 | This function concatenates @var{list-of-strings} into a single string, | ||
| 221 | quoting each string in the list that needs quoting as it goes. It | ||
| 222 | also sticks the @var{separator} string in between each pair of strings | ||
| 223 | in the result, and returns that result. If @var{separator} is omitted | ||
| 224 | or @code{nil}, it defaults to a blank @code{" "}. | ||
| 225 | |||
| 226 | The strings in @var{list-of-strings} that need quoting are those that | ||
| 227 | include @var{separator} as their substring. Quoting a string encloses | ||
| 228 | it in double quotes @code{"@dots{}"}. In the simplest case, if you | ||
| 229 | are consing a shell command from the individual command-line | ||
| 230 | arguments, every argument that includes embedded blanks will be | ||
| 231 | quoted. | ||
| 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 |