aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman1998-05-19 03:45:57 +0000
committerRichard M. Stallman1998-05-19 03:45:57 +0000
commita9f0a989a17f47f9d25b7a426b4e82a8ff684ee4 (patch)
treed62b5592064177c684f1509989b223623db3f24c
parentc6d6572475603083762cb0155ae966de7710bb9c (diff)
downloademacs-a9f0a989a17f47f9d25b7a426b4e82a8ff684ee4.tar.gz
emacs-a9f0a989a17f47f9d25b7a426b4e82a8ff684ee4.zip
*** empty log message ***
-rw-r--r--lispref/advice.texi240
-rw-r--r--lispref/anti.texi11
-rw-r--r--lispref/backups.texi12
-rw-r--r--lispref/buffers.texi14
-rw-r--r--lispref/commands.texi72
-rw-r--r--lispref/compile.texi15
-rw-r--r--lispref/control.texi12
-rw-r--r--lispref/customize.texi79
-rw-r--r--lispref/debugging.texi108
-rw-r--r--lispref/display.texi125
-rw-r--r--lispref/edebug.texi125
-rw-r--r--lispref/elisp.texi23
-rw-r--r--lispref/errors.texi2
-rw-r--r--lispref/eval.texi7
-rw-r--r--lispref/files.texi141
-rw-r--r--lispref/frames.texi134
-rw-r--r--lispref/functions.texi47
-rw-r--r--lispref/help.texi33
-rw-r--r--lispref/hooks.texi2
-rw-r--r--lispref/internals.texi10
-rw-r--r--lispref/intro.texi89
-rw-r--r--lispref/keymaps.texi193
-rw-r--r--lispref/lists.texi27
-rw-r--r--lispref/loading.texi176
-rw-r--r--lispref/macros.texi4
-rw-r--r--lispref/maps.texi2
-rw-r--r--lispref/markers.texi48
-rw-r--r--lispref/minibuf.texi34
-rw-r--r--lispref/modes.texi81
-rw-r--r--lispref/nonascii.texi770
-rw-r--r--lispref/numbers.texi43
-rw-r--r--lispref/objects.texi77
-rw-r--r--lispref/os.texi106
-rw-r--r--lispref/positions.texi24
-rw-r--r--lispref/processes.texi85
-rw-r--r--lispref/searching.texi35
-rw-r--r--lispref/sequences.texi108
-rw-r--r--lispref/streams.texi38
-rw-r--r--lispref/strings.texi93
-rw-r--r--lispref/symbols.texi12
-rw-r--r--lispref/syntax.texi34
-rw-r--r--lispref/text.texi82
-rw-r--r--lispref/tips.texi68
-rw-r--r--lispref/variables.texi83
-rw-r--r--lispref/windows.texi48
45 files changed, 2392 insertions, 1180 deletions
diff --git a/lispref/advice.texi b/lispref/advice.texi
index ffa6606f874..3d61ae41c38 100644
--- a/lispref/advice.texi
+++ b/lispref/advice.texi
@@ -8,25 +8,96 @@
8@cindex advising functions 8@cindex advising functions
9 9
10 The @dfn{advice} feature lets you add to the existing definition of a 10 The @dfn{advice} feature lets you add to the existing definition of a
11function, by @dfn{advising the function}. This a clean method for a 11function, by @dfn{advising the function}. This is a clean method for a
12library to customize functions defined by other parts of Emacs---cleaner 12library to customize functions defined by other parts of Emacs---cleaner
13than redefining the function in the usual way. 13than redefining the whole function.
14 14
15 Each piece of advice can be enabled or disabled explicitly. The 15 Each piece of advice can be enabled or disabled explicitly. The
16enabled pieces of advice for any given function actually take effect 16enabled pieces of advice for any given function actually take effect
17when you activate advice for that function, or when that function is 17when you activate advice for that function, or when that function is
18subsequently defined or redefined. 18subsequently defined or redefined.
19 19
20 @strong{Usage Note:} Advice is useful for altering the behavior of
21existing calls to an existing function. If you want the new behavior
22for new calls, or for key bindings, it is cleaner to define a new
23function (or a new command) which uses the existing function.
24
20@menu 25@menu
21* Defining Advice:: 26* Simple Advice:: A simple example to explain the basics of advice.
22* Computed Advice:: 27* Defining Advice:: Detailed description of @code{defadvice}.
23* Activation of Advice:: 28* Computed Advice:: ...is to @code{defadvice} as @code{fset} is to @code{defun}.
24* Enabling Advice:: 29* Activation of Advice:: Advice doesn't do anything until you activate it.
25* Preactivation:: 30* Enabling Advice:: You can enable or disable each piece of advice.
26* Argument Access in Advice:: 31* Preactivation:: Preactivation is a way of speeding up the
27* Combined Definition:: 32 loading of compiled advice.
33* Argument Access:: How advice can access the function's arguments.
34* Subr Arguments:: Accessing arguments when advising a primitive.
35* Combined Definition:: How advice is implemented.
28@end menu 36@end menu
29 37
38@node Simple Advice
39@section A Simple Advice Example
40
41 The command @code{next-line} moves point down vertically one or more
42lines; it is the standard binding of @kbd{C-n}. When used on the last
43line of the buffer, this command inserts a newline to create a line to
44move to (if @code{next-line-add-newlines} is non-@code{nil}).
45
46 Suppose you wanted to add a similar feature to @code{previous-line},
47which would insert a new line at the beginning of the buffer for the
48command to move to. How could you do this?
49
50 You could do it by redefining the whole function, but that is not
51modular. The advice feature provides a cleaner alternative: you can
52effectively add your code to the existing function definition, without
53actually changing or even seeing that definition. Here is how to do
54this:
55
56@example
57(defadvice previous-line (before next-line-at-end (arg))
58 "Insert an empty line when moving up from the top line."
59 (if (and next-line-add-newlines (= arg 1)
60 (save-excursion (beginning-of-line) (bobp)))
61 (progn
62 (beginning-of-line)
63 (newline))))
64@end example
65
66@cindex piece of advice
67 This expression defines a @dfn{piece of advice} for the function
68@code{previous-line}. This piece of advice is named
69@code{next-line-at-end}, and the symbol @code{before} says that it is
70@dfn{before-advice} which should run before the regular definition of
71@code{previous-line}. @code{(arg)} specifies how the advice code can
72refer to the function's arguments.
73
74 When this piece of advice runs, it creates an additional line, in the
75situation where that is appropriate, but does not move point to that
76line. This is the correct way to write the advice, because the normal
77definition will run afterward and will move back to the newly inserted
78line.
79
80 Defining the advice doesn't immediately change the function
81@code{previous-line}. That happens when you @dfn{activate} the advice,
82like this:
83
84@example
85(ad-activate 'previous-line)
86@end example
87
88@noindent
89This is what actually begins to use the advice that has been defined so
90far for the function @code{previous-line}. Henceforth, whenever that
91function is run, whether invoked by the user with @kbd{C-p} or
92@kbd{M-x}, or called from Lisp, it runs the advice first, and its
93regular definition second.
94
95 This example illustrates before-advice, which is one @dfn{class} of
96advice: it runs before the function's base definition. There are two
97other advice classes: @dfn{after-advice}, which runs after the base
98definition, and @dfn{around-advice}, which lets you specify an
99expression to wrap around the invocation of the base definition.
100
30@node Defining Advice 101@node Defining Advice
31@section Defining Advice 102@section Defining Advice
32 103
@@ -50,16 +121,11 @@ form) to be advised. From now on, we will write just ``function'' when
50describing the entity being advised, but this always includes macros and 121describing the entity being advised, but this always includes macros and
51special forms. 122special forms.
52 123
53The argument @var{name} is the name of the advice, a non-@code{nil} 124@cindex class of advice
54symbol. The advice name uniquely identifies one piece of advice, within all 125@cindex before-advice
55the pieces of advice in a particular class for a particular 126@cindex after-advice
56@var{function}. The name allows you to refer to the piece of 127@cindex around-advice
57advice---to redefine it, or to enable or disable it. 128@var{class} specifies the @dfn{class} of the advice---one of @code{before},
58
59Where an ordinary definition has an argument list, an advice definition
60needs several kinds of information.
61
62@var{class} specifies the class of the advice---one of @code{before},
63@code{after}, or @code{around}. Before-advice runs before the function 129@code{after}, or @code{around}. Before-advice runs before the function
64itself; after-advice runs after the function itself; around-advice is 130itself; after-advice runs after the function itself; around-advice is
65wrapped around the execution of the function itself. After-advice and 131wrapped around the execution of the function itself. After-advice and
@@ -75,6 +141,15 @@ definition is never run. This provides a way to override the original
75definition completely. (It also overrides lower-positioned pieces of 141definition completely. (It also overrides lower-positioned pieces of
76around-advice). 142around-advice).
77 143
144The argument @var{name} is the name of the advice, a non-@code{nil}
145symbol. The advice name uniquely identifies one piece of advice, within all
146the pieces of advice in a particular class for a particular
147@var{function}. The name allows you to refer to the piece of
148advice---to redefine it, or to enable or disable it.
149
150In place of the argument list in an ordinary definition, an advice
151definition calls for several different pieces of information.
152
78The optional @var{position} specifies where, in the current list of 153The optional @var{position} specifies where, in the current list of
79advice of the specified @var{class}, this new advice should be placed. 154advice of the specified @var{class}, this new advice should be placed.
80It should be either @code{first}, @code{last} or a number that 155It should be either @code{first}, @code{last} or a number that
@@ -84,35 +159,49 @@ no position is specified, the default is @code{first}. The
84advice. 159advice.
85 160
86The optional @var{arglist} can be used to define the argument list for 161The optional @var{arglist} can be used to define the argument list for
87the sake of advice. This argument list should of course be compatible 162the sake of advice. This becomes the argument list of the combined
88with the argument list of the original function, otherwise functions 163definition that is generated in order to run the advice (@pxref{Combined
89that call the advised function with the original argument list in mind 164Definition}). Therefore, the advice expressions can use the argument
90will break. If more than one piece of advice specifies an argument 165variables in this list to access argument values.
166
167This argument list must be compatible with the argument list of the
168original function, so that it can handle the ways the function is
169actually called. If more than one piece of advice specifies an argument
91list, then the first one (the one with the smallest position) found in 170list, then the first one (the one with the smallest position) found in
92the list of all classes of advice will be used. 171the list of all classes of advice is used. Numbers outside the range
172are mapped to the beginning or the end, whichever is closer.
93 173
94@var{flags} is a list of symbols that specify further information about 174The remaining elements, @var{flags}, is a list of symbols that specify
95how to use this piece of advice. Here are the valid symbols and their 175further information about how to use this piece of advice. Here are the
96meanings: 176valid symbols and their meanings:
97 177
98@table @code 178@table @code
99@item activate 179@item activate
100Activate all the advice for @var{function} after making this definition. 180Activate the advice for @var{function} now. Changes in a function's
101This is ignored when @var{function} itself is not defined yet (which is 181advice always take effect the next time you activate advice for the
102known as @dfn{forward advice}). 182function; this flag says to do so, for @var{function}, immediately after
183defining this piece of advice.
184
185@cindex forward advice
186This flag has no effect if @var{function} itself is not defined yet (a
187situation known as @dfn{forward advice}), because it is impossible to
188activate an undefined function's advice. However, defining
189@var{function} will automatically activate its advice.
103 190
104@item protect 191@item protect
105Protect this piece of advice against non-local exits and errors in 192Protect this piece of advice against non-local exits and errors in
106preceding code and advice. 193preceding code and advice. Protecting advice makes it a cleanup in an
194@code{unwind-protect} form, so that it will execute even if the
195previous code gets an error or uses @code{throw}. @xref{Cleanups}.
107 196
108@item compile 197@item compile
109Says that the combined definition which implements advice should be 198Compile the combined definition that is used to run the advice. This
110byte-compiled. This flag is ignored unless @code{activate} is also 199flag is ignored unless @code{activate} is also specified.
111specified. 200@xref{Combined Definition}.
112 201
113@item disable 202@item disable
114Disable this piece of advice, so that it will not be used 203Initially disable this piece of advice, so that it will not be used
115unless subsequently explicitly enabled. 204unless subsequently explicitly enabled. @xref{Enabling Advice}.
116 205
117@item preactivate 206@item preactivate
118Activate advice for @var{function} when this @code{defadvice} is 207Activate advice for @var{function} when this @code{defadvice} is
@@ -124,10 +213,10 @@ This is useful only if this @code{defadvice} is byte-compiled.
124@end table 213@end table
125 214
126The optional @var{documentation-string} serves to document this piece of 215The optional @var{documentation-string} serves to document this piece of
127advice. If the @code{documentation} function gets the documentation 216advice. When advice is active for @var{function}, the documentation for
128for @var{function} when its advice is active, the result will combine 217@var{function} (as returned by @code{documentation}) combines the
129the documentation strings of all the advice with that of the original 218documentation strings of all the advice for @var{function} with the
130function. 219documentation string of its original function definition.
131 220
132The optional @var{interactive-form} form can be supplied to change the 221The optional @var{interactive-form} form can be supplied to change the
133interactive behavior of the original function. If more than one piece 222interactive behavior of the original function. If more than one piece
@@ -162,7 +251,9 @@ this form:
162@end example 251@end example
163 252
164Here @var{protected} and @var{enabled} are flags, and @var{definition} 253Here @var{protected} and @var{enabled} are flags, and @var{definition}
165is an expression that says what the advice should do. 254is the expression that says what the advice should do. If @var{enabled}
255is @code{nil}, this piece of advice is initially disabled
256(@pxref{Enabling Advice}).
166 257
167If @var{function} already has one or more pieces of advice in the 258If @var{function} already has one or more pieces of advice in the
168specified @var{class}, then @var{position} specifies where in the list 259specified @var{class}, then @var{position} specifies where in the list
@@ -194,11 +285,12 @@ redefining the function over and over as each advice is added. More
194importantly, it permits defining advice for a function before that 285importantly, it permits defining advice for a function before that
195function is actually defined. 286function is actually defined.
196 287
197When a function is first activated, its original definition is saved, 288When a function's advice is first activated, the function's original
198and all enabled pieces of advice for that function are combined with the 289definition is saved, and all enabled pieces of advice for that function
199original definition to make a new definition. This definition is 290are combined with the original definition to make a new definition.
200installed, and optionally byte-compiled as well, depending on conditions 291(Pieces of advice that are currently disabled are not used; see
201described below. 292@ref{Enabling Advice}.) This definition is installed, and optionally
293byte-compiled as well, depending on conditions described below.
202 294
203In all of the commands to activate advice, if @var{compile} is @code{t}, 295In all of the commands to activate advice, if @var{compile} is @code{t},
204the command also compiles the combined definition which implements the 296the command also compiles the combined definition which implements the
@@ -208,9 +300,9 @@ advice.
208This command activates the advice for @var{function}. 300This command activates the advice for @var{function}.
209@end deffn 301@end deffn
210 302
211To activate a function whose advice is already active is not a no-op. 303To activate advice for a function whose advice is already active is not
212It is a useful operation which puts into effect any changes in advice 304a no-op. It is a useful operation which puts into effect any changes in
213since the previous activation of the same function. 305advice since the previous activation of that function's advice.
214 306
215@deffn Command ad-deactivate function 307@deffn Command ad-deactivate function
216This command deactivates the advice for @var{function}. 308This command deactivates the advice for @var{function}.
@@ -239,15 +331,21 @@ function which has at least one piece of advice that matches
239 331
240@deffn Command ad-update-regexp regexp &optional compile 332@deffn Command ad-update-regexp regexp &optional compile
241This command activates pieces of advice whose names match @var{regexp}, 333This command activates pieces of advice whose names match @var{regexp},
242but only those that are already activated. 334but only those for functions whose advice is already activated.
243@end deffn
244 335
245@deffn Command ad-stop-advice 336Reactivating a function's advice is useful for putting into effect all
246Turn off automatic advice activation when a function is defined or 337the changes that have been made in its advice (including enabling and
247redefined. 338disabling specific pieces of advice; @pxref{Enabling Advice}) since the
339last time it was activated.
248@end deffn 340@end deffn
249 341
250@deffn Command ad-start-advice 342@deffn Command ad-start-advice
343Turn on automatic advice activation when a function is defined or
344redefined. If you turn on this mode, then advice really does
345take effect immediately when defined.
346@end deffn
347
348@deffn Command ad-stop-advice
251Turn off automatic advice activation when a function is defined or 349Turn off automatic advice activation when a function is defined or
252redefined. 350redefined.
253@end deffn 351@end deffn
@@ -275,8 +373,8 @@ the function @code{foo}:
275(ad-disable-advice 'foo 'before 'my-advice) 373(ad-disable-advice 'foo 'before 'my-advice)
276@end example 374@end example
277 375
278 This call by itself only changes the enable flag for this piece of 376This function by itself only changes the enable flag for a piece of
279advice. To make this change take effect in the advised definition, you 377advice. To make the change take effect in the advised definition, you
280must activate the advice for @code{foo} again: 378must activate the advice for @code{foo} again:
281 379
282@example 380@example
@@ -293,8 +391,10 @@ This command enables the piece of advice named @var{name} in class
293@var{class} on @var{function}. 391@var{class} on @var{function}.
294@end deffn 392@end deffn
295 393
296 You can also disable many pieces of advice at once using a regular 394 You can also disable many pieces of advice at once, for various
297expression. 395functions, using a regular expression. As always, the changes take real
396effect only when you next reactivate advice for the functions in
397question.
298 398
299@deffn Command ad-disable-regexp regexp 399@deffn Command ad-disable-regexp regexp
300This command disables all pieces of advice whose names match 400This command disables all pieces of advice whose names match
@@ -322,12 +422,12 @@ same function, and the function's own definition. If the
322@code{defadvice} is compiled, that compiles the combined definition 422@code{defadvice} is compiled, that compiles the combined definition
323also. 423also.
324 424
325 When the function is subsequently activated, if the enabled advice for 425 When the function's advice is subsequently activated, if the enabled
326the function matches what was used to make this combined 426advice for the function matches what was used to make this combined
327definition. then the existing combined definition is used, and there is 427definition, then the existing combined definition is used, thus avoiding
328no need to construct one. Thus, preactivation never causes wrong 428the need to construct one. Thus, preactivation never causes wrong
329results---but it may fail to do any good, if the enabled advice at the 429results---but it may fail to do any good, if the enabled advice at the
330time of activation doesn't match. 430time of activation doesn't match what was used for preactivation.
331 431
332 Here are some symptoms that can indicate that a preactivation did not 432 Here are some symptoms that can indicate that a preactivation did not
333work properly, because of a mismatch. 433work properly, because of a mismatch.
@@ -351,8 +451,8 @@ when you @emph{compile} the preactivated advice.
351There is no elegant way to find out why preactivated advice is not being 451There is no elegant way to find out why preactivated advice is not being
352used. What you can do is to trace the function 452used. What you can do is to trace the function
353@code{ad-cache-id-verification-code} (with the function 453@code{ad-cache-id-verification-code} (with the function
354@code{trace-function-background}) before the advised function is 454@code{trace-function-background}) before the advised function's advice
355activated. After activation, check the value returned by 455is activated. After activation, check the value returned by
356@code{ad-cache-id-verification-code} for that function: @code{verified} 456@code{ad-cache-id-verification-code} for that function: @code{verified}
357means that the preactivated advice was used, while other values give 457means that the preactivated advice was used, while other values give
358some information about why they were considered inappropriate. 458some information about why they were considered inappropriate.
@@ -376,6 +476,13 @@ disadvantage: it is not robust, because it hard-codes the argument names
376into the advice. If the definition of the original function changes, 476into the advice. If the definition of the original function changes,
377the advice might break. 477the advice might break.
378 478
479 Another method is to specify an argument list in the advice itself.
480This avoids the need to know the original function definition's argument
481names, but it has a limitation: all the advice on any particular
482function must use the same argument list, because the argument list
483actually used for all the advice comes from the first piece of advice
484for that function.
485
379 A more robust method is to use macros that are translated into the 486 A more robust method is to use macros that are translated into the
380proper access forms at activation time, i.e., when constructing the 487proper access forms at activation time, i.e., when constructing the
381advised definition. Access macros access actual arguments by position 488advised definition. Access macros access actual arguments by position
@@ -456,7 +563,8 @@ will be 3, and @var{r} will be @code{(2 1 0)} inside the body of
456 These argument constructs are not really implemented as Lisp macros. 563 These argument constructs are not really implemented as Lisp macros.
457Instead they are implemented specially by the advice mechanism. 564Instead they are implemented specially by the advice mechanism.
458 565
459@subsection Definition of Subr Argument Lists 566@node Subr Arguments
567@section Definition of Subr Argument Lists
460 568
461 When the advice facility constructs the combined definition, it needs 569 When the advice facility constructs the combined definition, it needs
462to know the argument list of the original function. This is not always 570to know the argument list of the original function. This is not always
diff --git a/lispref/anti.texi b/lispref/anti.texi
index df81194f29d..d93e99cf962 100644
--- a/lispref/anti.texi
+++ b/lispref/anti.texi
@@ -7,7 +7,7 @@
7 7
8For those users who live backwards in time, here is information about 8For those users who live backwards in time, here is information about
9downgrading to Emacs version 19.34. We hope you will enjoy the greater 9downgrading to Emacs version 19.34. We hope you will enjoy the greater
10simplicity that results from the absence of many Emacs 19 features. In 10simplicity that results from the absence of many Emacs 20 features. In
11the following section, we carry this information back as far as Emacs 11the following section, we carry this information back as far as Emacs
1219.29, for which the previous printed edition of this manual was made. 1219.29, for which the previous printed edition of this manual was made.
13 13
@@ -29,9 +29,10 @@ Within this range, there are no invalid character codes.
29@item 29@item
30The Custom facility has been replaced with a much simpler and more 30The Custom facility has been replaced with a much simpler and more
31general method of defining user option variables. Instead of 31general method of defining user option variables. Instead of
32@code{defcustom}, which requires you to specify each user option's 32@code{defcustom}, which requires you to specify each user option's data
33data type and classify them into groups, all you have to do is write 33type and classify options into groups, all you have to do is write a
34a @code{defvar} and start the documentation string with @samp{*}. 34@code{defvar}. You should still start the documentation string with
35@samp{*}, though.
35@end itemize 36@end itemize
36 37
37Here are changes in the Lisp language itself: 38Here are changes in the Lisp language itself:
@@ -138,7 +139,7 @@ directory name from the beginning of the file name---just like
138We have got rid of the function @code{access-file}. 139We have got rid of the function @code{access-file}.
139 140
140@item 141@item
141Most of the minibuffer input functions, no longer take a default value as 142Most of the minibuffer input functions no longer take a default value as
142an argument. Also, they do not discard text properties from the result. 143an argument. Also, they do not discard text properties from the result.
143This means that if you insert text with text properties into the minibuffer, 144This means that if you insert text with text properties into the minibuffer,
144the minibuffer value really will contain text properties. 145the minibuffer value really will contain text properties.
diff --git a/lispref/backups.texi b/lispref/backups.texi
index 9707ade9eef..3cdd88d5c08 100644
--- a/lispref/backups.texi
+++ b/lispref/backups.texi
@@ -289,7 +289,8 @@ This function returns a string that is the name to use for a
289non-numbered backup file for file @var{filename}. On Unix, this is just 289non-numbered backup file for file @var{filename}. On Unix, this is just
290@var{filename} with a tilde appended. 290@var{filename} with a tilde appended.
291 291
292The standard definition of this function is as follows: 292The standard definition of this function, on most operating systems, is
293as follows:
293 294
294@smallexample 295@smallexample
295@group 296@group
@@ -306,7 +307,9 @@ to prepend a @samp{.} in addition to appending a tilde:
306@smallexample 307@smallexample
307@group 308@group
308(defun make-backup-file-name (filename) 309(defun make-backup-file-name (filename)
309 (concat "." filename "~")) 310 (expand-file-name
311 (concat "." (file-name-nondirectory filename) "~")
312 (file-name-directory filename)))
310@end group 313@end group
311 314
312@group 315@group
@@ -314,6 +317,11 @@ to prepend a @samp{.} in addition to appending a tilde:
314 @result{} ".backups.texi~" 317 @result{} ".backups.texi~"
315@end group 318@end group
316@end smallexample 319@end smallexample
320
321Some parts of Emacs, including some Dired commands, assume that backup
322file names end with @samp{~}. If you do not follow that convention, it
323will not cause serious problems, but these commands may give
324less-than-desirable results.
317@end defun 325@end defun
318 326
319@defun find-backup-file-name filename 327@defun find-backup-file-name filename
diff --git a/lispref/buffers.texi b/lispref/buffers.texi
index 600ff3e54b5..c54f1e6b9b0 100644
--- a/lispref/buffers.texi
+++ b/lispref/buffers.texi
@@ -47,9 +47,9 @@ not be displayed in any windows.
47 47
48 Buffers in Emacs editing are objects that have distinct names and hold 48 Buffers in Emacs editing are objects that have distinct names and hold
49text that can be edited. Buffers appear to Lisp programs as a special 49text that can be edited. Buffers appear to Lisp programs as a special
50data type. You can think of the contents of a buffer as an extendable 50data type. You can think of the contents of a buffer as a string that
51string; insertions and deletions may occur in any part of the buffer. 51you can extend; insertions and deletions may occur in any part of the
52@xref{Text}. 52buffer. @xref{Text}.
53 53
54 A Lisp buffer object contains numerous pieces of information. Some of 54 A Lisp buffer object contains numerous pieces of information. Some of
55this information is directly accessible to the programmer through 55this information is directly accessible to the programmer through
@@ -112,7 +112,7 @@ the subroutine does not change which buffer is current (unless, of
112course, that is the subroutine's purpose). Therefore, you should 112course, that is the subroutine's purpose). Therefore, you should
113normally use @code{set-buffer} within a @code{save-current-buffer} or 113normally use @code{set-buffer} within a @code{save-current-buffer} or
114@code{save-excursion} (@pxref{Excursions}) form that will restore the 114@code{save-excursion} (@pxref{Excursions}) form that will restore the
115current buffer when your function is done . Here is an example, the 115current buffer when your function is done. Here is an example, the
116code for the command @code{append-to-buffer} (with the documentation 116code for the command @code{append-to-buffer} (with the documentation
117string abridged): 117string abridged):
118 118
@@ -201,8 +201,8 @@ An error is signaled if @var{buffer-or-name} does not identify an
201existing buffer. 201existing buffer.
202@end defun 202@end defun
203 203
204@defspec save-current-buffer body...
204@tindex save-current-buffer 205@tindex save-current-buffer
205@defmac save-current-buffer body...
206The @code{save-current-buffer} macro saves the identity of the current 206The @code{save-current-buffer} macro saves the identity of the current
207buffer, evaluates the @var{body} forms, and finally restores that buffer 207buffer, evaluates the @var{body} forms, and finally restores that buffer
208as current. The return value is the value of the last form in 208as current. The return value is the value of the last form in
@@ -215,8 +215,8 @@ of course. Instead, whichever buffer was current just before exit
215remains current. 215remains current.
216@end defmac 216@end defmac
217 217
218@tindex with-current-buffer
219@defmac with-current-buffer buffer body... 218@defmac with-current-buffer buffer body...
219@tindex with-current-buffer
220The @code{with-current-buffer} macro saves the identity of the current 220The @code{with-current-buffer} macro saves the identity of the current
221buffer, makes @var{buffer} current, evaluates the @var{body} forms, and 221buffer, makes @var{buffer} current, evaluates the @var{body} forms, and
222finally restores the buffer. The return value is the value of the last 222finally restores the buffer. The return value is the value of the last
@@ -224,8 +224,8 @@ form in @var{body}. The current buffer is restored even in case of an
224abnormal exit via @code{throw} or error (@pxref{Nonlocal Exits}). 224abnormal exit via @code{throw} or error (@pxref{Nonlocal Exits}).
225@end defmac 225@end defmac
226 226
227@tindex with-temp-buffer
228@defmac with-temp-buffer body... 227@defmac with-temp-buffer body...
228@tindex with-temp-buffer
229The @code{with-temp-buffer} macro evaluates the @var{body} forms 229The @code{with-temp-buffer} macro evaluates the @var{body} forms
230with a temporary buffer as the current buffer. It saves the identity of 230with a temporary buffer as the current buffer. It saves the identity of
231the current buffer, creates a temporary buffer and makes it current, 231the current buffer, creates a temporary buffer and makes it current,
diff --git a/lispref/commands.texi b/lispref/commands.texi
index 29e43d4dfc7..49c9d3c16e3 100644
--- a/lispref/commands.texi
+++ b/lispref/commands.texi
@@ -332,6 +332,10 @@ Prompt.
332@item F 332@item F
333A file name. The file need not exist. Completion, Default, Prompt. 333A file name. The file need not exist. Completion, Default, Prompt.
334 334
335@item i
336An irrelevant argument. This code always supplies @code{nil} as
337the argument's value. No I/O.
338
335@item k 339@item k
336A key sequence (@pxref{Keymap Terminology}). This keeps reading events 340A key sequence (@pxref{Keymap Terminology}). This keeps reading events
337until a command (or undefined command) is found in the current key 341until a command (or undefined command) is found in the current key
@@ -408,6 +412,16 @@ Minibuffer}. Prompt.
408@cindex evaluated expression argument 412@cindex evaluated expression argument
409A Lisp form is read as with @kbd{x}, but then evaluated so that its 413A Lisp form is read as with @kbd{x}, but then evaluated so that its
410value becomes the argument for the command. Prompt. 414value becomes the argument for the command. Prompt.
415
416@item z
417A coding system name (a symbol). If the user enters null input, the
418argument value is @code{nil}. @xref{Coding Systems}. Completion,
419Existing, Prompt.
420
421@item Z
422A coding system name (a symbol)---but only if this command has a prefix
423argument. With no prefix argument, @samp{Z} provides @code{nil} as the
424argument value. Completion, Existing, Prompt.
411@end table 425@end table
412 426
413@node Interactive Examples 427@node Interactive Examples
@@ -758,8 +772,15 @@ are characters or symbols; mouse events are always lists. This section
758describes the representation and meaning of input events in detail. 772describes the representation and meaning of input events in detail.
759 773
760@defun eventp object 774@defun eventp object
761This function returns non-@code{nil} if @var{object} is an input event. 775This function returns non-@code{nil} if @var{object} is an input event
762A symbol 776or event type.
777
778Note that any symbol might be used as an event or an event type.
779@code{eventp} cannot distinguish whether a symbol is intended by Lisp
780code to be used as an event. Instead, it distinguishes whether the
781symbol has actually been used in an event that has been read as input in
782the current Emacs session. If a symbol has not yet been so used,
783@code{eventp} returns @code{nil}.
763@end defun 784@end defun
764 785
765@menu 786@menu
@@ -1314,6 +1335,36 @@ want to.
1314This kind of event indicates that the user deiconified @var{frame} using 1335This kind of event indicates that the user deiconified @var{frame} using
1315the window manager. Its standard definition is @code{ignore}; since the 1336the window manager. Its standard definition is @code{ignore}; since the
1316frame has already been made visible, Emacs has no work to do. 1337frame has already been made visible, Emacs has no work to do.
1338
1339@cindex @code{mouse-wheel} event
1340@item (mouse-wheel @var{position} @var{delta})
1341This kind of event is generated by moving a wheel on a mouse (such as
1342the MS Intellimouse). Its effect is typically a kind of scroll or zoom.
1343
1344The element @var{delta} describes the amount and direction of the wheel
1345rotation. Its absolute value is the number of increments by which the
1346wheel was rotated. A negative @var{delta} indicates that the wheel was
1347rotated backwards, towards the user, and a positive @var{delta}
1348indicates that the wheel was rotated forward, away from the user.
1349
1350The element @var{position} is a list describing the position of the
1351event, in the same format as used in a mouse-click event.
1352
1353This kind of event is generated only on some kinds of systems.
1354
1355@cindex @code{drag-n-drop} event
1356@item (drag-n-drop @var{position} @var{files})
1357This kind of event is generated when a group of files is
1358selected in an application outside of Emacs, and then dragged and
1359dropped onto an Emacs frame.
1360
1361The element @var{position} is a list describing the position of the
1362event, in the same format as used in a mouse-click event, and
1363@var{files} is the list of file names that were dragged and dropped.
1364The usual way to handle this event is by visiting these files.
1365
1366This kind of event is generated, at present, only on some kinds of
1367systems.
1317@end table 1368@end table
1318 1369
1319 If one of these events arrives in the middle of a key sequence---that 1370 If one of these events arrives in the middle of a key sequence---that
@@ -1559,7 +1610,7 @@ by not storing keyboard events in strings. Here is how to do that:
1559@itemize @bullet 1610@itemize @bullet
1560@item 1611@item
1561Use vectors instead of strings for key sequences, when you plan to use 1612Use vectors instead of strings for key sequences, when you plan to use
1562them for anything other than as arguments @code{lookup-key} and 1613them for anything other than as arguments to @code{lookup-key} and
1563@code{define-key}. For example, you can use 1614@code{define-key}. For example, you can use
1564@code{read-key-sequence-vector} instead of @code{read-key-sequence}, and 1615@code{read-key-sequence-vector} instead of @code{read-key-sequence}, and
1565@code{this-command-keys-vector} instead of @code{this-command-keys}. 1616@code{this-command-keys-vector} instead of @code{this-command-keys}.
@@ -1776,8 +1827,8 @@ this Emacs session. This includes key sequences read from the terminal
1776and key sequences read from keyboard macros being executed. 1827and key sequences read from keyboard macros being executed.
1777@end defvar 1828@end defvar
1778 1829
1779@tindex num-nonmacro-input-events
1780@defvar num-nonmacro-input-events 1830@defvar num-nonmacro-input-events
1831@tindex num-nonmacro-input-events
1781This variable holds the total number of input events received so far 1832This variable holds the total number of input events received so far
1782from the terminal---not counting those generated by keyboard macros. 1833from the terminal---not counting those generated by keyboard macros.
1783@end defvar 1834@end defvar
@@ -1803,6 +1854,12 @@ If @code{cursor-in-echo-area} is non-@code{nil}, then @code{read-event}
1803moves the cursor temporarily to the echo area, to the end of any message 1854moves the cursor temporarily to the echo area, to the end of any message
1804displayed there. Otherwise @code{read-event} does not move the cursor. 1855displayed there. Otherwise @code{read-event} does not move the cursor.
1805 1856
1857If @code{read-event} gets an event is defined as a help character, in
1858some cases @code{read-event} processes the event directly without
1859returning. @xref{Help Functions}. Certain other events, called
1860@dfn{special events}, are also processed directly within
1861@code{read-event} (@pxref{Special Events}).
1862
1806Here is what happens if you call @code{read-event} and then press the 1863Here is what happens if you call @code{read-event} and then press the
1807right-arrow function key: 1864right-arrow function key:
1808 1865
@@ -2506,9 +2563,10 @@ the command to be considered complex.
2506@defvar command-history 2563@defvar command-history
2507This variable's value is a list of recent complex commands, each 2564This variable's value is a list of recent complex commands, each
2508represented as a form to evaluate. It continues to accumulate all 2565represented as a form to evaluate. It continues to accumulate all
2509complex commands for the duration of the editing session, but all but 2566complex commands for the duration of the editing session, but when it
2510the first (most recent) thirty elements are deleted when a garbage 2567reaches the maximum size (specified by the variable
2511collection takes place (@pxref{Garbage Collection}). 2568@code{history-length}), the oldest elements are deleted as new ones are
2569added.
2512 2570
2513@example 2571@example
2514@group 2572@group
diff --git a/lispref/compile.texi b/lispref/compile.texi
index 007a4a6b094..001466d500d 100644
--- a/lispref/compile.texi
+++ b/lispref/compile.texi
@@ -3,7 +3,7 @@
3@c Copyright (C) 1990, 1991, 1992, 1993, 1994 Free Software Foundation, Inc. 3@c Copyright (C) 1990, 1991, 1992, 1993, 1994 Free Software Foundation, Inc.
4@c See the file elisp.texi for copying conditions. 4@c See the file elisp.texi for copying conditions.
5@setfilename ../info/compile 5@setfilename ../info/compile
6@node Byte Compilation, Advising, Loading, Top 6@node Byte Compilation, Advising Functions, Loading, Top
7@chapter Byte Compilation 7@chapter Byte Compilation
8@cindex byte-code 8@cindex byte-code
9@cindex compilation 9@cindex compilation
@@ -20,6 +20,12 @@ hardware (as true compiled code is), byte-code is completely
20transportable from machine to machine without recompilation. It is not, 20transportable from machine to machine without recompilation. It is not,
21however, as fast as true compiled code. 21however, as fast as true compiled code.
22 22
23 Compiling a Lisp file with the Emacs byte compiler always reads the
24file as multibyte text, even if Emacs was started with @samp{--unibyte},
25unless the file specifies otherwise. This is so that compilation gives
26results compatible with running the same file without compilation.
27@xref{Loading Non-ASCII}.
28
23 In general, any version of Emacs can run byte-compiled code produced 29 In general, any version of Emacs can run byte-compiled code produced
24by recent earlier versions of Emacs, but the reverse is not true. A 30by recent earlier versions of Emacs, but the reverse is not true. A
25major incompatible change was introduced in Emacs version 19.29, and 31major incompatible change was introduced in Emacs version 19.29, and
@@ -164,9 +170,10 @@ function.
164@end deffn 170@end deffn
165 171
166@deffn Command byte-compile-file filename 172@deffn Command byte-compile-file filename
167This function compiles a file of Lisp code named @var{filename} into 173This function compiles a file of Lisp code named @var{filename} into a
168a file of byte-code. The output file's name is made by appending 174file of byte-code. The output file's name is made by changing the
169@samp{c} to the end of @var{filename}. 175@samp{.el} suffix into @samp{.elc}; if @var{filename} does not end in
176@samp{.el}, it adds @samp{.elc} to the end of @var{filename}.
170 177
171Compilation works by reading the input file one form at a time. If it 178Compilation works by reading the input file one form at a time. If it
172is a definition of a function or macro, the compiled function or macro 179is a definition of a function or macro, the compiled function or macro
diff --git a/lispref/control.texi b/lispref/control.texi
index 1fbb668da0f..a824e79f6f2 100644
--- a/lispref/control.texi
+++ b/lispref/control.texi
@@ -172,8 +172,8 @@ never evaluated---it is ignored. Thus, in the example below,
172@end example 172@end example
173@end defspec 173@end defspec
174 174
175@tindex when
176@defmac when condition then-forms@dots{} 175@defmac when condition then-forms@dots{}
176@tindex when
177This is a variant of @code{if} where there are no @var{else-forms}, 177This is a variant of @code{if} where there are no @var{else-forms},
178and possibly several @var{then-forms}. In particular, 178and possibly several @var{then-forms}. In particular,
179 179
@@ -189,8 +189,8 @@ is entirely equivalent to
189@end example 189@end example
190@end defmac 190@end defmac
191 191
192@tindex condition
193@defmac unless condition forms@dots{} 192@defmac unless condition forms@dots{}
193@tindex condition
194This is a variant of @code{if} where there is no @var{then-form}: 194This is a variant of @code{if} where there is no @var{then-form}:
195 195
196@example 196@example
@@ -550,10 +550,10 @@ have several ways of transferring control nonsequentially: @code{return},
550 550
551@defspec catch tag body@dots{} 551@defspec catch tag body@dots{}
552@cindex tag on run time stack 552@cindex tag on run time stack
553@code{catch} establishes a return point for the @code{throw} function. The 553@code{catch} establishes a return point for the @code{throw} function.
554return point is distinguished from other such return points by @var{tag}, 554The return point is distinguished from other such return points by
555which may be any Lisp object. The argument @var{tag} is evaluated normally 555@var{tag}, which may be any Lisp object except @code{nil}. The argument
556before the return point is established. 556@var{tag} is evaluated normally before the return point is established.
557 557
558With the return point in effect, @code{catch} evaluates the forms of the 558With the return point in effect, @code{catch} evaluates the forms of the
559@var{body} in textual order. If the forms execute normally, without 559@var{body} in textual order. If the forms execute normally, without
diff --git a/lispref/customize.texi b/lispref/customize.texi
index 2b61848d643..dffd3de49a3 100644
--- a/lispref/customize.texi
+++ b/lispref/customize.texi
@@ -31,6 +31,10 @@ The keyword @code{:tag} is an exception because any given item can only
31display one name. 31display one name.
32 32
33@table @code 33@table @code
34@item :tag @var{name}
35Use @var{name}, a string, instead of the item's name, to label the item
36in customization menus and buffers.
37
34@item :group @var{group} 38@item :group @var{group}
35Put this customization item in group @var{group}. When you use 39Put this customization item in group @var{group}. When you use
36@code{:group} in a @code{defgroup}, it makes the new group a subgroup of 40@code{:group} in a @code{defgroup}, it makes the new group a subgroup of
@@ -48,10 +52,6 @@ other documentation.
48There are three alternatives you can use for @var{link-data}: 52There are three alternatives you can use for @var{link-data}:
49 53
50@table @code 54@table @code
51@item :tag @var{name}
52Use @var{name}, a string, instead of the item's name, to label the item
53in customization menus and buffers.
54
55@item (custom-manual @var{info-node}) 55@item (custom-manual @var{info-node})
56Link to an Info node; @var{info-node} is a string which specifies the 56Link to an Info node; @var{info-node} is a string which specifies the
57node name, as in @code{"(emacs)Top"}. The link appears as 57node name, as in @code{"(emacs)Top"}. The link appears as
@@ -109,23 +109,22 @@ keyword.
109 109
110 The way to declare new customization groups is with @code{defgroup}. 110 The way to declare new customization groups is with @code{defgroup}.
111 111
112@tindex defgroup
113@defmac defgroup group members doc [keyword value]... 112@defmac defgroup group members doc [keyword value]...
113@tindex defgroup
114Declare @var{group} as a customization group containing @var{members}. 114Declare @var{group} as a customization group containing @var{members}.
115Do not quote the symbol @var{group}. The argument @var{doc} specifies 115Do not quote the symbol @var{group}. The argument @var{doc} specifies
116the documentation string for the group. 116the documentation string for the group.
117 117
118The arguments @var{members} can be an alist whose elements specify 118The argument @var{members} is a list specifying an initial set of
119customization items to be members of the group; however, normally 119customization items to be members of the group. However, most often
120@var{members} is @code{nil}, and you specify the group's members by 120@var{members} is @code{nil}, and you specify the group's members by
121using the @code{:group} keyword when defining those members. 121using the @code{:group} keyword when defining those members.
122 122
123@ignore 123If you want to specify group members through @var{members}, each element
124@code{(@var{name} @var{widget})}. Here @var{name} is a symbol, and 124should have the form @code{(@var{name} @var{widget})}. Here @var{name}
125@var{widget} is a widget for editing that symbol. Useful widgets are 125is a symbol, and @var{widget} is a widget type for editing that symbol.
126@code{custom-variable} for editing variables, @code{custom-face} for 126Useful widgets are @code{custom-variable} for a variable,
127editing faces, and @code{custom-group} for editing groups. 127@code{custom-face} for a face, and @code{custom-group} for a group.
128@end ignore
129 128
130In addition to the common keywords (@pxref{Common Keywords}), you can 129In addition to the common keywords (@pxref{Common Keywords}), you can
131use this keyword in @code{defgroup}: 130use this keyword in @code{defgroup}:
@@ -162,18 +161,18 @@ turn this feature back on, if someone would like to do the work.
162 161
163 Use @code{defcustom} to declare user-editable variables. 162 Use @code{defcustom} to declare user-editable variables.
164 163
165@tindex defcustom
166@defmac defcustom option default doc [keyword value]... 164@defmac defcustom option default doc [keyword value]...
165@tindex defcustom
167Declare @var{option} as a customizable user option variable. Do not 166Declare @var{option} as a customizable user option variable. Do not
168quote @var{option}. The argument @var{doc} specifies the documentation 167quote @var{option}. The argument @var{doc} specifies the documentation
169string for the variable. 168string for the variable.
170 169
171If @var{option} is void, @code{defcustom} initializes it to 170If @var{option} is void, @code{defcustom} initializes it to
172@var{default}. @var{default} should be an expression to compute the 171@var{default}. @var{default} should be an expression to compute the
173value; be careful in writing it, because it can be be evaluated on more 172value; be careful in writing it, because it can be evaluated on more
174than one occasion. 173than one occasion.
175 174
176The following additional keywords are defined: 175The following additional keywords are accepted:
177 176
178@table @code 177@table @code
179@item :type @var{type} 178@item :type @var{type}
@@ -191,8 +190,9 @@ elements of the hook value. The user is not restricted to using only
191these functions, but they are offered as convenient alternatives. 190these functions, but they are offered as convenient alternatives.
192 191
193@item :version @var{version} 192@item :version @var{version}
194This option specifies that the variable's default value was changed in 193This option specifies that the variable was first introduced, or its
195Emacs version @var{version}. For example, 194default value was changed, in Emacs version @var{version}. The value
195@var{version} must be a string. For example,
196 196
197@example 197@example
198(defcustom foo-max 34 198(defcustom foo-max 34
@@ -260,7 +260,7 @@ Keywords}. Here is an example, from the library @file{paren.el}:
260(defcustom show-paren-mode nil 260(defcustom show-paren-mode nil
261 "Toggle Show Paren mode@enddots{}" 261 "Toggle Show Paren mode@enddots{}"
262 :set (lambda (symbol value) 262 :set (lambda (symbol value)
263 (show-paren-mode (or value 0))) 263 (show-paren-mode (or value 0)))
264 :initialize 'custom-initialize-default 264 :initialize 'custom-initialize-default
265 :type 'boolean 265 :type 'boolean
266 :group 'paren-showing 266 :group 'paren-showing
@@ -369,6 +369,13 @@ completion with @kbd{M-@key{TAB}}.
369The value must be a directory name, and you can do completion with 369The value must be a directory name, and you can do completion with
370@kbd{M-@key{TAB}}. 370@kbd{M-@key{TAB}}.
371 371
372@item hook
373The value must be a list of functions (or a single function, but that is
374obsolete usage). This customization type is used for hook variables.
375You can use the @code{:option} in the @code{defcustom} for a hook
376variable to specify functions recommended for use in the hook;
377see @ref{Variable Definitions}.
378
372@item symbol 379@item symbol
373The value must be a symbol. It appears in the customization buffer as 380The value must be a symbol. It appears in the customization buffer as
374the name of the symbol. 381the name of the symbol.
@@ -381,6 +388,10 @@ it is a function name, you can do completion with @kbd{M-@key{TAB}}.
381The value must be a variable name, and you can do completion with 388The value must be a variable name, and you can do completion with
382@kbd{M-@key{TAB}}. 389@kbd{M-@key{TAB}}.
383 390
391@item face
392The value must be a symbol which is a face name, and you can do
393completion with @kbd{M-@key{TAB}}.
394
384@item boolean 395@item boolean
385The value is boolean---either @code{nil} or @code{t}. Note that by 396The value is boolean---either @code{nil} or @code{t}. Note that by
386using @code{choice} and @code{const} together (see the next section), 397using @code{choice} and @code{const} together (see the next section),
@@ -399,24 +410,26 @@ doing that:
399@table @code 410@table @code
400@item (restricted-sexp :match-alternatives @var{criteria}) 411@item (restricted-sexp :match-alternatives @var{criteria})
401The value may be any Lisp object that satisfies one of @var{criteria}. 412The value may be any Lisp object that satisfies one of @var{criteria}.
402@var{criteria} should be a list, and each elements should be 413@var{criteria} should be a list, and each element should be
403one of these possibilities: 414one of these possibilities:
404 415
405@itemize @bullet 416@itemize @bullet
406@item 417@item
407A predicate---that is, a function of one argument that returns non-@code{nil} 418A predicate---that is, a function of one argument that has no side
408if the argument fits a certain type. This means that objects of that type 419effects, and returns either @code{nil} or non-@code{nil} according to
409are acceptable. 420the argument. Using a predicate in the list says that objects for which
421the predicate returns non-@code{nil} are acceptable.
410 422
411@item 423@item
412A quoted constant---that is, @code{'@var{object}}. This means that 424A quoted constant---that is, @code{'@var{object}}. This sort of element
413@var{object} itself is an acceptable value. 425in the list says that @var{object} itself is an acceptable value.
414@end itemize 426@end itemize
415 427
416For example, 428For example,
417 429
418@example 430@example
419(restricted-sexp :match-alternatives (integerp 't 'nil)) 431(restricted-sexp :match-alternatives
432 (integerp 't 'nil))
420@end example 433@end example
421 434
422@noindent 435@noindent
@@ -427,7 +440,7 @@ syntax, and the user edits them textually.
427 440
428@item (cons @var{car-type} @var{cdr-type}) 441@item (cons @var{car-type} @var{cdr-type})
429The value must be a cons cell, its @sc{car} must fit @var{car-type}, and 442The value must be a cons cell, its @sc{car} must fit @var{car-type}, and
430its @sc{cdr} must fit @var{cdr-type}. For example, @code{(const string 443its @sc{cdr} must fit @var{cdr-type}. For example, @code{(cons string
431symbol)} is a customization type which matches values such as 444symbol)} is a customization type which matches values such as
432@code{("foo" . foo)}. 445@code{("foo" . foo)}.
433 446
@@ -444,7 +457,7 @@ For example, @code{(list integer string function)} describes a list of
444three elements; the first element must be an integer, the second a 457three elements; the first element must be an integer, the second a
445string, and the third a function. 458string, and the third a function.
446 459
447In the customization buffer, the each element is displayed and edited 460In the customization buffer, each element is displayed and edited
448separately, according to the type specified for it. 461separately, according to the type specified for it.
449 462
450@item (vector @var{element-types}@dots{}) 463@item (vector @var{element-types}@dots{})
@@ -466,10 +479,10 @@ including the @code{:tag} keyword in the alternatives. For example, if
466an integer stands for a number of spaces, while a string is text to use 479an integer stands for a number of spaces, while a string is text to use
467verbatim, you might write the customization type this way, 480verbatim, you might write the customization type this way,
468 481
469@smallexample 482@example
470(choice (integer :tag "Number of spaces") 483(choice (integer :tag "Number of spaces")
471 (string :tag "Literal text")) 484 (string :tag "Literal text"))
472@end smallexample 485@end example
473 486
474@noindent 487@noindent
475so that the menu offers @samp{Number of spaces} and @samp{Literal Text}. 488so that the menu offers @samp{Number of spaces} and @samp{Literal Text}.
@@ -488,11 +501,11 @@ The main use of @code{const} is inside of @code{choice}. For example,
488@code{:tag} is often used with @code{const}, inside of @code{choice}. 501@code{:tag} is often used with @code{const}, inside of @code{choice}.
489For example, 502For example,
490 503
491@smallexample 504@example
492(choice (const :tag "Yes" t) 505(choice (const :tag "Yes" t)
493 (const :tag "No" nil) 506 (const :tag "No" nil)
494 (const :tag "Ask" foo)) 507 (const :tag "Ask" foo))
495@end smallexample 508@end example
496 509
497@item (function-item @var{function}) 510@item (function-item @var{function})
498Like @code{const}, but used for values which are functions. This 511Like @code{const}, but used for values which are functions. This
@@ -733,7 +746,7 @@ in the buffer with a positive tabbing order, or @code{nil}
733@end enumerate 746@end enumerate
734 747
735@item :parent 748@item :parent
736The parent of a nested widget (e.g. a @code{menu-choice} item or an 749The parent of a nested widget (e.g., a @code{menu-choice} item or an
737element of a @code{editable-list} widget). 750element of a @code{editable-list} widget).
738 751
739@item :sibling-args 752@item :sibling-args
diff --git a/lispref/debugging.texi b/lispref/debugging.texi
index 9c7a4fd7be7..8e5ed2834a5 100644
--- a/lispref/debugging.texi
+++ b/lispref/debugging.texi
@@ -3,7 +3,7 @@
3@c Copyright (C) 1990, 1991, 1992, 1993, 1994, 1998 Free Software Foundation, Inc. 3@c Copyright (C) 1990, 1991, 1992, 1993, 1994, 1998 Free Software Foundation, Inc.
4@c See the file elisp.texi for copying conditions. 4@c See the file elisp.texi for copying conditions.
5@setfilename ../info/debugging 5@setfilename ../info/debugging
6@node Debugging, Read and Print, Advising, Top 6@node Debugging, Read and Print, Advising Functions, Top
7@chapter Debugging Lisp Programs 7@chapter Debugging Lisp Programs
8 8
9 There are three ways to investigate a problem in an Emacs Lisp program, 9 There are three ways to investigate a problem in an Emacs Lisp program,
@@ -12,8 +12,9 @@ depending on what you are doing with the program when the problem appears.
12@itemize @bullet 12@itemize @bullet
13@item 13@item
14If the problem occurs when you run the program, you can use a Lisp 14If the problem occurs when you run the program, you can use a Lisp
15debugger (either the default debugger or Edebug) to investigate what is 15debugger to investigate what is happening during execution. In addition
16happening during execution. 16to the ordinary debugger, Emacs comes with a source level debugger,
17Edebug. This chapter describes both of them.
17 18
18@item 19@item
19If the problem is syntactic, so that Lisp cannot even read the program, 20If the problem is syntactic, so that Lisp cannot even read the program,
@@ -26,9 +27,9 @@ compiler, you need to know how to examine the compiler's input buffer.
26 27
27@menu 28@menu
28* Debugger:: How the Emacs Lisp debugger is implemented. 29* Debugger:: How the Emacs Lisp debugger is implemented.
30* Edebug:: A source-level Emacs Lisp debugger.
29* Syntax Errors:: How to find syntax errors. 31* Syntax Errors:: How to find syntax errors.
30* Compilation Errors:: How to find errors that show up in byte compilation. 32* Compilation Errors:: How to find errors that show up in byte compilation.
31* Edebug:: A source-level Emacs Lisp debugger.
32@end menu 33@end menu
33 34
34 Another useful debugging tool is the dribble file. When a dribble 35 Another useful debugging tool is the dribble file. When a dribble
@@ -45,13 +46,13 @@ Afterward, you can examine the file to find out what input was used.
45@cindex Lisp debugger 46@cindex Lisp debugger
46@cindex break 47@cindex break
47 48
48 The @dfn{Lisp debugger} provides the ability to suspend evaluation of 49 The ordinary @dfn{Lisp debugger} provides the ability to suspend
49a form. While evaluation is suspended (a state that is commonly known 50evaluation of a form. While evaluation is suspended (a state that is
50as a @dfn{break}), you may examine the run time stack, examine the 51commonly known as a @dfn{break}), you may examine the run time stack,
51values of local or global variables, or change those values. Since a 52examine the values of local or global variables, or change those values.
52break is a recursive edit, all the usual editing facilities of Emacs are 53Since a break is a recursive edit, all the usual editing facilities of
53available; you can even run programs that will enter the debugger 54Emacs are available; you can even run programs that will enter the
54recursively. @xref{Recursive Editing}. 55debugger recursively. @xref{Recursive Editing}.
55 56
56@menu 57@menu
57* Error Debugging:: Entering the debugger when an error happens. 58* Error Debugging:: Entering the debugger when an error happens.
@@ -74,25 +75,28 @@ happens. This allows you to investigate the immediate causes of the
74error. 75error.
75 76
76 However, entry to the debugger is not a normal consequence of an 77 However, entry to the debugger is not a normal consequence of an
77error. Many commands frequently get Lisp errors when invoked in 78error. Many commands frequently cause Lisp errors when invoked
78inappropriate contexts (such as @kbd{C-f} at the end of the buffer) and 79inappropriately (such as @kbd{C-f} at the end of the buffer), and during
79during ordinary editing it would be very unpleasant to enter the 80ordinary editing it would be very inconvenient to enter the debugger
80debugger each time this happens. If you want errors to enter the 81each time this happens. So if you want errors to enter the debugger, set
81debugger, set the variable @code{debug-on-error} to non-@code{nil}. 82the variable @code{debug-on-error} to non-@code{nil}. (The command
83@code{toggle-debug-on-error} provides an easy way to do this.)
82 84
83@defopt debug-on-error 85@defopt debug-on-error
84This variable determines whether the debugger is called when an error is 86This variable determines whether the debugger is called when an error is
85signaled and not handled. If @code{debug-on-error} is @code{t}, all 87signaled and not handled. If @code{debug-on-error} is @code{t}, all
86errors call the debugger. If it is @code{nil}, none call the debugger. 88kinds of errors call the debugger (except those listed in
89@code{debug-ignored-errors}). If it is @code{nil}, none call the
90debugger.
87 91
88The value can also be a list of error conditions that should call the 92The value can also be a list of error conditions that should call the
89debugger. For example, if you set it to the list 93debugger. For example, if you set it to the list
90@code{(void-variable)}, then only errors about a variable that has no 94@code{(void-variable)}, then only errors about a variable that has no
91value invoke the debugger. 95value invoke the debugger.
92 96
93When this variable is non-@code{nil}, Emacs does not catch errors that 97When this variable is non-@code{nil}, Emacs does not create an error
94happen in process filter functions and sentinels. Therefore, these 98handler around process filter functions and sentinels. Therefore,
95errors also can invoke the debugger. @xref{Processes}. 99errors in these functions also invoke the debugger. @xref{Processes}.
96@end defopt 100@end defopt
97 101
98@defopt debug-ignored-errors 102@defopt debug-ignored-errors
@@ -117,10 +121,10 @@ debugger, even if @code{debug-on-error} is non-@code{nil}. In other
117words, @code{condition-case} gets a chance to handle the error before 121words, @code{condition-case} gets a chance to handle the error before
118the debugger gets a chance. 122the debugger gets a chance.
119 123
120If you set @code{debug-on-signal} non-@code{nil}, then the debugger gets 124If you set @code{debug-on-signal} to a non-@code{nil} value, then the
121first chance at every error; an error will invoke the debugger 125debugger gets the first chance at every error; an error will invoke the
122regardless of any @code{condition-case}, if the fits the criterion 126debugger regardless of any @code{condition-case}, if it fits the
123specified by the values of @code{debug-on-error} and 127criterion specified by the values of @code{debug-on-error} and
124@code{debug-ignored-errors}. 128@code{debug-ignored-errors}.
125 129
126@strong{Warning:} This variable is strong medicine! Various parts of 130@strong{Warning:} This variable is strong medicine! Various parts of
@@ -134,13 +138,14 @@ enter the debugger.
134@end defopt 138@end defopt
135 139
136 To debug an error that happens during loading of the @file{.emacs} 140 To debug an error that happens during loading of the @file{.emacs}
137file, use the option @samp{-debug-init}, which binds 141file, use the option @samp{--debug-init}, which binds
138@code{debug-on-error} to @code{t} while @file{.emacs} is loaded and 142@code{debug-on-error} to @code{t} while @file{.emacs} is loaded, and
139inhibits use of @code{condition-case} to catch init-file errors. 143bypasses the @code{condition-case} which normally catches errors in the
144init-file.
140 145
141 If your @file{.emacs} file sets @code{debug-on-error}, the effect may 146 If your @file{.emacs} file sets @code{debug-on-error}, the effect may
142not last past the end of loading @file{.emacs}. (This is an undesirable 147not last past the end of loading @file{.emacs}. (This is an undesirable
143byproduct of the code that implements the @samp{-debug-init} command 148byproduct of the code that implements the @samp{--debug-init} command
144line option.) The best way to make @file{.emacs} set 149line option.) The best way to make @file{.emacs} set
145@code{debug-on-error} permanently is with @code{after-init-hook}, like 150@code{debug-on-error} permanently is with @code{after-init-hook}, like
146this: 151this:
@@ -269,8 +274,9 @@ not currently set up to break on entry. It always returns
269 You can cause the debugger to be called at a certain point in your 274 You can cause the debugger to be called at a certain point in your
270program by writing the expression @code{(debug)} at that point. To do 275program by writing the expression @code{(debug)} at that point. To do
271this, visit the source file, insert the text @samp{(debug)} at the 276this, visit the source file, insert the text @samp{(debug)} at the
272proper place, and type @kbd{C-M-x}. Be sure to undo this insertion 277proper place, and type @kbd{C-M-x}. @strong{Warning:} if you do this
273before you save the file! 278for temporary debugging purposes, be sure to undo this insertion before
279you save the file!
274 280
275 The place where you insert @samp{(debug)} must be a place where an 281 The place where you insert @samp{(debug)} must be a place where an
276additional form can be evaluated and its value ignored. (If the value 282additional form can be evaluated and its value ignored. (If the value
@@ -339,8 +345,8 @@ same function. (To do this, visit the source for the function and type
339@item c 345@item c
340Exit the debugger and continue execution. When continuing is possible, 346Exit the debugger and continue execution. When continuing is possible,
341it resumes execution of the program as if the debugger had never been 347it resumes execution of the program as if the debugger had never been
342entered (aside from the effect of any variables or data structures you 348entered (aside from any side-effects that you caused by changing
343may have changed while inside the debugger). 349variable values or data structures while inside the debugger).
344 350
345Continuing is possible after entry to the debugger due to function entry 351Continuing is possible after entry to the debugger due to function entry
346or exit, explicit invocation, or quitting. You cannot continue if the 352or exit, explicit invocation, or quitting. You cannot continue if the
@@ -371,10 +377,10 @@ remove the star from the line in the backtrace buffer.
371Read a Lisp expression in the minibuffer, evaluate it, and print the 377Read a Lisp expression in the minibuffer, evaluate it, and print the
372value in the echo area. The debugger alters certain important 378value in the echo area. The debugger alters certain important
373variables, and the current buffer, as part of its operation; @kbd{e} 379variables, and the current buffer, as part of its operation; @kbd{e}
374temporarily restores their outside-the-debugger values so you can 380temporarily restores their values from outside the debugger, so you can
375examine them. This makes the debugger more transparent. By contrast, 381examine and change them. This makes the debugger more transparent. By
376@kbd{M-:} does nothing special in the debugger; it shows you the 382contrast, @kbd{M-:} does nothing special in the debugger; it shows you
377variable values within the debugger. 383the variable values within the debugger.
378 384
379@item R 385@item R
380Like @kbd{e}, but also save the result of evaluation in the 386Like @kbd{e}, but also save the result of evaluation in the
@@ -404,7 +410,8 @@ You can't use @kbd{r} when the debugger was entered due to an error.
404@node Invoking the Debugger 410@node Invoking the Debugger
405@subsection Invoking the Debugger 411@subsection Invoking the Debugger
406 412
407 Here we describe fully the function used to invoke the debugger. 413 Here we describe in full detail the function @code{debug} that is used
414to invoke the debugger.
408 415
409@defun debug &rest debugger-args 416@defun debug &rest debugger-args
410This function enters the debugger. It switches buffers to a buffer 417This function enters the debugger. It switches buffers to a buffer
@@ -418,18 +425,15 @@ then @code{debug} switches back to the previous buffer and returns to
418whatever called @code{debug}. This is the only way the function 425whatever called @code{debug}. This is the only way the function
419@code{debug} can return to its caller. 426@code{debug} can return to its caller.
420 427
421If the first of the @var{debugger-args} passed to @code{debug} is 428The use of the @var{debugger-args} is that @code{debug} displays the
422@code{nil} (or if it is not one of the special values in the table 429rest of its arguments at the top of the @samp{*Backtrace*} buffer, so
423below), then @code{debug} displays the rest of its arguments at the 430that the user can see them. Except as described below, this is the
424top of the @samp{*Backtrace*} buffer. This mechanism is used to display 431@emph{only} way these arguments are used.
425a message to the user.
426
427However, if the first argument passed to @code{debug} is one of the
428following special values, then it has special significance. Normally,
429these values are passed to @code{debug} only by the internals of Emacs
430and the debugger, and not by programmers calling @code{debug}.
431 432
432The special values are: 433However, certain values for first argument to @code{debug} have a
434special significance. (Normally, these values are used only by the
435internals of Emacs, and not by programmers calling @code{debug}.) Here
436is a table of these special values:
433 437
434@table @code 438@table @code
435@item lambda 439@item lambda
@@ -640,6 +644,8 @@ If @var{frame-number} is out of range, @code{backtrace-frame} returns
640@code{nil}. 644@code{nil}.
641@end defun 645@end defun
642 646
647@include edebug.texi
648
643@node Syntax Errors 649@node Syntax Errors
644@section Debugging Invalid Lisp Syntax 650@section Debugging Invalid Lisp Syntax
645 651
@@ -658,7 +664,9 @@ if it goes to the place where that defun appears to end. If it does
658not, there is a problem in that defun. 664not, there is a problem in that defun.
659 665
660 However, unmatched parentheses are the most common syntax errors in 666 However, unmatched parentheses are the most common syntax errors in
661Lisp, and we can give further advice for those cases. 667Lisp, and we can give further advice for those cases. (In addition,
668just moving point through the code with Show Paren mode enabled might
669find the mismatch.)
662 670
663@menu 671@menu
664* Excess Open:: How to find a spurious open paren or missing close. 672* Excess Open:: How to find a spurious open paren or missing close.
@@ -753,5 +761,3 @@ the error.
753successfully, then point is located at the end of the form. In this 761successfully, then point is located at the end of the form. In this
754case, this technique can't localize the error precisely, but can still 762case, this technique can't localize the error precisely, but can still
755show you which function to check. 763show you which function to check.
756
757@include edebug.texi
diff --git a/lispref/display.texi b/lispref/display.texi
index 59782034ca6..4b09a8b3372 100644
--- a/lispref/display.texi
+++ b/lispref/display.texi
@@ -167,6 +167,9 @@ If it is non-@code{nil}, these lines are truncated; otherwise,
167@code{truncate-lines} says what to do with them. 167@code{truncate-lines} says what to do with them.
168@end defopt 168@end defopt
169 169
170 When horizontal scrolling (@pxref{Horizontal Scrolling}) is in use in
171a window, that forces truncation.
172
170 You can override the glyphs that indicate continuation or truncation 173 You can override the glyphs that indicate continuation or truncation
171using the display table; see @ref{Display Tables}. 174using the display table; see @ref{Display Tables}.
172 175
@@ -236,8 +239,8 @@ Minibuffer depth is 0.
236@end example 239@end example
237@end defun 240@end defun
238 241
239@tindex current-message
240@defun current-message 242@defun current-message
243@tindex current-message
241This function returns the message currently being displayed in the 244This function returns the message currently being displayed in the
242echo area, or @code{nil} if there is none. 245echo area, or @code{nil} if there is none.
243@end defun 246@end defun
@@ -252,8 +255,8 @@ The value is normally @code{nil}; Lisp programs bind it to @code{t}
252for brief periods of time. 255for brief periods of time.
253@end defvar 256@end defvar
254 257
255@tindex echo-area-clear-hook
256@defvar echo-area-clear-hook 258@defvar echo-area-clear-hook
259@tindex echo-area-clear-hook
257This normal hook is run whenever the echo area is cleared---either by 260This normal hook is run whenever the echo area is cleared---either by
258@code{(message nil)} or for any other reason. 261@code{(message nil)} or for any other reason.
259@end defvar 262@end defvar
@@ -278,8 +281,9 @@ This variable determines how much time should elapse before command
278characters echo. Its value must be an integer, which specifies the 281characters echo. Its value must be an integer, which specifies the
279number of seconds to wait before echoing. If the user types a prefix 282number of seconds to wait before echoing. If the user types a prefix
280key (such as @kbd{C-x}) and then delays this many seconds before 283key (such as @kbd{C-x}) and then delays this many seconds before
281continuing, the prefix key is echoed in the echo area. Any subsequent 284continuing, the prefix key is echoed in the echo area. (Once echoing
282characters in the same command will be echoed as well. 285begins in a key sequence, all subsequent characters in the same key
286sequence are echoed immediately.)
283 287
284If the value is zero, then command input is not echoed. 288If the value is zero, then command input is not echoed.
285@end defvar 289@end defvar
@@ -290,7 +294,8 @@ If the value is zero, then command input is not echoed.
290@cindex invisible text 294@cindex invisible text
291You can make characters @dfn{invisible}, so that they do not appear on 295You can make characters @dfn{invisible}, so that they do not appear on
292the screen, with the @code{invisible} property. This can be either a 296the screen, with the @code{invisible} property. This can be either a
293text property or a property of an overlay. 297text property (@pxref{Text Properties}) or a property of an overlay
298(@pxref{Overlays}).
294 299
295In the simplest case, any non-@code{nil} @code{invisible} property makes 300In the simplest case, any non-@code{nil} @code{invisible} property makes
296a character invisible. This is the default case---if you don't alter 301a character invisible. This is the default case---if you don't alter
@@ -342,14 +347,14 @@ by a visible newline, it displays an ellipsis.
342 Two functions are specifically provided for adding elements to 347 Two functions are specifically provided for adding elements to
343@code{buffer-invisibility-spec} and removing elements from it. 348@code{buffer-invisibility-spec} and removing elements from it.
344 349
345@tindex add-to-invisibility-spec
346@defun add-to-invisibility-spec element 350@defun add-to-invisibility-spec element
351@tindex add-to-invisibility-spec
347Add the element @var{element} to @code{buffer-invisibility-spec} 352Add the element @var{element} to @code{buffer-invisibility-spec}
348(if it is not already present in that list). 353(if it is not already present in that list).
349@end defun 354@end defun
350 355
351@tindex remove-from-invisibility-spec
352@defun remove-from-invisibility-spec element 356@defun remove-from-invisibility-spec element
357@tindex remove-from-invisibility-spec
353Remove the element @var{element} from @code{buffer-invisibility-spec}. 358Remove the element @var{element} from @code{buffer-invisibility-spec}.
354@end defun 359@end defun
355 360
@@ -393,8 +398,8 @@ temporarily modifying their invisible and intangible properties. If you
393want this to be done differently for a certain overlays, give it a 398want this to be done differently for a certain overlays, give it a
394@code{isearch-open-invisible-temporary} property which is a function. 399@code{isearch-open-invisible-temporary} property which is a function.
395The function is called with two arguments: the first is the overlay, and 400The function is called with two arguments: the first is the overlay, and
396the second is @code{nil} to make the overlay visible or @code{t} to make 401the second is @code{t} to make the overlay visible, or @code{nil} to
397it invisible again. 402make it invisible again.
398 403
399@node Selective Display 404@node Selective Display
400@section Selective Display 405@section Selective Display
@@ -598,6 +603,17 @@ The value of the last form in @var{forms} is returned.
598If this variable is non-@code{nil}, @code{with-output-to-temp-buffer} 603If this variable is non-@code{nil}, @code{with-output-to-temp-buffer}
599calls it as a function to do the job of displaying a help buffer. The 604calls it as a function to do the job of displaying a help buffer. The
600function gets one argument, which is the buffer it should display. 605function gets one argument, which is the buffer it should display.
606
607It is a good idea for this function to run @code{temp-buffer-show-hook}
608just as @code{with-output-to-temp-buffer} normally would, inside of
609@code{save-window-excursion} and with the chosen window and buffer
610selected.
611@end defvar
612
613@defvar temp-buffer-show-hook
614This normal hook is run by @code{with-output-to-temp-buffer} after
615displaying the help buffer. When the hook runs, the help buffer is
616current, and the window it was displayed in is selected.
601@end defvar 617@end defvar
602 618
603@defun momentary-string-display string position &optional char message 619@defun momentary-string-display string position &optional char message
@@ -675,15 +691,16 @@ these affect the display of the text within the overlay.
675@node Overlay Properties 691@node Overlay Properties
676@subsection Overlay Properties 692@subsection Overlay Properties
677 693
678Overlay properties are like text properties in some respects, but the 694Overlay properties are like text properties in that the properties that
679differences are more important than the similarities. Text properties 695alter how a character is displayed can come from either source. But in
680are considered a part of the text; overlays are specifically considered 696most respects they are different. Text properties are considered a part
681not to be part of the text. Thus, copying text between various buffers 697of the text; overlays are specifically considered not to be part of the
682and strings preserves text properties, but does not try to preserve 698text. Thus, copying text between various buffers and strings preserves
683overlays. Changing a buffer's text properties marks the buffer as 699text properties, but does not try to preserve overlays. Changing a
684modified, while moving an overlay or changing its properties does not. 700buffer's text properties marks the buffer as modified, while moving an
685Unlike text property changes, overlay changes are not recorded in the 701overlay or changing its properties does not. Unlike text property
686buffer's undo list. 702changes, overlay changes are not recorded in the buffer's undo list.
703@xref{Text Properties}, for comparison.
687 704
688@table @code 705@table @code
689@item priority 706@item priority
@@ -773,11 +790,14 @@ The @code{intangible} property on an overlay works just like the
773@code{intangible} text property. @xref{Special Properties}, for details. 790@code{intangible} text property. @xref{Special Properties}, for details.
774 791
775@item isearch-open-invisible 792@item isearch-open-invisible
776@itemx isearch-open-invisible-temporary 793This property tells incremental search how to make an invisible overlay
777These properties control how incremental search should make invisible an 794visible, permanently, if the final match overlaps it. @xref{Invisible
778overlay visible, either permanently or temporarily. @xref{Invisible
779Text}. 795Text}.
780 796
797@item isearch-open-invisible-temporary
798This property tells incremental search how to make an invisible overlay
799visible, temporarily, during the search. @xref{Invisible Text}.
800
781@item before-string 801@item before-string
782@kindex before-string @r{(overlay property)} 802@kindex before-string @r{(overlay property)}
783This property's value is a string to add to the display at the beginning 803This property's value is a string to add to the display at the beginning
@@ -861,8 +881,11 @@ This function returns the buffer that @var{overlay} belongs to.
861 881
862@defun delete-overlay overlay 882@defun delete-overlay overlay
863This function deletes @var{overlay}. The overlay continues to exist as 883This function deletes @var{overlay}. The overlay continues to exist as
864a Lisp object, but ceases to be part of the buffer it belonged to, and 884a Lisp object, but ceases to be attached to the buffer it belonged to,
865ceases to have any effect on display. 885and ceases to have any effect on display.
886
887A deleted overlay is not permanently useless. You can give it
888a new buffer position by calling @code{move-overlay}.
866@end defun 889@end defun
867 890
868@defun move-overlay overlay start end &optional buffer 891@defun move-overlay overlay start end &optional buffer
@@ -886,8 +909,8 @@ An overlay contains position @var{pos} if it begins at or before
886@var{pos}, and ends after @var{pos}. 909@var{pos}, and ends after @var{pos}.
887@end defun 910@end defun
888 911
889@tindex overlays-in
890@defun overlays-in beg end 912@defun overlays-in beg end
913@tindex overlays-in
891This function returns a list of the overlays that overlap the region 914This function returns a list of the overlays that overlap the region
892@var{beg} through @var{end}. ``Overlap'' means that at least one 915@var{beg} through @var{end}. ``Overlap'' means that at least one
893character is contained within the overlay and also contained within the 916character is contained within the overlay and also contained within the
@@ -912,20 +935,20 @@ Since not all characters have the same width, these functions let you
912check the width of a character. @xref{Primitive Indent}, and 935check the width of a character. @xref{Primitive Indent}, and
913@ref{Screen Lines}, for related functions. 936@ref{Screen Lines}, for related functions.
914 937
915@tindex char-width
916@defun char-width char 938@defun char-width char
939@tindex char-width
917This function returns the width in columns of the character @var{char}, 940This function returns the width in columns of the character @var{char},
918if it were displayed in the current buffer and the selected window. 941if it were displayed in the current buffer and the selected window.
919@end defun 942@end defun
920 943
921@tindex string-width
922@defun string-width string 944@defun string-width string
945@tindex string-width
923This function returns the width in columns of the string @var{string}, 946This function returns the width in columns of the string @var{string},
924if it were displayed in the current buffer and the selected window. 947if it were displayed in the current buffer and the selected window.
925@end defun 948@end defun
926 949
927@tindex truncate-string-to-width
928@defun truncate-string-to-width string width &optional start-column padding 950@defun truncate-string-to-width string width &optional start-column padding
951@tindex truncate-string-to-width
929This function returns the part of @var{string} that fits within 952This function returns the part of @var{string} that fits within
930@var{width} columns, as a new string. 953@var{width} columns, as a new string.
931 954
@@ -1033,22 +1056,22 @@ one.
1033@end table 1056@end table
1034 1057
1035@node Defining Faces 1058@node Defining Faces
1036@section Defining Faces 1059@subsection Defining Faces
1037 1060
1038 The way to define a new face is with @code{defface}. This creates a 1061 The way to define a new face is with @code{defface}. This creates a
1039kind of customization item (@pxref{Customization}) which the user can 1062kind of customization item (@pxref{Customization}) which the user can
1040customize using the Customization buffer (@pxref{Easy Customization,,, 1063customize using the Customization buffer (@pxref{Easy Customization,,,
1041emacs, The GNU Emacs Manual}). 1064emacs, The GNU Emacs Manual}).
1042 1065
1043@tindex defface
1044@defmac defface face spec doc [keyword value]... 1066@defmac defface face spec doc [keyword value]...
1067@tindex defface
1045Declare @var{face} as a customizable face that defaults according to 1068Declare @var{face} as a customizable face that defaults according to
1046@var{spec}. Do not quote the symbol @var{face}. The argument @var{doc} 1069@var{spec}. Do not quote the symbol @var{face}. The argument @var{doc}
1047specifies the face documentation. 1070specifies the face documentation.
1048 1071
1049When @code{defface} executes, it defines the face according to 1072When @code{defface} executes, it defines the face according to
1050@var{spec}, then uses any customizations saved in the @file{.emacs} file 1073@var{spec}, then uses any customizations that were read from the
1051to override that specification. 1074@file{.emacs} file to override that specification.
1052 1075
1053The purpose of @var{spec} is to specify how the face should appear on 1076The purpose of @var{spec} is to specify how the face should appear on
1054different kinds of terminals. It should be an alist whose elements have 1077different kinds of terminals. It should be an alist whose elements have
@@ -1069,7 +1092,7 @@ This element of @var{spec} matches all frames. Therefore, any
1069subsequent elements of @var{spec} are never used. Normally 1092subsequent elements of @var{spec} are never used. Normally
1070@code{t} is used in the last (or only) element of @var{spec}. 1093@code{t} is used in the last (or only) element of @var{spec}.
1071 1094
1072@item an list 1095@item a list
1073If @var{display} is alist, each elements should have the form 1096If @var{display} is alist, each elements should have the form
1074@code{(@var{characteristic} @var{value}@dots{})}. Here 1097@code{(@var{characteristic} @var{value}@dots{})}. Here
1075@var{characteristic} specifies a way of classifying frames, and the 1098@var{characteristic} specifies a way of classifying frames, and the
@@ -1222,19 +1245,20 @@ they are used automatically to handle certain shades of gray.
1222 1245
1223@defun set-face-font face font &optional frame 1246@defun set-face-font face font &optional frame
1224This function sets the font of face @var{face}. The argument @var{font} 1247This function sets the font of face @var{face}. The argument @var{font}
1225should be a string. Note that if you set the font explicitly, the bold 1248should be a string, either a valid font name for your system or the name
1226and italic attributes cease to have any effect, because the precise font 1249of an Emacs fontset (@pxref{Fontsets}). Note that if you set the font
1227that you specified is always used. 1250explicitly, the bold and italic attributes cease to have any effect,
1251because the precise font that you specified is always used.
1228@end defun 1252@end defun
1229 1253
1230@tindex set-face-bold-p
1231@defun set-face-bold-p face bold-p &optional frame 1254@defun set-face-bold-p face bold-p &optional frame
1255@tindex set-face-bold-p
1232This function sets the bold attribute of face @var{face}. 1256This function sets the bold attribute of face @var{face}.
1233Non-@code{nil} means bold; @code{nil} means non-bold. 1257Non-@code{nil} means bold; @code{nil} means non-bold.
1234@end defun 1258@end defun
1235 1259
1236@tindex set-face-italic-p
1237@defun set-face-italic-p face italic-p &optional frame 1260@defun set-face-italic-p face italic-p &optional frame
1261@tindex set-face-italic-p
1238This function sets the italic attribute of face @var{face}. 1262This function sets the italic attribute of face @var{face}.
1239Non-@code{nil} means italic; @code{nil} means non-italic. 1263Non-@code{nil} means italic; @code{nil} means non-italic.
1240@end defun 1264@end defun
@@ -1269,13 +1293,13 @@ This function returns the name of the background stipple pattern of face
1269This function returns the name of the font of face @var{face}. 1293This function returns the name of the font of face @var{face}.
1270@end defun 1294@end defun
1271 1295
1272@tindex face-bold-p
1273@defun face-bold-p face &optional frame 1296@defun face-bold-p face &optional frame
1297@tindex face-bold-p
1274This function returns the bold attribute of face @var{face}. 1298This function returns the bold attribute of face @var{face}.
1275@end defun 1299@end defun
1276 1300
1277@tindex face-italic-p
1278@defun face-italic-p face &optional frame 1301@defun face-italic-p face &optional frame
1302@tindex face-italic-p
1279This function returns the italic attribute of face @var{face}. 1303This function returns the italic attribute of face @var{face}.
1280@end defun 1304@end defun
1281 1305
@@ -1287,8 +1311,8 @@ This function returns the underline attribute of face @var{face}.
1287This function returns the face number of face @var{face}. 1311This function returns the face number of face @var{face}.
1288@end defun 1312@end defun
1289 1313
1290@tindex face-documentation
1291@defun face-documentation face 1314@defun face-documentation face
1315@tindex face-documentation
1292This function returns the documentation string of face @var{face}, or 1316This function returns the documentation string of face @var{face}, or
1293@code{nil} if none was specified for it. 1317@code{nil} if none was specified for it.
1294@end defun 1318@end defun
@@ -1428,7 +1452,7 @@ just like the codes in the range 128 to 255.
1428@item 1452@item
1429Character codes 128 through 255 map to sequences of four glyphs, where 1453Character codes 128 through 255 map to sequences of four glyphs, where
1430the first glyph is the @sc{ASCII} code for @samp{\}, and the others are 1454the first glyph is the @sc{ASCII} code for @samp{\}, and the others are
1431digit characters representing the charatcer code in octal. (A display 1455digit characters representing the character code in octal. (A display
1432table can specify a glyph to use instead of @samp{\}.) 1456table can specify a glyph to use instead of @samp{\}.)
1433 1457
1434@item 1458@item
@@ -1497,7 +1521,8 @@ force redisplay of the mode line using a new display table, call
1497@node Display Table Format 1521@node Display Table Format
1498@subsection Display Table Format 1522@subsection Display Table Format
1499 1523
1500 A display table is actually char-table with subtype @code{display-table}. 1524 A display table is actually a char-table (@pxref{Char-Tables}) with
1525@code{display-table} as its subtype.
1501 1526
1502@defun make-display-table 1527@defun make-display-table
1503This creates and returns a display table. The table initially has 1528This creates and returns a display table. The table initially has
@@ -1550,8 +1575,8 @@ effect of setting @code{ctl-arrow} to a non-@code{nil} value:
1550 (aset disptab 127 (vector ?^ ??))) 1575 (aset disptab 127 (vector ?^ ??)))
1551@end example 1576@end example
1552 1577
1553@tindex display-table-slot
1554@defun display-table-slot display-table slot 1578@defun display-table-slot display-table slot
1579@tindex display-table-slot
1555This function returns the value of the extra slot @var{slot} of 1580This function returns the value of the extra slot @var{slot} of
1556@var{display-table}. The argument @var{slot} may be a number from 0 to 1581@var{display-table}. The argument @var{slot} may be a number from 0 to
15575 inclusive, or a slot name (symbol). Valid symbols are 15825 inclusive, or a slot name (symbol). Valid symbols are
@@ -1559,8 +1584,8 @@ This function returns the value of the extra slot @var{slot} of
1559@code{selective-display}, and @code{vertical-border}. 1584@code{selective-display}, and @code{vertical-border}.
1560@end defun 1585@end defun
1561 1586
1562@tindex set-display-table-slot
1563@defun set-display-table-slot display-table slot value 1587@defun set-display-table-slot display-table slot value
1588@tindex set-display-table-slot
1564This function stores @var{value} in the extra slot @var{slot} of 1589This function stores @var{value} in the extra slot @var{slot} of
1565@var{display-table}. The argument @var{slot} may be a number from 0 to 1590@var{display-table}. The argument @var{slot} may be a number from 0 to
15665 inclusive, or a slot name (symbol). Valid symbols are 15915 inclusive, or a slot name (symbol). Valid symbols are
@@ -1669,14 +1694,14 @@ often you do this; frequent bells can become irritating. Also be
1669careful not to use just beeping when signaling an error is more 1694careful not to use just beeping when signaling an error is more
1670appropriate. (@xref{Errors}.) 1695appropriate. (@xref{Errors}.)
1671 1696
1672@defun ding &optional dont-terminate 1697@defun ding &optional do-not-terminate
1673@cindex keyboard macro termination 1698@cindex keyboard macro termination
1674This function beeps, or flashes the screen (see @code{visible-bell} below). 1699This function beeps, or flashes the screen (see @code{visible-bell} below).
1675It also terminates any keyboard macro currently executing unless 1700It also terminates any keyboard macro currently executing unless
1676@var{dont-terminate} is non-@code{nil}. 1701@var{do-not-terminate} is non-@code{nil}.
1677@end defun 1702@end defun
1678 1703
1679@defun beep &optional dont-terminate 1704@defun beep &optional do-not-terminate
1680This is a synonym for @code{ding}. 1705This is a synonym for @code{ding}.
1681@end defun 1706@end defun
1682 1707
@@ -1688,10 +1713,10 @@ provided the terminal's Termcap entry defines the visible bell
1688capability (@samp{vb}). 1713capability (@samp{vb}).
1689@end defvar 1714@end defvar
1690 1715
1691@tindex ring-bell-function
1692@defvar ring-bell-function 1716@defvar ring-bell-function
1717@tindex ring-bell-function
1693If this is non-@code{nil}, it specifies how Emacs should ``ring the 1718If this is non-@code{nil}, it specifies how Emacs should ``ring the
1694bell.'' Its value should bea function of no arguments. 1719bell.'' Its value should be a function of no arguments.
1695@end defvar 1720@end defvar
1696 1721
1697@node Window Systems 1722@node Window Systems
@@ -1714,7 +1739,7 @@ terminal).
1714This variable is a normal hook which Emacs runs after handling the 1739This variable is a normal hook which Emacs runs after handling the
1715initialization files. Emacs runs this hook after it has completed 1740initialization files. Emacs runs this hook after it has completed
1716loading your @file{.emacs} file, the default initialization file (if 1741loading your @file{.emacs} file, the default initialization file (if
1717any), and the terminal-specific Lisp code, and runring the hook 1742any), and the terminal-specific Lisp code, and running the hook
1718@code{term-setup-hook}. 1743@code{term-setup-hook}.
1719 1744
1720This hook is used for internal purposes: setting up communication with 1745This hook is used for internal purposes: setting up communication with
diff --git a/lispref/edebug.texi b/lispref/edebug.texi
index d8459d2bcea..c93330e38ae 100644
--- a/lispref/edebug.texi
+++ b/lispref/edebug.texi
@@ -36,7 +36,7 @@ Display expression results and evaluate expressions as if outside of
36Edebug. 36Edebug.
37 37
38@item 38@item
39Automatically reevaluate a list of expressions and 39Automatically re-evaluate a list of expressions and
40display their results each time Edebug updates the display. 40display their results each time Edebug updates the display.
41 41
42@item 42@item
@@ -199,11 +199,11 @@ steps into the call after instrumenting the function.
199@cindex Common Lisp (Edebug) 199@cindex Common Lisp (Edebug)
200@pindex cl.el @r{(Edebug)} 200@pindex cl.el @r{(Edebug)}
201@pindex cl-specs.el 201@pindex cl-specs.el
202 Edebug knows how to instrument all the standard special forms, an 202 Edebug knows how to instrument all the standard special forms,
203interactive form with an expression argument, anonymous lambda 203@code{interactive} forms with an expression argument, anonymous lambda
204expressions, and other defining forms. Edebug cannot know what a 204expressions, and other defining forms. Edebug cannot know what a
205user-defined macro will do with the arguments of a macro call, so you 205user-defined macro will do with the arguments of a macro call, so you
206must tell it; @xref{Instrumenting Macro Calls}, for details. 206must tell it; see @ref{Instrumenting Macro Calls}, for details.
207 207
208 When Edebug is about to instrument code for the first time in a 208 When Edebug is about to instrument code for the first time in a
209session, it runs the hook @code{edebug-setup-hook}, then sets it to 209session, it runs the hook @code{edebug-setup-hook}, then sets it to
@@ -212,7 +212,7 @@ session, it runs the hook @code{edebug-setup-hook}, then sets it to
212using, but actually load them only if you use Edebug. 212using, but actually load them only if you use Edebug.
213 213
214@findex eval-expression @r{(Edebug)} 214@findex eval-expression @r{(Edebug)}
215 To remove instrumentation from a definition, simply reevaluate its 215 To remove instrumentation from a definition, simply re-evaluate its
216definition in a way that does not instrument. There are two ways of 216definition in a way that does not instrument. There are two ways of
217evaluating forms that never instrument them: from a file with 217evaluating forms that never instrument them: from a file with
218@code{load}, and from the minibuffer with @code{eval-expression} 218@code{load}, and from the minibuffer with @code{eval-expression}
@@ -335,8 +335,8 @@ Step into the function or macro called by the form after point.
335@end table 335@end table
336 336
337The @kbd{h} command proceeds to the stop point near the current location 337The @kbd{h} command proceeds to the stop point near the current location
338if point, using a temporary breakpoint. See @ref{Breakpoints}, for more 338of point, using a temporary breakpoint. See @ref{Breakpoints}, for more
339about breakpoints. 339information about breakpoints.
340 340
341The @kbd{f} command runs the program forward over one expression. More 341The @kbd{f} command runs the program forward over one expression. More
342precisely, it sets a temporary breakpoint at the position that 342precisely, it sets a temporary breakpoint at the position that
@@ -463,7 +463,7 @@ with @kbd{u}. First move point to the Edebug stop point of your choice,
463then type @kbd{b} or @kbd{u} to set or unset a breakpoint there. 463then type @kbd{b} or @kbd{u} to set or unset a breakpoint there.
464Unsetting a breakpoint where none has been set has no effect. 464Unsetting a breakpoint where none has been set has no effect.
465 465
466Reevaluating or reinstrumenting a definition forgets all its breakpoints. 466Re-evaluating or reinstrumenting a definition forgets all its breakpoints.
467 467
468A @dfn{conditional breakpoint} tests a condition each time the program 468A @dfn{conditional breakpoint} tests a condition each time the program
469gets there. Any errors that occur as a result of evaluating the 469gets there. Any errors that occur as a result of evaluating the
@@ -568,7 +568,7 @@ are bound to the values they had outside of Edebug.
568@subsection Edebug Views 568@subsection Edebug Views
569 569
570 These Edebug commands let you view aspects of the buffer and window 570 These Edebug commands let you view aspects of the buffer and window
571status that obtained before entry to Edebug. The outside window 571status as they were before entry to Edebug. The outside window
572configuration is the collection of windows and contents that were in 572configuration is the collection of windows and contents that were in
573effect outside of Edebug. 573effect outside of Edebug.
574 574
@@ -745,7 +745,6 @@ After selecting @samp{*edebug*}, you can return to the source code
745buffer with @kbd{C-c C-w}. The @samp{*edebug*} buffer is killed when 745buffer with @kbd{C-c C-w}. The @samp{*edebug*} buffer is killed when
746you continue execution, and recreated next time it is needed. 746you continue execution, and recreated next time it is needed.
747 747
748
749@node Printing in Edebug 748@node Printing in Edebug
750@subsection Printing in Edebug 749@subsection Printing in Edebug
751 750
@@ -765,7 +764,6 @@ and @code{edebug-print-level} specify the values to use within Edebug.)
765@defopt edebug-print-length 764@defopt edebug-print-length
766If non-@code{nil}, bind @code{print-length} to this while printing 765If non-@code{nil}, bind @code{print-length} to this while printing
767results in Edebug. The default value is @code{50}. 766results in Edebug. The default value is @code{50}.
768@xref{Printing in Edebug}.
769@end defopt 767@end defopt
770 768
771@defopt edebug-print-level 769@defopt edebug-print-level
@@ -785,13 +783,13 @@ edebug-uninstall-custom-print}.
785 783
786@example 784@example
787(setq a '(x y)) 785(setq a '(x y))
788(setcar a a)) 786(setcar a a)
789@end example 787@end example
790 788
791@noindent 789@noindent
792Custom printing prints this as @samp{Result: #1=(#1# y)}. The 790Custom printing prints this as @samp{Result: #1=(#1# y)}. The
793@samp{#1=} notation labels the structure that follows it with the label 791@samp{#1=} notation labels the structure that follows it with the label
794@samp{1}, and the @samp{#1#} notation references the previously labelled 792@samp{1}, and the @samp{#1#} notation references the previously labeled
795structure. This notation is used for any shared elements of lists or 793structure. This notation is used for any shared elements of lists or
796vectors. 794vectors.
797 795
@@ -857,12 +855,19 @@ last lines inserted.
857@cindex frequency counts 855@cindex frequency counts
858@cindex performance analysis 856@cindex performance analysis
859Edebug provides rudimentary coverage testing and display of execution 857Edebug provides rudimentary coverage testing and display of execution
860frequency. All execution of an instrumented function accumulates 858frequency. Coverage testing works by comparing the result of each
861frequency counts, both before and after evaluation of each instrumented 859expression with the previous result; coverage is considered OK if two
862expression, even if the execution mode is Go-nonstop. Coverage testing 860different results are found. Thus, to sufficiently test the coverage of
863is more expensive, so it is done only if @code{edebug-test-coverage} is 861your code, try to execute it under conditions that evaluate all
864non-@code{nil}. The command @kbd{M-x edebug-display-freq-count} 862expressions more than once, and produce different results for each
865displays both the frequency data and the coverage data (if recorded). 863expression. Coverage testing makes execution slower, so it is only done
864if @code{edebug-test-coverage} is non-@code{nil}. Whether or not
865coverage testing is enabled, frequency counting is performed for all
866execution of an instrumented function, even if the execution mode is
867Go-nonstop.
868
869Use @kbd{M-x edebug-display-freq-count} to display both the
870coverage information and the frequency counts for a definition.
866 871
867@deffn Command edebug-display-freq-count 872@deffn Command edebug-display-freq-count
868This command displays the frequency count data for each line of the 873This command displays the frequency count data for each line of the
@@ -871,15 +876,16 @@ current definition.
871The frequency counts appear as comment lines after each line of code, 876The frequency counts appear as comment lines after each line of code,
872and you can undo all insertions with one @code{undo} command. The 877and you can undo all insertions with one @code{undo} command. The
873counts appear under the @samp{(} before an expression or the @samp{)} 878counts appear under the @samp{(} before an expression or the @samp{)}
874after an expression, or on the last character of a symbol. Values do 879after an expression, or on the last character of a variable. To
875not appear if they are equal to the previous count on the same line. 880simplify the display, a count is not shown if it is equal to the
881count of an earlier expression on the same line.
876 882
877The character @samp{=} following the count for an expression says that 883The character @samp{=} following the count for an expression says that
878the expression has returned the same value each time it was evaluated 884the expression has returned the same value each time it was evaluated.
879This is the only coverage information that Edebug records. 885This is the only coverage information that Edebug records.
880 886
881To clear the frequency count and coverage data for a definition, 887To clear the frequency count and coverage data for a definition,
882reinstrument it. 888simply reinstrument it with @code{eval-defun}.
883@end deffn 889@end deffn
884 890
885For example, after evaluating @code{(fac 5)} with a source 891For example, after evaluating @code{(fac 5)} with a source
@@ -930,8 +936,8 @@ program.
930@itemize @bullet 936@itemize @bullet
931@item 937@item
932@code{max-lisp-eval-depth} and @code{max-specpdl-size} are both 938@code{max-lisp-eval-depth} and @code{max-specpdl-size} are both
933incremented one time to reduce Edebug's impact on the stack. 939incremented once to reduce Edebug's impact on the stack. You could,
934You could, however, still run out of stack space when using Edebug. 940however, still run out of stack space when using Edebug.
935 941
936@item 942@item
937The state of keyboard macro execution is saved and restored. While 943The state of keyboard macro execution is saved and restored. While
@@ -1067,8 +1073,8 @@ name.
1067@end deffn 1073@end deffn
1068 1074
1069Here is a simple example that defines the specification for the 1075Here is a simple example that defines the specification for the
1070@code{for} macro described in the Emacs Lisp Reference Manual, followed 1076@code{for} example macro (@code{Argument Evaluation}), followed by an
1071by an alternative, equivalent specification. 1077alternative, equivalent specification.
1072 1078
1073@example 1079@example
1074(def-edebug-spec for 1080(def-edebug-spec for
@@ -1091,7 +1097,7 @@ None of the arguments is instrumented.
1091@item a symbol 1097@item a symbol
1092The symbol must have an Edebug specification which is used instead. 1098The symbol must have an Edebug specification which is used instead.
1093This indirection is repeated until another kind of specification is 1099This indirection is repeated until another kind of specification is
1094found. This allows you to inherit the specification for another macro. 1100found. This allows you to inherit the specification from another macro.
1095 1101
1096@item a list 1102@item a list
1097The elements of the list describe the types of the arguments of a 1103The elements of the list describe the types of the arguments of a
@@ -1137,9 +1143,8 @@ their meanings:
1137 1143
1138@table @code 1144@table @code
1139@item sexp 1145@item sexp
1140A single Lisp object, not unevaluated. 1146A single unevaluated expression, which is not instrumented.
1141@c "unevaluated expression" is not meaningful, because 1147@c an "expression" is not necessarily intended for evaluation.
1142@c an expression is a Lisp object intended for evaluation.
1143 1148
1144@item form 1149@item form
1145A single evaluated expression, which is instrumented. 1150A single evaluated expression, which is instrumented.
@@ -1202,7 +1207,7 @@ succeeds.
1202@item &define 1207@item &define
1203@kindex &define @r{(Edebug)} 1208@kindex &define @r{(Edebug)}
1204Indicates that the specification is for a defining form. The defining 1209Indicates that the specification is for a defining form. The defining
1205form itself is not instrumented (i.e. Edebug does not stop before and 1210form itself is not instrumented (that is, Edebug does not stop before and
1206after the defining form), but forms inside it typically will be 1211after the defining form), but forms inside it typically will be
1207instrumented. The @code{&define} keyword should be the first element in 1212instrumented. The @code{&define} keyword should be the first element in
1208a list specification. 1213a list specification.
@@ -1260,7 +1265,7 @@ a list whose elements match the specification @var{elements}.
1260A sublist specification may be a dotted list and the corresponding list 1265A sublist specification may be a dotted list and the corresponding list
1261argument may then be a dotted list. Alternatively, the last @sc{cdr} of a 1266argument may then be a dotted list. Alternatively, the last @sc{cdr} of a
1262dotted list specification may be another sublist specification (via a 1267dotted list specification may be another sublist specification (via a
1263grouping or an indirect specification, e.g. @code{(spec . [(more 1268grouping or an indirect specification, e.g., @code{(spec . [(more
1264specs@dots{})])}) whose elements match the non-dotted list arguments. 1269specs@dots{})])}) whose elements match the non-dotted list arguments.
1265This is useful in recursive specifications such as in the backquote 1270This is useful in recursive specifications such as in the backquote
1266example below. Also see the description of a @code{nil} specification 1271example below. Also see the description of a @code{nil} specification
@@ -1293,7 +1298,7 @@ than once.
1293 1298
1294@item arg 1299@item arg
1295The argument, a symbol, is the name of an argument of the defining form. 1300The argument, a symbol, is the name of an argument of the defining form.
1296However, lambda list keywords (symbols starting with @samp{@code{&}}) 1301However, lambda-list keywords (symbols starting with @samp{&})
1297are not allowed. 1302are not allowed.
1298 1303
1299@item lambda-list 1304@item lambda-list
@@ -1326,33 +1331,35 @@ necessarily mean a syntax error will be signaled; instead,
1326exhausted. Eventually every element of the argument list must be 1331exhausted. Eventually every element of the argument list must be
1327matched by some element in the specification, and every required element 1332matched by some element in the specification, and every required element
1328in the specification must match some argument. 1333in the specification must match some argument.
1329 1334
1330Backtracking is disabled for the remainder of a sublist or group when 1335When a syntax error is detected, it might not be reported until much
1331certain conditions occur, described below. Backtracking is reenabled 1336later after higher-level alternatives have been exhausted, and with the
1332when a new alternative is established by @code{&optional}, @code{&rest}, 1337point positioned further from the real error. But if backtracking is
1333or @code{&or}. It is also reenabled initially when processing a 1338disabled when an error occurs, it can be reported immediately. Note
1334sublist or group specification or an indirect specification. 1339that backtracking is also reenabled automatically in several situations;
1335 1340it is reenabled when a new alternative is established by
1336You might want to disable backtracking to commit to some alternative so 1341@code{&optional}, @code{&rest}, or @code{&or}, or at the start of
1337that Edebug can provide a more specific syntax error message. Normally, 1342processing a sublist, group, or indirect specification. The effect of
1338if no alternative matches, Edebug reports that none matched, but if one 1343enabling or disabling backtracking is limited to the remainder of the
1339alternative is committed to, Edebug can report how it failed to match. 1344level currently being processed and lower levels.
1340 1345
1341First, backtracking is disabled while matching any of the form 1346Backtracking is disabled while matching any of the
1342specifications (i.e. @code{form}, @code{body}, @code{def-form}, and 1347form specifications (that is, @code{form}, @code{body}, @code{def-form}, and
1343@code{def-body}). These specifications will match any form so any error 1348@code{def-body}). These specifications will match any form so any error
1344must be in the form itself rather than at a higher level. 1349must be in the form itself rather than at a higher level.
1345 1350
1346Second, backtracking is disabled after successfully matching a quoted 1351Backtracking is also disabled after successfully matching a quoted
1347symbol or string specification, since this usually indicates a 1352symbol or string specification, since this usually indicates a
1348recognized construct. If you have a set of alternative constructs that 1353recognized construct. But if you have a set of alternative constructs that
1349all begin with the same symbol, you can usually work around this 1354all begin with the same symbol, you can usually work around this
1350constraint by factoring the symbol out of the alternatives, e.g., 1355constraint by factoring the symbol out of the alternatives, e.g.,
1351@code{["foo" &or [first case] [second case] ...]}. 1356@code{["foo" &or [first case] [second case] ...]}.
1352 1357
1353Third, backtracking may be explicitly disabled by using the 1358Most needs are satisfied by these two ways that bactracking is
1354@code{gate} specification. This is useful when you know that 1359automatically disabled, but occasionally it is useful to explicitly
1355no higher alternatives may apply. 1360disable backtracking by using the @code{gate} specification. This is
1361useful when you know that no higher alternatives could apply. See the
1362example of the @code{let} specification.
1356 1363
1357@node Specification Examples 1364@node Specification Examples
1358@subsubsection Specification Examples 1365@subsubsection Specification Examples
@@ -1362,7 +1369,7 @@ the examples provided here.
1362 1369
1363A @code{let} special form has a sequence of bindings and a body. Each 1370A @code{let} special form has a sequence of bindings and a body. Each
1364of the bindings is either a symbol or a sublist with a symbol and 1371of the bindings is either a symbol or a sublist with a symbol and
1365optional value. In the specification below, notice the @code{gate} 1372optional expression. In the specification below, notice the @code{gate}
1366inside of the sublist to prevent backtracking once a sublist is found. 1373inside of the sublist to prevent backtracking once a sublist is found.
1367 1374
1368@example 1375@example
@@ -1491,19 +1498,11 @@ function entry or exit per line, indented by the recursion level.
1491 1498
1492The default value is @code{nil}. 1499The default value is @code{nil}.
1493 1500
1494Also see @code{edebug-tracing}, in @xref{Trace Buffer}. 1501Also see @code{edebug-tracing}, in @ref{Trace Buffer}.
1495@end defopt 1502@end defopt
1496 1503
1497@defopt edebug-test-coverage 1504@defopt edebug-test-coverage
1498If non-@code{nil}, Edebug tests coverage of all expressions debugged. 1505If non-@code{nil}, Edebug tests coverage of all expressions debugged.
1499This is done by comparing the result of each expression
1500with the previous result. Coverage is considered OK if two different
1501results are found. So to sufficiently test the coverage of your code,
1502try to execute it under conditions that evaluate all expressions more
1503than once, and produce different results for each expression.
1504
1505Use @kbd{M-x edebug-display-freq-count} to display the frequency count
1506and coverage information for a definition.
1507@xref{Coverage Testing}. 1506@xref{Coverage Testing}.
1508@end defopt 1507@end defopt
1509 1508
diff --git a/lispref/elisp.texi b/lispref/elisp.texi
index 6005cff535e..7dbc8093346 100644
--- a/lispref/elisp.texi
+++ b/lispref/elisp.texi
@@ -4,6 +4,8 @@
4@settitle GNU Emacs Lisp Reference Manual 4@settitle GNU Emacs Lisp Reference Manual
5@c %**end of header 5@c %**end of header
6 6
7@smallbook
8
7@ifinfo 9@ifinfo
8This version is the edition 2.5 of the GNU Emacs Lisp 10This version is the edition 2.5 of the GNU Emacs Lisp
9Reference Manual. It corresponds to Emacs Version 20.3 11Reference Manual. It corresponds to Emacs Version 20.3
@@ -269,7 +271,7 @@ Editing Types
269* Process Type:: A process running on the underlying OS. 271* Process Type:: A process running on the underlying OS.
270* Stream Type:: Receive or send characters. 272* Stream Type:: Receive or send characters.
271* Keymap Type:: What function a keystroke invokes. 273* Keymap Type:: What function a keystroke invokes.
272* Syntax Table Type:: What a character means. 274* Overlay Type:: How an overlay is represented.
273 275
274Numbers 276Numbers
275 277
@@ -291,7 +293,7 @@ Strings and Characters
291* Text Comparison:: Comparing characters or strings. 293* Text Comparison:: Comparing characters or strings.
292* String Conversion:: Converting characters or strings and vice versa. 294* String Conversion:: Converting characters or strings and vice versa.
293* Formatting Strings:: @code{format}: Emacs's analog of @code{printf}. 295* Formatting Strings:: @code{format}: Emacs's analog of @code{printf}.
294* Character Case:: Case conversion functions. 296* Case Conversion:: Case conversion functions.
295 297
296Lists 298Lists
297 299
@@ -443,6 +445,19 @@ Byte Compilation
443* Compilation Functions:: Byte compilation functions. 445* Compilation Functions:: Byte compilation functions.
444* Disassembly:: Disassembling byte-code; how to read byte-code. 446* Disassembly:: Disassembling byte-code; how to read byte-code.
445 447
448Advising Functions
449
450* Simple Advice:: A simple example to explain the basics of advice.
451* Defining Advice:: Detailed description of @code{defadvice}.
452* Computed Advice:: ...is to @code{defadvice} as @code{fset} is to @code{defun}.
453* Activation of Advice:: Advice doesn't do anything until you activate it.
454* Enabling Advice:: You can enable or disable each piece of advice.
455* Preactivation:: Preactivation is a way of speeding up the
456 loading of compiled advice.
457* Argument Access:: How advice can access the function's arguments.
458* Subr Arguments:: Accessing arguments when advising a primitive.
459* Combined Definition:: How advice is implemented.
460
446Debugging Lisp Programs 461Debugging Lisp Programs
447 462
448* Debugger:: How the Emacs Lisp debugger is implemented. 463* Debugger:: How the Emacs Lisp debugger is implemented.
@@ -684,7 +699,7 @@ Frames
684* Pop-Up Menus:: Displaying a menu for the user to select from. 699* Pop-Up Menus:: Displaying a menu for the user to select from.
685* Dialog Boxes:: Displaying a box to ask yes or no. 700* Dialog Boxes:: Displaying a box to ask yes or no.
686* Pointer Shapes:: Specifying the shape of the mouse pointer. 701* Pointer Shapes:: Specifying the shape of the mouse pointer.
687* X Selections:: Transferring text to and from other X clients. 702* Window System Selections::Transferring text to and from other X clients.
688* Color Names:: Getting the definitions of color names. 703* Color Names:: Getting the definitions of color names.
689* Resources:: Getting resource values from the server. 704* Resources:: Getting resource values from the server.
690* Server Data:: Getting info about the X server. 705* Server Data:: Getting info about the X server.
@@ -951,7 +966,7 @@ Object Internals
951@include index.texi 966@include index.texi
952 967
953@node New Symbols, , Index, Top 968@node New Symbols, , Index, Top
954@chapter New Symbols Since the Previous Edition 969@unnumbered New Symbols Since the Previous Edition
955 970
956@printindex tp 971@printindex tp
957 972
diff --git a/lispref/errors.texi b/lispref/errors.texi
index 809db995ed0..823eadddeac 100644
--- a/lispref/errors.texi
+++ b/lispref/errors.texi
@@ -104,7 +104,7 @@ This is a @code{file-error}.@*
104@xref{Regular Expressions}. 104@xref{Regular Expressions}.
105 105
106@item mark-inactive 106@item mark-inactive
107@code{Mark inactive"}@* 107@code{"Mark inactive"}@*
108@xref{The Mark}. 108@xref{The Mark}.
109 109
110@item no-catch 110@item no-catch
diff --git a/lispref/eval.texi b/lispref/eval.texi
index 512e6d927b2..d49aba1cc16 100644
--- a/lispref/eval.texi
+++ b/lispref/eval.texi
@@ -464,6 +464,9 @@ Emacs Lisp with a reference to where each is described.
464@item quote 464@item quote
465@pxref{Quoting} 465@pxref{Quoting}
466 466
467@item save-current-buffer
468@pxref{Current Buffer}
469
467@item save-excursion 470@item save-excursion
468@pxref{Excursions} 471@pxref{Excursions}
469 472
@@ -657,8 +660,10 @@ The depth limit counts internal uses of @code{eval}, @code{apply}, and
657expressions, and recursive evaluation of function call arguments and 660expressions, and recursive evaluation of function call arguments and
658function body forms, as well as explicit calls in Lisp code. 661function body forms, as well as explicit calls in Lisp code.
659 662
660The default value of this variable is 200. If you set it to a value 663The default value of this variable is 300. If you set it to a value
661less than 100, Lisp will reset it to 100 if the given value is reached. 664less than 100, Lisp will reset it to 100 if the given value is reached.
665Entry to the Lisp debugger increases the value, if there is little room
666left, to make sure the debugger itself has room to execute.
662 667
663@code{max-specpdl-size} provides another limit on nesting. 668@code{max-specpdl-size} provides another limit on nesting.
664@xref{Local Variables}. 669@xref{Local Variables}.
diff --git a/lispref/files.texi b/lispref/files.texi
index 45f8097fecd..940ac549210 100644
--- a/lispref/files.texi
+++ b/lispref/files.texi
@@ -15,7 +15,7 @@ described in @ref{Backups and Auto-Saving}.
15 15
16 Many of the file functions take one or more arguments that are file 16 Many of the file functions take one or more arguments that are file
17names. A file name is actually a string. Most of these functions 17names. A file name is actually a string. Most of these functions
18expand file name arguments using @code{expand-file-name}, so that 18expand file name arguments by calling @code{expand-file-name}, so that
19@file{~} is handled correctly, as are relative file names (including 19@file{~} is handled correctly, as are relative file names (including
20@samp{../}). These functions don't recognize environment variable 20@samp{../}). These functions don't recognize environment variable
21substitutions such as @samp{$HOME}. @xref{File Name Expansion}. 21substitutions such as @samp{$HOME}. @xref{File Name Expansion}.
@@ -201,9 +201,9 @@ used, and in many cases only some of the functions are called.
201@comment node-name, next, previous, up 201@comment node-name, next, previous, up
202@subsection Subroutines of Visiting 202@subsection Subroutines of Visiting
203 203
204 The @code{find-file-noselect} function uses the 204 The @code{find-file-noselect} function uses two important subroutines
205@code{create-file-buffer} and @code{after-find-file} functions as 205which are sometimes useful in user Lisp code: @code{create-file-buffer}
206subroutines. Sometimes it is useful to call them directly. 206and @code{after-find-file}. This section explains how to use them.
207 207
208@defun create-file-buffer filename 208@defun create-file-buffer filename
209This function creates a suitably named buffer for visiting 209This function creates a suitably named buffer for visiting
@@ -251,7 +251,7 @@ If @var{warn} is non-@code{nil}, then this function issues a warning
251if an auto-save file exists and is more recent than the visited file. 251if an auto-save file exists and is more recent than the visited file.
252 252
253The last thing @code{after-find-file} does is call all the functions 253The last thing @code{after-find-file} does is call all the functions
254in @code{find-file-hooks}. 254in the list @code{find-file-hooks}.
255@end defun 255@end defun
256 256
257@node Saving Buffers 257@node Saving Buffers
@@ -334,6 +334,12 @@ You might wish to save the file modes value returned by
334@code{backup-buffer} and use that to set the mode bits of the file that 334@code{backup-buffer} and use that to set the mode bits of the file that
335you write. This is what @code{save-buffer} normally does. 335you write. This is what @code{save-buffer} normally does.
336 336
337The hook functions in @code{write-file-hooks} are also responsible for
338encoding the data (if desired): they must choose a suitable coding
339system (@pxref{Lisp and Coding Systems}), perform the encoding
340(@pxref{Explicit Encoding}), and set @code{last-coding-system-used} to
341the coding system that was used (@pxref{Specifying Coding Systems}).
342
337Do not make this variable buffer-local. To set up buffer-specific hook 343Do not make this variable buffer-local. To set up buffer-specific hook
338functions, use @code{write-contents-hooks} instead. 344functions, use @code{write-contents-hooks} instead.
339 345
@@ -448,12 +454,13 @@ contents of the file. This is better than simply deleting the buffer
448contents and inserting the whole file, because (1) it preserves some 454contents and inserting the whole file, because (1) it preserves some
449marker positions and (2) it puts less data in the undo list. 455marker positions and (2) it puts less data in the undo list.
450 456
451It works to read a special file with @code{insert-file-contents} 457It is possible to read a special file (such as a FIFO or an I/O device)
452as long as @var{replace} and @var{visit} are @code{nil}. 458with @code{insert-file-contents}, as long as @var{replace} and
459@var{visit} are @code{nil}.
453@end defun 460@end defun
454 461
455@tindex insert-file-contents-literally
456@defun insert-file-contents-literally filename &optional visit beg end replace 462@defun insert-file-contents-literally filename &optional visit beg end replace
463@tindex insert-file-contents-literally
457This function works like @code{insert-file-contents} except that it does 464This function works like @code{insert-file-contents} except that it does
458not do format decoding (@pxref{Format Conversion}), does not do 465not do format decoding (@pxref{Format Conversion}), does not do
459character code conversion (@pxref{Coding Systems}), does not run 466character code conversion (@pxref{Coding Systems}), does not run
@@ -485,7 +492,7 @@ An error is signaled if @var{filename} specifies a nonwritable file,
485or a nonexistent file in a directory where files cannot be created. 492or a nonexistent file in a directory where files cannot be created.
486@end deffn 493@end deffn
487 494
488@deffn Command write-region start end filename &optional append visit 495@deffn Command write-region start end filename &optional append visit confirm
489This function writes the region delimited by @var{start} and @var{end} 496This function writes the region delimited by @var{start} and @var{end}
490in the current buffer into the file specified by @var{filename}. 497in the current buffer into the file specified by @var{filename}.
491 498
@@ -496,6 +503,9 @@ that string, rather than text from the buffer.
496If @var{append} is non-@code{nil}, then the specified text is appended 503If @var{append} is non-@code{nil}, then the specified text is appended
497to the existing file contents (if any). 504to the existing file contents (if any).
498 505
506If @var{confirm} is non-@code{nil}, then @code{write-region} asks
507for confirmation if @var{filename} names an existing file.
508
499If @var{visit} is @code{t}, then Emacs establishes an association 509If @var{visit} is @code{t}, then Emacs establishes an association
500between the buffer and the file: the buffer is then visiting that file. 510between the buffer and the file: the buffer is then visiting that file.
501It also sets the last file modification time for the current buffer to 511It also sets the last file modification time for the current buffer to
@@ -524,8 +534,8 @@ feature is useful for programs that use files for internal purposes,
524files that the user does not need to know about. 534files that the user does not need to know about.
525@end deffn 535@end deffn
526 536
527@tindex with-temp-file
528@defmac with-temp-file file body... 537@defmac with-temp-file file body...
538@tindex with-temp-file
529The @code{with-temp-file} macro evaluates the @var{body} forms with a 539The @code{with-temp-file} macro evaluates the @var{body} forms with a
530temporary buffer as the current buffer; then, at the end, it writes the 540temporary buffer as the current buffer; then, at the end, it writes the
531buffer contents into file @var{file}. It kills the temporary buffer 541buffer contents into file @var{file}. It kills the temporary buffer
@@ -732,8 +742,8 @@ we can deduce that any attempt to read a file in @file{/foo/} will
732give an error. 742give an error.
733@end defun 743@end defun
734 744
735@tindex access-file
736@defun access-file filename string 745@defun access-file filename string
746@tindex access-file
737This function opens file @var{filename} for reading, then closes it and 747This function opens file @var{filename} for reading, then closes it and
738returns @code{nil}. However, if the open fails, it signals an error 748returns @code{nil}. However, if the open fails, it signals an error
739using @var{string} as the error message text. 749using @var{string} as the error message text.
@@ -1103,9 +1113,9 @@ In the first part of the following example, we list two files,
1103 1113
1104@example 1114@example
1105@group 1115@group
1106% ls -l fo* 1116% ls -li fo*
1107-rw-rw-rw- 1 rms 29 Aug 18 20:32 foo 111781908 -rw-rw-rw- 1 rms 29 Aug 18 20:32 foo
1108-rw-rw-rw- 1 rms 24 Aug 18 20:31 foo3 111884302 -rw-rw-rw- 1 rms 24 Aug 18 20:31 foo3
1109@end group 1119@end group
1110@end example 1120@end example
1111 1121
@@ -1115,23 +1125,22 @@ the files again. This shows two names for one file, @file{foo} and
1115 1125
1116@example 1126@example
1117@group 1127@group
1118(add-name-to-file "~/lewis/foo" "~/lewis/foo2") 1128(add-name-to-file "foo" "foo2")
1119 @result{} nil 1129 @result{} nil
1120@end group 1130@end group
1121 1131
1122@group 1132@group
1123% ls -l fo* 1133% ls -li fo*
1124-rw-rw-rw- 2 rms 29 Aug 18 20:32 foo 113481908 -rw-rw-rw- 2 rms 29 Aug 18 20:32 foo
1125-rw-rw-rw- 2 rms 29 Aug 18 20:32 foo2 113581908 -rw-rw-rw- 2 rms 29 Aug 18 20:32 foo2
1126-rw-rw-rw- 1 rms 24 Aug 18 20:31 foo3 113684302 -rw-rw-rw- 1 rms 24 Aug 18 20:31 foo3
1127@end group 1137@end group
1128@end example 1138@end example
1129 1139
1130@c !!! Check whether this set of examples is consistent. --rjc 15mar92 1140Finally, we evaluate the following:
1131 Finally, we evaluate the following:
1132 1141
1133@example 1142@example
1134(add-name-to-file "~/lewis/foo" "~/lewis/foo3" t) 1143(add-name-to-file "foo" "foo3" t)
1135@end example 1144@end example
1136 1145
1137@noindent 1146@noindent
@@ -1141,22 +1150,22 @@ contents of @file{foo3} are lost.
1141 1150
1142@example 1151@example
1143@group 1152@group
1144(add-name-to-file "~/lewis/foo1" "~/lewis/foo3") 1153(add-name-to-file "foo1" "foo3")
1145 @result{} nil 1154 @result{} nil
1146@end group 1155@end group
1147 1156
1148@group 1157@group
1149% ls -l fo* 1158% ls -li fo*
1150-rw-rw-rw- 3 rms 29 Aug 18 20:32 foo 115981908 -rw-rw-rw- 3 rms 29 Aug 18 20:32 foo
1151-rw-rw-rw- 3 rms 29 Aug 18 20:32 foo2 116081908 -rw-rw-rw- 3 rms 29 Aug 18 20:32 foo2
1152-rw-rw-rw- 3 rms 29 Aug 18 20:32 foo3 116181908 -rw-rw-rw- 3 rms 29 Aug 18 20:32 foo3
1153@end group 1162@end group
1154@end example 1163@end example
1155 1164
1156 This function is meaningless on VMS, where multiple names for one file 1165This function is meaningless on operating systems where multiple names
1157are not allowed. 1166for one file are not allowed.
1158 1167
1159 See also @code{file-nlinks} in @ref{File Attributes}. 1168See also @code{file-nlinks} in @ref{File Attributes}.
1160@end defun 1169@end defun
1161 1170
1162@deffn Command rename-file filename newname &optional ok-if-already-exists 1171@deffn Command rename-file filename newname &optional ok-if-already-exists
@@ -1176,7 +1185,7 @@ In an interactive call, this function prompts for @var{filename} and
1176This command copies the file @var{oldname} to @var{newname}. An 1185This command copies the file @var{oldname} to @var{newname}. An
1177error is signaled if @var{oldname} does not exist. 1186error is signaled if @var{oldname} does not exist.
1178 1187
1179If @var{time} is non-@code{nil}, then this functions gives the new file 1188If @var{time} is non-@code{nil}, then this function gives the new file
1180the same last-modified time that the old one has. (This works on only 1189the same last-modified time that the old one has. (This works on only
1181some operating systems.) If setting the time gets an error, 1190some operating systems.) If setting the time gets an error,
1182@code{copy-file} signals a @code{file-date-error} error. 1191@code{copy-file} signals a @code{file-date-error} error.
@@ -1579,9 +1588,9 @@ form.
1579 1588
1580@example 1589@example
1581(file-relative-name "/foo/bar" "/foo/") 1590(file-relative-name "/foo/bar" "/foo/")
1582 @result{} "bar") 1591 @result{} "bar"
1583(file-relative-name "/foo/bar" "/hack/") 1592(file-relative-name "/foo/bar" "/hack/")
1584 @result{} "/foo/bar") 1593 @result{} "/foo/bar"
1585@end example 1594@end example
1586@end defun 1595@end defun
1587 1596
@@ -1653,38 +1662,55 @@ construct a name for such a file:
1653@example 1662@example
1654(make-temp-name 1663(make-temp-name
1655 (expand-file-name @var{name-of-application} 1664 (expand-file-name @var{name-of-application}
1656 (or (getenv "TMPDIR") 1665 temporary-file-directory))
1657 "/tmp/")))
1658@end example 1666@end example
1659 1667
1660@cindex @code{TMPDIR} environment variable.
1661@noindent 1668@noindent
1662The job of @code{make-temp-name} is to prevent two different users or 1669The job of @code{make-temp-name} is to prevent two different users or
1663two different jobs from trying to use the same name. 1670two different jobs from trying to use the exact same file name. This
1664 1671example uses the variable @code{temporary-file-directory} to decide
1665This example uses the environment variable @code{TMPDIR} to specify the 1672where to put the temporary file. All Emacs Lisp programs should
1666directory, and if that is not specified, we use the directory 1673use @code{temporary-file-directory} for this purpose, to give the user
1667@file{/tmp/}. This is the standard way to choose the directory, and all 1674a uniform way to specify the directory for all temporary files.
1668Emacs Lisp programs should use it.
1669 1675
1670@defun make-temp-name string 1676@defun make-temp-name string
1671This function generates string that can be used as a unique name. The 1677This function generates string that can be used as a unique file name.
1672name starts with @var{string}, and ends with a number that is different 1678The name starts with @var{string}, and contains a number that is
1673in each Emacs job. 1679different in each Emacs job.
1674 1680
1675@example 1681@example
1676@group 1682@group
1677(make-temp-name "/tmp/foo") 1683(make-temp-name "/tmp/foo")
1678 @result{} "/tmp/foo021304" 1684 @result{} "/tmp/foo232J6v"
1679@end group 1685@end group
1680@end example 1686@end example
1681 1687
1682To prevent conflicts among different libraries running in the same 1688To prevent conflicts among different libraries running in the same
1683Emacs, each Lisp program that uses @code{make-temp-name} should have its 1689Emacs, each Lisp program that uses @code{make-temp-name} should have its
1684own @var{string}. The number added to the end of the name distinguishes 1690own @var{string}. The number added to the end of @var{string}
1685between the same application running in different Emacs jobs. 1691distinguishes between the same application running in different Emacs
1692jobs. Additional added characters permit a large number of distinct
1693names even in one Emacs job.
1686@end defun 1694@end defun
1687 1695
1696@defvar temporary-file-directory
1697@cindex @code{TMPDIR} environment variable.
1698@cindex @code{TMP} environment variable.
1699This variable specifies the directory name for creating temporary files.
1700Its value should be a directory name (@pxref{Directory Names}), but it
1701is good for Lisp programs to cope if the value is a file name instead.
1702(Using the value as the second argument to @code{expand-file-name} is a
1703good way to achieve that.)
1704
1705The default value is determined in a reasonable way for your operating
1706system; on GNU and Unix systems it is based on the @code{TMP} and
1707@code{TMPDIR} environment variables.
1708
1709Even if you do not use @code{make-temp-name} to choose the temporary
1710file's name, you should still use this variable to decide which
1711directory to put the file in.
1712@end defvar
1713
1688@node File Name Completion 1714@node File Name Completion
1689@subsection File Name Completion 1715@subsection File Name Completion
1690@cindex file name completion subroutines 1716@cindex file name completion subroutines
@@ -1813,7 +1839,7 @@ is an example from the @code{completion} package:
1813 1839
1814 On GNU and Unix systems, and on some other systems as well, 1840 On GNU and Unix systems, and on some other systems as well,
1815@code{convert-standard-filename} returns its argument unchanged. On 1841@code{convert-standard-filename} returns its argument unchanged. On
1816some other systems, it alters the name to fit the systems's conventions. 1842some other systems, it alters the name to fit the system's conventions.
1817 1843
1818 For example, on MS-DOS the alterations made by this function include 1844 For example, on MS-DOS the alterations made by this function include
1819converting a leading @samp{.} to @samp{_}, converting a @samp{_} in the 1845converting a leading @samp{.} to @samp{_}, converting a @samp{_} in the
@@ -1883,11 +1909,12 @@ specification including wildcard characters. If @var{wildcard} is
1883non-@code{nil}, that means treat @var{file} as a file specification with 1909non-@code{nil}, that means treat @var{file} as a file specification with
1884wildcards. 1910wildcards.
1885 1911
1886If @var{full-directory-p} is non-@code{nil}, that the directory listing 1912If @var{full-directory-p} is non-@code{nil}, that means the directory
1887is expected to show a complete directory. You should specify @code{t} 1913listing is expected to show the full contents of a directory. You
1888when @var{file} is a directory and switches do not contain @samp{-d}. 1914should specify @code{t} when @var{file} is a directory and switches do
1889(The @samp{-d} option to @code{ls} says to describe a directory itself 1915not contain @samp{-d}. (The @samp{-d} option to @code{ls} says to
1890as a file, rather than showing its contents.) 1916describe a directory itself as a file, rather than showing its
1917contents.)
1891 1918
1892This function works by running a directory listing program whose name is 1919This function works by running a directory listing program whose name is
1893in the variable @code{insert-directory-program}. If @var{wildcard} is 1920in the variable @code{insert-directory-program}. If @var{wildcard} is
@@ -2230,7 +2257,7 @@ The argument @var{format} is a list of format names. If @var{format} is
2230@defvar auto-save-file-format 2257@defvar auto-save-file-format
2231This variable specifies the format to use for auto-saving. Its value is 2258This variable specifies the format to use for auto-saving. Its value is
2232a list of format names, just like the value of 2259a list of format names, just like the value of
2233@code{buffer-file-format}; but it is used instead of 2260@code{buffer-file-format}; however, it is used instead of
2234@code{buffer-file-format} for writing auto-save files. This variable 2261@code{buffer-file-format} for writing auto-save files. This variable is
2235is always buffer-local in all buffers. 2262always buffer-local in all buffers.
2236@end defvar 2263@end defvar
diff --git a/lispref/frames.texi b/lispref/frames.texi
index b5c641d891e..612a1a3ff64 100644
--- a/lispref/frames.texi
+++ b/lispref/frames.texi
@@ -13,11 +13,11 @@ perhaps a minibuffer window), which you can subdivide vertically or
13horizontally into smaller windows. 13horizontally into smaller windows.
14 14
15@cindex terminal frame 15@cindex terminal frame
16@cindex X window frame
17 When Emacs runs on a text-only terminal, it starts with one 16 When Emacs runs on a text-only terminal, it starts with one
18@dfn{terminal frame}. If you create additional ones, Emacs displays 17@dfn{terminal frame}. If you create additional ones, Emacs displays
19one and only one at any given time---on the terminal screen, of course. 18one and only one at any given time---on the terminal screen, of course.
20 19
20@cindex window frame
21 When Emacs communicates directly with a supported window system, such 21 When Emacs communicates directly with a supported window system, such
22as X Windows, it does not have a terminal frame; instead, it starts with 22as X Windows, it does not have a terminal frame; instead, it starts with
23a single @dfn{window frame}, but you can create more, and Emacs can 23a single @dfn{window frame}, but you can create more, and Emacs can
@@ -77,14 +77,14 @@ window system Emacs uses to display its frames. @xref{Window Frame
77Parameters}, for documentation of individual parameters you can specify. 77Parameters}, for documentation of individual parameters you can specify.
78@end defun 78@end defun
79 79
80@tindex before-make-frame-hook
81@defvar before-make-frame-hook 80@defvar before-make-frame-hook
81@tindex before-make-frame-hook
82A normal hook run by @code{make-frame} before it actually creates the 82A normal hook run by @code{make-frame} before it actually creates the
83frame. 83frame.
84@end defvar 84@end defvar
85 85
86@tindex after-make-frame-hook
87@defvar after-make-frame-hook 86@defvar after-make-frame-hook
87@tindex after-make-frame-hook
88An abnormal hook run by @code{make-frame} after it creates the frame. 88An abnormal hook run by @code{make-frame} after it creates the frame.
89Each function in @code{after-make-frame-hook} receives one argument, the 89Each function in @code{after-make-frame-hook} receives one argument, the
90frame just created. 90frame just created.
@@ -265,6 +265,11 @@ window frame; of these, @code{name}, @code{title}, @code{height},
265meaningful information in terminal frames. 265meaningful information in terminal frames.
266 266
267@table @code 267@table @code
268@item display
269The display on which to open this frame. It should be a string of the
270form @code{"@var{host}:@var{dpy}.@var{screen}"}, just like the
271@code{DISPLAY} environment variable.
272
268@item title 273@item title
269If a frame has a non-@code{nil} title, it appears in the window system's 274If a frame has a non-@code{nil} title, it appears in the window system's
270border for the frame, and also in the mode line of windows in that frame 275border for the frame, and also in the mode line of windows in that frame
@@ -283,11 +288,6 @@ If you specify the frame name explicitly when you create the frame, the
283name is also used (instead of the name of the Emacs executable) when 288name is also used (instead of the name of the Emacs executable) when
284looking up X resources for the frame. 289looking up X resources for the frame.
285 290
286@item display
287The display on which to open this frame. It should be a string of the
288form @code{"@var{host}:@var{dpy}.@var{screen}"}, just like the
289@code{DISPLAY} environment variable.
290
291@item left 291@item left
292The screen position of the left edge, in pixels, with respect to the 292The screen position of the left edge, in pixels, with respect to the
293left edge of the screen. The value may be a positive number @var{pos}, 293left edge of the screen. The value may be a positive number @var{pos},
@@ -382,7 +382,8 @@ ordered most-recently-selected first.
382 382
383@item font 383@item font
384The name of the font for displaying text in the frame. This is a 384The name of the font for displaying text in the frame. This is a
385string. 385string, either a valid font name for your system or the name of an Emacs
386fontset (@pxref{Fontsets}).
386 387
387@item auto-raise 388@item auto-raise
388Whether selecting the frame raises it (non-@code{nil} means yes). 389Whether selecting the frame raises it (non-@code{nil} means yes).
@@ -457,12 +458,14 @@ The default is 1. @xref{Menu Bar}. (In Emacs versions that use the X
457toolkit, there is only one menu bar line; all that matters about the 458toolkit, there is only one menu bar line; all that matters about the
458number you specify is whether it is greater than zero.) 459number you specify is whether it is greater than zero.)
459 460
461@ignore
460@item parent-id 462@item parent-id
461@c ??? Not yet working. 463@c ??? Not yet working.
462The X window number of the window that should be the parent of this one. 464The X window number of the window that should be the parent of this one.
463Specifying this lets you create an Emacs window inside some other 465Specifying this lets you create an Emacs window inside some other
464application's window. (It is not certain this will be implemented; try 466application's window. (It is not certain this will be implemented; try
465it and see if it works.) 467it and see if it works.)
468@end ignore
466@end table 469@end table
467 470
468@node Size and Position 471@node Size and Position
@@ -820,8 +823,8 @@ The redirection lasts until @code{redirect-frame-focus} is called to
820change it. 823change it.
821@end defun 824@end defun
822 825
823@tindex focus-follows-mouse
824@defopt focus-follows-mouse 826@defopt focus-follows-mouse
827@tindex focus-follows-mouse
825This option is how you inform Emacs whether the window manager transfers 828This option is how you inform Emacs whether the window manager transfers
826focus when the user moves the mouse. Non-@code{nil} says that it does. 829focus when the user moves the mouse. Non-@code{nil} says that it does.
827When this is so, the command @code{other-frame} moves the mouse to a 830When this is so, the command @code{other-frame} moves the mouse to a
@@ -895,12 +898,12 @@ on the screen.
895 898
896 You can raise and lower Emacs frame Windows with these functions: 899 You can raise and lower Emacs frame Windows with these functions:
897 900
898@deffn Command raise-frame frame 901@deffn Command raise-frame &optional frame
899This function raises frame @var{frame}. 902This function raises frame @var{frame} (default, the selected frame).
900@end deffn 903@end deffn
901 904
902@deffn Command lower-frame frame 905@deffn Command lower-frame &optional frame
903This function lowers frame @var{frame}. 906This function lowers frame @var{frame} (default, the selected frame).
904@end deffn 907@end deffn
905 908
906@defopt minibuffer-auto-raise 909@defopt minibuffer-auto-raise
@@ -1022,7 +1025,8 @@ the top left corner of the inside of @var{frame}.
1022This function @dfn{warps the mouse} to position @var{x}, @var{y} in 1025This function @dfn{warps the mouse} to position @var{x}, @var{y} in
1023frame @var{frame}. The arguments @var{x} and @var{y} are integers, 1026frame @var{frame}. The arguments @var{x} and @var{y} are integers,
1024giving the position in characters relative to the top left corner of the 1027giving the position in characters relative to the top left corner of the
1025inside of @var{frame}. 1028inside of @var{frame}. If @var{frame} is not visible, this function
1029does nothing. The return value is not significant.
1026@end defun 1030@end defun
1027 1031
1028@defun mouse-pixel-position 1032@defun mouse-pixel-position
@@ -1034,6 +1038,9 @@ coordinates in units of pixels rather than units of characters.
1034This function warps the mouse like @code{set-mouse-position} except that 1038This function warps the mouse like @code{set-mouse-position} except that
1035@var{x} and @var{y} are in units of pixels rather than units of 1039@var{x} and @var{y} are in units of pixels rather than units of
1036characters. These coordinates are not required to be within the frame. 1040characters. These coordinates are not required to be within the frame.
1041
1042If @var{frame} is not visible, this function does nothing. The return
1043value is not significant.
1037@end defun 1044@end defun
1038 1045
1039@need 3000 1046@need 3000
@@ -1266,6 +1273,101 @@ for @var{maximum} can make this function much faster, in cases where
1266many fonts match the pattern. 1273many fonts match the pattern.
1267@end defun 1274@end defun
1268 1275
1276@node Fontsets
1277@section Fontsets
1278
1279 A @dfn{fontset} is a list of fonts, each assigned to a range of
1280character codes. An individual font cannot display the whole range of
1281characters that Emacs supports, but a fontset can. Fontsets have names,
1282just as fonts do, and you can use a fontset name in place of a font name
1283when you specify the ``font'' for a frame or a face. Here is
1284information about defining a fontset under Lisp program control.
1285
1286@defun create-fontset-from-fontset-spec fontset-spec &optional style noerror
1287This function defines a new fontset according to the specification
1288string @var{fontset-spec}. The string should have this format:
1289
1290@smallexample
1291@var{fontpattern}, @r{[}@var{charsetname}:@var{fontname}@r{]@dots{}}
1292@end smallexample
1293
1294@noindent
1295Whitespace characters before and after the commas are ignored.
1296
1297The first part of the string, @var{fontpattern}, should have the form of
1298a standard X font name, except that the last two fields should be
1299@samp{fontset-@var{alias}}.
1300
1301Each fontset has two names, one long and one short. The long name is
1302@var{fontpattern} in its entirety. The short name is
1303@samp{fontset-@var{alias}}. You can refer to the fontset by either
1304name. If a fontset with the same name already exists, an error is
1305signaled, unless @var{noerror} is non-@code{nil}, in which case this
1306function does nothing.
1307
1308The specification string also says which fonts to use in the fontset.
1309See below for the details.
1310@end defun
1311
1312 If optional argument @var{style} is specified, it specifies a way to
1313modify the fontset. It should be one of @code{bold}, @code{italic}, and
1314@code{bold-italic}, and it says to find the bold, italic or bold-italic
1315version of each font if possible.
1316
1317 The construct @samp{@var{charset}:@var{font}} specifies which font to
1318use (in this fontset) for one particular character set. Here,
1319@var{charset} is the name of a character set, and @var{font} is the font
1320to use for that character set. You can use this construct any number of
1321times in the specification string.
1322
1323 For the remaining character sets, those that you don't specify
1324explicitly, Emacs chooses a font based on @var{fontpattern}: it replaces
1325@samp{fontset-@var{alias}} with a value that names one character set.
1326For the @sc{ASCII} character set, @samp{fontset-@var{alias}} is replaced
1327with @samp{ISO8859-1}.
1328
1329 In addition, when several consecutive fields are wildcards, Emacs
1330collapses them into a single wildcard. This is to prevent use of
1331auto-scaled fonts. Fonts made by scaling larger fonts are not usable
1332for editing, and scaling a smaller font is not useful because it is
1333better to use the smaller font in its own size, which Emacs does.
1334
1335 Thus if @var{fontpattern} is this,
1336
1337@example
1338-*-fixed-medium-r-normal-*-24-*-*-*-*-*-fontset-24
1339@end example
1340
1341@noindent
1342the font specification for ASCII characters would be this:
1343
1344@example
1345-*-fixed-medium-r-normal-*-24-*-ISO8859-1
1346@end example
1347
1348@noindent
1349and the font specification for Chinese GB2312 characters would be this:
1350
1351@example
1352-*-fixed-medium-r-normal-*-24-*-gb2312*-*
1353@end example
1354
1355 You may not have any Chinese font matching the above font
1356specification. Most X distributions include only Chinese fonts that
1357have @samp{song ti} or @samp{fangsong ti} in @var{family} field. In
1358such a case, @samp{Fontset-@var{n}} can be specified as below:
1359
1360@smallexample
1361Emacs.Fontset-0: -*-fixed-medium-r-normal-*-24-*-*-*-*-*-fontset-24,\
1362 chinese-gb2312:-*-*-medium-r-normal-*-24-*-gb2312*-*
1363@end smallexample
1364
1365@noindent
1366Then, the font specifications for all but Chinese GB2312 characters have
1367@samp{fixed} in the @var{family} field, and the font specification for
1368Chinese GB2312 characters has a wild card @samp{*} in the @var{family}
1369field.
1370
1269@node Color Names 1371@node Color Names
1270@section Color Names 1372@section Color Names
1271 1373
@@ -1422,7 +1524,7 @@ This function returns the number of color cells the screen supports.
1422 1524
1423@ignore 1525@ignore
1424@defvar x-no-window-manager 1526@defvar x-no-window-manager
1425This variable's value is is @code{t} if no X window manager is in use. 1527This variable's value is @code{t} if no X window manager is in use.
1426@end defvar 1528@end defvar
1427@end ignore 1529@end ignore
1428 1530
diff --git a/lispref/functions.texi b/lispref/functions.texi
index b770ac39f7c..510b3e1766d 100644
--- a/lispref/functions.texi
+++ b/lispref/functions.texi
@@ -54,11 +54,11 @@ such as @code{car} or @code{append}. These functions are also called
54@dfn{built-in} functions or @dfn{subrs}. (Special forms are also 54@dfn{built-in} functions or @dfn{subrs}. (Special forms are also
55considered primitives.) 55considered primitives.)
56 56
57Usually the reason we implement a function as a primitive is because it 57Usually the reason we implement a function as a primitive is either
58is fundamental, because it provides a low-level interface to operating 58because it is fundamental, because it provides a low-level interface to
59system services, or because it needs to run fast. Primitives can be 59operating system services, or because it needs to run fast. Primitives
60modified or added only by changing the C sources and recompiling the 60can be modified or added only by changing the C sources and recompiling
61editor. See @ref{Writing Emacs Primitives}. 61the editor. See @ref{Writing Emacs Primitives}.
62 62
63@item lambda expression 63@item lambda expression
64A @dfn{lambda expression} is a function written in Lisp. 64A @dfn{lambda expression} is a function written in Lisp.
@@ -110,8 +110,8 @@ A @dfn{byte-code function} is a function that has been compiled by the
110byte compiler. @xref{Byte-Code Type}. 110byte compiler. @xref{Byte-Code Type}.
111@end table 111@end table
112 112
113@tindex functionp
114@defun functionp object 113@defun functionp object
114@tindex functionp
115This function returns @code{t} if @var{object} is any kind of function, 115This function returns @code{t} if @var{object} is any kind of function,
116or a special form or macro. 116or a special form or macro.
117@end defun 117@end defun
@@ -458,11 +458,13 @@ one symbol, this is just a matter of convenience. It is easy to store
458it in several symbols using @code{fset}; then each of the symbols is 458it in several symbols using @code{fset}; then each of the symbols is
459equally well a name for the same function. 459equally well a name for the same function.
460 460
461 A symbol used as a function name may also be used as a variable; 461 A symbol used as a function name may also be used as a variable; these
462these two uses of a symbol are independent and do not conflict. 462two uses of a symbol are independent and do not conflict. (Some Lisp
463(Some Lisp dialects, such as Scheme, do not distinguish between a 463dialects, such as Scheme, do not distinguish between a symbol's value
464symbol's value and its function definition; a symbol's value as a variable 464and its function definition; a symbol's value as a variable is also its
465is also its function definition.) 465function definition.) If you have not given a symbol a function
466definition, you cannot use it as a function; whether the symbol has a
467value as a variable makes no difference to this.
466 468
467@node Defining Functions 469@node Defining Functions
468@section Defining Functions 470@section Defining Functions
@@ -581,7 +583,7 @@ which function to call, and how many arguments to give it, when you
581write the program. Usually that's just what you want. Occasionally you 583write the program. Usually that's just what you want. Occasionally you
582need to compute at run time which function to call. To do that, use the 584need to compute at run time which function to call. To do that, use the
583function @code{funcall}. When you also need to determine at run time 585function @code{funcall}. When you also need to determine at run time
584how may arguments to pass, use @code{apply}. 586how many arguments to pass, use @code{apply}.
585 587
586@defun funcall function &rest arguments 588@defun funcall function &rest arguments
587@code{funcall} calls @var{function} with @var{arguments}, and returns 589@code{funcall} calls @var{function} with @var{arguments}, and returns
@@ -846,7 +848,8 @@ of simple quotation to quote the anonymous function, like this:
846@example 848@example
847@group 849@group
848(defun double-property (symbol prop) 850(defun double-property (symbol prop)
849 (change-property symbol prop (function (lambda (x) (* 2 x))))) 851 (change-property symbol prop
852 (function (lambda (x) (* 2 x)))))
850@end group 853@end group
851@end example 854@end example
852 855
@@ -864,7 +867,7 @@ definition which uses ordinary @code{quote}, the argument passed to
864@noindent 867@noindent
865The Lisp compiler cannot assume this list is a function, even though it 868The Lisp compiler cannot assume this list is a function, even though it
866looks like one, since it does not know what @code{change-property} will 869looks like one, since it does not know what @code{change-property} will
867do with the list. Perhaps will check whether the @sc{car} of the third 870do with the list. Perhaps it will check whether the @sc{car} of the third
868element is the symbol @code{*}! Using @code{function} tells the 871element is the symbol @code{*}! Using @code{function} tells the
869compiler it is safe to go ahead and compile the constant function. 872compiler it is safe to go ahead and compile the constant function.
870 873
@@ -876,6 +879,20 @@ comment:
876(function @var{symbol}) @equiv{} (quote @var{symbol}) @equiv{} '@var{symbol} 879(function @var{symbol}) @equiv{} (quote @var{symbol}) @equiv{} '@var{symbol}
877@end example 880@end example
878 881
882 The read syntax @code{#'} is a short-hand for using @code{function}.
883For example,
884
885@example
886#'(lambda (x) (* x x))
887@end example
888
889@noindent
890is equivalent to
891
892@example
893(function (lambda (x) (* x x)))
894@end example
895
879@defspec function function-object 896@defspec function function-object
880@cindex function quoting 897@cindex function quoting
881This special form returns @var{function-object} without evaluating it. 898This special form returns @var{function-object} without evaluating it.
@@ -952,7 +969,7 @@ is a legitimate function.
952@defun fmakunbound symbol 969@defun fmakunbound symbol
953This function makes @var{symbol}'s function cell void, so that a 970This function makes @var{symbol}'s function cell void, so that a
954subsequent attempt to access this cell will cause a @code{void-function} 971subsequent attempt to access this cell will cause a @code{void-function}
955error. (See also @code{makunbound}, in @ref{Local Variables}.) 972error. (See also @code{makunbound}, in @ref{Void Variables}.)
956 973
957@example 974@example
958@group 975@group
diff --git a/lispref/help.texi b/lispref/help.texi
index d31315c0ef1..cde0956b5be 100644
--- a/lispref/help.texi
+++ b/lispref/help.texi
@@ -415,6 +415,15 @@ Emacs buffers are usually displayed).
415@end smallexample 415@end smallexample
416@end defun 416@end defun
417 417
418@defun read-kbd-macro string
419This function is used mainly for operating on keyboard macros, but it
420can also be used as a rough inverse for @code{key-description}. You
421call it with a string containing key descriptions, separated by spaces;
422it returns a string or vector containing the corresponding events.
423(This may or may not be a single valid key sequence, depending on what
424events you use; @pxref{Keymap Terminology}.)
425@end defun
426
418@node Help Functions 427@node Help Functions
419@section Help Functions 428@section Help Functions
420 429
@@ -431,8 +440,9 @@ named @samp{*Help*}, each with a one-line description taken from the
431beginning of its documentation string. 440beginning of its documentation string.
432 441
433@c Emacs 19 feature 442@c Emacs 19 feature
434If @var{do-all} is non-@code{nil}, then @code{apropos} also shows 443If @var{do-all} is non-@code{nil}, then @code{apropos} also shows key
435key bindings for the functions that are found. 444bindings for the functions that are found; it also shows all symbols,
445even those that are neither functions nor variables.
436 446
437In the first of the following examples, @code{apropos} finds all the 447In the first of the following examples, @code{apropos} finds all the
438symbols with names containing @samp{exec}. (We don't show here the 448symbols with names containing @samp{exec}. (We don't show here the
@@ -481,10 +491,10 @@ Documentation}.
481 491
482@defvar help-char 492@defvar help-char
483The value of this variable is the help character---the character that 493The value of this variable is the help character---the character that
484Emacs recognizes as meaning Help. By default, it stands for 8, which is 494Emacs recognizes as meaning Help. By default, its value is 8, which
485@kbd{C-h}. When Emacs reads this character, if @code{help-form} is 495stands for @kbd{C-h}. When Emacs reads this character, if
486non-@code{nil} Lisp expression, it evaluates that expression, and 496@code{help-form} is a non-@code{nil} Lisp expression, it evaluates that
487displays the result in a window if it is a string. 497expression, and displays the result in a window if it is a string.
488 498
489Usually the value of @code{help-form}'s value is @code{nil}. Then the 499Usually the value of @code{help-form}'s value is @code{nil}. Then the
490help character has no special meaning at the level of command input, and 500help character has no special meaning at the level of command input, and
@@ -498,8 +508,8 @@ binding as a subcommand of the prefix key, it runs
498subcommands of the prefix key. 508subcommands of the prefix key.
499@end defvar 509@end defvar
500 510
501@tindex help-event-list
502@defvar help-event-list 511@defvar help-event-list
512@tindex help-event-list
503The value of this variable is a list of event types that serve as 513The value of this variable is a list of event types that serve as
504alternative ``help characters.'' These events are handled just like the 514alternative ``help characters.'' These events are handled just like the
505event specified by @code{help-char}. 515event specified by @code{help-char}.
@@ -534,11 +544,10 @@ prefix described consists of all but the last event of that key
534sequence. (The last event is, presumably, the help character.) 544sequence. (The last event is, presumably, the help character.)
535@end defun 545@end defun
536 546
537 The following two functions are found in the library @file{helper}. 547 The following two functions are meant for modes that want to provide
538They are for modes that want to provide help without relinquishing 548help without relinquishing control, such as the ``electric'' modes.
539control, such as the ``electric'' modes. You must load that library 549Their names begin with @samp{Helper} to distinguish them from the
540with @code{(require 'helper)} in order to use them. Their names begin 550ordinary help functions.
541with @samp{Helper} to distinguish them from the ordinary help functions.
542 551
543@deffn Command Helper-describe-bindings 552@deffn Command Helper-describe-bindings
544This command pops up a window displaying a help buffer containing a 553This command pops up a window displaying a help buffer containing a
diff --git a/lispref/hooks.texi b/lispref/hooks.texi
index 6b0019146d6..b6904d2b7f7 100644
--- a/lispref/hooks.texi
+++ b/lispref/hooks.texi
@@ -30,7 +30,7 @@ however, we have renamed all of those.)
30 30
31@c !!! need xref to where each hook is documented or else document it 31@c !!! need xref to where each hook is documented or else document it
32@c by specifying what is expected, and when it is called relative to 32@c by specifying what is expected, and when it is called relative to
33@c mode initialization.) 33@c mode initialization.
34 34
35@table @code 35@table @code
36@item activate-mark-hook 36@item activate-mark-hook
diff --git a/lispref/internals.texi b/lispref/internals.texi
index 74d019d2039..33f5cb26dbd 100644
--- a/lispref/internals.texi
+++ b/lispref/internals.texi
@@ -302,6 +302,14 @@ The number of floats in use.
302@c Emacs 19 feature 302@c Emacs 19 feature
303The number of floats for which space has been obtained from the 303The number of floats for which space has been obtained from the
304operating system, but that are not currently being used. 304operating system, but that are not currently being used.
305
306@item used-intervals
307The number of intervals in use. Intervals are an internal
308data structure used for representing text properties.
309
310@item free-intervals
311The number of intervals for which space has been obtained
312from the operating system, but that are not currently being used.
305@end table 313@end table
306@end deffn 314@end deffn
307 315
@@ -778,7 +786,7 @@ This field is non-@code{nil} if the buffer's mark is active.
778@item local_var_alist 786@item local_var_alist
779This field contains the association list describing the buffer-local 787This field contains the association list describing the buffer-local
780variable bindings of this buffer, not including the built-in 788variable bindings of this buffer, not including the built-in
781buffer-local bindings that that have special slots in the buffer object. 789buffer-local bindings that have special slots in the buffer object.
782(Those slots are omitted from this table.) @xref{Buffer-Local 790(Those slots are omitted from this table.) @xref{Buffer-Local
783Variables}. 791Variables}.
784 792
diff --git a/lispref/intro.texi b/lispref/intro.texi
index 6d2d63981eb..d6471a4ced1 100644
--- a/lispref/intro.texi
+++ b/lispref/intro.texi
@@ -418,12 +418,17 @@ closely integrated with the editing facilities; thus, editing commands
418are functions that can also conveniently be called from Lisp programs, 418are functions that can also conveniently be called from Lisp programs,
419and parameters for customization are ordinary Lisp variables. 419and parameters for customization are ordinary Lisp variables.
420 420
421 This manual describes Emacs Lisp, presuming considerable familiarity 421 This manual attempts to be a full description of Emacs Lisp. For a
422with the use of Emacs for editing. (See @cite{The GNU Emacs Manual} 422beginner's introduction to Emacs Lisp, see @cite{An Introduction to
423for this basic information.) Generally speaking, the earlier chapters 423Emacs Lisp Programming}, by Bob Chassell, also published by the Free
424describe features of Emacs Lisp that have counterparts in many 424Software Foundation. This manual presumes considerable familiarity with
425programming languages, and later chapters describe features that are 425the use of Emacs for editing; see @cite{The GNU Emacs Manual} for this
426peculiar to Emacs Lisp or relate specifically to editing. 426basic information.
427
428 Generally speaking, the earlier chapters describe features of Emacs
429Lisp that have counterparts in many programming languages, and later
430chapters describe features that are peculiar to Emacs Lisp or relate
431specifically to editing.
427 432
428 This is edition 2.5. 433 This is edition 2.5.
429 434
@@ -431,6 +436,7 @@ peculiar to Emacs Lisp or relate specifically to editing.
431* Caveats:: Flaws and a request for help. 436* Caveats:: Flaws and a request for help.
432* Lisp History:: Emacs Lisp is descended from Maclisp. 437* Lisp History:: Emacs Lisp is descended from Maclisp.
433* Conventions:: How the manual is formatted. 438* Conventions:: How the manual is formatted.
439* Version Info:: Which Emacs version is running?
434* Acknowledgements:: The authors, editors, and sponsors of this manual. 440* Acknowledgements:: The authors, editors, and sponsors of this manual.
435@end menu 441@end menu
436 442
@@ -474,7 +480,7 @@ which you are criticizing.
474Please mail comments and corrections to 480Please mail comments and corrections to
475 481
476@example 482@example
477bug-lisp-manual@@prep.ai.mit.edu 483bug-lisp-manual@@gnu.org
478@end example 484@end example
479 485
480@noindent 486@noindent
@@ -483,7 +489,7 @@ apply the corrections. Months, and sometimes years, go by between
483updates. So please attach no significance to the lack of a reply---your 489updates. So please attach no significance to the lack of a reply---your
484mail @emph{will} be acted on in due time. If you want to contact the 490mail @emph{will} be acted on in due time. If you want to contact the
485Emacs maintainers more quickly, send mail to 491Emacs maintainers more quickly, send mail to
486@code{bug-gnu-emacs@@prep.ai.mit.edu}. 492@code{bug-gnu-emacs@@gnu.org}.
487 493
488@display 494@display
489 --Bil Lewis, Dan LaLiberte, Richard Stallman 495 --Bil Lewis, Dan LaLiberte, Richard Stallman
@@ -493,33 +499,38 @@ Emacs maintainers more quickly, send mail to
493@section Lisp History 499@section Lisp History
494@cindex Lisp history 500@cindex Lisp history
495 501
496 Lisp (LISt Processing language) was first developed in the late 1950's 502 Lisp (LISt Processing language) was first developed in the late 1950s
497at the Massachusetts Institute of Technology for research in artificial 503at the Massachusetts Institute of Technology for research in artificial
498intelligence. The great power of the Lisp language makes it superior 504intelligence. The great power of the Lisp language makes it ideal
499for other purposes as well, such as writing editing commands. 505for other purposes as well, such as writing editing commands.
500 506
501@cindex Maclisp 507@cindex Maclisp
502@cindex Common Lisp 508@cindex Common Lisp
503 Dozens of Lisp implementations have been built over the years, each 509 Dozens of Lisp implementations have been built over the years, each
504with its own idiosyncrasies. Many of them were inspired by Maclisp, 510with its own idiosyncrasies. Many of them were inspired by Maclisp,
505which was written in the 1960's at MIT's Project MAC. Eventually the 511which was written in the 1960s at MIT's Project MAC. Eventually the
506implementors of the descendants of Maclisp came together and developed a 512implementors of the descendants of Maclisp came together and developed a
507standard for Lisp systems, called Common Lisp. In the mean time, Gerry 513standard for Lisp systems, called Common Lisp. In the meantime, Gerry
508Sussman and Guy Steele at MIT developed a simplified but very powerful 514Sussman and Guy Steele at MIT developed a simplified but very powerful
509dialect of Lisp, called Scheme. 515dialect of Lisp, called Scheme.
510 516
511 GNU Emacs Lisp is largely inspired by Maclisp, and a little by Common 517 GNU Emacs Lisp is largely inspired by Maclisp, and a little by Common
512Lisp. If you know Common Lisp, you will notice many similarities. 518Lisp. If you know Common Lisp, you will notice many similarities.
513However, many of the features of Common Lisp have been omitted or 519However, many features of Common Lisp have been omitted or
514simplified in order to reduce the memory requirements of GNU Emacs. 520simplified in order to reduce the memory requirements of GNU Emacs.
515Sometimes the simplifications are so drastic that a Common Lisp user 521Sometimes the simplifications are so drastic that a Common Lisp user
516might be very confused. We will occasionally point out how GNU Emacs 522might be very confused. We will occasionally point out how GNU Emacs
517Lisp differs from Common Lisp. If you don't know Common Lisp, don't 523Lisp differs from Common Lisp. If you don't know Common Lisp, don't
518worry about it; this manual is self-contained. 524worry about it; this manual is self-contained.
519 525
526@pindex cl
527 A certain amount of Common Lisp emulation is available via the
528@file{cl} library @xref{Top,, Common Lisp Extension, cl, Common Lisp
529Extensions}.
530
520 Emacs Lisp is not at all influenced by Scheme; but the GNU project has 531 Emacs Lisp is not at all influenced by Scheme; but the GNU project has
521an implementation of Scheme, called Guile. We use Guile for 532an implementation of Scheme, called Guile. We use Guile in all new GNU
522extensibility in all new GNU software that calls for extensibility. 533software that calls for extensibility.
523 534
524@node Conventions 535@node Conventions
525@section Conventions 536@section Conventions
@@ -531,23 +542,22 @@ manual. You may want to skip this section and refer back to it later.
531* Some Terms:: Explanation of terms we use in this manual. 542* Some Terms:: Explanation of terms we use in this manual.
532* nil and t:: How the symbols @code{nil} and @code{t} are used. 543* nil and t:: How the symbols @code{nil} and @code{t} are used.
533* Evaluation Notation:: The format we use for examples of evaluation. 544* Evaluation Notation:: The format we use for examples of evaluation.
534* Printing Notation:: The format we use for examples that print output. 545* Printing Notation:: The format we use when examples print text.
535* Error Messages:: The format we use for examples of errors. 546* Error Messages:: The format we use for examples of errors.
536* Buffer Text Notation:: The format we use for buffer contents in examples. 547* Buffer Text Notation:: The format we use for buffer contents in examples.
537* Format of Descriptions:: Notation for describing functions, variables, etc. 548* Format of Descriptions:: Notation for describing functions, variables, etc.
538* Version Info:: Which Emacs version is running?
539@end menu 549@end menu
540 550
541@node Some Terms 551@node Some Terms
542@subsection Some Terms 552@subsection Some Terms
543 553
544 Throughout this manual, the phrases ``the Lisp reader'' and ``the Lisp 554 Throughout this manual, the phrases ``the Lisp reader'' and ``the Lisp
545printer'' are used to refer to those routines in Lisp that convert 555printer'' refer to those routines in Lisp that convert textual
546textual representations of Lisp objects into actual Lisp objects, and vice 556representations of Lisp objects into actual Lisp objects, and vice
547versa. @xref{Printed Representation}, for more details. You, the 557versa. @xref{Printed Representation}, for more details. You, the
548person reading this manual, are thought of as ``the programmer'' and are 558person reading this manual, are thought of as ``the programmer'' and are
549addressed as ``you''. ``The user'' is the person who uses Lisp programs, 559addressed as ``you''. ``The user'' is the person who uses Lisp
550including those you write. 560programs, including those you write.
551 561
552@cindex fonts 562@cindex fonts
553 Examples of Lisp code appear in this font or form: @code{(list 1 2 563 Examples of Lisp code appear in this font or form: @code{(list 1 2
@@ -590,7 +600,8 @@ in Lisp programs also.
590is considered to be @var{true}. However, @code{t} is the preferred way 600is considered to be @var{true}. However, @code{t} is the preferred way
591to represent the truth value @var{true}. When you need to choose a 601to represent the truth value @var{true}. When you need to choose a
592value which represents @var{true}, and there is no other basis for 602value which represents @var{true}, and there is no other basis for
593choosing, use @code{t}. The symbol @code{t} always has value @code{t}. 603choosing, use @code{t}. The symbol @code{t} always has the value
604@code{t}.
594 605
595 In Emacs Lisp, @code{nil} and @code{t} are special symbols that always 606 In Emacs Lisp, @code{nil} and @code{t} are special symbols that always
596evaluate to themselves. This is so that you do not need to quote them 607evaluate to themselves. This is so that you do not need to quote them
@@ -618,7 +629,7 @@ You can read this as ``@code{(car '(1 2))} evaluates to 1''.
618 629
619 When a form is a macro call, it expands into a new form for Lisp to 630 When a form is a macro call, it expands into a new form for Lisp to
620evaluate. We show the result of the expansion with 631evaluate. We show the result of the expansion with
621@samp{@expansion{}}. We may or may not show the actual result of the 632@samp{@expansion{}}. We may or may not show the result of the
622evaluation of the expanded form. 633evaluation of the expanded form.
623 634
624@example 635@example
@@ -741,10 +752,11 @@ indicates that the subsequent arguments may be omitted (omitted
741arguments default to @code{nil}). Do not write @code{&optional} when 752arguments default to @code{nil}). Do not write @code{&optional} when
742you call the function. 753you call the function.
743 754
744 The keyword @code{&rest} (which will always be followed by a single 755 The keyword @code{&rest} (which must be followed by a single argument
745argument name) indicates that any number of arguments can follow. The value 756name) indicates that any number of arguments can follow. The single
746of the single following arguments name will be a list of all these arguments. 757following argument name will have a value, as a variable, which is a
747Do not write @code{&rest} when you call the function. 758list of all these remaining arguments. Do not write @code{&rest} when
759you call the function.
748 760
749 Here is a description of an imaginary function @code{foo}: 761 Here is a description of an imaginary function @code{foo}:
750 762
@@ -791,7 +803,7 @@ interactively; macros process their arguments differently from functions
791 Special form descriptions use a more complex notation to specify 803 Special form descriptions use a more complex notation to specify
792optional and repeated arguments because they can break the argument 804optional and repeated arguments because they can break the argument
793list down into separate arguments in more complicated ways. 805list down into separate arguments in more complicated ways.
794@samp{@code{@r{[}@var{optional-arg}@r{]}}} means that @var{optional-arg} is 806@samp{@r{[}@var{optional-arg}@r{]}} means that @var{optional-arg} is
795optional and @samp{@var{repeated-args}@dots{}} stands for zero or more 807optional and @samp{@var{repeated-args}@dots{}} stands for zero or more
796arguments. Parentheses are used when several arguments are grouped into 808arguments. Parentheses are used when several arguments are grouped into
797additional levels of list structure. Here is an example: 809additional levels of list structure. Here is an example:
@@ -800,7 +812,7 @@ additional levels of list structure. Here is an example:
800This imaginary special form implements a loop that executes the 812This imaginary special form implements a loop that executes the
801@var{body} forms and then increments the variable @var{var} on each 813@var{body} forms and then increments the variable @var{var} on each
802iteration. On the first iteration, the variable has the value 814iteration. On the first iteration, the variable has the value
803@var{from}; on subsequent iterations, it is incremented by 1 (or by 815@var{from}; on subsequent iterations, it is incremented by one (or by
804@var{inc} if that is given). The loop exits before executing @var{body} 816@var{inc} if that is given). The loop exits before executing @var{body}
805if @var{var} equals @var{to}. Here is an example: 817if @var{var} equals @var{to}. Here is an example:
806 818
@@ -811,7 +823,7 @@ if @var{var} equals @var{to}. Here is an example:
811 (terpri)) 823 (terpri))
812@end example 824@end example
813 825
814If @var{from} and @var{to} are omitted, then @var{var} is bound to 826If @var{from} and @var{to} are omitted, @var{var} is bound to
815@code{nil} before the loop begins, and the loop exits if @var{var} is 827@code{nil} before the loop begins, and the loop exits if @var{var} is
816non-@code{nil} at the beginning of an iteration. Here is an example: 828non-@code{nil} at the beginning of an iteration. Here is an example:
817 829
@@ -855,33 +867,34 @@ replaced by `User Option'.
855@node Version Info 867@node Version Info
856@section Version Information 868@section Version Information
857 869
858 These functions and variables provide information about which 870 These facilities provide information about which version of Emacs is
859version of Emacs is in use. 871in use.
860 872
861@deffn Command emacs-version 873@deffn Command emacs-version
862This function returns a string describing the version of Emacs that is 874This function returns a string describing the version of Emacs that is
863running. It is useful to include this string in bug reports. 875running. It is useful to include this string in bug reports.
864 876
865@example 877@smallexample
866@group 878@group
867(emacs-version) 879(emacs-version)
868 @result{} "GNU Emacs 20.3.5 (i486-pc-linux-gnulibc1, X toolkit) 880 @result{} "GNU Emacs 20.3.5 (i486-pc-linux-gnulibc1, X toolkit)
869 of Sat Feb 14 1998 on psilocin.gnu.org" 881 of Sat Feb 14 1998 on psilocin.gnu.org"
870@end group 882@end group
871@end example 883@end smallexample
872 884
873Called interactively, the function prints the same information in the 885Called interactively, the function prints the same information in the
874echo area. 886echo area.
875@end deffn 887@end deffn
876 888
877@defvar emacs-build-time 889@defvar emacs-build-time
878The value of this variable is the time at which Emacs was built at the 890The value of this variable indicates the time at which Emacs was built
879local site. 891at the local site. It is a list of three integers, like the value
892of @code{current-time} (@pxref{Time of Day}).
880 893
881@example 894@example
882@group 895@group
883emacs-build-time 896emacs-build-time
884 @result{} "Tue Jun 6 14:55:57 1995" 897 @result{} (13623 62065 344633)
885@end group 898@end group
886@end example 899@end example
887@end defvar 900@end defvar
@@ -893,7 +906,7 @@ really part of the Emacs release version number; it is incremented each
893time you build Emacs in any given directory. 906time you build Emacs in any given directory.
894@end defvar 907@end defvar
895 908
896 The following two variables have existed since Emacs version 19.23, 909 The following two variables have existed since Emacs version 19.23:
897 910
898@defvar emacs-major-version 911@defvar emacs-major-version
899The major version number of Emacs, as an integer. For Emacs version 912The major version number of Emacs, as an integer. For Emacs version
diff --git a/lispref/keymaps.texi b/lispref/keymaps.texi
index 7e6cc59cecc..d29878d3288 100644
--- a/lispref/keymaps.texi
+++ b/lispref/keymaps.texi
@@ -133,11 +133,11 @@ keymaps}.
133When a keymap contains a vector, it always defines a binding for each 133When a keymap contains a vector, it always defines a binding for each
134@sc{ASCII} character, even if the vector contains @code{nil} for that 134@sc{ASCII} character, even if the vector contains @code{nil} for that
135character. Such a binding of @code{nil} overrides any default key 135character. Such a binding of @code{nil} overrides any default key
136binding in the keymap. However, default bindings are still meaningful 136binding in the keymap, for @sc{ASCII} characters. However, default
137for events that are not @sc{ASCII} characters. A binding of @code{nil} 137bindings are still meaningful for events other than @sc{ASCII}
138does @emph{not} override lower-precedence keymaps; thus, if the local 138characters. A binding of @code{nil} does @emph{not} override
139map gives a binding of @code{nil}, Emacs uses the binding from the 139lower-precedence keymaps; thus, if the local map gives a binding of
140global map. 140@code{nil}, Emacs uses the binding from the global map.
141 141
142@item @var{string} 142@item @var{string}
143@cindex keymap prompt string 143@cindex keymap prompt string
@@ -350,7 +350,7 @@ This map is also the function definition of @code{ESC-prefix}.
350 350
351@item 351@item
352@cindex @kbd{C-h} 352@cindex @kbd{C-h}
353@code{help-map} is the global definitions for the @kbd{C-h} prefix key. 353@code{help-map} is the global keymap for the @kbd{C-h} prefix key.
354 354
355@item 355@item
356@cindex @kbd{C-c} 356@cindex @kbd{C-c}
@@ -365,8 +365,8 @@ mode-specific bindings.
365@cindex @kbd{C-x} 365@cindex @kbd{C-x}
366@vindex ctl-x-map 366@vindex ctl-x-map
367@findex Control-X-prefix 367@findex Control-X-prefix
368@code{ctl-x-map} is the global key map used for the @kbd{C-x} prefix 368@code{ctl-x-map} is the global keymap used for the @kbd{C-x} prefix key.
369key. This map is found via the function definition of the symbol 369This map is found via the function cell of the symbol
370@code{Control-X-prefix}. 370@code{Control-X-prefix}.
371 371
372@item 372@item
@@ -395,7 +395,7 @@ that have no special names.
395that follows the prefix key. (It may instead be a symbol whose function 395that follows the prefix key. (It may instead be a symbol whose function
396definition is a keymap. The effect is the same, but the symbol serves 396definition is a keymap. The effect is the same, but the symbol serves
397as a name for the prefix key.) Thus, the binding of @kbd{C-x} is the 397as a name for the prefix key.) Thus, the binding of @kbd{C-x} is the
398symbol @code{Control-X-prefix}, whose function definition is the keymap 398symbol @code{Control-X-prefix}, whose function cell holds the keymap
399for @kbd{C-x} commands. (The same keymap is also the value of 399for @kbd{C-x} commands. (The same keymap is also the value of
400@code{ctl-x-map}.) 400@code{ctl-x-map}.)
401 401
@@ -472,7 +472,7 @@ local keymap is always active except when @code{overriding-local-map}
472overrides it. Text properties can specify an alternative local map for 472overrides it. Text properties can specify an alternative local map for
473certain parts of the buffer; see @ref{Special Properties}. 473certain parts of the buffer; see @ref{Special Properties}.
474 474
475 Each minor mode may have a keymap; if it does, the keymap is active 475 Each minor mode can have a keymap; if it does, the keymap is active
476when the minor mode is enabled. 476when the minor mode is enabled.
477 477
478 The variable @code{overriding-local-map}, if non-@code{nil}, specifies 478 The variable @code{overriding-local-map}, if non-@code{nil}, specifies
@@ -485,11 +485,12 @@ order of decreasing precedence, until it finds a binding in one of the
485maps. The procedure for searching a single keymap is called @dfn{key 485maps. The procedure for searching a single keymap is called @dfn{key
486lookup}; see @ref{Key Lookup}. 486lookup}; see @ref{Key Lookup}.
487 487
488Normally, Emacs first searches for the key in the minor mode 488 Normally, Emacs first searches for the key in the minor mode maps, in
489maps (one map at a time); if they do not supply a binding for the key, 489the order specified by @code{minor-mode-map-alist}; if they do not
490Emacs searches the local map; if that too has no binding, Emacs then 490supply a binding for the key, Emacs searches the local map; if that too
491searches the global map. However, if @code{overriding-local-map} is 491has no binding, Emacs then searches the global map. However, if
492non-@code{nil}, Emacs searches that map first, before the global map. 492@code{overriding-local-map} is non-@code{nil}, Emacs searches that map
493first, before the global map.
493 494
494@cindex major mode keymap 495@cindex major mode keymap
495 Since every buffer that uses the same major mode normally uses the 496 Since every buffer that uses the same major mode normally uses the
@@ -506,6 +507,9 @@ only when the mode is used for the first time in a session.
506 The minibuffer has local keymaps, too; they contain various completion 507 The minibuffer has local keymaps, too; they contain various completion
507and exit commands. @xref{Intro to Minibuffers}. 508and exit commands. @xref{Intro to Minibuffers}.
508 509
510 Emacs has other keymaps that are used in a different way---translating
511events within @code{read-key-sequence}. @xref{Translating Input}.
512
509 @xref{Standard Keymaps}, for a list of standard keymaps. 513 @xref{Standard Keymaps}, for a list of standard keymaps.
510 514
511@defvar global-map 515@defvar global-map
@@ -604,14 +608,17 @@ modes. See also @code{minor-mode-key-binding} (@pxref{Functions for Key
604Lookup}). 608Lookup}).
605@end defvar 609@end defvar
606 610
607@tindex minor-mode-overriding-map-alist
608@defvar minor-mode-overriding-map-alist 611@defvar minor-mode-overriding-map-alist
612@tindex minor-mode-overriding-map-alist
609This variable allows major modes to override the key bindings for 613This variable allows major modes to override the key bindings for
610particular minor modes. The elements of this alist look like the 614particular minor modes. The elements of this alist look like the
611elements of @code{minor-mode-map-alist}: @code{(@var{variable} 615elements of @code{minor-mode-map-alist}: @code{(@var{variable}
612. @var{keymap})}. If a variable appears an element 616. @var{keymap})}.
613@code{minor-mode-overriding-map-alist}, that element overrides any 617
614element for the same variable in @code{minor-mode-map-alist}. 618If a variable appears an element of
619@code{minor-mode-overriding-map-alist}, the map specified by that
620element totally replaces any map specified for the same variable in
621@code{minor-mode-map-alist}.
615 622
616@code{minor-mode-overriding-map-alist} is automatically buffer-local in 623@code{minor-mode-overriding-map-alist} is automatically buffer-local in
617all buffers. 624all buffers.
@@ -1414,7 +1421,7 @@ an indirect definition itself.
1414@end smallexample 1421@end smallexample
1415@end defun 1422@end defun
1416 1423
1417@deffn Command describe-bindings prefix 1424@deffn Command describe-bindings &optional prefix
1418This function creates a listing of all current key bindings, and 1425This function creates a listing of all current key bindings, and
1419displays it in a buffer named @samp{*Help*}. The text is grouped by 1426displays it in a buffer named @samp{*Help*}. The text is grouped by
1420modes---minor modes first, then the major mode, then global bindings. 1427modes---minor modes first, then the major mode, then global bindings.
@@ -1475,8 +1482,12 @@ an existing menu, you can specify its position in the menu using
1475@code{define-key-after} (@pxref{Modifying Menus}). 1482@code{define-key-after} (@pxref{Modifying Menus}).
1476 1483
1477@menu 1484@menu
1478* Simple Menu Items:: 1485* Simple Menu Items:: A simple kind of menu key binding,
1479* Extended Menu Items:: 1486 limited in capabilities.
1487* Alias Menu Items:: Using command aliases in menu items.
1488* Extended Menu Items:: More powerful menu item definitions
1489 let you specify keywords to enable
1490 various features.
1480@end menu 1491@end menu
1481 1492
1482@node Simple Menu Items 1493@node Simple Menu Items
@@ -1489,6 +1500,7 @@ looks like this:
1489(@var{item-string} . @var{real-binding}) 1500(@var{item-string} . @var{real-binding})
1490@end example 1501@end example
1491 1502
1503@noindent
1492The @sc{car}, @var{item-string}, is the string to be displayed in the 1504The @sc{car}, @var{item-string}, is the string to be displayed in the
1493menu. It should be short---preferably one to three words. It should 1505menu. It should be short---preferably one to three words. It should
1494describe the action of the command it corresponds to. 1506describe the action of the command it corresponds to.
@@ -1540,35 +1552,9 @@ Don't put these sublists in the menu item yourself; menu display
1540calculates them automatically. Don't mention keyboard equivalents in 1552calculates them automatically. Don't mention keyboard equivalents in
1541the item strings themselves, since that is redundant. 1553the item strings themselves, since that is redundant.
1542 1554
1543Sometimes it is useful to make menu items that use the ``same'' command
1544but with different enable conditions. You can do this by defining alias
1545commands. Here's an example that makes two aliases for
1546@code{toggle-read-only} and gives them different enable conditions:
1547
1548@example
1549(defalias 'make-read-only 'toggle-read-only)
1550(put 'make-read-only 'menu-enable '(not buffer-read-only))
1551(defalias 'make-writable 'toggle-read-only)
1552(put 'make-writable 'menu-enable 'buffer-read-only)
1553@end example
1554
1555When using aliases in menus, often it is useful to display the
1556equivalent key bindings for the ``real'' command name, not the aliases
1557(which typically don't have any key bindings except for the menu
1558itself). To request this, give the alias symbol a non-@code{nil}
1559@code{menu-alias} property. Thus,
1560
1561@example
1562(put 'make-read-only 'menu-alias t)
1563(put 'make-writable 'menu-alias t)
1564@end example
1565
1566@noindent
1567causes menu items for @code{make-read-only} and @code{make-writable} to
1568show the keyboard bindings for @code{toggle-read-only}.
1569
1570@node Extended Menu Items 1555@node Extended Menu Items
1571@subsubsection Extended Menu Items 1556@subsubsection Extended Menu Items
1557@kindex menu-item
1572 1558
1573 An extended-format menu item is a more flexible and also cleaner 1559 An extended-format menu item is a more flexible and also cleaner
1574alternative to the simple format. It consists of a list that starts 1560alternative to the simple format. It consists of a list that starts
@@ -1610,7 +1596,7 @@ not defined at all.
1610 1596
1611@item :help @var{help} 1597@item :help @var{help}
1612The value of this property, @var{help}, is the extra help string (not 1598The value of this property, @var{help}, is the extra help string (not
1613currently used). 1599currently used by Emacs).
1614 1600
1615@item :button (@var{type} . @var{selected}) 1601@item :button (@var{type} . @var{selected})
1616This property provides a way to define radio buttons and toggle buttons. 1602This property provides a way to define radio buttons and toggle buttons.
@@ -1618,6 +1604,54 @@ The @sc{car}, @var{type}, says which: is should be @code{:toggle} or
1618@code{:radio}. The @sc{cdr}, @var{selected}, should be a form; the 1604@code{:radio}. The @sc{cdr}, @var{selected}, should be a form; the
1619result of evaluating it says whether this button is currently selected. 1605result of evaluating it says whether this button is currently selected.
1620 1606
1607A @dfn{toggle} is a menu item which is labeled as either ``on'' or ``off''
1608according to the value of @var{selected}. The command itself should
1609toggle @var{selected}, setting it to @code{t} if it is @code{nil},
1610and to @code{nil} if it is @code{t}. Here is how the menu item
1611to toggle the @code{debug-on-error} flag is defined:
1612
1613@example
1614(menu-item "Debug on Error" toggle-debug-on-error
1615 :button (:toggle
1616 . (and (boundp 'debug-on-error)
1617 debug-on-error))
1618@end example
1619
1620@noindent
1621This works because @code{toggle-debug-on-error} is defined as a command
1622which toggles the variable @code{debug-on-error}.
1623
1624@dfn{Radio buttons} are a group of menu items, in which at any time one
1625and only one is ``selected.'' There should be a variable whose value
1626says which one is selected at any time. The @var{selected} form for
1627each radio button in the group should check whether the variable has the
1628right value for selecting that button. Clicking on the button should
1629set the variable so that the button you clicked on becomes selected.
1630
1631@item :key-sequence @var{key-sequence}
1632This property specifies which key sequence is likely to be bound to the
1633same command invoked by this menu item. If you specify the right key
1634sequence, that makes preparing the menu for display run much faster.
1635
1636If you specify the wrong key sequence, it has no effect; before Emacs
1637displays @var{key-sequence} in the menu, it verifies that
1638@var{key-sequence} is really equivalent to this menu item.
1639
1640@item :key-sequence nil
1641This property indicates that there is normally no key binding which is
1642equivalent to this menu item. Using this property saves time in
1643preparing the menu for display, because Emacs does not need to search
1644the keymaps for a keyboard equivalent for this menu item.
1645
1646However, if the user has rebound this item's definition to a key
1647sequence, Emacs ignores the @code{:keys} property and finds the keyboard
1648equivalent anyway.
1649
1650@item :keys @var{string}
1651This property specifies that @var{string} is the string to display
1652as the keyboard equivalent for this menu item. You can use
1653the @samp{\\[...]} documentation construct in @var{string}.
1654
1621@item :filter @var{filter-fn} 1655@item :filter @var{filter-fn}
1622This property provides a way to compute the menu item dynamically. 1656This property provides a way to compute the menu item dynamically.
1623The property value @var{filter-fn} should be a function of one argument; 1657The property value @var{filter-fn} should be a function of one argument;
@@ -1625,6 +1659,38 @@ when it is called, its argument will be @var{real-binding}. The
1625function should return the binding to use instead. 1659function should return the binding to use instead.
1626@end table 1660@end table
1627 1661
1662@node Alias Menu Items
1663@subsubsection Alias Menu Items
1664
1665 Sometimes it is useful to make menu items that use the ``same''
1666command but with different enable conditions. The best way to do this
1667in Emacs now is with extended menu items; before that feature existed,
1668it could be done by defining alias commands and using them in menu
1669items. Here's an example that makes two aliases for
1670@code{toggle-read-only} and gives them different enable conditions:
1671
1672@example
1673(defalias 'make-read-only 'toggle-read-only)
1674(put 'make-read-only 'menu-enable '(not buffer-read-only))
1675(defalias 'make-writable 'toggle-read-only)
1676(put 'make-writable 'menu-enable 'buffer-read-only)
1677@end example
1678
1679When using aliases in menus, often it is useful to display the
1680equivalent key bindings for the ``real'' command name, not the aliases
1681(which typically don't have any key bindings except for the menu
1682itself). To request this, give the alias symbol a non-@code{nil}
1683@code{menu-alias} property. Thus,
1684
1685@example
1686(put 'make-read-only 'menu-alias t)
1687(put 'make-writable 'menu-alias t)
1688@end example
1689
1690@noindent
1691causes menu items for @code{make-read-only} and @code{make-writable} to
1692show the keyboard bindings for @code{toggle-read-only}.
1693
1628@node Mouse Menus 1694@node Mouse Menus
1629@subsection Menus and the Mouse 1695@subsection Menus and the Mouse
1630 1696
@@ -1708,7 +1774,8 @@ for @key{SPC}.
1708 1774
1709 Here is a complete example of defining a menu keymap. It is the 1775 Here is a complete example of defining a menu keymap. It is the
1710definition of the @samp{Print} submenu in the @samp{Tools} menu in the 1776definition of the @samp{Print} submenu in the @samp{Tools} menu in the
1711menu bar. First we create the keymap, and give it a name: 1777menu bar, and it uses the simple menu item format (@pxref{Simple Menu
1778Items}). First we create the keymap, and give it a name:
1712 1779
1713@example 1780@example
1714(defvar menu-bar-print-menu (make-sparse-keymap "Print")) 1781(defvar menu-bar-print-menu (make-sparse-keymap "Print"))
@@ -1771,7 +1838,29 @@ command.
1771can do it this way: 1838can do it this way:
1772 1839
1773@example 1840@example
1774(define-key global-map [C-S-down-mouse-1] menu-bar-print-menu) 1841(define-key global-map [C-S-down-mouse-1]
1842 menu-bar-print-menu)
1843@end example
1844
1845 We could equally well use an extended menu item (@pxref{Extended Menu
1846Items}) for @code{print-region}, like this:
1847
1848@example
1849(define-key menu-bar-print-menu [print-region]
1850 '(menu-item "Print Region" print-region
1851 :enable (mark-active)))
1852@end example
1853
1854@noindent
1855With the extended menu item, the enable condition is specified
1856inside the menu item itself. If we wanted to make this
1857item disappear from the menu entirely when the mark is inactive,
1858we could do it this way:
1859
1860@example
1861(define-key menu-bar-print-menu [print-region]
1862 '(menu-item "Print Region" print-region
1863 :visible (mark-active)))
1775@end example 1864@end example
1776 1865
1777@node Menu Bar 1866@node Menu Bar
diff --git a/lispref/lists.texi b/lispref/lists.texi
index 3f269dc9093..bdc94dc015a 100644
--- a/lispref/lists.texi
+++ b/lispref/lists.texi
@@ -357,8 +357,8 @@ If @var{n} is zero or negative, @code{nthcdr} returns all of
357@end example 357@end example
358@end defun 358@end defun
359 359
360@tindex safe-length
361@defun safe-length list 360@defun safe-length list
361@tindex safe-length
362This function returns the length of @var{list}, with no risk 362This function returns the length of @var{list}, with no risk
363of either an error or an infinite loop. 363of either an error or an infinite loop.
364 364
@@ -371,24 +371,24 @@ number of distinct elements.
371worried that it may be circular, is with @code{length}. @xref{Sequence 371worried that it may be circular, is with @code{length}. @xref{Sequence
372Functions}. 372Functions}.
373 373
374@tindex caar
375@defun caar cons-cell 374@defun caar cons-cell
375@tindex caar
376This is the same as @code{(car (car @var{cons-cell}))}. 376This is the same as @code{(car (car @var{cons-cell}))}.
377@end defun 377@end defun
378 378
379@tindex cadr
380@defun cadr cons-cell 379@defun cadr cons-cell
380@tindex cadr
381This is the same as @code{(car (cdr @var{cons-cell}))} 381This is the same as @code{(car (cdr @var{cons-cell}))}
382or @code{(nth 1 @var{cons-cell})}. 382or @code{(nth 1 @var{cons-cell})}.
383@end defun 383@end defun
384 384
385@tindex cdar
386@defun cdar cons-cell 385@defun cdar cons-cell
386@tindex cdar
387This is the same as @code{(cdr (car @var{cons-cell}))}. 387This is the same as @code{(cdr (car @var{cons-cell}))}.
388@end defun 388@end defun
389 389
390@tindex cddr
391@defun cddr cons-cell 390@defun cddr cons-cell
391@tindex cddr
392This is the same as @code{(cdr (cdr @var{cons-cell}))} 392This is the same as @code{(cdr (cdr @var{cons-cell}))}
393or @code{(nthcdr 2 @var{cons-cell})}. 393or @code{(nthcdr 2 @var{cons-cell})}.
394@end defun 394@end defun
@@ -572,8 +572,8 @@ Here we show the use of vectors and strings as arguments to @code{append}:
572@end group 572@end group
573@end example 573@end example
574 574
575With the help of @code{apply}, we can append all the lists in a list of 575With the help of @code{apply} (@pxref{Calling Functions}), we can append
576lists: 576all the lists in a list of lists:
577 577
578@example 578@example
579@group 579@group
@@ -1030,6 +1030,15 @@ arguments. It is called with two elements of @var{list}. To get an
1030increasing order sort, the @var{predicate} should return @code{t} if the 1030increasing order sort, the @var{predicate} should return @code{t} if the
1031first element is ``less than'' the second, or @code{nil} if not. 1031first element is ``less than'' the second, or @code{nil} if not.
1032 1032
1033The comparison function @var{predicate} must give reliable results for
1034any given pair of arguments, at least within a single call to
1035@code{sort}. It must be @dfn{antisymmetric}; that is, if @var{a} is
1036less than @var{b}, @var{b} must not be less than @var{a}. It must be
1037@dfn{transitive}---that is, if @var{a} is less than @var{b}, and @var{b}
1038is less than @var{c}, then @var{a} must be less than @var{c}. If you
1039use a comparison function which does not meet these requirements, the
1040result of @code{sort} is unpredictable.
1041
1033The destructive aspect of @code{sort} is that it rearranges the cons 1042The destructive aspect of @code{sort} is that it rearranges the cons
1034cells forming @var{list} by changing @sc{cdr}s. A nondestructive sort 1043cells forming @var{list} by changing @sc{cdr}s. A nondestructive sort
1035function would create new cons cells to store the elements in their 1044function would create new cons cells to store the elements in their
@@ -1338,6 +1347,10 @@ Here is another example, in which the keys and values are not symbols:
1338@end smallexample 1347@end smallexample
1339@end defun 1348@end defun
1340 1349
1350 The functions @code{assoc-ignore-representation} and
1351@code{assoc-ignore-case} are much like @code{assoc} except using
1352@code{compare-strings} to do the comparison. @xref{Text Comparison}.
1353
1341@defun rassoc value alist 1354@defun rassoc value alist
1342This function returns the first association with value @var{value} in 1355This function returns the first association with value @var{value} in
1343@var{alist}. It returns @code{nil} if no association in @var{alist} has 1356@var{alist}. It returns @code{nil} if no association in @var{alist} has
diff --git a/lispref/loading.texi b/lispref/loading.texi
index 44eac1cbe44..6dda4a437ed 100644
--- a/lispref/loading.texi
+++ b/lispref/loading.texi
@@ -35,6 +35,8 @@ containing Lisp code.
35 35
36@menu 36@menu
37* How Programs Do Loading:: The @code{load} function and others. 37* How Programs Do Loading:: The @code{load} function and others.
38* Library Search:: Finding a library to load.
39* Loading Non-ASCII:: Non-@sc{ASCII} characters in Emacs Lisp files.
38* Autoload:: Setting up a function to autoload. 40* Autoload:: Setting up a function to autoload.
39* Repeated Loading:: Precautions about loading a file twice. 41* Repeated Loading:: Precautions about loading a file twice.
40* Named Features:: Loading a library if it isn't already loaded. 42* Named Features:: Loading a library if it isn't already loaded.
@@ -53,7 +55,7 @@ function's real definition (@pxref{Autoload}). @code{require} loads a
53file if it isn't already loaded (@pxref{Named Features}). Ultimately, 55file if it isn't already loaded (@pxref{Named Features}). Ultimately,
54all these facilities call the @code{load} function to do the work. 56all these facilities call the @code{load} function to do the work.
55 57
56@defun load filename &optional missing-ok nomessage nosuffix 58@defun load filename &optional missing-ok nomessage nosuffix must-suffix
57This function finds and opens a file of Lisp code, evaluates all the 59This function finds and opens a file of Lisp code, evaluates all the
58forms in it, and closes the file. 60forms in it, and closes the file.
59 61
@@ -74,6 +76,12 @@ must specify the precise file name you want. By specifying the precise
74file name and using @code{t} for @var{nosuffix}, you can prevent 76file name and using @code{t} for @var{nosuffix}, you can prevent
75perverse file names such as @file{foo.el.el} from being tried. 77perverse file names such as @file{foo.el.el} from being tried.
76 78
79If the optional argument @var{must-suffix} is non-@code{nil}, then
80@code{load} insists that the file name used must end in either
81@samp{.el} or @samp{.elc}, unless it contains an explicit directory
82name. If @var{filename} does not contain an explicit directory name,
83and does not end in a suffix, then @code{load} insists on adding one.
84
77If @var{filename} is a relative file name, such as @file{foo} or 85If @var{filename} is a relative file name, such as @file{foo} or
78@file{baz/foo.bar}, @code{load} searches for the file using the variable 86@file{baz/foo.bar}, @code{load} searches for the file using the variable
79@code{load-path}. It appends @var{filename} to each of the directories 87@code{load-path}. It appends @var{filename} to each of the directories
@@ -82,7 +90,7 @@ matches. The current default directory is tried only if it is specified
82in @code{load-path}, where @code{nil} stands for the default directory. 90in @code{load-path}, where @code{nil} stands for the default directory.
83@code{load} tries all three possible suffixes in the first directory in 91@code{load} tries all three possible suffixes in the first directory in
84@code{load-path}, then all three suffixes in the second directory, and 92@code{load-path}, then all three suffixes in the second directory, and
85so on. 93so on. @xref{Library Search}.
86 94
87If you get a warning that @file{foo.elc} is older than @file{foo.el}, it 95If you get a warning that @file{foo.elc} is older than @file{foo.el}, it
88means you should consider recompiling @file{foo.el}. @xref{Byte 96means you should consider recompiling @file{foo.el}. @xref{Byte
@@ -118,7 +126,7 @@ See below.
118This command loads the file @var{filename}. If @var{filename} is a 126This command loads the file @var{filename}. If @var{filename} is a
119relative file name, then the current default directory is assumed. 127relative file name, then the current default directory is assumed.
120@code{load-path} is not used, and suffixes are not appended. Use this 128@code{load-path} is not used, and suffixes are not appended. Use this
121command if you wish to specify the file to be loaded exactly. 129command if you wish to specify precisely the file name to load.
122@end deffn 130@end deffn
123 131
124@deffn Command load-library library 132@deffn Command load-library library
@@ -126,17 +134,43 @@ This command loads the library named @var{library}. It is equivalent to
126@code{load}, except in how it reads its argument interactively. 134@code{load}, except in how it reads its argument interactively.
127@end deffn 135@end deffn
128 136
137@defvar load-in-progress
138This variable is non-@code{nil} if Emacs is in the process of loading a
139file, and it is @code{nil} otherwise.
140@end defvar
141
142@defvar load-read-function
143This variable specifies an alternate expression-reading function for
144@code{load} and @code{eval-region} to use instead of @code{read}.
145The function should accept one argument, just as @code{read} does.
146
147Normally, the variable's value is @code{nil}, which means those
148functions should use @code{read}.
149@end defvar
150
151 For how @code{load} is used to build Emacs, see @ref{Building Emacs}.
152
153@node Library Search
154@section Library Search
155
156 When Emacs loads a Lisp library, it searches for the library
157in a list of directories specified by the variable @code{load-path}.
158
129@defopt load-path 159@defopt load-path
130@cindex @code{EMACSLOADPATH} environment variable 160@cindex @code{EMACSLOADPATH} environment variable
131The value of this variable is a list of directories to search when 161The value of this variable is a list of directories to search when
132loading files with @code{load}. Each element is a string (which must be 162loading files with @code{load}. Each element is a string (which must be
133a directory name) or @code{nil} (which stands for the current working 163a directory name) or @code{nil} (which stands for the current working
134directory). The value of @code{load-path} is initialized from the 164directory).
135environment variable @code{EMACSLOADPATH}, if that exists; otherwise its 165@end defopt
136default value is specified in @file{emacs/src/paths.h} when Emacs is 166
137built. 167 The value of @code{load-path} is initialized from the environment
168variable @code{EMACSLOADPATH}, if that exists; otherwise its default
169value is specified in @file{emacs/src/paths.h} when Emacs is built.
170Then the list is expanded by adding subdirectories of the directories
171in the list.
138 172
139The syntax of @code{EMACSLOADPATH} is the same as used for @code{PATH}; 173 The syntax of @code{EMACSLOADPATH} is the same as used for @code{PATH};
140@samp{:} (or @samp{;}, according to the operating system) separates 174@samp{:} (or @samp{;}, according to the operating system) separates
141directory names, and @samp{.} is used for the current default directory. 175directory names, and @samp{.} is used for the current default directory.
142Here is an example of how to set your @code{EMACSLOADPATH} variable from 176Here is an example of how to set your @code{EMACSLOADPATH} variable from
@@ -144,17 +178,17 @@ a @code{csh} @file{.login} file:
144 178
145@c This overfull hbox is OK. --rjc 16mar92 179@c This overfull hbox is OK. --rjc 16mar92
146@smallexample 180@smallexample
147setenv EMACSLOADPATH .:/user/bil/emacs:/usr/lib/emacs/lisp 181setenv EMACSLOADPATH .:/user/bil/emacs:/usr/local/lib/emacs/lisp
148@end smallexample 182@end smallexample
149 183
150Here is how to set it using @code{sh}: 184 Here is how to set it using @code{sh}:
151 185
152@smallexample 186@smallexample
153export EMACSLOADPATH 187export EMACSLOADPATH
154EMACSLOADPATH=.:/user/bil/emacs:/usr/local/lib/emacs/lisp 188EMACSLOADPATH=.:/user/bil/emacs:/usr/local/lib/emacs/lisp
155@end smallexample 189@end smallexample
156 190
157Here is an example of code you can place in a @file{.emacs} file to add 191 Here is an example of code you can place in a @file{.emacs} file to add
158several directories to the front of your default @code{load-path}: 192several directories to the front of your default @code{load-path}:
159 193
160@smallexample 194@smallexample
@@ -174,34 +208,37 @@ followed then by the @file{/user/bil/emacs} directory, the
174@file{/usr/local/lisplib} directory, and the @file{~/emacs} directory, 208@file{/usr/local/lisplib} directory, and the @file{~/emacs} directory,
175which are then followed by the standard directories for Lisp code. 209which are then followed by the standard directories for Lisp code.
176 210
177Dumping Emacs uses a special value of @code{load-path}. If the value of 211 Dumping Emacs uses a special value of @code{load-path}. If the value of
178@code{load-path} at the end of dumping is unchanged (that is, still the 212@code{load-path} at the end of dumping is unchanged (that is, still the
179same special value), the dumped Emacs switches to the ordinary 213same special value), the dumped Emacs switches to the ordinary
180@code{load-path} value when it starts up, as described above. But if 214@code{load-path} value when it starts up, as described above. But if
181@code{load-path} has any other value at the end of dumping, that value 215@code{load-path} has any other value at the end of dumping, that value
182is used for execution of the dumped Emacs also. 216is used for execution of the dumped Emacs also.
183 217
184Therefore, if you want to change @code{load-path} temporarily for 218 Therefore, if you want to change @code{load-path} temporarily for
185loading a few libraries in @file{site-init.el} or @file{site-load.el}, 219loading a few libraries in @file{site-init.el} or @file{site-load.el},
186you should bind @code{load-path} locally with @code{let} around the 220you should bind @code{load-path} locally with @code{let} around the
187calls to @code{load}. 221calls to @code{load}.
188@end defopt
189 222
190 The default value of @code{load-path}, when running an Emacs which has 223 The default value of @code{load-path}, when running an Emacs which has
191been installed on the system, looks like this: 224been installed on the system, includes two special directories (and
225their subdirectories as well):
192 226
193@smallexample 227@smallexample
194("/usr/local/share/emacs/@var{version}/site-lisp" 228"/usr/local/share/emacs/@var{version}/site-lisp"
195 "/usr/local/share/emacs/site-lisp"
196 "/usr/local/share/emacs/@var{version}/lisp")
197@end smallexample 229@end smallexample
198 230
199 The last of these three directories is where the Lisp files of Emacs 231@noindent
200itself are installed; the first two are for additional Lisp packages 232and
201installed at your site. The first directory is for locally installed 233
202packages that belong with a particular Emacs version; the second is for 234@smallexample
203locally installed packages that can be used with any installed Emacs 235"/usr/local/share/emacs/site-lisp"
204version. 236@end smallexample
237
238@noindent
239The first one is for locally installed packages for a particular Emacs
240version; the second is for locally installed packages meant for use with
241all installed Emacs versions.
205 242
206 There are several reasons why a Lisp package that works well in one 243 There are several reasons why a Lisp package that works well in one
207Emacs version can cause trouble in another. Sometimes packages need 244Emacs version can cause trouble in another. Sometimes packages need
@@ -210,28 +247,23 @@ undocumented internal Emacs data that can change without notice;
210sometimes a newer Emacs version incorporates a version of the package, 247sometimes a newer Emacs version incorporates a version of the package,
211and should be used only with that version. 248and should be used only with that version.
212 249
250 Emacs finds these directories' subdirectories and adds them to
251@code{load-path} when it starts up. Both immediate subdirectories and
252subdirectories multiple levels down are added to @code{load-path}.
253
254 Not all subdirectories are included, though. Subdirectories whose
255names do not start with a letter or digit are excluded. Subdirectories
256named @file{RCS} are excluded. Also, a subdirectory which contains a
257file named @file{.nosearch} is excluded. You can use these methods to
258prevent certain subdirectories of the @file{site-lisp} directories from
259being searched.
260
213 If you run Emacs from the directory where it was built---that is, an 261 If you run Emacs from the directory where it was built---that is, an
214executable that has not been formally installed---then @code{load-path} 262executable that has not been formally installed---then @code{load-path}
215normally contains two additional directories. These are the @code{lisp} 263normally contains two additional directories. These are the @code{lisp}
216and @code{site-lisp} subdirectories of the main build directory. (Both 264and @code{site-lisp} subdirectories of the main build directory. (Both
217are represented as absolute file names.) 265are represented as absolute file names.)
218 266
219@defvar load-in-progress
220This variable is non-@code{nil} if Emacs is in the process of loading a
221file, and it is @code{nil} otherwise.
222@end defvar
223
224@defvar load-read-function
225This variable specifies an alternate expression-reading function for
226@code{load} and @code{eval-region} to use instead of @code{read}.
227The function should accept one argument, just as @code{read} does.
228
229Normally, the variable's value is @code{nil}, which means those
230functions should use @code{read}.
231@end defvar
232
233 For how @code{load} is used to build Emacs, see @ref{Building Emacs}.
234
235@deffn Command locate-library library &optional nosuffix path interactive-call 267@deffn Command locate-library library &optional nosuffix path interactive-call
236This command finds the precise file name for library @var{library}. It 268This command finds the precise file name for library @var{library}. It
237searches for the library in the same way @code{load} does, and the 269searches for the library in the same way @code{load} does, and the
@@ -248,6 +280,44 @@ interactively, the argument @var{interactive-call} is @code{t}, and this
248tells @code{locate-library} to display the file name in the echo area. 280tells @code{locate-library} to display the file name in the echo area.
249@end deffn 281@end deffn
250 282
283@node Loading Non-ASCII
284@section Loading Non-ASCII Characters
285
286 When Emacs Lisp programs contain string constants with non-@sc{ASCII}
287characters, these can be represented within Emacs either as unibyte
288strings or as multibyte strings (@pxref{Text Representations}). Which
289representation is used depends on how the file is read into Emacs. If
290it is read with decoding into multibyte representation, the text of the
291Lisp program will be multibyte text, and its string constants will be
292multibyte strings. If a file containing Latin-1 characters (for
293example) is read without decoding, the text of the program will be
294unibyte text, and its string constants will be unibyte strings.
295@xref{Coding Systems}.
296
297 To make the results more predictable, Emacs always performs decoding
298into the multibyte representation when loading Lisp files, even if it
299was started with the @samp{--unibyte} option. This means that string
300constants with non-@sc{ASCII} characters translate into multibyte
301strings. The only exception is when a particular file specifies no
302decoding.
303
304 The reason Emacs is designed this way is so that Lisp programs give
305predictable results, regardless of how Emacs was started. In addition,
306this enables programs that depend on using multibyte text to work even
307in a unibyte Emacs. Of course, such programs should be designed to
308notice whether the user prefers unibyte or multibyte text, by checking
309@code{default-enable-multibyte-characters}, and convert representations
310appropriately.
311
312 In most Emacs Lisp programs, the fact that non-@sc{ASCII} strings are
313multibyte strings should not be noticeable, since inserting them in
314unibyte buffers converts them to unibyte automatically. However, if
315this does make a difference, you can force a particular Lisp file to be
316interpreted as unibyte by writing @samp{-*-coding: raw-text;-*-} in a
317comment on the file's first line. With that designator, the file will
318be unconditionally be interpreted as unibyte, even in an ordinary
319multibyte Emacs session.
320
251@node Autoload 321@node Autoload
252@section Autoload 322@section Autoload
253@cindex autoload 323@cindex autoload
@@ -263,8 +333,8 @@ as if it had been loaded all along.
263source before the real definition. @code{autoload} is the low-level 333source before the real definition. @code{autoload} is the low-level
264primitive for autoloading; any Lisp program can call @code{autoload} at 334primitive for autoloading; any Lisp program can call @code{autoload} at
265any time. Magic comments are the most convenient way to make a function 335any time. Magic comments are the most convenient way to make a function
266autoload, for packages installed along with Emacs. They do nothing on 336autoload, for packages installed along with Emacs. These comments do
267their own, but they serve as a guide for the command 337nothing on their own, but they serve as a guide for the command
268@code{update-file-autoloads}, which constructs calls to @code{autoload} 338@code{update-file-autoloads}, which constructs calls to @code{autoload}
269and arranges to execute them when Emacs is built. 339and arranges to execute them when Emacs is built.
270 340
@@ -286,10 +356,10 @@ documentation without loading the function's real definition.
286 356
287If @var{interactive} is non-@code{nil}, that says @var{function} can be 357If @var{interactive} is non-@code{nil}, that says @var{function} can be
288called interactively. This lets completion in @kbd{M-x} work without 358called interactively. This lets completion in @kbd{M-x} work without
289loading its real definition. The complete interactive specification is 359loading @var{function}'s real definition. The complete interactive
290not given here; it's not needed unless the user actually calls 360specification is not given here; it's not needed unless the user
291@var{function}, and when that happens, it's time to load the real 361actually calls @var{function}, and when that happens, it's time to load
292definition. 362the real definition.
293 363
294You can autoload macros and keymaps as well as ordinary functions. 364You can autoload macros and keymaps as well as ordinary functions.
295Specify @var{type} as @code{macro} if @var{function} is really a macro. 365Specify @var{type} as @code{macro} if @var{function} is really a macro.
@@ -338,9 +408,9 @@ or provide one or more features. If the file is not completely loaded
338definitions or @code{provide} calls that occurred during the load are 408definitions or @code{provide} calls that occurred during the load are
339undone. This is to ensure that the next attempt to call any function 409undone. This is to ensure that the next attempt to call any function
340autoloading from this file will try again to load the file. If not for 410autoloading from this file will try again to load the file. If not for
341this, then some of the functions in the file might appear defined, but 411this, then some of the functions in the file might be defined by the
342they might fail to work properly for the lack of certain subroutines 412aborted load, but fail to work properly for the lack of certain
343defined later in the file and not loaded successfully. 413subroutines not loaded successfully because they come later in the file.
344 414
345 If the autoloaded file fails to define the desired Lisp function or 415 If the autoloaded file fails to define the desired Lisp function or
346macro, then an error is signaled with data @code{"Autoloading failed to 416macro, then an error is signaled with data @code{"Autoloading failed to
@@ -348,7 +418,7 @@ define function @var{function-name}"}.
348 418
349@findex update-file-autoloads 419@findex update-file-autoloads
350@findex update-directory-autoloads 420@findex update-directory-autoloads
351 A magic autoload comment looks like @samp{;;;###autoload}, on a line 421 A magic autoload comment consists of @samp{;;;###autoload}, on a line
352by itself, just before the real definition of the function in its 422by itself, just before the real definition of the function in its
353autoloadable source file. The command @kbd{M-x update-file-autoloads} 423autoloadable source file. The command @kbd{M-x update-file-autoloads}
354writes a corresponding @code{autoload} call into @file{loaddefs.el}. 424writes a corresponding @code{autoload} call into @file{loaddefs.el}.
@@ -398,7 +468,7 @@ documentation string in the @file{etc/DOC} file. @xref{Building Emacs}.
398@section Repeated Loading 468@section Repeated Loading
399@cindex repeated loading 469@cindex repeated loading
400 470
401 You can load one file more than once in an Emacs session. For 471 You can load a given file more than once in an Emacs session. For
402example, after you have rewritten and reinstalled a function definition 472example, after you have rewritten and reinstalled a function definition
403by editing it in a buffer, you may wish to return to the original 473by editing it in a buffer, you may wish to return to the original
404version; you can do this by reloading the file it came from. 474version; you can do this by reloading the file it came from.
@@ -409,7 +479,7 @@ rather than a non-compiled file of similar name. If you rewrite a file
409that you intend to save and reinstall, you need to byte-compile the new 479that you intend to save and reinstall, you need to byte-compile the new
410version; otherwise Emacs will load the older, byte-compiled file instead 480version; otherwise Emacs will load the older, byte-compiled file instead
411of your newer, non-compiled file! If that happens, the message 481of your newer, non-compiled file! If that happens, the message
412displayed when loading the file includes, @samp{(compiled; source is 482displayed when loading the file includes, @samp{(compiled; note, source is
413newer)}, to remind you to recompile it. 483newer)}, to remind you to recompile it.
414 484
415 When writing the forms in a Lisp library file, keep in mind that the 485 When writing the forms in a Lisp library file, keep in mind that the
@@ -435,7 +505,7 @@ To avoid the problem, write this:
435 (cons '(leif-mode " Leif") minor-mode-alist))) 505 (cons '(leif-mode " Leif") minor-mode-alist)))
436@end example 506@end example
437 507
438 To add an element to a list just once, use @code{add-to-list} 508 To add an element to a list just once, you can also use @code{add-to-list}
439(@pxref{Setting Variables}). 509(@pxref{Setting Variables}).
440 510
441 Occasionally you will want to test explicitly whether a library has 511 Occasionally you will want to test explicitly whether a library has
diff --git a/lispref/macros.texi b/lispref/macros.texi
index b9e93bcf6d4..0a739bc3ba5 100644
--- a/lispref/macros.texi
+++ b/lispref/macros.texi
@@ -503,7 +503,7 @@ in expressions ordinarily.
503@node Eval During Expansion 503@node Eval During Expansion
504@subsection Evaluating Macro Arguments in Expansion 504@subsection Evaluating Macro Arguments in Expansion
505 505
506 Another problem can happen if you the macro definition itself 506 Another problem can happen if the macro definition itself
507evaluates any of the macro argument expressions, such as by calling 507evaluates any of the macro argument expressions, such as by calling
508@code{eval} (@pxref{Eval}). If the argument is supposed to refer to the 508@code{eval} (@pxref{Eval}). If the argument is supposed to refer to the
509user's variables, you may have trouble if the user happens to use a 509user's variables, you may have trouble if the user happens to use a
@@ -542,7 +542,7 @@ with @code{eval}) don't occur and its local variable bindings don't
542exist. 542exist.
543 543
544 To avoid these problems, @strong{don't evaluate an argument expression 544 To avoid these problems, @strong{don't evaluate an argument expression
545while computing the macro expansion.} Instead, substitute the 545while computing the macro expansion}. Instead, substitute the
546expression into the macro expansion, so that its value will be computed 546expression into the macro expansion, so that its value will be computed
547as part of executing the expansion. This is how the other examples in 547as part of executing the expansion. This is how the other examples in
548this chapter work. 548this chapter work.
diff --git a/lispref/maps.texi b/lispref/maps.texi
index 78b5ceae979..96f8d0921ee 100644
--- a/lispref/maps.texi
+++ b/lispref/maps.texi
@@ -150,8 +150,8 @@ The keymap which displays the Files menu in the menu bar.
150@vindex menu-bar-help-menu 150@vindex menu-bar-help-menu
151The keymap which displays the Help menu in the menu bar. 151The keymap which displays the Help menu in the menu bar.
152 152
153@tindex menu-bar-mule-menu
154@item menu-bar-mule-menu 153@item menu-bar-mule-menu
154@tindex menu-bar-mule-menu
155@vindex menu-bar-mule-menu 155@vindex menu-bar-mule-menu
156The keymap which displays the Mule menu in the menu bar. 156The keymap which displays the Mule menu in the menu bar.
157 157
diff --git a/lispref/markers.texi b/lispref/markers.texi
index 6a475b7a01e..0fa549bdd16 100644
--- a/lispref/markers.texi
+++ b/lispref/markers.texi
@@ -131,8 +131,8 @@ This function returns @code{t} if @var{object} is an integer or a marker,
131@end defun 131@end defun
132 132
133@defun number-or-marker-p object 133@defun number-or-marker-p object
134This function returns @code{t} if @var{object} is a number (either kind) 134This function returns @code{t} if @var{object} is a number (either
135or a marker, @code{nil} otherwise. 135integer or floating point) or a marker, @code{nil} otherwise.
136@end defun 136@end defun
137 137
138@node Creating Markers 138@node Creating Markers
@@ -144,7 +144,7 @@ accessible portion of the buffer, or to the same place as another given
144marker. 144marker.
145 145
146@defun make-marker 146@defun make-marker
147This functions returns a newly created marker that does not point 147This function returns a newly created marker that does not point
148anywhere. 148anywhere.
149 149
150@example 150@example
@@ -216,8 +216,25 @@ passed an integer argument greater than the length of the buffer,
216@code{copy-marker} returns a new marker that points to the end of the 216@code{copy-marker} returns a new marker that points to the end of the
217buffer. 217buffer.
218 218
219@example
220@group
221(copy-marker 0)
222 @result{} #<marker at 1 in markers.texi>
223@end group
224
225@group
226(copy-marker 20000)
227 @result{} #<marker at 7572 in markers.texi>
228@end group
229@end example
230
219An error is signaled if @var{marker} is neither a marker nor an 231An error is signaled if @var{marker} is neither a marker nor an
220integer. 232integer.
233@end defun
234
235 Two distinct markers are considered @code{equal} (even though not
236@code{eq}) to each other if they have the same position and buffer, or
237if they both point nowhere.
221 238
222@example 239@example
223@group 240@group
@@ -239,18 +256,7 @@ integer.
239(equal p q) 256(equal p q)
240 @result{} t 257 @result{} t
241@end group 258@end group
242
243@group
244(copy-marker 0)
245 @result{} #<marker at 1 in markers.texi>
246@end group
247
248@group
249(copy-marker 20000)
250 @result{} #<marker at 7572 in markers.texi>
251@end group
252@end example 259@end example
253@end defun
254 260
255@node Information from Markers 261@node Information from Markers
256@section Information from Markers 262@section Information from Markers
@@ -296,10 +302,6 @@ This function returns the buffer that @var{marker} points into, or
296@end example 302@end example
297@end defun 303@end defun
298 304
299 Two distinct markers are considered @code{equal} (even though not
300@code{eq}) to each other if they have the same position and buffer, or
301if they both point nowhere.
302
303@node Marker Insertion Types 305@node Marker Insertion Types
304@section Marker Insertion Types 306@section Marker Insertion Types
305 307
@@ -311,16 +313,16 @@ marker should do by setting its @dfn{insertion type}. Note that use of
311@code{insert-before-markers} ignores markers' insertion types, always 313@code{insert-before-markers} ignores markers' insertion types, always
312relocating a marker to point after the inserted text. 314relocating a marker to point after the inserted text.
313 315
314@tindex set-marker-insertion-type
315@defun set-marker-insertion-type marker type 316@defun set-marker-insertion-type marker type
317@tindex set-marker-insertion-type
316This function sets the insertion type of marker @var{marker} to 318This function sets the insertion type of marker @var{marker} to
317@var{type}. If @var{type} is @code{t}, @var{marker} will advances when 319@var{type}. If @var{type} is @code{t}, @var{marker} will advances when
318text is inserted at it. If @var{type} is @code{nil}, @var{marker} does 320text is inserted at it. If @var{type} is @code{nil}, @var{marker} does
319not advance when text is inserted there. 321not advance when text is inserted there.
320@end defun 322@end defun
321 323
322@tindex marker-insertion-type
323@defun marker-insertion-type marker 324@defun marker-insertion-type marker
325@tindex marker-insertion-type
324This function reports the current insertion type of @var{marker}. 326This function reports the current insertion type of @var{marker}.
325@end defun 327@end defun
326 328
@@ -377,9 +379,9 @@ This is another name for @code{set-marker}.
377 379
378 One special marker in each buffer is designated @dfn{the mark}. It 380 One special marker in each buffer is designated @dfn{the mark}. It
379records a position for the user for the sake of commands such as 381records a position for the user for the sake of commands such as
380@kbd{C-w} and @kbd{C-x @key{TAB}}. Lisp programs should set the mark 382@code{kill-region} and @code{indent-rigidly}. Lisp programs should set
381only to values that have a potential use to the user, and never for 383the mark only to values that have a potential use to the user, and never
382their own internal purposes. For example, the @code{replace-regexp} 384for their own internal purposes. For example, the @code{replace-regexp}
383command sets the mark to the value of point before doing any 385command sets the mark to the value of point before doing any
384replacements, because this enables the user to move back there 386replacements, because this enables the user to move back there
385conveniently after the replace is finished. 387conveniently after the replace is finished.
diff --git a/lispref/minibuf.texi b/lispref/minibuf.texi
index 0ff8e79c1ca..8ddb5d72350 100644
--- a/lispref/minibuf.texi
+++ b/lispref/minibuf.texi
@@ -90,8 +90,8 @@ either one.
90 90
91 In most cases, you should not call minibuffer input functions in the 91 In most cases, you should not call minibuffer input functions in the
92middle of a Lisp function. Instead, do all minibuffer input as part of 92middle of a Lisp function. Instead, do all minibuffer input as part of
93reading the arguments for a command, in the @code{interactive} spec. 93reading the arguments for a command, in the @code{interactive}
94@xref{Defining Commands}. 94specification. @xref{Defining Commands}.
95 95
96@defun read-from-minibuffer prompt-string &optional initial-contents keymap read hist default inherit-input-method 96@defun read-from-minibuffer prompt-string &optional initial-contents keymap read hist default inherit-input-method
97This function is the most general way to get input through the 97This function is the most general way to get input through the
@@ -115,7 +115,7 @@ The argument @var{default} specifies a default value to make available
115through the history commands. It should be a string, or @code{nil}. If 115through the history commands. It should be a string, or @code{nil}. If
116@var{read} is non-@code{nil}, then @var{default} is also used as the 116@var{read} is non-@code{nil}, then @var{default} is also used as the
117input to @code{read}, if the user enters empty input. However, in the 117input to @code{read}, if the user enters empty input. However, in the
118usual case (where @var{read} is @code{nil}, @code{read-from-minibuffer} 118usual case (where @var{read} is @code{nil}), @code{read-from-minibuffer}
119does not return @var{default} when the user enters empty input; it 119does not return @var{default} when the user enters empty input; it
120returns an empty string, @code{""}. In this respect, it is different 120returns an empty string, @code{""}. In this respect, it is different
121from all the other minibuffer input functions in this chapter. 121from all the other minibuffer input functions in this chapter.
@@ -136,9 +136,10 @@ properties were present in the minibuffer. Otherwise all the text
136properties are stripped when the value is returned. 136properties are stripped when the value is returned.
137 137
138If the argument @var{inherit-input-method} is non-@code{nil}, then the 138If the argument @var{inherit-input-method} is non-@code{nil}, then the
139minibuffer inherits the current input method and the setting of 139minibuffer inherits the current buffer's input method (@pxref{Input
140@code{enable-multibyte-characters} from whichever buffer was current 140Methods}) and the setting of @code{enable-multibyte-characters}
141before entering the minibuffer. 141(@pxref{Text Representations}) from whichever buffer was current before
142entering the minibuffer.
142 143
143If @var{initial-contents} is a string, @code{read-from-minibuffer} 144If @var{initial-contents} is a string, @code{read-from-minibuffer}
144inserts it into the minibuffer, leaving point at the end, before the 145inserts it into the minibuffer, leaving point at the end, before the
@@ -425,7 +426,12 @@ arguments to other commands).
425@end defvar 426@end defvar
426 427
427@defvar file-name-history 428@defvar file-name-history
428A history list for file name arguments. 429A history list for file-name arguments.
430@end defvar
431
432@defvar buffer-name-history
433@tindex buffer-name-history
434A history list for buffer-name arguments.
429@end defvar 435@end defvar
430 436
431@defvar regexp-history 437@defvar regexp-history
@@ -673,10 +679,10 @@ edit the input, providing several commands to attempt completion.
673In most cases, we recommend using @var{default}, and not @var{initial}. 679In most cases, we recommend using @var{default}, and not @var{initial}.
674 680
675If the argument @var{inherit-input-method} is non-@code{nil}, then the 681If the argument @var{inherit-input-method} is non-@code{nil}, then the
676minibuffer inherits the current input method and the setting of 682minibuffer inherits the current buffer's input method (@pxref{Input
677@code{enable-multibyte-characters} from whichever buffer was current 683Methods}) and the setting of @code{enable-multibyte-characters}
678before entering the minibuffer. @xref{Input Methods,,, emacs, The GNU 684(@pxref{Text Representations}) from whichever buffer was current before
679Emacs Manual}. 685entering the minibuffer.
680 686
681Completion ignores case when comparing the input against the possible 687Completion ignores case when comparing the input against the possible
682matches, if the built-in variable @code{completion-ignore-case} is 688matches, if the built-in variable @code{completion-ignore-case} is
@@ -853,8 +859,8 @@ reading certain sorts of names with completion.
853 859
854 In most cases, you should not call these functions in the middle of a 860 In most cases, you should not call these functions in the middle of a
855Lisp function. When possible, do all minibuffer input as part of 861Lisp function. When possible, do all minibuffer input as part of
856reading the arguments for a command, in the @code{interactive} spec. 862reading the arguments for a command, in the @code{interactive}
857@xref{Defining Commands}. 863specification. @xref{Defining Commands}.
858 864
859@defun read-buffer prompt &optional default existing 865@defun read-buffer prompt &optional default existing
860This function reads the name of a buffer and returns it as a string. 866This function reads the name of a buffer and returns it as a string.
@@ -1412,8 +1418,8 @@ The return value of @code{map-y-or-n-p} is the number of objects acted on.
1412 1418
1413 This function is useful for reading passwords. 1419 This function is useful for reading passwords.
1414 1420
1415@tindex read-password
1416@defun read-password prompt default 1421@defun read-password prompt default
1422@tindex read-password
1417This function reads a password, echoing @samp{.} in the echo area 1423This function reads a password, echoing @samp{.} in the echo area
1418for each character entered, and returns it as a string. It prompts 1424for each character entered, and returns it as a string. It prompts
1419with @var{prompt}, and returns @var{default} if the user enters the 1425with @var{prompt}, and returns @var{default} if the user enters the
diff --git a/lispref/modes.texi b/lispref/modes.texi
index dbdefb5a2d3..dfbdfee00c6 100644
--- a/lispref/modes.texi
+++ b/lispref/modes.texi
@@ -305,7 +305,7 @@ the conventions listed above:
305(if text-mode-map 305(if text-mode-map
306 () ; @r{Do not change the keymap if it is already set up.} 306 () ; @r{Do not change the keymap if it is already set up.}
307 (setq text-mode-map (make-sparse-keymap)) 307 (setq text-mode-map (make-sparse-keymap))
308 (define-key text-mode-map "\t" 'tab-to-tab-stop) 308 (define-key text-mode-map "\t" 'indent-relative)
309 (define-key text-mode-map "\es" 'center-line) 309 (define-key text-mode-map "\es" 'center-line)
310 (define-key text-mode-map "\eS" 'center-paragraph)) 310 (define-key text-mode-map "\eS" 'center-paragraph))
311@end group 311@end group
@@ -399,7 +399,7 @@ mode functions:
399 (cond (lisp-syntax 399 (cond (lisp-syntax
400 (set-syntax-table lisp-mode-syntax-table))) 400 (set-syntax-table lisp-mode-syntax-table)))
401 (setq local-abbrev-table lisp-mode-abbrev-table) 401 (setq local-abbrev-table lisp-mode-abbrev-table)
402 @dots{}) 402 @dots{}
403@end group 403@end group
404@end smallexample 404@end smallexample
405 405
@@ -915,8 +915,8 @@ characters are reserved for major modes.)
915minor mode; with it, you can specify all about a simple minor mode in 915minor mode; with it, you can specify all about a simple minor mode in
916one self-contained definition. 916one self-contained definition.
917 917
918@tindex easy-mmode-define-minor-mode
919@defmac easy-mmode-define-minor-mode mode doc &optional init-value mode-indicator keymap 918@defmac easy-mmode-define-minor-mode mode doc &optional init-value mode-indicator keymap
919@tindex easy-mmode-define-minor-mode
920This macro defines a new minor mode whose name is @var{mode} (a symbol). 920This macro defines a new minor mode whose name is @var{mode} (a symbol).
921 921
922This macro defines a command named @var{mode} which toggles the minor 922This macro defines a command named @var{mode} which toggles the minor
@@ -1144,12 +1144,11 @@ line. There is nothing inherently special about these variables; any
1144other variables could have the same effects on the mode line if 1144other variables could have the same effects on the mode line if
1145@code{mode-line-format} were changed to use them. 1145@code{mode-line-format} were changed to use them.
1146 1146
1147@tindex mode-line-mule-info
1148@defvar mode-line-mule-info 1147@defvar mode-line-mule-info
1148@tindex mode-line-mule-info
1149This variable holds the value of the mode-line construct that displays 1149This variable holds the value of the mode-line construct that displays
1150information about the language environment, buffer coding system, and 1150information about the language environment, buffer coding system, and
1151current input method. @xref{International,,, emacs, The GNU Emacs 1151current input method. @xref{Non-ASCII Characters}.
1152Manual}.
1153@end defvar 1152@end defvar
1154 1153
1155@defvar mode-line-modified 1154@defvar mode-line-modified
@@ -1165,8 +1164,8 @@ modified.
1165Changing this variable does not force an update of the mode line. 1164Changing this variable does not force an update of the mode line.
1166@end defvar 1165@end defvar
1167 1166
1168@tindex mode-line-frame-identification
1169@defvar mode-line-frame-identification 1167@defvar mode-line-frame-identification
1168@tindex mode-line-frame-identification
1170This variable identifies the current frame. The default value is 1169This variable identifies the current frame. The default value is
1171@code{" "} if you are using a window system which can show multiple 1170@code{" "} if you are using a window system which can show multiple
1172frames, or @code{"-%F "} on an ordinary terminal which shows only one 1171frames, or @code{"-%F "} on an ordinary terminal which shows only one
@@ -1426,6 +1425,7 @@ selected by the user, calls @var{function} with arguments
1426 1425
1427For Emacs Lisp mode, @var{pattern} could look like this: 1426For Emacs Lisp mode, @var{pattern} could look like this:
1428 1427
1428@c should probably use imenu-syntax-alist and \\sw rather than [-A-Za-z0-9+]
1429@example 1429@example
1430@group 1430@group
1431((nil "^\\s-*(def\\(un\\|subst\\|macro\\|advice\\)\ 1431((nil "^\\s-*(def\\(un\\|subst\\|macro\\|advice\\)\
@@ -1437,7 +1437,8 @@ For Emacs Lisp mode, @var{pattern} could look like this:
1437@end group 1437@end group
1438@group 1438@group
1439 ("*Types*" 1439 ("*Types*"
1440 "^\\s-*(def\\(type\\|struct\\|class\\|ine-condition\\)\ 1440 "^\\s-*\
1441(def\\(type\\|struct\\|class\\|ine-condition\\)\
1441\\s-+\\([-A-Za-z0-9+]+\\)" 2)) 1442\\s-+\\([-A-Za-z0-9+]+\\)" 2))
1442@end group 1443@end group
1443@end example 1444@end example
@@ -1446,9 +1447,40 @@ Setting this variable makes it buffer-local in the current buffer.
1446@end defvar 1447@end defvar
1447 1448
1448@defvar imenu-case-fold-search 1449@defvar imenu-case-fold-search
1449This variable controls whether the regular expression matching for Imenu 1450This variable controls whether matching against
1450is case-sensitive: @code{t}, the default, means matching should ignore 1451@var{imenu-generic-expression} is case-sensitive: @code{t}, the default,
1451case. 1452means matching should ignore case.
1453
1454Setting this variable makes it buffer-local in the current buffer.
1455@end defvar
1456
1457@defvar imenu-syntax-alist
1458This variable is an alist of syntax table modifiers to use while
1459executing @code{imenu--generic-function} to override the syntax table of
1460the current buffer. Each element should have this form:
1461
1462@example
1463(@var{characters} . @var{syntax-description})
1464@end example
1465
1466The @sc{car}, @var{characters}, can be either a character or a string.
1467The element says to give that character or characters the syntax
1468specified by @var{syntax-description}, which is passed to
1469@code{modify-syntax-entry} (@pxref{Syntax Table Functions}).
1470
1471This feature is typically used to give word syntax to characters which
1472normally have symbol syntax, and thus to simplify
1473@code{imenu-generic-expression} and speed up matching.
1474For example, Fortran mode uses it this way:
1475
1476@example
1477 (setq imenu-syntax-alist '(("_$" . "w")))
1478@end example
1479
1480The @code{imenu-generic-expression} patterns can then use @samp{\\sw+}
1481instead of @samp{\\(\\sw\\|\\s_\\)\\}. Note that this technique may be
1482inconvenient to use when the mode needs to limit the initial character
1483of a name to a smaller set of characters
1452 1484
1453Setting this variable makes it buffer-local in the current buffer. 1485Setting this variable makes it buffer-local in the current buffer.
1454@end defvar 1486@end defvar
@@ -1568,7 +1600,7 @@ first symbol specifies how to do level 1 fontification, the second
1568symbol how to do level 2, and so on. 1600symbol how to do level 2, and so on.
1569 1601
1570The second element, @var{keywords-only}, specifies the value of the 1602The second element, @var{keywords-only}, specifies the value of the
1571variable @code{font-lock-keywords-only}. If this is is non-@code{nil}, 1603variable @code{font-lock-keywords-only}. If this is non-@code{nil},
1572syntactic fontification (of strings and comments) is not performed. 1604syntactic fontification (of strings and comments) is not performed.
1573 1605
1574The third element, @var{case-fold}, specifies the value of 1606The third element, @var{case-fold}, specifies the value of
@@ -1731,7 +1763,7 @@ where @var{submatcher} is much like @var{matcher}, with one
1731exception---see below. @var{pre-match-form} and @var{post-match-form} 1763exception---see below. @var{pre-match-form} and @var{post-match-form}
1732are evaluated before the first, and after the last, instance 1764are evaluated before the first, and after the last, instance
1733@var{anchored}'s @var{submatcher} is used. Therefore they can be used 1765@var{anchored}'s @var{submatcher} is used. Therefore they can be used
1734to initialise before, and cleanup after, @var{submatcher} is used. 1766to initialize before, and cleanup after, @var{submatcher} is used.
1735Typically, @var{pre-match-form} is used to move to some position 1767Typically, @var{pre-match-form} is used to move to some position
1736relative to the original @var{submatcher}, before starting with 1768relative to the original @var{submatcher}, before starting with
1737@var{anchored}'s @var{submatcher}. @var{post-match-form} might be used 1769@var{anchored}'s @var{submatcher}. @var{post-match-form} might be used
@@ -1787,7 +1819,7 @@ syntactically; it should only fontify based on
1787@end defvar 1819@end defvar
1788 1820
1789@ignore 1821@ignore
1790Other variables include those for buffer-specialised fontification functions, 1822Other variables include those for buffer-specialized fontification functions,
1791`font-lock-fontify-buffer-function', `font-lock-unfontify-buffer-function', 1823`font-lock-fontify-buffer-function', `font-lock-unfontify-buffer-function',
1792`font-lock-fontify-region-function', `font-lock-unfontify-region-function', 1824`font-lock-fontify-region-function', `font-lock-unfontify-region-function',
1793`font-lock-inhibit-thing-lock' and `font-lock-maximum-size'. 1825`font-lock-inhibit-thing-lock' and `font-lock-maximum-size'.
@@ -2039,6 +2071,27 @@ For example, here's how @code{emacs-lisp-mode} runs its mode hook:
2039@end example 2071@end example
2040@end defun 2072@end defun
2041 2073
2074@defun run-hook-with-args hook &rest args
2075This function is the way to run an abnormal hook which passes arguments
2076to the hook functions. It calls each of the hook functions, passing
2077each of them the arguments @var{args}.
2078@end defun
2079
2080@defun run-hook-with-args-until-failure hook &rest args
2081This function is the way to run an abnormal hook which passes arguments
2082to the hook functions, and stops as soon as any hook function fails. It
2083calls each of the hook functions, passing each of them the arguments
2084@var{args}, until some hook function returns @code{nil}. Then it stops.
2085@end defun
2086
2087@defun run-hook-with-args-until-success hook &rest args
2088This function is the way to run an abnormal hook which passes arguments
2089to the hook functions, and stops as soon as any hook function succeeds.
2090It calls each of the hook functions, passing each of them the arguments
2091@var{args}, until some hook function returns non-@code{nil}. Then it
2092stops.
2093@end defun
2094
2042@defun add-hook hook function &optional append local 2095@defun add-hook hook function &optional append local
2043This function is the handy way to add function @var{function} to hook 2096This function is the handy way to add function @var{function} to hook
2044variable @var{hook}. The argument @var{function} may be any valid Lisp 2097variable @var{hook}. The argument @var{function} may be any valid Lisp
diff --git a/lispref/nonascii.texi b/lispref/nonascii.texi
index f75900d6818..ac7c9ed9c43 100644
--- a/lispref/nonascii.texi
+++ b/lispref/nonascii.texi
@@ -17,15 +17,12 @@ characters and how they are stored in strings and buffers.
17* Selecting a Representation:: 17* Selecting a Representation::
18* Character Codes:: 18* Character Codes::
19* Character Sets:: 19* Character Sets::
20* Scanning Charsets::
21* Chars and Bytes:: 20* Chars and Bytes::
21* Splitting Characters::
22* Scanning Charsets::
23* Translation of Characters::
22* Coding Systems:: 24* Coding Systems::
23* Lisp and Coding System:: 25* Input Methods::
24* Default Coding Systems::
25* Specifying Coding Systems::
26* Explicit Encoding::
27* MS-DOS File Types::
28* MS-DOS Subprocesses::
29@end menu 26@end menu
30 27
31@node Text Representations 28@node Text Representations
@@ -53,19 +50,17 @@ character set by setting the variable @code{nonascii-insert-offset}).
53byte, and as a result, the full range of Emacs character codes can be 50byte, and as a result, the full range of Emacs character codes can be
54stored. The first byte of a multibyte character is always in the range 51stored. The first byte of a multibyte character is always in the range
55128 through 159 (octal 0200 through 0237). These values are called 52128 through 159 (octal 0200 through 0237). These values are called
56@dfn{leading codes}. The first byte determines which character set the 53@dfn{leading codes}. The second and subsequent bytes of a multibyte
57character belongs to (@pxref{Character Sets}); in particular, it 54character are always in the range 160 through 255 (octal 0240 through
58determines how many bytes long the sequence is. The second and 550377).
59subsequent bytes of a multibyte character are always in the range 160
60through 255 (octal 0240 through 0377).
61 56
62 In a buffer, the buffer-local value of the variable 57 In a buffer, the buffer-local value of the variable
63@code{enable-multibyte-characters} specifies the representation used. 58@code{enable-multibyte-characters} specifies the representation used.
64The representation for a string is determined based on the string 59The representation for a string is determined based on the string
65contents when the string is constructed. 60contents when the string is constructed.
66 61
67@tindex enable-multibyte-characters
68@defvar enable-multibyte-characters 62@defvar enable-multibyte-characters
63@tindex enable-multibyte-characters
69This variable specifies the current buffer's text representation. 64This variable specifies the current buffer's text representation.
70If it is non-@code{nil}, the buffer contains multibyte text; otherwise, 65If it is non-@code{nil}, the buffer contains multibyte text; otherwise,
71it contains unibyte text. 66it contains unibyte text.
@@ -74,20 +69,21 @@ You cannot set this variable directly; instead, use the function
74@code{set-buffer-multibyte} to change a buffer's representation. 69@code{set-buffer-multibyte} to change a buffer's representation.
75@end defvar 70@end defvar
76 71
77@tindex default-enable-multibyte-characters
78@defvar default-enable-multibyte-characters 72@defvar default-enable-multibyte-characters
79This variable`s value is entirely equivalent to @code{(default-value 73@tindex default-enable-multibyte-characters
74This variable's value is entirely equivalent to @code{(default-value
80'enable-multibyte-characters)}, and setting this variable changes that 75'enable-multibyte-characters)}, and setting this variable changes that
81default value. Although setting the local binding of 76default value. Setting the local binding of
82@code{enable-multibyte-characters} in a specific buffer is dangerous, 77@code{enable-multibyte-characters} in a specific buffer is not allowed,
83changing the default value is safe, and it is a reasonable thing to do. 78but changing the default value is supported, and it is a reasonable
79thing to do, because it has no effect on existing buffers.
84 80
85The @samp{--unibyte} command line option does its job by setting the 81The @samp{--unibyte} command line option does its job by setting the
86default value to @code{nil} early in startup. 82default value to @code{nil} early in startup.
87@end defvar 83@end defvar
88 84
89@tindex multibyte-string-p
90@defun multibyte-string-p string 85@defun multibyte-string-p string
86@tindex multibyte-string-p
91Return @code{t} if @var{string} contains multibyte characters. 87Return @code{t} if @var{string} contains multibyte characters.
92@end defun 88@end defun
93 89
@@ -120,11 +116,12 @@ user that cannot be overridden automatically.
120unchanged, and likewise 128 through 159. It converts the non-@sc{ASCII} 116unchanged, and likewise 128 through 159. It converts the non-@sc{ASCII}
121codes 160 through 255 by adding the value @code{nonascii-insert-offset} 117codes 160 through 255 by adding the value @code{nonascii-insert-offset}
122to each character code. By setting this variable, you specify which 118to each character code. By setting this variable, you specify which
123character set the unibyte characters correspond to. For example, if 119character set the unibyte characters correspond to (@pxref{Character
124@code{nonascii-insert-offset} is 2048, which is @code{(- (make-char 120Sets}). For example, if @code{nonascii-insert-offset} is 2048, which is
125'latin-iso8859-1 0) 128)}, then the unibyte non-@sc{ASCII} characters 121@code{(- (make-char 'latin-iso8859-1) 128)}, then the unibyte
126correspond to Latin 1. If it is 2688, which is @code{(- (make-char 122non-@sc{ASCII} characters correspond to Latin 1. If it is 2688, which
127'greek-iso8859-7 0) 128)}, then they correspond to Greek letters. 123is @code{(- (make-char 'greek-iso8859-7) 128)}, then they correspond to
124Greek letters.
128 125
129 Converting multibyte text to unibyte is simpler: it performs 126 Converting multibyte text to unibyte is simpler: it performs
130logical-and of each character code with 255. If 127logical-and of each character code with 255. If
@@ -133,21 +130,22 @@ the beginning of some character set, this conversion is the inverse of
133the other: converting unibyte text to multibyte and back to unibyte 130the other: converting unibyte text to multibyte and back to unibyte
134reproduces the original unibyte text. 131reproduces the original unibyte text.
135 132
136@tindex nonascii-insert-offset
137@defvar nonascii-insert-offset 133@defvar nonascii-insert-offset
134@tindex nonascii-insert-offset
138This variable specifies the amount to add to a non-@sc{ASCII} character 135This variable specifies the amount to add to a non-@sc{ASCII} character
139when converting unibyte text to multibyte. It also applies when 136when converting unibyte text to multibyte. It also applies when
140@code{insert-char} or @code{self-insert-command} inserts a character in 137@code{self-insert-command} inserts a character in the unibyte
141the unibyte non-@sc{ASCII} range, 128 through 255. 138non-@sc{ASCII} range, 128 through 255. However, the function
139@code{insert-char} does not perform this conversion.
142 140
143The right value to use to select character set @var{cs} is @code{(- 141The right value to use to select character set @var{cs} is @code{(-
144(make-char @var{cs} 0) 128)}. If the value of 142(make-char @var{cs}) 128)}. If the value of
145@code{nonascii-insert-offset} is zero, then conversion actually uses the 143@code{nonascii-insert-offset} is zero, then conversion actually uses the
146value for the Latin 1 character set, rather than zero. 144value for the Latin 1 character set, rather than zero.
147@end defvar 145@end defvar
148 146
149@tindex nonascii-translate-table 147@defvar nonascii-translation-table
150@defvar nonascii-translate-table 148@tindex nonascii-translation-table
151This variable provides a more general alternative to 149This variable provides a more general alternative to
152@code{nonascii-insert-offset}. You can use it to specify independently 150@code{nonascii-insert-offset}. You can use it to specify independently
153how to translate each code in the range of 128 through 255 into a 151how to translate each code in the range of 128 through 255 into a
@@ -155,15 +153,15 @@ multibyte character. The value should be a vector, or @code{nil}.
155If this is non-@code{nil}, it overrides @code{nonascii-insert-offset}. 153If this is non-@code{nil}, it overrides @code{nonascii-insert-offset}.
156@end defvar 154@end defvar
157 155
158@tindex string-make-unibyte
159@defun string-make-unibyte string 156@defun string-make-unibyte string
157@tindex string-make-unibyte
160This function converts the text of @var{string} to unibyte 158This function converts the text of @var{string} to unibyte
161representation, if it isn't already, and return the result. If 159representation, if it isn't already, and return the result. If
162@var{string} is a unibyte string, it is returned unchanged. 160@var{string} is a unibyte string, it is returned unchanged.
163@end defun 161@end defun
164 162
165@tindex string-make-multibyte
166@defun string-make-multibyte string 163@defun string-make-multibyte string
164@tindex string-make-multibyte
167This function converts the text of @var{string} to multibyte 165This function converts the text of @var{string} to multibyte
168representation, if it isn't already, and return the result. If 166representation, if it isn't already, and return the result. If
169@var{string} is a multibyte string, it is returned unchanged. 167@var{string} is a multibyte string, it is returned unchanged.
@@ -175,8 +173,8 @@ representation, if it isn't already, and return the result. If
175 Sometimes it is useful to examine an existing buffer or string as 173 Sometimes it is useful to examine an existing buffer or string as
176multibyte when it was unibyte, or vice versa. 174multibyte when it was unibyte, or vice versa.
177 175
178@tindex set-buffer-multibyte
179@defun set-buffer-multibyte multibyte 176@defun set-buffer-multibyte multibyte
177@tindex set-buffer-multibyte
180Set the representation type of the current buffer. If @var{multibyte} 178Set the representation type of the current buffer. If @var{multibyte}
181is non-@code{nil}, the buffer becomes multibyte. If @var{multibyte} 179is non-@code{nil}, the buffer becomes multibyte. If @var{multibyte}
182is @code{nil}, the buffer becomes unibyte. 180is @code{nil}, the buffer becomes unibyte.
@@ -193,8 +191,8 @@ representation is in use. It also adjusts various data in the buffer
193same text as they did before. 191same text as they did before.
194@end defun 192@end defun
195 193
196@tindex string-as-unibyte
197@defun string-as-unibyte string 194@defun string-as-unibyte string
195@tindex string-as-unibyte
198This function returns a string with the same bytes as @var{string} but 196This function returns a string with the same bytes as @var{string} but
199treating each byte as a character. This means that the value may have 197treating each byte as a character. This means that the value may have
200more characters than @var{string} has. 198more characters than @var{string} has.
@@ -203,8 +201,8 @@ If @var{string} is unibyte already, then the value is @var{string}
203itself. 201itself.
204@end defun 202@end defun
205 203
206@tindex string-as-multibyte
207@defun string-as-multibyte string 204@defun string-as-multibyte string
205@tindex string-as-multibyte
208This function returns a string with the same bytes as @var{string} but 206This function returns a string with the same bytes as @var{string} but
209treating each multibyte sequence as one character. This means that the 207treating each multibyte sequence as one character. This means that the
210value may have fewer characters than @var{string} has. 208value may have fewer characters than @var{string} has.
@@ -253,88 +251,93 @@ example, @code{latin-iso8859-1} is one character set,
253@code{greek-iso8859-7} is another, and @code{ascii} is another. An 251@code{greek-iso8859-7} is another, and @code{ascii} is another. An
254Emacs character set can hold at most 9025 characters; therefore, in some 252Emacs character set can hold at most 9025 characters; therefore, in some
255cases, characters that would logically be grouped together are split 253cases, characters that would logically be grouped together are split
256into several character sets. For example, one set of Chinese characters 254into several character sets. For example, one set of Chinese
257is divided into eight Emacs character sets, @code{chinese-cns11643-1} 255characters, generally known as Big 5, is divided into two Emacs
258through @code{chinese-cns11643-7}. 256character sets, @code{chinese-big5-1} and @code{chinese-big5-2}.
259 257
260@tindex charsetp
261@defun charsetp object 258@defun charsetp object
259@tindex charsetp
262Return @code{t} if @var{object} is a character set name symbol, 260Return @code{t} if @var{object} is a character set name symbol,
263@code{nil} otherwise. 261@code{nil} otherwise.
264@end defun 262@end defun
265 263
266@tindex charset-list
267@defun charset-list 264@defun charset-list
265@tindex charset-list
268This function returns a list of all defined character set names. 266This function returns a list of all defined character set names.
269@end defun 267@end defun
270 268
271@tindex char-charset
272@defun char-charset character 269@defun char-charset character
273This function returns the the name of the character 270@tindex char-charset
271This function returns the name of the character
274set that @var{character} belongs to. 272set that @var{character} belongs to.
275@end defun 273@end defun
276 274
277@node Scanning Charsets
278@section Scanning for Character Sets
279
280 Sometimes it is useful to find out which character sets appear in a
281part of a buffer or a string. One use for this is in determining which
282coding systems (@pxref{Coding Systems}) are capable of representing all
283of the text in question.
284
285@tindex find-charset-region
286@defun find-charset-region beg end &optional unification
287This function returns a list of the character sets
288that appear in the current buffer between positions @var{beg}
289and @var{end}.
290@end defun
291
292@tindex find-charset-string
293@defun find-charset-string string &optional unification
294This function returns a list of the character sets
295that appear in the string @var{string}.
296@end defun
297
298@node Chars and Bytes 275@node Chars and Bytes
299@section Characters and Bytes 276@section Characters and Bytes
300@cindex bytes and characters 277@cindex bytes and characters
301 278
279@cindex introduction sequence
280@cindex dimension (of character set)
302 In multibyte representation, each character occupies one or more 281 In multibyte representation, each character occupies one or more
303bytes. The functions in this section convert between characters and the 282bytes. Each character set has an @dfn{introduction sequence}, which is
304byte values used to represent them. For most purposes, there is no need 283one or two bytes long. The introduction sequence is the beginning of
305to be concerned with the number of bytes used to represent a character 284the byte sequence for any character in the character set. (The
285@sc{ASCII} character set has a zero-length introduction sequence.) The
286rest of the character's bytes distinguish it from the other characters
287in the same character set. Depending on the character set, there are
288either one or two distinguishing bytes; the number of such bytes is
289called the @dfn{dimension} of the character set.
290
291@defun charset-dimension charset
292@tindex charset-dimension
293This function returns the dimension of @var{charset};
294At present, the dimension is always 1 or 2.
295@end defun
296
297 This is the simplest way to determine the byte length of a character
298set's introduction sequence:
299
300@example
301(- (char-bytes (make-char @var{charset}))
302 (charset-dimension @var{charset}))
303@end example
304
305@node Splitting Characters
306@section Splitting Characters
307
308 The functions in this section convert between characters and the byte
309values used to represent them. For most purposes, there is no need to
310be concerned with the sequence of bytes used to represent a character,
306because Emacs translates automatically when necessary. 311because Emacs translates automatically when necessary.
307 312
308@tindex char-bytes
309@defun char-bytes character 313@defun char-bytes character
314@tindex char-bytes
310This function returns the number of bytes used to represent the 315This function returns the number of bytes used to represent the
311character @var{character}. In most cases, this is the same as 316character @var{character}. This depends only on the character set that
312@code{(length (split-char @var{character}))}; the only exception is for 317@var{character} belongs to; it equals the dimension of that character
313ASCII characters and the codes used in unibyte text, which use just one 318set (@pxref{Character Sets}), plus the length of its introduction
314byte. 319sequence.
315 320
316@example 321@example
317(char-bytes 2248) 322(char-bytes 2248)
318 @result{} 2 323 @result{} 2
319(char-bytes 65) 324(char-bytes 65)
320 @result{} 1 325 @result{} 1
321@end example
322
323This function's values are correct for both multibyte and unibyte
324representations, because the non-@sc{ASCII} character codes used in
325those two representations do not overlap.
326
327@example
328(char-bytes 192) 326(char-bytes 192)
329 @result{} 1 327 @result{} 1
330@end example 328@end example
329
330The reason this function can give correct results for both multibyte and
331unibyte representations is that the non-@sc{ASCII} character codes used
332in those two representations do not overlap.
331@end defun 333@end defun
332 334
333@tindex split-char
334@defun split-char character 335@defun split-char character
336@tindex split-char
335Return a list containing the name of the character set of 337Return a list containing the name of the character set of
336@var{character}, followed by one or two byte-values which identify 338@var{character}, followed by one or two byte values (integers) which
337@var{character} within that character set. 339identify @var{character} within that character set. The number of byte
340values is the character set's dimension.
338 341
339@example 342@example
340(split-char 2248) 343(split-char 2248)
@@ -352,11 +355,13 @@ the @code{ascii} character set:
352@end example 355@end example
353@end defun 356@end defun
354 357
355@tindex make-char
356@defun make-char charset &rest byte-values 358@defun make-char charset &rest byte-values
357Thus function returns the character in character set @var{charset} 359@tindex make-char
358identified by @var{byte-values}. This is roughly the opposite of 360This function returns the character in character set @var{charset}
359split-char. 361identified by @var{byte-values}. This is roughly the inverse of
362@code{split-char}. Normally, you should specify either one or two
363@var{byte-values}, according to the dimension of @var{charset}. For
364example,
360 365
361@example 366@example
362(make-char 'latin-iso8859-1 72) 367(make-char 'latin-iso8859-1 72)
@@ -364,6 +369,105 @@ split-char.
364@end example 369@end example
365@end defun 370@end defun
366 371
372@cindex generic characters
373 If you call @code{make-char} with no @var{byte-values}, the result is
374a @dfn{generic character} which stands for @var{charset}. A generic
375character is an integer, but it is @emph{not} valid for insertion in the
376buffer as a character. It can be used in @code{char-table-range} to
377refer to the whole character set (@pxref{Char-Tables}).
378@code{char-valid-p} returns @code{nil} for generic characters.
379For example:
380
381@example
382(make-char 'latin-iso8859-1)
383 @result{} 2176
384(char-valid-p 2176)
385 @result{} nil
386(split-char 2176)
387 @result{} (latin-iso8859-1 0)
388@end example
389
390@node Scanning Charsets
391@section Scanning for Character Sets
392
393 Sometimes it is useful to find out which character sets appear in a
394part of a buffer or a string. One use for this is in determining which
395coding systems (@pxref{Coding Systems}) are capable of representing all
396of the text in question.
397
398@defun find-charset-region beg end &optional translation
399@tindex find-charset-region
400This function returns a list of the character sets that appear in the
401current buffer between positions @var{beg} and @var{end}.
402
403The optional argument @var{translation} specifies a translation table to
404be used in scanning the text (@pxref{Translation of Characters}). If it
405is non-@code{nil}, then each character in the region is translated
406through this table, and the value returned describes the translated
407characters instead of the characters actually in the buffer.
408@end defun
409
410@defun find-charset-string string &optional translation
411@tindex find-charset-string
412This function returns a list of the character sets
413that appear in the string @var{string}.
414
415The optional argument @var{translation} specifies a
416translation table; see @code{find-charset-region}, above.
417@end defun
418
419@node Translation of Characters
420@section Translation of Characters
421@cindex character translation tables
422@cindex translation tables
423
424 A @dfn{translation table} specifies a mapping of characters
425into characters. These tables are used in encoding and decoding, and
426for other purposes. Some coding systems specify their own particular
427translation tables; there are also default translation tables which
428apply to all other coding systems.
429
430@defun make-translation-table translations
431This function returns a translation table based on the arguments
432@var{translations}. Each argument---each element of
433@var{translations}---should be a list of the form @code{(@var{from}
434. @var{to})}; this says to translate the character @var{from} into
435@var{to}.
436
437You can also map one whole character set into another character set with
438the same dimension. To do this, you specify a generic character (which
439designates a character set) for @var{from} (@pxref{Splitting Characters}).
440In this case, @var{to} should also be a generic character, for another
441character set of the same dimension. Then the translation table
442translates each character of @var{from}'s character set into the
443corresponding character of @var{to}'s character set.
444@end defun
445
446 In decoding, the translation table's translations are applied to the
447characters that result from ordinary decoding. If a coding system has
448property @code{character-translation-table-for-decode}, that specifies
449the translation table to use. Otherwise, if
450@code{standard-character-translation-table-for-decode} is
451non-@code{nil}, decoding uses that table.
452
453 In encoding, the translation table's translations are applied to the
454characters in the buffer, and the result of translation is actually
455encoded. If a coding system has property
456@code{character-translation-table-for-encode}, that specifies the
457translation table to use. Otherwise the variable
458@code{standard-character-translation-table-for-encode} specifies the
459translation table.
460
461@defvar standard-character-translation-table-for-decode
462This is the default translation table for decoding, for
463coding systems that don't specify any other translation table.
464@end defvar
465
466@defvar standard-character-translation-table-for-encode
467This is the default translation table for encoding, for
468coding systems that don't specify any other translation table.
469@end defvar
470
367@node Coding Systems 471@node Coding Systems
368@section Coding Systems 472@section Coding Systems
369 473
@@ -373,6 +477,20 @@ subprocess or receives text from a subprocess, it normally performs
373character code conversion and end-of-line conversion as specified 477character code conversion and end-of-line conversion as specified
374by a particular @dfn{coding system}. 478by a particular @dfn{coding system}.
375 479
480@menu
481* Coding System Basics::
482* Encoding and I/O::
483* Lisp and Coding Systems::
484* Default Coding Systems::
485* Specifying Coding Systems::
486* Explicit Encoding::
487* Terminal I/O Encoding::
488* MS-DOS File Types::
489@end menu
490
491@node Coding System Basics
492@subsection Basic Concepts of Coding Systems
493
376@cindex character code conversion 494@cindex character code conversion
377 @dfn{Character code conversion} involves conversion between the encoding 495 @dfn{Character code conversion} involves conversion between the encoding
378used inside Emacs and some other encoding. Emacs supports many 496used inside Emacs and some other encoding. Emacs supports many
@@ -401,129 +519,219 @@ carriage-return.
401conversion unspecified, to be chosen based on the data. @dfn{Variant 519conversion unspecified, to be chosen based on the data. @dfn{Variant
402coding systems} such as @code{latin-1-unix}, @code{latin-1-dos} and 520coding systems} such as @code{latin-1-unix}, @code{latin-1-dos} and
403@code{latin-1-mac} specify the end-of-line conversion explicitly as 521@code{latin-1-mac} specify the end-of-line conversion explicitly as
404well. Each base coding system has three corresponding variants whose 522well. Most base coding systems have three corresponding variants whose
405names are formed by adding @samp{-unix}, @samp{-dos} and @samp{-mac}. 523names are formed by adding @samp{-unix}, @samp{-dos} and @samp{-mac}.
406 524
525 The coding system @code{raw-text} is special in that it prevents
526character code conversion, and causes the buffer visited with that
527coding system to be a unibyte buffer. It does not specify the
528end-of-line conversion, allowing that to be determined as usual by the
529data, and has the usual three variants which specify the end-of-line
530conversion. @code{no-conversion} is equivalent to @code{raw-text-unix}:
531it specifies no conversion of either character codes or end-of-line.
532
533 The coding system @code{emacs-mule} specifies that the data is
534represented in the internal Emacs encoding. This is like
535@code{raw-text} in that no code conversion happens, but different in
536that the result is multibyte data.
537
538@defun coding-system-get coding-system property
539@tindex coding-system-get
540This function returns the specified property of the coding system
541@var{coding-system}. Most coding system properties exist for internal
542purposes, but one that you might find useful is @code{mime-charset}.
543That property's value is the name used in MIME for the character coding
544which this coding system can read and write. Examples:
545
546@example
547(coding-system-get 'iso-latin-1 'mime-charset)
548 @result{} iso-8859-1
549(coding-system-get 'iso-2022-cn 'mime-charset)
550 @result{} iso-2022-cn
551(coding-system-get 'cyrillic-koi8 'mime-charset)
552 @result{} koi8-r
553@end example
554
555The value of the @code{mime-charset} property is also defined
556as an alias for the coding system.
557@end defun
558
559@node Encoding and I/O
560@subsection Encoding and I/O
561
562 The principal purpose coding systems is for use in reading and
563writing files. The function @code{insert-file-contents} uses
564a coding system for decoding the file data, and @code{write-region}
565uses one to encode the buffer contents.
566
567 You can specify the coding system to use either explicitly
568(@pxref{Specifying Coding Systems}), or implicitly using the defaulting
569mechanism (@pxref{Default Coding Systems}). But these methods may not
570completely specify what to do. For example, they may choose a coding
571system such as @code{undefined} which leaves the character code
572conversion to be determined from the data. In these cases, the I/O
573operation finishes the job of choosing a coding system. Very often
574you will want to find out afterwards which coding system was chosen.
575
576@defvar buffer-file-coding-system
577@tindex buffer-file-coding-system
578This variable records the coding system that was used for visiting the
579current buffer. It is used for saving the buffer, and for writing part
580of the buffer with @code{write-region}. When those operations ask the
581user to specify a different coding system,
582@code{buffer-file-coding-system} is updated to the coding system
583specified.
584@end defvar
585
586@defvar save-buffer-coding-system
587@tindex save-buffer-coding-system
588This variable specifies the coding system for saving the buffer---but it
589is not used for @code{write-region}. When saving the buffer asks the
590user to specify a different coding system, and
591@code{save-buffer-coding-system} was used, then it is updated to the
592coding system that was specified.
593@end defvar
594
595@defvar last-coding-system-used
596@tindex last-coding-system-used
597I/O operations for files and subprocesses set this variable to the
598coding system name that was used. The explicit encoding and decoding
599functions (@pxref{Explicit Encoding}) set it too.
600
601@strong{Warning:} Since receiving subprocess output sets this variable,
602it can change whenever Emacs waits; therefore, you should use copy the
603value shortly after the function call which stores the value you are
604interested in.
605@end defvar
606
407@node Lisp and Coding Systems 607@node Lisp and Coding Systems
408@subsection Coding Systems in Lisp 608@subsection Coding Systems in Lisp
409 609
410 Here are Lisp facilities for working with coding systems; 610 Here are Lisp facilities for working with coding systems;
411 611
412@tindex coding-system-list
413@defun coding-system-list &optional base-only 612@defun coding-system-list &optional base-only
613@tindex coding-system-list
414This function returns a list of all coding system names (symbols). If 614This function returns a list of all coding system names (symbols). If
415@var{base-only} is non-@code{nil}, the value includes only the 615@var{base-only} is non-@code{nil}, the value includes only the
416base coding systems. Otherwise, it includes variant coding systems as well. 616base coding systems. Otherwise, it includes variant coding systems as well.
417@end defun 617@end defun
418 618
419@tindex coding-system-p
420@defun coding-system-p object 619@defun coding-system-p object
620@tindex coding-system-p
421This function returns @code{t} if @var{object} is a coding system 621This function returns @code{t} if @var{object} is a coding system
422name. 622name.
423@end defun 623@end defun
424 624
425@tindex check-coding-system
426@defun check-coding-system coding-system 625@defun check-coding-system coding-system
626@tindex check-coding-system
427This function checks the validity of @var{coding-system}. 627This function checks the validity of @var{coding-system}.
428If that is valid, it returns @var{coding-system}. 628If that is valid, it returns @var{coding-system}.
429Otherwise it signals an error with condition @code{coding-system-error}. 629Otherwise it signals an error with condition @code{coding-system-error}.
430@end defun 630@end defun
431 631
432@tindex find-safe-coding-system 632@defun coding-system-change-eol-conversion coding-system eol-type
433@defun find-safe-coding-system from to 633@tindex coding-system-change-eol-conversion
434Return a list of proper coding systems to encode a text between 634This function returns a coding system which is like @var{coding-system}
435@var{from} and @var{to}. All coding systems in the list can safely 635except for its in eol conversion, which is specified by @code{eol-type}.
436encode any multibyte characters in the text. 636@var{eol-type} should be @code{unix}, @code{dos}, @code{mac}, or
637@code{nil}. If it is @code{nil}, the returned coding system determines
638the end-of-line conversion from the data.
639@end defun
437 640
438If the text contains no multibyte characters, return a list of a single 641@defun coding-system-change-text-conversion eol-coding text-coding
439element @code{undecided}. 642@tindex coding-system-change-text-conversion
643This function returns a coding system which uses the end-of-line
644conversion of @var{eol-coding}, and the text conversion of
645@var{text-coding}. If @var{text-coding} is @code{nil}, it returns
646@code{undecided}, or one of its variants according to @var{eol-coding}.
440@end defun 647@end defun
441 648
649@defun find-coding-systems-region from to
650@tindex find-coding-systems-region
651This function returns a list of coding systems that could be used to
652encode a text between @var{from} and @var{to}. All coding systems in
653the list can safely encode any multibyte characters in that portion of
654the text.
655
656If the text contains no multibyte characters, the function returns the
657list @code{(undecided)}.
658@end defun
659
660@defun find-coding-systems-string string
661@tindex find-coding-systems-string
662This function returns a list of coding systems that could be used to
663encode the text of @var{string}. All coding systems in the list can
664safely encode any multibyte characters in @var{string}. If the text
665contains no multibyte characters, this returns the list
666@code{(undecided)}.
667@end defun
668
669@defun find-coding-systems-for-charsets charsets
670@tindex find-coding-systems-for-charsets
671This function returns a list of coding systems that could be used to
672encode all the character sets in the list @var{charsets}.
673@end defun
674
675@defun detect-coding-region start end &optional highest
442@tindex detect-coding-region 676@tindex detect-coding-region
443@defun detect-coding-region start end highest
444This function chooses a plausible coding system for decoding the text 677This function chooses a plausible coding system for decoding the text
445from @var{start} to @var{end}. This text should be ``raw bytes'' 678from @var{start} to @var{end}. This text should be ``raw bytes''
446(@pxref{Explicit Encoding}). 679(@pxref{Explicit Encoding}).
447 680
448Normally this function returns is a list of coding systems that could 681Normally this function returns a list of coding systems that could
449handle decoding the text that was scanned. They are listed in order of 682handle decoding the text that was scanned. They are listed in order of
450decreasing priority, based on the priority specified by the user with 683decreasing priority. But if @var{highest} is non-@code{nil}, then the
451@code{prefer-coding-system}. But if @var{highest} is non-@code{nil}, 684return value is just one coding system, the one that is highest in
452then the return value is just one coding system, the one that is highest 685priority.
453in priority. 686
687If the region contains only @sc{ASCII} characters, the value
688is @code{undecided} or @code{(undecided)}.
454@end defun 689@end defun
455 690
456@tindex detect-coding-string string highest 691@defun detect-coding-string string highest
457@defun detect-coding-string 692@tindex detect-coding-string
458This function is like @code{detect-coding-region} except that it 693This function is like @code{detect-coding-region} except that it
459operates on the contents of @var{string} instead of bytes in the buffer. 694operates on the contents of @var{string} instead of bytes in the buffer.
460@end defun 695@end defun
461 696
462@defun find-operation-coding-system operation &rest arguments
463This function returns the coding system to use (by default) for
464performing @var{operation} with @var{arguments}. The value has this
465form:
466
467@example
468(@var{decoding-system} @var{encoding-system})
469@end example
470
471The first element, @var{decoding-system}, is the coding system to use
472for decoding (in case @var{operation} does decoding), and
473@var{encoding-system} is the coding system for encoding (in case
474@var{operation} does encoding).
475
476The argument @var{operation} should be an Emacs I/O primitive:
477@code{insert-file-contents}, @code{write-region}, @code{call-process},
478@code{call-process-region}, @code{start-process}, or
479@code{open-network-stream}.
480
481The remaining arguments should be the same arguments that might be given
482to that I/O primitive. Depending on which primitive, one of those
483arguments is selected as the @dfn{target}. For example, if
484@var{operation} does file I/O, whichever argument specifies the file
485name is the target. For subprocess primitives, the process name is the
486target. For @code{open-network-stream}, the target is the service name
487or port number.
488
489This function looks up the target in @code{file-coding-system-alist},
490@code{process-coding-system-alist}, or
491@code{network-coding-system-alist}, depending on @var{operation}.
492@xref{Default Coding Systems}.
493@end defun
494
495 Here are two functions you can use to let the user specify a coding 697 Here are two functions you can use to let the user specify a coding
496system, with completion. @xref{Completion}. 698system, with completion. @xref{Completion}.
497 699
700@defun read-coding-system prompt &optional default
498@tindex read-coding-system 701@tindex read-coding-system
499@defun read-coding-system prompt default
500This function reads a coding system using the minibuffer, prompting with 702This function reads a coding system using the minibuffer, prompting with
501string @var{prompt}, and returns the coding system name as a symbol. If 703string @var{prompt}, and returns the coding system name as a symbol. If
502the user enters null input, @var{default} specifies which coding system 704the user enters null input, @var{default} specifies which coding system
503to return. It should be a symbol or a string. 705to return. It should be a symbol or a string.
504@end defun 706@end defun
505 707
506@tindex read-non-nil-coding-system
507@defun read-non-nil-coding-system prompt 708@defun read-non-nil-coding-system prompt
709@tindex read-non-nil-coding-system
508This function reads a coding system using the minibuffer, prompting with 710This function reads a coding system using the minibuffer, prompting with
509string @var{prompt},and returns the coding system name as a symbol. If 711string @var{prompt}, and returns the coding system name as a symbol. If
510the user tries to enter null input, it asks the user to try again. 712the user tries to enter null input, it asks the user to try again.
511@xref{Coding Systems}. 713@xref{Coding Systems}.
512@end defun 714@end defun
513 715
716 @xref{Process Information}, for how to examine or set the coding
717systems used for I/O to a subprocess.
718
514@node Default Coding Systems 719@node Default Coding Systems
515@section Default Coding Systems 720@subsection Default Coding Systems
516 721
517 These variable specify which coding system to use by default for 722 This section describes variables that specify the default coding
518certain files or when running certain subprograms. The idea of these 723system for certain files or when running certain subprograms, and the
519variables is that you set them once and for all to the defaults you 724function which which I/O operations use to access them.
520want, and then do not change them again. To specify a particular coding 725
521system for a particular operation in a Lisp program, don't change these 726 The idea of these variables is that you set them once and for all to the
522variables; instead, override them using @code{coding-system-for-read} 727defaults you want, and then do not change them again. To specify a
523and @code{coding-system-for-write} (@pxref{Specifying Coding Systems}). 728particular coding system for a particular operation in a Lisp program,
729don't change these variables; instead, override them using
730@code{coding-system-for-read} and @code{coding-system-for-write}
731(@pxref{Specifying Coding Systems}).
524 732
525@tindex file-coding-system-alist
526@defvar file-coding-system-alist 733@defvar file-coding-system-alist
734@tindex file-coding-system-alist
527This variable is an alist that specifies the coding systems to use for 735This variable is an alist that specifies the coding systems to use for
528reading and writing particular files. Each element has the form 736reading and writing particular files. Each element has the form
529@code{(@var{pattern} . @var{coding})}, where @var{pattern} is a regular 737@code{(@var{pattern} . @var{coding})}, where @var{pattern} is a regular
@@ -542,8 +750,8 @@ system or a cons cell containing two coding systems. This value is used
542as described above. 750as described above.
543@end defvar 751@end defvar
544 752
545@tindex process-coding-system-alist
546@defvar process-coding-system-alist 753@defvar process-coding-system-alist
754@tindex process-coding-system-alist
547This variable is an alist specifying which coding systems to use for a 755This variable is an alist specifying which coding systems to use for a
548subprocess, depending on which program is running in the subprocess. It 756subprocess, depending on which program is running in the subprocess. It
549works like @code{file-coding-system-alist}, except that @var{pattern} is 757works like @code{file-coding-system-alist}, except that @var{pattern} is
@@ -553,8 +761,21 @@ coding systems used for I/O to the subprocess, but you can specify
553other coding systems later using @code{set-process-coding-system}. 761other coding systems later using @code{set-process-coding-system}.
554@end defvar 762@end defvar
555 763
556@tindex network-coding-system-alist 764 @strong{Warning:} Coding systems such as @code{undecided} which
765determine the coding system from the data do not work entirely reliably
766with asynchronous subprocess output. This is because Emacs processes
767asynchronous subprocess output in batches, as it arrives. If the coding
768system leaves the character code conversion unspecified, or leaves the
769end-of-line conversion unspecified, Emacs must try to detect the proper
770conversion from one batch at a time, and this does not always work.
771
772 Therefore, with an asynchronous subprocess, if at all possible, use a
773coding system which determines both the character code conversion and
774the end of line conversion---that is, one like @code{latin-1-unix},
775rather than @code{undecided} or @code{latin-1}.
776
557@defvar network-coding-system-alist 777@defvar network-coding-system-alist
778@tindex network-coding-system-alist
558This variable is an alist that specifies the coding system to use for 779This variable is an alist that specifies the coding system to use for
559network streams. It works much like @code{file-coding-system-alist}, 780network streams. It works much like @code{file-coding-system-alist},
560with the difference that the @var{pattern} in an element may be either a 781with the difference that the @var{pattern} in an element may be either a
@@ -563,26 +784,60 @@ is matched against the network service name used to open the network
563stream. 784stream.
564@end defvar 785@end defvar
565 786
566@tindex default-process-coding-system
567@defvar default-process-coding-system 787@defvar default-process-coding-system
788@tindex default-process-coding-system
568This variable specifies the coding systems to use for subprocess (and 789This variable specifies the coding systems to use for subprocess (and
569network stream) input and output, when nothing else specifies what to 790network stream) input and output, when nothing else specifies what to
570do. 791do.
571 792
572The value should be a cons cell of the form @code{(@var{output-coding} 793The value should be a cons cell of the form @code{(@var{input-coding}
573. @var{input-coding})}. Here @var{output-coding} applies to output to 794. @var{output-coding})}. Here @var{input-coding} applies to input from
574the subprocess, and @var{input-coding} applies to input from it. 795the subprocess, and @var{output-coding} applies to output to it.
575@end defvar 796@end defvar
576 797
798@defun find-operation-coding-system operation &rest arguments
799@tindex find-operation-coding-system
800This function returns the coding system to use (by default) for
801performing @var{operation} with @var{arguments}. The value has this
802form:
803
804@example
805(@var{decoding-system} @var{encoding-system})
806@end example
807
808The first element, @var{decoding-system}, is the coding system to use
809for decoding (in case @var{operation} does decoding), and
810@var{encoding-system} is the coding system for encoding (in case
811@var{operation} does encoding).
812
813The argument @var{operation} should be an Emacs I/O primitive:
814@code{insert-file-contents}, @code{write-region}, @code{call-process},
815@code{call-process-region}, @code{start-process}, or
816@code{open-network-stream}.
817
818The remaining arguments should be the same arguments that might be given
819to that I/O primitive. Depending on which primitive, one of those
820arguments is selected as the @dfn{target}. For example, if
821@var{operation} does file I/O, whichever argument specifies the file
822name is the target. For subprocess primitives, the process name is the
823target. For @code{open-network-stream}, the target is the service name
824or port number.
825
826This function looks up the target in @code{file-coding-system-alist},
827@code{process-coding-system-alist}, or
828@code{network-coding-system-alist}, depending on @var{operation}.
829@xref{Default Coding Systems}.
830@end defun
831
577@node Specifying Coding Systems 832@node Specifying Coding Systems
578@section Specifying a Coding System for One Operation 833@subsection Specifying a Coding System for One Operation
579 834
580 You can specify the coding system for a specific operation by binding 835 You can specify the coding system for a specific operation by binding
581the variables @code{coding-system-for-read} and/or 836the variables @code{coding-system-for-read} and/or
582@code{coding-system-for-write}. 837@code{coding-system-for-write}.
583 838
584@tindex coding-system-for-read
585@defvar coding-system-for-read 839@defvar coding-system-for-read
840@tindex coding-system-for-read
586If this variable is non-@code{nil}, it specifies the coding system to 841If this variable is non-@code{nil}, it specifies the coding system to
587use for reading a file, or for input from a synchronous subprocess. 842use for reading a file, or for input from a synchronous subprocess.
588 843
@@ -605,14 +860,14 @@ of the right way to use the variable:
605@end example 860@end example
606 861
607When its value is non-@code{nil}, @code{coding-system-for-read} takes 862When its value is non-@code{nil}, @code{coding-system-for-read} takes
608precedence all other methods of specifying a coding system to use for 863precedence over all other methods of specifying a coding system to use for
609input, including @code{file-coding-system-alist}, 864input, including @code{file-coding-system-alist},
610@code{process-coding-system-alist} and 865@code{process-coding-system-alist} and
611@code{network-coding-system-alist}. 866@code{network-coding-system-alist}.
612@end defvar 867@end defvar
613 868
614@tindex coding-system-for-write
615@defvar coding-system-for-write 869@defvar coding-system-for-write
870@tindex coding-system-for-write
616This works much like @code{coding-system-for-read}, except that it 871This works much like @code{coding-system-for-read}, except that it
617applies to output rather than input. It affects writing to files, 872applies to output rather than input. It affects writing to files,
618subprocesses, and net connections. 873subprocesses, and net connections.
@@ -623,53 +878,16 @@ When a single operation does both input and output, as do
623affect it. 878affect it.
624@end defvar 879@end defvar
625 880
626@tindex last-coding-system-used
627@defvar last-coding-system-used
628All I/O operations that use a coding system set this variable
629to the coding system name that was used.
630@end defvar
631
632@tindex inhibit-eol-conversion
633@defvar inhibit-eol-conversion 881@defvar inhibit-eol-conversion
882@tindex inhibit-eol-conversion
634When this variable is non-@code{nil}, no end-of-line conversion is done, 883When this variable is non-@code{nil}, no end-of-line conversion is done,
635no matter which coding system is specified. This applies to all the 884no matter which coding system is specified. This applies to all the
636Emacs I/O and subprocess primitives, and to the explicit encoding and 885Emacs I/O and subprocess primitives, and to the explicit encoding and
637decoding functions (@pxref{Explicit Encoding}). 886decoding functions (@pxref{Explicit Encoding}).
638@end defvar 887@end defvar
639 888
640@tindex keyboard-coding-system
641@defun keyboard-coding-system
642This function returns the coding system that is in use for decoding
643keyboard input---or @code{nil} if no coding system is to be used.
644@end defun
645
646@tindex set-keyboard-coding-system
647@defun set-keyboard-coding-system coding-system
648This function specifies @var{coding-system} as the coding system to
649use for decoding keyboard input. If @var{coding-system} is @code{nil},
650that means do not decode keyboard input.
651@end defun
652
653@tindex terminal-coding-system
654@defun terminal-coding-system
655This function returns the coding system that is in use for encoding
656terminal output---or @code{nil} for no encoding.
657@end defun
658
659@tindex set-terminal-coding-system
660@defun set-terminal-coding-system coding-system
661This function specifies @var{coding-system} as the coding system to use
662for encoding terminal output. If @var{coding-system} is @code{nil},
663that means do not encode terminal output.
664@end defun
665
666 See also the functions @code{process-coding-system} and
667@code{set-process-coding-system}. @xref{Process Information}.
668
669 See also @code{read-coding-system} in @ref{High-Level Completion}.
670
671@node Explicit Encoding 889@node Explicit Encoding
672@section Explicit Encoding and Decoding 890@subsection Explicit Encoding and Decoding
673@cindex encoding text 891@cindex encoding text
674@cindex decoding text 892@cindex decoding text
675 893
@@ -699,39 +917,72 @@ write them with @code{write-region} (@pxref{Writing to Files}), and
699suppress encoding for that @code{write-region} call by binding 917suppress encoding for that @code{write-region} call by binding
700@code{coding-system-for-write} to @code{no-conversion}. 918@code{coding-system-for-write} to @code{no-conversion}.
701 919
702@tindex encode-coding-region
703@defun encode-coding-region start end coding-system 920@defun encode-coding-region start end coding-system
921@tindex encode-coding-region
704This function encodes the text from @var{start} to @var{end} according 922This function encodes the text from @var{start} to @var{end} according
705to coding system @var{coding-system}. The encoded text replaces the 923to coding system @var{coding-system}. The encoded text replaces the
706original text in the buffer. The result of encoding is ``raw bytes,'' 924original text in the buffer. The result of encoding is ``raw bytes,''
707but the buffer remains multibyte if it was multibyte before. 925but the buffer remains multibyte if it was multibyte before.
708@end defun 926@end defun
709 927
710@tindex encode-coding-string
711@defun encode-coding-string string coding-system 928@defun encode-coding-string string coding-system
929@tindex encode-coding-string
712This function encodes the text in @var{string} according to coding 930This function encodes the text in @var{string} according to coding
713system @var{coding-system}. It returns a new string containing the 931system @var{coding-system}. It returns a new string containing the
714encoded text. The result of encoding is a unibyte string of ``raw bytes.'' 932encoded text. The result of encoding is a unibyte string of ``raw bytes.''
715@end defun 933@end defun
716 934
717@tindex decode-coding-region
718@defun decode-coding-region start end coding-system 935@defun decode-coding-region start end coding-system
936@tindex decode-coding-region
719This function decodes the text from @var{start} to @var{end} according 937This function decodes the text from @var{start} to @var{end} according
720to coding system @var{coding-system}. The decoded text replaces the 938to coding system @var{coding-system}. The decoded text replaces the
721original text in the buffer. To make explicit decoding useful, the text 939original text in the buffer. To make explicit decoding useful, the text
722before decoding ought to be ``raw bytes.'' 940before decoding ought to be ``raw bytes.''
723@end defun 941@end defun
724 942
725@tindex decode-coding-string
726@defun decode-coding-string string coding-system 943@defun decode-coding-string string coding-system
944@tindex decode-coding-string
727This function decodes the text in @var{string} according to coding 945This function decodes the text in @var{string} according to coding
728system @var{coding-system}. It returns a new string containing the 946system @var{coding-system}. It returns a new string containing the
729decoded text. To make explicit decoding useful, the contents of 947decoded text. To make explicit decoding useful, the contents of
730@var{string} ought to be ``raw bytes.'' 948@var{string} ought to be ``raw bytes.''
731@end defun 949@end defun
732 950
951@node Terminal I/O Encoding
952@subsection Terminal I/O Encoding
953
954 Emacs can decode keyboard input using a coding system, and encode
955terminal output. This kind of decoding and encoding does not set
956@code{last-coding-system-used}.
957
958@defun keyboard-coding-system
959@tindex keyboard-coding-system
960This function returns the coding system that is in use for decoding
961keyboard input---or @code{nil} if no coding system is to be used.
962@end defun
963
964@defun set-keyboard-coding-system coding-system
965@tindex set-keyboard-coding-system
966This function specifies @var{coding-system} as the coding system to
967use for decoding keyboard input. If @var{coding-system} is @code{nil},
968that means do not decode keyboard input.
969@end defun
970
971@defun terminal-coding-system
972@tindex terminal-coding-system
973This function returns the coding system that is in use for encoding
974terminal output---or @code{nil} for no encoding.
975@end defun
976
977@defun set-terminal-coding-system coding-system
978@tindex set-terminal-coding-system
979This function specifies @var{coding-system} as the coding system to use
980for encoding terminal output. If @var{coding-system} is @code{nil},
981that means do not encode terminal output.
982@end defun
983
733@node MS-DOS File Types 984@node MS-DOS File Types
734@section MS-DOS File Types 985@subsection MS-DOS File Types
735@cindex DOS file types 986@cindex DOS file types
736@cindex MS-DOS file types 987@cindex MS-DOS file types
737@cindex Windows file types 988@cindex Windows file types
@@ -740,17 +991,24 @@ decoded text. To make explicit decoding useful, the contents of
740@cindex binary files and text files 991@cindex binary files and text files
741 992
742 Emacs on MS-DOS and on MS-Windows recognizes certain file names as 993 Emacs on MS-DOS and on MS-Windows recognizes certain file names as
743text files or binary files. For a text file, Emacs always uses DOS 994text files or binary files. By ``binary file'' we mean a file of
744end-of-line conversion. For a binary file, Emacs does no end-of-line 995literal byte values that are not necessary meant to be characters.
745conversion and no character code conversion. 996Emacs does no end-of-line conversion and no character code conversion
997for a binary file. Meanwhile, when you create a new file which is
998marked by its name as a ``text file'', Emacs uses DOS end-of-line
999conversion.
746 1000
747@defvar buffer-file-type 1001@defvar buffer-file-type
748This variable, automatically buffer-local in each buffer, records the 1002This variable, automatically buffer-local in each buffer, records the
749file type of the buffer's visited file. The value is @code{nil} for 1003file type of the buffer's visited file. When a buffer does not specify
750text, @code{t} for binary. When a buffer does not specify a coding 1004a coding system with @code{buffer-file-coding-system}, this variable is
751system with @code{buffer-file-coding-system}, this variable is used by 1005used to determine which coding system to use when writing the contents
752the function @code{find-buffer-file-type-coding-system} to determine 1006of the buffer. It should be @code{nil} for text, @code{t} for binary.
753which coding system to use when writing the contents of the buffer. 1007If it is @code{t}, the coding system is @code{no-conversion}.
1008Otherwise, @code{undecided-dos} is used.
1009
1010Normally this variable is set by visiting a file; it is set to
1011@code{nil} if the file was visited without any actual conversion.
754@end defvar 1012@end defvar
755 1013
756@defopt file-name-buffer-file-type-alist 1014@defopt file-name-buffer-file-type-alist
@@ -775,26 +1033,80 @@ This variable says how to handle files for which
775@code{file-name-buffer-file-type-alist} says nothing about the type. 1033@code{file-name-buffer-file-type-alist} says nothing about the type.
776 1034
777If this variable is non-@code{nil}, then these files are treated as 1035If this variable is non-@code{nil}, then these files are treated as
778binary. Otherwise, nothing special is done for them---the coding system 1036binary: the coding system @code{no-conversion} is used. Otherwise,
779is deduced solely from the file contents, in the usual Emacs fashion. 1037nothing special is done for them---the coding system is deduced solely
1038from the file contents, in the usual Emacs fashion.
780@end defopt 1039@end defopt
781 1040
782@node MS-DOS Subprocesses 1041@node Input Methods
783@section MS-DOS Subprocesses 1042@section Input Methods
784 1043@cindex input methods
785 On Microsoft operating systems, these variables provide an alternative 1044
786way to specify the kind of end-of-line conversion to use for input and 1045 @dfn{Input methods} provide convenient ways of entering non-@sc{ASCII}
787output. The variable @code{binary-process-input} applies to input sent 1046characters from the keyboard. Unlike coding systems, which translate
788to the subprocess, and @code{binary-process-output} applies to output 1047non-@sc{ASCII} characters to and from encodings meant to be read by
789received from it. A non-@code{nil} value means the data is ``binary,'' 1048programs, input methods provide human-friendly commands. (@xref{Input
790and @code{nil} means the data is text. 1049Methods,,, emacs, The GNU Emacs Manual}, for information on how users
791 1050use input methods to enter text.) How to define input methods is not
792@defvar binary-process-input 1051yet documented in this manual, but here we describe how to use them.
793If this variable is @code{nil}, convert newlines to @sc{crlf} sequences in 1052
794the input to a synchronous subprocess. 1053 Each input method has a name, which is currently a string;
1054in the future, symbols may also be usable as input method names.
1055
1056@tindex current-input-method
1057@defvar current-input-method
1058This variable holds the name of the input method now active in the
1059current buffer. (It automatically becomes local in each buffer when set
1060in any fashion.) It is @code{nil} if no input method is active in the
1061buffer now.
795@end defvar 1062@end defvar
796 1063
797@defvar binary-process-output 1064@tindex default-input-method
798If this variable is @code{nil}, convert @sc{crlf} sequences to newlines in 1065@defvar default-input-method
799the output from a synchronous subprocess. 1066This variable holds the default input method for commands that choose an
1067input method. Unlike @code{current-input-method}, this variable is
1068normally global.
800@end defvar 1069@end defvar
1070
1071@tindex set-input-method
1072@defun set-input-method input-method
1073This function activates input method @var{input-method} for the current
1074buffer. It also sets @code{default-input-method} to @var{input-method}.
1075If @var{input-method} is @code{nil}, this function deactivates any input
1076method for the current buffer.
1077@end defun
1078
1079@tindex read-input-method-name
1080@defun read-input-method-name prompt &optional default inhibit-null
1081This function reads an input method name with the minibuffer, prompting
1082with @var{prompt}. If @var{default} is non-@code{nil}, that is returned
1083by default, if the user enters empty input. However, if
1084@var{inhibit-null} is non-@code{nil}, empty input signals an error.
1085
1086The returned value is a string.
1087@end defun
1088
1089@tindex input-method-alist
1090@defvar input-method-alist
1091This variable defines all the supported input methods.
1092Each element defines one input method, and should have the form:
1093
1094@example
1095(@var{input-method} @var{language-env} @var{activate-func} @var{title} @var{description} @var{args}...)
1096@end example
1097
1098Here @var{input-method} is the input method name, a string; @var{env} is
1099another string, the name of the language environment this input method
1100is recommended for. (That serves only for documentation purposes.)
1101
1102@var{title} is a string to display in the mode line while this method is
1103active. @var{description} is a string describing this method and what
1104it is good for.
1105
1106@var{activate-func} is a function to call to activate this method. The
1107@var{args}, if any, are passed as arguments to @var{activate-func}. All
1108told, the arguments to @var{activate-func} are @var{input-method} and
1109the @var{args}.
1110@end defun
1111
1112
diff --git a/lispref/numbers.texi b/lispref/numbers.texi
index daee3890e77..fbbdc83871e 100644
--- a/lispref/numbers.texi
+++ b/lispref/numbers.texi
@@ -249,6 +249,11 @@ numbers or markers. However, it is a good idea to use @code{=} if you
249can, even for comparing integers, just in case we change the 249can, even for comparing integers, just in case we change the
250representation of integers in a future Emacs version. 250representation of integers in a future Emacs version.
251 251
252 Sometimes it is useful to compare numbers with @code{equal}; it treats
253two numbers as equal if they have the same data type (both integers, or
254both floating point) and the same value. By contrast, @code{=} can
255treat an integer and a floating point number as equal.
256
252 There is another wrinkle: because floating point arithmetic is not 257 There is another wrinkle: because floating point arithmetic is not
253exact, it is often a bad idea to check for equality of two floating 258exact, it is often a bad idea to check for equality of two floating
254point values. Usually it is better to test for approximate equality. 259point values. Usually it is better to test for approximate equality.
@@ -328,7 +333,7 @@ This function returns the smallest of its arguments.
328@end defun 333@end defun
329 334
330@defun abs number 335@defun abs number
331This returns the absolute value of @var{number}. 336This function returns the absolute value of @var{number}.
332@end defun 337@end defun
333 338
334@node Numeric Conversions 339@node Numeric Conversions
@@ -357,9 +362,9 @@ This returns @var{number}, converted to an integer by rounding downward
357(towards negative infinity). 362(towards negative infinity).
358 363
359If @var{divisor} is specified, @var{number} is divided by @var{divisor} 364If @var{divisor} is specified, @var{number} is divided by @var{divisor}
360before the floor is taken; this is the division operation that 365before the floor is taken; this uses the kind of division operation that
361corresponds to @code{mod}. An @code{arith-error} results if 366corresponds to @code{mod}, rounding downward. An @code{arith-error}
362@var{divisor} is 0. 367results if @var{divisor} is 0.
363@end defun 368@end defun
364 369
365@defun ceiling number 370@defun ceiling number
@@ -600,7 +605,7 @@ Conversions}.
600@section Rounding Operations 605@section Rounding Operations
601@cindex rounding without conversion 606@cindex rounding without conversion
602 607
603The functions @code{ffloor}, @code{fceiling}, @code{fround} and 608The functions @code{ffloor}, @code{fceiling}, @code{fround}, and
604@code{ftruncate} take a floating point argument and return a floating 609@code{ftruncate} take a floating point argument and return a floating
605point result whose value is a nearby integer. @code{ffloor} returns the 610point result whose value is a nearby integer. @code{ffloor} returns the
606nearest integer below; @code{fceiling}, the nearest integer above; 611nearest integer below; @code{fceiling}, the nearest integer above;
@@ -965,14 +970,34 @@ and pi/2 (exclusive) whose tangent is @var{arg}.
965@end defun 970@end defun
966 971
967@defun exp arg 972@defun exp arg
968This is the exponential function; it returns @i{e} to the power 973This is the exponential function; it returns
969@var{arg}. @i{e} is a fundamental mathematical constant also called the 974@tex
970base of natural logarithms. 975$e$
976@end tex
977@ifinfo
978@i{e}
979@end ifinfo
980to the power @var{arg}.
981@tex
982$e$
983@end tex
984@ifinfo
985@i{e}
986@end ifinfo
987is a fundamental mathematical constant also called the base of natural
988logarithms.
971@end defun 989@end defun
972 990
973@defun log arg &optional base 991@defun log arg &optional base
974This function returns the logarithm of @var{arg}, with base @var{base}. 992This function returns the logarithm of @var{arg}, with base @var{base}.
975If you don't specify @var{base}, the base @var{e} is used. If @var{arg} 993If you don't specify @var{base}, the base
994@tex
995$e$
996@end tex
997@ifinfo
998@i{e}
999@end ifinfo
1000is used. If @var{arg}
976is negative, the result is a NaN. 1001is negative, the result is a NaN.
977@end defun 1002@end defun
978 1003
diff --git a/lispref/objects.texi b/lispref/objects.texi
index ea1e8fb1632..f2c082b56bc 100644
--- a/lispref/objects.texi
+++ b/lispref/objects.texi
@@ -396,8 +396,9 @@ distinction to the computer in any way.
396@cindex alt characters 396@cindex alt characters
397 The X Window System defines three other modifier bits that can be set 397 The X Window System defines three other modifier bits that can be set
398in a character: @dfn{hyper}, @dfn{super} and @dfn{alt}. The syntaxes 398in a character: @dfn{hyper}, @dfn{super} and @dfn{alt}. The syntaxes
399for these bits are @samp{\H-}, @samp{\s-} and @samp{\A-}. Thus, 399for these bits are @samp{\H-}, @samp{\s-} and @samp{\A-}. (Case is
400@samp{?\H-\M-\A-x} represents @kbd{Alt-Hyper-Meta-x}. 400significant in these prefixes.) Thus, @samp{?\H-\M-\A-x} represents
401@kbd{Alt-Hyper-Meta-x}.
401@tex 402@tex
402Numerically, the 403Numerically, the
403bit values are $2^{22}$ for alt, $2^{23}$ for super and $2^{24}$ for hyper. 404bit values are $2^{22}$ for alt, $2^{23}$ for super and $2^{24}$ for hyper.
@@ -882,9 +883,9 @@ character code, using a hex escape, @samp{\x@var{nnnnnnn}}, with as many
882digits as necessary. (Multibyte non-@sc{ASCII} character codes are all 883digits as necessary. (Multibyte non-@sc{ASCII} character codes are all
883greater than 256.) Any character which is not a valid hex digit 884greater than 256.) Any character which is not a valid hex digit
884terminates this construct. If the character that would follow is a hex 885terminates this construct. If the character that would follow is a hex
885digit, write @samp{\ } to terminate the hex escape---for example, 886digit, write @w{@samp{\ }} to terminate the hex escape---for example,
886@samp{\x8c0\ } represents one character, @samp{a} with grave accent. 887@w{@samp{\x8c0\ }} represents one character, @samp{a} with grave accent.
887@samp{\ } in a string constant is just like backslash-newline; it does 888@w{@samp{\ }} in a string constant is just like backslash-newline; it does
888not contribute any character to the string, but it does terminate the 889not contribute any character to the string, but it does terminate the
889preceding hex escape. 890preceding hex escape.
890 891
@@ -899,30 +900,35 @@ text representations.
899@node Nonprinting Characters 900@node Nonprinting Characters
900@subsubsection Nonprinting Characters in Strings 901@subsubsection Nonprinting Characters in Strings
901 902
902 Strings cannot hold characters that have the hyper, super, or alt
903modifiers; the only control or meta characters they can hold are the
904@sc{ASCII} control characters. Strings do not distinguish case in
905@sc{ASCII} control characters.
906
907 You can use the same backslash escape-sequences in a string constant 903 You can use the same backslash escape-sequences in a string constant
908as in character literals (but do not use the question mark that begins a 904as in character literals (but do not use the question mark that begins a
909character constant). For example, you can write a string containing the 905character constant). For example, you can write a string containing the
910nonprinting characters tab, @kbd{C-a} and @kbd{M-C-a}, with commas and 906nonprinting characters tab and @kbd{C-a}, with commas and spaces between
911spaces between them, like this: @code{"\t, \C-a, \M-\C-a"}. 907them, like this: @code{"\t, \C-a"}. @xref{Character Type}, for a
912@xref{Character Type}, for a description of the read syntax for 908description of the read syntax for characters.
913characters. 909
914 910 However, not all of the characters you can write with backslash
915 If you use the @samp{\M-} syntax to indicate a meta character in a 911escape-sequences are valid in strings. The only control characters that
916string constant, this sets the 912a string can hold are the @sc{ASCII} control characters. Strings do not
913distinguish case in @sc{ASCII} control characters.
914
915 Properly speaking, strings cannot hold meta characters; but when a
916string is to be used as a key sequence, there is a special convention
917that allows the meta versions of @sc{ASCII} characters to be put in a
918string. If you use the @samp{\M-} syntax to indicate a meta character
919in a string constant, this sets the
917@tex 920@tex
918$2^{7}$ 921$2^{7}$
919@end tex 922@end tex
920@ifinfo 923@ifinfo
9212**7 9242**7
922@end ifinfo 925@end ifinfo
923bit of the character in the string. This construct works only with 926bit of the character in the string. If the string is used in
924ASCII characters. Note that the same meta characters have a different 927@code{define-key} or @code{lookup-key}, this numeric code is translated
925representation when not in a string. @xref{Character Type}. 928into the equivalent meta character. @xref{Character Type}.
929
930 Strings cannot hold characters that have the hyper, super, or alt
931modifiers.
926 932
927@node Text Props and Strings 933@node Text Props and Strings
928@subsubsection Text Properties in Strings 934@subsubsection Text Properties in Strings
@@ -960,7 +966,9 @@ represents a string whose textual contents are @samp{foo bar}, in which
960the first three characters have a @code{face} property with value 966the first three characters have a @code{face} property with value
961@code{bold}, and the last three have a @code{face} property with value 967@code{bold}, and the last three have a @code{face} property with value
962@code{italic}. (The fourth character has no text properties so its 968@code{italic}. (The fourth character has no text properties so its
963property list is @code{nil}.) 969property list is @code{nil}. It is not actually necessary to mention
970ranges with @code{nil} as the property list, since any characters not
971mentioned in any range will default to having no properties.)
964 972
965@node Vector Type 973@node Vector Type
966@subsection Vector Type 974@subsection Vector Type
@@ -1024,17 +1032,18 @@ that it begins with @samp{#&} followed by the length. The string
1024constant that follows actually specifies the contents of the bool-vector 1032constant that follows actually specifies the contents of the bool-vector
1025as a bitmap---each ``character'' in the string contains 8 bits, which 1033as a bitmap---each ``character'' in the string contains 8 bits, which
1026specify the next 8 elements of the bool-vector (1 stands for @code{t}, 1034specify the next 8 elements of the bool-vector (1 stands for @code{t},
1027and 0 for @code{nil}). If the length is not a multiple of 8, the 1035and 0 for @code{nil}). The least significant bits of the character are
1028printed representation describes extra elements, but these really 1036the lowest-numbered elements of the bool-vector. If the length is not a
1029make no difference. 1037multiple of 8, the printed representation shows extra elements, but
1038these extras really make no difference.
1030 1039
1031@example 1040@example
1032(make-bool-vector 3 t) 1041(make-bool-vector 3 t)
1033 @result{} #&3"\377" 1042 @result{} #&3"\007"
1034(make-bool-vector 3 nil) 1043(make-bool-vector 3 nil)
1035 @result{} #&3"\0"" 1044 @result{} #&3"\0"
1036;; @r{These are equal since only the first 3 bits are used.} 1045;; @r{These are equal since only the first 3 bits are used.}
1037(equal #&3"\377" #&3"\340") 1046(equal #&3"\377" #&3"\007")
1038 @result{} t 1047 @result{} t
1039@end example 1048@end example
1040 1049
@@ -1151,7 +1160,7 @@ symbol. @xref{Autoload}, for more details.
1151@section Editing Types 1160@section Editing Types
1152@cindex editing types 1161@cindex editing types
1153 1162
1154 The types in the previous section used for general programming 1163 The types in the previous section are used for general programming
1155purposes, and most of them are common to most Lisp dialects. Emacs Lisp 1164purposes, and most of them are common to most Lisp dialects. Emacs Lisp
1156provides several additional data types for purposes connected with 1165provides several additional data types for purposes connected with
1157editing. 1166editing.
@@ -1288,7 +1297,7 @@ in any given window can change frequently.
1288@node Frame Type 1297@node Frame Type
1289@subsection Frame Type 1298@subsection Frame Type
1290 1299
1291 A @var{frame} is a rectangle on the screen that contains one or more 1300 A @dfn{frame} is a rectangle on the screen that contains one or more
1292Emacs windows. A frame initially contains a single main window (plus 1301Emacs windows. A frame initially contains a single main window (plus
1293perhaps a minibuffer window) which you can subdivide vertically or 1302perhaps a minibuffer window) which you can subdivide vertically or
1294horizontally into smaller windows. 1303horizontally into smaller windows.
@@ -1300,7 +1309,7 @@ uniquely).
1300@example 1309@example
1301@group 1310@group
1302(selected-frame) 1311(selected-frame)
1303 @result{} #<frame emacs@@mole.gnu.ai.mit.edu 0xdac80> 1312 @result{} #<frame emacs@@psilocin.gnu.org 0xdac80>
1304@end group 1313@end group
1305@end example 1314@end example
1306 1315
@@ -1668,10 +1677,10 @@ object.
1668@end group 1677@end group
1669@end example 1678@end example
1670 1679
1671(The @code{make-symbol} function returns an uninterned symbol that is 1680The @code{make-symbol} function returns an uninterned symbol, distinct
1672not interned in the standard @code{obarray}. When uninterned symbols 1681from the symbol that is used if you write the name in a Lisp expression.
1673are in use, symbol names are no longer unique. Distinct symbols with 1682Distinct symbols with the same name are not @code{eq}. @xref{Creating
1674the same name are not @code{eq}. @xref{Creating Symbols}.) 1683Symbols}.
1675 1684
1676@example 1685@example
1677@group 1686@group
diff --git a/lispref/os.texi b/lispref/os.texi
index a9d58c55aef..b3764422dff 100644
--- a/lispref/os.texi
+++ b/lispref/os.texi
@@ -55,6 +55,14 @@ it is started up is as follows:
55 55
56@enumerate 56@enumerate
57@item 57@item
58It adds subdirectories to @code{load-path}, by running the file
59named @file{subdirs.el} in each directory that is listed.
60
61@item
62It sets the language environment and the terminal coding system,
63if requested by environment variables such as @code{LANG}.
64
65@item
58It loads the initialization library for the window system, if you are 66It loads the initialization library for the window system, if you are
59using a window system. This library's name is 67using a window system. This library's name is
60@file{term/@var{windowsystem}-win.el}. 68@file{term/@var{windowsystem}-win.el}.
@@ -76,10 +84,9 @@ It loads the library @file{site-start}, unless the option
76@cindex @file{site-start.el} 84@cindex @file{site-start.el}
77 85
78@item 86@item
79It loads the file @file{~/.emacs}, unless @samp{-q} was specified on the 87It loads the file @file{~/.emacs}, unless @samp{-q} or @samp{-batch} was
80command line. (This is not done in @samp{-batch} mode.) The @samp{-u} 88specified on the command line. The @samp{-u} option can specify another
81option can specify another user name whose home directory should be used 89user name whose home directory should be used instead of @file{~}.
82instead of @file{~}.
83 90
84@item 91@item
85It loads the library @file{default}, unless @code{inhibit-default-init} 92It loads the library @file{default}, unless @code{inhibit-default-init}
@@ -146,10 +153,11 @@ form to your @file{.emacs} file:
146 "@var{your-login-name}") 153 "@var{your-login-name}")
147@end example 154@end example
148 155
149Simply setting @code{inhibit-startup-echo-area-message} to your login 156Emacs explicitly checks for an expression as shown above in your
150name is not sufficient to inhibit the message; Emacs explicitly checks 157@file{.emacs} file; your login name must appear in the expression as a
151whether @file{.emacs} contains an expression as shown above. Your login 158Lisp string constant. Other methods of setting
152name must appear in the expression as a Lisp string constant. 159@code{inhibit-startup-echo-area-message} to the same value do not
160inhibit the startup message.
153 161
154This way, you can easily inhibit the message for yourself if you wish, 162This way, you can easily inhibit the message for yourself if you wish,
155but thoughtless copying of your @file{.emacs} file will not inhibit the 163but thoughtless copying of your @file{.emacs} file will not inhibit the
@@ -206,9 +214,14 @@ then the default library is not loaded. The default value is
206@end defopt 214@end defopt
207 215
208@defvar before-init-hook 216@defvar before-init-hook
209@defvarx after-init-hook 217This normal hook is run, once, just before loading of all the init files
210These two normal hooks are run just before, and just after, loading of 218(the user's init file, @file{default.el}, and/or @file{site-start.el}).
211the user's init file, @file{default.el}, and/or @file{site-start.el}. 219@end defvar
220
221@defvar after-init-hook
222This normal hook is run, once, just after loading of all the init files
223(the user's init file, @file{default.el}, and/or @file{site-start.el}),
224before the terminal-specific initialization.
212@end defvar 225@end defvar
213 226
214@node Terminal-Specific 227@node Terminal-Specific
@@ -216,18 +229,12 @@ the user's init file, @file{default.el}, and/or @file{site-start.el}.
216@cindex terminal-specific initialization 229@cindex terminal-specific initialization
217 230
218 Each terminal type can have its own Lisp library that Emacs loads when 231 Each terminal type can have its own Lisp library that Emacs loads when
219run on that type of terminal. For a terminal type named @var{termtype}, 232run on that type of terminal. The library's name is constructed by
220the library is called @file{term/@var{termtype}}. Emacs finds the file 233concatenating the value of the variable @code{term-file-prefix} and the
221by searching the @code{load-path} directories as it does for other 234terminal type. Normally, @code{term-file-prefix} has the value
222files, and trying the @samp{.elc} and @samp{.el} suffixes. Normally, 235@code{"term/"}; changing this is not recommended. Emacs finds the file
223terminal-specific Lisp library is located in @file{emacs/lisp/term}, a 236in the normal manner, by searching the @code{load-path} directories, and
224subdirectory of the @file{emacs/lisp} directory in which most Emacs Lisp 237trying the @samp{.elc} and @samp{.el} suffixes.
225libraries are kept.@refill
226
227 The library's name is constructed by concatenating the value of the
228variable @code{term-file-prefix} and the terminal type. Normally,
229@code{term-file-prefix} has the value @code{"term/"}; changing this
230is not recommended.
231 238
232 The usual function of a terminal-specific library is to enable special 239 The usual function of a terminal-specific library is to enable special
233keys to send sequences that Emacs can recognize. It may also need to 240keys to send sequences that Emacs can recognize. It may also need to
@@ -620,7 +627,7 @@ systems.
620This function returns the name of the machine you are running on. 627This function returns the name of the machine you are running on.
621@example 628@example
622(system-name) 629(system-name)
623 @result{} "prep.ai.mit.edu" 630 @result{} "www.gnu.org"
624@end example 631@end example
625@end defun 632@end defun
626 633
@@ -719,19 +726,24 @@ locations, but can find them in a directory related somehow to the one
719containing the Emacs executable. 726containing the Emacs executable.
720@end defvar 727@end defvar
721 728
722@defun load-average 729@defun load-average &optional use-float
723This function returns the current 1-minute, 5-minute and 15-minute load 730This function returns the current 1-minute, 5-minute and 15-minute load
724averages in a list. The values are integers that are 100 times the 731averages in a list.
725system load averages, which indicate the average number of processes 732
726trying to run. It would be more logical to use floating point numbers, 733By default, the values are integers that are 100 times the system load
727but this function was introduced before Emacs supported floating point 734averages, which indicate the average number of processes trying to run.
728numbers, and it is not worth changing it now. 735If @var{use-float} is non-@code{nil}, then they are returned
736as floating point numbers instead.
729 737
730@example 738@example
731@group 739@group
732(load-average) 740(load-average)
733 @result{} (169 48 36) 741 @result{} (169 48 36)
734@end group 742@end group
743@group
744(load-average t)
745 @result{} (1.69 0.48 0.36)
746@end group
735 747
736@group 748@group
737lewis@@rocky[5] % uptime 749lewis@@rocky[5] % uptime
@@ -745,8 +757,8 @@ lewis@@rocky[5] % uptime
745This function returns the process @sc{id} of the Emacs process. 757This function returns the process @sc{id} of the Emacs process.
746@end defun 758@end defun
747 759
748@tindex tty-erase-char
749@defvar tty-erase-char 760@defvar tty-erase-char
761@tindex tty-erase-char
750This variable holds the erase character that was selected 762This variable holds the erase character that was selected
751in the system's terminal driver, before Emacs was started. 763in the system's terminal driver, before Emacs was started.
752@end defvar 764@end defvar
@@ -859,7 +871,7 @@ This function returns the effective @sc{uid} of the user.
859zone. 871zone.
860 872
861@defun current-time-string &optional time-value 873@defun current-time-string &optional time-value
862This function returns the current time and date as a humanly-readable 874This function returns the current time and date as a human-readable
863string. The format of the string is unvarying; the number of characters 875string. The format of the string is unvarying; the number of characters
864used for each part is always the same, so you can reliably use 876used for each part is always the same, so you can reliably use
865@code{substring} to extract pieces of it. It is wise to count the 877@code{substring} to extract pieces of it. It is wise to count the
@@ -1027,7 +1039,8 @@ This stands for the time zone abbreviation.
1027You can also specify the field width and type of padding for any of 1039You can also specify the field width and type of padding for any of
1028these @samp{%}-sequences. This works as in @code{printf}: you write 1040these @samp{%}-sequences. This works as in @code{printf}: you write
1029the field width as digits in the middle of a @samp{%}-sequences. If you 1041the field width as digits in the middle of a @samp{%}-sequences. If you
1030start the field width with 0, it means to pad with zeros. 1042start the field width with @samp{0}, it means to pad with zeros. If you
1043start the field width with @samp{_}, it means to pad with spaces.
1031 1044
1032For example, @samp{%S} specifies the number of seconds since the minute; 1045For example, @samp{%S} specifies the number of seconds since the minute;
1033@samp{%03S} means to pad this with zeros to 3 positions, @samp{%_3S} to 1046@samp{%03S} means to pad this with zeros to 3 positions, @samp{%_3S} to
@@ -1101,6 +1114,9 @@ feature makes it possible to use the elements of a list returned by
1101You can perform simple date arithmetic by using out-of-range values for 1114You can perform simple date arithmetic by using out-of-range values for
1102the @var{sec}, @var{minute}, @var{hour}, @var{day}, and @var{month} 1115the @var{sec}, @var{minute}, @var{hour}, @var{day}, and @var{month}
1103arguments; for example, day 0 means the day preceding the given month. 1116arguments; for example, day 0 means the day preceding the given month.
1117
1118The operating system puts limits on the range of possible time values;
1119if you try to encode a time that is out of range, an error results.
1104@end defun 1120@end defun
1105 1121
1106@node Timers 1122@node Timers
@@ -1124,10 +1140,18 @@ later, and @var{args} are the arguments to give it when it is called.
1124The time @var{time} is specified as a string. 1140The time @var{time} is specified as a string.
1125 1141
1126Absolute times may be specified in a wide variety of formats, and tries 1142Absolute times may be specified in a wide variety of formats, and tries
1127to accept all common date formats. One valid format is 1143to accept all common date formats. Valid formats include these two,
1128@samp{@var{hour}:@var{min}:@var{sec} @var{timezone} 1144
1129@var{month}/@var{day}/@var{year}}, where all fields are numbers; the 1145@example
1130format that @code{current-time-string} returns is also allowed. 1146@var{year}-@var{month}-@var{day} @var{hour}:@var{min}:@var{sec} @var{timezone}
1147
1148@var{hour}:@var{min}:@var{sec} @var{timezone} @var{month}/@var{day}/@var{year}
1149@end example
1150
1151@noindent
1152where in both examples all fields are numbers; the format that
1153@code{current-time-string} returns is also allowed, and many others
1154as well.
1131 1155
1132To specify a relative time, use numbers followed by units. 1156To specify a relative time, use numbers followed by units.
1133For example: 1157For example:
@@ -1168,7 +1192,7 @@ the value of the last form in @var{body}. If, however, the execution of
1168executes all the @var{timeout-forms} and returns the value of the last 1192executes all the @var{timeout-forms} and returns the value of the last
1169of them. 1193of them.
1170 1194
1171This macro works by set a timer to run after @var{seconds} seconds. If 1195This macro works by setting a timer to run after @var{seconds} seconds. If
1172@var{body} finishes before that time, it cancels the timer. If the 1196@var{body} finishes before that time, it cancels the timer. If the
1173timer actually runs, it terminates execution of @var{body}, then 1197timer actually runs, it terminates execution of @var{body}, then
1174executes @var{timeout-forms}. 1198executes @var{timeout-forms}.
@@ -1290,8 +1314,8 @@ is non-@code{nil} when Emacs is using interrupt-driven input. If
1290@code{nil}, Emacs is using @sc{cbreak} mode. 1314@code{nil}, Emacs is using @sc{cbreak} mode.
1291@item flow 1315@item flow
1292is non-@code{nil} if Emacs uses @sc{xon/xoff} (@kbd{C-q}, @kbd{C-s}) 1316is non-@code{nil} if Emacs uses @sc{xon/xoff} (@kbd{C-q}, @kbd{C-s})
1293flow control for output to the terminal. This value has effect when 1317flow control for output to the terminal. This value is meaningful only
1294unless @var{interrupt} is @code{nil}. 1318when @var{interrupt} is @code{nil}.
1295@item meta 1319@item meta
1296is @code{t} if Emacs treats the eighth bit of input characters as 1320is @code{t} if Emacs treats the eighth bit of input characters as
1297the meta bit; @code{nil} means Emacs clears the eighth bit of every 1321the meta bit; @code{nil} means Emacs clears the eighth bit of every
@@ -1365,7 +1389,7 @@ versa. (@xref{Flow Control} for more information on this subject.)
1365@end group 1389@end group
1366@group 1390@group
1367 (setq keyboard-translate-table 1391 (setq keyboard-translate-table
1368 (make-char-table 'keyboard-translate-table nil))) 1392 (make-char-table 'keyboard-translate-table nil))
1369@end group 1393@end group
1370@group 1394@group
1371 ;; @r{Swap @kbd{C-s} and @kbd{C-\}.} 1395 ;; @r{Swap @kbd{C-s} and @kbd{C-\}.}
diff --git a/lispref/positions.texi b/lispref/positions.texi
index a414abb5dc7..e4f9a4cc7b8 100644
--- a/lispref/positions.texi
+++ b/lispref/positions.texi
@@ -180,10 +180,13 @@ whether a given character is part of a word. @xref{Syntax Tables}.
180 180
181@deffn Command forward-word count 181@deffn Command forward-word count
182This function moves point forward @var{count} words (or backward if 182This function moves point forward @var{count} words (or backward if
183@var{count} is negative). Normally it returns @code{t}. If this motion 183@var{count} is negative). More precisely, it keeps moving until it
184encounters the beginning or end of the buffer, or the limits of the 184moves across a word-constituent character and encounters a
185accessible portion when narrowing is in effect, point stops there 185word-separator character, then returns @code{t}.
186and the value is @code{nil}. 186
187If this motion encounters the beginning or end of the buffer, or the
188limits of the accessible portion when narrowing is in effect, point
189stops there and the value is @code{nil}.
187 190
188In an interactive call, @var{count} is set to the numeric prefix 191In an interactive call, @var{count} is set to the numeric prefix
189argument. 192argument.
@@ -450,7 +453,7 @@ Display}.
450 These functions scan text to determine where screen lines break, and 453 These functions scan text to determine where screen lines break, and
451thus take time proportional to the distance scanned. If you intend to 454thus take time proportional to the distance scanned. If you intend to
452use them heavily, Emacs provides caches which may improve the 455use them heavily, Emacs provides caches which may improve the
453performance of your code. @xref{Text Lines, cache-long-line-scans}. 456performance of your code. @xref{Truncation, cache-long-line-scans}.
454 457
455 458
456@defun vertical-motion count &optional window 459@defun vertical-motion count &optional window
@@ -507,7 +510,7 @@ normally, use @code{(window-width @var{window})}.
507The argument @var{offsets} is either @code{nil} or a cons cell of the 510The argument @var{offsets} is either @code{nil} or a cons cell of the
508form @code{(@var{hscroll} . @var{tab-offset})}. Here @var{hscroll} is 511form @code{(@var{hscroll} . @var{tab-offset})}. Here @var{hscroll} is
509the number of columns not being displayed at the left margin; most 512the number of columns not being displayed at the left margin; most
510callers get this from @code{window-hscroll}. Meanwhile, 513callers get this by calling @code{window-hscroll}. Meanwhile,
511@var{tab-offset} is the offset between column numbers on the screen and 514@var{tab-offset} is the offset between column numbers on the screen and
512column numbers in the buffer. This can be nonzero in a continuation 515column numbers in the buffer. This can be nonzero in a continuation
513line, when the previous screen lines' widths do not add up to a multiple 516line, when the previous screen lines' widths do not add up to a multiple
@@ -725,7 +728,7 @@ an abnormal exit via @code{throw} or error (@pxref{Nonlocal Exits}).
725 728
726The @code{save-excursion} special form is the standard way to switch 729The @code{save-excursion} special form is the standard way to switch
727buffers or move point within one part of a program and avoid affecting 730buffers or move point within one part of a program and avoid affecting
728the rest of the program. It is used more than 500 times in the Lisp 731the rest of the program. It is used more than 4000 times in the Lisp
729sources of Emacs. 732sources of Emacs.
730 733
731@code{save-excursion} does not save the values of point and the mark for 734@code{save-excursion} does not save the values of point and the mark for
@@ -759,6 +762,11 @@ The value returned by @code{save-excursion} is the result of the last of
759@end example 762@end example
760@end defspec 763@end defspec
761 764
765 @strong{Warning:} Ordinary insertion of text adjacent to the saved
766point value relocates the saved value, just as it relocates all markers.
767Therefore, when the saved point value is restored, it normally comes
768after the inserted text.
769
762 Although @code{save-excursion} saves the location of the mark, it does 770 Although @code{save-excursion} saves the location of the mark, it does
763not prevent functions which modify the buffer from setting 771not prevent functions which modify the buffer from setting
764@code{deactivate-mark}, and thus causing the deactivation of the mark 772@code{deactivate-mark}, and thus causing the deactivation of the mark
@@ -857,7 +865,7 @@ of inaccessible text before and after the accessible portion.
857 865
858This method yields correct results if @var{body} does further narrowing. 866This method yields correct results if @var{body} does further narrowing.
859However, @code{save-restriction} can become confused if the body widens 867However, @code{save-restriction} can become confused if the body widens
860and then make changes outside the range of the saved narrowing. When 868and then makes changes outside the range of the saved narrowing. When
861this is what you want to do, @code{save-restriction} is not the right 869this is what you want to do, @code{save-restriction} is not the right
862tool for the job. Here is what you must use instead: 870tool for the job. Here is what you must use instead:
863 871
diff --git a/lispref/processes.texi b/lispref/processes.texi
index 94b8e61bdf3..8589348b282 100644
--- a/lispref/processes.texi
+++ b/lispref/processes.texi
@@ -34,6 +34,7 @@ This function returns @code{t} if @var{object} is a process,
34 34
35@menu 35@menu
36* Subprocess Creation:: Functions that start subprocesses. 36* Subprocess Creation:: Functions that start subprocesses.
37* Shell Arguments:: Quoting an argument to pass it to a shell.
37* Synchronous Processes:: Details of using synchronous subprocesses. 38* Synchronous Processes:: Details of using synchronous subprocesses.
38* Asynchronous Processes:: Starting up an asynchronous subprocess. 39* Asynchronous Processes:: Starting up an asynchronous subprocess.
39* Deleting Processes:: Eliminating an asynchronous subprocess. 40* Deleting Processes:: Eliminating an asynchronous subprocess.
@@ -190,8 +191,6 @@ process terminated.
190coding system, much like text read from a file. The input sent to a 191coding system, much like text read from a file. The input sent to a
191subprocess by @code{call-process-region} is encoded using a coding 192subprocess by @code{call-process-region} is encoded using a coding
192system, much like text written into a file. @xref{Coding Systems}. 193system, much like text written into a file. @xref{Coding Systems}.
193On Microsoft operating systems, additional variables control
194the conversion for end-of-line (@pxref{MS-DOS Subprocesses}).
195 194
196@defun call-process program &optional infile destination display &rest args 195@defun call-process program &optional infile destination display &rest args
197This function calls @var{program} in a separate process and waits for 196This function calls @var{program} in a separate process and waits for
@@ -240,9 +239,14 @@ buffer.
240@end table 239@end table
241 240
242If @var{display} is non-@code{nil}, then @code{call-process} redisplays 241If @var{display} is non-@code{nil}, then @code{call-process} redisplays
243the buffer as output is inserted. Otherwise the function does no 242the buffer as output is inserted. (However, if the coding system chosen
244redisplay, and the results become visible on the screen only when Emacs 243for decoding output is @code{undecided}, meaning deduce the encoding
245redisplays that buffer in the normal course of events. 244from the actual data, then redisplay sometimes cannot continue once
245non-@sc{ASCII} characters are encountered. There are fundamental
246reasons why it is hard to fix this.) Otherwise the function
247@code{call-process} does no redisplay, and the results become visible on
248the screen only when Emacs redisplays that buffer in the normal course
249of events.
246 250
247The remaining arguments, @var{args}, are strings that specify command 251The remaining arguments, @var{args}, are strings that specify command
248line arguments for the program. 252line arguments for the program.
@@ -351,8 +355,8 @@ inputinput@point{}
351@end smallexample 355@end smallexample
352@end defun 356@end defun
353 357
354@tindex shell-command-to-string
355@defun shell-command-to-string command 358@defun shell-command-to-string command
359@tindex shell-command-to-string
356This function executes @var{command} (a string) as a shell command, 360This function executes @var{command} (a string) as a shell command,
357then returns the command's output as a string. 361then returns the command's output as a string.
358@end defun 362@end defun
@@ -362,10 +366,15 @@ then returns the command's output as a string.
362@cindex asynchronous subprocess 366@cindex asynchronous subprocess
363 367
364 After an @dfn{asynchronous process} is created, Emacs and the Lisp 368 After an @dfn{asynchronous process} is created, Emacs and the Lisp
365program both continue running immediately. The process may thereafter 369program both continue running immediately. The process thereafter runs
366run in parallel with Emacs, and the two may communicate with each other 370in parallel with Emacs, and the two can communicate with each other
367using the functions described in following sections. Here we describe 371using the functions described in following sections. However,
368how to create an asynchronous process with @code{start-process}. 372communication is only partially asynchronous: Emacs sends data to the
373process only when certain functions are called, and Emacs accepts data
374from the process only when Emacs is waiting for input or for a time
375delay.
376
377 Here we describe how to create an asynchronous process.
369 378
370@defun start-process name buffer-or-name program &rest args 379@defun start-process name buffer-or-name program &rest args
371This function creates a new asynchronous subprocess and starts the 380This function creates a new asynchronous subprocess and starts the
@@ -570,8 +579,8 @@ process is started and remains constant as long as the process exists.
570This function returns the name of @var{process}. 579This function returns the name of @var{process}.
571@end defun 580@end defun
572 581
573@tindex process-contact
574@defun process-contact process 582@defun process-contact process
583@tindex process-contact
575This function returns @code{t} for an ordinary child process, and 584This function returns @code{t} for an ordinary child process, and
576@code{(@var{hostname} @var{service})} for a net connection 585@code{(@var{hostname} @var{service})} for a net connection
577(@pxref{Network}). 586(@pxref{Network}).
@@ -639,8 +648,8 @@ instead of a terminal (see @code{process-connection-type} in
639@ref{Asynchronous Processes}). 648@ref{Asynchronous Processes}).
640@end defun 649@end defun
641 650
642@tindex process-coding-system
643@defun process-coding-system process 651@defun process-coding-system process
652@tindex process-coding-system
644This function returns a cons cell describing the coding systems in use 653This function returns a cons cell describing the coding systems in use
645for decoding output from @var{process} and for encoding input to 654for decoding output from @var{process} and for encoding input to
646@var{process} (@pxref{Coding Systems}). The value has this form: 655@var{process} (@pxref{Coding Systems}). The value has this form:
@@ -650,8 +659,8 @@ for decoding output from @var{process} and for encoding input to
650@end example 659@end example
651@end defun 660@end defun
652 661
653@tindex set-process-coding-system
654@defun set-process-coding-system process decoding-system encoding-system 662@defun set-process-coding-system process decoding-system encoding-system
663@tindex set-process-coding-system
655This function specifies the coding systems to use for subsequent output 664This function specifies the coding systems to use for subsequent output
656from and input to @var{process}. It will use @var{decoding-system} to 665from and input to @var{process}. It will use @var{decoding-system} to
657decode subprocess output, and @var{encoding-system} to encode subprocess 666decode subprocess output, and @var{encoding-system} to encode subprocess
@@ -673,8 +682,11 @@ the other characters, to force them through. For most programs,
673these @sc{eof}s do no harm. 682these @sc{eof}s do no harm.
674 683
675 Subprocess input is normally encoded using a coding system before the 684 Subprocess input is normally encoded using a coding system before the
676subprocess receives it, much like text written into a file. 685subprocess receives it, much like text written into a file. You can use
677@xref{Coding Systems}. 686@code{set-process-coding-system} to specify which coding system to use
687(@pxref{Process Information}). Otherwise, the coding system comes from
688@code{coding-system-for-write}, if that is non-@code{nil}; or else from
689the defaulting mechanism (@pxref{Default Coding Systems}).
678 690
679@defun process-send-string process-name string 691@defun process-send-string process-name string
680This function sends @var{process-name} the contents of @var{string} as 692This function sends @var{process-name} the contents of @var{string} as
@@ -838,9 +850,32 @@ called the @dfn{filter function} can be called to act on the output. If
838the process has no buffer and no filter function, its output is 850the process has no buffer and no filter function, its output is
839discarded. 851discarded.
840 852
853 Output from a subprocess can arrive only while Emacs is waiting: when
854reading terminal input, in @code{sit-for} and @code{sleep-for}
855(@pxref{Waiting}), and in @code{accept-process-output} (@pxref{Accepting
856Output}). This minimizes the problem of timing errors that usually
857plague parallel programming. For example, you can safely create a
858process and only then specify its buffer or filter function; no output
859can arrive before you finish, if the code in between does not call any
860primitive that waits.
861
841 Subprocess output is normally decoded using a coding system before the 862 Subprocess output is normally decoded using a coding system before the
842buffer or filter function receives it, much like text read from a file. 863buffer or filter function receives it, much like text read from a file.
843@xref{Coding Systems}. 864You can use @code{set-process-coding-system} to specify which coding
865system to use (@pxref{Process Information}). Otherwise, the coding
866system comes from @code{coding-system-for-read}, if that is
867non-@code{nil}; or else from the defaulting mechanism (@pxref{Default
868Coding Systems}).
869
870 @strong{Warning:} Coding systems such as @code{undecided} which
871determine the coding system from the data do not work entirely reliably
872with asynchronous subprocess output. This is because Emacs has to
873process asynchronous subprocess output in batches, as it arrives. Emacs
874must try to detect the proper coding system from one batch at a time,
875and this does not always work. Therefore, if at all possible, use a
876coding system which determines both the character code conversion and
877the end of line conversion---that is, one like @code{latin-1-unix},
878rather than @code{undecided} or @code{latin-1}.
844 879
845@menu 880@menu
846* Process Buffers:: If no filter, output is put in a buffer. 881* Process Buffers:: If no filter, output is put in a buffer.
@@ -934,19 +969,16 @@ then @emph{all} output from that process is passed to the filter. The
934process buffer is used directly for output from the process only when 969process buffer is used directly for output from the process only when
935there is no filter. 970there is no filter.
936 971
972 The filter function can only be called when Emacs is waiting for
973something, because process output arrives only at such times. Emacs
974waits when reading terminal input, in @code{sit-for} and
975@code{sleep-for} (@pxref{Waiting}), and in @code{accept-process-output}
976(@pxref{Accepting Output}).
977
937 A filter function must accept two arguments: the associated process 978 A filter function must accept two arguments: the associated process
938and a string, which is output just received from it. The function is 979and a string, which is output just received from it. The function is
939then free to do whatever it chooses with the output. 980then free to do whatever it chooses with the output.
940 981
941 A filter function runs only while Emacs is waiting (e.g., for terminal
942input, or for time to elapse, or for process output). This avoids the
943timing errors that could result from running filters at random places in
944the middle of other Lisp programs. You may explicitly cause Emacs to
945wait, so that filter functions will run, by calling @code{sit-for} or
946@code{sleep-for} (@pxref{Waiting}), or @code{accept-process-output}
947(@pxref{Accepting Output}). Emacs is also waiting when the command loop
948is reading input.
949
950 Quitting is normally inhibited within a filter function---otherwise, 982 Quitting is normally inhibited within a filter function---otherwise,
951the effect of typing @kbd{C-g} at command level or to quit a user 983the effect of typing @kbd{C-g} at command level or to quit a user
952command would be unpredictable. If you want to permit quitting inside a 984command would be unpredictable. If you want to permit quitting inside a
@@ -1161,7 +1193,8 @@ errors that could result from running them at random places in the
1161middle of other Lisp programs. A program can wait, so that sentinels 1193middle of other Lisp programs. A program can wait, so that sentinels
1162will run, by calling @code{sit-for} or @code{sleep-for} 1194will run, by calling @code{sit-for} or @code{sleep-for}
1163(@pxref{Waiting}), or @code{accept-process-output} (@pxref{Accepting 1195(@pxref{Waiting}), or @code{accept-process-output} (@pxref{Accepting
1164Output}). Emacs is also waiting when the command loop is reading input. 1196Output}). Emacs also allows sentinels to run when the command loop is
1197reading input.
1165 1198
1166 Quitting is normally inhibited within a sentinel---otherwise, the 1199 Quitting is normally inhibited within a sentinel---otherwise, the
1167effect of typing @kbd{C-g} at command level or to quit a user command 1200effect of typing @kbd{C-g} at command level or to quit a user command
diff --git a/lispref/searching.texi b/lispref/searching.texi
index 336865c5642..7ba8a9fe666 100644
--- a/lispref/searching.texi
+++ b/lispref/searching.texi
@@ -231,11 +231,12 @@ this choice, the rest of the regexp matches successfully.@refill
231 231
232Nested repetition operators can be extremely slow if they specify 232Nested repetition operators can be extremely slow if they specify
233backtracking loops. For example, it could take hours for the regular 233backtracking loops. For example, it could take hours for the regular
234expression @samp{\(x+y*\)*a} to match the sequence 234expression @samp{\(x+y*\)*a} to try to match the sequence
235@samp{xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxz}. The slowness is because 235@samp{xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxz}, before it ultimately fails.
236Emacs must try each imaginable way of grouping the 35 @samp{x}'s before 236The slowness is because Emacs must try each imaginable way of grouping
237concluding that none of them can work. To make sure your regular 237the 35 @samp{x}'s before concluding that none of them can work. To make
238expressions run fast, check nested repetitions carefully. 238sure your regular expressions run fast, check nested repetitions
239carefully.
239 240
240@item @samp{+} 241@item @samp{+}
241@cindex @samp{+} in regexp 242@cindex @samp{+} in regexp
@@ -281,7 +282,7 @@ representations, because only the @sc{ASCII} characters are excluded.
281The beginning and end of a range must be in the same character set 282The beginning and end of a range must be in the same character set
282(@pxref{Character Sets}). Thus, @samp{[a-\x8c0]} is invalid because 283(@pxref{Character Sets}). Thus, @samp{[a-\x8c0]} is invalid because
283@samp{a} is in the @sc{ASCII} character set but the character 0x8c0 284@samp{a} is in the @sc{ASCII} character set but the character 0x8c0
284(@samp{a} with grave accent) is in the Latin-1 character set. 285(@samp{A} with grave accent) is in the Emacs character set for Latin-1.
285 286
286Note that the usual regexp special characters are not special inside a 287Note that the usual regexp special characters are not special inside a
287character alternative. A completely different set of characters are 288character alternative. A completely different set of characters are
@@ -354,11 +355,11 @@ ordinary since there is no preceding expression on which the @samp{*}
354can act. It is poor practice to depend on this behavior; quote the 355can act. It is poor practice to depend on this behavior; quote the
355special character anyway, regardless of where it appears.@refill 356special character anyway, regardless of where it appears.@refill
356 357
357For the most part, @samp{\} followed by any character matches only 358For the most part, @samp{\} followed by any character matches only that
358that character. However, there are several exceptions: two-character 359character. However, there are several exceptions: two-character
359sequences starting with @samp{\} which have special meanings. The 360sequences starting with @samp{\} which have special meanings. (The
360second character in the sequence is always an ordinary character on 361second character in such a sequence is always ordinary when used on its
361their own. Here is a table of @samp{\} constructs. 362own.) Here is a table of @samp{\} constructs.
362 363
363@table @samp 364@table @samp
364@item \| 365@item \|
@@ -393,8 +394,8 @@ or @samp{barx}.
393@item 394@item
394To enclose a complicated expression for the postfix operators @samp{*}, 395To enclose a complicated expression for the postfix operators @samp{*},
395@samp{+} and @samp{?} to operate on. Thus, @samp{ba\(na\)*} matches 396@samp{+} and @samp{?} to operate on. Thus, @samp{ba\(na\)*} matches
396@samp{bananana}, etc., with any (zero or more) number of @samp{na} 397@samp{ba}, @samp{bana}, @samp{banana}, @samp{bananana}, etc., with any
397strings.@refill 398number (zero or more) of @samp{na} strings.
398 399
399@item 400@item
400To record a matched substring for future reference. 401To record a matched substring for future reference.
@@ -530,8 +531,8 @@ whitespace:
530@end example 531@end example
531@end defun 532@end defun
532 533
533@tindex regexp-opt
534@defun regexp-opt strings &optional paren 534@defun regexp-opt strings &optional paren
535@tindex regexp-opt
535This function returns an efficient regular expression that will match 536This function returns an efficient regular expression that will match
536any of the strings @var{strings}. This is useful when you need to make 537any of the strings @var{strings}. This is useful when you need to make
537matching or searching as fast as possible---for example, for Font Lock 538matching or searching as fast as possible---for example, for Font Lock
@@ -555,8 +556,8 @@ regular expression which is equivalent to the actual value
555@end example 556@end example
556@end defun 557@end defun
557 558
558@tindex regexp-opt-depth
559@defun regexp-opt-depth regexp 559@defun regexp-opt-depth regexp
560@tindex regexp-opt-depth
560This function returns the total number of grouping constructs 561This function returns the total number of grouping constructs
561(parenthesized expressions) in @var{regexp}. 562(parenthesized expressions) in @var{regexp}.
562@end defun 563@end defun
@@ -1091,6 +1092,10 @@ subexpression is numbered 1, the second 2, and so on. Only regular
1091expressions can have subexpressions---after a simple string search, the 1092expressions can have subexpressions---after a simple string search, the
1092only information available is about the entire match. 1093only information available is about the entire match.
1093 1094
1095 A search which fails may or may not alter the match data. In the
1096past, a failing search did not do this, but we may change it in the
1097future.
1098
1094@defun match-string count &optional in-string 1099@defun match-string count &optional in-string
1095This function returns, as a string, the text matched in the last search 1100This function returns, as a string, the text matched in the last search
1096or match operation. It returns the entire text if @var{count} is zero, 1101or match operation. It returns the entire text if @var{count} is zero,
diff --git a/lispref/sequences.texi b/lispref/sequences.texi
index 8f19d6f9a1b..26263831d1c 100644
--- a/lispref/sequences.texi
+++ b/lispref/sequences.texi
@@ -82,7 +82,7 @@ This function returns the number of elements in @var{sequence}. If
82@sc{cdr} is not @code{nil}), a @code{wrong-type-argument} error is 82@sc{cdr} is not @code{nil}), a @code{wrong-type-argument} error is
83signaled. 83signaled.
84 84
85@xref{List Elements}, for the related function @code{safe-list}. 85@xref{List Elements}, for the related function @code{safe-length}.
86 86
87@example 87@example
88@group 88@group
@@ -132,11 +132,11 @@ otherwise, they trigger an @code{args-out-of-range} error.
132@end group 132@end group
133@group 133@group
134(elt [1 2 3 4] 4) 134(elt [1 2 3 4] 4)
135 @error{}Args out of range: [1 2 3 4], 4 135 @error{} Args out of range: [1 2 3 4], 4
136@end group 136@end group
137@group 137@group
138(elt [1 2 3 4] -1) 138(elt [1 2 3 4] -1)
139 @error{}Args out of range: [1 2 3 4], -1 139 @error{} Args out of range: [1 2 3 4], -1
140@end group 140@end group
141@end example 141@end example
142 142
@@ -218,12 +218,12 @@ be accessed in constant time. In contrast, an element of a list
218requires access time that is proportional to the position of the element 218requires access time that is proportional to the position of the element
219in the list. 219in the list.
220 220
221 Emacs defines four types of array, both of which are one-dimensional: 221 Emacs defines four types of array, all one-dimensional: @dfn{strings},
222@dfn{strings}, @dfn{vectors}, @dfn{bool-vectors} and @dfn{char-tables}. 222@dfn{vectors}, @dfn{bool-vectors} and @dfn{char-tables}. A vector is a
223A vector is a general array; its elements can be any Lisp objects. A 223general array; its elements can be any Lisp objects. A string is a
224string is a specialized array; its elements must be characters (i.e., 224specialized array; its elements must be characters (i.e., integers
225integers between 0 and 255). Each type of array has its own read 225between 0 and 255). Each type of array has its own read syntax.
226syntax. @xref{String Type}, and @ref{Vector Type}. 226@xref{String Type}, and @ref{Vector Type}.
227 227
228 All four kinds of array share these characteristics: 228 All four kinds of array share these characteristics:
229 229
@@ -347,8 +347,8 @@ If @var{array} is a string and @var{object} is not a character, a
347@code{wrong-type-argument} error results. If @var{array} is a string 347@code{wrong-type-argument} error results. If @var{array} is a string
348and @var{object} is character, but @var{object} does not use the same 348and @var{object} is character, but @var{object} does not use the same
349number of bytes as the character currently stored in @code{(aref 349number of bytes as the character currently stored in @code{(aref
350@var{object} @var{index})}, that is also an error. @xref{Chars and 350@var{object} @var{index})}, that is also an error. @xref{Splitting
351Bytes}. 351Characters}.
352@end defun 352@end defun
353 353
354@defun fillarray array object 354@defun fillarray array object
@@ -520,19 +520,25 @@ list with the same elements (@pxref{Building Lists}):
520@node Char-Tables 520@node Char-Tables
521@section Char-Tables 521@section Char-Tables
522@cindex char-tables 522@cindex char-tables
523@cindex extra slots of char-table
523 524
524 A char-table is much like a vector, except that it is indexed by 525 A char-table is much like a vector, except that it is indexed by
525character codes. Any valid character code, without modifiers, can be 526character codes. Any valid character code, without modifiers, can be
526used as an index in a char-table. You can access a char-table's 527used as an index in a char-table. You can access a char-table's
527elements with @code{aref} and @code{aset}, as with any array. 528elements with @code{aref} and @code{aset}, as with any array. In
528Char-tables are constants when evaluated. 529addition, a char-table can have @dfn{extra slots} to hold additional
530data not associated with particular character codes. Char-tables are
531constants when evaluated.
529 532
530@cindex extra slots of char-table
531@cindex subtype of char-table 533@cindex subtype of char-table
532 Each char-table has a @dfn{subtype} which is a symbol. In order to be 534 Each char-table has a @dfn{subtype} which is a symbol. The subtype
533a valid subtype, a symbol must have a @code{char-table-extra-slots} 535has two purposes: to distinguish char-tables meant for different uses,
534property which is an integer between 0 and 10. This integer specifies 536and to control the number of extra slots. For example, display tables
535the number of @dfn{extra slots} in the char-table. 537are char-tables with @code{display-table} as the subtype, and syntax
538tables are char-tables with @code{syntax-table} as the subtype. A valid
539subtype must have a @code{char-table-extra-slots} property which is an
540integer between 0 and 10. This integer specifies the number of
541@dfn{extra slots} in the char-table.
536 542
537@cindex parent of char-table 543@cindex parent of char-table
538 A char-table can have a @dfn{parent}. which is another char-table. If 544 A char-table can have a @dfn{parent}. which is another char-table. If
@@ -547,8 +553,8 @@ specifies @code{nil}.
547@code{(aref @var{char-table} @var{c})} returns the default value 553@code{(aref @var{char-table} @var{c})} returns the default value
548whenever the char-table does not specify any other non-@code{nil} value. 554whenever the char-table does not specify any other non-@code{nil} value.
549 555
550@tindex make-char-table
551@defun make-char-table subtype &optional init 556@defun make-char-table subtype &optional init
557@tindex make-char-table
552Return a newly created char-table, with subtype @var{subtype}. Each 558Return a newly created char-table, with subtype @var{subtype}. Each
553element is initialized to @var{init}, which defaults to @code{nil}. You 559element is initialized to @var{init}, which defaults to @code{nil}. You
554cannot alter the subtype of a char-table after the char-table is 560cannot alter the subtype of a char-table after the char-table is
@@ -558,19 +564,19 @@ There is no argument to specify the length of the char-table, because
558all char-tables have room for any valid character code as an index. 564all char-tables have room for any valid character code as an index.
559@end defun 565@end defun
560 566
561@tindex char-table-p
562@defun char-table-p object 567@defun char-table-p object
568@tindex char-table-p
563This function returns @code{t} if @var{object} is a char-table, 569This function returns @code{t} if @var{object} is a char-table,
564otherwise @code{nil}. 570otherwise @code{nil}.
565@end defun 571@end defun
566 572
567@tindex char-table-subtype
568@defun char-table-subtype char-table 573@defun char-table-subtype char-table
574@tindex char-table-subtype
569This function returns the subtype symbol of @var{char-table}. 575This function returns the subtype symbol of @var{char-table}.
570@end defun 576@end defun
571 577
572@tindex set-char-table-default
573@defun set-char-table-default char-table new-default 578@defun set-char-table-default char-table new-default
579@tindex set-char-table-default
574This function sets the default value of @var{char-table} to 580This function sets the default value of @var{char-table} to
575@var{new-default}. 581@var{new-default}.
576 582
@@ -578,26 +584,26 @@ There is no special function to access the default value of a char-table.
578To do that, use @code{(char-table-range @var{char-table} nil)}. 584To do that, use @code{(char-table-range @var{char-table} nil)}.
579@end defun 585@end defun
580 586
581@tindex char-table-parent
582@defun char-table-parent char-table 587@defun char-table-parent char-table
588@tindex char-table-parent
583This function returns the parent of @var{char-table}. The parent is 589This function returns the parent of @var{char-table}. The parent is
584always either @code{nil} or another char-table. 590always either @code{nil} or another char-table.
585@end defun 591@end defun
586 592
587@tindex set-char-table-parent
588@defun set-char-table-parent char-table new-parent 593@defun set-char-table-parent char-table new-parent
594@tindex set-char-table-parent
589This function sets the parent of @var{char-table} to @var{new-parent}. 595This function sets the parent of @var{char-table} to @var{new-parent}.
590@end defun 596@end defun
591 597
592@tindex char-table-extra-slot
593@defun char-table-extra-slot char-table n 598@defun char-table-extra-slot char-table n
599@tindex char-table-extra-slot
594This function returns the contents of extra slot @var{n} of 600This function returns the contents of extra slot @var{n} of
595@var{char-table}. The number of extra slots in a char-table is 601@var{char-table}. The number of extra slots in a char-table is
596determined by its subtype. 602determined by its subtype.
597@end defun 603@end defun
598 604
599@tindex set-char-table-extra-slot
600@defun set-char-table-extra-slot char-table n value 605@defun set-char-table-extra-slot char-table n value
606@tindex set-char-table-extra-slot
601This function stores @var{value} in extra slot @var{n} of 607This function stores @var{value} in extra slot @var{n} of
602@var{char-table}. 608@var{char-table}.
603@end defun 609@end defun
@@ -605,28 +611,34 @@ This function stores @var{value} in extra slot @var{n} of
605 A char-table can specify an element value for a single character code; 611 A char-table can specify an element value for a single character code;
606it can also specify a value for an entire character set. 612it can also specify a value for an entire character set.
607 613
608@tindex char-table-range
609@defun char-table-range char-table range 614@defun char-table-range char-table range
615@tindex char-table-range
610This returns the value specified in @var{char-table} for a range of 616This returns the value specified in @var{char-table} for a range of
611characters @var{range}. Here @var{range} may be 617characters @var{range}. Here are the possibilities for @var{range}:
612 618
613@table @asis 619@table @asis
614@item @code{nil} 620@item @code{nil}
615Refers to the default value. 621Refers to the default value.
616 622
617@item @var{char} 623@item @var{char}
618Refers to the element for character @var{char}. 624Refers to the element for character @var{char}
625(supposing @var{char} is a valid character code).
619 626
620@item @var{charset} 627@item @var{charset}
621Refers to the value specified for the whole character set 628Refers to the value specified for the whole character set
622@var{charset} (@pxref{Character Sets}). 629@var{charset} (@pxref{Character Sets}).
630
631@item @var{generic-char}
632A generic character stands for a character set; specifying the generic
633character as argument is equivalent to specifying the character set
634name. @xref{Splitting Characters}, for a description of generic characters.
623@end table 635@end table
624@end defun 636@end defun
625 637
626@tindex set-char-table-range
627@defun set-char-table-range char-table range value 638@defun set-char-table-range char-table range value
639@tindex set-char-table-range
628This function set the value in @var{char-table} for a range of 640This function set the value in @var{char-table} for a range of
629characters @var{range}. Here @var{range} may be 641characters @var{range}. Here are the possibilities for @var{range}:
630 642
631@table @asis 643@table @asis
632@item @code{nil} 644@item @code{nil}
@@ -636,24 +648,45 @@ Refers to the default value.
636Refers to the whole range of character codes. 648Refers to the whole range of character codes.
637 649
638@item @var{char} 650@item @var{char}
639Refers to the element for character @var{char}. 651Refers to the element for character @var{char}
652(supposing @var{char} is a valid character code).
640 653
641@item @var{charset} 654@item @var{charset}
642Refers to the value specified for the whole character set 655Refers to the value specified for the whole character set
643@var{charset} (@pxref{Character Sets}). 656@var{charset} (@pxref{Character Sets}).
657
658@item @var{generic-char}
659A generic character stands for a character set; specifying the generic
660character as argument is equivalent to specifying the character set
661name. @xref{Splitting Characters}, for a description of generic characters.
644@end table 662@end table
645@end defun 663@end defun
646 664
647@tindex map-char-table
648@defun map-char-table function char-table 665@defun map-char-table function char-table
666@tindex map-char-table
649This function calls @var{function} for each element of @var{char-table}. 667This function calls @var{function} for each element of @var{char-table}.
650@var{function} is called with two arguments, a key and a value. The key 668@var{function} is called with two arguments, a key and a value. The key
651is a possible @var{range} argument for @code{char-table-range}, and the 669is a possible @var{range} argument for @code{char-table-range}---either
652value is @code{(char-table-range @var{char-table} @var{key})}. Invalid 670a valid character or a generic character---and the value is
653character codes are never used as @var{key}. 671@code{(char-table-range @var{char-table} @var{key})}.
654 672
655Overall, the key-value pairs passed to @var{function} describe all the 673Overall, the key-value pairs passed to @var{function} describe all the
656values stored in @var{char-table}. 674values stored in @var{char-table}.
675
676The return value is always @code{nil}; to make this function useful,
677@var{function} should have side effects. For example,
678here is how to examine each element of the syntax table:
679
680@example
681(map-char-table
682 #'(lambda (key value)
683 (setq accumulator
684 (cons (list key value) accumulator)))
685 (syntax-table))
686@result{}
687((475008 nil) (474880 nil) (474752 nil) (474624 nil)
688 ... (5 (3)) (4 (3)) (3 (3)) (2 (3)) (1 (3)) (0 (3)))
689@end example
657@end defun 690@end defun
658 691
659@node Bool-Vectors 692@node Bool-Vectors
@@ -671,13 +704,14 @@ Bool-vectors are constants when evaluated.
671from that, you manipulate them with same functions used for other kinds 704from that, you manipulate them with same functions used for other kinds
672of arrays. 705of arrays.
673 706
674@tindex make-bool-vector
675@defun make-bool-vector length initial 707@defun make-bool-vector length initial
708@tindex make-bool-vector
676Return a new book-vector of @var{length} elements, 709Return a new book-vector of @var{length} elements,
677each one initialized to @var{initial}. 710each one initialized to @var{initial}.
678@end defun 711@end defun
679 712
680@defun bool-vector-p object 713@defun bool-vector-p object
714@tindex bool-vector-p
681This returns @code{t} if @var{object} is a bool-vector, 715This returns @code{t} if @var{object} is a bool-vector,
682and @code{nil} otherwise. 716and @code{nil} otherwise.
683@end defun 717@end defun
diff --git a/lispref/streams.texi b/lispref/streams.texi
index 945e550fc0a..cf3f14a095f 100644
--- a/lispref/streams.texi
+++ b/lispref/streams.texi
@@ -255,7 +255,7 @@ useless-list
255@end example 255@end example
256 256
257@noindent 257@noindent
258Note that the open and close parentheses remains in the list. The Lisp 258Note that the open and close parentheses remain in the list. The Lisp
259reader encountered the open parenthesis, decided that it ended the 259reader encountered the open parenthesis, decided that it ended the
260input, and unread it. Another attempt to read from the stream at this 260input, and unread it. Another attempt to read from the stream at this
261point would read @samp{()} and return @code{nil}. 261point would read @samp{()} and return @code{nil}.
@@ -353,14 +353,15 @@ Point advances as characters are inserted.
353The output characters are inserted into the buffer that @var{marker} 353The output characters are inserted into the buffer that @var{marker}
354points into, at the marker position. The marker position advances as 354points into, at the marker position. The marker position advances as
355characters are inserted. The value of point in the buffer has no effect 355characters are inserted. The value of point in the buffer has no effect
356on printing when the stream is a marker. 356on printing when the stream is a marker, and this kind of printing
357does not move point.
357 358
358@item @var{function} 359@item @var{function}
359@cindex function output stream 360@cindex function output stream
360The output characters are passed to @var{function}, which is responsible 361The output characters are passed to @var{function}, which is responsible
361for storing them away. It is called with a single character as 362for storing them away. It is called with a single character as
362argument, as many times as there are characters to be output, and is 363argument, as many times as there are characters to be output, and
363free to do anything at all with the characters it receives. 364is responsible for storing the characters wherever you want to put them.
364 365
365@item @code{t} 366@item @code{t}
366@cindex @code{t} output stream 367@cindex @code{t} output stream
@@ -368,9 +369,9 @@ The output characters are displayed in the echo area.
368 369
369@item @code{nil} 370@item @code{nil}
370@cindex @code{nil} output stream 371@cindex @code{nil} output stream
371@code{nil} specified as an output stream means to the value of 372@code{nil} specified as an output stream means to use the value of
372@code{standard-output} instead; that value is the @dfn{default output 373@code{standard-output} instead; that value is the @dfn{default output
373stream}, and must be a non-@code{nil} output stream. 374stream}, and must not be @code{nil}.
374 375
375@item @var{symbol} 376@item @var{symbol}
376A symbol as output stream is equivalent to the symbol's function 377A symbol as output stream is equivalent to the symbol's function
@@ -425,7 +426,7 @@ effect.
425@example 426@example
426@group 427@group
427---------- Buffer: foo ---------- 428---------- Buffer: foo ----------
428"This is the @point{}output" 429This is the @point{}output
429---------- Buffer: foo ---------- 430---------- Buffer: foo ----------
430@end group 431@end group
431 432
@@ -441,9 +442,9 @@ m
441 442
442@group 443@group
443---------- Buffer: foo ---------- 444---------- Buffer: foo ----------
444"This is t 445This is t
445"More output for foo." 446"More output for foo."
446he @point{}output" 447he @point{}output
447---------- Buffer: foo ---------- 448---------- Buffer: foo ----------
448@end group 449@end group
449 450
@@ -535,12 +536,13 @@ describe a Lisp object clearly for a Lisp programmer. However, if the
535purpose of the output is to look nice for humans, then it is usually 536purpose of the output is to look nice for humans, then it is usually
536better to print without quoting. 537better to print without quoting.
537 538
538 Printing a self-referent Lisp object in the normal way would require 539 Lisp objects can refer to themselves. Printing a self-referential
539an infinite amount of text, and could even result in stack overflow. 540object in the normal way would require an infinite amount of text, and
540Emacs detects such recursion and prints @samp{#@var{level}} instead of 541the attempt could cause infinite recursion. Emacs detects such
541recursively printing an object already being printed. For example, here 542recursion and prints @samp{#@var{level}} instead of recursively printing
542@samp{#0} indicates a recursive reference to the object at level 0 of 543an object already being printed. For example, here @samp{#0} indicates
543the current print operation: 544a recursive reference to the object at level 0 of the current print
545operation:
544 546
545@example 547@example
546(setq foo (list nil)) 548(setq foo (list nil))
@@ -661,10 +663,10 @@ See @code{format}, in @ref{String Conversion}, for other ways to obtain
661the printed representation of a Lisp object as a string. 663the printed representation of a Lisp object as a string.
662@end defun 664@end defun
663 665
664@tindex with-output-to-string
665@defmac with-output-to-string body... 666@defmac with-output-to-string body...
666This macro executes the @var{body} forms with standard-output set up so 667@tindex with-output-to-string
667that all output feeds into a string. Then it returns that string. 668This macro executes the @var{body} forms with @code{standard-output} set
669up to feed output into a string. Then it returns that string.
668 670
669For example, if the current buffer name is @samp{foo}, 671For example, if the current buffer name is @samp{foo},
670 672
diff --git a/lispref/strings.texi b/lispref/strings.texi
index 71300010f37..5e511a5d331 100644
--- a/lispref/strings.texi
+++ b/lispref/strings.texi
@@ -28,7 +28,7 @@ keyboard character events.
28* Modifying Strings:: Altering the contents of an existing string. 28* Modifying Strings:: Altering the contents of an existing string.
29* Text Comparison:: Comparing characters or strings. 29* Text Comparison:: Comparing characters or strings.
30* String Conversion:: Converting characters or strings and vice versa. 30* String Conversion:: Converting characters or strings and vice versa.
31* Formatting Strings:: @code{format}: Emacs's analog of @code{printf}. 31* Formatting Strings:: @code{format}: Emacs's analogue of @code{printf}.
32* Case Conversion:: Case conversion functions. 32* Case Conversion:: Case conversion functions.
33* Case Tables:: Customizing case conversion. 33* Case Tables:: Customizing case conversion.
34@end menu 34@end menu
@@ -97,12 +97,12 @@ For more information about general sequence and array predicates,
97see @ref{Sequences Arrays Vectors}, and @ref{Arrays}. 97see @ref{Sequences Arrays Vectors}, and @ref{Arrays}.
98 98
99@defun stringp object 99@defun stringp object
100 This function returns @code{t} if @var{object} is a string, @code{nil} 100This function returns @code{t} if @var{object} is a string, @code{nil}
101otherwise. 101otherwise.
102@end defun 102@end defun
103 103
104@defun char-or-string-p object 104@defun char-or-string-p object
105 This function returns @code{t} if @var{object} is a string or a 105This function returns @code{t} if @var{object} is a string or a
106character (i.e., an integer), @code{nil} otherwise. 106character (i.e., an integer), @code{nil} otherwise.
107@end defun 107@end defun
108 108
@@ -113,7 +113,7 @@ character (i.e., an integer), @code{nil} otherwise.
113putting strings together, or by taking them apart. 113putting strings together, or by taking them apart.
114 114
115@defun make-string count character 115@defun make-string count character
116 This function returns a string made up of @var{count} repetitions of 116This function returns a string made up of @var{count} repetitions of
117@var{character}. If @var{count} is negative, an error is signaled. 117@var{character}. If @var{count} is negative, an error is signaled.
118 118
119@example 119@example
@@ -128,8 +128,8 @@ putting strings together, or by taking them apart.
128@code{make-list} (@pxref{Building Lists}). 128@code{make-list} (@pxref{Building Lists}).
129@end defun 129@end defun
130 130
131@tindex string
132@defun string &rest characters 131@defun string &rest characters
132@tindex string
133This returns a string containing the characters @var{characters}. 133This returns a string containing the characters @var{characters}.
134 134
135@example 135@example
@@ -232,7 +232,7 @@ returns an empty string.
232@example 232@example
233(concat "abc" "-def") 233(concat "abc" "-def")
234 @result{} "abc-def" 234 @result{} "abc-def"
235(concat "abc" (list 120 (+ 256 121)) [122]) 235(concat "abc" (list 120 121) [122])
236 @result{} "abcxyz" 236 @result{} "abcxyz"
237;; @r{@code{nil} is an empty sequence.} 237;; @r{@code{nil} is an empty sequence.}
238(concat "abc" nil "-def") 238(concat "abc" nil "-def")
@@ -244,10 +244,6 @@ returns an empty string.
244@end example 244@end example
245 245
246@noindent 246@noindent
247The second example above shows how characters stored in strings are
248taken modulo 256. In other words, each character in the string is
249stored in one byte.
250
251The @code{concat} function always constructs a new string that is 247The @code{concat} function always constructs a new string that is
252not @code{eq} to any existing string. 248not @code{eq} to any existing string.
253 249
@@ -274,8 +270,8 @@ description of @code{mapconcat} in @ref{Mapping Functions},
274Lists}. 270Lists}.
275@end defun 271@end defun
276 272
277@tindex split-string
278@defun split-string string separators 273@defun split-string string separators
274@tindex split-string
279Split @var{string} into substrings in between matches for the regular 275Split @var{string} into substrings in between matches for the regular
280expression @var{separators}. Each match for @var{separators} defines a 276expression @var{separators}. Each match for @var{separators} defines a
281splitting point; the substrings between the splitting points are made 277splitting point; the substrings between the splitting points are made
@@ -322,8 +318,8 @@ that index, @code{aset} signals an error.
322 318
323 A more powerful function is @code{store-substring}: 319 A more powerful function is @code{store-substring}:
324 320
325@tindex store-substring
326@defun store-substring string idx obj 321@defun store-substring string idx obj
322@tindex store-substring
327This function alters part of the contents of the string @var{string}, by 323This function alters part of the contents of the string @var{string}, by
328storing @var{obj} starting at index @var{idx}. The argument @var{obj} 324storing @var{obj} starting at index @var{idx}. The argument @var{obj}
329may be either a character or a (smaller) string. 325may be either a character or a (smaller) string.
@@ -434,6 +430,41 @@ no characters is less than any other string.
434@code{string-lessp} is another name for @code{string<}. 430@code{string-lessp} is another name for @code{string<}.
435@end defun 431@end defun
436 432
433@defun compare-strings string1 start1 end1 string2 start2 end2 &optional ignore-case
434@tindex compare-strings
435This function compares a specified part of @var{string1} with a
436specified part of @var{string2}. The specified part of @var{string1}
437runs from index @var{start1} up to index @var{end1} (default, the end of
438the string). The specified part of @var{string2} runs from index
439@var{start2} up to index @var{end2} (default, the end of the string).
440
441The strings are both converted to multibyte for the comparison
442(@pxref{Text Representations}) so that a unibyte string can be usefully
443compared with a multibyte string. If @var{ignore-case} is
444non-@code{nil}, then case is ignored as well.
445
446If the specified portions of the two strings match, the value is
447@code{t}. Otherwise, the value is an integer which indicates how many
448leading characters agree, and which string is less. Its absolute value
449is one plus the number of characters that agree at the beginning of the
450two strings. The sign is negative if @var{string1} (or its specified
451portion) is less.
452@end defun
453
454@defun assoc-ignore-case key alist
455@tindex assoc-ignore-case
456This function works like @code{assoc}, except that @var{key} must be a
457string, and comparison is done using @code{compare-strings}.
458Case differences are ignored in this comparison.
459@end defun
460
461@defun assoc-ignore-representation key alist
462@tindex assoc-ignore-representation
463This function works like @code{assoc}, except that @var{key} must be a
464string, and comparison is done using @code{compare-strings}.
465Case differences are significant.
466@end defun
467
437 See also @code{compare-buffer-substrings} in @ref{Comparing Text}, for 468 See also @code{compare-buffer-substrings} in @ref{Comparing Text}, for
438a way to compare text in buffers. The function @code{string-match}, 469a way to compare text in buffers. The function @code{string-match},
439which matches a regular expression against a string, can be used 470which matches a regular expression against a string, can be used
@@ -509,7 +540,7 @@ negative.
509See also the function @code{format} in @ref{Formatting Strings}. 540See also the function @code{format} in @ref{Formatting Strings}.
510@end defun 541@end defun
511 542
512@defun string-to-number string base 543@defun string-to-number string &optional base
513@cindex string to number 544@cindex string to number
514This function returns the numeric value of the characters in 545This function returns the numeric value of the characters in
515@var{string}. If @var{base} is non-@code{nil}, integers are converted 546@var{string}. If @var{base} is non-@code{nil}, integers are converted
@@ -522,7 +553,7 @@ The parsing skips spaces and tabs at the beginning of @var{string}, then
522reads as much of @var{string} as it can interpret as a number. (On some 553reads as much of @var{string} as it can interpret as a number. (On some
523systems it ignores other whitespace at the beginning, not just spaces 554systems it ignores other whitespace at the beginning, not just spaces
524and tabs.) If the first character after the ignored whitespace is not a 555and tabs.) If the first character after the ignored whitespace is not a
525digit or a minus sign, this function returns 0. 556digit or a plus or minus sign, this function returns 0.
526 557
527@example 558@example
528(string-to-number "256") 559(string-to-number "256")
@@ -600,10 +631,9 @@ second such value, and so on. Any extra format specifications (those
600for which there are no corresponding values) cause unpredictable 631for which there are no corresponding values) cause unpredictable
601behavior. Any extra values to be formatted are ignored. 632behavior. Any extra values to be formatted are ignored.
602 633
603 Certain format specifications require values of particular types. 634 Certain format specifications require values of particular types. If
604However, no error is signaled if the value actually supplied fails to 635you supply a value that doesn't fit the requirements, an error is
605have the expected type. Instead, the output is likely to be 636signaled.
606meaningless.
607 637
608 Here is a table of valid format specifications: 638 Here is a table of valid format specifications:
609 639
@@ -652,7 +682,7 @@ point number.
652 682
653@item %g 683@item %g
654Replace the specification with notation for a floating point number, 684Replace the specification with notation for a floating point number,
655using either exponential notation or decimal-point notation whichever 685using either exponential notation or decimal-point notation, whichever
656is shorter. 686is shorter.
657 687
658@item %% 688@item %%
@@ -741,10 +771,14 @@ not truncated. In the third case, the padding is on the right.
741@cindex case conversion in Lisp 771@cindex case conversion in Lisp
742 772
743 The character case functions change the case of single characters or 773 The character case functions change the case of single characters or
744of the contents of strings. The functions convert only alphabetic 774of the contents of strings. The functions normally convert only
745characters (the letters @samp{A} through @samp{Z} and @samp{a} through 775alphabetic characters (the letters @samp{A} through @samp{Z} and
746@samp{z}); other characters are not altered. The functions do not 776@samp{a} through @samp{z}, as well as non-ASCII letters); other
747modify the strings that are passed to them as arguments. 777characters are not altered. (You can specify a different case
778conversion mapping by specifying a case table---@pxref{Case Tables}.)
779
780 These functions do not modify the strings that are passed to them as
781arguments.
748 782
749 The examples below use the characters @samp{X} and @samp{x} which have 783 The examples below use the characters @samp{X} and @samp{x} which have
750@sc{ASCII} codes 88 and 120 respectively. 784@sc{ASCII} codes 88 and 120 respectively.
@@ -823,8 +857,8 @@ has the same result as @code{upcase}.
823@defun upcase-initials string 857@defun upcase-initials string
824This function capitalizes the initials of the words in @var{string}. 858This function capitalizes the initials of the words in @var{string}.
825without altering any letters other than the initials. It returns a new 859without altering any letters other than the initials. It returns a new
826string whose contents are a copy of @var{string-or-char}, in which each 860string whose contents are a copy of @var{string}, in which each word has
827word has been converted to upper case. 861been converted to upper case.
828 862
829The definition of a word is any sequence of consecutive characters that 863The definition of a word is any sequence of consecutive characters that
830are assigned to the word constituent syntax class in the current syntax 864are assigned to the word constituent syntax class in the current syntax
@@ -838,6 +872,9 @@ table (@xref{Syntax Class Table}).
838@end example 872@end example
839@end defun 873@end defun
840 874
875 @xref{Text Comparison}, for functions that compare strings; some of
876them ignore case differences, or can optionally ignore case differences.
877
841@node Case Tables 878@node Case Tables
842@section The Case Table 879@section The Case Table
843 880
@@ -860,10 +897,10 @@ The upcase table maps each character into the corresponding upper
860case character. 897case character.
861@item canonicalize 898@item canonicalize
862The canonicalize table maps all of a set of case-related characters 899The canonicalize table maps all of a set of case-related characters
863into some one of them. 900into a particular member of that set.
864@item equivalences 901@item equivalences
865The equivalences table maps each of a set of case-related characters 902The equivalences table maps each one of a set of case-related characters
866into the next one in that set. 903into the next character in that set.
867@end table 904@end table
868 905
869 In simple cases, all you need to specify is the mapping to lower-case; 906 In simple cases, all you need to specify is the mapping to lower-case;
diff --git a/lispref/symbols.texi b/lispref/symbols.texi
index 9f52fc0e5be..7e9c6a4a9a6 100644
--- a/lispref/symbols.texi
+++ b/lispref/symbols.texi
@@ -121,12 +121,12 @@ The property list cell contains the list @code{(variable-documentation
121documentation string for the variable @code{buffer-file-name} in the 121documentation string for the variable @code{buffer-file-name} in the
122@file{DOC-@var{version}} file. (29529 is the offset from the beginning 122@file{DOC-@var{version}} file. (29529 is the offset from the beginning
123of the @file{DOC-@var{version}} file to where that documentation string 123of the @file{DOC-@var{version}} file to where that documentation string
124begins---@pxref{Documentation Basics}) The function cell contains the 124begins---see @ref{Documentation Basics}.) The function cell contains
125function for returning the name of the file. @code{buffer-file-name} 125the function for returning the name of the file.
126names a primitive function, which has no read syntax and prints in hash 126@code{buffer-file-name} names a primitive function, which has no read
127notation (@pxref{Primitive Function Type}). A symbol naming a function 127syntax and prints in hash notation (@pxref{Primitive Function Type}). A
128written in Lisp would have a lambda expression (or a byte-code object) 128symbol naming a function written in Lisp would have a lambda expression
129in this cell. 129(or a byte-code object) in this cell.
130 130
131@node Definitions, Creating Symbols, Symbol Components, Symbols 131@node Definitions, Creating Symbols, Symbol Components, Symbols
132@section Defining Symbols 132@section Defining Symbols
diff --git a/lispref/syntax.texi b/lispref/syntax.texi
index 3200c40ac83..b6a5ea9a132 100644
--- a/lispref/syntax.texi
+++ b/lispref/syntax.texi
@@ -10,7 +10,7 @@
10@cindex text parsing 10@cindex text parsing
11 11
12 A @dfn{syntax table} specifies the syntactic textual function of each 12 A @dfn{syntax table} specifies the syntactic textual function of each
13character. This information is used by the parsing commands, the 13character. This information is used by the @dfn{parsing functions}, the
14complex movement commands, and others to determine where words, symbols, 14complex movement commands, and others to determine where words, symbols,
15and other syntactic constructs begin and end. The current syntax table 15and other syntactic constructs begin and end. The current syntax table
16controls the meaning of the word motion functions (@pxref{Word Motion}) 16controls the meaning of the word motion functions (@pxref{Word Motion})
@@ -524,8 +524,8 @@ If the property is @code{nil}, the character's syntax is determined from
524the current syntax table in the usual way. 524the current syntax table in the usual way.
525@end table 525@end table
526 526
527@tindex parse-sexp-lookup-properties
528@defvar parse-sexp-lookup-properties 527@defvar parse-sexp-lookup-properties
528@tindex parse-sexp-lookup-properties
529If this is non-@code{nil}, the syntax scanning functions pay attention 529If this is non-@code{nil}, the syntax scanning functions pay attention
530to syntax text properties. Otherwise they use only the current syntax 530to syntax text properties. Otherwise they use only the current syntax
531table. 531table.
@@ -765,43 +765,50 @@ a character to match was specified.
765to each syntactic type. 765to each syntactic type.
766 766
767@multitable @columnfractions .05 .3 .3 .3 767@multitable @columnfractions .05 .3 .3 .3
768@item@tab 768@item
769@tab
769@i{Integer} @i{Class} 770@i{Integer} @i{Class}
770@tab 771@tab
771@i{Integer} @i{Class} 772@i{Integer} @i{Class}
772@tab 773@tab
773@i{Integer} @i{Class} 774@i{Integer} @i{Class}
774@item@tab 775@item
776@tab
7750 @ @ whitespace 7770 @ @ whitespace
776@tab 778@tab
7775 @ @ close parenthesis 7795 @ @ close parenthesis
778@tab 780@tab
77910 @ @ character quote 78110 @ @ character quote
780@item@tab 782@item
783@tab
7811 @ @ punctuation 7841 @ @ punctuation
782@tab 785@tab
7836 @ @ expression prefix 7866 @ @ expression prefix
784@tab 787@tab
78511 @ @ comment-start 78811 @ @ comment-start
786@item@tab 789@item
790@tab
7872 @ @ word 7912 @ @ word
788@tab 792@tab
7897 @ @ string quote 7937 @ @ string quote
790@tab 794@tab
79112 @ @ comment-end 79512 @ @ comment-end
792@item@tab 796@item
797@tab
7933 @ @ symbol 7983 @ @ symbol
794@tab 799@tab
7958 @ @ paired delimiter 8008 @ @ paired delimiter
796@tab 801@tab
79713 @ @ inherit 80213 @ @ inherit
798@item@tab 803@item
804@tab
7994 @ @ open parenthesis 8054 @ @ open parenthesis
800@tab 806@tab
8019 @ @ escape 8079 @ @ escape
802@tab 808@tab
80314 @ @ comment-fence 80914 @ @ comment-fence
804@item@tab 810@item
811@tab
80515 @ string-fence 81215 @ string-fence
806@end multitable 813@end multitable
807 814
@@ -813,19 +820,22 @@ least significant bit. This table gives the power of two which
813corresponds to each syntax flag. 820corresponds to each syntax flag.
814 821
815@multitable @columnfractions .05 .3 .3 .3 822@multitable @columnfractions .05 .3 .3 .3
816@item@tab 823@item
824@tab
817@i{Prefix} @i{Flag} 825@i{Prefix} @i{Flag}
818@tab 826@tab
819@i{Prefix} @i{Flag} 827@i{Prefix} @i{Flag}
820@tab 828@tab
821@i{Prefix} @i{Flag} 829@i{Prefix} @i{Flag}
822@item@tab 830@item
831@tab
823@samp{1} @ @ @code{(lsh 1 16)} 832@samp{1} @ @ @code{(lsh 1 16)}
824@tab 833@tab
825@samp{3} @ @ @code{(lsh 1 18)} 834@samp{3} @ @ @code{(lsh 1 18)}
826@tab 835@tab
827@samp{p} @ @ @code{(lsh 1 20)} 836@samp{p} @ @ @code{(lsh 1 20)}
828@item@tab 837@item
838@tab
829@samp{2} @ @ @code{(lsh 1 17)} 839@samp{2} @ @ @code{(lsh 1 17)}
830@tab 840@tab
831@samp{4} @ @ @code{(lsh 1 19)} 841@samp{4} @ @ @code{(lsh 1 19)}
diff --git a/lispref/text.texi b/lispref/text.texi
index 96b527d23fa..69f0c002293 100644
--- a/lispref/text.texi
+++ b/lispref/text.texi
@@ -196,8 +196,11 @@ properties, just the characters themselves. @xref{Text Properties}.
196 196
197@defun buffer-string 197@defun buffer-string
198This function returns the contents of the entire accessible portion of 198This function returns the contents of the entire accessible portion of
199the current buffer as a string. This is the portion between 199the current buffer as a string. It is equivalent to
200@code{(point-min)} and @code{(point-max)} (@pxref{Narrowing}). 200
201@example
202(buffer-substring (point-min) (point-max))
203@end example
201 204
202@example 205@example
203@group 206@group
@@ -302,6 +305,13 @@ properties as the characters they were copied from. By contrast,
302characters specified as separate arguments, not part of a string or 305characters specified as separate arguments, not part of a string or
303buffer, inherit their text properties from the neighboring text. 306buffer, inherit their text properties from the neighboring text.
304 307
308 The insertion functions convert text from unibyte to multibyte in
309order to insert in a multibyte buffer, and vice versa---if the text
310comes from a string or from a buffer. However, they do not convert
311unibyte character codes 128 through 255 to multibyte characters, not
312even if the current buffer is a multibyte buffer. @xref{Converting
313Representations}.
314
305@defun insert &rest args 315@defun insert &rest args
306This function inserts the strings and/or characters @var{args} into the 316This function inserts the strings and/or characters @var{args} into the
307current buffer, at point, moving point forward. In other words, it 317current buffer, at point, moving point forward. In other words, it
@@ -328,6 +338,10 @@ current buffer before point. The argument @var{count} should be a
328number (@code{nil} means 1), and @var{character} must be a character. 338number (@code{nil} means 1), and @var{character} must be a character.
329The value is @code{nil}. 339The value is @code{nil}.
330 340
341This function does not convert unibyte character codes 128 through 255
342to multibyte characters, not even if the current buffer is a multibyte
343buffer. @xref{Converting Representations}.
344
331If @var{inherit} is non-@code{nil}, then the inserted characters inherit 345If @var{inherit} is non-@code{nil}, then the inserted characters inherit
332sticky text properties from the two characters before and after the 346sticky text properties from the two characters before and after the
333insertion point. @xref{Sticky Properties}. 347insertion point. @xref{Sticky Properties}.
@@ -524,8 +538,8 @@ the kill ring.
524The value returned is always @code{nil}. 538The value returned is always @code{nil}.
525@end deffn 539@end deffn
526 540
527@tindex backward-delete-char-untabify-method
528@defopt backward-delete-char-untabify-method 541@defopt backward-delete-char-untabify-method
542@tindex backward-delete-char-untabify-method
529This option specifies how @code{backward-delete-char-untabify} should 543This option specifies how @code{backward-delete-char-untabify} should
530deal with whitespace. Possible values include @code{untabify}, the 544deal with whitespace. Possible values include @code{untabify}, the
531default, meaning convert a tab to many spaces and delete one; 545default, meaning convert a tab to many spaces and delete one;
@@ -579,7 +593,7 @@ This function joins the line point is on to the previous line, deleting
579any whitespace at the join and in some cases replacing it with one 593any whitespace at the join and in some cases replacing it with one
580space. If @var{join-following-p} is non-@code{nil}, 594space. If @var{join-following-p} is non-@code{nil},
581@code{delete-indentation} joins this line to the following line 595@code{delete-indentation} joins this line to the following line
582instead. The value is @code{nil}. 596instead. The function returns @code{nil}.
583 597
584If there is a fill prefix, and the second of the lines being joined 598If there is a fill prefix, and the second of the lines being joined
585starts with the prefix, then @code{delete-indentation} deletes the 599starts with the prefix, then @code{delete-indentation} deletes the
@@ -612,7 +626,7 @@ responsible for deciding whether to leave a space at the junction.
612@end deffn 626@end deffn
613 627
614@defun fixup-whitespace 628@defun fixup-whitespace
615This function replaces all the white space surrounding point with either 629This function replaces all the whitespace surrounding point with either
616one space or no space, according to the context. It returns @code{nil}. 630one space or no space, according to the context. It returns @code{nil}.
617 631
618At the beginning or end of a line, the appropriate amount of space is 632At the beginning or end of a line, the appropriate amount of space is
@@ -728,9 +742,9 @@ new entry automatically deletes the last entry.
728 742
729 When kill commands are interwoven with other commands, each kill 743 When kill commands are interwoven with other commands, each kill
730command makes a new entry in the kill ring. Multiple kill commands in 744command makes a new entry in the kill ring. Multiple kill commands in
731succession build up a single entry in the kill ring, which would be 745succession build up a single kill-ring entry, which would be yanked as a
732yanked as a unit; the second and subsequent consecutive kill commands 746unit; the second and subsequent consecutive kill commands add text to
733add text to the entry made by the first one. 747the entry made by the first one.
734 748
735 For yanking, one entry in the kill ring is designated the ``front'' of 749 For yanking, one entry in the kill ring is designated the ``front'' of
736the ring. Some yank commands ``rotate'' the ring by designating a 750the ring. Some yank commands ``rotate'' the ring by designating a
@@ -825,7 +839,7 @@ The sequence of kills in the kill ring wraps around, so that after the
825oldest one comes the newest one, and before the newest one goes the 839oldest one comes the newest one, and before the newest one goes the
826oldest. 840oldest.
827 841
828The value is always @code{nil}. 842The return value is always @code{nil}.
829@end deffn 843@end deffn
830 844
831@node Low-Level Kill Ring 845@node Low-Level Kill Ring
@@ -837,8 +851,8 @@ take care of interaction with window system selections
837(@pxref{Window System Selections}). 851(@pxref{Window System Selections}).
838 852
839@defun current-kill n &optional do-not-move 853@defun current-kill n &optional do-not-move
840The function @code{current-kill} rotates the yanking pointer which 854The function @code{current-kill} rotates the yanking pointer, which
841designates the ``front'' of the kill ring by @var{n} places (from newer 855designates the ``front'' of the kill ring, by @var{n} places (from newer
842kills to older ones), and returns the text at that place in the ring. 856kills to older ones), and returns the text at that place in the ring.
843 857
844If the optional second argument @var{do-not-move} is non-@code{nil}, 858If the optional second argument @var{do-not-move} is non-@code{nil},
@@ -1049,8 +1063,8 @@ not make boundaries, and then the 20th does, and so on as long as
1049self-inserting characters continue. 1063self-inserting characters continue.
1050 1064
1051All buffer modifications add a boundary whenever the previous undoable 1065All buffer modifications add a boundary whenever the previous undoable
1052change was made in some other buffer. This way, a command that modifies 1066change was made in some other buffer. This is to ensure that
1053several buffers makes a boundary in each buffer it changes. 1067each command makes a boundary in each buffer where it makes changes.
1054 1068
1055Calling this function explicitly is useful for splitting the effects of 1069Calling this function explicitly is useful for splitting the effects of
1056a command into more than one unit. For example, @code{query-replace} 1070a command into more than one unit. For example, @code{query-replace}
@@ -1096,8 +1110,8 @@ In an interactive call, @var{buffer-or-name} is the current buffer.
1096You cannot specify any other buffer. 1110You cannot specify any other buffer.
1097@end deffn 1111@end deffn
1098 1112
1099@defun buffer-disable-undo &optional buffer 1113@deffn Command buffer-disable-undo &optional buffer
1100@defunx buffer-flush-undo &optional buffer 1114@deffnx Command buffer-flush-undo &optional buffer
1101@cindex disable undo 1115@cindex disable undo
1102This function discards the undo list of @var{buffer}, and disables 1116This function discards the undo list of @var{buffer}, and disables
1103further recording of undo information. As a result, it is no longer 1117further recording of undo information. As a result, it is no longer
@@ -1105,11 +1119,11 @@ possible to undo either previous changes or any subsequent changes. If
1105the undo list of @var{buffer} is already disabled, this function 1119the undo list of @var{buffer} is already disabled, this function
1106has no effect. 1120has no effect.
1107 1121
1108This function returns @code{nil}. It cannot be called interactively. 1122This function returns @code{nil}.
1109 1123
1110The name @code{buffer-flush-undo} is not considered obsolete, but the 1124The name @code{buffer-flush-undo} is not considered obsolete, but the
1111preferred name is @code{buffer-disable-undo}. 1125preferred name is @code{buffer-disable-undo}.
1112@end defun 1126@end deffn
1113 1127
1114 As editing continues, undo lists get longer and longer. To prevent 1128 As editing continues, undo lists get longer and longer. To prevent
1115them from using up all available memory space, garbage collection trims 1129them from using up all available memory space, garbage collection trims
@@ -1214,6 +1228,7 @@ filling when @var{justify} is non-@code{nil}.
1214 1228
1215In an interactive call, any prefix argument requests justification. 1229In an interactive call, any prefix argument requests justification.
1216 1230
1231@cindex Adaptive Fill mode
1217In Adaptive Fill mode, which is enabled by default, calling the function 1232In Adaptive Fill mode, which is enabled by default, calling the function
1218@code{fill-region-as-paragraph} on an indented paragraph when there is 1233@code{fill-region-as-paragraph} on an indented paragraph when there is
1219no fill prefix uses the indentation of the second line of the paragraph 1234no fill prefix uses the indentation of the second line of the paragraph
@@ -1279,7 +1294,8 @@ newlines'' act as paragraph separators.
1279@section Margins for Filling 1294@section Margins for Filling
1280 1295
1281@defopt fill-prefix 1296@defopt fill-prefix
1282This variable specifies a string of text that appears at the beginning 1297This buffer-local variable specifies a string of text that appears at
1298the beginning
1283of normal text lines and should be disregarded when filling them. Any 1299of normal text lines and should be disregarded when filling them. Any
1284line that fails to start with the fill prefix is considered the start of 1300line that fails to start with the fill prefix is considered the start of
1285a paragraph; so is any line that starts with the fill prefix followed by 1301a paragraph; so is any line that starts with the fill prefix followed by
@@ -1290,7 +1306,7 @@ together. The resulting filled lines also start with the fill prefix.
1290The fill prefix follows the left margin whitespace, if any. 1306The fill prefix follows the left margin whitespace, if any.
1291@end defopt 1307@end defopt
1292 1308
1293@defopt fill-column 1309@defvar fill-column
1294This buffer-local variable specifies the maximum width of filled lines. 1310This buffer-local variable specifies the maximum width of filled lines.
1295Its value should be an integer, which is a number of columns. All the 1311Its value should be an integer, which is a number of columns. All the
1296filling, justification, and centering commands are affected by this 1312filling, justification, and centering commands are affected by this
@@ -1300,7 +1316,7 @@ As a practical matter, if you are writing text for other people to
1300read, you should set @code{fill-column} to no more than 70. Otherwise 1316read, you should set @code{fill-column} to no more than 70. Otherwise
1301the line will be too long for people to read comfortably, and this can 1317the line will be too long for people to read comfortably, and this can
1302make the text seem clumsy. 1318make the text seem clumsy.
1303@end defopt 1319@end defvar
1304 1320
1305@defvar default-fill-column 1321@defvar default-fill-column
1306The value of this variable is the default value for @code{fill-column} in 1322The value of this variable is the default value for @code{fill-column} in
@@ -1367,8 +1383,8 @@ mode, @kbd{C-j} indents to this column. This variable automatically
1367becomes buffer-local when set in any fashion. 1383becomes buffer-local when set in any fashion.
1368@end defvar 1384@end defvar
1369 1385
1370@tindex fill-nobreak-predicate
1371@defvar fill-nobreak-predicate 1386@defvar fill-nobreak-predicate
1387@tindex fill-nobreak-predicate
1372This variable gives major modes a way to specify not to break a line at 1388This variable gives major modes a way to specify not to break a line at
1373certain places. Its value should be a function. This function is 1389certain places. Its value should be a function. This function is
1374called during filling, with no arguments and with point located at the 1390called during filling, with no arguments and with point located at the
@@ -1787,8 +1803,8 @@ indent the current line in a way appropriate for the current major mode.
1787 1803
1788@deffn Command indent-for-tab-command 1804@deffn Command indent-for-tab-command
1789This command calls the function in @code{indent-line-function} to indent 1805This command calls the function in @code{indent-line-function} to indent
1790the current line; except that if that function is 1806the current line; however, if that function is
1791@code{indent-to-left-margin}, it calls @code{insert-tab} instead. (That 1807@code{indent-to-left-margin}, @code{insert-tab} is called instead. (That
1792is a trivial command that inserts a tab character.) 1808is a trivial command that inserts a tab character.)
1793@end deffn 1809@end deffn
1794 1810
@@ -1842,7 +1858,8 @@ by making it start with the fill prefix.
1842 1858
1843@defvar indent-region-function 1859@defvar indent-region-function
1844The value of this variable is a function that can be used by 1860The value of this variable is a function that can be used by
1845@code{indent-region} as a short cut. You should design the function so 1861@code{indent-region} as a short cut. It should take two arguments, the
1862start and end of the region. You should design the function so
1846that it will produce the same results as indenting the lines of the 1863that it will produce the same results as indenting the lines of the
1847region one by one, but presumably faster. 1864region one by one, but presumably faster.
1848 1865
@@ -2389,16 +2406,16 @@ position less than or equal to @var{pos}; it equals @var{pos} only if
2389@var{limit} equals @var{pos}. 2406@var{limit} equals @var{pos}.
2390@end defun 2407@end defun
2391 2408
2392@tindex next-char-property-change
2393@defun next-char-property-change position &optional limit 2409@defun next-char-property-change position &optional limit
2410@tindex next-char-property-change
2394This is like @code{next-property-change} except that it considers 2411This is like @code{next-property-change} except that it considers
2395overlay properties as well as text properties. There is no @var{object} 2412overlay properties as well as text properties. There is no @var{object}
2396operand because this function operates only on the current buffer. It 2413operand because this function operates only on the current buffer. It
2397returns the next address at which either kind of property changes. 2414returns the next address at which either kind of property changes.
2398@end defun 2415@end defun
2399 2416
2400@tindex previous-char-property-change
2401@defun previous-char-property-change position &optional limit 2417@defun previous-char-property-change position &optional limit
2418@tindex previous-char-property-change
2402This is like @code{next-char-property-change}, but scans back from 2419This is like @code{next-char-property-change}, but scans back from
2403@var{position} instead of forward. 2420@var{position} instead of forward.
2404@end defun 2421@end defun
@@ -3160,17 +3177,14 @@ end of the region just changed, and the length of the text that existed
3160before the change. All three arguments are integers. The buffer that's 3177before the change. All three arguments are integers. The buffer that's
3161about to change is always the current buffer. 3178about to change is always the current buffer.
3162 3179
3163The length of the old text is measured in bytes; it is the difference 3180The length of the old text the difference between the buffer positions
3164between the buffer positions before and after that text, before the 3181before and after that text as it was before the change. As for the
3165change. As for the changed text, its length in bytes is simply the 3182changed text, its length is simply the difference between the first two
3166difference between the first two arguments. If you want the length 3183arguments.
3167in @emph{characters} of the text before the change, you should use
3168a @code{before-change-functions} function that calls @code{chars-in-region}
3169(@pxref{Chars and Bytes}).
3170@end defvar 3184@end defvar
3171 3185
3172@tindex combine-after-change-calls
3173@defmac combine-after-change-calls body... 3186@defmac combine-after-change-calls body...
3187@tindex combine-after-change-calls
3174The macro executes @var{body} normally, but arranges to call the 3188The macro executes @var{body} normally, but arranges to call the
3175after-change functions just once for a series of several changes---if 3189after-change functions just once for a series of several changes---if
3176that seems safe. 3190that seems safe.
diff --git a/lispref/tips.texi b/lispref/tips.texi
index 11522391a3f..264875768b9 100644
--- a/lispref/tips.texi
+++ b/lispref/tips.texi
@@ -46,7 +46,7 @@ instead.
46If you write a function that you think ought to be added to Emacs under 46If you write a function that you think ought to be added to Emacs under
47a certain name, such as @code{twiddle-files}, don't call it by that name 47a certain name, such as @code{twiddle-files}, don't call it by that name
48in your program. Call it @code{mylib-twiddle-files} in your program, 48in your program. Call it @code{mylib-twiddle-files} in your program,
49and send mail to @samp{bug-gnu-emacs@@prep.ai.mit.edu} suggesting we add 49and send mail to @samp{bug-gnu-emacs@@gnu.org} suggesting we add
50it to Emacs. If and when we do, we can change the name easily enough. 50it to Emacs. If and when we do, we can change the name easily enough.
51 51
52If one prefix is insufficient, your package may use two or three 52If one prefix is insufficient, your package may use two or three
@@ -104,6 +104,8 @@ If a user option variable records a true-or-false condition, give it a
104name that ends in @samp{-flag}. 104name that ends in @samp{-flag}.
105 105
106@item 106@item
107@cindex reserved keys
108@cindex keys, reserved
107Please do not define @kbd{C-c @var{letter}} as a key in your major 109Please do not define @kbd{C-c @var{letter}} as a key in your major
108modes. These sequences are reserved for users; they are the 110modes. These sequences are reserved for users; they are the
109@strong{only} sequences reserved for users, so do not block them. 111@strong{only} sequences reserved for users, so do not block them.
@@ -262,7 +264,7 @@ Try to avoid compiler warnings about undefined free variables, by adding
262If you bind a variable in one function, and use it or set it in another 264If you bind a variable in one function, and use it or set it in another
263function, the compiler warns about the latter function unless the 265function, the compiler warns about the latter function unless the
264variable has a definition. But often these variables have short names, 266variable has a definition. But often these variables have short names,
265and it is not clean for Lisp packages to define such variables names. 267and it is not clean for Lisp packages to define such variable names.
266Therefore, you should rename the variable to start with the name prefix 268Therefore, you should rename the variable to start with the name prefix
267used for the other functions and variables in your package. 269used for the other functions and variables in your package.
268 270
@@ -317,8 +319,10 @@ Lisp programs.
317@cindex profiling 319@cindex profiling
318@cindex timing programs 320@cindex timing programs
319@cindex @file{profile.el} 321@cindex @file{profile.el}
320Use the @file{profile} library to profile your program. See the file 322@cindex @file{elp.el}
321@file{profile.el} for instructions. 323Profile your program with the @file{profile} library or the @file{elp}
324library. See the files @file{profile.el} and @file{elp.el} for
325instructions.
322 326
323@item 327@item
324Use iteration rather than recursion whenever possible. 328Use iteration rather than recursion whenever possible.
@@ -340,19 +344,13 @@ property. If the property is non-@code{nil}, then the function is
340handled specially. 344handled specially.
341 345
342For example, the following input will show you that @code{aref} is 346For example, the following input will show you that @code{aref} is
343compiled specially (@pxref{Array Functions}) while @code{elt} is not 347compiled specially (@pxref{Array Functions}):
344(@pxref{Sequence Functions}):
345 348
346@example 349@example
347@group 350@group
348(get 'aref 'byte-compile) 351(get 'aref 'byte-compile)
349 @result{} byte-compile-two-args 352 @result{} byte-compile-two-args
350@end group 353@end group
351
352@group
353(get 'elt 'byte-compile)
354 @result{} nil
355@end group
356@end example 354@end example
357 355
358@item 356@item
@@ -480,14 +478,39 @@ t and nil without single-quotes. (In this manual, we use a different
480convention, with single-quotes for all symbols.) 478convention, with single-quotes for all symbols.)
481@end ifinfo 479@end ifinfo
482 480
483For example: 481Help mode automatically creates hyperlinks when documentation strings
482use symbol names inside single quotes, when the symbol has either a
483function or a variable definition. You do not need to do anything
484special to make use of this feature. However, when a symbol has both a
485function definition and a variable definition, and you want to refer to
486just one of them, you can specify which one by writing one of the words
487@samp{variable}, @samp{option}, @samp{function}, or @samp{command},
488immediately before the symbol name. (Case makes no difference in
489recognizing these indicator words.) For example, if you write
490
491@example
492This function sets the variable `buffer-file-name'.
493@end example
494
495@noindent
496then the hyperlink will refer only to the variable documentation of
497@code{buffer-file-name}, and not to its function documentation.
498
499If a symbol has a function definition and/or a variable definition, but
500those are irrelevant to the use of the symbol that you are documenting,
501you can write the word @samp{symbol} before the symbol name to prevent
502making any hyperlink. For example,
484 503
485@example 504@example
486The value of `swim-speed' specifies how fast to swim. 505If the argument KIND-OF-RESULT is the symbol `list',
487Possible values are t for high speed, nil for low speed, 506this function returns a list of all the objects
488and `medium' for medium speed. 507that satisfy the criterion.
489@end example 508@end example
490 509
510@noindent
511does not make a hyperlink to the documentation, irrelevant here, of the
512function @code{list}.
513
491@item 514@item
492Don't write key sequences directly in documentation strings. Instead, 515Don't write key sequences directly in documentation strings. Instead,
493use the @samp{\\[@dots{}]} construct to stand for them. For example, 516use the @samp{\\[@dots{}]} construct to stand for them. For example,
@@ -692,6 +715,8 @@ example).
692 715
693@item Keywords 716@item Keywords
694This line lists keywords for the @code{finder-by-keyword} help command. 717This line lists keywords for the @code{finder-by-keyword} help command.
718Please use that command to see a list of the meaningful keywords.
719
695This field is important; it's how people will find your package when 720This field is important; it's how people will find your package when
696they're looking for things by topic area. To separate the keywords, you 721they're looking for things by topic area. To separate the keywords, you
697can use spaces, commas, or both. 722can use spaces, commas, or both.
@@ -708,14 +733,21 @@ library file. Here is a table of them:
708@table @samp 733@table @samp
709@item ;;; Commentary: 734@item ;;; Commentary:
710This begins introductory comments that explain how the library works. 735This begins introductory comments that explain how the library works.
711It should come right after the copying permissions. 736It should come right after the copying permissions, terminated by a
737@samp{Change Log}, @samp{History} or @samp{Code} comment line. This
738text is used by the Finder package, so it should make sense in that
739context.
740
741@item ;;; Documentation
742This has been used in some files in place of @samp{;;; Commentary:},
743but @samp{;;; Commentary:} is preferred.
712 744
713@item ;;; Change log: 745@item ;;; Change Log:
714This begins change log information stored in the library file (if you 746This begins change log information stored in the library file (if you
715store the change history there). For most of the Lisp 747store the change history there). For most of the Lisp
716files distributed with Emacs, the change history is kept in the file 748files distributed with Emacs, the change history is kept in the file
717@file{ChangeLog} and not in the source file at all; these files do 749@file{ChangeLog} and not in the source file at all; these files do
718not have a @samp{;;; Change log:} line. 750not have a @samp{;;; Change Log:} line.
719 751
720@item ;;; Code: 752@item ;;; Code:
721This begins the actual code of the program. 753This begins the actual code of the program.
diff --git a/lispref/variables.texi b/lispref/variables.texi
index 4517d6bb02f..1451db07d06 100644
--- a/lispref/variables.texi
+++ b/lispref/variables.texi
@@ -104,7 +104,7 @@ include @code{nil} and @code{t}, as well as any symbol whose name starts
104with @samp{:}. These symbols cannot be rebound, nor can their values be 104with @samp{:}. These symbols cannot be rebound, nor can their values be
105changed. Any attempt to set or bind @code{nil} or @code{t} signals a 105changed. Any attempt to set or bind @code{nil} or @code{t} signals a
106@code{setting-constant} error. The same is true for a symbol whose name 106@code{setting-constant} error. The same is true for a symbol whose name
107starts with @samp{:}, except that you are allowed to set such symbol to 107starts with @samp{:}, except that you are allowed to set such a symbol to
108itself. 108itself.
109 109
110@example 110@example
@@ -118,8 +118,8 @@ nil @equiv{} 'nil
118@end group 118@end group
119@end example 119@end example
120 120
121@tindex keyword-symbols-constant-flag
122@defvar keyword-symbols-constant-flag 121@defvar keyword-symbols-constant-flag
122@tindex keyword-symbols-constant-flag
123If this variable is @code{nil}, you are allowed to set and bind symbols 123If this variable is @code{nil}, you are allowed to set and bind symbols
124whose names start with @samp{:} as you wish. This is to make it 124whose names start with @samp{:} as you wish. This is to make it
125possible to run old Lisp programs which do that. 125possible to run old Lisp programs which do that.
@@ -247,27 +247,29 @@ Macro calls (@pxref{Macros}).
247@end itemize 247@end itemize
248 248
249 Variables can also have buffer-local bindings (@pxref{Buffer-Local 249 Variables can also have buffer-local bindings (@pxref{Buffer-Local
250Variables}); a few variables have terminal-local bindings 250Variables}) and frame-local bindings (@pxref{Frame-Local Variables}); a
251(@pxref{Multiple Displays}). These kinds of bindings work somewhat like 251few variables have terminal-local bindings (@pxref{Multiple Displays}).
252ordinary local bindings, but they are localized depending on ``where'' 252These kinds of bindings work somewhat like ordinary local bindings, but
253you are in Emacs, rather than localized in time. 253they are localized depending on ``where'' you are in Emacs, rather than
254localized in time.
254 255
255@defvar max-specpdl-size 256@defvar max-specpdl-size
256@cindex variable limit error 257@cindex variable limit error
257@cindex evaluation error 258@cindex evaluation error
258@cindex infinite recursion 259@cindex infinite recursion
259 This variable defines the limit on the total number of local variable 260This variable defines the limit on the total number of local variable
260bindings and @code{unwind-protect} cleanups (@pxref{Nonlocal Exits}) 261bindings and @code{unwind-protect} cleanups (@pxref{Nonlocal Exits})
261that are allowed before signaling an error (with data @code{"Variable 262that are allowed before signaling an error (with data @code{"Variable
262binding depth exceeds max-specpdl-size"}). 263binding depth exceeds max-specpdl-size"}).
263 264
264 This limit, with the associated error when it is exceeded, is one way 265This limit, with the associated error when it is exceeded, is one way
265that Lisp avoids infinite recursion on an ill-defined function. 266that Lisp avoids infinite recursion on an ill-defined function.
266 267@code{max-lisp-eval-depth} provides another limit on depth of nesting.
267 The default value is 600.
268
269 @code{max-lisp-eval-depth} provides another limit on depth of nesting.
270@xref{Eval}. 268@xref{Eval}.
269
270The default value is 600. Entry to the Lisp debugger increases the
271value, if there is little room left, to make sure the debugger itself
272has room to execute.
271@end defvar 273@end defvar
272 274
273@node Void Variables 275@node Void Variables
@@ -430,14 +432,15 @@ already has a value (i.e., it is not void), @var{value} is not even
430evaluated, and @var{symbol}'s value remains unchanged. If @var{value} 432evaluated, and @var{symbol}'s value remains unchanged. If @var{value}
431is omitted, the value of @var{symbol} is not changed in any case. 433is omitted, the value of @var{symbol} is not changed in any case.
432 434
435If @var{symbol} has a buffer-local binding in the current buffer,
436@code{defvar} operates on the default value, which is buffer-independent,
437not the current (buffer-local) binding. It sets the default value if
438the default value is void. @xref{Buffer-Local Variables}.
439
433When you evaluate a top-level @code{defvar} form with @kbd{C-M-x} in 440When you evaluate a top-level @code{defvar} form with @kbd{C-M-x} in
434Emacs Lisp mode (@code{eval-defun}), a special feature of 441Emacs Lisp mode (@code{eval-defun}), a special feature of
435@code{eval-defun} arranges to set the variable unconditionally even if 442@code{eval-defun} arranges to set the variable unconditionally, without
436the variable already has a value. 443testing whether its value is void.
437
438If @var{symbol} has a buffer-local binding in the current buffer,
439@code{defvar} sets the default (buffer-independent) value, not the
440buffer-local value. @xref{Buffer-Local Variables}.
441 444
442If the @var{doc-string} argument appears, it specifies the documentation 445If the @var{doc-string} argument appears, it specifies the documentation
443for the variable. (This opportunity to specify documentation is one of 446for the variable. (This opportunity to specify documentation is one of
@@ -518,9 +521,10 @@ symbol to be defined must appear explicitly in the @code{defconst}.
518 521
519@code{defconst} always evaluates @var{value}, and sets the value of 522@code{defconst} always evaluates @var{value}, and sets the value of
520@var{symbol} to the result if @var{value} is given. If @var{symbol} 523@var{symbol} to the result if @var{value} is given. If @var{symbol}
521does has a buffer-local binding in the current buffer, @code{defconst} 524does have a buffer-local binding in the current buffer, @code{defconst}
522sets the default value, not the buffer-local value. But you should not 525sets the default value, not the buffer-local value. (But you should not
523be making the symbol buffer-local if it is defined with @code{defconst}. 526be making buffer-local bindings for a symbol that is defined with
527@code{defconst}.)
524 528
525Here, @code{pi} is a constant that presumably ought not to be changed 529Here, @code{pi} is a constant that presumably ought not to be changed
526by anyone (attempts by the Indiana State Legislature notwithstanding). 530by anyone (attempts by the Indiana State Legislature notwithstanding).
@@ -560,7 +564,7 @@ then the variable is a user option.
560the @code{set-variable} command uses that value to control reading the 564the @code{set-variable} command uses that value to control reading the
561new value for the variable. The property's value is used as if it were 565new value for the variable. The property's value is used as if it were
562to @code{interactive} (@pxref{Using Interactive}). However, this feature 566to @code{interactive} (@pxref{Using Interactive}). However, this feature
563is largely obsoleted by the @code{defcustom} (@pxref{Customization}). 567is largely obsoleted by @code{defcustom} (@pxref{Customization}).
564 568
565 @strong{Warning:} If the @code{defconst} and @code{defvar} special 569 @strong{Warning:} If the @code{defconst} and @code{defvar} special
566forms are used while the variable has a local binding, they set the 570forms are used while the variable has a local binding, they set the
@@ -1069,7 +1073,7 @@ and/or frames is an important customization method.
1069 1073
1070 This section describes buffer-local bindings; for frame-local 1074 This section describes buffer-local bindings; for frame-local
1071bindings, see the following section, @ref{Frame-Local Variables}. (A few 1075bindings, see the following section, @ref{Frame-Local Variables}. (A few
1072variables have bindings that are local to a X terminal; see 1076variables have bindings that are local to each X terminal; see
1073@ref{Multiple Displays}.) 1077@ref{Multiple Displays}.)
1074 1078
1075@menu 1079@menu
@@ -1137,8 +1141,8 @@ can scramble the values of the buffer-local and default bindings.
1137 1141
1138 To preserve your sanity, avoid using a variable in that way. If you 1142 To preserve your sanity, avoid using a variable in that way. If you
1139use @code{save-excursion} around each piece of code that changes to a 1143use @code{save-excursion} around each piece of code that changes to a
1140different current buffer, you will not have this problem. Here is an 1144different current buffer, you will not have this problem
1141example of what to avoid: 1145(@pxref{Excursions}). Here is an example of what to avoid:
1142 1146
1143@example 1147@example
1144@group 1148@group
@@ -1288,7 +1292,7 @@ then the variable appears directly in the resulting list.
1288(setq lcl (buffer-local-variables)) 1292(setq lcl (buffer-local-variables))
1289 ;; @r{First, built-in variables local in all buffers:} 1293 ;; @r{First, built-in variables local in all buffers:}
1290@result{} ((mark-active . nil) 1294@result{} ((mark-active . nil)
1291 (buffer-undo-list nil) 1295 (buffer-undo-list . nil)
1292 (mode-name . "Fundamental") 1296 (mode-name . "Fundamental")
1293 @dots{} 1297 @dots{}
1294@group 1298@group
@@ -1331,8 +1335,9 @@ result, the buffer will see the default values of most variables.
1331 1335
1332This function also resets certain other information pertaining to the 1336This function also resets certain other information pertaining to the
1333buffer: it sets the local keymap to @code{nil}, the syntax table to the 1337buffer: it sets the local keymap to @code{nil}, the syntax table to the
1334value of @code{standard-syntax-table}, and the abbrev table to the value 1338value of @code{(standard-syntax-table)}, the case table to
1335of @code{fundamental-mode-abbrev-table}. 1339@code{(standard-case-table)}, and the abbrev table to the value of
1340@code{fundamental-mode-abbrev-table}.
1336 1341
1337The very first thing this function does is run the normal hook 1342The very first thing this function does is run the normal hook
1338@code{change-major-mode-hook} (see below). 1343@code{change-major-mode-hook} (see below).
@@ -1400,10 +1405,11 @@ default value is nonvoid. If @code{(default-boundp 'foo)} returns
1400@code{symbol-value}. 1405@code{symbol-value}.
1401@end defun 1406@end defun
1402 1407
1403@defspec setq-default symbol value 1408@defspec setq-default [symbol form]@dots{}
1404This sets the default value of @var{symbol} to @var{value}. It does not 1409This special form gives each @var{symbol} a new default value, which is
1405evaluate @var{symbol}, but does evaluate @var{value}. The value of the 1410the result of evaluating the corresponding @var{form}. It does not
1406@code{setq-default} form is @var{value}. 1411evaluate @var{symbol}, but does evaluate @var{form}. The value of the
1412@code{setq-default} form is the value of the last @var{form}.
1407 1413
1408If a @var{symbol} is not buffer-local for the current buffer, and is not 1414If a @var{symbol} is not buffer-local for the current buffer, and is not
1409marked automatically buffer-local, @code{setq-default} has the same 1415marked automatically buffer-local, @code{setq-default} has the same
@@ -1492,17 +1498,18 @@ name as the parameter name.
1492 To enable frame-local bindings for a certain variable, call the function 1498 To enable frame-local bindings for a certain variable, call the function
1493@code{make-variable-frame-local}. 1499@code{make-variable-frame-local}.
1494 1500
1495@defun make-variable-frame-local variable 1501@deffn Command make-variable-frame-local variable
1496Enable the use of frame-local bindings for @var{variable}. This does 1502Enable the use of frame-local bindings for @var{variable}. This does
1497not in itself create any frame-local bindings for the variable; however, 1503not in itself create any frame-local bindings for the variable; however,
1498if some frame already has a value for @var{variable} as a frame 1504if some frame already has a value for @var{variable} as a frame
1499parameter, that value automatically becomes a frame-local binding. 1505parameter, that value automatically becomes a frame-local binding.
1500 1506
1501If the variable is terminal-local, this function signals an error. Such 1507If the variable is terminal-local, this function signals an error,
1502variables cannot have buffer-local bindings as well. @xref{Multiple 1508because such variables cannot have frame-local bindings as well.
1503Displays}. A few variables that are implemented specially in Emacs 1509@xref{Multiple Displays}. A few variables that are implemented
1504can be (and usually are) buffer-local, but can never be frame-local. 1510specially in Emacs can be (and usually are) buffer-local, but can never
1505@end defun 1511be frame-local.
1512@end deffn
1506 1513
1507 Buffer-local bindings take precedence over frame-local bindings. Thus, 1514 Buffer-local bindings take precedence over frame-local bindings. Thus,
1508consider a variable @code{foo}: if the current buffer has a buffer-local 1515consider a variable @code{foo}: if the current buffer has a buffer-local
diff --git a/lispref/windows.texi b/lispref/windows.texi
index 9199ff0f8d2..bd4bad02137 100644
--- a/lispref/windows.texi
+++ b/lispref/windows.texi
@@ -597,7 +597,9 @@ when you need complete control.
597 597
598@defun set-window-buffer window buffer-or-name 598@defun set-window-buffer window buffer-or-name
599This function makes @var{window} display @var{buffer-or-name} as its 599This function makes @var{window} display @var{buffer-or-name} as its
600contents. It returns @code{nil}. 600contents. It returns @code{nil}. This is the fundamental primitive
601for changing which buffer is displayed in a window, and all ways
602of doing that call this function.
601 603
602@example 604@example
603@group 605@group
@@ -669,6 +671,16 @@ If it is a frame, consider windows on that frame.
669@end itemize 671@end itemize
670@end defun 672@end defun
671 673
674@defvar buffer-display-time
675@tindex buffer-display-time
676This variable records the time at which a buffer was last made visible
677in a window. It is always local in each buffer; each time
678@code{set-window-buffer} is called, it sets this variable to
679@code{(current-time)} in the specified buffer (@pxref{Time of Day}).
680When a buffer is first created, @code{buffer-display-count} starts out
681with the value @code{nil}.
682@end defvar
683
672@node Displaying Buffers 684@node Displaying Buffers
673@section Displaying Buffers in Windows 685@section Displaying Buffers in Windows
674@cindex switching to a buffer 686@cindex switching to a buffer
@@ -685,7 +697,8 @@ See the preceding section for
685@ifinfo 697@ifinfo
686@xref{Buffers and Windows}, for 698@xref{Buffers and Windows}, for
687@end ifinfo 699@end ifinfo
688low-level functions that give you more precise control. 700low-level functions that give you more precise control. All of these
701functions work by calling @code{set-window-buffer}.
689 702
690 Do not use the functions in this section in order to make a buffer 703 Do not use the functions in this section in order to make a buffer
691current so that a Lisp program can access or modify it; they are too 704current so that a Lisp program can access or modify it; they are too
@@ -786,14 +799,6 @@ don't care which other buffer is used; you just want to make sure that
786This function returns @code{nil}. 799This function returns @code{nil}.
787@end deffn 800@end deffn
788 801
789@tindex buffer-display-count
790@defvar buffer-display-count
791This variable is always buffer-local in each buffer. When the buffer is
792created, @code{buffer-display-count} has value 0. Each time the buffer
793is displayed in a window, that increments the value of
794@code{buffer-display-count}.
795@end defvar
796
797@node Choosing Window 802@node Choosing Window
798@section Choosing a Window for Display 803@section Choosing a Window for Display
799 804
@@ -1308,13 +1313,14 @@ Replaces three keystroke sequence C-u 0 C-l."
1308@section Horizontal Scrolling 1313@section Horizontal Scrolling
1309@cindex horizontal scrolling 1314@cindex horizontal scrolling
1310 1315
1311 Because we read English first from top to bottom and second from left 1316 Because we read English from left to right in the ``inner loop'', and
1312to right, horizontal scrolling is not like vertical scrolling. Vertical 1317from top to bottom in the ``outer loop'', horizontal scrolling is not
1313scrolling involves selection of a contiguous portion of text to display. 1318like vertical scrolling. Vertical scrolling involves selection of a
1314Horizontal scrolling causes part of each line to go off screen. The 1319contiguous portion of text to display, but horizontal scrolling causes
1315amount of horizontal scrolling is therefore specified as a number of 1320part of each line to go off screen. The amount of horizontal scrolling
1316columns rather than as a position in the buffer. It has nothing to do 1321is therefore specified as a number of columns rather than as a position
1317with the display-start position returned by @code{window-start}. 1322in the buffer. It has nothing to do with the display-start position
1323returned by @code{window-start}.
1318 1324
1319 Usually, no horizontal scrolling is in effect; then the leftmost 1325 Usually, no horizontal scrolling is in effect; then the leftmost
1320column is at the left edge of the window. In this state, scrolling to 1326column is at the left edge of the window. In this state, scrolling to
@@ -1838,8 +1844,8 @@ over. In most cases, @code{save-selected-window} (@pxref{Selecting
1838Windows}) is what you need here. 1844Windows}) is what you need here.
1839@end defvar 1845@end defvar
1840 1846
1841@tindex redisplay-end-trigger-functions
1842@defvar redisplay-end-trigger-functions 1847@defvar redisplay-end-trigger-functions
1848@tindex redisplay-end-trigger-functions
1843This abnormal hook is run whenever redisplay in window uses text that 1849This abnormal hook is run whenever redisplay in window uses text that
1844extends past a specified end trigger position. You set the end trigger 1850extends past a specified end trigger position. You set the end trigger
1845position with the function @code{set-window-redisplay-end-trigger}. The 1851position with the function @code{set-window-redisplay-end-trigger}. The
@@ -1849,19 +1855,19 @@ feature, and the trigger value is automatically reset to @code{nil} just
1849after the hook is run. 1855after the hook is run.
1850@end defvar 1856@end defvar
1851 1857
1852@tindex set-window-redisplay-end-trigger
1853@defun set-window-redisplay-end-trigger window position 1858@defun set-window-redisplay-end-trigger window position
1859@tindex set-window-redisplay-end-trigger
1854This function sets @var{window}'s end trigger position at 1860This function sets @var{window}'s end trigger position at
1855@var{position}. 1861@var{position}.
1856@end defun 1862@end defun
1857 1863
1858@tindex window-redisplay-end-trigger
1859@defun window-redisplay-end-trigger window 1864@defun window-redisplay-end-trigger window
1865@tindex window-redisplay-end-trigger
1860This function returns @var{window}'s current end trigger position. 1866This function returns @var{window}'s current end trigger position.
1861@end defun 1867@end defun
1862 1868
1863@tindex window-configuration-change-hook
1864@defvar window-configuration-change-hook 1869@defvar window-configuration-change-hook
1870@tindex window-configuration-change-hook
1865A normal hook that is run every time you change the window configuration 1871A normal hook that is run every time you change the window configuration
1866of an existing frame. This includes splitting or deleting windows, 1872of an existing frame. This includes splitting or deleting windows,
1867changing the sizes of windows, or displaying a different buffer in a 1873changing the sizes of windows, or displaying a different buffer in a