diff options
| author | Chong Yidong | 2012-04-15 15:28:01 +0800 |
|---|---|---|
| committer | Chong Yidong | 2012-04-15 15:28:01 +0800 |
| commit | e6fd457e010c2ec034a331335530d817852cc11c (patch) | |
| tree | 4c290ef2537450fca8200b57dc11dc5443c40b1c /doc/lispref | |
| parent | 75f1671a5240bf2833fc473900b662135509ed72 (diff) | |
| parent | 467a33d09f0e6d445fb020013ac65b12adffc35e (diff) | |
| download | emacs-e6fd457e010c2ec034a331335530d817852cc11c.tar.gz emacs-e6fd457e010c2ec034a331335530d817852cc11c.zip | |
Merge from emacs-24 branch
Diffstat (limited to 'doc/lispref')
| -rw-r--r-- | doc/lispref/ChangeLog | 20 | ||||
| -rw-r--r-- | doc/lispref/anti.texi | 18 | ||||
| -rw-r--r-- | doc/lispref/processes.texi | 145 |
3 files changed, 112 insertions, 71 deletions
diff --git a/doc/lispref/ChangeLog b/doc/lispref/ChangeLog index 6b3aba6d799..b5a25cb1c51 100644 --- a/doc/lispref/ChangeLog +++ b/doc/lispref/ChangeLog | |||
| @@ -1,3 +1,23 @@ | |||
| 1 | 2012-04-15 Glenn Morris <rgm@gnu.org> | ||
| 2 | |||
| 3 | * processes.texi (Processes, Subprocess Creation, Shell Arguments): | ||
| 4 | (Synchronous Processes, Asynchronous Processes, Deleting Processes): | ||
| 5 | Copyedits. | ||
| 6 | (Subprocess Creation): Discourage modifying exec-path directly. | ||
| 7 | (Synchronous Processes, Asynchronous Processes): | ||
| 8 | Update some example output. | ||
| 9 | (Process Information): Fix typo. | ||
| 10 | (Bindat Spec): Use Texinfo-recommended form of quote+punctuation. | ||
| 11 | |||
| 12 | 2012-04-15 Glenn Morris <rgm@gnu.org> | ||
| 13 | |||
| 14 | * anti.texi (Antinews): Copyedits. Don't @dfn anything here. | ||
| 15 | open-network-stream does exist in Emacs 23, but is simpler. | ||
| 16 | |||
| 17 | 2012-04-15 Chong Yidong <cyd@gnu.org> | ||
| 18 | |||
| 19 | * customize.texi (Custom Themes): Also document load-theme etc. | ||
| 20 | |||
| 1 | 2012-04-14 Chong Yidong <cyd@gnu.org> | 21 | 2012-04-14 Chong Yidong <cyd@gnu.org> |
| 2 | 22 | ||
| 3 | * customize.texi (Applying Customizations): | 23 | * customize.texi (Applying Customizations): |
diff --git a/doc/lispref/anti.texi b/doc/lispref/anti.texi index 0e3c9eadeae..59f8f91c855 100644 --- a/doc/lispref/anti.texi +++ b/doc/lispref/anti.texi | |||
| @@ -65,9 +65,9 @@ Emacs windows now have most of their internal state hidden from Lisp. | |||
| 65 | Internal windows are no longer visible to Lisp; functions such as | 65 | Internal windows are no longer visible to Lisp; functions such as |
| 66 | @code{window-parent}, window parameters related to window arrangement, | 66 | @code{window-parent}, window parameters related to window arrangement, |
| 67 | and window-local buffer lists have all been removed. Functions for | 67 | and window-local buffer lists have all been removed. Functions for |
| 68 | resizing windows can delete windows if when they become too small. | 68 | resizing windows can delete windows if they become too small. |
| 69 | 69 | ||
| 70 | The @dfn{action function} feature for controlling buffer display has | 70 | The ``action function'' feature for controlling buffer display has |
| 71 | been removed, including @code{display-buffer-overriding-action} and | 71 | been removed, including @code{display-buffer-overriding-action} and |
| 72 | related variables, as well as the @var{action} argument to | 72 | related variables, as well as the @var{action} argument to |
| 73 | @code{display-buffer} and other functions. The way to | 73 | @code{display-buffer} and other functions. The way to |
| @@ -80,7 +80,7 @@ variables. | |||
| 80 | The standard completion interface has been simplified, eliminating the | 80 | The standard completion interface has been simplified, eliminating the |
| 81 | @code{completion-extra-properties} variable, the @code{metadata} | 81 | @code{completion-extra-properties} variable, the @code{metadata} |
| 82 | action flag for completion functions, and the concept of | 82 | action flag for completion functions, and the concept of |
| 83 | @dfn{completion categories}. Lisp programmers may now find the choice | 83 | ``completion categories''. Lisp programmers may now find the choice |
| 84 | of methods for tuning completion less bewildering, but if a package | 84 | of methods for tuning completion less bewildering, but if a package |
| 85 | finds the streamlined interface insufficient for its needs, it must | 85 | finds the streamlined interface insufficient for its needs, it must |
| 86 | implement its own specialized completion feature. | 86 | implement its own specialized completion feature. |
| @@ -123,17 +123,19 @@ an additional @var{cache} entry in their definitions, like this: | |||
| 123 | The @var{cache} entry is used internally by Emacs to record equivalent | 123 | The @var{cache} entry is used internally by Emacs to record equivalent |
| 124 | keyboard key sequences for invoking the same command; Lisp programs | 124 | keyboard key sequences for invoking the same command; Lisp programs |
| 125 | should never use it. | 125 | should never use it. |
| 126 | @c Not really NEWS-worthy then... | ||
| 126 | 127 | ||
| 127 | @item | 128 | @item |
| 128 | The @code{open-network-stream} function has been removed, and so has | 129 | The @code{gnutls} library has been removed, and the function |
| 129 | the @code{gnutls} library. Lisp programs that want an encrypted | 130 | @code{open-network-stream} correspondingly simplified. |
| 130 | network connection must now call external utilities such as | 131 | Lisp programs that want an encrypted network connection must now call |
| 131 | @command{starttls} or @command{gnutls-cli}. | 132 | external utilities such as @command{starttls} or @command{gnutls-cli}. |
| 132 | 133 | ||
| 133 | @item | 134 | @item |
| 134 | Tool bars can no longer display separators, which frees up several | 135 | Tool bars can no longer display separators, which frees up several |
| 135 | pixels of space on each graphical frame. | 136 | pixels of space on each graphical frame. |
| 136 | 137 | ||
| 137 | @item | 138 | @item |
| 138 | Many other functions and variables have been eliminated. | 139 | As part of the ongoing quest for simplicity, many other functions and |
| 140 | variables have been eliminated. | ||
| 139 | @end itemize | 141 | @end itemize |
diff --git a/doc/lispref/processes.texi b/doc/lispref/processes.texi index ce5cfd12c87..5a08fc9711e 100644 --- a/doc/lispref/processes.texi +++ b/doc/lispref/processes.texi | |||
| @@ -22,7 +22,7 @@ subprocess, the Lisp program waits for the subprocess to terminate | |||
| 22 | before continuing execution. When you create an asynchronous | 22 | before continuing execution. When you create an asynchronous |
| 23 | subprocess, it can run in parallel with the Lisp program. This kind of | 23 | subprocess, it can run in parallel with the Lisp program. This kind of |
| 24 | subprocess is represented within Emacs by a Lisp object which is also | 24 | subprocess is represented within Emacs by a Lisp object which is also |
| 25 | called a ``process.'' Lisp programs can use this object to communicate | 25 | called a ``process''. Lisp programs can use this object to communicate |
| 26 | with the subprocess or to control it. For example, you can send | 26 | with the subprocess or to control it. For example, you can send |
| 27 | signals, obtain status information, receive output from the process, or | 27 | signals, obtain status information, receive output from the process, or |
| 28 | send input to it. | 28 | send input to it. |
| @@ -69,7 +69,9 @@ a program. One of them, @code{start-process}, creates an asynchronous | |||
| 69 | process and returns a process object (@pxref{Asynchronous Processes}). | 69 | process and returns a process object (@pxref{Asynchronous Processes}). |
| 70 | The other two, @code{call-process} and @code{call-process-region}, | 70 | The other two, @code{call-process} and @code{call-process-region}, |
| 71 | create a synchronous process and do not return a process object | 71 | create a synchronous process and do not return a process object |
| 72 | (@pxref{Synchronous Processes}). | 72 | (@pxref{Synchronous Processes}). There are various higher-level |
| 73 | functions that make use of these primitives to run particular types of | ||
| 74 | process. | ||
| 73 | 75 | ||
| 74 | Synchronous and asynchronous processes are explained in the following | 76 | Synchronous and asynchronous processes are explained in the following |
| 75 | sections. Since the three functions are all called in a similar | 77 | sections. Since the three functions are all called in a similar |
| @@ -103,16 +105,19 @@ system-dependent. | |||
| 103 | 105 | ||
| 104 | @strong{Please note:} The argument @var{program} contains only the | 106 | @strong{Please note:} The argument @var{program} contains only the |
| 105 | name of the program; it may not contain any command-line arguments. You | 107 | name of the program; it may not contain any command-line arguments. You |
| 106 | must use @var{args} to provide those. | 108 | must use a separate argument, @var{args}, to provide those, as |
| 109 | described below. | ||
| 107 | 110 | ||
| 108 | Each of the subprocess-creating functions has a @var{buffer-or-name} | 111 | Each of the subprocess-creating functions has a @var{buffer-or-name} |
| 109 | argument which specifies where the standard output from the program will | 112 | argument that specifies where the standard output from the program will |
| 110 | go. It should be a buffer or a buffer name; if it is a buffer name, | 113 | go. It should be a buffer or a buffer name; if it is a buffer name, |
| 111 | that will create the buffer if it does not already exist. It can also | 114 | that will create the buffer if it does not already exist. It can also |
| 112 | be @code{nil}, which says to discard the output unless a filter function | 115 | be @code{nil}, which says to discard the output unless a filter function |
| 113 | handles it. (@xref{Filter Functions}, and @ref{Read and Print}.) | 116 | handles it. (@xref{Filter Functions}, and @ref{Read and Print}.) |
| 114 | Normally, you should avoid having multiple processes send output to the | 117 | Normally, you should avoid having multiple processes send output to the |
| 115 | same buffer because their output would be intermixed randomly. | 118 | same buffer because their output would be intermixed randomly. |
| 119 | For synchronous processes, you can send the output to a file instead | ||
| 120 | of a buffer. | ||
| 116 | 121 | ||
| 117 | @cindex program arguments | 122 | @cindex program arguments |
| 118 | All three of the subprocess-creating functions have a @code{&rest} | 123 | All three of the subprocess-creating functions have a @code{&rest} |
| @@ -121,18 +126,16 @@ supplied to @var{program} as separate command line arguments. Wildcard | |||
| 121 | characters and other shell constructs have no special meanings in these | 126 | characters and other shell constructs have no special meanings in these |
| 122 | strings, since the strings are passed directly to the specified program. | 127 | strings, since the strings are passed directly to the specified program. |
| 123 | 128 | ||
| 124 | The subprocess gets its current directory from the value of | ||
| 125 | @code{default-directory} (@pxref{File Name Expansion}). | ||
| 126 | |||
| 127 | @cindex environment variables, subprocesses | 129 | @cindex environment variables, subprocesses |
| 128 | The subprocess inherits its environment from Emacs, but you can | 130 | The subprocess inherits its environment from Emacs, but you can |
| 129 | specify overrides for it with @code{process-environment}. @xref{System | 131 | specify overrides for it with @code{process-environment}. @xref{System |
| 130 | Environment}. | 132 | Environment}. The subprocess gets its current directory from the |
| 133 | value of @code{default-directory}. | ||
| 131 | 134 | ||
| 132 | @defvar exec-directory | 135 | @defvar exec-directory |
| 133 | @pindex movemail | 136 | @pindex movemail |
| 134 | The value of this variable is a string, the name of a directory that | 137 | The value of this variable is a string, the name of a directory that |
| 135 | contains programs that come with GNU Emacs, programs intended for Emacs | 138 | contains programs that come with GNU Emacs and are intended for Emacs |
| 136 | to invoke. The program @code{movemail} is an example of such a program; | 139 | to invoke. The program @code{movemail} is an example of such a program; |
| 137 | Rmail uses it to fetch new mail from an inbox. | 140 | Rmail uses it to fetch new mail from an inbox. |
| 138 | @end defvar | 141 | @end defvar |
| @@ -147,6 +150,11 @@ directory (which is the value of @code{default-directory}). | |||
| 147 | The value of @code{exec-path} is used by @code{call-process} and | 150 | The value of @code{exec-path} is used by @code{call-process} and |
| 148 | @code{start-process} when the @var{program} argument is not an absolute | 151 | @code{start-process} when the @var{program} argument is not an absolute |
| 149 | file name. | 152 | file name. |
| 153 | |||
| 154 | Generally, you should not modify @code{exec-path} directly. Instead, | ||
| 155 | ensure that your @env{PATH} environment variable is set appropriately | ||
| 156 | before starting Emacs. Trying to modify @code{exec-path} | ||
| 157 | independently of @env{PATH} can lead to confusing results. | ||
| 150 | @end defopt | 158 | @end defopt |
| 151 | 159 | ||
| 152 | @node Shell Arguments | 160 | @node Shell Arguments |
| @@ -162,7 +170,7 @@ occur in the file name, they will confuse the shell. To handle these | |||
| 162 | characters, use the function @code{shell-quote-argument}: | 170 | characters, use the function @code{shell-quote-argument}: |
| 163 | 171 | ||
| 164 | @defun shell-quote-argument argument | 172 | @defun shell-quote-argument argument |
| 165 | This function returns a string which represents, in shell syntax, | 173 | This function returns a string that represents, in shell syntax, |
| 166 | an argument whose actual contents are @var{argument}. It should | 174 | an argument whose actual contents are @var{argument}. It should |
| 167 | work reliably to concatenate the return value into a shell command | 175 | work reliably to concatenate the return value into a shell command |
| 168 | and then pass it to a shell for execution. | 176 | and then pass it to a shell for execution. |
| @@ -200,10 +208,10 @@ a shell command: | |||
| 200 | The following two functions are useful for combining a list of | 208 | The following two functions are useful for combining a list of |
| 201 | individual command-line argument strings into a single string, and | 209 | individual command-line argument strings into a single string, and |
| 202 | taking a string apart into a list of individual command-line | 210 | taking a string apart into a list of individual command-line |
| 203 | arguments. These functions are mainly intended to be used for | 211 | arguments. These functions are mainly intended for |
| 204 | converting user input in the minibuffer, a Lisp string, into a list of | 212 | converting user input in the minibuffer, a Lisp string, into a list of |
| 205 | string arguments to be passed to @code{call-process} or | 213 | string arguments to be passed to @code{call-process} or |
| 206 | @code{start-process}, or for the converting such lists of arguments in | 214 | @code{start-process}, or for converting such lists of arguments into |
| 207 | a single Lisp string to be presented in the minibuffer or echo area. | 215 | a single Lisp string to be presented in the minibuffer or echo area. |
| 208 | 216 | ||
| 209 | @defun split-string-and-unquote string &optional separators | 217 | @defun split-string-and-unquote string &optional separators |
| @@ -347,7 +355,7 @@ In the examples below, the buffer @samp{foo} is current. | |||
| 347 | @result{} 0 | 355 | @result{} 0 |
| 348 | 356 | ||
| 349 | ---------- Buffer: foo ---------- | 357 | ---------- Buffer: foo ---------- |
| 350 | /usr/user/lewis/manual | 358 | /home/lewis/manual |
| 351 | ---------- Buffer: foo ---------- | 359 | ---------- Buffer: foo ---------- |
| 352 | @end group | 360 | @end group |
| 353 | 361 | ||
| @@ -356,18 +364,18 @@ In the examples below, the buffer @samp{foo} is current. | |||
| 356 | @result{} 0 | 364 | @result{} 0 |
| 357 | 365 | ||
| 358 | ---------- Buffer: bar ---------- | 366 | ---------- Buffer: bar ---------- |
| 359 | lewis:5LTsHm66CSWKg:398:21:Bil Lewis:/user/lewis:/bin/csh | 367 | lewis:x:1001:1001:Bil Lewis,,,,:/home/lewis:/bin/bash |
| 360 | 368 | ||
| 361 | ---------- Buffer: bar ---------- | 369 | ---------- Buffer: bar ---------- |
| 362 | @end group | 370 | @end group |
| 363 | @end smallexample | 371 | @end smallexample |
| 364 | 372 | ||
| 365 | Here is a good example of the use of @code{call-process}, which used to | 373 | Here is an example of the use of @code{call-process}, as used to |
| 366 | be found in the definition of @code{insert-directory}: | 374 | be found in the definition of the @code{insert-directory} function: |
| 367 | 375 | ||
| 368 | @smallexample | 376 | @smallexample |
| 369 | @group | 377 | @group |
| 370 | (call-process insert-directory-program nil t nil @var{switches} | 378 | (call-process insert-directory-program nil t nil switches |
| 371 | (if full-directory-p | 379 | (if full-directory-p |
| 372 | (concat (file-name-as-directory file) ".") | 380 | (concat (file-name-as-directory file) ".") |
| 373 | file)) | 381 | file)) |
| @@ -377,9 +385,9 @@ be found in the definition of @code{insert-directory}: | |||
| 377 | 385 | ||
| 378 | @defun process-file program &optional infile buffer display &rest args | 386 | @defun process-file program &optional infile buffer display &rest args |
| 379 | This function processes files synchronously in a separate process. It | 387 | This function processes files synchronously in a separate process. It |
| 380 | is similar to @code{call-process} but may invoke a file handler based | 388 | is similar to @code{call-process}, but may invoke a file handler based |
| 381 | on the value of the variable @code{default-directory}. The current | 389 | on the value of the variable @code{default-directory}, which specifies |
| 382 | working directory of the subprocess is @code{default-directory}. | 390 | the current working directory of the subprocess. |
| 383 | 391 | ||
| 384 | The arguments are handled in almost the same way as for | 392 | The arguments are handled in almost the same way as for |
| 385 | @code{call-process}, with the following differences: | 393 | @code{call-process}, with the following differences: |
| @@ -392,15 +400,15 @@ file handlers might not support separating standard output and error | |||
| 392 | output by way of the @var{buffer} argument. | 400 | output by way of the @var{buffer} argument. |
| 393 | 401 | ||
| 394 | If a file handler is invoked, it determines the program to run based | 402 | If a file handler is invoked, it determines the program to run based |
| 395 | on the first argument @var{program}. For instance, consider that a | 403 | on the first argument @var{program}. For instance, suppose that a |
| 396 | handler for remote files is invoked. Then the path that is used for | 404 | handler for remote files is invoked. Then the path that is used for |
| 397 | searching the program might be different than @code{exec-path}. | 405 | searching for the program might be different from @code{exec-path}. |
| 398 | 406 | ||
| 399 | The second argument @var{infile} may invoke a file handler. The file | 407 | The second argument @var{infile} may invoke a file handler. The file |
| 400 | handler could be different from the handler chosen for the | 408 | handler could be different from the handler chosen for the |
| 401 | @code{process-file} function itself. (For example, | 409 | @code{process-file} function itself. (For example, |
| 402 | @code{default-directory} could be on a remote host, whereas | 410 | @code{default-directory} could be on one remote host, and |
| 403 | @var{infile} is on another remote host. Or @code{default-directory} | 411 | @var{infile} on a different remote host. Or @code{default-directory} |
| 404 | could be non-special, whereas @var{infile} is on a remote host.) | 412 | could be non-special, whereas @var{infile} is on a remote host.) |
| 405 | 413 | ||
| 406 | If @var{buffer} is a list of the form @code{(@var{real-destination} | 414 | If @var{buffer} is a list of the form @code{(@var{real-destination} |
| @@ -417,16 +425,16 @@ file names. | |||
| 417 | @end defun | 425 | @end defun |
| 418 | 426 | ||
| 419 | @defvar process-file-side-effects | 427 | @defvar process-file-side-effects |
| 420 | This variable indicates, whether a call of @code{process-file} changes | 428 | This variable indicates whether a call of @code{process-file} changes |
| 421 | remote files. | 429 | remote files. |
| 422 | 430 | ||
| 423 | Per default, this variable is always set to @code{t}, meaning that a | 431 | By default, this variable is always set to @code{t}, meaning that a |
| 424 | call of @code{process-file} could potentially change any file on a | 432 | call of @code{process-file} could potentially change any file on a |
| 425 | remote host. When set to @code{nil}, a file handler could optimize | 433 | remote host. When set to @code{nil}, a file handler could optimize |
| 426 | its behavior with respect to remote file attributes caching. | 434 | its behavior with respect to remote file attribute caching. |
| 427 | 435 | ||
| 428 | This variable should never be changed by @code{setq}. Instead of, it | 436 | You should only ever change this variable with a let-binding; never |
| 429 | shall be set only by let-binding. | 437 | with @code{setq}. |
| 430 | @end defvar | 438 | @end defvar |
| 431 | 439 | ||
| 432 | @defun call-process-region start end program &optional delete destination display &rest args | 440 | @defun call-process-region start end program &optional delete destination display &rest args |
| @@ -442,7 +450,7 @@ as it comes in. For details, see the description of | |||
| 442 | @code{call-process}, above. If @var{destination} is the integer 0, | 450 | @code{call-process}, above. If @var{destination} is the integer 0, |
| 443 | @code{call-process-region} discards the output and returns @code{nil} | 451 | @code{call-process-region} discards the output and returns @code{nil} |
| 444 | immediately, without waiting for the subprocess to finish (this only | 452 | immediately, without waiting for the subprocess to finish (this only |
| 445 | works if asynchronous subprocesses are supported). | 453 | works if asynchronous subprocesses are supported; i.e. not on MS-DOS). |
| 446 | 454 | ||
| 447 | The remaining arguments, @var{args}, are strings that specify command | 455 | The remaining arguments, @var{args}, are strings that specify command |
| 448 | line arguments for the program. | 456 | line arguments for the program. |
| @@ -476,20 +484,21 @@ inputinput@point{} | |||
| 476 | @end group | 484 | @end group |
| 477 | @end smallexample | 485 | @end smallexample |
| 478 | 486 | ||
| 479 | The @code{shell-command-on-region} command uses | 487 | For example, the @code{shell-command-on-region} command uses |
| 480 | @code{call-process-region} like this: | 488 | @code{call-process-region} in a manner similar to this: |
| 481 | 489 | ||
| 482 | @smallexample | 490 | @smallexample |
| 483 | @group | 491 | @group |
| 484 | (call-process-region | 492 | (call-process-region |
| 485 | start end | 493 | start end |
| 486 | shell-file-name ; @r{Name of program.} | 494 | shell-file-name ; @r{name of program} |
| 487 | nil ; @r{Do not delete region.} | 495 | nil ; @r{do not delete region} |
| 488 | buffer ; @r{Send output to @code{buffer}.} | 496 | buffer ; @r{send output to @code{buffer}} |
| 489 | nil ; @r{No redisplay during output.} | 497 | nil ; @r{no redisplay during output} |
| 490 | "-c" command) ; @r{Arguments for the shell.} | 498 | "-c" command) ; @r{arguments for the shell} |
| 491 | @end group | 499 | @end group |
| 492 | @end smallexample | 500 | @end smallexample |
| 501 | @c It actually uses shell-command-switch, but no need to mention that here. | ||
| 493 | @end defun | 502 | @end defun |
| 494 | 503 | ||
| 495 | @defun call-process-shell-command command &optional infile destination display &rest args | 504 | @defun call-process-shell-command command &optional infile destination display &rest args |
| @@ -510,6 +519,9 @@ This function executes @var{command} (a string) as a shell command, | |||
| 510 | then returns the command's output as a string. | 519 | then returns the command's output as a string. |
| 511 | @end defun | 520 | @end defun |
| 512 | 521 | ||
| 522 | @c There is also shell-command-on-region, but that is more of a user | ||
| 523 | @c command, not something to use in programs. | ||
| 524 | |||
| 513 | @defun process-lines program &rest args | 525 | @defun process-lines program &rest args |
| 514 | This function runs @var{program}, waits for it to finish, and returns | 526 | This function runs @var{program}, waits for it to finish, and returns |
| 515 | its output as a list of strings. Each string in the list holds a | 527 | its output as a list of strings. Each string in the list holds a |
| @@ -553,7 +565,8 @@ The remaining arguments, @var{args}, are strings that specify command | |||
| 553 | line arguments for the program. | 565 | line arguments for the program. |
| 554 | 566 | ||
| 555 | In the example below, the first process is started and runs (rather, | 567 | In the example below, the first process is started and runs (rather, |
| 556 | sleeps) for 100 seconds. Meanwhile, the second process is started, and | 568 | sleeps) for 100 seconds (the output buffer @samp{foo} is created |
| 569 | immediately). Meanwhile, the second process is started, and | ||
| 557 | given the name @samp{my-process<1>} for the sake of uniqueness. It | 570 | given the name @samp{my-process<1>} for the sake of uniqueness. It |
| 558 | inserts the directory listing at the end of the buffer @samp{foo}, | 571 | inserts the directory listing at the end of the buffer @samp{foo}, |
| 559 | before the first process finishes. Then it finishes, and a message to | 572 | before the first process finishes. Then it finishes, and a message to |
| @@ -567,13 +580,15 @@ finishes, and another message is inserted in the buffer for it. | |||
| 567 | @end group | 580 | @end group |
| 568 | 581 | ||
| 569 | @group | 582 | @group |
| 570 | (start-process "my-process" "foo" "ls" "-l" "/user/lewis/bin") | 583 | (start-process "my-process" "foo" "ls" "-l" "/bin") |
| 571 | @result{} #<process my-process<1>> | 584 | @result{} #<process my-process<1>> |
| 572 | 585 | ||
| 573 | ---------- Buffer: foo ---------- | 586 | ---------- Buffer: foo ---------- |
| 574 | total 2 | 587 | total 8336 |
| 575 | lrwxrwxrwx 1 lewis 14 Jul 22 10:12 gnuemacs --> /emacs | 588 | -rwxr-xr-x 1 root root 971384 Mar 30 10:14 bash |
| 576 | -rwxrwxrwx 1 lewis 19 Jul 30 21:02 lemon | 589 | -rwxr-xr-x 1 root root 146920 Jul 5 2011 bsd-csh |
| 590 | @dots{} | ||
| 591 | -rwxr-xr-x 1 root root 696880 Feb 28 15:55 zsh4 | ||
| 577 | 592 | ||
| 578 | Process my-process<1> finished | 593 | Process my-process<1> finished |
| 579 | 594 | ||
| @@ -586,45 +601,49 @@ Process my-process finished | |||
| 586 | @defun start-file-process name buffer-or-name program &rest args | 601 | @defun start-file-process name buffer-or-name program &rest args |
| 587 | Like @code{start-process}, this function starts a new asynchronous | 602 | Like @code{start-process}, this function starts a new asynchronous |
| 588 | subprocess running @var{program} in it, and returns its process | 603 | subprocess running @var{program} in it, and returns its process |
| 589 | object---when @code{default-directory} is not a magic file name. | 604 | object. |
| 590 | 605 | ||
| 591 | If @code{default-directory} is magic, the function invokes its file | 606 | The difference from @code{start-process} is that this function may |
| 592 | handler instead. This handler ought to run @var{program}, perhaps on | 607 | invoked a file handler based on the value of @code{default-directory}. |
| 593 | the local host, perhaps on a remote host that corresponds to | 608 | This handler ought to run @var{program}, perhaps on the local host, |
| 594 | @code{default-directory}. In the latter case, the local part of | 609 | perhaps on a remote host that corresponds to @code{default-directory}. |
| 595 | @code{default-directory} becomes the working directory of the process. | 610 | In the latter case, the local part of @code{default-directory} becomes |
| 611 | the working directory of the process. | ||
| 596 | 612 | ||
| 597 | This function does not try to invoke file name handlers for | 613 | This function does not try to invoke file name handlers for |
| 598 | @var{program} or for the @var{program-args}. | 614 | @var{program} or for the @var{program-args}. |
| 599 | 615 | ||
| 600 | Depending on the implementation of the file handler, it might not be | 616 | Depending on the implementation of the file handler, it might not be |
| 601 | possible to apply @code{process-filter} or @code{process-sentinel} to | 617 | possible to apply @code{process-filter} or @code{process-sentinel} to |
| 602 | the resulting process object (@pxref{Filter Functions}, @pxref{Sentinels}). | 618 | the resulting process object. @xref{Filter Functions}, and @ref{Sentinels}. |
| 603 | 619 | ||
| 620 | @c FIXME Can we find a better example (i.e. a more modern function | ||
| 621 | @c that is actually documented). | ||
| 604 | Some file handlers may not support @code{start-file-process} (for | 622 | Some file handlers may not support @code{start-file-process} (for |
| 605 | example @code{ange-ftp-hook-function}). In such cases, the function | 623 | example the function @code{ange-ftp-hook-function}). In such cases, |
| 606 | does nothing and returns @code{nil}. | 624 | this function does nothing and returns @code{nil}. |
| 607 | @end defun | 625 | @end defun |
| 608 | 626 | ||
| 609 | @defun start-process-shell-command name buffer-or-name command | 627 | @defun start-process-shell-command name buffer-or-name command |
| 610 | This function is like @code{start-process} except that it uses a shell | 628 | This function is like @code{start-process}, except that it uses a shell |
| 611 | to execute the specified command. The argument @var{command} is a shell | 629 | to execute the specified command. The argument @var{command} is a shell |
| 612 | command name. The variable @code{shell-file-name} specifies which shell to | 630 | command name. The variable @code{shell-file-name} specifies which shell to |
| 613 | use. | 631 | use. |
| 614 | 632 | ||
| 615 | The point of running a program through the shell, rather than directly | 633 | The point of running a program through the shell, rather than directly |
| 616 | with @code{start-process}, is so that you can employ shell features such | 634 | with @code{start-process}, is so that you can employ shell features such |
| 617 | as wildcards in the arguments. It follows that if you include an | 635 | as wildcards in the arguments. It follows that if you include any |
| 618 | arbitrary user-specified arguments in the command, you should quote it | 636 | arbitrary user-specified arguments in the command, you should quote them |
| 619 | with @code{shell-quote-argument} first, so that any special shell | 637 | with @code{shell-quote-argument} first, so that any special shell |
| 620 | characters do @emph{not} have their special shell meanings. @xref{Shell | 638 | characters do @emph{not} have their special shell meanings. @xref{Shell |
| 621 | Arguments}. | 639 | Arguments}. Of course, when executing commands based on user input |
| 640 | you should also consider the security implications. | ||
| 622 | @end defun | 641 | @end defun |
| 623 | 642 | ||
| 624 | @defun start-file-process-shell-command name buffer-or-name command | 643 | @defun start-file-process-shell-command name buffer-or-name command |
| 625 | This function is like @code{start-process-shell-command}, but uses | 644 | This function is like @code{start-process-shell-command}, but uses |
| 626 | @code{start-file-process} internally. By this, @var{command} can be | 645 | @code{start-file-process} internally. Because of this, @var{command} |
| 627 | executed also on remote hosts, depending on @code{default-directory}. | 646 | can also be executed on remote hosts, depending on @code{default-directory}. |
| 628 | @end defun | 647 | @end defun |
| 629 | 648 | ||
| 630 | @defvar process-connection-type | 649 | @defvar process-connection-type |
| @@ -649,7 +668,7 @@ with one subprocess by binding the variable around the call to | |||
| 649 | 668 | ||
| 650 | @smallexample | 669 | @smallexample |
| 651 | @group | 670 | @group |
| 652 | (let ((process-connection-type nil)) ; @r{Use a pipe.} | 671 | (let ((process-connection-type nil)) ; @r{use a pipe} |
| 653 | (start-process @dots{})) | 672 | (start-process @dots{})) |
| 654 | @end group | 673 | @end group |
| 655 | @end smallexample | 674 | @end smallexample |
| @@ -666,9 +685,9 @@ Information}). | |||
| 666 | @dfn{Deleting a process} disconnects Emacs immediately from the | 685 | @dfn{Deleting a process} disconnects Emacs immediately from the |
| 667 | subprocess. Processes are deleted automatically after they terminate, | 686 | subprocess. Processes are deleted automatically after they terminate, |
| 668 | but not necessarily right away. You can delete a process explicitly | 687 | but not necessarily right away. You can delete a process explicitly |
| 669 | at any time. If you delete a terminated process explicitly before it | 688 | at any time. If you explicitly delete a terminated process before it |
| 670 | is deleted automatically, no harm results. Deleting a running | 689 | is deleted automatically, no harm results. Deleting a running |
| 671 | process sends a signal to terminate it (and its child processes if | 690 | process sends a signal to terminate it (and its child processes, if |
| 672 | any), and calls the process sentinel if it has one. @xref{Sentinels}. | 691 | any), and calls the process sentinel if it has one. @xref{Sentinels}. |
| 673 | 692 | ||
| 674 | When a process is deleted, the process object itself continues to | 693 | When a process is deleted, the process object itself continues to |
| @@ -866,7 +885,7 @@ closed the connection, or Emacs did @code{delete-process}. | |||
| 866 | @end defun | 885 | @end defun |
| 867 | 886 | ||
| 868 | @defun process-live-p process | 887 | @defun process-live-p process |
| 869 | This function returns nin-@code{nil} if @var{process} is alive. A | 888 | This function returns non-@code{nil} if @var{process} is alive. A |
| 870 | process is considered alive if its status is @code{run}, @code{open}, | 889 | process is considered alive if its status is @code{run}, @code{open}, |
| 871 | @code{listen}, @code{connect} or @code{stop}. | 890 | @code{listen}, @code{connect} or @code{stop}. |
| 872 | @end defun | 891 | @end defun |
| @@ -2664,7 +2683,7 @@ specification}, a special nested list describing named and typed | |||
| 2664 | @dfn{fields}. This specification controls length of each field to be | 2683 | @dfn{fields}. This specification controls length of each field to be |
| 2665 | processed, and how to pack or unpack it. We normally keep bindat specs | 2684 | processed, and how to pack or unpack it. We normally keep bindat specs |
| 2666 | in variables whose names end in @samp{-bindat-spec}; that kind of name | 2685 | in variables whose names end in @samp{-bindat-spec}; that kind of name |
| 2667 | is automatically recognized as ``risky.'' | 2686 | is automatically recognized as ``risky''. |
| 2668 | 2687 | ||
| 2669 | @cindex endianness | 2688 | @cindex endianness |
| 2670 | @cindex big endian | 2689 | @cindex big endian |
| @@ -2674,7 +2693,7 @@ is automatically recognized as ``risky.'' | |||
| 2674 | that the field represents and, in the case of multibyte fields, how | 2693 | that the field represents and, in the case of multibyte fields, how |
| 2675 | the bytes are ordered within the field. The two possible orderings | 2694 | the bytes are ordered within the field. The two possible orderings |
| 2676 | are ``big endian'' (also known as ``network byte ordering'') and | 2695 | are ``big endian'' (also known as ``network byte ordering'') and |
| 2677 | ``little endian.'' For instance, the number @code{#x23cd} (decimal | 2696 | ``little endian''. For instance, the number @code{#x23cd} (decimal |
| 2678 | 9165) in big endian would be the two bytes @code{#x23} @code{#xcd}; | 2697 | 9165) in big endian would be the two bytes @code{#x23} @code{#xcd}; |
| 2679 | and in little endian, @code{#xcd} @code{#x23}. Here are the possible | 2698 | and in little endian, @code{#xcd} @code{#x23}. Here are the possible |
| 2680 | type values: | 2699 | type values: |