diff options
| author | Noam Postavsky | 2019-07-26 23:20:37 -0400 |
|---|---|---|
| committer | Noam Postavsky | 2019-08-19 19:49:50 -0400 |
| commit | 615cff42580a3521c1a4ea7c3ec467eb8259e1c7 (patch) | |
| tree | 29a8aed75dabb24a797d5d6a9c3228c0e99535e1 | |
| parent | beb1d22260af2e03d80d34fcc1db212785a9d903 (diff) | |
| download | emacs-615cff42580a3521c1a4ea7c3ec467eb8259e1c7.tar.gz emacs-615cff42580a3521c1a4ea7c3ec467eb8259e1c7.zip | |
Fix process filter documentation (Bug#13400)
* doc/lispref/processes.texi (Asynchronous Processes): Note that input
may read when sending data as well.
(Output from Processes): Note that functions which send data may also
trigger reading from processes.
(Input to Processes, Filter Functions): Note that filter functions may
be called recursively.
| -rw-r--r-- | doc/lispref/processes.texi | 29 |
1 files changed, 13 insertions, 16 deletions
diff --git a/doc/lispref/processes.texi b/doc/lispref/processes.texi index a93f4db4282..bd807cdceef 100644 --- a/doc/lispref/processes.texi +++ b/doc/lispref/processes.texi | |||
| @@ -588,9 +588,8 @@ process}. After an asynchronous process is created, it runs in | |||
| 588 | parallel with Emacs, and Emacs can communicate with it using the | 588 | parallel with Emacs, and Emacs can communicate with it using the |
| 589 | functions described in the following sections (@pxref{Input to | 589 | functions described in the following sections (@pxref{Input to |
| 590 | Processes}, and @pxref{Output from Processes}). Note that process | 590 | Processes}, and @pxref{Output from Processes}). Note that process |
| 591 | communication is only partially asynchronous: Emacs sends data to the | 591 | communication is only partially asynchronous: Emacs sends and receives |
| 592 | process only when certain functions are called, and Emacs accepts data | 592 | data to and from a process only when those functions are called. |
| 593 | from the process only while waiting for input or for a time delay. | ||
| 594 | 593 | ||
| 595 | @cindex pty, when to use for subprocess communications | 594 | @cindex pty, when to use for subprocess communications |
| 596 | @cindex pipe, when to use for subprocess communications | 595 | @cindex pipe, when to use for subprocess communications |
| @@ -1200,8 +1199,9 @@ the defaulting mechanism (@pxref{Default Coding Systems}). | |||
| 1200 | because the input buffer is full. When this happens, the send functions | 1199 | because the input buffer is full. When this happens, the send functions |
| 1201 | wait a short while, accepting output from subprocesses, and then try | 1200 | wait a short while, accepting output from subprocesses, and then try |
| 1202 | again. This gives the subprocess a chance to read more of its pending | 1201 | again. This gives the subprocess a chance to read more of its pending |
| 1203 | input and make space in the buffer. It also allows filters, sentinels | 1202 | input and make space in the buffer. It also allows filters (including |
| 1204 | and timers to run---so take account of that in writing your code. | 1203 | the one currently running), sentinels and timers to run---so take |
| 1204 | account of that in writing your code. | ||
| 1205 | 1205 | ||
| 1206 | In these functions, the @var{process} argument can be a process or | 1206 | In these functions, the @var{process} argument can be a process or |
| 1207 | the name of a process, or a buffer or buffer name (which stands | 1207 | the name of a process, or a buffer or buffer name (which stands |
| @@ -1416,9 +1416,10 @@ output, Emacs won't receive that output. | |||
| 1416 | 1416 | ||
| 1417 | Output from a subprocess can arrive only while Emacs is waiting: when | 1417 | Output from a subprocess can arrive only while Emacs is waiting: when |
| 1418 | reading terminal input (see the function @code{waiting-for-user-input-p}), | 1418 | reading terminal input (see the function @code{waiting-for-user-input-p}), |
| 1419 | in @code{sit-for} and @code{sleep-for} (@pxref{Waiting}), and in | 1419 | in @code{sit-for} and @code{sleep-for} (@pxref{Waiting}), in |
| 1420 | @code{accept-process-output} (@pxref{Accepting Output}). This | 1420 | @code{accept-process-output} (@pxref{Accepting Output}), and in |
| 1421 | minimizes the problem of timing errors that usually plague parallel | 1421 | functions which send data to processes (@pxref{Input to Processes}). |
| 1422 | This minimizes the problem of timing errors that usually plague parallel | ||
| 1422 | programming. For example, you can safely create a process and only | 1423 | programming. For example, you can safely create a process and only |
| 1423 | then specify its buffer or filter function; no output can arrive | 1424 | then specify its buffer or filter function; no output can arrive |
| 1424 | before you finish, if the code in between does not call any primitive | 1425 | before you finish, if the code in between does not call any primitive |
| @@ -1594,14 +1595,10 @@ outputs directly to the process buffer. | |||
| 1594 | By default, the error output from the process, if any, is also | 1595 | By default, the error output from the process, if any, is also |
| 1595 | passed to the filter function, unless the destination for the standard | 1596 | passed to the filter function, unless the destination for the standard |
| 1596 | error stream of the process was separated from the standard output | 1597 | error stream of the process was separated from the standard output |
| 1597 | when the process was created (@pxref{Output from Processes}). | 1598 | when the process was created. Emacs will only call the filter |
| 1598 | 1599 | function during certain function calls. @xref{Output from Processes}. | |
| 1599 | The filter function can only be called when Emacs is waiting for | 1600 | Note that if any of those functions are called by the filter, the |
| 1600 | something, because process output arrives only at such times. Emacs | 1601 | filter may be called recursively. |
| 1601 | waits when reading terminal input (see the function | ||
| 1602 | @code{waiting-for-user-input-p}), in @code{sit-for} and | ||
| 1603 | @code{sleep-for} (@pxref{Waiting}), and in | ||
| 1604 | @code{accept-process-output} (@pxref{Accepting Output}). | ||
| 1605 | 1602 | ||
| 1606 | A filter function must accept two arguments: the associated process | 1603 | A filter function must accept two arguments: the associated process |
| 1607 | and a string, which is output just received from it. The function is | 1604 | and a string, which is output just received from it. The function is |