aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGlenn Morris2012-04-17 20:48:43 -0700
committerGlenn Morris2012-04-17 20:48:43 -0700
commit016a35dfa7c48255b7e461dc8a2441a643c8731c (patch)
tree87a9df5df48d1067f4384685f7450dce8e3e0151
parentd666446d7da49d504a5cc548321a77ecb405952e (diff)
downloademacs-016a35dfa7c48255b7e461dc8a2441a643c8731c.tar.gz
emacs-016a35dfa7c48255b7e461dc8a2441a643c8731c.zip
More process-related doc and manual small edits
* doc/lispref/processes.texi (Output from Processes, Filter Functions): Mention waiting-for-user-input-p. (Sentinels, Query Before Exit, System Processes, Transaction Queues): (Network Servers, Datagrams, Network Processes, Network Options) (Network Feature Testing, Serial Ports): Copyedits. (Network): Add encrypted network overview paragraph. Cross-reference the Emacs-GnuTLS manual. Use @acronym. * lisp/net/network-stream.el (open-network-stream): Doc fix. * src/process.c (Fset_process_inherit_coding_system_flag) (Fset_process_query_on_exit_flag): Doc fix (mention return value). (Fmake_network_process): Doc fix.
-rw-r--r--doc/lispref/ChangeLog10
-rw-r--r--doc/lispref/processes.texi210
-rw-r--r--lisp/ChangeLog4
-rw-r--r--lisp/net/network-stream.el5
-rw-r--r--src/ChangeLog6
-rw-r--r--src/process.c9
6 files changed, 146 insertions, 98 deletions
diff --git a/doc/lispref/ChangeLog b/doc/lispref/ChangeLog
index 16a0696b9f9..e56317ad70a 100644
--- a/doc/lispref/ChangeLog
+++ b/doc/lispref/ChangeLog
@@ -1,3 +1,13 @@
12012-04-18 Glenn Morris <rgm@gnu.org>
2
3 * processes.texi (Output from Processes, Filter Functions):
4 Mention waiting-for-user-input-p.
5 (Sentinels, Query Before Exit, System Processes, Transaction Queues):
6 (Network Servers, Datagrams, Network Processes, Network Options)
7 (Network Feature Testing, Serial Ports): Copyedits.
8 (Network): Add encrypted network overview paragraph.
9 Cross-reference the Emacs-GnuTLS manual. Use @acronym.
10
12012-04-17 Chong Yidong <cyd@gnu.org> 112012-04-17 Chong Yidong <cyd@gnu.org>
2 12
3 * help.texi (Keys in Documentation): Mention :advertised-binding. 13 * help.texi (Keys in Documentation): Mention :advertised-binding.
diff --git a/doc/lispref/processes.texi b/doc/lispref/processes.texi
index fd8bc717d09..0a763b4e146 100644
--- a/doc/lispref/processes.texi
+++ b/doc/lispref/processes.texi
@@ -1133,13 +1133,14 @@ subprocess has children that are still live and still producing
1133output, Emacs won't receive that output. 1133output, Emacs won't receive that output.
1134 1134
1135 Output from a subprocess can arrive only while Emacs is waiting: when 1135 Output from a subprocess can arrive only while Emacs is waiting: when
1136reading terminal input, in @code{sit-for} and @code{sleep-for} 1136reading terminal input (see the function @code{waiting-for-user-input-p}),
1137(@pxref{Waiting}), and in @code{accept-process-output} (@pxref{Accepting 1137in @code{sit-for} and @code{sleep-for} (@pxref{Waiting}), and in
1138Output}). This minimizes the problem of timing errors that usually 1138@code{accept-process-output} (@pxref{Accepting Output}). This
1139plague parallel programming. For example, you can safely create a 1139minimizes the problem of timing errors that usually plague parallel
1140process and only then specify its buffer or filter function; no output 1140programming. For example, you can safely create a process and only
1141can arrive before you finish, if the code in between does not call any 1141then specify its buffer or filter function; no output can arrive
1142primitive that waits. 1142before you finish, if the code in between does not call any primitive
1143that waits.
1143 1144
1144@defvar process-adaptive-read-buffering 1145@defvar process-adaptive-read-buffering
1145On some systems, when Emacs reads the output from a subprocess, the 1146On some systems, when Emacs reads the output from a subprocess, the
@@ -1264,14 +1265,16 @@ there is no filter.
1264 1265
1265 The filter function can only be called when Emacs is waiting for 1266 The filter function can only be called when Emacs is waiting for
1266something, because process output arrives only at such times. Emacs 1267something, because process output arrives only at such times. Emacs
1267waits when reading terminal input, in @code{sit-for} and 1268waits when reading terminal input (see the function
1268@code{sleep-for} (@pxref{Waiting}), and in @code{accept-process-output} 1269@code{waiting-for-user-input-p}), in @code{sit-for} and
1269(@pxref{Accepting Output}). 1270@code{sleep-for} (@pxref{Waiting}), and in
1271@code{accept-process-output} (@pxref{Accepting Output}).
1270 1272
1271 A filter function must accept two arguments: the associated process 1273 A filter function must accept two arguments: the associated process
1272and a string, which is output just received from it. The function is 1274and a string, which is output just received from it. The function is
1273then free to do whatever it chooses with the output. 1275then free to do whatever it chooses with the output.
1274 1276
1277@c Note this text is duplicated in the sentinels section.
1275 Quitting is normally inhibited within a filter function---otherwise, 1278 Quitting is normally inhibited within a filter function---otherwise,
1276the effect of typing @kbd{C-g} at command level or to quit a user 1279the effect of typing @kbd{C-g} at command level or to quit a user
1277command would be unpredictable. If you want to permit quitting inside 1280command would be unpredictable. If you want to permit quitting inside
@@ -1506,6 +1509,7 @@ describing the type of event.
1506 1509
1507 The string describing the event looks like one of the following: 1510 The string describing the event looks like one of the following:
1508 1511
1512@c FIXME? Also "killed\n" - see example below?
1509@itemize @bullet 1513@itemize @bullet
1510@item 1514@item
1511@code{"finished\n"}. 1515@code{"finished\n"}.
@@ -1522,7 +1526,7 @@ describing the type of event.
1522 1526
1523 A sentinel runs only while Emacs is waiting (e.g., for terminal 1527 A sentinel runs only while Emacs is waiting (e.g., for terminal
1524input, or for time to elapse, or for process output). This avoids the 1528input, or for time to elapse, or for process output). This avoids the
1525timing errors that could result from running them at random places in 1529timing errors that could result from running sentinels at random places in
1526the middle of other Lisp programs. A program can wait, so that 1530the middle of other Lisp programs. A program can wait, so that
1527sentinels will run, by calling @code{sit-for} or @code{sleep-for} 1531sentinels will run, by calling @code{sit-for} or @code{sleep-for}
1528(@pxref{Waiting}), or @code{accept-process-output} (@pxref{Accepting 1532(@pxref{Waiting}), or @code{accept-process-output} (@pxref{Accepting
@@ -1546,6 +1550,7 @@ should check whether the buffer is still alive. If it tries to insert
1546into a dead buffer, it will get an error. If the buffer is dead, 1550into a dead buffer, it will get an error. If the buffer is dead,
1547@code{(buffer-name (process-buffer @var{process}))} returns @code{nil}. 1551@code{(buffer-name (process-buffer @var{process}))} returns @code{nil}.
1548 1552
1553@c Note this text is duplicated in the filter functions section.
1549 Quitting is normally inhibited within a sentinel---otherwise, the 1554 Quitting is normally inhibited within a sentinel---otherwise, the
1550effect of typing @kbd{C-g} at command level or to quit a user command 1555effect of typing @kbd{C-g} at command level or to quit a user command
1551would be unpredictable. If you want to permit quitting inside a 1556would be unpredictable. If you want to permit quitting inside a
@@ -1556,8 +1561,8 @@ right way to do this is with the macro @code{with-local-quit}.
1556 If an error happens during execution of a sentinel, it is caught 1561 If an error happens during execution of a sentinel, it is caught
1557automatically, so that it doesn't stop the execution of whatever 1562automatically, so that it doesn't stop the execution of whatever
1558programs was running when the sentinel was started. However, if 1563programs was running when the sentinel was started. However, if
1559@code{debug-on-error} is non-@code{nil}, the error-catching is turned 1564@code{debug-on-error} is non-@code{nil}, errors are not caught.
1560off. This makes it possible to use the Lisp debugger to debug the 1565This makes it possible to use the Lisp debugger to debug the
1561sentinel. @xref{Debugger}. 1566sentinel. @xref{Debugger}.
1562 1567
1563 While a sentinel is running, the process sentinel is temporarily 1568 While a sentinel is running, the process sentinel is temporarily
@@ -1565,10 +1570,14 @@ set to @code{nil} so that the sentinel won't run recursively.
1565For this reason it is not possible for a sentinel to specify 1570For this reason it is not possible for a sentinel to specify
1566a new sentinel. 1571a new sentinel.
1567 1572
1573@ignore
1568 In earlier Emacs versions, every sentinel that did regular expression 1574 In earlier Emacs versions, every sentinel that did regular expression
1569searching or matching had to explicitly save and restore the match data. 1575searching or matching had to explicitly save and restore the match data.
1570Now Emacs does this automatically for sentinels; they never need to do 1576Now Emacs does this automatically for sentinels; they never need to do
1571it explicitly. @xref{Match Data}. 1577it explicitly.
1578@end ignore
1579 Note that Emacs automatically saves and restores the match data
1580while executing sentinels. @xref{Match Data}.
1572 1581
1573@defun set-process-sentinel process sentinel 1582@defun set-process-sentinel process sentinel
1574This function associates @var{sentinel} with @var{process}. If 1583This function associates @var{sentinel} with @var{process}. If
@@ -1576,7 +1585,7 @@ This function associates @var{sentinel} with @var{process}. If
1576The default behavior when there is no sentinel is to insert a message in 1585The default behavior when there is no sentinel is to insert a message in
1577the process's buffer when the process status changes. 1586the process's buffer when the process status changes.
1578 1587
1579Changes in process sentinel take effect immediately---if the sentinel 1588Changes in process sentinels take effect immediately---if the sentinel
1580is slated to be run but has not been called yet, and you specify a new 1589is slated to be run but has not been called yet, and you specify a new
1581sentinel, the eventual call to the sentinel will use the new one. 1590sentinel, the eventual call to the sentinel will use the new one.
1582 1591
@@ -1604,7 +1613,7 @@ has none.
1604@defun waiting-for-user-input-p 1613@defun waiting-for-user-input-p
1605While a sentinel or filter function is running, this function returns 1614While a sentinel or filter function is running, this function returns
1606non-@code{nil} if Emacs was waiting for keyboard input from the user at 1615non-@code{nil} if Emacs was waiting for keyboard input from the user at
1607the time the sentinel or filter function was called, @code{nil} if it 1616the time the sentinel or filter function was called, or @code{nil} if it
1608was not. 1617was not.
1609@end defun 1618@end defun
1610 1619
@@ -1614,7 +1623,7 @@ was not.
1614 When Emacs exits, it terminates all its subprocesses by sending them 1623 When Emacs exits, it terminates all its subprocesses by sending them
1615the @code{SIGHUP} signal. Because subprocesses may be doing 1624the @code{SIGHUP} signal. Because subprocesses may be doing
1616valuable work, Emacs normally asks the user to confirm that it is ok 1625valuable work, Emacs normally asks the user to confirm that it is ok
1617to terminate them. Each process has a query flag which, if 1626to terminate them. Each process has a query flag, which, if
1618non-@code{nil}, says that Emacs should ask for confirmation before 1627non-@code{nil}, says that Emacs should ask for confirmation before
1619exiting and thus killing that process. The default for the query flag 1628exiting and thus killing that process. The default for the query flag
1620is @code{t}, meaning @emph{do} query. 1629is @code{t}, meaning @emph{do} query.
@@ -1633,7 +1642,7 @@ shell process to avoid querying:
1633@smallexample 1642@smallexample
1634@group 1643@group
1635(set-process-query-on-exit-flag (get-process "shell") nil) 1644(set-process-query-on-exit-flag (get-process "shell") nil)
1636 @result{} t 1645 @result{} nil
1637@end group 1646@end group
1638@end smallexample 1647@end smallexample
1639@end defun 1648@end defun
@@ -1645,7 +1654,7 @@ shell process to avoid querying:
1645 In addition to accessing and manipulating processes that are 1654 In addition to accessing and manipulating processes that are
1646subprocesses of the current Emacs session, Emacs Lisp programs can 1655subprocesses of the current Emacs session, Emacs Lisp programs can
1647also access other processes running on the same machine. We call 1656also access other processes running on the same machine. We call
1648these @dfn{system processes}, to distinguish between them and Emacs 1657these @dfn{system processes}, to distinguish them from Emacs
1649subprocesses. 1658subprocesses.
1650 1659
1651 Emacs provides several primitives for accessing system processes. 1660 Emacs provides several primitives for accessing system processes.
@@ -1665,7 +1674,7 @@ This function returns an alist of attributes for the process specified
1665by its process ID @var{pid}. Each association in the alist is of the 1674by its process ID @var{pid}. Each association in the alist is of the
1666form @code{(@var{key} . @var{value})}, where @var{key} designates the 1675form @code{(@var{key} . @var{value})}, where @var{key} designates the
1667attribute and @var{value} is the value of that attribute. The various 1676attribute and @var{value} is the value of that attribute. The various
1668attribute @var{key}'s that this function can return are listed below. 1677attribute @var{key}s that this function can return are listed below.
1669Not all platforms support all of these attributes; if an attribute is 1678Not all platforms support all of these attributes; if an attribute is
1670not supported, its association will not appear in the returned alist. 1679not supported, its association will not appear in the returned alist.
1671Values that are numbers can be either integer or floating-point, 1680Values that are numbers can be either integer or floating-point,
@@ -1826,6 +1835,8 @@ as @code{shell-command}.
1826@section Transaction Queues 1835@section Transaction Queues
1827@cindex transaction queue 1836@cindex transaction queue
1828 1837
1838@c That's not very informative. What is a transaction, and when might
1839@c I want to use one?
1829You can use a @dfn{transaction queue} to communicate with a subprocess 1840You can use a @dfn{transaction queue} to communicate with a subprocess
1830using transactions. First use @code{tq-create} to create a transaction 1841using transactions. First use @code{tq-create} to create a transaction
1831queue communicating with a specified process. Then you can call 1842queue communicating with a specified process. Then you can call
@@ -1855,8 +1866,11 @@ text at the end of the entire answer, but nothing before; that's how
1855If the argument @var{delay-question} is non-@code{nil}, delay sending 1866If the argument @var{delay-question} is non-@code{nil}, delay sending
1856this question until the process has finished replying to any previous 1867this question until the process has finished replying to any previous
1857questions. This produces more reliable results with some processes. 1868questions. This produces more reliable results with some processes.
1869@ignore
1858 1870
1871@c Let's not mention it then.
1859The return value of @code{tq-enqueue} itself is not meaningful. 1872The return value of @code{tq-enqueue} itself is not meaningful.
1873@end ignore
1860@end defun 1874@end defun
1861 1875
1862@defun tq-close queue 1876@defun tq-close queue
@@ -1874,10 +1888,11 @@ Transaction queues are implemented by means of a filter function.
1874@cindex UDP 1888@cindex UDP
1875 1889
1876 Emacs Lisp programs can open stream (TCP) and datagram (UDP) network 1890 Emacs Lisp programs can open stream (TCP) and datagram (UDP) network
1877connections to other processes on the same machine or other machines. 1891connections (@pxref{Datagrams}) to other processes on the same machine
1892or other machines.
1878A network connection is handled by Lisp much like a subprocess, and is 1893A network connection is handled by Lisp much like a subprocess, and is
1879represented by a process object. However, the process you are 1894represented by a process object. However, the process you are
1880communicating with is not a child of the Emacs process, so it has no 1895communicating with is not a child of the Emacs process, has no
1881process @acronym{ID}, and you can't kill it or send it signals. All you 1896process @acronym{ID}, and you can't kill it or send it signals. All you
1882can do is send and receive data. @code{delete-process} closes the 1897can do is send and receive data. @code{delete-process} closes the
1883connection, but does not kill the program at the other end; that 1898connection, but does not kill the program at the other end; that
@@ -1905,7 +1920,7 @@ network connection or server, @code{serial} for a serial port
1905connection, or @code{real} for a real subprocess. 1920connection, or @code{real} for a real subprocess.
1906 1921
1907 The @code{process-status} function returns @code{open}, 1922 The @code{process-status} function returns @code{open},
1908@code{closed}, @code{connect}, and @code{failed} for network 1923@code{closed}, @code{connect}, or @code{failed} for network
1909connections. For a network server, the status is always 1924connections. For a network server, the status is always
1910@code{listen}. None of those values is possible for a real 1925@code{listen}. None of those values is possible for a real
1911subprocess. @xref{Process Information}. 1926subprocess. @xref{Process Information}.
@@ -1915,35 +1930,48 @@ subprocess. @xref{Process Information}.
1915process, being stopped means not accepting new connections. (Up to 5 1930process, being stopped means not accepting new connections. (Up to 5
1916connection requests will be queued for when you resume the server; you 1931connection requests will be queued for when you resume the server; you
1917can increase this limit, unless it is imposed by the operating 1932can increase this limit, unless it is imposed by the operating
1918system.) For a network stream connection, being stopped means not 1933system---see the @code{:server} keyword of @code{make-network-process},
1919processing input (any arriving input waits until you resume the 1934@ref{Network Processes}.) For a network stream connection, being
1920connection). For a datagram connection, some number of packets may be 1935stopped means not processing input (any arriving input waits until you
1921queued but input may be lost. You can use the function 1936resume the connection). For a datagram connection, some number of
1937packets may be queued but input may be lost. You can use the function
1922@code{process-command} to determine whether a network connection or 1938@code{process-command} to determine whether a network connection or
1923server is stopped; a non-@code{nil} value means yes. 1939server is stopped; a non-@code{nil} value means yes.
1924 1940
1925@cindex network connection, encrypted 1941@cindex network connection, encrypted
1926@cindex encrypted network connections 1942@cindex encrypted network connections
1927@cindex TLS network connections 1943@cindex @acronym{TLS} network connections
1928@cindex STARTTLS network connections 1944@cindex @acronym{STARTTLS} network connections
1929@defun open-network-stream name buffer-or-name host service &rest parameters 1945Emacs can create encrypted network connections, using either built-in
1946or external support. The built-in support uses the GnuTLS
1947(``Transport Layer Security'') library; see
1948@uref{http://www.gnu.org/software/gnutls/, the GnuTLS project page}.
1949If your Emacs was compiled with GnuTLS support, the function
1950@code{gnutls-available-p} is defined and returns non-@code{nil}. For
1951more details, @pxref{Top,, Overview, emacs-gnutls, The Emacs-GnuTLS manual}.
1952The external support uses the @file{starttls.el} library, which
1953requires a helper utility such as @command{gnutls-cli} to be installed
1954on the system. The @code{open-network-stream} function can
1955transparently handle the details of creating encrypted connections for
1956you, using whatever support is available.
1957
1958@defun open-network-stream name buffer host service &rest parameters
1930This function opens a TCP connection, with optional encryption, and 1959This function opens a TCP connection, with optional encryption, and
1931returns a process object that represents the connection. 1960returns a process object that represents the connection.
1932 1961
1933The @var{name} argument specifies the name for the process object. It 1962The @var{name} argument specifies the name for the process object. It
1934is modified as necessary to make it unique. 1963is modified as necessary to make it unique.
1935 1964
1936The @var{buffer-or-name} argument is the buffer to associate with the 1965The @var{buffer} argument is the buffer to associate with the
1937connection. Output from the connection is inserted in the buffer, 1966connection. Output from the connection is inserted in the buffer,
1938unless you specify a filter function to handle the output. If 1967unless you specify a filter function to handle the output. If
1939@var{buffer-or-name} is @code{nil}, it means that the connection is not 1968@var{buffer} is @code{nil}, it means that the connection is not
1940associated with any buffer. 1969associated with any buffer.
1941 1970
1942The arguments @var{host} and @var{service} specify where to connect to; 1971The arguments @var{host} and @var{service} specify where to connect to;
1943@var{host} is the host name (a string), and @var{service} is the name of 1972@var{host} is the host name (a string), and @var{service} is the name of
1944a defined network service (a string) or a port number (an integer). 1973a defined network service (a string) or a port number (an integer).
1945 1974
1946@c FIXME? Is this too lengthy for the printed manual?
1947The remaining arguments @var{parameters} are keyword/argument pairs 1975The remaining arguments @var{parameters} are keyword/argument pairs
1948that are mainly relevant to encrypted connections: 1976that are mainly relevant to encrypted connections:
1949 1977
@@ -1960,14 +1988,15 @@ The type of connection. Options are:
1960An ordinary, unencrypted connection. 1988An ordinary, unencrypted connection.
1961@item tls 1989@item tls
1962@itemx ssl 1990@itemx ssl
1963A TLS (``Transport Layer Security'') connection. 1991A @acronym{TLS} (``Transport Layer Security'') connection.
1964@item nil 1992@item nil
1965@itemx network 1993@itemx network
1966Start with a plain connection, and if parameters @samp{:success} 1994Start with a plain connection, and if parameters @samp{:success}
1967and @samp{:capability-command} are supplied, try to upgrade to an encrypted 1995and @samp{:capability-command} are supplied, try to upgrade to an encrypted
1968connection via STARTTLS. If that fails, retain the unencrypted connection. 1996connection via @acronym{STARTTLS}. If that fails, retain the
1997unencrypted connection.
1969@item starttls 1998@item starttls
1970As for @code{nil}, but if STARTTLS fails drop the connection. 1999As for @code{nil}, but if @acronym{STARTTLS} fails drop the connection.
1971@item shell 2000@item shell
1972A shell connection. 2001A shell connection.
1973@end table 2002@end table
@@ -1986,22 +2015,22 @@ command @var{capability-command}. The latter defaults to the former.
1986 2015
1987@item :starttls-function @var{function} 2016@item :starttls-function @var{function}
1988Function of one argument (the response to @var{capability-command}), 2017Function of one argument (the response to @var{capability-command}),
1989which returns either @code{nil}, or the command to activate STARTTLS 2018which returns either @code{nil}, or the command to activate @acronym{STARTTLS}
1990if supported. 2019if supported.
1991 2020
1992@item :success @var{regexp} 2021@item :success @var{regexp}
1993Regular expression matching a successful STARTTLS negotiation. 2022Regular expression matching a successful @acronym{STARTTLS} negotiation.
1994 2023
1995@item :use-starttls-if-possible @var{boolean} 2024@item :use-starttls-if-possible @var{boolean}
1996If non-@code{nil}, do opportunistic STARTTLS upgrades even if Emacs 2025If non-@code{nil}, do opportunistic @acronym{STARTTLS} upgrades even if Emacs
1997doesn't have built-in TLS support. 2026doesn't have built-in @acronym{TLS} support.
1998 2027
1999@item :client-certificate @var{list-or-t} 2028@item :client-certificate @var{list-or-t}
2000Either a list of the form @code{(@var{key-file} @var{cert-file})}, 2029Either a list of the form @code{(@var{key-file} @var{cert-file})},
2001naming the certificate key file and certificate file itself, or 2030naming the certificate key file and certificate file itself, or
2002@code{t}, meaning to query @code{auth-source} for this information 2031@code{t}, meaning to query @code{auth-source} for this information
2003(@pxref{Top,,auth-source, auth, Emacs auth-source Library}). 2032(@pxref{Top,,Overview, auth, The Auth-Source Manual}).
2004Only used for TLS or STARTTLS. 2033Only used for @acronym{TLS} or @acronym{STARTTLS}.
2005 2034
2006@item :return-list @var{cons-or-nil} 2035@item :return-list @var{cons-or-nil}
2007The return value of this function. If omitted or @code{nil}, return a 2036The return value of this function. If omitted or @code{nil}, return a
@@ -2025,18 +2054,20 @@ The connection type: @samp{plain} or @samp{tls}.
2025@section Network Servers 2054@section Network Servers
2026@cindex network servers 2055@cindex network servers
2027 2056
2028 You create a server by calling @code{make-network-process} with 2057 You create a server by calling @code{make-network-process}
2029@code{:server t}. The server will listen for connection requests from 2058(@pxref{Network Processes}) with @code{:server t}. The server will
2030clients. When it accepts a client connection request, that creates a 2059listen for connection requests from clients. When it accepts a client
2031new network connection, itself a process object, with the following 2060connection request, that creates a new network connection, itself a
2032parameters: 2061process object, with the following parameters:
2033 2062
2034@itemize @bullet 2063@itemize @bullet
2035@item 2064@item
2036The connection's process name is constructed by concatenating the 2065The connection's process name is constructed by concatenating the
2037server process's @var{name} with a client identification string. The 2066server process's @var{name} with a client identification string. The
2067@c FIXME? What about IPv6? Say briefly what the difference is?
2038client identification string for an IPv4 connection looks like 2068client identification string for an IPv4 connection looks like
2039@samp{<@var{a}.@var{b}.@var{c}.@var{d}:@var{p}>}. Otherwise, it is a 2069@samp{<@var{a}.@var{b}.@var{c}.@var{d}:@var{p}>}, which represents an
2070address and port number. Otherwise, it is a
2040unique number in brackets, as in @samp{<@var{nnn}>}. The number 2071unique number in brackets, as in @samp{<@var{nnn}>}. The number
2041is unique for each connection in the Emacs session. 2072is unique for each connection in the Emacs session.
2042 2073
@@ -2057,7 +2088,7 @@ uses its filter and sentinel; their sole purpose is to initialize
2057connections made to the server. 2088connections made to the server.
2058 2089
2059@item 2090@item
2060The connection's process contact info is set according to the client's 2091The connection's process contact information is set according to the client's
2061addressing information (typically an IP address and a port number). 2092addressing information (typically an IP address and a port number).
2062This information is associated with the @code{process-contact} 2093This information is associated with the @code{process-contact}
2063keywords @code{:host}, @code{:service}, @code{:remote}. 2094keywords @code{:host}, @code{:service}, @code{:remote}.
@@ -2074,7 +2105,7 @@ The client process's plist is initialized from the server's plist.
2074@section Datagrams 2105@section Datagrams
2075@cindex datagrams 2106@cindex datagrams
2076 2107
2077 A datagram connection communicates with individual packets rather 2108 A @dfn{datagram} connection communicates with individual packets rather
2078than streams of data. Each call to @code{process-send} sends one 2109than streams of data. Each call to @code{process-send} sends one
2079datagram packet (@pxref{Input to Processes}), and each datagram 2110datagram packet (@pxref{Input to Processes}), and each datagram
2080received results in one call to the filter function. 2111received results in one call to the filter function.
@@ -2127,7 +2158,8 @@ process object that represents it. The arguments @var{args} are a
2127list of keyword/argument pairs. Omitting a keyword is always 2158list of keyword/argument pairs. Omitting a keyword is always
2128equivalent to specifying it with value @code{nil}, except for 2159equivalent to specifying it with value @code{nil}, except for
2129@code{:coding}, @code{:filter-multibyte}, and @code{:reuseaddr}. Here 2160@code{:coding}, @code{:filter-multibyte}, and @code{:reuseaddr}. Here
2130are the meaningful keywords: 2161are the meaningful keywords (those corresponding to network options
2162are listed in the following section):
2131 2163
2132@table @asis 2164@table @asis
2133@item :name @var{name} 2165@item :name @var{name}
@@ -2143,7 +2175,7 @@ connection. Both connections and servers can be of these types.
2143@item :server @var{server-flag} 2175@item :server @var{server-flag}
2144If @var{server-flag} is non-@code{nil}, create a server. Otherwise, 2176If @var{server-flag} is non-@code{nil}, create a server. Otherwise,
2145create a connection. For a stream type server, @var{server-flag} may 2177create a connection. For a stream type server, @var{server-flag} may
2146be an integer which then specifies the length of the queue of pending 2178be an integer, which then specifies the length of the queue of pending
2147connections to the server. The default queue length is 5. 2179connections to the server. The default queue length is 5.
2148 2180
2149@item :host @var{host} 2181@item :host @var{host}
@@ -2154,7 +2186,7 @@ specify a valid address for the local host, and only clients
2154connecting to that address will be accepted. 2186connecting to that address will be accepted.
2155 2187
2156@item :service @var{service} 2188@item :service @var{service}
2157@var{service} specifies a port number to connect to, or, for a server, 2189@var{service} specifies a port number to connect to; or, for a server,
2158the port number to listen on. It should be a service name that 2190the port number to listen on. It should be a service name that
2159translates to a port number, or an integer specifying the port number 2191translates to a port number, or an integer specifying the port number
2160directly. For a server, it can also be @code{t}, which means to let 2192directly. For a server, it can also be @code{t}, which means to let
@@ -2165,18 +2197,18 @@ the system select an unused port number.
2165communication. @code{nil} means determine the proper address family 2197communication. @code{nil} means determine the proper address family
2166automatically for the given @var{host} and @var{service}. 2198automatically for the given @var{host} and @var{service}.
2167@code{local} specifies a Unix socket, in which case @var{host} is 2199@code{local} specifies a Unix socket, in which case @var{host} is
2168ignored. @code{ipv4} and @code{ipv6} specify to use IPv4 and IPv6 2200ignored. @code{ipv4} and @code{ipv6} specify to use IPv4 and IPv6,
2169respectively. 2201respectively.
2170 2202
2171@item :local @var{local-address} 2203@item :local @var{local-address}
2172For a server process, @var{local-address} is the address to listen on. 2204For a server process, @var{local-address} is the address to listen on.
2173It overrides @var{family}, @var{host} and @var{service}, and you 2205It overrides @var{family}, @var{host} and @var{service}, so you
2174may as well not specify them. 2206might as well not specify them.
2175 2207
2176@item :remote @var{remote-address} 2208@item :remote @var{remote-address}
2177For a connection, @var{remote-address} is the address to connect to. 2209For a connection, @var{remote-address} is the address to connect to.
2178It overrides @var{family}, @var{host} and @var{service}, and you 2210It overrides @var{family}, @var{host} and @var{service}, so you
2179may as well not specify them. 2211might as well not specify them.
2180 2212
2181For a datagram server, @var{remote-address} specifies the initial 2213For a datagram server, @var{remote-address} specifies the initial
2182setting of the remote datagram address. 2214setting of the remote datagram address.
@@ -2200,7 +2232,7 @@ integers @code{[@var{a} @var{b} @var{c} @var{d} @var{e} @var{f}
2200port number @var{p}. 2232port number @var{p}.
2201 2233
2202@item 2234@item
2203A local address is represented as a string which specifies the address 2235A local address is represented as a string, which specifies the address
2204in the local address space. 2236in the local address space.
2205 2237
2206@item 2238@item
@@ -2222,8 +2254,8 @@ second argument matching @code{"open"} (if successful) or
2222has succeeded or failed. 2254has succeeded or failed.
2223 2255
2224@item :stop @var{stopped} 2256@item :stop @var{stopped}
2225Start the network connection or server in the `stopped' state if 2257If @var{stopped} is non-@code{nil}, start the network connection or
2226@var{stopped} is non-@code{nil}. 2258server in the ``stopped'' state.
2227 2259
2228@item :buffer @var{buffer} 2260@item :buffer @var{buffer}
2229Use @var{buffer} as the process buffer. 2261Use @var{buffer} as the process buffer.
@@ -2244,6 +2276,11 @@ Initialize the process query flag to @var{query-flag}.
2244@item :filter @var{filter} 2276@item :filter @var{filter}
2245Initialize the process filter to @var{filter}. 2277Initialize the process filter to @var{filter}.
2246 2278
2279@item :filter-multibyte @var{multibyte}
2280If @var{multibyte} is non-@code{nil}, strings given to the process
2281filter are multibyte, otherwise they are unibyte. The default is the
2282default value of @code{enable-multibyte-characters}.
2283
2247@item :sentinel @var{sentinel} 2284@item :sentinel @var{sentinel}
2248Initialize the process sentinel to @var{sentinel}. 2285Initialize the process sentinel to @var{sentinel}.
2249 2286
@@ -2251,7 +2288,7 @@ Initialize the process sentinel to @var{sentinel}.
2251Initialize the log function of a server process to @var{log}. The log 2288Initialize the log function of a server process to @var{log}. The log
2252function is called each time the server accepts a network connection 2289function is called each time the server accepts a network connection
2253from a client. The arguments passed to the log function are 2290from a client. The arguments passed to the log function are
2254@var{server}, @var{connection}, and @var{message}, where @var{server} 2291@var{server}, @var{connection}, and @var{message}; where @var{server}
2255is the server process, @var{connection} is the new process for the 2292is the server process, @var{connection} is the new process for the
2256connection, and @var{message} is a string describing what has 2293connection, and @var{message} is a string describing what has
2257happened. 2294happened.
@@ -2288,7 +2325,7 @@ Using this option may require special privileges on some systems.
2288@item :broadcast @var{broadcast-flag} 2325@item :broadcast @var{broadcast-flag}
2289If @var{broadcast-flag} is non-@code{nil} for a datagram process, the 2326If @var{broadcast-flag} is non-@code{nil} for a datagram process, the
2290process will receive datagram packet sent to a broadcast address, and 2327process will receive datagram packet sent to a broadcast address, and
2291be able to send packets to a broadcast address. Ignored for a stream 2328be able to send packets to a broadcast address. This is ignored for a stream
2292connection. 2329connection.
2293 2330
2294@item :dontroute @var{dontroute-flag} 2331@item :dontroute @var{dontroute-flag}
@@ -2304,10 +2341,11 @@ If @var{linger-arg} is non-@code{nil}, wait for successful
2304transmission of all queued packets on the connection before it is 2341transmission of all queued packets on the connection before it is
2305deleted (see @code{delete-process}). If @var{linger-arg} is an 2342deleted (see @code{delete-process}). If @var{linger-arg} is an
2306integer, it specifies the maximum time in seconds to wait for queued 2343integer, it specifies the maximum time in seconds to wait for queued
2307packets to be sent before closing the connection. Default is 2344packets to be sent before closing the connection. The default is
2308@code{nil} which means to discard unsent queued packets when the 2345@code{nil}, which means to discard unsent queued packets when the
2309process is deleted. 2346process is deleted.
2310 2347
2348@c FIXME Where out-of-band data is ...?
2311@item :oobinline @var{oobinline-flag} 2349@item :oobinline @var{oobinline-flag}
2312If @var{oobinline-flag} is non-@code{nil} for a stream connection, 2350If @var{oobinline-flag} is non-@code{nil} for a stream connection,
2313receive out-of-band data in the normal data stream. Otherwise, ignore 2351receive out-of-band data in the normal data stream. Otherwise, ignore
@@ -2316,7 +2354,7 @@ out-of-band data.
2316@item :priority @var{priority} 2354@item :priority @var{priority}
2317Set the priority for packets sent on this connection to the integer 2355Set the priority for packets sent on this connection to the integer
2318@var{priority}. The interpretation of this number is protocol 2356@var{priority}. The interpretation of this number is protocol
2319specific, such as setting the TOS (type of service) field on IP 2357specific; such as setting the TOS (type of service) field on IP
2320packets sent on this connection. It may also have system dependent 2358packets sent on this connection. It may also have system dependent
2321effects, such as selecting a specific output queue on the network 2359effects, such as selecting a specific output queue on the network
2322interface. 2360interface.
@@ -2324,20 +2362,20 @@ interface.
2324@item :reuseaddr @var{reuseaddr-flag} 2362@item :reuseaddr @var{reuseaddr-flag}
2325If @var{reuseaddr-flag} is non-@code{nil} (the default) for a stream 2363If @var{reuseaddr-flag} is non-@code{nil} (the default) for a stream
2326server process, allow this server to reuse a specific port number (see 2364server process, allow this server to reuse a specific port number (see
2327@code{:service}) unless another process on this host is already 2365@code{:service}), unless another process on this host is already
2328listening on that port. If @var{reuseaddr-flag} is @code{nil}, there 2366listening on that port. If @var{reuseaddr-flag} is @code{nil}, there
2329may be a period of time after the last use of that port (by any 2367may be a period of time after the last use of that port (by any
2330process on the host), where it is not possible to make a new server on 2368process on the host) where it is not possible to make a new server on
2331that port. 2369that port.
2332@end table 2370@end table
2333 2371
2334@defun set-network-process-option process option value &optional no-error 2372@defun set-network-process-option process option value &optional no-error
2335This function sets or modifies a network option for network process 2373This function sets or modifies a network option for network process
2336@var{process}. See @code{make-network-process} for details of options 2374@var{process}. The accepted options and values are as for
2337@var{option} and their corresponding values @var{value}. If 2375@code{make-network-process}. If @var{no-error} is non-@code{nil},
2338@var{no-error} is non-@code{nil}, this function returns @code{nil} 2376this function returns @code{nil} instead of signaling an error if
2339instead of signaling an error if @var{option} is not a supported 2377@var{option} is not a supported option. If the function successfully
2340option. If the function successfully completes, it returns @code{t}. 2378completes, it returns @code{t}.
2341 2379
2342The current setting of an option is available via the 2380The current setting of an option is available via the
2343@code{process-contact} function. 2381@code{process-contact} function.
@@ -2354,11 +2392,9 @@ The current setting of an option is available via the
2354@end example 2392@end example
2355 2393
2356@noindent 2394@noindent
2357The result of the first form is @code{t} if it works to specify 2395The result of this form is @code{t} if it works to specify
2358@var{keyword} with value @var{value} in @code{make-network-process}. 2396@var{keyword} with value @var{value} in @code{make-network-process}.
2359The result of the second form is @code{t} if @var{keyword} is 2397Here are some of the @var{keyword}---@var{value} pairs you can test in
2360supported by @code{make-network-process}. Here are some of the
2361@var{keyword}---@var{value} pairs you can test in
2362this way. 2398this way.
2363 2399
2364@table @code 2400@table @code
@@ -2382,20 +2418,10 @@ Non-@code{nil} if the system can select the port for a server.
2382@end example 2418@end example
2383 2419
2384@noindent 2420@noindent
2385Here are some of the options you can test in this way. 2421The accepted @var{keyword} values are @code{:bindtodevice}, etc.
2386 2422For the complete list, @pxref{Network Options}. This form returns
2387@table @code 2423non-@code{nil} if that particular network option is supported by
2388@item :bindtodevice 2424@code{make-network-process} (or @code{set-network-process-option}).
2389@itemx :broadcast
2390@itemx :dontroute
2391@itemx :keepalive
2392@itemx :linger
2393@itemx :oobinline
2394@itemx :priority
2395@itemx :reuseaddr
2396That particular network option is supported by
2397@code{make-network-process} and @code{set-network-process-option}.
2398@end table
2399 2425
2400@node Misc Network 2426@node Misc Network
2401@section Misc Network Facilities 2427@section Misc Network Facilities
@@ -2533,7 +2559,7 @@ Initialize the process query flag to @var{query-flag}. @xref{Query
2533Before Exit}. The flags defaults to @code{nil} if unspecified. 2559Before Exit}. The flags defaults to @code{nil} if unspecified.
2534 2560
2535@item :stop @var{bool} 2561@item :stop @var{bool}
2536Start process in the @code{stopped} state if @var{bool} is 2562Start process in the ``stopped'' state if @var{bool} is
2537non-@code{nil}. In the stopped state, a serial process does not 2563non-@code{nil}. In the stopped state, a serial process does not
2538accept incoming data, but you can send outgoing data. The stopped 2564accept incoming data, but you can send outgoing data. The stopped
2539state is cleared by @code{continue-process} and set by 2565state is cleared by @code{continue-process} and set by
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 026b99872f0..16cf1e347a1 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,7 @@
12012-04-18 Glenn Morris <rgm@gnu.org>
2
3 * net/network-stream.el (open-network-stream): Doc fix.
4
12012-04-17 Chong Yidong <cyd@gnu.org> 52012-04-17 Chong Yidong <cyd@gnu.org>
2 6
3 * emacs-lisp/tabulated-list.el (tabulated-list-print): Fix typos. 7 * emacs-lisp/tabulated-list.el (tabulated-list-print): Fix typos.
diff --git a/lisp/net/network-stream.el b/lisp/net/network-stream.el
index 7a3d47ef1d1..81d05eabc5a 100644
--- a/lisp/net/network-stream.el
+++ b/lisp/net/network-stream.el
@@ -125,9 +125,8 @@ values:
125 certificate. This parameter will only be used when doing TLS 125 certificate. This parameter will only be used when doing TLS
126 or STARTTLS connections. 126 or STARTTLS connections.
127 127
128If :use-starttls-if-possible is non-nil, do opportunistic 128:use-starttls-if-possible is a boolean that says to do opportunistic
129STARTTLS upgrades even if Emacs doesn't have built-in TLS 129STARTTLS upgrades even if Emacs doesn't have built-in TLS functionality.
130functionality.
131 130
132:nowait is a boolean that says the connection should be made 131:nowait is a boolean that says the connection should be made
133 asynchronously, if possible." 132 asynchronously, if possible."
diff --git a/src/ChangeLog b/src/ChangeLog
index 42c582994cf..fb4da407b70 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,9 @@
12012-04-18 Glenn Morris <rgm@gnu.org>
2
3 * process.c (Fset_process_inherit_coding_system_flag)
4 (Fset_process_query_on_exit_flag): Doc fix (mention return value).
5 (Fmake_network_process): Doc fix.
6
12012-04-17 Eli Zaretskii <eliz@gnu.org> 72012-04-17 Eli Zaretskii <eliz@gnu.org>
2 8
3 * xdisp.c (string_buffer_position_lim): Limit starting position to 9 * xdisp.c (string_buffer_position_lim): Limit starting position to
diff --git a/src/process.c b/src/process.c
index dc43191ebef..f6ea5d75e1a 100644
--- a/src/process.c
+++ b/src/process.c
@@ -1070,7 +1070,9 @@ is more appropriate for saving the process buffer.
1070 1070
1071Binding the variable `inherit-process-coding-system' to non-nil before 1071Binding the variable `inherit-process-coding-system' to non-nil before
1072starting the process is an alternative way of setting the inherit flag 1072starting the process is an alternative way of setting the inherit flag
1073for the process which will run. */) 1073for the process which will run.
1074
1075This function returns FLAG. */)
1074 (register Lisp_Object process, Lisp_Object flag) 1076 (register Lisp_Object process, Lisp_Object flag)
1075{ 1077{
1076 CHECK_PROCESS (process); 1078 CHECK_PROCESS (process);
@@ -1083,7 +1085,8 @@ DEFUN ("set-process-query-on-exit-flag",
1083 2, 2, 0, 1085 2, 2, 0,
1084 doc: /* Specify if query is needed for PROCESS when Emacs is exited. 1086 doc: /* Specify if query is needed for PROCESS when Emacs is exited.
1085If the second argument FLAG is non-nil, Emacs will query the user before 1087If the second argument FLAG is non-nil, Emacs will query the user before
1086exiting or killing a buffer if PROCESS is running. */) 1088exiting or killing a buffer if PROCESS is running. This function
1089returns FLAG. */)
1087 (register Lisp_Object process, Lisp_Object flag) 1090 (register Lisp_Object process, Lisp_Object flag)
1088{ 1091{
1089 CHECK_PROCESS (process); 1092 CHECK_PROCESS (process);
@@ -2794,7 +2797,7 @@ The stopped state is cleared by `continue-process' and set by
2794:filter-multibyte BOOL -- If BOOL is non-nil, strings given to the 2797:filter-multibyte BOOL -- If BOOL is non-nil, strings given to the
2795process filter are multibyte, otherwise they are unibyte. 2798process filter are multibyte, otherwise they are unibyte.
2796If this keyword is not specified, the strings are multibyte if 2799If this keyword is not specified, the strings are multibyte if
2797`default-enable-multibyte-characters' is non-nil. 2800the default value of `enable-multibyte-characters' is non-nil.
2798 2801
2799:sentinel SENTINEL -- Install SENTINEL as the process sentinel. 2802:sentinel SENTINEL -- Install SENTINEL as the process sentinel.
2800 2803