From 458e643be8acb837a8b002d8103e58c228976cd3 Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Fri, 21 Feb 2014 00:04:15 -0800 Subject: [PATCH] Some doc updates for default process sentinels and filters not being nil * doc/lispref/internals.texi (Process Internals): * doc/lispref/processes.texi (Deleting Processes, Output from Processes) (Process Buffers, Filter Functions, Accepting Output, Sentinels) (Network, Network Servers, Network Processes, Serial Ports): Filters and sentinels can no longer be nil. * doc/lispref/elisp.texi (Top): Menu update. * doc/misc/flymake.texi (Starting the syntax check process): Grammar fix. * doc/misc/tramp.texi (External packages): Grammar fix. Reword for default sentinel not being nil any more. * src/process.c (Fprocess_buffer, Faccept_process_output) (Finternal_default_process_filter, Finternal_default_process_sentinel): Doc fixes. --- doc/lispref/ChangeLog | 9 ++++++ doc/lispref/elisp.texi | 2 +- doc/lispref/internals.texi | 6 ++-- doc/lispref/processes.texi | 68 ++++++++++++++++++++++++---------------------- doc/misc/ChangeLog | 7 +++++ doc/misc/flymake.texi | 4 +-- doc/misc/tramp.texi | 10 +++---- src/ChangeLog | 6 ++++ src/process.c | 32 ++++++++++++---------- 9 files changed, 84 insertions(+), 60 deletions(-) diff --git a/doc/lispref/ChangeLog b/doc/lispref/ChangeLog index fcfb524934d..d6a996ca9bf 100644 --- a/doc/lispref/ChangeLog +++ b/doc/lispref/ChangeLog @@ -1,3 +1,12 @@ +2014-02-21 Glenn Morris + + * internals.texi (Process Internals): + * processes.texi (Deleting Processes, Output from Processes) + (Process Buffers, Filter Functions, Accepting Output, Sentinels) + (Network, Network Servers, Network Processes, Serial Ports): + Filters and sentinels can no longer be nil. + * elisp.texi (Top): Menu update. + 2014-02-20 Glenn Morris * functions.texi (Defining Functions): Mention defalias-fset-function. diff --git a/doc/lispref/elisp.texi b/doc/lispref/elisp.texi index 0b2154cdb5e..b512968ff78 100644 --- a/doc/lispref/elisp.texi +++ b/doc/lispref/elisp.texi @@ -1305,7 +1305,7 @@ Processes Receiving Output from Processes -* Process Buffers:: If no filter, output is put in a buffer. +* Process Buffers:: By default, output is put in a buffer. * Filter Functions:: Filter functions accept output from the process. * Decoding Output:: Filters can get unibyte or multibyte strings. * Accepting Output:: How to wait until process output arrives. diff --git a/doc/lispref/internals.texi b/doc/lispref/internals.texi index 32fef454ac7..94e4b705105 100644 --- a/doc/lispref/internals.texi +++ b/doc/lispref/internals.texi @@ -1469,12 +1469,10 @@ process. For a network or serial process, it is @code{nil} if the process is running or @code{t} if the process is stopped. @item filter -If non-@code{nil}, a function used to accept output from the process -instead of a buffer. +A function used to accept output from the process. @item sentinel -If non-@code{nil}, a function called whenever the state of the process -changes. +A function called whenever the state of the process changes. @item buffer The associated buffer of the process. diff --git a/doc/lispref/processes.texi b/doc/lispref/processes.texi index c05f8ae8cb2..a564bd604c7 100644 --- a/doc/lispref/processes.texi +++ b/doc/lispref/processes.texi @@ -696,7 +696,7 @@ but not necessarily right away. You can delete a process explicitly at any time. If you explicitly delete a terminated process before it is deleted automatically, no harm results. Deleting a running process sends a signal to terminate it (and its child processes, if -any), and calls the process sentinel if it has one. @xref{Sentinels}. +any), and calls the process sentinel. @xref{Sentinels}. When a process is deleted, the process object itself continues to exist as long as other Lisp objects point to it. All the Lisp @@ -719,7 +719,7 @@ signal. The argument may be a process, the name of a process, a buffer, or the name of a buffer. (A buffer or buffer-name stands for the process that @code{get-buffer-process} returns.) Calling @code{delete-process} on a running process terminates it, updates the -process status, and runs the sentinel (if any) immediately. If the +process status, and runs the sentinel immediately. If the process has already terminated, calling @code{delete-process} has no effect on its status, or on the running of its sentinel (which will happen sooner or later). @@ -1170,7 +1170,7 @@ redirect one of them to a file---for example, by using an appropriate shell command. @menu -* Process Buffers:: If no filter, output is put in a buffer. +* Process Buffers:: By default, output is put in a buffer. * Filter Functions:: Filter functions accept output from the process. * Decoding Output:: Filters can get unibyte or multibyte strings. * Accepting Output:: How to wait until process output arrives. @@ -1187,11 +1187,12 @@ normal practice only one process is associated with any given buffer. Many applications of processes also use the buffer for editing input to be sent to the process, but this is not built into Emacs Lisp. - Unless the process has a filter function (@pxref{Filter Functions}), -its output is inserted in the associated buffer. The position to insert -the output is determined by the @code{process-mark}, which is then -updated to point to the end of the text just inserted. Usually, but not -always, the @code{process-mark} is at the end of the buffer. + By default, process output is inserted in the associated buffer. +(You can change this by defining a custom filter function, +@pxref{Filter Functions}). The position to insert the output is +determined by the @code{process-mark}, which is then updated to point +to the end of the text just inserted. Usually, but not always, the +@code{process-mark} is at the end of the buffer. @findex process-kill-buffer-query-function Killing the associated buffer of a process also kills the process. @@ -1268,10 +1269,9 @@ subprocess with a @code{SIGHUP} signal (@pxref{Signals to Processes}). @cindex process filter A process @dfn{filter function} is a function that receives the -standard output from the associated process. If a process has a filter, -then @emph{all} output from that process is passed to the filter. The -process buffer is used directly for output from the process only when -there is no filter. +standard output from the associated process. @emph{all} output from +that process is passed to the filter. The default filter simply +outputs directly to the process buffer. The filter function can only be called when Emacs is waiting for something, because process output arrives only at such times. Emacs @@ -1300,8 +1300,8 @@ This makes it possible to use the Lisp debugger to debug the filter function. @xref{Debugger}. Many filter functions sometimes (or always) insert the output in the -process's buffer, mimicking the actions of Emacs when there is no -filter. Such filter functions need to make sure that they save the +process's buffer, mimicking the actions of the default filter. +Such filter functions need to make sure that they save the current buffer, select the correct buffer (if different) before inserting output, and then restore the original buffer. They should also check whether the buffer is still alive, update the @@ -1357,12 +1357,12 @@ received text into a temporary buffer, which can then be searched. @defun set-process-filter process filter This function gives @var{process} the filter function @var{filter}. If -@var{filter} is @code{nil}, it gives the process no filter. +@var{filter} is @code{nil}, it gives the process the default filter, +which inserts the process output into the process buffer. @end defun @defun process-filter process -This function returns the filter function of @var{process}, or @code{nil} -if it has none. +This function returns the filter function of @var{process}. @end defun Here is an example of the use of a filter function: @@ -1401,8 +1401,7 @@ backup.mss dland syllabus.mss @ignore @c The code in this example doesn't show the right way to do things. Here is another, more realistic example, which demonstrates how to use -the process mark to do insertion in the same fashion as is done when -there is no filter function: +the process mark to do insertion in the same fashion as the default filter: @smallexample @group @@ -1474,9 +1473,9 @@ until output arrives from a process. @defun accept-process-output &optional process seconds millisec just-this-one This function allows Emacs to read pending output from processes. The -output is inserted in the associated buffers or given to their filter -functions. If @var{process} is non-@code{nil} then this function does -not return until some output has been received from @var{process}. +output is given to their filter functions. If @var{process} is +non-@code{nil} then this function does not return until some output +has been received from @var{process}. The arguments @var{seconds} and @var{millisec} let you specify timeout periods. The former specifies a period measured in seconds and the @@ -1591,9 +1590,9 @@ while executing sentinels. @xref{Match Data}. @defun set-process-sentinel process sentinel This function associates @var{sentinel} with @var{process}. If -@var{sentinel} is @code{nil}, then the process will have no sentinel. -The default behavior when there is no sentinel is to insert a message in -the process's buffer when the process status changes. +@var{sentinel} is @code{nil}, then the process will have the default +sentinel, which inserts a message in the process's buffer when the +process status changes. Changes in process sentinels take effect immediately---if the sentinel is slated to be run but has not been called yet, and you specify a new @@ -1616,8 +1615,7 @@ sentinel, the eventual call to the sentinel will use the new one. @end defun @defun process-sentinel process -This function returns the sentinel of @var{process}, or @code{nil} if it -has none. +This function returns the sentinel of @var{process}. @end defun @defun waiting-for-user-input-p @@ -1974,7 +1972,7 @@ is modified as necessary to make it unique. The @var{buffer} argument is the buffer to associate with the connection. Output from the connection is inserted in the buffer, -unless you specify a filter function to handle the output. If +unless you specify your own filter function to handle the output. If @var{buffer} is @code{nil}, it means that the connection is not associated with any buffer. @@ -2082,7 +2080,7 @@ unique number in brackets, as in @samp{<@var{nnn}>}. The number is unique for each connection in the Emacs session. @item -If the server's filter is non-@code{nil}, the connection process does +If the server has a non-default filter, the connection process does not get a separate process buffer; otherwise, Emacs creates a new buffer for the purpose. The buffer name is the server's buffer name or process name, concatenated with the client identification string. @@ -2284,7 +2282,8 @@ Initialize the process query flag to @var{query-flag}. @xref{Query Before Exit}. @item :filter @var{filter} -Initialize the process filter to @var{filter}. +Initialize the process filter to @var{filter}. (Otherwise the default +filter is used.) @item :filter-multibyte @var{multibyte} If @var{multibyte} is non-@code{nil}, strings given to the process @@ -2292,7 +2291,8 @@ filter are multibyte, otherwise they are unibyte. The default is the default value of @code{enable-multibyte-characters}. @item :sentinel @var{sentinel} -Initialize the process sentinel to @var{sentinel}. +Initialize the process sentinel to @var{sentinel}. (Otherwise the default +sentinel is used.) @item :log @var{log} Initialize the log function of a server process to @var{log}. The log @@ -2580,10 +2580,12 @@ state is cleared by @code{continue-process} and set by @code{stop-process}. @item :filter @var{filter} -Install @var{filter} as the process filter. +Install @var{filter} as the process filter. (Otherwise the default +filter is used.) @item :sentinel @var{sentinel} -Install @var{sentinel} as the process sentinel. +Install @var{sentinel} as the process sentinel. (Otherwise the default +sentinel is used.) @item :plist @var{plist} Install @var{plist} as the initial plist of the process. diff --git a/doc/misc/ChangeLog b/doc/misc/ChangeLog index e2ef448c3cd..7dbf46cf1a2 100644 --- a/doc/misc/ChangeLog +++ b/doc/misc/ChangeLog @@ -1,3 +1,10 @@ +2014-02-21 Glenn Morris + + * flymake.texi (Starting the syntax check process): Grammar fix. + + * tramp.texi (External packages): Grammar fix. + Reword for default sentinel not being nil any more. + 2014-02-19 Michael Albinus * trampver.texi: Update release number. diff --git a/doc/misc/flymake.texi b/doc/misc/flymake.texi index a9904530e13..5125acd1f0d 100644 --- a/doc/misc/flymake.texi +++ b/doc/misc/flymake.texi @@ -695,8 +695,8 @@ Buildfile values are also cached. The command line (command name and the list of arguments) for launching a process is returned by the initialization function. Flymake then just calls @code{start-process} -to start an asynchronous process and configures process filter and -sentinel which is used for processing the output of the syntax check +to start an asynchronous process and configures a process filter and +sentinel, which are used for processing the output of the syntax check tool. @node Parsing the output diff --git a/doc/misc/tramp.texi b/doc/misc/tramp.texi index b3057c255fc..6dd5d2a88d8 100644 --- a/doc/misc/tramp.texi +++ b/doc/misc/tramp.texi @@ -3766,10 +3766,10 @@ its complete cache keeping attributes for all files of the remote host it has seen so far. This is a performance degradation, because the lost file attributes -must be recomputed when needed again. In cases the caller of +must be recomputed when needed again. In cases where the caller of @code{process-file} knows that there are no file attribute changes, it -shall let-bind the variable @code{process-file-side-effects} to -@code{nil}. @value{tramp} wouldn't flush the file attributes cache then. +should let-bind the variable @code{process-file-side-effects} to +@code{nil}. Then @value{tramp} won't flush the file attributes cache. @lisp (let (process-file-side-effects) @@ -3779,8 +3779,8 @@ shall let-bind the variable @code{process-file-side-effects} to For asynchronous processes, @value{tramp} flushes the file attributes cache via a process sentinel. If the caller of @code{start-file-process} knows that there are no file attribute -changes, it shall set the process sentinel to @code{nil}. In case the -caller defines an own process sentinel, @value{tramp}'s process +changes, it should set the process sentinel to the default. In cases +where the caller defines its own process sentinel, @value{tramp}'s process sentinel is overwritten. The caller can still flush the file attributes cache in its process sentinel with this code: diff --git a/src/ChangeLog b/src/ChangeLog index 2b631dfc5f9..70fce9add14 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,9 @@ +2014-02-21 Glenn Morris + + * process.c (Fprocess_buffer, Faccept_process_output) + (Finternal_default_process_filter, Finternal_default_process_sentinel): + Doc fixes. + 2014-02-21 Martin Rudalics * window.c (Fwindow_scroll_bar_width): New function. diff --git a/src/process.c b/src/process.c index 85470b66c3e..c891962ecb2 100644 --- a/src/process.c +++ b/src/process.c @@ -1,7 +1,7 @@ /* Asynchronous subprocess control for GNU Emacs. -Copyright (C) 1985-1988, 1993-1996, 1998-1999, 2001-2014 Free Software -Foundation, Inc. +Copyright (C) 1985-1988, 1993-1996, 1998-1999, 2001-2014 + Free Software Foundation, Inc. This file is part of GNU Emacs. @@ -1022,7 +1022,7 @@ Return BUFFER. */) DEFUN ("process-buffer", Fprocess_buffer, Sprocess_buffer, 1, 1, 0, doc: /* Return the buffer PROCESS is associated with. -Output from PROCESS is inserted in this buffer unless PROCESS has a filter. */) +The default process filter inserts output from PROCESS into this buffer. */) (register Lisp_Object process) { CHECK_PROCESS (process); @@ -1049,7 +1049,7 @@ passed to the filter. The filter gets two arguments: the process and the string of output. The string argument is normally a multibyte string, except: -- if the process' input coding system is no-conversion or raw-text, +- if the process's input coding system is no-conversion or raw-text, it is a unibyte string (the non-converted input), or else - if `default-enable-multibyte-characters' is nil, it is a unibyte string (the result of converting the decoded input multibyte @@ -1061,7 +1061,7 @@ The string argument is normally a multibyte string, except: CHECK_PROCESS (process); p = XPROCESS (process); - /* Don't signal an error if the process' input file descriptor + /* Don't signal an error if the process's input file descriptor is closed. This could make debugging Lisp more difficult, for example when doing something like @@ -2758,7 +2758,7 @@ client. The arguments are SERVER, CLIENT, and MESSAGE, where SERVER is the server process, CLIENT is the new process for the connection, and MESSAGE is a string. -:plist PLIST -- Install PLIST as the new process' initial plist. +:plist PLIST -- Install PLIST as the new process's initial plist. :server QLEN -- if QLEN is non-nil, create a server process for the specified FAMILY, SERVICE, and connection type (stream or datagram). @@ -2788,21 +2788,21 @@ When a client connection is accepted, a new network process is created for the connection with the following parameters: - The client's process name is constructed by concatenating the server -process' NAME and a client identification string. +process's NAME and a client identification string. - If the FILTER argument is non-nil, the client process will not get a separate process buffer; otherwise, the client's process buffer is a newly -created buffer named after the server process' BUFFER name or process +created buffer named after the server process's BUFFER name or process NAME concatenated with the client identification string. - The connection type and the process filter and sentinel parameters are -inherited from the server process' TYPE, FILTER and SENTINEL. -- The client process' contact info is set according to the client's +inherited from the server process's TYPE, FILTER and SENTINEL. +- The client process's contact info is set according to the client's addressing information (typically an IP address and a port number). -- The client process' plist is initialized from the server's plist. +- The client process's plist is initialized from the server's plist. Notice that the FILTER and SENTINEL args are never used directly by the server process. Also, the BUFFER argument is not used directly by the server process, but via the optional :log function, accepted (and -failed) connections may be logged in the server process' buffer. +failed) connections may be logged in the server process's buffer. The original argument list, modified with the actual connection information, is available via the `process-contact' function. @@ -3917,7 +3917,7 @@ deactivate_process (Lisp_Object proc) DEFUN ("accept-process-output", Faccept_process_output, Saccept_process_output, 0, 4, 0, doc: /* Allow any pending output from subprocesses to be read by Emacs. -It is read into the process' buffers or given to their filter functions. +It is given to their filter functions. Non-nil arg PROCESS means do not return until some output has been received from PROCESS. @@ -5187,7 +5187,8 @@ read_and_dispose_of_process_output (struct Lisp_Process *p, char *chars, DEFUN ("internal-default-process-filter", Finternal_default_process_filter, Sinternal_default_process_filter, 2, 2, 0, - doc: /* Function used as default process filter. */) + doc: /* Function used as default process filter. +This inserts the process's output into its buffer. */) (Lisp_Object proc, Lisp_Object text) { struct Lisp_Process *p; @@ -6411,7 +6412,8 @@ status_notify (struct Lisp_Process *deleting_process) DEFUN ("internal-default-process-sentinel", Finternal_default_process_sentinel, Sinternal_default_process_sentinel, 2, 2, 0, - doc: /* Function used as default sentinel for processes. */) + doc: /* Function used as default sentinel for processes. +This inserts a status message into the process's buffer. */) (Lisp_Object proc, Lisp_Object msg) { Lisp_Object buffer, symbol; -- 2.11.4.GIT