aboutsummaryrefslogtreecommitdiffstats
path: root/doc
diff options
context:
space:
mode:
authorChong Yidong2012-04-20 16:48:50 +0800
committerChong Yidong2012-04-20 16:48:50 +0800
commitc07a4c0b599e0debfb10acdf02ac6559b998a88a (patch)
treef87bca47c21f04b43cca2347a21ed89c57b67958 /doc
parent6cf2a23e297b8a57a70c2a1dab5aa28b73461b0b (diff)
parent50e5ebca7edcf5299b89ff74499991de01e22046 (diff)
downloademacs-c07a4c0b599e0debfb10acdf02ac6559b998a88a.tar.gz
emacs-c07a4c0b599e0debfb10acdf02ac6559b998a88a.zip
Merge from emacs-24 branch
Diffstat (limited to 'doc')
-rw-r--r--doc/lispref/ChangeLog72
-rw-r--r--doc/lispref/elisp.texi4
-rw-r--r--doc/lispref/files.texi12
-rw-r--r--doc/lispref/help.texi15
-rw-r--r--doc/lispref/keymaps.texi13
-rw-r--r--doc/lispref/minibuf.texi378
-rw-r--r--doc/lispref/processes.texi496
-rw-r--r--doc/lispref/vol1.texi4
-rw-r--r--doc/lispref/vol2.texi4
-rw-r--r--doc/misc/ChangeLog20
-rw-r--r--doc/misc/faq.texi88
11 files changed, 658 insertions, 448 deletions
diff --git a/doc/lispref/ChangeLog b/doc/lispref/ChangeLog
index b5a25cb1c51..284a1230a83 100644
--- a/doc/lispref/ChangeLog
+++ b/doc/lispref/ChangeLog
@@ -1,3 +1,75 @@
12012-04-20 Chong Yidong <cyd@gnu.org>
2
3 * processes.texi (Asynchronous Processes): Mention nil argument to
4 start-process.
5
62012-04-20 Glenn Morris <rgm@gnu.org>
7
8 * minibuf.texi (Basic Completion): No need to describe obarrays here.
9 Don't mention obsolete `nospace' argument of all-completions.
10 (Minibuffer Completion, Completion Commands, Reading File Names)
11 (Completion Variables): Copyedits.
12 (Completion Commands): Mention parent keymaps.
13 Remove obsolete minibuffer-local-filename-must-match-map.
14 (High-Level Completion): Remove read-variable's almost
15 word-for-word duplication of read-command.
16 * elisp.texi, vol1.texi, vol2.texi, minibuf.texi (Completion):
17 Update "High-Level Completion" description.
18
192012-04-19 Glenn Morris <rgm@gnu.org>
20
21 * minibuf.texi (Minibuffers):
22 * elisp.texi, vol1.texi, vol2.texi: Fix minibuffer subsection order.
23
24 * minibuf.texi: Standardize metasyntactic variables ("history", etc).
25 Use Texinfo-recommended form of quote+punctuation.
26 (Intro to Minibuffers): First minibuffer is #1, not #0.
27 Mention minibuffer-inactive-mode.
28 (Text from Minibuffer): Copyedits.
29 (Minibuffer History, Programmed Completion): Fix @var usage.
30 (Object from Minibuffer): Remove overly pedantic para.
31 (Minibuffer History): Copyedits. Add face-name-history.
32 (Initial Input, Yes-or-No Queries, Multiple Queries)
33 (Minibuffer Windows, Minibuffer Misc): Copyedits.
34 (Yes-or-No Queries): Tweak example.
35 (Minibuffer Commands): Add next-complete-history-element.
36 (Minibuffer Misc): Mention minibuffer-message-timeout, and
37 minibuffer-inactive-mode.
38
392012-04-18 Glenn Morris <rgm@gnu.org>
40
41 * processes.texi (Serial Ports, Byte Packing, Bindat Spec)
42 (Bindat Functions): Copyedits.
43
442012-04-18 Christopher Schmidt <christopher@ch.ristopher.com>
45
46 * files.texi (Saving Buffers): Document `visit and `visit-save'
47 values of require-final-newline.
48
492012-04-18 Glenn Morris <rgm@gnu.org>
50
51 * processes.texi (Output from Processes, Filter Functions):
52 Mention waiting-for-user-input-p.
53 (Sentinels, Query Before Exit, System Processes, Transaction Queues):
54 (Network Servers, Datagrams, Network Processes, Network Options)
55 (Network Feature Testing, Serial Ports): Copyedits.
56 (Network): Add encrypted network overview paragraph.
57 Cross-reference the Emacs-GnuTLS manual. Use @acronym.
58
592012-04-17 Chong Yidong <cyd@gnu.org>
60
61 * help.texi (Keys in Documentation): Mention :advertised-binding.
62
63 * keymaps.texi (Menu Bar): Move most of the :advertised-binding
64 description to help.texi.
65
662012-04-16 Glenn Morris <rgm@gnu.org>
67
68 * processes.texi (Process Information, Input to Processes)
69 (Signals to Processes, Output from Processes, Process Buffers)
70 (Filter Functions, Decoding Output): Copyedits.
71 (Accepting Output): Discourage use of `millisec' argument.
72
12012-04-15 Glenn Morris <rgm@gnu.org> 732012-04-15 Glenn Morris <rgm@gnu.org>
2 74
3 * processes.texi (Processes, Subprocess Creation, Shell Arguments): 75 * processes.texi (Processes, Subprocess Creation, Shell Arguments):
diff --git a/doc/lispref/elisp.texi b/doc/lispref/elisp.texi
index 76397556b01..4319d5eddda 100644
--- a/doc/lispref/elisp.texi
+++ b/doc/lispref/elisp.texi
@@ -637,8 +637,8 @@ Minibuffers
637* Multiple Queries:: Asking a series of similar questions. 637* Multiple Queries:: Asking a series of similar questions.
638* Reading a Password:: Reading a password from the terminal. 638* Reading a Password:: Reading a password from the terminal.
639* Minibuffer Commands:: Commands used as key bindings in minibuffers. 639* Minibuffer Commands:: Commands used as key bindings in minibuffers.
640* Minibuffer Contents:: How such commands access the minibuffer text.
641* Minibuffer Windows:: Operating on the special minibuffer windows. 640* Minibuffer Windows:: Operating on the special minibuffer windows.
641* Minibuffer Contents:: How such commands access the minibuffer text.
642* Recursive Mini:: Whether recursive entry to minibuffer is allowed. 642* Recursive Mini:: Whether recursive entry to minibuffer is allowed.
643* Minibuffer Misc:: Various customization hooks and variables. 643* Minibuffer Misc:: Various customization hooks and variables.
644 644
@@ -648,7 +648,7 @@ Completion
648* Minibuffer Completion:: Invoking the minibuffer with completion. 648* Minibuffer Completion:: Invoking the minibuffer with completion.
649* Completion Commands:: Minibuffer commands that do completion. 649* Completion Commands:: Minibuffer commands that do completion.
650* High-Level Completion:: Convenient special cases of completion 650* High-Level Completion:: Convenient special cases of completion
651 (reading buffer name, file name, etc.). 651 (reading buffer names, variable names, etc.).
652* Reading File Names:: Using completion to read file names and 652* Reading File Names:: Using completion to read file names and
653 shell commands. 653 shell commands.
654* Completion Variables:: Variables controlling completion behavior. 654* Completion Variables:: Variables controlling completion behavior.
diff --git a/doc/lispref/files.texi b/doc/lispref/files.texi
index ca4504ca967..3597d9f80c4 100644
--- a/doc/lispref/files.texi
+++ b/doc/lispref/files.texi
@@ -489,11 +489,13 @@ in particular buffers.
489@defopt require-final-newline 489@defopt require-final-newline
490This variable determines whether files may be written out that do 490This variable determines whether files may be written out that do
491@emph{not} end with a newline. If the value of the variable is 491@emph{not} end with a newline. If the value of the variable is
492@code{t}, then @code{save-buffer} silently adds a newline at the end of 492@code{t}, then @code{save-buffer} silently adds a newline at the end
493the file whenever the buffer being saved does not already end in one. 493of the buffer whenever it does not already end in one. If the value
494If the value of the variable is non-@code{nil}, but not @code{t}, then 494is @code{visit}, Emacs adds a missing newline just after it visits the
495@code{save-buffer} asks the user whether to add a newline each time the 495file. If the value is @code{visit-save}, Emacs adds a missing newline
496case arises. 496both on visiting and on saving. For any other non-@code{nil} value,
497@code{save-buffer} asks the user whether to add a newline each time
498the case arises.
497 499
498If the value of the variable is @code{nil}, then @code{save-buffer} 500If the value of the variable is @code{nil}, then @code{save-buffer}
499doesn't add newlines at all. @code{nil} is the default value, but a few 501doesn't add newlines at all. @code{nil} is the default value, but a few
diff --git a/doc/lispref/help.texi b/doc/lispref/help.texi
index 769b4292d30..5dfb2b05ff8 100644
--- a/doc/lispref/help.texi
+++ b/doc/lispref/help.texi
@@ -347,6 +347,21 @@ This function scans @var{string} for the above special sequences and
347replaces them by what they stand for, returning the result as a string. 347replaces them by what they stand for, returning the result as a string.
348This permits display of documentation that refers accurately to the 348This permits display of documentation that refers accurately to the
349user's own customized key bindings. 349user's own customized key bindings.
350
351@cindex advertised binding
352If a command has multiple bindings, this function normally uses the
353first one it finds. You can specify one particular key binding by
354assigning an @code{:advertised-binding} symbol property to the
355command, like this:
356
357@smallexample
358(put 'undo :advertised-binding [?\C-/])
359@end smallexample
360
361@noindent
362The @code{:advertised-binding} property also affects the binding shown
363in menu items (@pxref{Menu Bar}). The property is ignored if it
364specifies a key binding that the command does not actually have.
350@end defun 365@end defun
351 366
352 Here are examples of the special sequences: 367 Here are examples of the special sequences:
diff --git a/doc/lispref/keymaps.texi b/doc/lispref/keymaps.texi
index f8befb8fd90..b12752fdeea 100644
--- a/doc/lispref/keymaps.texi
+++ b/doc/lispref/keymaps.texi
@@ -2548,17 +2548,8 @@ the same command (if such a key binding exists). This serves as a
2548convenient hint for users who do not know the key binding. If a 2548convenient hint for users who do not know the key binding. If a
2549command has multiple bindings, Emacs normally displays the first one 2549command has multiple bindings, Emacs normally displays the first one
2550it finds. You can specify one particular key binding by assigning an 2550it finds. You can specify one particular key binding by assigning an
2551@code{:advertised-binding} symbol property to the command. For 2551@code{:advertised-binding} symbol property to the command. @xref{Keys
2552instance, the following tells Emacs to show @kbd{C-/} for the 2552in Documentation}.
2553@code{undo} menu item:
2554
2555@smallexample
2556(put 'undo :advertised-binding [?\C-/])
2557@end smallexample
2558
2559@noindent
2560If the @code{:advertised-binding} property specifies a key binding
2561that the command does not actually have, it is ignored.
2562 2553
2563@node Tool Bar 2554@node Tool Bar
2564@subsection Tool bars 2555@subsection Tool bars
diff --git a/doc/lispref/minibuf.texi b/doc/lispref/minibuf.texi
index 1be21f5d974..c840eb6ded0 100644
--- a/doc/lispref/minibuf.texi
+++ b/doc/lispref/minibuf.texi
@@ -29,8 +29,8 @@ argument.
29* Multiple Queries:: Asking a series of similar questions. 29* Multiple Queries:: Asking a series of similar questions.
30* Reading a Password:: Reading a password from the terminal. 30* Reading a Password:: Reading a password from the terminal.
31* Minibuffer Commands:: Commands used as key bindings in minibuffers. 31* Minibuffer Commands:: Commands used as key bindings in minibuffers.
32* Minibuffer Contents:: How such commands access the minibuffer text.
33* Minibuffer Windows:: Operating on the special minibuffer windows. 32* Minibuffer Windows:: Operating on the special minibuffer windows.
33* Minibuffer Contents:: How such commands access the minibuffer text.
34* Recursive Mini:: Whether recursive entry to minibuffer is allowed. 34* Recursive Mini:: Whether recursive entry to minibuffer is allowed.
35* Minibuffer Misc:: Various customization hooks and variables. 35* Minibuffer Misc:: Various customization hooks and variables.
36@end menu 36@end menu
@@ -59,8 +59,10 @@ boundary between the prompt and the actual text.
59 59
60 The minibuffer's window is normally a single line; it grows 60 The minibuffer's window is normally a single line; it grows
61automatically if the contents require more space. You can explicitly 61automatically if the contents require more space. You can explicitly
62@c FIXME? Works in 23.4, not 24.0.95. (Bug#11276)
62resize it temporarily with the window sizing commands; it reverts to 63resize it temporarily with the window sizing commands; it reverts to
63its normal size when the minibuffer is exited. You can resize it 64its normal size when the minibuffer is exited. You can resize it
65@c FIXME? Doesn't work in any version of Emacs?
64permanently by using the window sizing commands in the frame's other 66permanently by using the window sizing commands in the frame's other
65window, when the minibuffer is not active. If the frame contains just 67window, when the minibuffer is not active. If the frame contains just
66a minibuffer, you can change the minibuffer's size by changing the 68a minibuffer, you can change the minibuffer's size by changing the
@@ -72,9 +74,9 @@ of variables such as @code{this-command} and @code{last-command}
72code that uses the minibuffer, if you do not want that to change them. 74code that uses the minibuffer, if you do not want that to change them.
73 75
74 Under some circumstances, a command can use a minibuffer even if 76 Under some circumstances, a command can use a minibuffer even if
75there is an active minibuffer; such minibuffers are called a 77there is an active minibuffer; such a minibuffer is called a
76@dfn{recursive minibuffer}. The first minibuffer is named 78@dfn{recursive minibuffer}. The first minibuffer is named
77@w{@samp{ *Minibuf-0*}}. Recursive minibuffers are named by 79@w{@samp{ *Minibuf-1*}}. Recursive minibuffers are named by
78incrementing the number at the end of the name. (The names begin with 80incrementing the number at the end of the name. (The names begin with
79a space so that they won't show up in normal buffer lists.) Of 81a space so that they won't show up in normal buffer lists.) Of
80several recursive minibuffers, the innermost (or most recently 82several recursive minibuffers, the innermost (or most recently
@@ -90,6 +92,12 @@ to be done. @xref{Text from Minibuffer}, for the non-completion
90minibuffer local maps. @xref{Completion Commands}, for the minibuffer 92minibuffer local maps. @xref{Completion Commands}, for the minibuffer
91local maps for completion. 93local maps for completion.
92 94
95@cindex inactive minibuffer
96 When a minibuffer is inactive, its major mode is
97@code{minibuffer-inactive-mode}, with keymap
98@code{minibuffer-inactive-mode-map}. This is only really useful if
99the minibuffer is in a separate frame. @xref{Minibuffers and Frames}.
100
93 When Emacs is running in batch mode, any request to read from the 101 When Emacs is running in batch mode, any request to read from the
94minibuffer actually reads a line from the standard input descriptor that 102minibuffer actually reads a line from the standard input descriptor that
95was supplied when Emacs was started. 103was supplied when Emacs was started.
@@ -110,7 +118,7 @@ middle of a Lisp function. Instead, do all minibuffer input as part of
110reading the arguments for a command, in the @code{interactive} 118reading the arguments for a command, in the @code{interactive}
111specification. @xref{Defining Commands}. 119specification. @xref{Defining Commands}.
112 120
113@defun read-from-minibuffer prompt-string &optional initial-contents keymap read hist default inherit-input-method 121@defun read-from-minibuffer prompt &optional initial keymap read history default inherit-input-method
114This function is the most general way to get input from the 122This function is the most general way to get input from the
115minibuffer. By default, it accepts arbitrary text and returns it as a 123minibuffer. By default, it accepts arbitrary text and returns it as a
116string; however, if @var{read} is non-@code{nil}, then it uses 124string; however, if @var{read} is non-@code{nil}, then it uses
@@ -118,8 +126,8 @@ string; however, if @var{read} is non-@code{nil}, then it uses
118Functions}). 126Functions}).
119 127
120The first thing this function does is to activate a minibuffer and 128The first thing this function does is to activate a minibuffer and
121display it with @var{prompt-string} as the prompt. This value must be a 129display it with @var{prompt} (which must be a string) as the
122string. Then the user can edit text in the minibuffer. 130prompt. Then the user can edit text in the minibuffer.
123 131
124When the user types a command to exit the minibuffer, 132When the user types a command to exit the minibuffer,
125@code{read-from-minibuffer} constructs the return value from the text in 133@code{read-from-minibuffer} constructs the return value from the text in
@@ -131,7 +139,7 @@ reads the text and returns the resulting Lisp object, unevaluated.
131The argument @var{default} specifies default values to make available 139The argument @var{default} specifies default values to make available
132through the history commands. It should be a string, a list of 140through the history commands. It should be a string, a list of
133strings, or @code{nil}. The string or strings become the minibuffer's 141strings, or @code{nil}. The string or strings become the minibuffer's
134``future history,'' available to the user with @kbd{M-n}. 142``future history'', available to the user with @kbd{M-n}.
135 143
136If @var{read} is non-@code{nil}, then @var{default} is also used 144If @var{read} is non-@code{nil}, then @var{default} is also used
137as the input to @code{read}, if the user enters empty input. 145as the input to @code{read}, if the user enters empty input.
@@ -148,12 +156,13 @@ value of @code{minibuffer-local-map} is used as the keymap. Specifying
148a keymap is the most important way to customize the minibuffer for 156a keymap is the most important way to customize the minibuffer for
149various applications such as completion. 157various applications such as completion.
150 158
151The argument @var{hist} specifies which history list variable to use 159The argument @var{history} specifies a history list variable to use
152for saving the input and for history commands used in the minibuffer. 160for saving the input and for history commands used in the minibuffer.
153It defaults to @code{minibuffer-history}. @xref{Minibuffer History}. 161It defaults to @code{minibuffer-history}. You can optionally specify
162a starting position in the history list as well. @xref{Minibuffer History}.
154 163
155If the variable @code{minibuffer-allow-text-properties} is 164If the variable @code{minibuffer-allow-text-properties} is
156non-@code{nil}, then the string which is returned includes whatever text 165non-@code{nil}, then the string that is returned includes whatever text
157properties were present in the minibuffer. Otherwise all the text 166properties were present in the minibuffer. Otherwise all the text
158properties are stripped when the value is returned. 167properties are stripped when the value is returned.
159 168
@@ -163,9 +172,9 @@ the setting of @code{enable-multibyte-characters} (@pxref{Text
163Representations}) from whichever buffer was current before entering the 172Representations}) from whichever buffer was current before entering the
164minibuffer. 173minibuffer.
165 174
166Use of @var{initial-contents} is mostly deprecated; we recommend using 175Use of @var{initial} is mostly deprecated; we recommend using
167a non-@code{nil} value only in conjunction with specifying a cons cell 176a non-@code{nil} value only in conjunction with specifying a cons cell
168for @var{hist}. @xref{Initial Input}. 177for @var{history}. @xref{Initial Input}.
169@end defun 178@end defun
170 179
171@defun read-string prompt &optional initial history default inherit-input-method 180@defun read-string prompt &optional initial history default inherit-input-method
@@ -178,11 +187,11 @@ The optional argument @var{default} is used as in
178@code{read-from-minibuffer}, except that, if non-@code{nil}, it also 187@code{read-from-minibuffer}, except that, if non-@code{nil}, it also
179specifies a default value to return if the user enters null input. As 188specifies a default value to return if the user enters null input. As
180in @code{read-from-minibuffer} it should be a string, a list of 189in @code{read-from-minibuffer} it should be a string, a list of
181strings, or @code{nil} which is equivalent to an empty string. When 190strings, or @code{nil}, which is equivalent to an empty string. When
182@var{default} is a string, that string is the default value. When it 191@var{default} is a string, that string is the default value. When it
183is a list of strings, the first string is the default value. (All 192is a list of strings, the first string is the default value. (All
184these strings are available to the user in the ``future minibuffer 193these strings are available to the user in the ``future minibuffer
185history.'') 194history''.)
186 195
187This function works by calling the 196This function works by calling the
188@code{read-from-minibuffer} function: 197@code{read-from-minibuffer} function:
@@ -201,16 +210,16 @@ This function works by calling the
201@end smallexample 210@end smallexample
202@end defun 211@end defun
203 212
204@defun read-regexp prompt &optional default-value 213@defun read-regexp prompt &optional default
205This function reads a regular expression as a string from the 214This function reads a regular expression as a string from the
206minibuffer and returns it. The argument @var{prompt} is used as in 215minibuffer and returns it. The argument @var{prompt} is used as in
207@code{read-from-minibuffer}. The keymap used is 216@code{read-from-minibuffer}. The keymap used is
208@code{minibuffer-local-map}, and @code{regexp-history} is used as the 217@code{minibuffer-local-map}, and @code{regexp-history} is used as the
209history list (@pxref{Minibuffer History, regexp-history}). 218history list (@pxref{Minibuffer History, regexp-history}).
210 219
211The optional argument @var{default-value} specifies a default value to 220The optional argument @var{default} specifies a default value to
212return if the user enters null input; it should be a string, or 221return if the user enters null input; it should be a string, or
213@code{nil} which is equivalent to an empty string. 222@code{nil}, which is equivalent to an empty string.
214 223
215In addition, @code{read-regexp} collects a few useful candidates for 224In addition, @code{read-regexp} collects a few useful candidates for
216input and passes them to @code{read-from-minibuffer}, to make them 225input and passes them to @code{read-from-minibuffer}, to make them
@@ -234,9 +243,9 @@ function, after computing the list of defaults as described above.
234@end defun 243@end defun
235 244
236@defvar minibuffer-allow-text-properties 245@defvar minibuffer-allow-text-properties
237If this variable is @code{nil}, then @code{read-from-minibuffer} strips 246If this variable is @code{nil}, then @code{read-from-minibuffer}
238all text properties from the minibuffer input before returning it. 247and @code{read-string} strip all text properties from the minibuffer
239This variable also affects @code{read-string}. However, 248input before returning it. However,
240@code{read-no-blanks-input} (see below), as well as 249@code{read-no-blanks-input} (see below), as well as
241@code{read-minibuffer} and related functions (@pxref{Object from 250@code{read-minibuffer} and related functions (@pxref{Object from
242Minibuffer,, Reading Lisp Objects With the Minibuffer}), and all 251Minibuffer,, Reading Lisp Objects With the Minibuffer}), and all
@@ -274,6 +283,12 @@ default, it makes the following bindings:
274 283
275@item @kbd{M-r} 284@item @kbd{M-r}
276@code{previous-matching-history-element} 285@code{previous-matching-history-element}
286
287@ignore
288@c Does not seem worth/appropriate mentioning.
289@item @kbd{C-@key{TAB}}
290@code{file-cache-minibuffer-complete}
291@end ignore
277@end table 292@end table
278@end defvar 293@end defvar
279 294
@@ -304,6 +319,8 @@ This function discards text properties, regardless of the value of
304@end smallexample 319@end smallexample
305@end defun 320@end defun
306 321
322@c Slightly unfortunate name, suggesting it might be related to the
323@c Nextstep port...
307@defvar minibuffer-local-ns-map 324@defvar minibuffer-local-ns-map
308This built-in variable is the keymap used as the minibuffer local keymap 325This built-in variable is the keymap used as the minibuffer local keymap
309in the function @code{read-no-blanks-input}. By default, it makes the 326in the function @code{read-no-blanks-input}. By default, it makes the
@@ -388,23 +405,16 @@ This function simply evaluates the result of a call to
388@end defun 405@end defun
389 406
390@defun edit-and-eval-command prompt form 407@defun edit-and-eval-command prompt form
391This function reads a Lisp expression in the minibuffer, and then 408This function reads a Lisp expression in the minibuffer, evaluates it,
392evaluates it. The difference between this command and 409then returns the result. The difference between this command and
393@code{eval-minibuffer} is that here the initial @var{form} is not 410@code{eval-minibuffer} is that here the initial @var{form} is not
394optional and it is treated as a Lisp object to be converted to printed 411optional and it is treated as a Lisp object to be converted to printed
395representation rather than as a string of text. It is printed with 412representation rather than as a string of text. It is printed with
396@code{prin1}, so if it is a string, double-quote characters (@samp{"}) 413@code{prin1}, so if it is a string, double-quote characters (@samp{"})
397appear in the initial text. @xref{Output Functions}. 414appear in the initial text. @xref{Output Functions}.
398 415
399The first thing @code{edit-and-eval-command} does is to activate the
400minibuffer with @var{prompt} as the prompt. Then it inserts the printed
401representation of @var{form} in the minibuffer, and lets the user edit it.
402When the user exits the minibuffer, the edited text is read with
403@code{read} and then evaluated. The resulting value becomes the value
404of @code{edit-and-eval-command}.
405
406In the following example, we offer the user an expression with initial 416In the following example, we offer the user an expression with initial
407text which is a valid form already: 417text that is already a valid form:
408 418
409@smallexample 419@smallexample
410@group 420@group
@@ -424,7 +434,6 @@ Please edit: (forward-word 1)@point{}
424@noindent 434@noindent
425Typing @key{RET} right away would exit the minibuffer and evaluate the 435Typing @key{RET} right away would exit the minibuffer and evaluate the
426expression, thus moving point forward one word. 436expression, thus moving point forward one word.
427@code{edit-and-eval-command} returns @code{nil} in this example.
428@end defun 437@end defun
429 438
430@node Minibuffer History 439@node Minibuffer History
@@ -440,7 +449,7 @@ is a list of strings (previous inputs), most recent first.
440kinds of inputs. It's the Lisp programmer's job to specify the right 449kinds of inputs. It's the Lisp programmer's job to specify the right
441history list for each use of the minibuffer. 450history list for each use of the minibuffer.
442 451
443 You specify a minibuffer history list with the optional @var{hist} 452 You specify a minibuffer history list with the optional @var{history}
444argument to @code{read-from-minibuffer} or @code{completing-read}. 453argument to @code{read-from-minibuffer} or @code{completing-read}.
445Here are the possible values for it: 454Here are the possible values for it:
446 455
@@ -456,7 +465,7 @@ Specifying 0 for @var{startpos} is equivalent to just specifying the
456symbol @var{variable}. @code{previous-history-element} will display 465symbol @var{variable}. @code{previous-history-element} will display
457the most recent element of the history list in the minibuffer. If you 466the most recent element of the history list in the minibuffer. If you
458specify a positive @var{startpos}, the minibuffer history functions 467specify a positive @var{startpos}, the minibuffer history functions
459behave as if @code{(elt @var{variable} (1- @var{STARTPOS}))} were the 468behave as if @code{(elt @var{variable} (1- @var{startpos}))} were the
460history element currently shown in the minibuffer. 469history element currently shown in the minibuffer.
461 470
462For consistency, you should also specify that element of the history 471For consistency, you should also specify that element of the history
@@ -464,7 +473,7 @@ as the initial minibuffer contents, using the @var{initial} argument
464to the minibuffer input function (@pxref{Initial Input}). 473to the minibuffer input function (@pxref{Initial Input}).
465@end table 474@end table
466 475
467 If you don't specify @var{hist}, then the default history list 476 If you don't specify @var{history}, then the default history list
468@code{minibuffer-history} is used. For other standard history lists, 477@code{minibuffer-history} is used. For other standard history lists,
469see below. You can also create your own history list variable; just 478see below. You can also create your own history list variable; just
470initialize it to @code{nil} before the first use. 479initialize it to @code{nil} before the first use.
@@ -503,15 +512,15 @@ If the value of this variable is @code{nil}, standard functions that
503read from the minibuffer don't add new elements to the history list. 512read from the minibuffer don't add new elements to the history list.
504This lets Lisp programs explicitly manage input history by using 513This lets Lisp programs explicitly manage input history by using
505@code{add-to-history}. By default, @code{history-add-new-input} is 514@code{add-to-history}. By default, @code{history-add-new-input} is
506set to a non-@code{nil} value. 515non-@code{nil}.
507@end defvar 516@end defvar
508 517
509@defopt history-length 518@defopt history-length
510The value of this variable specifies the maximum length for all 519The value of this variable specifies the maximum length for all
511history lists that don't specify their own maximum lengths. If the 520history lists that don't specify their own maximum lengths. If the
512value is @code{t}, that means there is no maximum (don't delete old 521value is @code{t}, that means there is no maximum (don't delete old
513elements). The value of @code{history-length} property of the history 522elements). If a history list variable's symbol has a non-@code{nil}
514list variable's symbol, if set, overrides this variable for that 523@code{history-length} property, it overrides this variable for that
515particular history list. 524particular history list.
516@end defopt 525@end defopt
517 526
@@ -555,11 +564,19 @@ A history list for arguments that are shell commands.
555A history list for arguments that are Lisp expressions to evaluate. 564A history list for arguments that are Lisp expressions to evaluate.
556@end defvar 565@end defvar
557 566
567@defvar face-name-history
568A history list for arguments that are faces.
569@end defvar
570
571@c Less common: coding-system-history, input-method-history,
572@c command-history, grep-history, grep-find-history,
573@c read-envvar-name-history, setenv-history, yes-or-no-p-history.
574
558@node Initial Input 575@node Initial Input
559@section Initial Input 576@section Initial Input
560 577
561Several of the functions for minibuffer input have an argument called 578Several of the functions for minibuffer input have an argument called
562@var{initial} or @var{initial-contents}. This is a mostly-deprecated 579@var{initial}. This is a mostly-deprecated
563feature for specifying that the minibuffer should start out with 580feature for specifying that the minibuffer should start out with
564certain text, instead of empty as usual. 581certain text, instead of empty as usual.
565 582
@@ -576,7 +593,7 @@ to offer useful default inputs to the user.
576 593
577There is just one situation where you should specify a string for an 594There is just one situation where you should specify a string for an
578@var{initial} argument. This is when you specify a cons cell for the 595@var{initial} argument. This is when you specify a cons cell for the
579@var{hist} or @var{history} argument. @xref{Minibuffer History}. 596@var{history} argument. @xref{Minibuffer History}.
580 597
581@var{initial} can also be a cons cell of the form @code{(@var{string} 598@var{initial} can also be a cons cell of the form @code{(@var{string}
582. @var{position})}. This means to insert @var{string} in the 599. @var{position})}. This means to insert @var{string} in the
@@ -588,11 +605,10 @@ inconsistently in different functions. In @code{completing-read},
588of 0 means the beginning of the string, 1 means after the first 605of 0 means the beginning of the string, 1 means after the first
589character, etc. In @code{read-minibuffer}, and the other 606character, etc. In @code{read-minibuffer}, and the other
590non-completion minibuffer input functions that support this argument, 607non-completion minibuffer input functions that support this argument,
5911 means the beginning of the string 2 means after the first character, 6081 means the beginning of the string, 2 means after the first character,
592etc. 609etc.
593 610
594Use of a cons cell as the value for @var{initial} arguments is 611Use of a cons cell as the value for @var{initial} arguments is deprecated.
595deprecated in user code.
596 612
597@node Completion 613@node Completion
598@section Completion 614@section Completion
@@ -603,6 +619,7 @@ starting from an abbreviation for it. Completion works by comparing the
603user's input against a list of valid names and determining how much of 619user's input against a list of valid names and determining how much of
604the name is determined uniquely by what the user has typed. For 620the name is determined uniquely by what the user has typed. For
605example, when you type @kbd{C-x b} (@code{switch-to-buffer}) and then 621example, when you type @kbd{C-x b} (@code{switch-to-buffer}) and then
622@c "This is the sort of English up with which I will not put."
606type the first few letters of the name of the buffer to which you wish 623type the first few letters of the name of the buffer to which you wish
607to switch, and then type @key{TAB} (@code{minibuffer-complete}), Emacs 624to switch, and then type @key{TAB} (@code{minibuffer-complete}), Emacs
608extends the name as far as it can. 625extends the name as far as it can.
@@ -627,7 +644,7 @@ for reading certain kinds of names with completion.
627* Minibuffer Completion:: Invoking the minibuffer with completion. 644* Minibuffer Completion:: Invoking the minibuffer with completion.
628* Completion Commands:: Minibuffer commands that do completion. 645* Completion Commands:: Minibuffer commands that do completion.
629* High-Level Completion:: Convenient special cases of completion 646* High-Level Completion:: Convenient special cases of completion
630 (reading buffer name, file name, etc.). 647 (reading buffer names, variable names, etc.).
631* Reading File Names:: Using completion to read file names and 648* Reading File Names:: Using completion to read file names and
632 shell commands. 649 shell commands.
633* Completion Variables:: Variables controlling completion behavior. 650* Completion Variables:: Variables controlling completion behavior.
@@ -662,20 +679,14 @@ If @var{collection} is an alist (@pxref{Association Lists}), the
662permissible completions are the elements of the alist that are either 679permissible completions are the elements of the alist that are either
663strings, or conses whose @sc{car} is a string or symbol. 680strings, or conses whose @sc{car} is a string or symbol.
664Symbols are converted to strings using @code{symbol-name}. Other 681Symbols are converted to strings using @code{symbol-name}. Other
665elements of the alist are ignored. (Remember that in Emacs Lisp, the 682elements of the alist are ignored. (Remember that in Emacs Lisp, the
666elements of alists do not @emph{have} to be conses.) In particular, a 683elements of alists do not @emph{have} to be conses.) In particular, a
667list of strings is allowed, even though we usually do not 684list of strings is allowed, even though we usually do not
668think of such lists as alists. 685think of such lists as alists.
669 686
670@cindex obarray in completion 687@cindex obarray in completion
671If @var{collection} is an obarray (@pxref{Creating Symbols}), the names 688If @var{collection} is an obarray (@pxref{Creating Symbols}), the names
672of all symbols in the obarray form the set of permissible completions. The 689of all symbols in the obarray form the set of permissible completions.
673global variable @code{obarray} holds an obarray containing the names of
674all interned Lisp symbols.
675
676Note that the only valid way to make a new obarray is to create it
677empty and then add symbols to it one by one using @code{intern}.
678Also, you cannot intern a given symbol in more than one obarray.
679 690
680If @var{collection} is a hash table, then the keys that are strings 691If @var{collection} is a hash table, then the keys that are strings
681are the possible completions. Other keys are ignored. 692are the possible completions. Other keys are ignored.
@@ -756,16 +767,20 @@ too short). Both of those begin with the string @samp{foobar}.
756@end smallexample 767@end smallexample
757@end defun 768@end defun
758 769
759@defun all-completions string collection &optional predicate nospace 770@c Removed obsolete argument nospace.
771@defun all-completions string collection &optional predicate
760This function returns a list of all possible completions of 772This function returns a list of all possible completions of
761@var{string}. The arguments to this function (aside from 773@var{string}. The arguments to this function
762@var{nospace}) are the same as those of @code{try-completion}. Also, 774@c (aside from @var{nospace})
763this function uses @code{completion-regexp-list} in the same way that 775are the same as those of @code{try-completion}, and it
776uses @code{completion-regexp-list} in the same way that
764@code{try-completion} does. 777@code{try-completion} does.
765 778
779@ignore
766The optional argument @var{nospace} is obsolete. If it is 780The optional argument @var{nospace} is obsolete. If it is
767non-@code{nil}, completions that start with a space are ignored unless 781non-@code{nil}, completions that start with a space are ignored unless
768@var{string} starts with a space. 782@var{string} starts with a space.
783@end ignore
769 784
770If @var{collection} is a function, it is called with three arguments: 785If @var{collection} is a function, it is called with three arguments:
771@var{string}, @var{predicate} and @code{t}; then @code{all-completions} 786@var{string}, @var{predicate} and @code{t}; then @code{all-completions}
@@ -835,7 +850,7 @@ pertains to the area after @code{"/usr/"} and before @code{"/doc"}.
835@end defun 850@end defun
836 851
837If you store a completion alist in a variable, you should mark the 852If you store a completion alist in a variable, you should mark the
838variable as ``risky'' with a non-@code{nil} 853variable as ``risky'' by giving it a non-@code{nil}
839@code{risky-local-variable} property. @xref{File Local Variables}. 854@code{risky-local-variable} property. @xref{File Local Variables}.
840 855
841@defvar completion-ignore-case 856@defvar completion-ignore-case
@@ -864,7 +879,7 @@ proper value is done the first time you do completion using @var{var}.
864It is done by calling @var{fun} with no arguments. The 879It is done by calling @var{fun} with no arguments. The
865value @var{fun} returns becomes the permanent value of @var{var}. 880value @var{fun} returns becomes the permanent value of @var{var}.
866 881
867Here is a usage example: 882Here is an example:
868 883
869@smallexample 884@smallexample
870(defvar foo (lazy-completion-table foo make-my-alist)) 885(defvar foo (lazy-completion-table foo make-my-alist))
@@ -879,7 +894,7 @@ Here is a usage example:
879 This section describes the basic interface for reading from the 894 This section describes the basic interface for reading from the
880minibuffer with completion. 895minibuffer with completion.
881 896
882@defun completing-read prompt collection &optional predicate require-match initial hist default inherit-input-method 897@defun completing-read prompt collection &optional predicate require-match initial history default inherit-input-method
883This function reads a string in the minibuffer, assisting the user by 898This function reads a string in the minibuffer, assisting the user by
884providing completion. It activates the minibuffer with prompt 899providing completion. It activates the minibuffer with prompt
885@var{prompt}, which must be a string. 900@var{prompt}, which must be a string.
@@ -934,13 +949,13 @@ The function @code{completing-read} uses
934@code{minibuffer-local-must-match-map} if @var{require-match} is 949@code{minibuffer-local-must-match-map} if @var{require-match} is
935non-@code{nil}. @xref{Completion Commands}. 950non-@code{nil}. @xref{Completion Commands}.
936 951
937The argument @var{hist} specifies which history list variable to use for 952The argument @var{history} specifies which history list variable to use for
938saving the input and for minibuffer history commands. It defaults to 953saving the input and for minibuffer history commands. It defaults to
939@code{minibuffer-history}. @xref{Minibuffer History}. 954@code{minibuffer-history}. @xref{Minibuffer History}.
940 955
941The argument @var{initial} is mostly deprecated; we recommend using a 956The argument @var{initial} is mostly deprecated; we recommend using a
942non-@code{nil} value only in conjunction with specifying a cons cell 957non-@code{nil} value only in conjunction with specifying a cons cell
943for @var{hist}. @xref{Initial Input}. For default input, use 958for @var{history}. @xref{Initial Input}. For default input, use
944@var{default} instead. 959@var{default} instead.
945 960
946If the argument @var{inherit-input-method} is non-@code{nil}, then the 961If the argument @var{inherit-input-method} is non-@code{nil}, then the
@@ -949,7 +964,7 @@ Methods}) and the setting of @code{enable-multibyte-characters}
949(@pxref{Text Representations}) from whichever buffer was current before 964(@pxref{Text Representations}) from whichever buffer was current before
950entering the minibuffer. 965entering the minibuffer.
951 966
952If the built-in variable @code{completion-ignore-case} is 967If the variable @code{completion-ignore-case} is
953non-@code{nil}, completion ignores case when comparing the input 968non-@code{nil}, completion ignores case when comparing the input
954against the possible matches. @xref{Basic Completion}. In this mode 969against the possible matches. @xref{Basic Completion}. In this mode
955of operation, @var{predicate} must also ignore case, or you will get 970of operation, @var{predicate} must also ignore case, or you will get
@@ -1082,8 +1097,8 @@ uses this to highlight text in the completion list for better visual
1082feedback. This is not needed in the minibuffer; for minibuffer 1097feedback. This is not needed in the minibuffer; for minibuffer
1083completion, you can pass @code{nil}. 1098completion, you can pass @code{nil}.
1084 1099
1085This function is called by @code{minibuffer-completion-help}. The 1100This function is called by @code{minibuffer-completion-help}. A
1086most common way to use it is together with 1101common way to use it is together with
1087@code{with-output-to-temp-buffer}, like this: 1102@code{with-output-to-temp-buffer}, like this:
1088 1103
1089@example 1104@example
@@ -1117,7 +1132,7 @@ keymap makes the following bindings:
1117@end table 1132@end table
1118 1133
1119@noindent 1134@noindent
1120with other characters bound as in @code{minibuffer-local-map} 1135and uses @code{minibuffer-local-map} as its parent keymap
1121(@pxref{Definition of minibuffer-local-map}). 1136(@pxref{Definition of minibuffer-local-map}).
1122@end defvar 1137@end defvar
1123 1138
@@ -1129,15 +1144,6 @@ minibuffer unconditionally. By default, this keymap makes the following
1129bindings: 1144bindings:
1130 1145
1131@table @asis 1146@table @asis
1132@item @kbd{?}
1133@code{minibuffer-completion-help}
1134
1135@item @key{SPC}
1136@code{minibuffer-complete-word}
1137
1138@item @key{TAB}
1139@code{minibuffer-complete}
1140
1141@item @kbd{C-j} 1147@item @kbd{C-j}
1142@code{minibuffer-complete-and-exit} 1148@code{minibuffer-complete-and-exit}
1143 1149
@@ -1146,25 +1152,21 @@ bindings:
1146@end table 1152@end table
1147 1153
1148@noindent 1154@noindent
1149with other characters bound as in @code{minibuffer-local-map}. 1155and uses @code{minibuffer-local-completion-map} as its parent keymap.
1150@end defvar 1156@end defvar
1151 1157
1152@defvar minibuffer-local-filename-completion-map 1158@defvar minibuffer-local-filename-completion-map
1153This is like @code{minibuffer-local-completion-map} 1159This is a sparse keymap that simply unbinds @key{SPC}; because
1154except that it does not bind @key{SPC}. This keymap is used by the 1160filenames can contain spaces. The function @code{read-file-name}
1155function @code{read-file-name}. 1161combines this keymap with either @code{minibuffer-local-completion-map}
1162or @code{minibuffer-local-must-match-map}.
1156@end defvar 1163@end defvar
1157 1164
1158@defvar minibuffer-local-filename-must-match-map
1159This is like @code{minibuffer-local-must-match-map}
1160except that it does not bind @key{SPC}. This keymap is used by the
1161function @code{read-file-name}.
1162@end defvar
1163 1165
1164@node High-Level Completion 1166@node High-Level Completion
1165@subsection High-Level Completion Functions 1167@subsection High-Level Completion Functions
1166 1168
1167 This section describes the higher-level convenient functions for 1169 This section describes the higher-level convenience functions for
1168reading certain sorts of names with completion. 1170reading certain sorts of names with completion.
1169 1171
1170 In most cases, you should not call these functions in the middle of a 1172 In most cases, you should not call these functions in the middle of a
@@ -1238,7 +1240,7 @@ for which @code{commandp} returns @code{t}. @xref{Interactive Call}.
1238The argument @var{default} specifies what to return if the user enters 1240The argument @var{default} specifies what to return if the user enters
1239null input. It can be a symbol, a string or a list of strings. If it 1241null input. It can be a symbol, a string or a list of strings. If it
1240is a string, @code{read-command} interns it before returning it. 1242is a string, @code{read-command} interns it before returning it.
1241If it is a list, @code{read-command} returns the first element of this list. 1243If it is a list, @code{read-command} interns the first element of this list.
1242If @var{default} is @code{nil}, that means no default has been 1244If @var{default} is @code{nil}, that means no default has been
1243specified; then if the user enters null input, the return value is 1245specified; then if the user enters null input, the return value is
1244@code{(intern "")}, that is, a symbol whose name is an empty string. 1246@code{(intern "")}, that is, a symbol whose name is an empty string.
@@ -1280,51 +1282,11 @@ complete in the set of extant Lisp symbols, and it uses the
1280 1282
1281@defun read-variable prompt &optional default 1283@defun read-variable prompt &optional default
1282@anchor{Definition of read-variable} 1284@anchor{Definition of read-variable}
1283This function reads the name of a user variable and returns it as a 1285This function reads the name of a customizable variable and returns it
1284symbol. 1286as a symbol. Its arguments have the same form as those of
1285 1287@code{read-command}. It behaves just like @code{read-command}, except
1286The argument @var{default} specifies the default value to return if 1288that it uses the predicate @code{custom-variable-p} instead of
1287the user enters null input. It can be a symbol, a string, or a list 1289@code{commandp}.
1288of strings. If it is a string, @code{read-variable} interns it to
1289make the default value. If it is a list, @code{read-variable} interns
1290the first element. If @var{default} is @code{nil}, that means no
1291default has been specified; then if the user enters null input, the
1292return value is @code{(intern "")}.
1293
1294@example
1295@group
1296(read-variable "Variable name? ")
1297
1298;; @r{After evaluation of the preceding expression,}
1299;; @r{the following prompt appears,}
1300;; @r{with an empty minibuffer:}
1301@end group
1302
1303@group
1304---------- Buffer: Minibuffer ----------
1305Variable name? @point{}
1306---------- Buffer: Minibuffer ----------
1307@end group
1308@end example
1309
1310@noindent
1311If the user then types @kbd{fill-p @key{RET}}, @code{read-variable}
1312returns @code{fill-prefix}.
1313
1314In general, @code{read-variable} is similar to @code{read-command},
1315but uses the predicate @code{custom-variable-p} instead of
1316@code{commandp}:
1317
1318@cindex @code{custom-variable-p} example
1319@example
1320@group
1321(read-variable @var{prompt})
1322@equiv{}
1323(intern
1324 (completing-read @var{prompt} obarray
1325 'custom-variable-p t nil))
1326@end group
1327@end example
1328@end defun 1290@end defun
1329 1291
1330@deffn Command read-color &optional prompt convert allow-empty display 1292@deffn Command read-color &optional prompt convert allow-empty display
@@ -1342,7 +1304,7 @@ minibuffer. However, when called interactively or if the optional
1342argument @var{convert} is non-@code{nil}, it converts any input color 1304argument @var{convert} is non-@code{nil}, it converts any input color
1343name into the corresponding RGB value string and instead returns that. 1305name into the corresponding RGB value string and instead returns that.
1344This function requires a valid color specification to be input. 1306This function requires a valid color specification to be input.
1345Empty color names are allowed when @code{allow-empty} is 1307Empty color names are allowed when @var{allow-empty} is
1346non-@code{nil} and the user enters null input. 1308non-@code{nil} and the user enters null input.
1347 1309
1348Interactively, or when @var{display} is non-@code{nil}, the return 1310Interactively, or when @var{display} is non-@code{nil}, the return
@@ -1360,7 +1322,7 @@ and @code{read-input-method-name}, in @ref{Input Methods}.
1360 1322
1361 The high-level completion functions @code{read-file-name}, 1323 The high-level completion functions @code{read-file-name},
1362@code{read-directory-name}, and @code{read-shell-command} are designed 1324@code{read-directory-name}, and @code{read-shell-command} are designed
1363to read file names, directory names, and shell commands respectively. 1325to read file names, directory names, and shell commands, respectively.
1364They provide special features, including automatic insertion of the 1326They provide special features, including automatic insertion of the
1365default directory. 1327default directory.
1366 1328
@@ -1369,15 +1331,29 @@ This function reads a file name, prompting with @var{prompt} and
1369providing completion. 1331providing completion.
1370 1332
1371As an exception, this function reads a file name using a graphical 1333As an exception, this function reads a file name using a graphical
1372file dialog instead of the minibuffer, if (i) it is invoked via a 1334file dialog instead of the minibuffer, if all of the following are
1373mouse command, and (ii) the selected frame is on a graphical display 1335true:
1374supporting such dialogs, and (iii) the variable @code{use-dialog-box} 1336
1375is non-@code{nil} (@pxref{Dialog Boxes,, Dialog Boxes, emacs, The GNU 1337@enumerate
1376Emacs Manual}), and (iv) the @var{directory} argument, described 1338@item
1377below, does not specify a remote file (@pxref{Remote Files,, Remote 1339It is invoked via a mouse command.
1378Files, emacs, The GNU Emacs Manual}). The exact behavior when using a 1340
1379graphical file dialog is platform-dependent. Here, we simply document 1341@item
1380the behavior when using the minibuffer. 1342The selected frame is on a graphical display supporting such dialogs.
1343
1344@item
1345The variable @code{use-dialog-box} is non-@code{nil}.
1346@xref{Dialog Boxes,, Dialog Boxes, emacs, The GNU Emacs Manual}.
1347
1348@item
1349The @var{directory} argument, described below, does not specify a
1350remote file. @xref{Remote Files,, Remote Files, emacs, The GNU Emacs Manual}.
1351@end enumerate
1352
1353@noindent
1354The exact behavior when using a graphical file dialog is
1355platform-dependent. Here, we simply document the behavior when using
1356the minibuffer.
1381 1357
1382@code{read-file-name} does not automatically expand the returned file 1358@code{read-file-name} does not automatically expand the returned file
1383name. You must call @code{expand-file-name} yourself if an absolute 1359name. You must call @code{expand-file-name} yourself if an absolute
@@ -1388,7 +1364,7 @@ The optional argument @var{require-match} has the same meaning as in
1388 1364
1389The argument @var{directory} specifies the directory to use for 1365The argument @var{directory} specifies the directory to use for
1390completing relative file names. It should be an absolute directory 1366completing relative file names. It should be an absolute directory
1391name. If @code{insert-default-directory} is non-@code{nil}, 1367name. If the variable @code{insert-default-directory} is non-@code{nil},
1392@var{directory} is also inserted in the minibuffer as initial input. 1368@var{directory} is also inserted in the minibuffer as initial input.
1393It defaults to the current buffer's value of @code{default-directory}. 1369It defaults to the current buffer's value of @code{default-directory}.
1394 1370
@@ -1396,9 +1372,9 @@ If you specify @var{initial}, that is an initial file name to insert
1396in the buffer (after @var{directory}, if that is inserted). In this 1372in the buffer (after @var{directory}, if that is inserted). In this
1397case, point goes at the beginning of @var{initial}. The default for 1373case, point goes at the beginning of @var{initial}. The default for
1398@var{initial} is @code{nil}---don't insert any file name. To see what 1374@var{initial} is @code{nil}---don't insert any file name. To see what
1399@var{initial} does, try the command @kbd{C-x C-v}. @strong{Please 1375@var{initial} does, try the command @kbd{C-x C-v} in a buffer visiting
1400note:} we recommend using @var{default} rather than @var{initial} in 1376a file. @strong{Please note:} we recommend using @var{default} rather
1401most cases. 1377than @var{initial} in most cases.
1402 1378
1403If @var{default} is non-@code{nil}, then the function returns 1379If @var{default} is non-@code{nil}, then the function returns
1404@var{default} if the user exits the minibuffer with the same non-empty 1380@var{default} if the user exits the minibuffer with the same non-empty
@@ -1501,7 +1477,7 @@ use the code letters @samp{f} or @samp{F} in their interactive form.
1501@xref{Interactive Codes,, Code Characters for interactive}.) Its 1477@xref{Interactive Codes,, Code Characters for interactive}.) Its
1502value controls whether @code{read-file-name} starts by placing the 1478value controls whether @code{read-file-name} starts by placing the
1503name of the default directory in the minibuffer, plus the initial file 1479name of the default directory in the minibuffer, plus the initial file
1504name if any. If the value of this variable is @code{nil}, then 1480name, if any. If the value of this variable is @code{nil}, then
1505@code{read-file-name} does not place any initial input in the 1481@code{read-file-name} does not place any initial input in the
1506minibuffer (unless you specify initial input with the @var{initial} 1482minibuffer (unless you specify initial input with the @var{initial}
1507argument). In that case, the default directory is still used for 1483argument). In that case, the default directory is still used for
@@ -1544,17 +1520,17 @@ The file is @point{}
1544@end example 1520@end example
1545@end defopt 1521@end defopt
1546 1522
1547@defun read-shell-command prompt &optional initial-contents hist &rest args 1523@defun read-shell-command prompt &optional initial history &rest args
1548This function reads a shell command from the minibuffer, prompting 1524This function reads a shell command from the minibuffer, prompting
1549with @var{prompt} and providing intelligent completion. It completes 1525with @var{prompt} and providing intelligent completion. It completes
1550the first word of the command using candidates that are appropriate 1526the first word of the command using candidates that are appropriate
1551for command names, and the rest of the command words as file names. 1527for command names, and the rest of the command words as file names.
1552 1528
1553This function uses @code{minibuffer-local-shell-command-map} as the 1529This function uses @code{minibuffer-local-shell-command-map} as the
1554keymap for minibuffer input. The @var{hist} argument specifies the 1530keymap for minibuffer input. The @var{history} argument specifies the
1555history list to use; if is omitted or @code{nil}, it defaults to 1531history list to use; if is omitted or @code{nil}, it defaults to
1556@code{shell-command-history} (@pxref{Minibuffer History, 1532@code{shell-command-history} (@pxref{Minibuffer History,
1557shell-command-history}). The optional argument @var{initial-contents} 1533shell-command-history}). The optional argument @var{initial}
1558specifies the initial content of the minibuffer (@pxref{Initial 1534specifies the initial content of the minibuffer (@pxref{Initial
1559Input}). The rest of @var{args}, if present, are used as the 1535Input}). The rest of @var{args}, if present, are used as the
1560@var{default} and @var{inherit-input-method} arguments in 1536@var{default} and @var{inherit-input-method} arguments in
@@ -1563,20 +1539,22 @@ Input}). The rest of @var{args}, if present, are used as the
1563 1539
1564@defvar minibuffer-local-shell-command-map 1540@defvar minibuffer-local-shell-command-map
1565This keymap is used by @code{read-shell-command} for completing 1541This keymap is used by @code{read-shell-command} for completing
1566command and file names that are part of a shell command. 1542command and file names that are part of a shell command. It uses
1543@code{minibuffer-local-map} as its parent keymap, and binds @key{TAB}
1544to @code{completion-at-point}.
1567@end defvar 1545@end defvar
1568 1546
1569@node Completion Variables 1547@node Completion Variables
1570@subsection Completion Variables 1548@subsection Completion Variables
1571 1549
1572 Here are some variables which can be used to alter the default 1550 Here are some variables that can be used to alter the default
1573completion behavior. 1551completion behavior.
1574 1552
1575@cindex completion styles 1553@cindex completion styles
1576@defopt completion-styles 1554@defopt completion-styles
1577The value of this variable is a list of completion style (symbols) to 1555The value of this variable is a list of completion style (symbols) to
1578use for performing completion. A @dfn{completion style} is a set of 1556use for performing completion. A @dfn{completion style} is a set of
1579rules for generating completions. Each symbol in occurring this list 1557rules for generating completions. Each symbol occurring this list
1580must have a corresponding entry in @code{completion-styles-alist}. 1558must have a corresponding entry in @code{completion-styles-alist}.
1581@end defopt 1559@end defopt
1582 1560
@@ -1623,13 +1601,14 @@ description of the available completion styles.
1623@defopt completion-category-overrides 1601@defopt completion-category-overrides
1624This variable specifies special completion styles and other completion 1602This variable specifies special completion styles and other completion
1625behaviors to use when completing certain types of text. Its value 1603behaviors to use when completing certain types of text. Its value
1626should be a list of the form @code{(@var{category} . @var{alist})}. 1604should be an alist with elements of the form @code{(@var{category}
1627@var{category} is a symbol describing what is being completed; 1605. @var{alist})}. @var{category} is a symbol describing what is being
1628currently, the @code{buffer} and @code{file} categories are defined, 1606completed; currently, the @code{buffer}, @code{file}, and
1629but others can be defined via specialized completion functions 1607@code{unicode-name} categories are defined, but others can be defined
1630(@pxref{Programmed Completion}). @var{alist} is an association list 1608via specialized completion functions (@pxref{Programmed Completion}).
1631describing how completion should behave for the corresponding 1609@var{alist} is an association list describing how completion should
1632category. The following alist keys are supported: 1610behave for the corresponding category. The following alist keys are
1611supported:
1633 1612
1634@table @code 1613@table @code
1635@item styles 1614@item styles
@@ -1662,7 +1641,7 @@ the completion.
1662The value should be a function to run after performing completion. 1641The value should be a function to run after performing completion.
1663The function should accept two arguments, @var{string} and 1642The function should accept two arguments, @var{string} and
1664@var{status}, where @var{string} is the text to which the field was 1643@var{status}, where @var{string} is the text to which the field was
1665completed and @var{status} indicates what kind of operation happened: 1644completed, and @var{status} indicates what kind of operation happened:
1666@code{finished} if text is now complete, @code{sole} if the text 1645@code{finished} if text is now complete, @code{sole} if the text
1667cannot be further completed but completion is not finished, or 1646cannot be further completed but completion is not finished, or
1668@code{exact} if the text is a valid completion but may be further 1647@code{exact} if the text is a valid completion but may be further
@@ -1726,9 +1705,10 @@ some completion alternative; @code{nil} otherwise.
1726 1705
1727@item (boundaries . @var{suffix}) 1706@item (boundaries . @var{suffix})
1728This specifies a @code{completion-boundaries} operation. The function 1707This specifies a @code{completion-boundaries} operation. The function
1729should return @code{(boundaries START . END)}, where START is the 1708should return @code{(boundaries @var{start} . @var{end})}, where
1730position of the beginning boundary in the specified string, and END is 1709@var{start} is the position of the beginning boundary in the specified
1731the position of the end boundary in SUFFIX. 1710string, and @var{end} is the position of the end boundary in
1711@var{suffix}.
1732 1712
1733@item metadata 1713@item metadata
1734This specifies a request for information about the state of the 1714This specifies a request for information about the state of the
@@ -1773,7 +1753,7 @@ the same as for @code{display-sort-function}.
1773 1753
1774@defun completion-table-dynamic function 1754@defun completion-table-dynamic function
1775This function is a convenient way to write a function that can act as 1755This function is a convenient way to write a function that can act as
1776programmed completion function. The argument @var{function} should be 1756a programmed completion function. The argument @var{function} should be
1777a function that takes one argument, a string, and returns an alist of 1757a function that takes one argument, a string, and returns an alist of
1778possible completions of it. You can think of 1758possible completions of it. You can think of
1779@code{completion-table-dynamic} as a transducer between that interface 1759@code{completion-table-dynamic} as a transducer between that interface
@@ -1827,7 +1807,7 @@ satisfy.
1827 1807
1828@item :exclusive 1808@item :exclusive
1829If the value is @code{no}, then if the completion table fails to match 1809If the value is @code{no}, then if the completion table fails to match
1830the text at point, then @code{completion-at-point} moves on to the 1810the text at point, @code{completion-at-point} moves on to the
1831next function in @code{completion-at-point-functions} instead of 1811next function in @code{completion-at-point-functions} instead of
1832reporting a completion failure. 1812reporting a completion failure.
1833@end table 1813@end table
@@ -1841,7 +1821,7 @@ old code to using @code{completion-at-point}.
1841The first function in @code{completion-at-point-functions} to return a 1821The first function in @code{completion-at-point-functions} to return a
1842non-@code{nil} value is used by @code{completion-at-point}. The 1822non-@code{nil} value is used by @code{completion-at-point}. The
1843remaining functions are not called. The exception to this is when 1823remaining functions are not called. The exception to this is when
1844there is a @code{:exclusive} specification, as described above. 1824there is an @code{:exclusive} specification, as described above.
1845@end defvar 1825@end defvar
1846 1826
1847 The following function provides a convenient way to perform 1827 The following function provides a convenient way to perform
@@ -1879,7 +1859,7 @@ answer.
1879using the mouse---more precisely, if @code{last-nonmenu-event} 1859using the mouse---more precisely, if @code{last-nonmenu-event}
1880(@pxref{Command Loop Info}) is either @code{nil} or a list---then it 1860(@pxref{Command Loop Info}) is either @code{nil} or a list---then it
1881uses a dialog box or pop-up menu to ask the question. Otherwise, it 1861uses a dialog box or pop-up menu to ask the question. Otherwise, it
1882uses keyboard input. You can force use of the mouse or use of keyboard 1862uses keyboard input. You can force use either of the mouse or of keyboard
1883input by binding @code{last-nonmenu-event} to a suitable value around 1863input by binding @code{last-nonmenu-event} to a suitable value around
1884the call. 1864the call.
1885 1865
@@ -1890,7 +1870,7 @@ the call.
1890This function asks the user a question, expecting input in the echo 1870This function asks the user a question, expecting input in the echo
1891area. It returns @code{t} if the user types @kbd{y}, @code{nil} if the 1871area. It returns @code{t} if the user types @kbd{y}, @code{nil} if the
1892user types @kbd{n}. This function also accepts @key{SPC} to mean yes 1872user types @kbd{n}. This function also accepts @key{SPC} to mean yes
1893and @key{DEL} to mean no. It accepts @kbd{C-]} to mean ``quit,'' like 1873and @key{DEL} to mean no. It accepts @kbd{C-]} to mean ``quit'', like
1894@kbd{C-g}, because the question might look like a minibuffer and for 1874@kbd{C-g}, because the question might look like a minibuffer and for
1895that reason the user might try to use @kbd{C-]} to get out. The answer 1875that reason the user might try to use @kbd{C-]} to get out. The answer
1896is a single character, with no @key{RET} needed to terminate it. Upper 1876is a single character, with no @key{RET} needed to terminate it. Upper
@@ -1914,12 +1894,16 @@ hardwired. The keymap @code{query-replace-map} specifies them.
1914In the following example, the user first types @kbd{q}, which is 1894In the following example, the user first types @kbd{q}, which is
1915invalid. At the next prompt the user types @kbd{y}. 1895invalid. At the next prompt the user types @kbd{y}.
1916 1896
1897@c Need an interactive example, because otherwise the return value
1898@c obscures the display of the valid answer.
1917@smallexample 1899@smallexample
1918@group 1900@group
1919(y-or-n-p "Do you need a lift? ") 1901(defun ask ()
1902 (interactive)
1903 (y-or-n-p "Do you need a lift? "))
1920 1904
1921;; @r{After evaluation of the preceding expression,} 1905;; @r{After evaluation of the preceding definition, @kbd{M-x ask}}
1922;; @r{the following prompt appears in the echo area:} 1906;; @r{causes the following prompt to appear in the echo area:}
1923@end group 1907@end group
1924 1908
1925@group 1909@group
@@ -1951,10 +1935,10 @@ We show successive lines of echo area messages, but only one actually
1951appears on the screen at a time. 1935appears on the screen at a time.
1952@end defun 1936@end defun
1953 1937
1954@defun y-or-n-p-with-timeout prompt seconds default-value 1938@defun y-or-n-p-with-timeout prompt seconds default
1955Like @code{y-or-n-p}, except that if the user fails to answer within 1939Like @code{y-or-n-p}, except that if the user fails to answer within
1956@var{seconds} seconds, this function stops waiting and returns 1940@var{seconds} seconds, this function stops waiting and returns
1957@var{default-value}. It works by setting up a timer; see @ref{Timers}. 1941@var{default}. It works by setting up a timer; see @ref{Timers}.
1958The argument @var{seconds} may be an integer or a floating point number. 1942The argument @var{seconds} may be an integer or a floating point number.
1959@end defun 1943@end defun
1960 1944
@@ -2022,7 +2006,7 @@ single-character answer in the echo area for each one.
2022The value of @var{list} specifies the objects to ask questions about. 2006The value of @var{list} specifies the objects to ask questions about.
2023It should be either a list of objects or a generator function. If it is 2007It should be either a list of objects or a generator function. If it is
2024a function, it should expect no arguments, and should return either the 2008a function, it should expect no arguments, and should return either the
2025next object to ask about, or @code{nil} meaning stop asking questions. 2009next object to ask about, or @code{nil}, meaning to stop asking questions.
2026 2010
2027The argument @var{prompter} specifies how to ask each question. If 2011The argument @var{prompter} specifies how to ask each question. If
2028@var{prompter} is a string, the question text is computed like this: 2012@var{prompter} is a string, the question text is computed like this:
@@ -2038,8 +2022,8 @@ where @var{object} is the next object to ask about (as obtained from
2038If not a string, @var{prompter} should be a function of one argument 2022If not a string, @var{prompter} should be a function of one argument
2039(the next object to ask about) and should return the question text. If 2023(the next object to ask about) and should return the question text. If
2040the value is a string, that is the question to ask the user. The 2024the value is a string, that is the question to ask the user. The
2041function can also return @code{t} meaning do act on this object (and 2025function can also return @code{t}, meaning do act on this object (and
2042don't ask the user), or @code{nil} meaning ignore this object (and don't 2026don't ask the user), or @code{nil}, meaning ignore this object (and don't
2043ask the user). 2027ask the user).
2044 2028
2045The argument @var{actor} says how to act on the answers that the user 2029The argument @var{actor} says how to act on the answers that the user
@@ -2080,7 +2064,7 @@ answer); @var{function} is a function of one argument (an object from
2080 2064
2081When the user responds with @var{char}, @code{map-y-or-n-p} calls 2065When the user responds with @var{char}, @code{map-y-or-n-p} calls
2082@var{function}. If it returns non-@code{nil}, the object is considered 2066@var{function}. If it returns non-@code{nil}, the object is considered
2083``acted upon,'' and @code{map-y-or-n-p} advances to the next object in 2067``acted upon'', and @code{map-y-or-n-p} advances to the next object in
2084@var{list}. If it returns @code{nil}, the prompt is repeated for the 2068@var{list}. If it returns @code{nil}, the prompt is repeated for the
2085same object. 2069same object.
2086 2070
@@ -2092,12 +2076,14 @@ If @code{map-y-or-n-p} is called in a command that was invoked using the
2092mouse---more precisely, if @code{last-nonmenu-event} (@pxref{Command 2076mouse---more precisely, if @code{last-nonmenu-event} (@pxref{Command
2093Loop Info}) is either @code{nil} or a list---then it uses a dialog box 2077Loop Info}) is either @code{nil} or a list---then it uses a dialog box
2094or pop-up menu to ask the question. In this case, it does not use 2078or pop-up menu to ask the question. In this case, it does not use
2095keyboard input or the echo area. You can force use of the mouse or use 2079keyboard input or the echo area. You can force use either of the mouse or
2096of keyboard input by binding @code{last-nonmenu-event} to a suitable 2080of keyboard input by binding @code{last-nonmenu-event} to a suitable
2097value around the call. 2081value around the call.
2098 2082
2099The return value of @code{map-y-or-n-p} is the number of objects acted on. 2083The return value of @code{map-y-or-n-p} is the number of objects acted on.
2100@end defun 2084@end defun
2085@c FIXME An example of this would be more useful than all the
2086@c preceding examples of simple things.
2101 2087
2102@node Reading a Password 2088@node Reading a Password
2103@section Reading a Password 2089@section Reading a Password
@@ -2160,6 +2146,19 @@ This command replaces the minibuffer contents with the value of the
2160regular expression). 2146regular expression).
2161@end deffn 2147@end deffn
2162 2148
2149@deffn Command previous-complete-history-element n
2150This command replaces the minibuffer contents with the value of the
2151@var{n}th previous (older) history element that completes the current
2152contents of the minibuffer before the point.
2153@end deffn
2154
2155@deffn Command next-complete-history-element n
2156This command replaces the minibuffer contents with the value of the
2157@var{n}th next (newer) history element that completes the current
2158contents of the minibuffer before the point.
2159@end deffn
2160
2161
2163@node Minibuffer Windows 2162@node Minibuffer Windows
2164@section Minibuffer Windows 2163@section Minibuffer Windows
2165@cindex minibuffer windows 2164@cindex minibuffer windows
@@ -2169,7 +2168,7 @@ and test whether they are active.
2169 2168
2170@defun active-minibuffer-window 2169@defun active-minibuffer-window
2171This function returns the currently active minibuffer window, or 2170This function returns the currently active minibuffer window, or
2172@code{nil} if none is currently active. 2171@code{nil} if there is none.
2173@end defun 2172@end defun
2174 2173
2175@defun minibuffer-window &optional frame 2174@defun minibuffer-window &optional frame
@@ -2202,8 +2201,8 @@ there can be more than one minibuffer window if there is more than one
2202frame. 2201frame.
2203 2202
2204@defun minibuffer-window-active-p window 2203@defun minibuffer-window-active-p window
2205This function returns non-@code{nil} if @var{window}, assumed to be 2204This function returns non-@code{nil} if @var{window} is the currently
2206a minibuffer window, is currently active. 2205active minibuffer window.
2207@end defun 2206@end defun
2208 2207
2209@node Minibuffer Contents 2208@node Minibuffer Contents
@@ -2318,7 +2317,7 @@ minibuffer, it scrolls this window.
2318@end defvar 2317@end defvar
2319 2318
2320@defun minibuffer-selected-window 2319@defun minibuffer-selected-window
2321This function returns the window which was selected when the 2320This function returns the window that was selected when the
2322minibuffer was entered. If selected window is not a minibuffer 2321minibuffer was entered. If selected window is not a minibuffer
2323window, it returns @code{nil}. 2322window, it returns @code{nil}.
2324@end defun 2323@end defun
@@ -2329,10 +2328,19 @@ windows. If a float, it specifies a fraction of the height of the
2329frame. If an integer, it specifies a number of lines. 2328frame. If an integer, it specifies a number of lines.
2330@end defopt 2329@end defopt
2331 2330
2331@vindex minibuffer-message-timeout
2332@defun minibuffer-message string &rest args 2332@defun minibuffer-message string &rest args
2333This function displays @var{string} temporarily at the end of the 2333This function displays @var{string} temporarily at the end of the
2334minibuffer text, for two seconds, or until the next input event 2334minibuffer text, for a few seconds, or until the next input event
2335arrives, whichever comes first. If @var{args} is non-@code{nil}, the 2335arrives, whichever comes first. The variable
2336actual message is obtained by passing @var{string} and @var{args} 2336@code{minibuffer-message-timeout} specifies the number of seconds to
2337through @code{format}. @xref{Formatting Strings}. 2337wait in the absence of input. It defaults to 2. If @var{args} is
2338non-@code{nil}, the actual message is obtained by passing @var{string}
2339and @var{args} through @code{format}. @xref{Formatting Strings}.
2338@end defun 2340@end defun
2341
2342@deffn Command minibuffer-inactive-mode
2343This is the major mode used in inactive minibuffers. It uses
2344keymap @code{minibuffer-inactive-mode-map}. This can be useful
2345if the minibuffer is in a separate frame. @xref{Minibuffers and Frames}.
2346@end deffn
diff --git a/doc/lispref/processes.texi b/doc/lispref/processes.texi
index 5a08fc9711e..71736584865 100644
--- a/doc/lispref/processes.texi
+++ b/doc/lispref/processes.texi
@@ -561,8 +561,13 @@ already exists, then @var{name} is modified (by appending @samp{<1>},
561etc.) to be unique. The buffer @var{buffer-or-name} is the buffer to 561etc.) to be unique. The buffer @var{buffer-or-name} is the buffer to
562associate with the process. 562associate with the process.
563 563
564If @var{program} is @code{nil}, Emacs opens a new pseudoterminal (pty)
565and associates its input and output with @var{buffer-or-name}, without
566creating a subprocess. In that case, the remaining arguments
567@var{args} are ignored.
568
564The remaining arguments, @var{args}, are strings that specify command 569The remaining arguments, @var{args}, are strings that specify command
565line arguments for the program. 570line arguments for the subprocess.
566 571
567In the example below, the first process is started and runs (rather, 572In the example below, the first process is started and runs (rather,
568sleeps) for 100 seconds (the output buffer @samp{foo} is created 573sleeps) for 100 seconds (the output buffer @samp{foo} is created
@@ -728,17 +733,17 @@ happen sooner or later).
728@section Process Information 733@section Process Information
729 734
730 Several functions return information about processes. 735 Several functions return information about processes.
731@code{list-processes} is provided for interactive use.
732 736
733@deffn Command list-processes &optional query-only 737@deffn Command list-processes &optional query-only buffer
734This command displays a listing of all living processes. In addition, 738This command displays a listing of all living processes. In addition,
735it finally deletes any process whose status was @samp{Exited} or 739it finally deletes any process whose status was @samp{Exited} or
736@samp{Signaled}. It returns @code{nil}. 740@samp{Signaled}. It returns @code{nil}.
737 741
738The processes are shown in a buffer named @file{*Process List*}, whose 742The processes are shown in a buffer named @file{*Process List*}
739major mode is named Process Menu mode. 743(unless you specify otherwise using the optional argument @var{buffer}),
744whose major mode is Process Menu mode.
740 745
741If @var{query-only} is non-@code{nil} then it lists only processes 746If @var{query-only} is non-@code{nil}, it only lists processes
742whose query flag is non-@code{nil}. @xref{Query Before Exit}. 747whose query flag is non-@code{nil}. @xref{Query Before Exit}.
743@end deffn 748@end deffn
744 749
@@ -754,8 +759,8 @@ This function returns a list of all processes that have not been deleted.
754@end defun 759@end defun
755 760
756@defun get-process name 761@defun get-process name
757This function returns the process named @var{name}, or @code{nil} if 762This function returns the process named @var{name} (a string), or
758there is none. An error is signaled if @var{name} is not a string. 763@code{nil} if there is none.
759 764
760@smallexample 765@smallexample
761@group 766@group
@@ -774,7 +779,7 @@ were given to the program.
774@smallexample 779@smallexample
775@group 780@group
776(process-command (get-process "shell")) 781(process-command (get-process "shell"))
777 @result{} ("/bin/csh" "-i") 782 @result{} ("bash" "-i")
778@end group 783@end group
779@end smallexample 784@end smallexample
780@end defun 785@end defun
@@ -782,11 +787,10 @@ were given to the program.
782@defun process-contact process &optional key 787@defun process-contact process &optional key
783 788
784This function returns information about how a network or serial 789This function returns information about how a network or serial
785process was set up. For a network process, when @var{key} is 790process was set up. When @var{key} is @code{nil}, it returns
786@code{nil}, it returns @code{(@var{hostname} @var{service})} which 791@code{(@var{hostname} @var{service})} for a network process, and
787specifies what you connected to. For a serial process, when @var{key} 792@code{(@var{port} @var{speed})} for a serial process.
788is @code{nil}, it returns @code{(@var{port} @var{speed})}. For an 793For an ordinary child process, this function always returns @code{t}.
789ordinary child process, this function always returns @code{t}.
790 794
791If @var{key} is @code{t}, the value is the complete status information 795If @var{key} is @code{t}, the value is the complete status information
792for the connection, server, or serial port; that is, the list of 796for the connection, server, or serial port; that is, the list of
@@ -794,7 +798,8 @@ keywords and values specified in @code{make-network-process} or
794@code{make-serial-process}, except that some of the values represent 798@code{make-serial-process}, except that some of the values represent
795the current status instead of what you specified. 799the current status instead of what you specified.
796 800
797For a network process: 801For a network process, the values include (see
802@code{make-network-process} for a complete list):
798 803
799@table @code 804@table @code
800@item :buffer 805@item :buffer
@@ -831,7 +836,7 @@ process is started and remains constant as long as the process exists.
831@end defun 836@end defun
832 837
833@defun process-name process 838@defun process-name process
834This function returns the name of @var{process}. 839This function returns the name of @var{process}, as a string.
835@end defun 840@end defun
836 841
837@defun process-status process-name 842@defun process-status process-name
@@ -871,12 +876,6 @@ if @var{process-name} is not the name of an existing process.
871(process-status (get-buffer "*shell*")) 876(process-status (get-buffer "*shell*"))
872 @result{} run 877 @result{} run
873@end group 878@end group
874@group
875x
876 @result{} #<process xx<1>>
877(process-status x)
878 @result{} exit
879@end group
880@end smallexample 879@end smallexample
881 880
882For a network connection, @code{process-status} returns one of the symbols 881For a network connection, @code{process-status} returns one of the symbols
@@ -914,13 +913,9 @@ the remote host is provided as process property @code{remote-tty}.
914 913
915@defun process-coding-system process 914@defun process-coding-system process
916@anchor{Coding systems for a subprocess} 915@anchor{Coding systems for a subprocess}
917This function returns a cons cell describing the coding systems in use 916This function returns a cons cell @code{(@var{decode} . @var{encode})},
918for decoding output from @var{process} and for encoding input to 917describing the coding systems in use for decoding output from, and
919@var{process} (@pxref{Coding Systems}). The value has this form: 918encoding input to, @var{process} (@pxref{Coding Systems}).
920
921@example
922(@var{coding-system-for-decoding} . @var{coding-system-for-encoding})
923@end example
924@end defun 919@end defun
925 920
926@defun set-process-coding-system process &optional decoding-system encoding-system 921@defun set-process-coding-system process &optional decoding-system encoding-system
@@ -960,6 +955,7 @@ Emacs, which is done with the functions in this section. You must
960specify the process to send input to, and the input data to send. The 955specify the process to send input to, and the input data to send. The
961data appears on the ``standard input'' of the subprocess. 956data appears on the ``standard input'' of the subprocess.
962 957
958@c FIXME which?
963 Some operating systems have limited space for buffered input in a 959 Some operating systems have limited space for buffered input in a
964@acronym{PTY}. On these systems, Emacs sends an @acronym{EOF} 960@acronym{PTY}. On these systems, Emacs sends an @acronym{EOF}
965periodically amidst the other characters, to force them through. For 961periodically amidst the other characters, to force them through. For
@@ -986,26 +982,14 @@ the current buffer's process.
986 982
987@defun process-send-string process string 983@defun process-send-string process string
988This function sends @var{process} the contents of @var{string} as 984This function sends @var{process} the contents of @var{string} as
989standard input. If it is @code{nil}, the current buffer's process is used. 985standard input. It returns @code{nil}. For example, to make a
990 986Shell buffer list files:
991 The function returns @code{nil}.
992 987
993@smallexample 988@smallexample
994@group 989@group
995(process-send-string "shell<1>" "ls\n") 990(process-send-string "shell<1>" "ls\n")
996 @result{} nil 991 @result{} nil
997@end group 992@end group
998
999
1000@group
1001---------- Buffer: *shell* ----------
1002...
1003introduction.texi syntax-tables.texi~
1004introduction.texi~ text.texi
1005introduction.txt text.texi~
1006...
1007---------- Buffer: *shell* ----------
1008@end group
1009@end smallexample 993@end smallexample
1010@end defun 994@end defun
1011 995
@@ -1021,7 +1005,6 @@ is unimportant which number is larger.)
1021@defun process-send-eof &optional process 1005@defun process-send-eof &optional process
1022This function makes @var{process} see an end-of-file in its 1006This function makes @var{process} see an end-of-file in its
1023input. The @acronym{EOF} comes after any text already sent to it. 1007input. The @acronym{EOF} comes after any text already sent to it.
1024
1025The function returns @var{process}. 1008The function returns @var{process}.
1026 1009
1027@smallexample 1010@smallexample
@@ -1052,7 +1035,7 @@ system. For example, the signal @code{SIGINT} means that the user has
1052typed @kbd{C-c}, or that some analogous thing has happened. 1035typed @kbd{C-c}, or that some analogous thing has happened.
1053 1036
1054 Each signal has a standard effect on the subprocess. Most signals 1037 Each signal has a standard effect on the subprocess. Most signals
1055kill the subprocess, but some stop or resume execution instead. Most 1038kill the subprocess, but some stop (or resume) execution instead. Most
1056signals can optionally be handled by programs; if the program handles 1039signals can optionally be handled by programs; if the program handles
1057the signal, then we can say nothing in general about its effects. 1040the signal, then we can say nothing in general about its effects.
1058 1041
@@ -1061,7 +1044,7 @@ section. Emacs also sends signals automatically at certain times:
1061killing a buffer sends a @code{SIGHUP} signal to all its associated 1044killing a buffer sends a @code{SIGHUP} signal to all its associated
1062processes; killing Emacs sends a @code{SIGHUP} signal to all remaining 1045processes; killing Emacs sends a @code{SIGHUP} signal to all remaining
1063processes. (@code{SIGHUP} is a signal that usually indicates that the 1046processes. (@code{SIGHUP} is a signal that usually indicates that the
1064user hung up the phone.) 1047user ``hung up the phone'', i.e., disconnected.)
1065 1048
1066 Each of the signal-sending functions takes two optional arguments: 1049 Each of the signal-sending functions takes two optional arguments:
1067@var{process} and @var{current-group}. 1050@var{process} and @var{current-group}.
@@ -1105,6 +1088,8 @@ and cannot be handled by the subprocess.
1105@defun quit-process &optional process current-group 1088@defun quit-process &optional process current-group
1106This function sends the signal @code{SIGQUIT} to the process 1089This function sends the signal @code{SIGQUIT} to the process
1107@var{process}. This signal is the one sent by the ``quit 1090@var{process}. This signal is the one sent by the ``quit
1091@c FIXME? Never heard of C-b being used for this. In readline, eg
1092@c bash, that is backward-word.
1108character'' (usually @kbd{C-b} or @kbd{C-\}) when you are not inside 1093character'' (usually @kbd{C-b} or @kbd{C-\}) when you are not inside
1109Emacs. 1094Emacs.
1110@end defun 1095@end defun
@@ -1129,11 +1114,12 @@ stopped previously.
1129 1114
1130@defun signal-process process signal 1115@defun signal-process process signal
1131This function sends a signal to process @var{process}. The argument 1116This function sends a signal to process @var{process}. The argument
1132@var{signal} specifies which signal to send; it should be an integer. 1117@var{signal} specifies which signal to send; it should be an integer,
1118or a symbol whose name is a signal.
1133 1119
1134The @var{process} argument can be a system process @acronym{ID}; that 1120The @var{process} argument can be a system process @acronym{ID} (an
1135allows you to send signals to processes that are not children of 1121integer); that allows you to send signals to processes that are not
1136Emacs. @xref{System Processes}. 1122children of Emacs. @xref{System Processes}.
1137@end defun 1123@end defun
1138 1124
1139@node Output from Processes 1125@node Output from Processes
@@ -1143,10 +1129,10 @@ Emacs. @xref{System Processes}.
1143 1129
1144 There are two ways to receive the output that a subprocess writes to 1130 There are two ways to receive the output that a subprocess writes to
1145its standard output stream. The output can be inserted in a buffer, 1131its standard output stream. The output can be inserted in a buffer,
1146which is called the associated buffer of the process, or a function 1132which is called the associated buffer of the process (@pxref{Process
1147called the @dfn{filter function} can be called to act on the output. If 1133Buffers}), or a function called the @dfn{filter function} can be
1148the process has no buffer and no filter function, its output is 1134called to act on the output. If the process has no buffer and no
1149discarded. 1135filter function, its output is discarded.
1150 1136
1151 When a subprocess terminates, Emacs reads any pending output, 1137 When a subprocess terminates, Emacs reads any pending output,
1152then stops reading output from that subprocess. Therefore, if the 1138then stops reading output from that subprocess. Therefore, if the
@@ -1154,19 +1140,20 @@ subprocess has children that are still live and still producing
1154output, Emacs won't receive that output. 1140output, Emacs won't receive that output.
1155 1141
1156 Output from a subprocess can arrive only while Emacs is waiting: when 1142 Output from a subprocess can arrive only while Emacs is waiting: when
1157reading terminal input, in @code{sit-for} and @code{sleep-for} 1143reading terminal input (see the function @code{waiting-for-user-input-p}),
1158(@pxref{Waiting}), and in @code{accept-process-output} (@pxref{Accepting 1144in @code{sit-for} and @code{sleep-for} (@pxref{Waiting}), and in
1159Output}). This minimizes the problem of timing errors that usually 1145@code{accept-process-output} (@pxref{Accepting Output}). This
1160plague parallel programming. For example, you can safely create a 1146minimizes the problem of timing errors that usually plague parallel
1161process and only then specify its buffer or filter function; no output 1147programming. For example, you can safely create a process and only
1162can arrive before you finish, if the code in between does not call any 1148then specify its buffer or filter function; no output can arrive
1163primitive that waits. 1149before you finish, if the code in between does not call any primitive
1150that waits.
1164 1151
1165@defvar process-adaptive-read-buffering 1152@defvar process-adaptive-read-buffering
1166On some systems, when Emacs reads the output from a subprocess, the 1153On some systems, when Emacs reads the output from a subprocess, the
1167output data is read in very small blocks, potentially resulting in 1154output data is read in very small blocks, potentially resulting in
1168very poor performance. This behavior can be remedied to some extent 1155very poor performance. This behavior can be remedied to some extent
1169by setting the variable @var{process-adaptive-read-buffering} to a 1156by setting the variable @code{process-adaptive-read-buffering} to a
1170non-@code{nil} value (the default), as it will automatically delay reading 1157non-@code{nil} value (the default), as it will automatically delay reading
1171from such processes, thus allowing them to produce more output before 1158from such processes, thus allowing them to produce more output before
1172Emacs tries to read it. 1159Emacs tries to read it.
@@ -1235,9 +1222,9 @@ to insert, and updates it to point after the inserted text. That is why
1235successive batches of output are inserted consecutively. 1222successive batches of output are inserted consecutively.
1236 1223
1237Filter functions normally should use this marker in the same fashion 1224Filter functions normally should use this marker in the same fashion
1238as is done by direct insertion of output in the buffer. A good 1225as is done by direct insertion of output in the buffer. For an
1239example of a filter function that uses @code{process-mark} is found at 1226example of a filter function that uses @code{process-mark},
1240the end of the following section. 1227@pxref{Process Filter Example}.
1241 1228
1242When the user is expected to enter input in the process buffer for 1229When the user is expected to enter input in the process buffer for
1243transmission to the process, the process marker separates the new input 1230transmission to the process, the process marker separates the new input
@@ -1285,14 +1272,16 @@ there is no filter.
1285 1272
1286 The filter function can only be called when Emacs is waiting for 1273 The filter function can only be called when Emacs is waiting for
1287something, because process output arrives only at such times. Emacs 1274something, because process output arrives only at such times. Emacs
1288waits when reading terminal input, in @code{sit-for} and 1275waits when reading terminal input (see the function
1289@code{sleep-for} (@pxref{Waiting}), and in @code{accept-process-output} 1276@code{waiting-for-user-input-p}), in @code{sit-for} and
1290(@pxref{Accepting Output}). 1277@code{sleep-for} (@pxref{Waiting}), and in
1278@code{accept-process-output} (@pxref{Accepting Output}).
1291 1279
1292 A filter function must accept two arguments: the associated process 1280 A filter function must accept two arguments: the associated process
1293and a string, which is output just received from it. The function is 1281and a string, which is output just received from it. The function is
1294then free to do whatever it chooses with the output. 1282then free to do whatever it chooses with the output.
1295 1283
1284@c Note this text is duplicated in the sentinels section.
1296 Quitting is normally inhibited within a filter function---otherwise, 1285 Quitting is normally inhibited within a filter function---otherwise,
1297the effect of typing @kbd{C-g} at command level or to quit a user 1286the effect of typing @kbd{C-g} at command level or to quit a user
1298command would be unpredictable. If you want to permit quitting inside 1287command would be unpredictable. If you want to permit quitting inside
@@ -1303,19 +1292,20 @@ cases, the right way to do this is with the macro
1303 If an error happens during execution of a filter function, it is 1292 If an error happens during execution of a filter function, it is
1304caught automatically, so that it doesn't stop the execution of whatever 1293caught automatically, so that it doesn't stop the execution of whatever
1305program was running when the filter function was started. However, if 1294program was running when the filter function was started. However, if
1306@code{debug-on-error} is non-@code{nil}, the error-catching is turned 1295@code{debug-on-error} is non-@code{nil}, errors are not caught.
1307off. This makes it possible to use the Lisp debugger to debug the 1296This makes it possible to use the Lisp debugger to debug the
1308filter function. @xref{Debugger}. 1297filter function. @xref{Debugger}.
1309 1298
1310 Many filter functions sometimes or always insert the text in the 1299 Many filter functions sometimes (or always) insert the output in the
1311process's buffer, mimicking the actions of Emacs when there is no 1300process's buffer, mimicking the actions of Emacs when there is no
1312filter. Such filter functions need to use @code{set-buffer} in order to 1301filter. Such filter functions need to make sure that they save the
1313be sure to insert in that buffer. To avoid setting the current buffer 1302current buffer, select the correct buffer (if different) before
1314semipermanently, these filter functions must save and restore the 1303inserting output, and then restore the original buffer.
1315current buffer. They should also check whether the buffer is still 1304They should also check whether the buffer is still alive, update the
1316alive, update the process marker, and in some cases update the value 1305process marker, and in some cases update the value of point. Here is
1317of point. Here is how to do these things: 1306how to do these things:
1318 1307
1308@anchor{Process Filter Example}
1319@smallexample 1309@smallexample
1320@group 1310@group
1321(defun ordinary-insertion-filter (proc string) 1311(defun ordinary-insertion-filter (proc string)
@@ -1325,7 +1315,7 @@ of point. Here is how to do these things:
1325@end group 1315@end group
1326@group 1316@group
1327 (save-excursion 1317 (save-excursion
1328 ;; @r{Insert the text, advancing the process marker.} 1318 ;; @r{Insert the text, advancing the process marker.}
1329 (goto-char (process-mark proc)) 1319 (goto-char (process-mark proc))
1330 (insert string) 1320 (insert string)
1331 (set-marker (process-mark proc) (point))) 1321 (set-marker (process-mark proc) (point)))
@@ -1333,14 +1323,8 @@ of point. Here is how to do these things:
1333@end group 1323@end group
1334@end smallexample 1324@end smallexample
1335 1325
1336@noindent
1337The reason to use @code{with-current-buffer}, rather than using
1338@code{save-excursion} to save and restore the current buffer, is so as
1339to preserve the change in point made by the second call to
1340@code{goto-char}.
1341
1342 To make the filter force the process buffer to be visible whenever new 1326 To make the filter force the process buffer to be visible whenever new
1343text arrives, insert the following line just before the 1327text arrives, you could insert a line like the following just before the
1344@code{with-current-buffer} construct: 1328@code{with-current-buffer} construct:
1345 1329
1346@smallexample 1330@smallexample
@@ -1351,12 +1335,16 @@ text arrives, insert the following line just before the
1351previously, eliminate the variable @code{moving} and call 1335previously, eliminate the variable @code{moving} and call
1352@code{goto-char} unconditionally. 1336@code{goto-char} unconditionally.
1353 1337
1338@ignore
1354 In earlier Emacs versions, every filter function that did regular 1339 In earlier Emacs versions, every filter function that did regular
1355expression searching or matching had to explicitly save and restore the 1340expression searching or matching had to explicitly save and restore the
1356match data. Now Emacs does this automatically for filter functions; 1341match data. Now Emacs does this automatically for filter functions;
1357they never need to do it explicitly. @xref{Match Data}. 1342they never need to do it explicitly.
1343@end ignore
1344 Note that Emacs automatically saves and restores the match data
1345while executing filter functions. @xref{Match Data}.
1358 1346
1359 The output to the function may come in chunks of any size. A program 1347 The output to the filter may come in chunks of any size. A program
1360that produces the same output twice in a row may send it as one batch of 1348that produces the same output twice in a row may send it as one batch of
1361200 characters one time, and five batches of 40 characters the next. If 1349200 characters one time, and five batches of 40 characters the next. If
1362the filter looks for certain text strings in the subprocess output, make 1350the filter looks for certain text strings in the subprocess output, make
@@ -1374,7 +1362,7 @@ This function returns the filter function of @var{process}, or @code{nil}
1374if it has none. 1362if it has none.
1375@end defun 1363@end defun
1376 1364
1377 Here is an example of use of a filter function: 1365 Here is an example of the use of a filter function:
1378 1366
1379@smallexample 1367@smallexample
1380@group 1368@group
@@ -1394,7 +1382,7 @@ if it has none.
1394(process-send-string "shell" "ls ~/other\n") 1382(process-send-string "shell" "ls ~/other\n")
1395 @result{} nil 1383 @result{} nil
1396kept 1384kept
1397 @result{} ("lewis@@slug[8] % " 1385 @result{} ("lewis@@slug:$ "
1398@end group 1386@end group
1399@group 1387@group
1400"FINAL-W87-SHORT.MSS backup.otl kolstad.mss~ 1388"FINAL-W87-SHORT.MSS backup.otl kolstad.mss~
@@ -1450,8 +1438,8 @@ bytes, Emacs by default uses @code{no-conversion} for it; see
1450@ref{Lisp and Coding Systems, inhibit-null-byte-detection}, for how to 1438@ref{Lisp and Coding Systems, inhibit-null-byte-detection}, for how to
1451control this behavior. 1439control this behavior.
1452 1440
1453 @strong{Warning:} Coding systems such as @code{undecided} which 1441 @strong{Warning:} Coding systems such as @code{undecided}, which
1454determine the coding system from the data do not work entirely 1442determine the coding system from the data, do not work entirely
1455reliably with asynchronous subprocess output. This is because Emacs 1443reliably with asynchronous subprocess output. This is because Emacs
1456has to process asynchronous subprocess output in batches, as it 1444has to process asynchronous subprocess output in batches, as it
1457arrives. Emacs must try to detect the proper coding system from one 1445arrives. Emacs must try to detect the proper coding system from one
@@ -1469,7 +1457,7 @@ output as a multibyte string or as a unibyte string according to the
1469process's filter coding system. Emacs 1457process's filter coding system. Emacs
1470decodes the output according to the process output coding system, 1458decodes the output according to the process output coding system,
1471which usually produces a multibyte string, except for coding systems 1459which usually produces a multibyte string, except for coding systems
1472such as @code{binary} and @code{raw-text} 1460such as @code{binary} and @code{raw-text}.
1473 1461
1474@node Accepting Output 1462@node Accepting Output
1475@subsection Accepting Output from Processes 1463@subsection Accepting Output from Processes
@@ -1487,7 +1475,6 @@ output is inserted in the associated buffers or given to their filter
1487functions. If @var{process} is non-@code{nil} then this function does 1475functions. If @var{process} is non-@code{nil} then this function does
1488not return until some output has been received from @var{process}. 1476not return until some output has been received from @var{process}.
1489 1477
1490@c Emacs 19 feature
1491The arguments @var{seconds} and @var{millisec} let you specify timeout 1478The arguments @var{seconds} and @var{millisec} let you specify timeout
1492periods. The former specifies a period measured in seconds and the 1479periods. The former specifies a period measured in seconds and the
1493latter specifies one measured in milliseconds. The two time periods 1480latter specifies one measured in milliseconds. The two time periods
@@ -1495,10 +1482,10 @@ thus specified are added together, and @code{accept-process-output}
1495returns after that much time, whether or not there has been any 1482returns after that much time, whether or not there has been any
1496subprocess output. 1483subprocess output.
1497 1484
1498The argument @var{millisec} is semi-obsolete nowadays because 1485The argument @var{millisec} is obsolete (and should not be used),
1499@var{seconds} can be a floating point number to specify waiting a 1486because @var{seconds} can be a floating point number to specify
1500fractional number of seconds. If @var{seconds} is 0, the function 1487waiting a fractional number of seconds. If @var{seconds} is 0, the
1501accepts whatever output is pending but does not wait. 1488function accepts whatever output is pending but does not wait.
1502 1489
1503@c Emacs 22.1 feature 1490@c Emacs 22.1 feature
1504If @var{process} is a process, and the argument @var{just-this-one} is 1491If @var{process} is a process, and the argument @var{just-this-one} is
@@ -1529,6 +1516,7 @@ describing the type of event.
1529 1516
1530 The string describing the event looks like one of the following: 1517 The string describing the event looks like one of the following:
1531 1518
1519@c FIXME? Also "killed\n" - see example below?
1532@itemize @bullet 1520@itemize @bullet
1533@item 1521@item
1534@code{"finished\n"}. 1522@code{"finished\n"}.
@@ -1545,7 +1533,7 @@ describing the type of event.
1545 1533
1546 A sentinel runs only while Emacs is waiting (e.g., for terminal 1534 A sentinel runs only while Emacs is waiting (e.g., for terminal
1547input, or for time to elapse, or for process output). This avoids the 1535input, or for time to elapse, or for process output). This avoids the
1548timing errors that could result from running them at random places in 1536timing errors that could result from running sentinels at random places in
1549the middle of other Lisp programs. A program can wait, so that 1537the middle of other Lisp programs. A program can wait, so that
1550sentinels will run, by calling @code{sit-for} or @code{sleep-for} 1538sentinels will run, by calling @code{sit-for} or @code{sleep-for}
1551(@pxref{Waiting}), or @code{accept-process-output} (@pxref{Accepting 1539(@pxref{Waiting}), or @code{accept-process-output} (@pxref{Accepting
@@ -1569,6 +1557,7 @@ should check whether the buffer is still alive. If it tries to insert
1569into a dead buffer, it will get an error. If the buffer is dead, 1557into a dead buffer, it will get an error. If the buffer is dead,
1570@code{(buffer-name (process-buffer @var{process}))} returns @code{nil}. 1558@code{(buffer-name (process-buffer @var{process}))} returns @code{nil}.
1571 1559
1560@c Note this text is duplicated in the filter functions section.
1572 Quitting is normally inhibited within a sentinel---otherwise, the 1561 Quitting is normally inhibited within a sentinel---otherwise, the
1573effect of typing @kbd{C-g} at command level or to quit a user command 1562effect of typing @kbd{C-g} at command level or to quit a user command
1574would be unpredictable. If you want to permit quitting inside a 1563would be unpredictable. If you want to permit quitting inside a
@@ -1579,8 +1568,8 @@ right way to do this is with the macro @code{with-local-quit}.
1579 If an error happens during execution of a sentinel, it is caught 1568 If an error happens during execution of a sentinel, it is caught
1580automatically, so that it doesn't stop the execution of whatever 1569automatically, so that it doesn't stop the execution of whatever
1581programs was running when the sentinel was started. However, if 1570programs was running when the sentinel was started. However, if
1582@code{debug-on-error} is non-@code{nil}, the error-catching is turned 1571@code{debug-on-error} is non-@code{nil}, errors are not caught.
1583off. This makes it possible to use the Lisp debugger to debug the 1572This makes it possible to use the Lisp debugger to debug the
1584sentinel. @xref{Debugger}. 1573sentinel. @xref{Debugger}.
1585 1574
1586 While a sentinel is running, the process sentinel is temporarily 1575 While a sentinel is running, the process sentinel is temporarily
@@ -1588,10 +1577,14 @@ set to @code{nil} so that the sentinel won't run recursively.
1588For this reason it is not possible for a sentinel to specify 1577For this reason it is not possible for a sentinel to specify
1589a new sentinel. 1578a new sentinel.
1590 1579
1580@ignore
1591 In earlier Emacs versions, every sentinel that did regular expression 1581 In earlier Emacs versions, every sentinel that did regular expression
1592searching or matching had to explicitly save and restore the match data. 1582searching or matching had to explicitly save and restore the match data.
1593Now Emacs does this automatically for sentinels; they never need to do 1583Now Emacs does this automatically for sentinels; they never need to do
1594it explicitly. @xref{Match Data}. 1584it explicitly.
1585@end ignore
1586 Note that Emacs automatically saves and restores the match data
1587while executing sentinels. @xref{Match Data}.
1595 1588
1596@defun set-process-sentinel process sentinel 1589@defun set-process-sentinel process sentinel
1597This function associates @var{sentinel} with @var{process}. If 1590This function associates @var{sentinel} with @var{process}. If
@@ -1599,7 +1592,7 @@ This function associates @var{sentinel} with @var{process}. If
1599The default behavior when there is no sentinel is to insert a message in 1592The default behavior when there is no sentinel is to insert a message in
1600the process's buffer when the process status changes. 1593the process's buffer when the process status changes.
1601 1594
1602Changes in process sentinel take effect immediately---if the sentinel 1595Changes in process sentinels take effect immediately---if the sentinel
1603is slated to be run but has not been called yet, and you specify a new 1596is slated to be run but has not been called yet, and you specify a new
1604sentinel, the eventual call to the sentinel will use the new one. 1597sentinel, the eventual call to the sentinel will use the new one.
1605 1598
@@ -1627,7 +1620,7 @@ has none.
1627@defun waiting-for-user-input-p 1620@defun waiting-for-user-input-p
1628While a sentinel or filter function is running, this function returns 1621While a sentinel or filter function is running, this function returns
1629non-@code{nil} if Emacs was waiting for keyboard input from the user at 1622non-@code{nil} if Emacs was waiting for keyboard input from the user at
1630the time the sentinel or filter function was called, @code{nil} if it 1623the time the sentinel or filter function was called, or @code{nil} if it
1631was not. 1624was not.
1632@end defun 1625@end defun
1633 1626
@@ -1637,7 +1630,7 @@ was not.
1637 When Emacs exits, it terminates all its subprocesses by sending them 1630 When Emacs exits, it terminates all its subprocesses by sending them
1638the @code{SIGHUP} signal. Because subprocesses may be doing 1631the @code{SIGHUP} signal. Because subprocesses may be doing
1639valuable work, Emacs normally asks the user to confirm that it is ok 1632valuable work, Emacs normally asks the user to confirm that it is ok
1640to terminate them. Each process has a query flag which, if 1633to terminate them. Each process has a query flag, which, if
1641non-@code{nil}, says that Emacs should ask for confirmation before 1634non-@code{nil}, says that Emacs should ask for confirmation before
1642exiting and thus killing that process. The default for the query flag 1635exiting and thus killing that process. The default for the query flag
1643is @code{t}, meaning @emph{do} query. 1636is @code{t}, meaning @emph{do} query.
@@ -1656,7 +1649,7 @@ shell process to avoid querying:
1656@smallexample 1649@smallexample
1657@group 1650@group
1658(set-process-query-on-exit-flag (get-process "shell") nil) 1651(set-process-query-on-exit-flag (get-process "shell") nil)
1659 @result{} t 1652 @result{} nil
1660@end group 1653@end group
1661@end smallexample 1654@end smallexample
1662@end defun 1655@end defun
@@ -1668,7 +1661,7 @@ shell process to avoid querying:
1668 In addition to accessing and manipulating processes that are 1661 In addition to accessing and manipulating processes that are
1669subprocesses of the current Emacs session, Emacs Lisp programs can 1662subprocesses of the current Emacs session, Emacs Lisp programs can
1670also access other processes running on the same machine. We call 1663also access other processes running on the same machine. We call
1671these @dfn{system processes}, to distinguish between them and Emacs 1664these @dfn{system processes}, to distinguish them from Emacs
1672subprocesses. 1665subprocesses.
1673 1666
1674 Emacs provides several primitives for accessing system processes. 1667 Emacs provides several primitives for accessing system processes.
@@ -1688,7 +1681,7 @@ This function returns an alist of attributes for the process specified
1688by its process ID @var{pid}. Each association in the alist is of the 1681by its process ID @var{pid}. Each association in the alist is of the
1689form @code{(@var{key} . @var{value})}, where @var{key} designates the 1682form @code{(@var{key} . @var{value})}, where @var{key} designates the
1690attribute and @var{value} is the value of that attribute. The various 1683attribute and @var{value} is the value of that attribute. The various
1691attribute @var{key}'s that this function can return are listed below. 1684attribute @var{key}s that this function can return are listed below.
1692Not all platforms support all of these attributes; if an attribute is 1685Not all platforms support all of these attributes; if an attribute is
1693not supported, its association will not appear in the returned alist. 1686not supported, its association will not appear in the returned alist.
1694Values that are numbers can be either integer or floating-point, 1687Values that are numbers can be either integer or floating-point,
@@ -1849,6 +1842,8 @@ as @code{shell-command}.
1849@section Transaction Queues 1842@section Transaction Queues
1850@cindex transaction queue 1843@cindex transaction queue
1851 1844
1845@c That's not very informative. What is a transaction, and when might
1846@c I want to use one?
1852You can use a @dfn{transaction queue} to communicate with a subprocess 1847You can use a @dfn{transaction queue} to communicate with a subprocess
1853using transactions. First use @code{tq-create} to create a transaction 1848using transactions. First use @code{tq-create} to create a transaction
1854queue communicating with a specified process. Then you can call 1849queue communicating with a specified process. Then you can call
@@ -1878,8 +1873,11 @@ text at the end of the entire answer, but nothing before; that's how
1878If the argument @var{delay-question} is non-@code{nil}, delay sending 1873If the argument @var{delay-question} is non-@code{nil}, delay sending
1879this question until the process has finished replying to any previous 1874this question until the process has finished replying to any previous
1880questions. This produces more reliable results with some processes. 1875questions. This produces more reliable results with some processes.
1876@ignore
1881 1877
1878@c Let's not mention it then.
1882The return value of @code{tq-enqueue} itself is not meaningful. 1879The return value of @code{tq-enqueue} itself is not meaningful.
1880@end ignore
1883@end defun 1881@end defun
1884 1882
1885@defun tq-close queue 1883@defun tq-close queue
@@ -1897,10 +1895,11 @@ Transaction queues are implemented by means of a filter function.
1897@cindex UDP 1895@cindex UDP
1898 1896
1899 Emacs Lisp programs can open stream (TCP) and datagram (UDP) network 1897 Emacs Lisp programs can open stream (TCP) and datagram (UDP) network
1900connections to other processes on the same machine or other machines. 1898connections (@pxref{Datagrams}) to other processes on the same machine
1899or other machines.
1901A network connection is handled by Lisp much like a subprocess, and is 1900A network connection is handled by Lisp much like a subprocess, and is
1902represented by a process object. However, the process you are 1901represented by a process object. However, the process you are
1903communicating with is not a child of the Emacs process, so it has no 1902communicating with is not a child of the Emacs process, has no
1904process @acronym{ID}, and you can't kill it or send it signals. All you 1903process @acronym{ID}, and you can't kill it or send it signals. All you
1905can do is send and receive data. @code{delete-process} closes the 1904can do is send and receive data. @code{delete-process} closes the
1906connection, but does not kill the program at the other end; that 1905connection, but does not kill the program at the other end; that
@@ -1928,7 +1927,7 @@ network connection or server, @code{serial} for a serial port
1928connection, or @code{real} for a real subprocess. 1927connection, or @code{real} for a real subprocess.
1929 1928
1930 The @code{process-status} function returns @code{open}, 1929 The @code{process-status} function returns @code{open},
1931@code{closed}, @code{connect}, and @code{failed} for network 1930@code{closed}, @code{connect}, or @code{failed} for network
1932connections. For a network server, the status is always 1931connections. For a network server, the status is always
1933@code{listen}. None of those values is possible for a real 1932@code{listen}. None of those values is possible for a real
1934subprocess. @xref{Process Information}. 1933subprocess. @xref{Process Information}.
@@ -1938,35 +1937,48 @@ subprocess. @xref{Process Information}.
1938process, being stopped means not accepting new connections. (Up to 5 1937process, being stopped means not accepting new connections. (Up to 5
1939connection requests will be queued for when you resume the server; you 1938connection requests will be queued for when you resume the server; you
1940can increase this limit, unless it is imposed by the operating 1939can increase this limit, unless it is imposed by the operating
1941system.) For a network stream connection, being stopped means not 1940system---see the @code{:server} keyword of @code{make-network-process},
1942processing input (any arriving input waits until you resume the 1941@ref{Network Processes}.) For a network stream connection, being
1943connection). For a datagram connection, some number of packets may be 1942stopped means not processing input (any arriving input waits until you
1944queued but input may be lost. You can use the function 1943resume the connection). For a datagram connection, some number of
1944packets may be queued but input may be lost. You can use the function
1945@code{process-command} to determine whether a network connection or 1945@code{process-command} to determine whether a network connection or
1946server is stopped; a non-@code{nil} value means yes. 1946server is stopped; a non-@code{nil} value means yes.
1947 1947
1948@cindex network connection, encrypted 1948@cindex network connection, encrypted
1949@cindex encrypted network connections 1949@cindex encrypted network connections
1950@cindex TLS network connections 1950@cindex @acronym{TLS} network connections
1951@cindex STARTTLS network connections 1951@cindex @acronym{STARTTLS} network connections
1952@defun open-network-stream name buffer-or-name host service &rest parameters 1952Emacs can create encrypted network connections, using either built-in
1953or external support. The built-in support uses the GnuTLS
1954(``Transport Layer Security'') library; see
1955@uref{http://www.gnu.org/software/gnutls/, the GnuTLS project page}.
1956If your Emacs was compiled with GnuTLS support, the function
1957@code{gnutls-available-p} is defined and returns non-@code{nil}. For
1958more details, @pxref{Top,, Overview, emacs-gnutls, The Emacs-GnuTLS manual}.
1959The external support uses the @file{starttls.el} library, which
1960requires a helper utility such as @command{gnutls-cli} to be installed
1961on the system. The @code{open-network-stream} function can
1962transparently handle the details of creating encrypted connections for
1963you, using whatever support is available.
1964
1965@defun open-network-stream name buffer host service &rest parameters
1953This function opens a TCP connection, with optional encryption, and 1966This function opens a TCP connection, with optional encryption, and
1954returns a process object that represents the connection. 1967returns a process object that represents the connection.
1955 1968
1956The @var{name} argument specifies the name for the process object. It 1969The @var{name} argument specifies the name for the process object. It
1957is modified as necessary to make it unique. 1970is modified as necessary to make it unique.
1958 1971
1959The @var{buffer-or-name} argument is the buffer to associate with the 1972The @var{buffer} argument is the buffer to associate with the
1960connection. Output from the connection is inserted in the buffer, 1973connection. Output from the connection is inserted in the buffer,
1961unless you specify a filter function to handle the output. If 1974unless you specify a filter function to handle the output. If
1962@var{buffer-or-name} is @code{nil}, it means that the connection is not 1975@var{buffer} is @code{nil}, it means that the connection is not
1963associated with any buffer. 1976associated with any buffer.
1964 1977
1965The arguments @var{host} and @var{service} specify where to connect to; 1978The arguments @var{host} and @var{service} specify where to connect to;
1966@var{host} is the host name (a string), and @var{service} is the name of 1979@var{host} is the host name (a string), and @var{service} is the name of
1967a defined network service (a string) or a port number (an integer). 1980a defined network service (a string) or a port number (an integer).
1968 1981
1969@c FIXME? Is this too lengthy for the printed manual?
1970The remaining arguments @var{parameters} are keyword/argument pairs 1982The remaining arguments @var{parameters} are keyword/argument pairs
1971that are mainly relevant to encrypted connections: 1983that are mainly relevant to encrypted connections:
1972 1984
@@ -1983,14 +1995,15 @@ The type of connection. Options are:
1983An ordinary, unencrypted connection. 1995An ordinary, unencrypted connection.
1984@item tls 1996@item tls
1985@itemx ssl 1997@itemx ssl
1986A TLS (``Transport Layer Security'') connection. 1998A @acronym{TLS} (``Transport Layer Security'') connection.
1987@item nil 1999@item nil
1988@itemx network 2000@itemx network
1989Start with a plain connection, and if parameters @samp{:success} 2001Start with a plain connection, and if parameters @samp{:success}
1990and @samp{:capability-command} are supplied, try to upgrade to an encrypted 2002and @samp{:capability-command} are supplied, try to upgrade to an encrypted
1991connection via STARTTLS. If that fails, retain the unencrypted connection. 2003connection via @acronym{STARTTLS}. If that fails, retain the
2004unencrypted connection.
1992@item starttls 2005@item starttls
1993As for @code{nil}, but if STARTTLS fails drop the connection. 2006As for @code{nil}, but if @acronym{STARTTLS} fails drop the connection.
1994@item shell 2007@item shell
1995A shell connection. 2008A shell connection.
1996@end table 2009@end table
@@ -2009,22 +2022,22 @@ command @var{capability-command}. The latter defaults to the former.
2009 2022
2010@item :starttls-function @var{function} 2023@item :starttls-function @var{function}
2011Function of one argument (the response to @var{capability-command}), 2024Function of one argument (the response to @var{capability-command}),
2012which returns either @code{nil}, or the command to activate STARTTLS 2025which returns either @code{nil}, or the command to activate @acronym{STARTTLS}
2013if supported. 2026if supported.
2014 2027
2015@item :success @var{regexp} 2028@item :success @var{regexp}
2016Regular expression matching a successful STARTTLS negotiation. 2029Regular expression matching a successful @acronym{STARTTLS} negotiation.
2017 2030
2018@item :use-starttls-if-possible @var{boolean} 2031@item :use-starttls-if-possible @var{boolean}
2019If non-@code{nil}, do opportunistic STARTTLS upgrades even if Emacs 2032If non-@code{nil}, do opportunistic @acronym{STARTTLS} upgrades even if Emacs
2020doesn't have built-in TLS support. 2033doesn't have built-in @acronym{TLS} support.
2021 2034
2022@item :client-certificate @var{list-or-t} 2035@item :client-certificate @var{list-or-t}
2023Either a list of the form @code{(@var{key-file} @var{cert-file})}, 2036Either a list of the form @code{(@var{key-file} @var{cert-file})},
2024naming the certificate key file and certificate file itself, or 2037naming the certificate key file and certificate file itself, or
2025@code{t}, meaning to query @code{auth-source} for this information 2038@code{t}, meaning to query @code{auth-source} for this information
2026(@pxref{Top,,auth-source, auth, Emacs auth-source Library}). 2039(@pxref{Top,,Overview, auth, The Auth-Source Manual}).
2027Only used for TLS or STARTTLS. 2040Only used for @acronym{TLS} or @acronym{STARTTLS}.
2028 2041
2029@item :return-list @var{cons-or-nil} 2042@item :return-list @var{cons-or-nil}
2030The return value of this function. If omitted or @code{nil}, return a 2043The return value of this function. If omitted or @code{nil}, return a
@@ -2048,18 +2061,20 @@ The connection type: @samp{plain} or @samp{tls}.
2048@section Network Servers 2061@section Network Servers
2049@cindex network servers 2062@cindex network servers
2050 2063
2051 You create a server by calling @code{make-network-process} with 2064 You create a server by calling @code{make-network-process}
2052@code{:server t}. The server will listen for connection requests from 2065(@pxref{Network Processes}) with @code{:server t}. The server will
2053clients. When it accepts a client connection request, that creates a 2066listen for connection requests from clients. When it accepts a client
2054new network connection, itself a process object, with the following 2067connection request, that creates a new network connection, itself a
2055parameters: 2068process object, with the following parameters:
2056 2069
2057@itemize @bullet 2070@itemize @bullet
2058@item 2071@item
2059The connection's process name is constructed by concatenating the 2072The connection's process name is constructed by concatenating the
2060server process's @var{name} with a client identification string. The 2073server process's @var{name} with a client identification string. The
2074@c FIXME? What about IPv6? Say briefly what the difference is?
2061client identification string for an IPv4 connection looks like 2075client identification string for an IPv4 connection looks like
2062@samp{<@var{a}.@var{b}.@var{c}.@var{d}:@var{p}>}. Otherwise, it is a 2076@samp{<@var{a}.@var{b}.@var{c}.@var{d}:@var{p}>}, which represents an
2077address and port number. Otherwise, it is a
2063unique number in brackets, as in @samp{<@var{nnn}>}. The number 2078unique number in brackets, as in @samp{<@var{nnn}>}. The number
2064is unique for each connection in the Emacs session. 2079is unique for each connection in the Emacs session.
2065 2080
@@ -2080,7 +2095,7 @@ uses its filter and sentinel; their sole purpose is to initialize
2080connections made to the server. 2095connections made to the server.
2081 2096
2082@item 2097@item
2083The connection's process contact info is set according to the client's 2098The connection's process contact information is set according to the client's
2084addressing information (typically an IP address and a port number). 2099addressing information (typically an IP address and a port number).
2085This information is associated with the @code{process-contact} 2100This information is associated with the @code{process-contact}
2086keywords @code{:host}, @code{:service}, @code{:remote}. 2101keywords @code{:host}, @code{:service}, @code{:remote}.
@@ -2097,7 +2112,7 @@ The client process's plist is initialized from the server's plist.
2097@section Datagrams 2112@section Datagrams
2098@cindex datagrams 2113@cindex datagrams
2099 2114
2100 A datagram connection communicates with individual packets rather 2115 A @dfn{datagram} connection communicates with individual packets rather
2101than streams of data. Each call to @code{process-send} sends one 2116than streams of data. Each call to @code{process-send} sends one
2102datagram packet (@pxref{Input to Processes}), and each datagram 2117datagram packet (@pxref{Input to Processes}), and each datagram
2103received results in one call to the filter function. 2118received results in one call to the filter function.
@@ -2150,7 +2165,8 @@ process object that represents it. The arguments @var{args} are a
2150list of keyword/argument pairs. Omitting a keyword is always 2165list of keyword/argument pairs. Omitting a keyword is always
2151equivalent to specifying it with value @code{nil}, except for 2166equivalent to specifying it with value @code{nil}, except for
2152@code{:coding}, @code{:filter-multibyte}, and @code{:reuseaddr}. Here 2167@code{:coding}, @code{:filter-multibyte}, and @code{:reuseaddr}. Here
2153are the meaningful keywords: 2168are the meaningful keywords (those corresponding to network options
2169are listed in the following section):
2154 2170
2155@table @asis 2171@table @asis
2156@item :name @var{name} 2172@item :name @var{name}
@@ -2166,7 +2182,7 @@ connection. Both connections and servers can be of these types.
2166@item :server @var{server-flag} 2182@item :server @var{server-flag}
2167If @var{server-flag} is non-@code{nil}, create a server. Otherwise, 2183If @var{server-flag} is non-@code{nil}, create a server. Otherwise,
2168create a connection. For a stream type server, @var{server-flag} may 2184create a connection. For a stream type server, @var{server-flag} may
2169be an integer which then specifies the length of the queue of pending 2185be an integer, which then specifies the length of the queue of pending
2170connections to the server. The default queue length is 5. 2186connections to the server. The default queue length is 5.
2171 2187
2172@item :host @var{host} 2188@item :host @var{host}
@@ -2177,7 +2193,7 @@ specify a valid address for the local host, and only clients
2177connecting to that address will be accepted. 2193connecting to that address will be accepted.
2178 2194
2179@item :service @var{service} 2195@item :service @var{service}
2180@var{service} specifies a port number to connect to, or, for a server, 2196@var{service} specifies a port number to connect to; or, for a server,
2181the port number to listen on. It should be a service name that 2197the port number to listen on. It should be a service name that
2182translates to a port number, or an integer specifying the port number 2198translates to a port number, or an integer specifying the port number
2183directly. For a server, it can also be @code{t}, which means to let 2199directly. For a server, it can also be @code{t}, which means to let
@@ -2188,18 +2204,18 @@ the system select an unused port number.
2188communication. @code{nil} means determine the proper address family 2204communication. @code{nil} means determine the proper address family
2189automatically for the given @var{host} and @var{service}. 2205automatically for the given @var{host} and @var{service}.
2190@code{local} specifies a Unix socket, in which case @var{host} is 2206@code{local} specifies a Unix socket, in which case @var{host} is
2191ignored. @code{ipv4} and @code{ipv6} specify to use IPv4 and IPv6 2207ignored. @code{ipv4} and @code{ipv6} specify to use IPv4 and IPv6,
2192respectively. 2208respectively.
2193 2209
2194@item :local @var{local-address} 2210@item :local @var{local-address}
2195For a server process, @var{local-address} is the address to listen on. 2211For a server process, @var{local-address} is the address to listen on.
2196It overrides @var{family}, @var{host} and @var{service}, and you 2212It overrides @var{family}, @var{host} and @var{service}, so you
2197may as well not specify them. 2213might as well not specify them.
2198 2214
2199@item :remote @var{remote-address} 2215@item :remote @var{remote-address}
2200For a connection, @var{remote-address} is the address to connect to. 2216For a connection, @var{remote-address} is the address to connect to.
2201It overrides @var{family}, @var{host} and @var{service}, and you 2217It overrides @var{family}, @var{host} and @var{service}, so you
2202may as well not specify them. 2218might as well not specify them.
2203 2219
2204For a datagram server, @var{remote-address} specifies the initial 2220For a datagram server, @var{remote-address} specifies the initial
2205setting of the remote datagram address. 2221setting of the remote datagram address.
@@ -2223,7 +2239,7 @@ integers @code{[@var{a} @var{b} @var{c} @var{d} @var{e} @var{f}
2223port number @var{p}. 2239port number @var{p}.
2224 2240
2225@item 2241@item
2226A local address is represented as a string which specifies the address 2242A local address is represented as a string, which specifies the address
2227in the local address space. 2243in the local address space.
2228 2244
2229@item 2245@item
@@ -2245,8 +2261,8 @@ second argument matching @code{"open"} (if successful) or
2245has succeeded or failed. 2261has succeeded or failed.
2246 2262
2247@item :stop @var{stopped} 2263@item :stop @var{stopped}
2248Start the network connection or server in the `stopped' state if 2264If @var{stopped} is non-@code{nil}, start the network connection or
2249@var{stopped} is non-@code{nil}. 2265server in the ``stopped'' state.
2250 2266
2251@item :buffer @var{buffer} 2267@item :buffer @var{buffer}
2252Use @var{buffer} as the process buffer. 2268Use @var{buffer} as the process buffer.
@@ -2267,6 +2283,11 @@ Initialize the process query flag to @var{query-flag}.
2267@item :filter @var{filter} 2283@item :filter @var{filter}
2268Initialize the process filter to @var{filter}. 2284Initialize the process filter to @var{filter}.
2269 2285
2286@item :filter-multibyte @var{multibyte}
2287If @var{multibyte} is non-@code{nil}, strings given to the process
2288filter are multibyte, otherwise they are unibyte. The default is the
2289default value of @code{enable-multibyte-characters}.
2290
2270@item :sentinel @var{sentinel} 2291@item :sentinel @var{sentinel}
2271Initialize the process sentinel to @var{sentinel}. 2292Initialize the process sentinel to @var{sentinel}.
2272 2293
@@ -2274,7 +2295,7 @@ Initialize the process sentinel to @var{sentinel}.
2274Initialize the log function of a server process to @var{log}. The log 2295Initialize the log function of a server process to @var{log}. The log
2275function is called each time the server accepts a network connection 2296function is called each time the server accepts a network connection
2276from a client. The arguments passed to the log function are 2297from a client. The arguments passed to the log function are
2277@var{server}, @var{connection}, and @var{message}, where @var{server} 2298@var{server}, @var{connection}, and @var{message}; where @var{server}
2278is the server process, @var{connection} is the new process for the 2299is the server process, @var{connection} is the new process for the
2279connection, and @var{message} is a string describing what has 2300connection, and @var{message} is a string describing what has
2280happened. 2301happened.
@@ -2311,7 +2332,7 @@ Using this option may require special privileges on some systems.
2311@item :broadcast @var{broadcast-flag} 2332@item :broadcast @var{broadcast-flag}
2312If @var{broadcast-flag} is non-@code{nil} for a datagram process, the 2333If @var{broadcast-flag} is non-@code{nil} for a datagram process, the
2313process will receive datagram packet sent to a broadcast address, and 2334process will receive datagram packet sent to a broadcast address, and
2314be able to send packets to a broadcast address. Ignored for a stream 2335be able to send packets to a broadcast address. This is ignored for a stream
2315connection. 2336connection.
2316 2337
2317@item :dontroute @var{dontroute-flag} 2338@item :dontroute @var{dontroute-flag}
@@ -2327,10 +2348,11 @@ If @var{linger-arg} is non-@code{nil}, wait for successful
2327transmission of all queued packets on the connection before it is 2348transmission of all queued packets on the connection before it is
2328deleted (see @code{delete-process}). If @var{linger-arg} is an 2349deleted (see @code{delete-process}). If @var{linger-arg} is an
2329integer, it specifies the maximum time in seconds to wait for queued 2350integer, it specifies the maximum time in seconds to wait for queued
2330packets to be sent before closing the connection. Default is 2351packets to be sent before closing the connection. The default is
2331@code{nil} which means to discard unsent queued packets when the 2352@code{nil}, which means to discard unsent queued packets when the
2332process is deleted. 2353process is deleted.
2333 2354
2355@c FIXME Where out-of-band data is ...?
2334@item :oobinline @var{oobinline-flag} 2356@item :oobinline @var{oobinline-flag}
2335If @var{oobinline-flag} is non-@code{nil} for a stream connection, 2357If @var{oobinline-flag} is non-@code{nil} for a stream connection,
2336receive out-of-band data in the normal data stream. Otherwise, ignore 2358receive out-of-band data in the normal data stream. Otherwise, ignore
@@ -2339,7 +2361,7 @@ out-of-band data.
2339@item :priority @var{priority} 2361@item :priority @var{priority}
2340Set the priority for packets sent on this connection to the integer 2362Set the priority for packets sent on this connection to the integer
2341@var{priority}. The interpretation of this number is protocol 2363@var{priority}. The interpretation of this number is protocol
2342specific, such as setting the TOS (type of service) field on IP 2364specific; such as setting the TOS (type of service) field on IP
2343packets sent on this connection. It may also have system dependent 2365packets sent on this connection. It may also have system dependent
2344effects, such as selecting a specific output queue on the network 2366effects, such as selecting a specific output queue on the network
2345interface. 2367interface.
@@ -2347,20 +2369,20 @@ interface.
2347@item :reuseaddr @var{reuseaddr-flag} 2369@item :reuseaddr @var{reuseaddr-flag}
2348If @var{reuseaddr-flag} is non-@code{nil} (the default) for a stream 2370If @var{reuseaddr-flag} is non-@code{nil} (the default) for a stream
2349server process, allow this server to reuse a specific port number (see 2371server process, allow this server to reuse a specific port number (see
2350@code{:service}) unless another process on this host is already 2372@code{:service}), unless another process on this host is already
2351listening on that port. If @var{reuseaddr-flag} is @code{nil}, there 2373listening on that port. If @var{reuseaddr-flag} is @code{nil}, there
2352may be a period of time after the last use of that port (by any 2374may be a period of time after the last use of that port (by any
2353process on the host), where it is not possible to make a new server on 2375process on the host) where it is not possible to make a new server on
2354that port. 2376that port.
2355@end table 2377@end table
2356 2378
2357@defun set-network-process-option process option value &optional no-error 2379@defun set-network-process-option process option value &optional no-error
2358This function sets or modifies a network option for network process 2380This function sets or modifies a network option for network process
2359@var{process}. See @code{make-network-process} for details of options 2381@var{process}. The accepted options and values are as for
2360@var{option} and their corresponding values @var{value}. If 2382@code{make-network-process}. If @var{no-error} is non-@code{nil},
2361@var{no-error} is non-@code{nil}, this function returns @code{nil} 2383this function returns @code{nil} instead of signaling an error if
2362instead of signaling an error if @var{option} is not a supported 2384@var{option} is not a supported option. If the function successfully
2363option. If the function successfully completes, it returns @code{t}. 2385completes, it returns @code{t}.
2364 2386
2365The current setting of an option is available via the 2387The current setting of an option is available via the
2366@code{process-contact} function. 2388@code{process-contact} function.
@@ -2377,11 +2399,9 @@ The current setting of an option is available via the
2377@end example 2399@end example
2378 2400
2379@noindent 2401@noindent
2380The result of the first form is @code{t} if it works to specify 2402The result of this form is @code{t} if it works to specify
2381@var{keyword} with value @var{value} in @code{make-network-process}. 2403@var{keyword} with value @var{value} in @code{make-network-process}.
2382The result of the second form is @code{t} if @var{keyword} is 2404Here are some of the @var{keyword}---@var{value} pairs you can test in
2383supported by @code{make-network-process}. Here are some of the
2384@var{keyword}---@var{value} pairs you can test in
2385this way. 2405this way.
2386 2406
2387@table @code 2407@table @code
@@ -2405,20 +2425,10 @@ Non-@code{nil} if the system can select the port for a server.
2405@end example 2425@end example
2406 2426
2407@noindent 2427@noindent
2408Here are some of the options you can test in this way. 2428The accepted @var{keyword} values are @code{:bindtodevice}, etc.
2409 2429For the complete list, @pxref{Network Options}. This form returns
2410@table @code 2430non-@code{nil} if that particular network option is supported by
2411@item :bindtodevice 2431@code{make-network-process} (or @code{set-network-process-option}).
2412@itemx :broadcast
2413@itemx :dontroute
2414@itemx :keepalive
2415@itemx :linger
2416@itemx :oobinline
2417@itemx :priority
2418@itemx :reuseaddr
2419That particular network option is supported by
2420@code{make-network-process} and @code{set-network-process-option}.
2421@end table
2422 2432
2423@node Misc Network 2433@node Misc Network
2424@section Misc Network Facilities 2434@section Misc Network Facilities
@@ -2490,11 +2500,11 @@ lets you change the speed, bytesize, and other parameters. In a
2490terminal window created by @code{serial-term}, you can click on the 2500terminal window created by @code{serial-term}, you can click on the
2491mode line for configuration. 2501mode line for configuration.
2492 2502
2493 A serial connection is represented by a process object which can be 2503 A serial connection is represented by a process object, which can be
2494used similar to a subprocess or network process. You can send and 2504used in a similar way to a subprocess or network process. You can send and
2495receive data and configure the serial port. A serial process object 2505receive data, and configure the serial port. A serial process object
2496has no process ID, you can't send signals to it, and the status codes 2506has no process ID, however, and you can't send signals to it, and the
2497are different from other types of processes. 2507status codes are different from other types of processes.
2498@code{delete-process} on the process object or @code{kill-buffer} on 2508@code{delete-process} on the process object or @code{kill-buffer} on
2499the process buffer close the connection, but this does not affect the 2509the process buffer close the connection, but this does not affect the
2500device connected to the serial port. 2510device connected to the serial port.
@@ -2502,15 +2512,17 @@ device connected to the serial port.
2502 The function @code{process-type} returns the symbol @code{serial} 2512 The function @code{process-type} returns the symbol @code{serial}
2503for a process object representing a serial port connection. 2513for a process object representing a serial port connection.
2504 2514
2505 Serial ports are available on GNU/Linux, Unix, and Windows systems. 2515 Serial ports are available on GNU/Linux, Unix, and MS Windows systems.
2506 2516
2507@deffn Command serial-term port speed 2517@deffn Command serial-term port speed
2508Start a terminal-emulator for a serial port in a new buffer. 2518Start a terminal-emulator for a serial port in a new buffer.
2509@var{port} is the name of the serial port to which to connect. For 2519@var{port} is the name of the serial port to connect to. For
2510example, this could be @file{/dev/ttyS0} on Unix. On Windows, this 2520example, this could be @file{/dev/ttyS0} on Unix. On MS Windows, this
2511could be @file{COM1}, or @file{\\.\COM10} (double the backslashes in 2521could be @file{COM1}, or @file{\\.\COM10} (double the backslashes in
2512Lisp strings). 2522Lisp strings).
2513 2523
2524@c FIXME is 9600 still the most common value, or is it 115200 now?
2525@c (Same value, 9600, appears below as well.)
2514@var{speed} is the speed of the serial port in bits per second. 9600 2526@var{speed} is the speed of the serial port in bits per second. 9600
2515is a common value. The buffer is in Term mode; see @ref{Term Mode,,, 2527is a common value. The buffer is in Term mode; see @ref{Term Mode,,,
2516emacs, The GNU Emacs Manual}, for the commands to use in that buffer. 2528emacs, The GNU Emacs Manual}, for the commands to use in that buffer.
@@ -2519,25 +2531,27 @@ You can change the speed and the configuration in the mode line menu.
2519 2531
2520@defun make-serial-process &rest args 2532@defun make-serial-process &rest args
2521This function creates a process and a buffer. Arguments are specified 2533This function creates a process and a buffer. Arguments are specified
2522as keyword/argument pairs. Here's the list of the meaningful keywords: 2534as keyword/argument pairs. Here's the list of the meaningful
2535keywords, with the first two (@var{port} and @var{speed}) being mandatory:
2523 2536
2524@table @code 2537@table @code
2525@item :port @var{port}@r{ (mandatory)} 2538@item :port @var{port}
2526This is the name of the serial port. On Unix and GNU systems, this is 2539This is the name of the serial port. On Unix and GNU systems, this is
2527a file name such as @file{/dev/ttyS0}. On Windows, this could be 2540a file name such as @file{/dev/ttyS0}. On Windows, this could be
2528@file{COM1}, or @file{\\.\COM10} for ports higher than @file{COM9} 2541@file{COM1}, or @file{\\.\COM10} for ports higher than @file{COM9}
2529(double the backslashes in Lisp strings). 2542(double the backslashes in Lisp strings).
2530 2543
2531@item :speed @var{speed}@r{ (mandatory)} 2544@item :speed @var{speed}
2532The speed of the serial port in bits per second. This function calls 2545The speed of the serial port in bits per second. This function calls
2533@code{serial-process-configure} to handle the speed. 2546@code{serial-process-configure} to handle the speed; see the
2547following documentation of that function for more details.
2534 2548
2535@item :name @var{name} 2549@item :name @var{name}
2536The name of the process. If @var{name} is not given, @var{port} will 2550The name of the process. If @var{name} is not given, @var{port} will
2537serve as the process name as well. 2551serve as the process name as well.
2538 2552
2539@item :buffer @var{buffer} 2553@item :buffer @var{buffer}
2540The buffer to associate with the process. The value could be either a 2554The buffer to associate with the process. The value can be either a
2541buffer or a string that names a buffer. Process output goes at the 2555buffer or a string that names a buffer. Process output goes at the
2542end of that buffer, unless you specify an output stream or filter 2556end of that buffer, unless you specify an output stream or filter
2543function to handle the output. If @var{buffer} is not given, the 2557function to handle the output. If @var{buffer} is not given, the
@@ -2547,16 +2561,16 @@ keyword.
2547@item :coding @var{coding} 2561@item :coding @var{coding}
2548If @var{coding} is a symbol, it specifies the coding system used for 2562If @var{coding} is a symbol, it specifies the coding system used for
2549both reading and writing for this process. If @var{coding} is a cons 2563both reading and writing for this process. If @var{coding} is a cons
2550@code{(decoding . encoding)}, @var{decoding} is used for reading, and 2564@code{(@var{decoding} . @var{encoding})}, @var{decoding} is used for
2551@var{encoding} is used for writing. If not specified, the default is 2565reading, and @var{encoding} is used for writing. If not specified,
2552to determine the coding systems from data itself. 2566the default is to determine the coding systems from the data itself.
2553 2567
2554@item :noquery @var{query-flag} 2568@item :noquery @var{query-flag}
2555Initialize the process query flag to @var{query-flag}. @xref{Query 2569Initialize the process query flag to @var{query-flag}. @xref{Query
2556Before Exit}. The flags defaults to @code{nil} if unspecified. 2570Before Exit}. The flags defaults to @code{nil} if unspecified.
2557 2571
2558@item :stop @var{bool} 2572@item :stop @var{bool}
2559Start process in the @code{stopped} state if @var{bool} is 2573Start process in the ``stopped'' state if @var{bool} is
2560non-@code{nil}. In the stopped state, a serial process does not 2574non-@code{nil}. In the stopped state, a serial process does not
2561accept incoming data, but you can send outgoing data. The stopped 2575accept incoming data, but you can send outgoing data. The stopped
2562state is cleared by @code{continue-process} and set by 2576state is cleared by @code{continue-process} and set by
@@ -2571,8 +2585,7 @@ Install @var{sentinel} as the process sentinel.
2571@item :plist @var{plist} 2585@item :plist @var{plist}
2572Install @var{plist} as the initial plist of the process. 2586Install @var{plist} as the initial plist of the process.
2573 2587
2574@item :speed 2588@item :bytesize
2575@itemx :bytesize
2576@itemx :parity 2589@itemx :parity
2577@itemx :stopbits 2590@itemx :stopbits
2578@itemx :flowcontrol 2591@itemx :flowcontrol
@@ -2600,7 +2613,7 @@ Here is an example:
2600This functions configures a serial port connection. Arguments are 2613This functions configures a serial port connection. Arguments are
2601specified as keyword/argument pairs. Attributes that are not given 2614specified as keyword/argument pairs. Attributes that are not given
2602are re-initialized from the process's current configuration (available 2615are re-initialized from the process's current configuration (available
2603via the function @code{process-contact}) or set to reasonable default 2616via the function @code{process-contact}), or set to reasonable default
2604values. The following arguments are defined: 2617values. The following arguments are defined:
2605 2618
2606@table @code 2619@table @code
@@ -2618,8 +2631,8 @@ rate}. The value can be any number, but most serial ports work only
2618at a few defined values between 1200 and 115200, with 9600 being the 2631at a few defined values between 1200 and 115200, with 9600 being the
2619most common value. If @var{speed} is @code{nil}, the function ignores 2632most common value. If @var{speed} is @code{nil}, the function ignores
2620all other arguments and does not configure the port. This may be 2633all other arguments and does not configure the port. This may be
2621useful for special serial ports such as Bluetooth-to-serial converters 2634useful for special serial ports such as Bluetooth-to-serial converters,
2622which can only be configured through AT commands sent through the 2635which can only be configured through @samp{AT} commands sent through the
2623connection. The value of @code{nil} for @var{speed} is valid only for 2636connection. The value of @code{nil} for @var{speed} is valid only for
2624connections that were already opened by a previous call to 2637connections that were already opened by a previous call to
2625@code{make-serial-process} or @code{serial-term}. 2638@code{make-serial-process} or @code{serial-term}.
@@ -2646,9 +2659,9 @@ flow control). If @var{flowcontrol} is not given, it defaults to no
2646flow control. 2659flow control.
2647@end table 2660@end table
2648 2661
2649@code{serial-process-configure} is called by 2662Internally, @code{make-serial-process} calls
2650@code{make-serial-process} for the initial configuration of the serial 2663@code{serial-process-configure} for the initial configuration of the
2651port. 2664serial port.
2652@end defun 2665@end defun
2653 2666
2654@node Byte Packing 2667@node Byte Packing
@@ -2658,8 +2671,12 @@ port.
2658 This section describes how to pack and unpack arrays of bytes, 2671 This section describes how to pack and unpack arrays of bytes,
2659usually for binary network protocols. These functions convert byte arrays 2672usually for binary network protocols. These functions convert byte arrays
2660to alists, and vice versa. The byte array can be represented as a 2673to alists, and vice versa. The byte array can be represented as a
2674@c FIXME? No multibyte?
2661unibyte string or as a vector of integers, while the alist associates 2675unibyte string or as a vector of integers, while the alist associates
2662symbols either with fixed-size objects or with recursive sub-alists. 2676symbols either with fixed-size objects or with recursive sub-alists.
2677To use the functions referred to in this section, load the
2678@code{bindat} library.
2679@c It doesn't have any autoloads.
2663 2680
2664@cindex serializing 2681@cindex serializing
2665@cindex deserializing 2682@cindex deserializing
@@ -2680,7 +2697,7 @@ direction is also known as @dfn{serializing} or @dfn{packing}.
2680 2697
2681 To control unpacking and packing, you write a @dfn{data layout 2698 To control unpacking and packing, you write a @dfn{data layout
2682specification}, a special nested list describing named and typed 2699specification}, a special nested list describing named and typed
2683@dfn{fields}. This specification controls length of each field to be 2700@dfn{fields}. This specification controls the length of each field to be
2684processed, and how to pack or unpack it. We normally keep bindat specs 2701processed, and how to pack or unpack it. We normally keep bindat specs
2685in variables whose names end in @samp{-bindat-spec}; that kind of name 2702in variables whose names end in @samp{-bindat-spec}; that kind of name
2686is automatically recognized as ``risky''. 2703is automatically recognized as ``risky''.
@@ -2729,12 +2746,12 @@ String of length @var{len}.
2729Zero-terminated string, in a fixed-size field with length @var{len}. 2746Zero-terminated string, in a fixed-size field with length @var{len}.
2730 2747
2731@item vec @var{len} [@var{type}] 2748@item vec @var{len} [@var{type}]
2732Vector of @var{len} elements of type @var{type}, or bytes if not 2749Vector of @var{len} elements of type @var{type}, defaulting to bytes.
2733@var{type} is specified.
2734The @var{type} is any of the simple types above, or another vector 2750The @var{type} is any of the simple types above, or another vector
2735specified as a list @code{(vec @var{len} [@var{type}])}. 2751specified as a list of the form @code{(vec @var{len} [@var{type}])}.
2736 2752
2737@item ip 2753@item ip
2754@c FIXME? IPv6?
2738Four-byte vector representing an Internet address. For example: 2755Four-byte vector representing an Internet address. For example:
2739@code{[127 0 0 1]} for localhost. 2756@code{[127 0 0 1]} for localhost.
2740 2757
@@ -2762,12 +2779,11 @@ below, or by an expression @code{(eval @var{form})} where @var{form}
2762should evaluate to an integer, specifying the field length. 2779should evaluate to an integer, specifying the field length.
2763 2780
2764A field specification generally has the form @code{([@var{name}] 2781A field specification generally has the form @code{([@var{name}]
2765@var{handler})}. The square braces indicate that @var{name} is 2782@var{handler})}, where @var{name} is optional. Don't use names that
2766optional. (Don't use names that are symbols meaningful as type 2783are symbols meaningful as type specifications (above) or handler
2767specifications (above) or handler specifications (below), since that 2784specifications (below), since that would be ambiguous. @var{name} can
2768would be ambiguous.) @var{name} can be a symbol or the expression 2785be a symbol or an expression @code{(eval @var{form})}, in which case
2769@code{(eval @var{form})}, in which case @var{form} should evaluate to 2786@var{form} should evaluate to a symbol.
2770a symbol.
2771 2787
2772@var{handler} describes how to unpack or pack the field and can be one 2788@var{handler} describes how to unpack or pack the field and can be one
2773of the following: 2789of the following:
@@ -2814,10 +2830,11 @@ of @var{form}. A non-@code{nil} result indicates a match.
2814 2830
2815@item repeat @var{count} @var{field-specs}@dots{} 2831@item repeat @var{count} @var{field-specs}@dots{}
2816Process the @var{field-specs} recursively, in order, then repeat 2832Process the @var{field-specs} recursively, in order, then repeat
2817starting from the first one, processing all the specs @var{count} 2833starting from the first one, processing all the specifications @var{count}
2818times overall. The @var{count} is given using the same formats as a 2834times overall. The @var{count} is given using the same formats as a
2819field length---if an @code{eval} form is used, it is evaluated just once. 2835field length---if an @code{eval} form is used, it is evaluated just once.
2820For correct operation, each spec in @var{field-specs} must include a name. 2836For correct operation, each specification in @var{field-specs} must
2837include a name.
2821@end table 2838@end table
2822 2839
2823For the @code{(eval @var{form})} forms used in a bindat specification, 2840For the @code{(eval @var{form})} forms used in a bindat specification,
@@ -2856,9 +2873,10 @@ specification, @code{bindat-raw} to a byte array, and @var{struct} to an
2856alist representing unpacked field data. 2873alist representing unpacked field data.
2857 2874
2858@defun bindat-unpack spec bindat-raw &optional bindat-idx 2875@defun bindat-unpack spec bindat-raw &optional bindat-idx
2876@c FIXME? Again, no multibyte?
2859This function unpacks data from the unibyte string or byte 2877This function unpacks data from the unibyte string or byte
2860array @code{bindat-raw} 2878array @code{bindat-raw}
2861according to @var{spec}. Normally this starts unpacking at the 2879according to @var{spec}. Normally, this starts unpacking at the
2862beginning of the byte array, but if @var{bindat-idx} is non-@code{nil}, it 2880beginning of the byte array, but if @var{bindat-idx} is non-@code{nil}, it
2863specifies a zero-based starting position to use instead. 2881specifies a zero-based starting position to use instead.
2864 2882
@@ -2894,7 +2912,7 @@ according to @var{spec}.
2894 2912
2895@defun bindat-pack spec struct &optional bindat-raw bindat-idx 2913@defun bindat-pack spec struct &optional bindat-raw bindat-idx
2896This function returns a byte array packed according to @var{spec} from 2914This function returns a byte array packed according to @var{spec} from
2897the data in the alist @var{struct}. Normally it creates and fills a 2915the data in the alist @var{struct}. It normally creates and fills a
2898new byte array starting at the beginning. However, if @var{bindat-raw} 2916new byte array starting at the beginning. However, if @var{bindat-raw}
2899is non-@code{nil}, it specifies a pre-allocated unibyte string or vector to 2917is non-@code{nil}, it specifies a pre-allocated unibyte string or vector to
2900pack into. If @var{bindat-idx} is non-@code{nil}, it specifies the starting 2918pack into. If @var{bindat-idx} is non-@code{nil}, it specifies the starting
@@ -2907,6 +2925,7 @@ meets or exceeds the total length to avoid an out-of-range error.
2907@defun bindat-ip-to-string ip 2925@defun bindat-ip-to-string ip
2908Convert the Internet address vector @var{ip} to a string in the usual 2926Convert the Internet address vector @var{ip} to a string in the usual
2909dotted notation. 2927dotted notation.
2928@c FIXME? Does it do IPv6?
2910 2929
2911@example 2930@example
2912(bindat-ip-to-string [127 0 0 1]) 2931(bindat-ip-to-string [127 0 0 1])
@@ -2916,10 +2935,16 @@ dotted notation.
2916 2935
2917@node Bindat Examples 2936@node Bindat Examples
2918@subsection Examples of Byte Unpacking and Packing 2937@subsection Examples of Byte Unpacking and Packing
2938@c FIXME? This seems a very long example for something that is not used
2939@c very often. As of 24.1, gdb-mi.el is the only user of bindat.el in Emacs.
2940@c Maybe one or both of these examples should just be moved to the
2941@c commentary of bindat.el.
2919 2942
2920 Here is a complete example of byte unpacking and packing: 2943 Here is a complete example of byte unpacking and packing:
2921 2944
2922@lisp 2945@lisp
2946(require 'bindat)
2947
2923(defvar fcookie-index-spec 2948(defvar fcookie-index-spec
2924 '((:version u32) 2949 '((:version u32)
2925 (:count u32) 2950 (:count u32)
@@ -2928,16 +2953,14 @@ dotted notation.
2928 (:flags u32) 2953 (:flags u32)
2929 (:delim u8) 2954 (:delim u8)
2930 (:ignored fill 3) 2955 (:ignored fill 3)
2931 (:offset repeat (:count) 2956 (:offset repeat (:count) (:foo u32)))
2932 (:foo u32)))
2933 "Description of a fortune cookie index file's contents.") 2957 "Description of a fortune cookie index file's contents.")
2934 2958
2935(defun fcookie (cookies &optional index) 2959(defun fcookie (cookies &optional index)
2936 "Display a random fortune cookie from file COOKIES. 2960 "Display a random fortune cookie from file COOKIES.
2937Optional second arg INDEX specifies the associated index 2961Optional second arg INDEX specifies the associated index
2938filename, which is by default constructed by appending 2962filename, by default \"COOKIES.dat\". Display cookie text
2939\".dat\" to COOKIES. Display cookie text in possibly 2963in buffer \"*Fortune Cookie: BASENAME*\", where BASENAME
2940new buffer \"*Fortune Cookie: BASENAME*\" where BASENAME
2941is COOKIES without the directory part." 2964is COOKIES without the directory part."
2942 (interactive "fCookies file: ") 2965 (interactive "fCookies file: ")
2943 (let* ((info (with-temp-buffer 2966 (let* ((info (with-temp-buffer
@@ -2960,10 +2983,9 @@ is COOKIES without the directory part."
2960 2983
2961(defun fcookie-create-index (cookies &optional index delim) 2984(defun fcookie-create-index (cookies &optional index delim)
2962 "Scan file COOKIES, and write out its index file. 2985 "Scan file COOKIES, and write out its index file.
2963Optional second arg INDEX specifies the index filename, 2986Optional arg INDEX specifies the index filename, which by
2964which is by default constructed by appending \".dat\" to 2987default is \"COOKIES.dat\". Optional arg DELIM specifies the
2965COOKIES. Optional third arg DELIM specifies the unibyte 2988unibyte character that, when found on a line of its own in
2966character which, when found on a line of its own in
2967COOKIES, indicates the border between entries." 2989COOKIES, indicates the border between entries."
2968 (interactive "fCookies file: ") 2990 (interactive "fCookies file: ")
2969 (setq delim (or delim ?%)) 2991 (setq delim (or delim ?%))
@@ -3000,8 +3022,8 @@ COOKIES, indicates the border between entries."
3000 (write-file (or index (concat cookies ".dat"))))))) 3022 (write-file (or index (concat cookies ".dat")))))))
3001@end lisp 3023@end lisp
3002 3024
3003Following is an example of defining and unpacking a complex structure. 3025The following is an example of defining and unpacking a complex
3004Consider the following C structures: 3026structure. Consider the following C structures:
3005 3027
3006@example 3028@example
3007struct header @{ 3029struct header @{
@@ -3014,14 +3036,14 @@ struct header @{
3014struct data @{ 3036struct data @{
3015 unsigned char type; 3037 unsigned char type;
3016 unsigned char opcode; 3038 unsigned char opcode;
3017 unsigned short length; /* In network byte order */ 3039 unsigned short length; /* in network byte order */
3018 unsigned char id[8]; /* null-terminated string */ 3040 unsigned char id[8]; /* null-terminated string */
3019 unsigned char data[/* (length + 3) & ~3 */]; 3041 unsigned char data[/* (length + 3) & ~3 */];
3020@}; 3042@};
3021 3043
3022struct packet @{ 3044struct packet @{
3023 struct header header; 3045 struct header header;
3024 unsigned long counters[2]; /* In little endian order */ 3046 unsigned long counters[2]; /* in little endian order */
3025 unsigned char items; 3047 unsigned char items;
3026 unsigned char filler[3]; 3048 unsigned char filler[3];
3027 struct data item[/* items */]; 3049 struct data item[/* items */];
@@ -3029,7 +3051,7 @@ struct packet @{
3029@}; 3051@};
3030@end example 3052@end example
3031 3053
3032The corresponding data layout specification: 3054The corresponding data layout specification is:
3033 3055
3034@lisp 3056@lisp
3035(setq header-spec 3057(setq header-spec
@@ -3041,21 +3063,21 @@ The corresponding data layout specification:
3041(setq data-spec 3063(setq data-spec
3042 '((type u8) 3064 '((type u8)
3043 (opcode u8) 3065 (opcode u8)
3044 (length u16) ;; network byte order 3066 (length u16) ; network byte order
3045 (id strz 8) 3067 (id strz 8)
3046 (data vec (length)) 3068 (data vec (length))
3047 (align 4))) 3069 (align 4)))
3048 3070
3049(setq packet-spec 3071(setq packet-spec
3050 '((header struct header-spec) 3072 '((header struct header-spec)
3051 (counters vec 2 u32r) ;; little endian order 3073 (counters vec 2 u32r) ; little endian order
3052 (items u8) 3074 (items u8)
3053 (fill 3) 3075 (fill 3)
3054 (item repeat (items) 3076 (item repeat (items)
3055 (struct data-spec)))) 3077 (struct data-spec))))
3056@end lisp 3078@end lisp
3057 3079
3058A binary data representation: 3080A binary data representation is:
3059 3081
3060@lisp 3082@lisp
3061(setq binary-data 3083(setq binary-data
@@ -3065,7 +3087,7 @@ A binary data representation:
3065 1 4 0 7 ?B ?C ?D ?E ?F ?G 0 0 6 7 8 9 10 11 12 0 ]) 3087 1 4 0 7 ?B ?C ?D ?E ?F ?G 0 0 6 7 8 9 10 11 12 0 ])
3066@end lisp 3088@end lisp
3067 3089
3068The corresponding decoded structure: 3090The corresponding decoded structure is:
3069 3091
3070@lisp 3092@lisp
3071(setq decoded (bindat-unpack packet-spec binary-data)) 3093(setq decoded (bindat-unpack packet-spec binary-data))
@@ -3089,7 +3111,7 @@ The corresponding decoded structure:
3089 (type . 1)))) 3111 (type . 1))))
3090@end lisp 3112@end lisp
3091 3113
3092Fetching data from this structure: 3114An example of fetching data from this structure:
3093 3115
3094@lisp 3116@lisp
3095(bindat-get-field decoded 'item 1 'id) 3117(bindat-get-field decoded 'item 1 'id)
diff --git a/doc/lispref/vol1.texi b/doc/lispref/vol1.texi
index 45a0dee3b1c..25ea8577467 100644
--- a/doc/lispref/vol1.texi
+++ b/doc/lispref/vol1.texi
@@ -658,8 +658,8 @@ Minibuffers
658* Multiple Queries:: Asking a series of similar questions. 658* Multiple Queries:: Asking a series of similar questions.
659* Reading a Password:: Reading a password from the terminal. 659* Reading a Password:: Reading a password from the terminal.
660* Minibuffer Commands:: Commands used as key bindings in minibuffers. 660* Minibuffer Commands:: Commands used as key bindings in minibuffers.
661* Minibuffer Contents:: How such commands access the minibuffer text.
662* Minibuffer Windows:: Operating on the special minibuffer windows. 661* Minibuffer Windows:: Operating on the special minibuffer windows.
662* Minibuffer Contents:: How such commands access the minibuffer text.
663* Recursive Mini:: Whether recursive entry to minibuffer is allowed. 663* Recursive Mini:: Whether recursive entry to minibuffer is allowed.
664* Minibuffer Misc:: Various customization hooks and variables. 664* Minibuffer Misc:: Various customization hooks and variables.
665 665
@@ -670,7 +670,7 @@ Completion
670* Minibuffer Completion:: Invoking the minibuffer with completion. 670* Minibuffer Completion:: Invoking the minibuffer with completion.
671* Completion Commands:: Minibuffer commands that do completion. 671* Completion Commands:: Minibuffer commands that do completion.
672* High-Level Completion:: Convenient special cases of completion 672* High-Level Completion:: Convenient special cases of completion
673 (reading buffer name, file name, etc.). 673 (reading buffer names, variable names, etc.).
674* Reading File Names:: Using completion to read file names and 674* Reading File Names:: Using completion to read file names and
675 shell commands. 675 shell commands.
676* Completion Variables:: Variables controlling completion behavior. 676* Completion Variables:: Variables controlling completion behavior.
diff --git a/doc/lispref/vol2.texi b/doc/lispref/vol2.texi
index 01a3e3c129e..2fd2a8d8224 100644
--- a/doc/lispref/vol2.texi
+++ b/doc/lispref/vol2.texi
@@ -657,8 +657,8 @@ Minibuffers
657* Multiple Queries:: Asking a series of similar questions. 657* Multiple Queries:: Asking a series of similar questions.
658* Reading a Password:: Reading a password from the terminal. 658* Reading a Password:: Reading a password from the terminal.
659* Minibuffer Commands:: Commands used as key bindings in minibuffers. 659* Minibuffer Commands:: Commands used as key bindings in minibuffers.
660* Minibuffer Contents:: How such commands access the minibuffer text.
661* Minibuffer Windows:: Operating on the special minibuffer windows. 660* Minibuffer Windows:: Operating on the special minibuffer windows.
661* Minibuffer Contents:: How such commands access the minibuffer text.
662* Recursive Mini:: Whether recursive entry to minibuffer is allowed. 662* Recursive Mini:: Whether recursive entry to minibuffer is allowed.
663* Minibuffer Misc:: Various customization hooks and variables. 663* Minibuffer Misc:: Various customization hooks and variables.
664 664
@@ -669,7 +669,7 @@ Completion
669* Minibuffer Completion:: Invoking the minibuffer with completion. 669* Minibuffer Completion:: Invoking the minibuffer with completion.
670* Completion Commands:: Minibuffer commands that do completion. 670* Completion Commands:: Minibuffer commands that do completion.
671* High-Level Completion:: Convenient special cases of completion 671* High-Level Completion:: Convenient special cases of completion
672 (reading buffer name, file name, etc.). 672 (reading buffer names, variable names, etc.).
673* Reading File Names:: Using completion to read file names and 673* Reading File Names:: Using completion to read file names and
674 shell commands. 674 shell commands.
675* Completion Variables:: Variables controlling completion behavior. 675* Completion Variables:: Variables controlling completion behavior.
diff --git a/doc/misc/ChangeLog b/doc/misc/ChangeLog
index 46fea77107b..20c453544bc 100644
--- a/doc/misc/ChangeLog
+++ b/doc/misc/ChangeLog
@@ -1,3 +1,23 @@
12012-04-20 Glenn Morris <rgm@gnu.org>
2
3 * faq.texi (New in Emacs 24): New section.
4 (Packages that do not come with Emacs): Mention M-x list-packages.
5
62012-04-20 Glenn Morris <rgm@gnu.org>
7
8 * Makefile.in: Replace non-portable use of $< in emacs-gnutls rules.
9
102012-04-20 Eli Zaretskii <eliz@gnu.org>
11
12 * makefile.w32-in (INFO_TARGETS, DVI_TARGETS, clean): Add emacs-gnutls.
13 ($(infodir)/emacs-gnutls, emacs-gnutls.dvi): New targets.
14
152012-04-20 Teodor Zlatanov <tzz@lifelogs.com>
16
17 * emacs-gnutls.texi: Add documentation for the GnuTLS integration.
18 * Makefile.in: Add emacs-gnutls.texi to build.
19
202012-04-20 Alan Mackenzie <acm@muc.de>
12012-04-14 Alan Mackenzie <acm@muc.de> 212012-04-14 Alan Mackenzie <acm@muc.de>
2 22
3 * cc-mode.texi (c-offsets-alist): Correct a typo. 23 * cc-mode.texi (c-offsets-alist): Correct a typo.
diff --git a/doc/misc/faq.texi b/doc/misc/faq.texi
index 5b7bb7ec9ce..0f20c41c8eb 100644
--- a/doc/misc/faq.texi
+++ b/doc/misc/faq.texi
@@ -942,6 +942,7 @@ status of its latest version.
942@menu 942@menu
943* Origin of the term Emacs:: 943* Origin of the term Emacs::
944* Latest version of Emacs:: 944* Latest version of Emacs::
945* New in Emacs 24::
945* New in Emacs 23:: 946* New in Emacs 23::
946* New in Emacs 22:: 947* New in Emacs 22::
947* New in Emacs 21:: 948* New in Emacs 21::
@@ -1009,12 +1010,84 @@ Emacs, type @kbd{C-h C-n} (@kbd{M-x view-emacs-news}). As of Emacs 22,
1009you can give this command a prefix argument to read about which features 1010you can give this command a prefix argument to read about which features
1010were new in older versions. 1011were new in older versions.
1011 1012
1013@node New in Emacs 24
1014@section What is different about Emacs 24?
1015@cindex Differences between Emacs 23 and Emacs 24
1016@cindex Emacs 24, new features in
1017
1018@itemize
1019@cindex packages, installing more
1020@item
1021Emacs now includes a package manager. Type @kbd{M-x list-packages} to
1022get started. You can use this to download and automatically install
1023many more Lisp packages.
1024
1025@cindex lexical binding
1026@item
1027Emacs Lisp now supports lexical binding on a per-file basis. In
1028@emph{lexical binding}, variable references must be located textually
1029within the binding construct. This contrasts with @emph{dynamic
1030binding}, where programs can refer to variables defined outside their
1031local textual scope. A Lisp file can use a local variable setting of
1032@code{lexical-binding: t} to indicate that the contents should be
1033interpreted using lexical binding. See the Emacs Lisp Reference
1034Manual for more details.
1035
1036@cindex bidirectional display
1037@cindex right-to-left languages
1038@item
1039Some human languages, such as English, are written from left to right.
1040Others, such as Arabic, are written from right to left. Emacs now has
1041support for any mixture of these forms---this is ``bidirectional text''.
1042
1043@item
1044Handling of text selections has been improved, and now integrates
1045better with external clipboards.
1046
1047@cindex themes
1048@item
1049A new command @kbd{customize-themes} allows you to easily change the
1050appearance of your Emacs.
1051
1052@item
1053Emacs can be compiled with the Gtk+ 3 toolkit.
1054
1055@item
1056Support for several new external libraries can be included at compile
1057time:
1058
1059@itemize
1060
1061@item
1062``Security-Enhanced Linux'' (SELinux) is a Linux kernel feature that
1063provides more sophisticated file access controls than ordinary
1064``Unix-style'' file permissions.
1065
1066@item
1067The ImageMagick display library. This allows you to display many more
1068image format in Emacs, as well as carry out transformations such as
1069rotations.
1070
1071@item
1072The GnuTLS library for secure network communications. Emacs uses this
1073transparently for email if your mail server supports it.
1074
1075@item
1076The libxml2 library for parsing XML structures.
1077@end itemize
1078
1079@item
1080Much more flexibility in the handling of windows and buffer display.
1081
1082@end itemize
1083
1084As always, consult the @file{NEWS} file for more information.
1085
1086
1012@node New in Emacs 23 1087@node New in Emacs 23
1013@section What is different about Emacs 23? 1088@section What is different about Emacs 23?
1014@cindex Differences between Emacs 22 and Emacs 23 1089@cindex Differences between Emacs 22 and Emacs 23
1015@cindex Emacs 23, new features in 1090@cindex Emacs 23, new features in
1016@cindex Recently introduced features
1017@cindex Default features
1018 1091
1019@itemize 1092@itemize
1020 1093
@@ -1065,8 +1138,7 @@ Other changes include: support for serial port access; D-Bus bindings; a
1065new Visual Line mode for line-motion; improved completion; a new mode 1138new Visual Line mode for line-motion; improved completion; a new mode
1066(@samp{DocView}) for viewing of PDF, PostScript, and DVI documents; nXML 1139(@samp{DocView}) for viewing of PDF, PostScript, and DVI documents; nXML
1067mode (for editing XML documents) is included; VC has been updated for 1140mode (for editing XML documents) is included; VC has been updated for
1068newer version control systems; etc. As always, consult the @file{NEWS} 1141newer version control systems; etc.
1069file for more information.
1070 1142
1071 1143
1072@node New in Emacs 22 1144@node New in Emacs 22
@@ -3225,6 +3297,14 @@ see @ref{Packages that do not come with Emacs}.
3225@cindex Emacs Lisp List 3297@cindex Emacs Lisp List
3226@cindex Emacs Lisp Archive 3298@cindex Emacs Lisp Archive
3227 3299
3300Your first port of call should be the @kbd{M-x list-packages} command.
3301This connects to the @uref{http:///elpa.gnu.org, GNU ELPA} (``Emacs
3302Lisp Package Archive'') server and fetches the list of additional
3303packages that it offers. These are GNU packages that are available
3304for use with Emacs, but are distributed separately. Select a package
3305to get more details about the features that it offers, and then if you
3306wish, Emacs can download and automatically install it for you.
3307
3228@uref{http://www.damtp.cam.ac.uk/user/sje30/emacs/ell.html, The Emacs Lisp 3308@uref{http://www.damtp.cam.ac.uk/user/sje30/emacs/ell.html, The Emacs Lisp
3229List (ELL)}, maintained by @email{S.J.Eglen@@damtp.cam.ac.uk, Stephen Eglen}, 3309List (ELL)}, maintained by @email{S.J.Eglen@@damtp.cam.ac.uk, Stephen Eglen},
3230aims to provide one compact list with links to all of the current Emacs 3310aims to provide one compact list with links to all of the current Emacs