aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEli Zaretskii2025-09-20 12:32:21 +0300
committerEli Zaretskii2025-09-20 12:32:21 +0300
commit40adabe2ef8787daa375eaddfb1e265ef5fb18a3 (patch)
tree25968c6d85d67e7ea2c25144b56a451ff8c970da
parent65fb5798960201d247063f38c460a69253a00264 (diff)
downloademacs-40adabe2ef8787daa375eaddfb1e265ef5fb18a3.tar.gz
emacs-40adabe2ef8787daa375eaddfb1e265ef5fb18a3.zip
Improve documentation of 'accept-process-output'
* doc/lispref/processes.texi (Accepting Output): * src/process.c (Faccept_process_output): Document better the meaning of the timeout of 'accept-process-output' a,d the fact that it doesn't always return as soon as some output is available. See https://lists.gnu.org/archive/html/emacs-devel/2025-08/msg00750.html for more details.
-rw-r--r--doc/lispref/processes.texi12
-rw-r--r--src/process.c10
2 files changed, 19 insertions, 3 deletions
diff --git a/doc/lispref/processes.texi b/doc/lispref/processes.texi
index 3d3ec7a5a3c..59f6ddeb63b 100644
--- a/doc/lispref/processes.texi
+++ b/doc/lispref/processes.texi
@@ -1989,7 +1989,8 @@ until output arrives from a process.
1989 1989
1990@defun accept-process-output &optional process seconds millisec just-this-one 1990@defun accept-process-output &optional process seconds millisec just-this-one
1991This function allows Emacs to read pending output from processes. The 1991This function allows Emacs to read pending output from processes. The
1992output is given to their filter functions. If @var{process} is 1992output is given to the filter functions set up by the processes
1993(@pxref{Filter Functions}). If @var{process} is
1993non-@code{nil} then this function does not return until some output 1994non-@code{nil} then this function does not return until some output
1994has been received from @var{process} or @var{process} has closed the 1995has been received from @var{process} or @var{process} has closed the
1995connection. 1996connection.
@@ -2020,6 +2021,15 @@ got output from @var{process}, or from any process if @var{process} is
2020corresponding connection contains buffered data. The function returns 2021corresponding connection contains buffered data. The function returns
2021@code{nil} if the timeout expired or the connection was closed before output 2022@code{nil} if the timeout expired or the connection was closed before output
2022arrived. 2023arrived.
2024
2025Note that this function is not guaranteed to return as soon as some
2026output is available from a subprocess, because the main purpose of the
2027function is to let Emacs read output from subprocesses, not to wait as
2028little as possible. In particular, if @var{process} is @code{nil}, the
2029function should not be expected to return before the specified timeout
2030expires. Thus, if a Lisp program needs to minimize the wait for the
2031subprocess output, it should call this function with a non-@code{nil}
2032value of a specific @var{process}.
2023@end defun 2033@end defun
2024 2034
2025If a connection from a process contains buffered data, 2035If a connection from a process contains buffered data,
diff --git a/src/process.c b/src/process.c
index 75416b8e52a..2804409f51e 100644
--- a/src/process.c
+++ b/src/process.c
@@ -4865,7 +4865,7 @@ deactivate_process (Lisp_Object proc)
4865DEFUN ("accept-process-output", Faccept_process_output, Saccept_process_output, 4865DEFUN ("accept-process-output", Faccept_process_output, Saccept_process_output,
4866 0, 4, 0, 4866 0, 4, 0,
4867 doc: /* Allow any pending output from subprocesses to be read by Emacs. 4867 doc: /* Allow any pending output from subprocesses to be read by Emacs.
4868It is given to their filter functions. 4868The subprocess output is given to the respective process filter functions.
4869Optional argument PROCESS means to return only after output is 4869Optional argument PROCESS means to return only after output is
4870received from PROCESS or PROCESS closes the connection. 4870received from PROCESS or PROCESS closes the connection.
4871 4871
@@ -4880,7 +4880,13 @@ from PROCESS only, suspending reading output from other processes.
4880If JUST-THIS-ONE is an integer, don't run any timers either. 4880If JUST-THIS-ONE is an integer, don't run any timers either.
4881Return non-nil if we received any output from PROCESS (or, if PROCESS 4881Return non-nil if we received any output from PROCESS (or, if PROCESS
4882is nil, from any process) before the timeout expired or the 4882is nil, from any process) before the timeout expired or the
4883corresponding connection was closed. */) 4883corresponding connection was closed.
4884
4885Note that it is not guaranteed that this function will return as
4886soon as some output is received. In particular, if PROCESS is nil,
4887the function should not be expected to return before the timeout
4888expires. The main purpose of this function is to allow process output
4889to be read by Emacs, not to return as soon as any output is read. */)
4884 (Lisp_Object process, Lisp_Object seconds, Lisp_Object millisec, 4890 (Lisp_Object process, Lisp_Object seconds, Lisp_Object millisec,
4885 Lisp_Object just_this_one) 4891 Lisp_Object just_this_one)
4886{ 4892{