aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman1999-09-17 06:59:04 +0000
committerRichard M. Stallman1999-09-17 06:59:04 +0000
commit8241495da57ca0efed1b2e86ff693b5614e0aebd (patch)
treeee1fca7ca3eafe24dbbf651622196bc849203e69
parent106217c6600b3049f1c62afaf198b9382206acba (diff)
downloademacs-8241495da57ca0efed1b2e86ff693b5614e0aebd.tar.gz
emacs-8241495da57ca0efed1b2e86ff693b5614e0aebd.zip
*** empty log message ***
-rw-r--r--lispref/abbrevs.texi2
-rw-r--r--lispref/advice.texi11
-rw-r--r--lispref/anti.texi264
-rw-r--r--lispref/backups.texi91
-rw-r--r--lispref/buffers.texi58
-rw-r--r--lispref/calendar.texi6
-rw-r--r--lispref/commands.texi68
-rw-r--r--lispref/control.texi94
-rw-r--r--lispref/customize.texi63
-rw-r--r--lispref/debugging.texi47
-rw-r--r--lispref/display.texi1550
-rw-r--r--lispref/edebug.texi163
-rw-r--r--lispref/elisp.texi24
-rw-r--r--lispref/errors.texi8
-rw-r--r--lispref/files.texi204
-rw-r--r--lispref/frames.texi342
-rw-r--r--lispref/functions.texi1
-rw-r--r--lispref/internals.texi40
-rw-r--r--lispref/intro.texi31
-rw-r--r--lispref/keymaps.texi252
-rw-r--r--lispref/lists.texi37
-rw-r--r--lispref/loading.texi66
-rw-r--r--lispref/maps.texi23
-rw-r--r--lispref/markers.texi2
-rw-r--r--lispref/minibuf.texi41
-rw-r--r--lispref/modes.texi215
-rw-r--r--lispref/nonascii.texi135
-rw-r--r--lispref/numbers.texi32
-rw-r--r--lispref/objects.texi161
-rw-r--r--lispref/os.texi222
-rw-r--r--lispref/positions.texi41
-rw-r--r--lispref/processes.texi75
-rw-r--r--lispref/searching.texi285
-rw-r--r--lispref/sequences.texi4
-rw-r--r--lispref/streams.texi53
-rw-r--r--lispref/strings.texi84
-rw-r--r--lispref/symbols.texi19
-rw-r--r--lispref/syntax.texi23
-rw-r--r--lispref/text.texi75
-rw-r--r--lispref/tips.texi66
-rw-r--r--lispref/variables.texi33
-rw-r--r--lispref/windows.texi350
42 files changed, 3884 insertions, 1477 deletions
diff --git a/lispref/abbrevs.texi b/lispref/abbrevs.texi
index 674082b6289..52847bf320a 100644
--- a/lispref/abbrevs.texi
+++ b/lispref/abbrevs.texi
@@ -4,7 +4,7 @@
4@c See the file elisp.texi for copying conditions. 4@c See the file elisp.texi for copying conditions.
5@setfilename ../info/abbrevs 5@setfilename ../info/abbrevs
6@node Abbrevs, Processes, Syntax Tables, Top 6@node Abbrevs, Processes, Syntax Tables, Top
7@chapter Abbrevs And Abbrev Expansion 7@chapter Abbrevs and Abbrev Expansion
8@cindex abbrev 8@cindex abbrev
9@cindex abbrev table 9@cindex abbrev table
10 10
diff --git a/lispref/advice.texi b/lispref/advice.texi
index 1d3d4e0e46f..6ff93495447 100644
--- a/lispref/advice.texi
+++ b/lispref/advice.texi
@@ -174,6 +174,9 @@ actually called. If more than one piece of advice specifies an argument
174list, then the first one (the one with the smallest position) found in 174list, then the first one (the one with the smallest position) found in
175the list of all classes of advice is used. 175the list of all classes of advice is used.
176 176
177@xref{Argument Access in Advice}, for more information about argument
178lists and advice.
179
177The remaining elements, @var{flags}, are symbols that specify further 180The remaining elements, @var{flags}, are symbols that specify further
178information about how to use this piece of advice. Here are the valid 181information about how to use this piece of advice. Here are the valid
179symbols and their meanings: 182symbols and their meanings:
@@ -210,7 +213,7 @@ unless subsequently explicitly enabled. @xref{Enabling Advice}.
210Activate advice for @var{function} when this @code{defadvice} is 213Activate advice for @var{function} when this @code{defadvice} is
211compiled or macroexpanded. This generates a compiled advised definition 214compiled or macroexpanded. This generates a compiled advised definition
212according to the current advice state, which will be used during 215according to the current advice state, which will be used during
213activation if appropriate. 216activation if appropriate. @xref{Preactivation}.
214 217
215This is useful only if this @code{defadvice} is byte-compiled. 218This is useful only if this @code{defadvice} is byte-compiled.
216@end table 219@end table
@@ -301,7 +304,9 @@ specified @var{class}, then @var{position} specifies where in the list
301to put the new piece of advice. The value of @var{position} can either 304to put the new piece of advice. The value of @var{position} can either
302be @code{first}, @code{last}, or a number (counting from 0 at the 305be @code{first}, @code{last}, or a number (counting from 0 at the
303beginning of the list). Numbers outside the range are mapped to the 306beginning of the list). Numbers outside the range are mapped to the
304closest extreme position. 307beginning or the end of the range, whichever is closer. The
308@var{position} value is ignored when redefining an existing piece of
309advice.
305 310
306If @var{function} already has a piece of @var{advice} with the same 311If @var{function} already has a piece of @var{advice} with the same
307name, then the position argument is ignored and the old advice is 312name, then the position argument is ignored and the old advice is
@@ -339,7 +344,7 @@ the command also compiles the combined definition which implements the
339advice. 344advice.
340 345
341@deffn Command ad-activate function &optional compile 346@deffn Command ad-activate function &optional compile
342This command activates the advice for @var{function}. 347This command activates all the advice defined for @var{function}.
343@end deffn 348@end deffn
344 349
345To activate advice for a function whose advice is already active is not 350To activate advice for a function whose advice is already active is not
diff --git a/lispref/anti.texi b/lispref/anti.texi
index d9873088f17..1b9fa426d86 100644
--- a/lispref/anti.texi
+++ b/lispref/anti.texi
@@ -1,248 +1,226 @@
1@c -*-texinfo-*- 1@c -*-texinfo-*-
2@c This is part of the GNU Emacs Lisp Reference Manual. 2@c This is part of the GNU Emacs Lisp Reference Manual.
3@c Copyright (C) 1998 Free Software Foundation, Inc. 3@c Copyright (C) 1999 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@node Antinews, Index, Standard Hooks, Top 5@node Antinews, Index, Standard Hooks, Top
6@appendix Emacs 19 Antinews 6@appendix Emacs 20 Antinews
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 20.4. We hope you will enjoy the greater
10simplicity that results from the absence of many Emacs 20 features. In 10simplicity that results from the absence of many Emacs 21 features. In
11the following section, we carry this information back as far as Emacs 11the following section, we carry this information back to Emacs
1219.29, for which the previous printed edition of this manual was made. 1220.3, for which the previous printed edition of this manual was made.
13 13
14@section Old Lisp Features in Emacs 19 14@section Old Lisp Features in Emacs 20
15
16Here are the most important of the features that you will learn
17to do without in Emacs 19:
18 15
19@itemize @bullet 16@itemize @bullet
20@item 17@item
21In a great simplification, Emacs 19 supports ASCII characters only. 18The @code{push} and @code{pop} macros are not defined.
22There are no multibyte characters, character sets, language
23environments, coding systems, or input methods; all the functions that
24specifically relate to them are gone as well.
25
26Valid character codes for text must be in the range 0 through 255.
27Within this range, there are no invalid character codes.
28 19
29@item 20@item
30The Custom facility has been replaced with a much simpler and more 21You can't display images in buffers. (Emacs is meant for editing text.)
31general method of defining user option variables. Instead of 22With no images, there are no display margins, and no tool bars.
32@code{defcustom}, which requires you to specify each user option's data
33type and classify options into groups, all you have to do is write a
34@code{defvar}. You should still start the documentation string with
35@samp{*}, though.
36@end itemize
37
38Here are changes in the Lisp language itself:
39 23
40@itemize @bullet
41@item 24@item
42Symbols whose names start with @samp{:} are no longer special 25The @code{display} text property has no special meaning; you can use it
43in any way. They start out void, like most other symbols. 26freely in Lisp programs, with no effects except what you implement for
27yourself. With no images, who needs the @code{display} text property?
44 28
45@item 29@item
46The macros @code{when} and @code{unless} have been deleted. 30Faces have fewer attributes. The attributes @code{:family},
31@code{:height}, @code{:width}, @code{:weight}, and @code{:slant},
32have been replaced with a font name, a ``bold'' flag, and an
33``italic'' flag.
47 34
48@item 35The attributes @code{:overline}, @code{:strike-through}
49The functions @code{caar}, @code{cadr}, @code{cdar} and @code{cddr} 36and @code{:box} have been eliminated too.
50no longer exist.
51 37
52@item 38With fewer font attributes, there are no functions
53The function @code{functionp} is now gone. If you don't know 39@code{set-face-attribute} and @code{face-attribute}. Instead, you
54by now whether something is a function, Emacs can't tell you. 40access these attributes using functions such as @code{face-font}, and
55@end itemize 41set them with functions such as @code{set-face-font}. (These functions
42were available in Emacs 21, but are not as useful there.)
56 43
57Here are changes in handling strings and text. 44@item
45There are no facilities for playing sound. This means Emacs will
46respect your peace and quiet, aside from occasional beeps.
58 47
59@itemize @bullet
60@item 48@item
61The function @code{substring} works only on strings, not on vectors. 49Regular expressions do not support the POSIX character classes
50such as @samp{[:alpha:]}. All characters are created equal.
62 51
63@item 52@item
64There are no more character categories. 53Hash tables have been eliminated; use alists instead.
65 54
66@item 55@item
67When you compare strings with @code{equal}, it now compares 56The Lisp printer does not detect and report circular structure. That is
68their string properties as well as their text. All must match, 57ok, because the Lisp reader cannot recreate circular structure anyway.
69or the strings are not equal. 58However, there is a library @samp{cust-print.el} which can report
59circular structure.
70 60
71@item 61@item
72@code{format-time-string} no longer supports specified field width 62Emacs provides its own implementation of scroll bars, instead
73or specified padding. 63of using those of the X toolkit. They always use the frame foreground
64and background colors, so you cannot specify different colors for
65the scroll bars.
74 66
75@item 67@item
76The functions @code{split-string} and @code{string} no longer exist. 68For simplicity, all ASCII characters now have the same height and width.
77Neither does @code{store-substring} or @code{sref}. 69(Certain characters, such as Chinese characters, always have have twice
70the standard width.) All characters are created equal.
78 71
79@item 72@item
80All printing characters have the same width. Therefore, we have deleted 73Tooltips operate using ordinary Emacs frames.
81@code{char-width}, @code{string-width} and
82@code{truncate-string-to-width}.
83 74
84@item 75@item
85We have eliminated the functions @code{next-char-property-change} and 76Areas of the mode line are not mouse-sensitive; however, some mouse
86@code{previous-char-property-change} also. 77commands are available for the mode line as a whole.
87 78
88@item 79@item
89Syntax parsing now determines the syntax of each character from the 80Windows cannot have header lines. Conversely, there is no way to turn
90syntax table alone---not from text properties. This makes the syntax 81off the mode line of a window unless it is a minibuffer.
91codes @samp{|} and @samp{!}, which were meant for use with text
92properties, useless; so we have deleted them.
93 82
94@item 83@item
95In the function @code{parse-partial-sexp}, passing @code{syntax-table} 84Plain dashes are the only separators you can use in a menu.
96as the sixth argument @var{commentstop} no longer has any special meaning.
97And the return value has only eight elements.
98@end itemize
99 85
100Here are changes in other areas of Emacs Lisp: 86@item
87Vertical fractional scrolling does not exist.
101 88
102@itemize @bullet
103@item 89@item
104The macros @code{save-current-buffer}, @code{with-current-buffer}, 90The functions @code{format} and @code{message} ignore and discard text
105@code{with-temp-buffer}, @code{with-temp-file}, @code{save-selected-window}, 91properties.
106and @code{with-output-to-string} are gone.
107 92
108@item 93@item
109The easy-mmode facility for defining minor modes is gone too. 94Colors are supported only on window systems, not on text-only terminals.
95So the support functions for colors on text-only terminals are
96not needed.
110 97
111@item 98@item
112Process filters and sentinels must explicitly save the match data, with 99The functions @code{color-values}, @code{color-defined-p} and
113@code{save-match-data}, or they will clobber the match data and 100@code{defined-colors} have been renamed to @code{x-color-values},
114something horrible will happen. 101@code{x-color-defined-p} and @code{x-defined-colors}.
115 102
116@item 103@item
117As part of our effort to loosen up, @code{batch-byte-compile-file} no 104Windows cannot be made fixed-width or fixed-height;
118longer returns a nonzero status code if there is a compilation error. 105Emacs will adjust the size of all windows when it needs to.
119 106
120@item 107@item
121The ``mail user agent'' feature is gone. 108The minibuffer prompt does not actually appear in content of the
109minibuffer; it is displayed specially in the minibuffer window.
122 110
123@item 111@item
124We have removed the functions @code{add-to-invisibility-spec} and 112The ``exclusive open'' feature of @code{write-region}
125@code{remove-from-invisibility-spec}, so you should manipulate 113has been eliminated; any non-@code{nil} value for the seventh
126the value of @code{buffer-invisibility-spec} by hand. 114argument now means to ask the user for confirmation.
127 115
128@item 116@item
129The functions @code{face-documentation}, @code{face-bold-p}, 117The function @code{buffer-size} always reports on the
130@code{face-italic-p}, @code{set-face-bold-p}, @code{set-face-italic-p} 118current buffer.
131are gone. Instead, use @code{make-face-bold} and friends.
132 119
133@item 120@item
134All the functions that operate on a file now discard an extra redundant 121The function @code{assoc-delete-all} has itself been deleted.
135directory name from the beginning of the file name---just like 122So there!
136@code{substitute-in-file-name}.
137 123
138@item 124@item
139We have got rid of the function @code{access-file}. 125The variable @code{small-temporary-file-directory} has no special
126meaning. There's only one variable for specifying which directory to
127use for temporary files, @code{temporary-file-directory}, but not all
128Emacs features use it anyway. Some use the @code{TMP} environment
129variable, and some use the @code{TMPDIR} environment variable.
140 130
141@item 131@item
142Most of the minibuffer input functions no longer take a default value as 132The variable @code{inhibit-modification-hooks}
143an argument. Also, they do not discard text properties from the result. 133has no special meaning.
144This means that if you insert text with text properties into the minibuffer,
145the minibuffer value really will contain text properties.
146 134
147@item 135@item
148Only the simple menu item format is supported (@pxref{Simple Menu Items}). 136The hook @code{fontification-functions} has been eliminated,
137but there are other hooks, such as @code{window-scroll-functions},
138that you can use to do a similar job.
149 139
150@item 140@item
151You can still bind @code{x-resource-class} around a call to 141The variable @code{redisplay-dont-pause}
152@code{x-get-resource}, but it won't do anything special. 142has no special meaning.
153 143
154@item 144@item
155Wave goodbye to the hooks @code{before-make-frame-hook}, 145The hook @code{calendar-move-hook} has been deleted.
156@code{after-make-frame-functions}, and
157@code{window-configuration-change-hook},
158 146
159@item 147@item
160The functions and variables that deal with MS Windows NT/95 148The function @code{move-to-column} treats any non-@code{nil}
161have been renamed to start with @samp{win32-} instead of @samp{w32-}. 149second argument just like @code{t}.
162This is because we admire Microsoft more each day as we go back
163into the past.
164@end itemize 150@end itemize
165 151
166@section Onward into the Past! 152@section Old Lisp Features in Emacs 20.3
167 153
168Here we go even further back, as far as Emacs 19.29, for which the 154Here are the most important of the features that you will learn
169previous printed edition of the Emacs Lisp manual was made. 155to do without in Emacs 20.3:
170 156
171@itemize @bullet 157Here are changes in the Lisp language itself:
172@item
173There are no char-tables or bool-vectors. Syntax tables, display
174tables, and case tables are all vectors now, and the value of
175@code{keyboard-translate-table} should be a vector or a string.
176 158
159@itemize @bullet
177@item 160@item
178There is only one kind of marker. When you insert text at the place 161The functions @code{line-beginning-position} and @code{line-end-position}
179where a marker points, the marker always ends up before that text, 162have been eliminated.
180unless you use @code{insert-before-markers}, which puts all the markers
181after the inserted text.
182 163
183@item 164@item
184There is no function @code{overlays-in}. 165The functions @code{directory-files-and-attributes},
166@code{file-attributes-lessp}, and @code{file-expand-wildcards}, have
167been eliminated.
185 168
186@item 169@item
187The variable @code{print-length} applies only to lists, not to 170The functions @code{decode-coding-region} and @code{encode-coding-region}
188vectors or strings. 171leave text properties untouched, in case that is useful. (It rarely makes
172any sense, though.)
189 173
190@item 174@item
191The function @code{convert-standard-filename} no longer exists, so each 175The functions @code{position-bytes} and @code{byte-to-position} have
192Lisp package must independently figure out which file names to use for 176been eliminated.
193its initialization files on each kind of operating system.
194 177
195@item 178@item
196The macro @code{with-timeout} has been eliminated, along with the 179Temporary buffers made with @code{with-output-to-temp-buffer} are now
197function @code{y-or-n-p-with-timeout}. Idle timers don't exist at all; 180modifiable by default, and use Fundamental mode rather than Help mode.
198instead, maybe you can use @code{post-command-idle-hook} to do some of
199the same job.
200 181
201@item 182@item
202The functions @code{keymap-parent} and @code{set-keymap-parent} are 183The functions @code{sref} interprets its @var{index} argument as a
203gone. We expect keymaps to recognize their own parents. 184number of bytes, not a number of characters. And the function
185@code{char-bytes} actually tries to report on the number of bytes that a
186character occupies.
204 187
205@item 188@item
206When you delete text and then undo a deletion, markers that were 189The function @code{process-running-child-p} has been eliminated.
207originally inside the deleted text end up either at the beginning
208or the end of it---not back in their original places.
209 190
210@item 191@item
211The interactive specification @samp{N} is gone now. 192The function @code{interrupt-process} and similar functions no longer do
193anything special when the second argument is @code{lambda}.
212 194
213@item 195@item
214There is no more @code{safe-length}. Don't try to be so safe! Did you 196The function @code{define-prefix-command} accepts only two arguments.
215expect to live forever?
216 197
217@item 198@item
218We got rid of @code{insert-file-contents-literally}, because 199The meaning of the second argument to @code{read-char},
219programmers are too literal-minded anyway. 200@code{read-event}, and @code{read-char-exclusive} has been reversed:
201they use the current input method if the argument is if @code{nil}.
220 202
221@item 203@item
222As part of our continuing effort to help Lisp programmers to relax, we 204The function @code{with-temp-message} has been eliminated.
223threw out the function @code{error-message-string}. Don't worry so much
224about errors! We all make mistakes.
225 205
226@item 206@item
227The keymap @code{special-event-map} is gone, because Emacs has no more 207The function @code{clear-this-command-keys} has been eliminated.
228special events. If you want to hold a party in Emacs, please let us
229know.
230 208
231@item 209@item
232You can't do date arithmetic with @code{encode-time} any more. 210The functions @code{gap-position} and @code{gap-size} have been eliminated.
233 211
234@item 212@item
235The functions @code{command-execute} and @code{call-interactively} no 213In @code{modify-face}, an argument of @code{(nil)} has no special
236longer accept the optional argument @var{keys}. 214meaning.
237 215
238@item 216@item
239@code{get-buffer-window-list} is gone as well. 217The base64 conversion functions have been eliminated.
240 218
241@item 219@item
242With the function @code{replace-match}, you can only replace the whole 220Wildcard support has been eliminated from @code{find-file}
243match, not a subexpression of it. 221and allied functions.
244 222
245@item 223@item
246We eliminated the hooks @code{buffer-access-fontify-functions}, 224@code{file-attributes} returns the file size and the file inode number
247@code{window-scroll-functions}, and @code{redisplay-end-trigger-functions}. 225only as a simple integer.
248@end itemize 226@end itemize
diff --git a/lispref/backups.texi b/lispref/backups.texi
index f81caa58649..3ff74a50bb1 100644
--- a/lispref/backups.texi
+++ b/lispref/backups.texi
@@ -179,6 +179,19 @@ This variable is significant only if @code{backup-by-copying} is
179non-@code{nil}. 179non-@code{nil}.
180@end defvar 180@end defvar
181 181
182@defvar backup-by-copying-when-privileged-mismatch
183This variable, if non-@code{nil}, specifies the same behavior as
184@code{backup-by-copying-when-mismatch}, but only for certain user-id
185values: namely, those less than or equal to a certain number. You set
186this variable to that number.
187
188Thus, if you set @code{backup-by-copying-when-privileged-mismatch}
189to 0, backup by copying is done for the superuser only,
190when necessary to prevent a change in the owner of the file.
191
192The default is 200.
193@end defvar
194
182@node Numbered Backups 195@node Numbered Backups
183@subsection Making and Deleting Numbered Backup Files 196@subsection Making and Deleting Numbered Backup Files
184 197
@@ -393,8 +406,8 @@ integer. Otherwise, it turns auto-saving off.
393 406
394@defun auto-save-file-name-p filename 407@defun auto-save-file-name-p filename
395This function returns a non-@code{nil} value if @var{filename} is a 408This function returns a non-@code{nil} value if @var{filename} is a
396string that could be the name of an auto-save file. It works based on 409string that could be the name of an auto-save file. It assumes
397knowledge of the naming convention for auto-save files: a name that 410the usual naming convention for auto-save files: a name that
398begins and ends with hash marks (@samp{#}) is a possible auto-save file 411begins and ends with hash marks (@samp{#}) is a possible auto-save file
399name. The argument @var{filename} should not contain a directory part. 412name. The argument @var{filename} should not contain a directory part.
400 413
@@ -433,8 +446,8 @@ correspondingly.
433This function returns the file name to use for auto-saving the current 446This function returns the file name to use for auto-saving the current
434buffer. This is just the file name with hash marks (@samp{#}) prepended 447buffer. This is just the file name with hash marks (@samp{#}) prepended
435and appended to it. This function does not look at the variable 448and appended to it. This function does not look at the variable
436@code{auto-save-visited-file-name} (described below); you should check 449@code{auto-save-visited-file-name} (described below); callers of this
437that before calling this function. 450function should check that variable first.
438 451
439@example 452@example
440@group 453@group
@@ -475,10 +488,11 @@ file that you are editing. Normally, this variable is @code{nil}, so
475auto-save files have distinct names that are created by 488auto-save files have distinct names that are created by
476@code{make-auto-save-file-name}. 489@code{make-auto-save-file-name}.
477 490
478When you change the value of this variable, the value does not take 491When you change the value of this variable, the new value does not take
479effect until the next time auto-save mode is reenabled in any given 492effect in an existing buffer until the next time auto-save mode is
480buffer. If auto-save mode is already enabled, auto-saves continue to go 493reenabled in it. If auto-save mode is already enabled, auto-saves
481in the same file name until @code{auto-save-mode} is called again. 494continue to go in the same file name until @code{auto-save-mode} is
495called again.
482@end defvar 496@end defvar
483 497
484@defun recent-auto-save-p 498@defun recent-auto-save-p
@@ -493,18 +507,18 @@ function returns @code{nil}.
493@end defun 507@end defun
494 508
495@defopt auto-save-interval 509@defopt auto-save-interval
496The value of this variable is the number of characters that Emacs 510The value of this variable specifies how often to do auto-saving, in
497reads from the keyboard between auto-saves. Each time this many more 511terms of number of input events. Each time this many additional input
498characters are read, auto-saving is done for all buffers in which it is 512events are read, Emacs does auto-saving for all buffers in which that is
499enabled. 513enabled.
500@end defopt 514@end defopt
501 515
502@defopt auto-save-timeout 516@defopt auto-save-timeout
503The value of this variable is the number of seconds of idle time that 517The value of this variable is the number of seconds of idle time that
504should cause auto-saving. Each time the user pauses for this long, 518should cause auto-saving. Each time the user pauses for this long,
505Emacs auto-saves any buffers that need it. (Actually, the specified 519Emacs does auto-saving for all buffers in which that is enabled.
506timeout is multiplied by a factor depending on the size of the current 520(Actually, the specified timeout is multiplied by a factor depending on
507buffer.) 521the size of the current buffer.)
508@end defopt 522@end defopt
509 523
510@defvar auto-save-hook 524@defvar auto-save-hook
@@ -552,14 +566,15 @@ nothing.
552 566
553@defvar buffer-saved-size 567@defvar buffer-saved-size
554The value of this buffer-local variable is the length of the current 568The value of this buffer-local variable is the length of the current
555buffer as of the last time it was read in, saved, or auto-saved. This is 569buffer, when it was last read in, saved, or auto-saved. This is
556used to detect a substantial decrease in size, and turn off auto-saving 570used to detect a substantial decrease in size, and turn off auto-saving
557in response. 571in response.
558 572
559If it is @minus{}1, that means auto-saving is temporarily shut off in this 573If it is @minus{}1, that means auto-saving is temporarily shut off in
560buffer due to a substantial deletion. Explicitly saving the buffer 574this buffer due to a substantial decrease in size. Explicitly saving
561stores a positive value in this variable, thus reenabling auto-saving. 575the buffer stores a positive value in this variable, thus reenabling
562Turning auto-save mode off or on also alters this variable. 576auto-saving. Turning auto-save mode off or on also updates this
577variable, so that the substantial decrease in size is forgotten.
563@end defvar 578@end defvar
564 579
565@defvar auto-save-list-file-name 580@defvar auto-save-list-file-name
@@ -570,14 +585,14 @@ enabled. The first line gives the name of the visited file (it's empty
570if the buffer has none), and the second gives the name of the auto-save 585if the buffer has none), and the second gives the name of the auto-save
571file. 586file.
572 587
573If Emacs exits normally, it deletes this file. If Emacs crashes, you 588When Emacs exits normally, it deletes this file; if Emacs crashes, you
574can look in the file to find all the auto-save files that might contain 589can look in the file to find all the auto-save files that might contain
575work that was otherwise lost. The @code{recover-session} command uses 590work that was otherwise lost. The @code{recover-session} command uses
576these files. 591this file to find them.
577 592
578The default name for this file is in your home directory and starts with 593The default name for this file specifies your home directory and starts
579@samp{.saves-}. It also contains the Emacs process @sc{id} and the host 594with @samp{.saves-}. It also contains the Emacs process @sc{id} and the
580name. 595host name.
581@end defvar 596@end defvar
582 597
583@node Reverting 598@node Reverting
@@ -594,10 +609,10 @@ file on disk. This action undoes all changes since the file was visited
594or saved. 609or saved.
595 610
596By default, if the latest auto-save file is more recent than the visited 611By default, if the latest auto-save file is more recent than the visited
597file, @code{revert-buffer} asks the user whether to use that instead. 612file, and the argument @var{ignore-auto} is non-@code{nil},
598But if the argument @var{ignore-auto} is non-@code{nil}, then only the 613@code{revert-buffer} asks the user whether to use that auto-save
599the visited file itself is used. Interactively, @var{ignore-auto} is 614instead. When you invoke this command interactively, @var{ignore-auto}
600@code{t} unless there is a numeric prefix argument; thus, the 615is @code{t} unless there is a numeric prefix argument; thus, the
601interactive default is to check the auto-save file. 616interactive default is to check the auto-save file.
602 617
603Normally, @code{revert-buffer} asks for confirmation before it changes 618Normally, @code{revert-buffer} asks for confirmation before it changes
@@ -608,9 +623,9 @@ Reverting tries to preserve marker positions in the buffer by using the
608replacement feature of @code{insert-file-contents}. If the buffer 623replacement feature of @code{insert-file-contents}. If the buffer
609contents and the file contents are identical before the revert 624contents and the file contents are identical before the revert
610operation, reverting preserves all the markers. If they are not 625operation, reverting preserves all the markers. If they are not
611identical, reverting does change the buffer; then it preserves the 626identical, reverting does change the buffer; in that case, it preserves
612markers in the unchanged text (if any) at the beginning and end of the 627the markers in the unchanged text (if any) at the beginning and end of
613buffer. Preserving any additional markers would be problematical. 628the buffer. Preserving any additional markers would be problematical.
614@end deffn 629@end deffn
615 630
616You can customize how @code{revert-buffer} does its work by setting 631You can customize how @code{revert-buffer} does its work by setting
@@ -618,10 +633,10 @@ these variables---typically, as buffer-local variables.
618 633
619@defvar revert-without-query 634@defvar revert-without-query
620This variable holds a list of files that should be reverted without 635This variable holds a list of files that should be reverted without
621query. The value is a list of regular expressions. If a file name 636query. The value is a list of regular expressions. If the visited file
622matches one of these regular expressions, then @code{revert-buffer} 637name matches one of these regular expressions, and the file has changed
623reverts the file without asking the user for confirmation, if the file 638on disk but the buffer is not modified, then @code{revert-buffer}
624has changed on disk and the buffer is not modified. 639reverts the file without asking the user for confirmation.
625@end defvar 640@end defvar
626 641
627@defvar revert-buffer-function 642@defvar revert-buffer-function
@@ -637,20 +652,20 @@ regenerate the contents.
637@end defvar 652@end defvar
638 653
639@defvar revert-buffer-insert-file-contents-function 654@defvar revert-buffer-insert-file-contents-function
640The value of this variable, if non-@code{nil}, is the function to use to 655The value of this variable, if non-@code{nil}, specifies the function to use to
641insert the updated contents when reverting this buffer. The function 656insert the updated contents when reverting this buffer. The function
642receives two arguments: first the file name to use; second, @code{t} if 657receives two arguments: first the file name to use; second, @code{t} if
643the user has asked to read the auto-save file. 658the user has asked to read the auto-save file.
644@end defvar 659@end defvar
645 660
646@defvar before-revert-hook 661@defvar before-revert-hook
647This normal hook is run by @code{revert-buffer} before actually 662This normal hook is run by @code{revert-buffer} before
648inserting the modified contents---but only if 663inserting the modified contents---but only if
649@code{revert-buffer-function} is @code{nil}. 664@code{revert-buffer-function} is @code{nil}.
650@end defvar 665@end defvar
651 666
652@defvar after-revert-hook 667@defvar after-revert-hook
653This normal hook is run by @code{revert-buffer} after actually inserting 668This normal hook is run by @code{revert-buffer} after inserting
654the modified contents---but only if @code{revert-buffer-function} is 669the modified contents---but only if @code{revert-buffer-function} is
655@code{nil}. 670@code{nil}.
656@end defvar 671@end defvar
diff --git a/lispref/buffers.texi b/lispref/buffers.texi
index f05d242ef1a..670b147a3b8 100644
--- a/lispref/buffers.texi
+++ b/lispref/buffers.texi
@@ -10,7 +10,7 @@
10 A @dfn{buffer} is a Lisp object containing text to be edited. Buffers 10 A @dfn{buffer} is a Lisp object containing text to be edited. Buffers
11are used to hold the contents of files that are being visited; there may 11are used to hold the contents of files that are being visited; there may
12also be buffers that are not visiting files. While several buffers may 12also be buffers that are not visiting files. While several buffers may
13exist at one time, exactly one buffer is designated the @dfn{current 13exist at one time, only one buffer is designated the @dfn{current
14buffer} at any time. Most editing commands act on the contents of the 14buffer} at any time. Most editing commands act on the contents of the
15current buffer. Each buffer, including the current buffer, may or may 15current buffer. Each buffer, including the current buffer, may or may
16not be displayed in any windows. 16not be displayed in any windows.
@@ -18,7 +18,7 @@ not be displayed in any windows.
18@menu 18@menu
19* Buffer Basics:: What is a buffer? 19* Buffer Basics:: What is a buffer?
20* Current Buffer:: Designating a buffer as current 20* Current Buffer:: Designating a buffer as current
21 so primitives will access its contents. 21 so that primitives will access its contents.
22* Buffer Names:: Accessing and changing buffer names. 22* Buffer Names:: Accessing and changing buffer names.
23* Buffer File Name:: The buffer file name indicates which file is visited. 23* Buffer File Name:: The buffer file name indicates which file is visited.
24* Buffer Modification:: A buffer is @dfn{modified} if it needs to be saved. 24* Buffer Modification:: A buffer is @dfn{modified} if it needs to be saved.
@@ -39,8 +39,8 @@ not be displayed in any windows.
39@ifinfo 39@ifinfo
40 A @dfn{buffer} is a Lisp object containing text to be edited. Buffers 40 A @dfn{buffer} is a Lisp object containing text to be edited. Buffers
41are used to hold the contents of files that are being visited; there may 41are used to hold the contents of files that are being visited; there may
42also be buffers that are not visiting files. While several buffers may 42also be buffers that are not visiting files. Although several buffers
43exist at one time, exactly one buffer is designated the @dfn{current 43normally exist, only one buffer is designated the @dfn{current
44buffer} at any time. Most editing commands act on the contents of the 44buffer} at any time. Most editing commands act on the contents of the
45current buffer. Each buffer, including the current buffer, may or may 45current buffer. Each buffer, including the current buffer, may or may
46not be displayed in any windows. 46not be displayed in any windows.
@@ -103,12 +103,12 @@ current, to prevent confusion: the buffer that the cursor is in when
103Emacs reads a command is the buffer that the command will apply to. 103Emacs reads a command is the buffer that the command will apply to.
104(@xref{Command Loop}.) Therefore, @code{set-buffer} is not the way to 104(@xref{Command Loop}.) Therefore, @code{set-buffer} is not the way to
105switch visibly to a different buffer so that the user can edit it. For 105switch visibly to a different buffer so that the user can edit it. For
106this, you must use the functions described in @ref{Displaying Buffers}. 106that, you must use the functions described in @ref{Displaying Buffers}.
107 107
108 However, Lisp functions that change to a different current buffer 108 @strong{Note:} Lisp functions that change to a different current buffer
109should not depend on the command loop to set it back afterwards. 109should not depend on the command loop to set it back afterwards.
110Editing commands written in Emacs Lisp can be called from other programs 110Editing commands written in Emacs Lisp can be called from other programs
111as well as from the command loop. It is convenient for the caller if 111as well as from the command loop; it is convenient for the caller if
112the subroutine does not change which buffer is current (unless, of 112the subroutine does not change which buffer is current (unless, of
113course, that is the subroutine's purpose). Therefore, you should 113course, that is the subroutine's purpose). Therefore, you should
114normally use @code{set-buffer} within a @code{save-current-buffer} or 114normally use @code{set-buffer} within a @code{save-current-buffer} or
@@ -153,9 +153,9 @@ binding. Otherwise, use @code{save-current-buffer} or
153@code{save-excursion} to make sure that the buffer current at the 153@code{save-excursion} to make sure that the buffer current at the
154beginning is current again whenever the variable is unbound. 154beginning is current again whenever the variable is unbound.
155 155
156 It is not reliable to change the current buffer back with 156 Do not rely on using @code{set-buffer} to change the current buffer
157@code{set-buffer}, because that won't do the job if a quit happens while 157back, because that won't do the job if a quit happens while the wrong
158the wrong buffer is current. Here is what @emph{not} to do: 158buffer is current. Here is what @emph{not} to do:
159 159
160@example 160@example
161@group 161@group
@@ -192,10 +192,9 @@ This function returns the current buffer.
192@end defun 192@end defun
193 193
194@defun set-buffer buffer-or-name 194@defun set-buffer buffer-or-name
195This function makes @var{buffer-or-name} the current buffer. It does 195This function makes @var{buffer-or-name} the current buffer. This does
196not display the buffer in the currently selected window or in any other 196not display the buffer in any window, so the user cannot necessarily see
197window, so the user cannot necessarily see the buffer. But Lisp 197the buffer. But Lisp programs will now operate on it.
198programs can in any case work on it.
199 198
200This function returns the buffer identified by @var{buffer-or-name}. 199This function returns the buffer identified by @var{buffer-or-name}.
201An error is signaled if @var{buffer-or-name} does not identify an 200An error is signaled if @var{buffer-or-name} does not identify an
@@ -302,18 +301,15 @@ Ordinarily, @code{rename-buffer} signals an error if @var{newname} is
302already in use. However, if @var{unique} is non-@code{nil}, it modifies 301already in use. However, if @var{unique} is non-@code{nil}, it modifies
303@var{newname} to make a name that is not in use. Interactively, you can 302@var{newname} to make a name that is not in use. Interactively, you can
304make @var{unique} non-@code{nil} with a numeric prefix argument. 303make @var{unique} non-@code{nil} with a numeric prefix argument.
305 304(This is how the command @code{rename-uniquely} is implemented.)
306One application of this command is to rename the @samp{*shell*} buffer
307to some other name, thus making it possible to create a second shell
308buffer under the name @samp{*shell*}.
309@end deffn 305@end deffn
310 306
311@defun get-buffer buffer-or-name 307@defun get-buffer buffer-or-name
312This function returns the buffer specified by @var{buffer-or-name}. 308This function returns the buffer specified by @var{buffer-or-name}.
313If @var{buffer-or-name} is a string and there is no buffer with that 309If @var{buffer-or-name} is a string and there is no buffer with that
314name, the value is @code{nil}. If @var{buffer-or-name} is a buffer, it 310name, the value is @code{nil}. If @var{buffer-or-name} is a buffer, it
315is returned as given. (That is not very useful, so the argument is usually 311is returned as given; that is not very useful, so the argument is usually
316a name.) For example: 312a name. For example:
317 313
318@example 314@example
319@group 315@group
@@ -374,7 +370,7 @@ supplied, it defaults to the current buffer.
374@defvar buffer-file-name 370@defvar buffer-file-name
375This buffer-local variable contains the name of the file being visited 371This buffer-local variable contains the name of the file being visited
376in the current buffer, or @code{nil} if it is not visiting a file. It 372in the current buffer, or @code{nil} if it is not visiting a file. It
377is a permanent local, unaffected by @code{kill-local-variables}. 373is a permanent local variable, unaffected by @code{kill-local-variables}.
378 374
379@example 375@example
380@group 376@group
@@ -621,7 +617,7 @@ the read-only flag with @kbd{C-x C-q}.
621 617
622@item 618@item
623Modes such as Dired and Rmail make buffers read-only when altering the 619Modes such as Dired and Rmail make buffers read-only when altering the
624contents with the usual editing commands is probably a mistake. 620contents with the usual editing commands would probably be a mistake.
625 621
626The special commands of these modes bind @code{buffer-read-only} to 622The special commands of these modes bind @code{buffer-read-only} to
627@code{nil} (with @code{let}) or bind @code{inhibit-read-only} to 623@code{nil} (with @code{let}) or bind @code{inhibit-read-only} to
@@ -649,7 +645,7 @@ of the list (comparison is done with @code{eq}).
649 645
650@deffn Command toggle-read-only 646@deffn Command toggle-read-only
651This command changes whether the current buffer is read-only. It is 647This command changes whether the current buffer is read-only. It is
652intended for interactive use; don't use it in programs. At any given 648intended for interactive use; do not use it in programs. At any given
653point in a program, you should know whether you want the read-only flag 649point in a program, you should know whether you want the read-only flag
654on or off; so you can set @code{buffer-read-only} explicitly to the 650on or off; so you can set @code{buffer-read-only} explicitly to the
655proper value, @code{t} or @code{nil}. 651proper value, @code{t} or @code{nil}.
@@ -857,8 +853,8 @@ text space available for other use.
857 The buffer object for the buffer that has been killed remains in 853 The buffer object for the buffer that has been killed remains in
858existence as long as anything refers to it, but it is specially marked 854existence as long as anything refers to it, but it is specially marked
859so that you cannot make it current or display it. Killed buffers retain 855so that you cannot make it current or display it. Killed buffers retain
860their identity, however; two distinct buffers, when killed, remain 856their identity, however; if you kill two distinct buffers, they remain
861distinct according to @code{eq}. 857distinct according to @code{eq} although both are dead.
862 858
863 If you kill a buffer that is current or displayed in a window, Emacs 859 If you kill a buffer that is current or displayed in a window, Emacs
864automatically selects or displays some other buffer instead. This means 860automatically selects or displays some other buffer instead. This means
@@ -916,9 +912,9 @@ Buffer foo.changed modified; kill anyway? (yes or no) @kbd{yes}
916After confirming unsaved changes, @code{kill-buffer} calls the functions 912After confirming unsaved changes, @code{kill-buffer} calls the functions
917in the list @code{kill-buffer-query-functions}, in order of appearance, 913in the list @code{kill-buffer-query-functions}, in order of appearance,
918with no arguments. The buffer being killed is the current buffer when 914with no arguments. The buffer being killed is the current buffer when
919they are called. The idea is that these functions ask for confirmation 915they are called. The idea of this feature is that these functions will
920from the user for various nonstandard reasons. If any of them returns 916ask for confirmation from the user. If any of them returns @code{nil},
921@code{nil}, @code{kill-buffer} spares the buffer's life. 917@code{kill-buffer} spares the buffer's life.
922@end defvar 918@end defvar
923 919
924@defvar kill-buffer-hook 920@defvar kill-buffer-hook
@@ -951,7 +947,7 @@ base buffer; changes made by editing either one are visible immediately
951in the other. This includes the text properties as well as the characters 947in the other. This includes the text properties as well as the characters
952themselves. 948themselves.
953 949
954 But in all other respects, the indirect buffer and its base buffer are 950 In all other respects, the indirect buffer and its base buffer are
955completely separate. They have different names, different values of 951completely separate. They have different names, different values of
956point, different narrowing, different markers and overlays (though 952point, different narrowing, different markers and overlays (though
957inserting or deleting text in either buffer relocates the markers and 953inserting or deleting text in either buffer relocates the markers and
@@ -959,8 +955,8 @@ overlays for both), different major modes, and different buffer-local
959variables. 955variables.
960 956
961 An indirect buffer cannot visit a file, but its base buffer can. If 957 An indirect buffer cannot visit a file, but its base buffer can. If
962you try to save the indirect buffer, that actually works by saving the 958you try to save the indirect buffer, that actually saves the base
963base buffer. 959buffer.
964 960
965 Killing an indirect buffer has no effect on its base buffer. Killing 961 Killing an indirect buffer has no effect on its base buffer. Killing
966the base buffer effectively kills the indirect buffer in that it cannot 962the base buffer effectively kills the indirect buffer in that it cannot
diff --git a/lispref/calendar.texi b/lispref/calendar.texi
index ad521822e88..30718d2902c 100644
--- a/lispref/calendar.texi
+++ b/lispref/calendar.texi
@@ -117,6 +117,10 @@ terminal.
117 A similar normal hook, @code{today-invisible-calendar-hook} is run if 117 A similar normal hook, @code{today-invisible-calendar-hook} is run if
118the current date is @emph{not} visible in the window. 118the current date is @emph{not} visible in the window.
119 119
120@vindex calendar-move-hook
121 Starting in Emacs 21, each of the calendar cursor motion commands
122runs the hook @code{calendar-move-hook} after it moves the cursor.
123
120@node Holiday Customizing 124@node Holiday Customizing
121@section Customizing the Holidays 125@section Customizing the Holidays
122 126
@@ -776,7 +780,7 @@ can use
776@noindent 780@noindent
777and the fancy diary will show 781and the fancy diary will show
778@smallexample 782@smallexample
779Ruth & Ed's anniversary 783Ed's anniversary
780@end smallexample 784@end smallexample
781@noindent 785@noindent
782both on December 15 and on December 22. 786both on December 15 and on December 22.
diff --git a/lispref/commands.texi b/lispref/commands.texi
index cf64fc3abb0..f5e4f90f357 100644
--- a/lispref/commands.texi
+++ b/lispref/commands.texi
@@ -322,7 +322,7 @@ You can use @samp{e} more than once in a single command's interactive
322specification. If the key sequence that invoked the command has 322specification. If the key sequence that invoked the command has
323@var{n} events that are lists, the @var{n}th @samp{e} provides the 323@var{n} events that are lists, the @var{n}th @samp{e} provides the
324@var{n}th such event. Events that are not lists, such as function keys 324@var{n}th such event. Events that are not lists, such as function keys
325and @sc{ASCII} characters, do not count where @samp{e} is concerned. 325and @sc{ascii} characters, do not count where @samp{e} is concerned.
326 326
327@item f 327@item f
328A file name of an existing file (@pxref{File Names}). The default 328A file name of an existing file (@pxref{File Names}). The default
@@ -760,7 +760,7 @@ last-command-event
760@end example 760@end example
761 761
762@noindent 762@noindent
763The value is 5 because that is the @sc{ASCII} code for @kbd{C-e}. 763The value is 5 because that is the @sc{ascii} code for @kbd{C-e}.
764 764
765The alias @code{last-command-char} exists for compatibility with 765The alias @code{last-command-char} exists for compatibility with
766Emacs version 18. 766Emacs version 18.
@@ -834,7 +834,7 @@ An input character event consists of a @dfn{basic code} between 0 and
834@item meta 834@item meta
835The 835The
836@tex 836@tex
837$2^{27}$ 837@math{2^{27}}
838@end tex 838@end tex
839@ifinfo 839@ifinfo
8402**27 8402**27
@@ -845,57 +845,57 @@ typed with the meta key held down.
845@item control 845@item control
846The 846The
847@tex 847@tex
848$2^{26}$ 848@math{2^{26}}
849@end tex 849@end tex
850@ifinfo 850@ifinfo
8512**26 8512**26
852@end ifinfo 852@end ifinfo
853bit in the character code indicates a non-@sc{ASCII} 853bit in the character code indicates a non-@sc{ascii}
854control character. 854control character.
855 855
856@sc{ASCII} control characters such as @kbd{C-a} have special basic 856@sc{ascii} control characters such as @kbd{C-a} have special basic
857codes of their own, so Emacs needs no special bit to indicate them. 857codes of their own, so Emacs needs no special bit to indicate them.
858Thus, the code for @kbd{C-a} is just 1. 858Thus, the code for @kbd{C-a} is just 1.
859 859
860But if you type a control combination not in @sc{ASCII}, such as 860But if you type a control combination not in @sc{ascii}, such as
861@kbd{%} with the control key, the numeric value you get is the code 861@kbd{%} with the control key, the numeric value you get is the code
862for @kbd{%} plus 862for @kbd{%} plus
863@tex 863@tex
864$2^{26}$ 864@math{2^{26}}
865@end tex 865@end tex
866@ifinfo 866@ifinfo
8672**26 8672**26
868@end ifinfo 868@end ifinfo
869(assuming the terminal supports non-@sc{ASCII} 869(assuming the terminal supports non-@sc{ascii}
870control characters). 870control characters).
871 871
872@item shift 872@item shift
873The 873The
874@tex 874@tex
875$2^{25}$ 875@math{2^{25}}
876@end tex 876@end tex
877@ifinfo 877@ifinfo
8782**25 8782**25
879@end ifinfo 879@end ifinfo
880bit in the character code indicates an @sc{ASCII} control 880bit in the character code indicates an @sc{ascii} control
881character typed with the shift key held down. 881character typed with the shift key held down.
882 882
883For letters, the basic code itself indicates upper versus lower case; 883For letters, the basic code itself indicates upper versus lower case;
884for digits and punctuation, the shift key selects an entirely different 884for digits and punctuation, the shift key selects an entirely different
885character with a different basic code. In order to keep within the 885character with a different basic code. In order to keep within the
886@sc{ASCII} character set whenever possible, Emacs avoids using the 886@sc{ascii} character set whenever possible, Emacs avoids using the
887@tex 887@tex
888$2^{25}$ 888@math{2^{25}}
889@end tex 889@end tex
890@ifinfo 890@ifinfo
8912**25 8912**25
892@end ifinfo 892@end ifinfo
893bit for those characters. 893bit for those characters.
894 894
895However, @sc{ASCII} provides no way to distinguish @kbd{C-A} from 895However, @sc{ascii} provides no way to distinguish @kbd{C-A} from
896@kbd{C-a}, so Emacs uses the 896@kbd{C-a}, so Emacs uses the
897@tex 897@tex
898$2^{25}$ 898@math{2^{25}}
899@end tex 899@end tex
900@ifinfo 900@ifinfo
9012**25 9012**25
@@ -906,7 +906,7 @@ bit in @kbd{C-A} and not in
906@item hyper 906@item hyper
907The 907The
908@tex 908@tex
909$2^{24}$ 909@math{2^{24}}
910@end tex 910@end tex
911@ifinfo 911@ifinfo
9122**24 9122**24
@@ -917,7 +917,7 @@ typed with the hyper key held down.
917@item super 917@item super
918The 918The
919@tex 919@tex
920$2^{23}$ 920@math{2^{23}}
921@end tex 921@end tex
922@ifinfo 922@ifinfo
9232**23 9232**23
@@ -928,7 +928,7 @@ typed with the super key held down.
928@item alt 928@item alt
929The 929The
930@tex 930@tex
931$2^{22}$ 931@math{2^{22}}
932@end tex 932@end tex
933@ifinfo 933@ifinfo
9342**22 9342**22
@@ -966,10 +966,10 @@ function keys:
966 966
967@table @asis 967@table @asis
968@item @code{backspace}, @code{tab}, @code{newline}, @code{return}, @code{delete} 968@item @code{backspace}, @code{tab}, @code{newline}, @code{return}, @code{delete}
969These keys correspond to common @sc{ASCII} control characters that have 969These keys correspond to common @sc{ascii} control characters that have
970special keys on most keyboards. 970special keys on most keyboards.
971 971
972In @sc{ASCII}, @kbd{C-i} and @key{TAB} are the same character. If the 972In @sc{ascii}, @kbd{C-i} and @key{TAB} are the same character. If the
973terminal can distinguish between them, Emacs conveys the distinction to 973terminal can distinguish between them, Emacs conveys the distinction to
974Lisp programs by representing the former as the integer 9, and the 974Lisp programs by representing the former as the integer 9, and the
975latter as the symbol @code{tab}. 975latter as the symbol @code{tab}.
@@ -981,7 +981,7 @@ character @kbd{C-i}) also applies to @code{tab}. Likewise for the other
981symbols in this group. The function @code{read-char} likewise converts 981symbols in this group. The function @code{read-char} likewise converts
982these events into characters. 982these events into characters.
983 983
984In @sc{ASCII}, @key{BS} is really @kbd{C-h}. But @code{backspace} 984In @sc{ascii}, @key{BS} is really @kbd{C-h}. But @code{backspace}
985converts into the character code 127 (@key{DEL}), not into code 8 985converts into the character code 127 (@key{DEL}), not into code 8
986(@key{BS}). This is what most users prefer. 986(@key{BS}). This is what most users prefer.
987 987
@@ -1657,7 +1657,7 @@ additional modifier bits, we had to change the representation of meta
1657characters. Now the flag that represents the Meta modifier in a 1657characters. Now the flag that represents the Meta modifier in a
1658character is 1658character is
1659@tex 1659@tex
1660$2^{27}$ 1660@math{2^{27}}
1661@end tex 1661@end tex
1662@ifinfo 1662@ifinfo
16632**27 16632**27
@@ -1677,14 +1677,14 @@ in the string unchanged.
1677@item 1677@item
1678The meta variants of those characters, with codes in the range of 1678The meta variants of those characters, with codes in the range of
1679@tex 1679@tex
1680$2^{27}$ 1680@math{2^{27}}
1681@end tex 1681@end tex
1682@ifinfo 1682@ifinfo
16832**27 16832**27
1684@end ifinfo 1684@end ifinfo
1685to 1685to
1686@tex 1686@tex
1687$2^{27} + 127$, 1687@math{2^{27} + 127},
1688@end tex 1688@end tex
1689@ifinfo 1689@ifinfo
16902**27+127, 16902**27+127,
@@ -1692,14 +1692,14 @@ $2^{27} + 127$,
1692can also go in the string, but you must change their 1692can also go in the string, but you must change their
1693numeric values. You must set the 1693numeric values. You must set the
1694@tex 1694@tex
1695$2^{7}$ 1695@math{2^{7}}
1696@end tex 1696@end tex
1697@ifinfo 1697@ifinfo
16982**7 16982**7
1699@end ifinfo 1699@end ifinfo
1700bit instead of the 1700bit instead of the
1701@tex 1701@tex
1702$2^{27}$ 1702@math{2^{27}}
1703@end tex 1703@end tex
1704@ifinfo 1704@ifinfo
17052**27 17052**27
@@ -1708,7 +1708,7 @@ bit, resulting in a value between 128 and 255. Only a unibyte string
1708can include these codes. 1708can include these codes.
1709 1709
1710@item 1710@item
1711Non-@sc{ASCII} characters above 256 can be included in a multibyte string. 1711Non-@sc{ascii} characters above 256 can be included in a multibyte string.
1712 1712
1713@item 1713@item
1714Other keyboard character events cannot fit in a string. This includes 1714Other keyboard character events cannot fit in a string. This includes
@@ -1869,7 +1869,7 @@ Echo Area}.
1869 1869
1870If @var{inherit-input-method} is non-@code{nil}, then the current input 1870If @var{inherit-input-method} is non-@code{nil}, then the current input
1871method (if any) is employed to make it possible to enter a 1871method (if any) is employed to make it possible to enter a
1872non-@sc{ASCII} character. Otherwise, input method handling is disabled 1872non-@sc{ascii} character. Otherwise, input method handling is disabled
1873for reading this event. 1873for reading this event.
1874 1874
1875If @code{cursor-in-echo-area} is non-@code{nil}, then @code{read-event} 1875If @code{cursor-in-echo-area} is non-@code{nil}, then @code{read-event}
@@ -1899,7 +1899,7 @@ user generates an event which is not a character (i.e. a mouse click or
1899function key event), @code{read-char} signals an error. The arguments 1899function key event), @code{read-char} signals an error. The arguments
1900work as in @code{read-event}. 1900work as in @code{read-event}.
1901 1901
1902In the first example, the user types the character @kbd{1} (@sc{ASCII} 1902In the first example, the user types the character @kbd{1} (@sc{ascii}
1903code 49). The second example shows a keyboard macro definition that 1903code 49). The second example shows a keyboard macro definition that
1904calls @code{read-char} from the minibuffer using @code{eval-expression}. 1904calls @code{read-char} from the minibuffer using @code{eval-expression}.
1905@code{read-char} reads the keyboard macro's very next character, which 1905@code{read-char} reads the keyboard macro's very next character, which
@@ -2078,7 +2078,7 @@ This variable records the last terminal input event read, whether
2078as part of a command or explicitly by a Lisp program. 2078as part of a command or explicitly by a Lisp program.
2079 2079
2080In the example below, the Lisp program reads the character @kbd{1}, 2080In the example below, the Lisp program reads the character @kbd{1},
2081@sc{ASCII} code 49. It becomes the value of @code{last-input-event}, 2081@sc{ascii} code 49. It becomes the value of @code{last-input-event},
2082while @kbd{C-e} (we assume @kbd{C-x C-e} command is used to evaluate 2082while @kbd{C-e} (we assume @kbd{C-x C-e} command is used to evaluate
2083this expression) remains the value of @code{last-command-event}. 2083this expression) remains the value of @code{last-command-event}.
2084 2084
@@ -2171,12 +2171,8 @@ period measured in milliseconds. This adds to the period specified by
2171@var{seconds}. If the system doesn't support waiting fractions of a 2171@var{seconds}. If the system doesn't support waiting fractions of a
2172second, you get an error if you specify nonzero @var{millisec}. 2172second, you get an error if you specify nonzero @var{millisec}.
2173 2173
2174@cindex forcing redisplay 2174The expression @code{(sit-for 0)} is a convenient way to request a
2175Redisplay is always preempted if input arrives, and does not happen at 2175redisplay, without any delay. @xref{Forcing Redisplay}.
2176all if input is available before it starts. Thus, there is no way to
2177force screen updating if there is pending input; however, if there is no
2178input pending, you can force an update with no delay by using
2179@code{(sit-for 0)}.
2180 2176
2181If @var{nodisp} is non-@code{nil}, then @code{sit-for} does not 2177If @var{nodisp} is non-@code{nil}, then @code{sit-for} does not
2182redisplay, but it still returns as soon as input is available (or when 2178redisplay, but it still returns as soon as input is available (or when
diff --git a/lispref/control.texi b/lispref/control.texi
index 2925201285b..1d79fc83316 100644
--- a/lispref/control.texi
+++ b/lispref/control.texi
@@ -20,8 +20,8 @@ write several forms in succession in the body of a function, or at top
20level in a file of Lisp code---the forms are executed in the order 20level in a file of Lisp code---the forms are executed in the order
21written. We call this @dfn{textual order}. For example, if a function 21written. We call this @dfn{textual order}. For example, if a function
22body consists of two forms @var{a} and @var{b}, evaluation of the 22body consists of two forms @var{a} and @var{b}, evaluation of the
23function evaluates first @var{a} and then @var{b}, and the function's 23function evaluates first @var{a} and then @var{b}. The result of
24value is the value of @var{b}. 24evaluating @var{b} becomes the value of the function.
25 25
26 Explicit control structures make possible an order of execution other 26 Explicit control structures make possible an order of execution other
27than sequential. 27than sequential.
@@ -60,9 +60,9 @@ control construct of Lisp.
60 60
61@noindent 61@noindent
62and it says to execute the forms @var{a}, @var{b}, @var{c}, and so on, in 62and it says to execute the forms @var{a}, @var{b}, @var{c}, and so on, in
63that order. These forms are called the body of the @code{progn} form. 63that order. These forms are called the @dfn{body} of the @code{progn} form.
64The value of the last form in the body becomes the value of the entire 64The value of the last form in the body becomes the value of the entire
65@code{progn}. 65@code{progn}. @code{(progn)} returns @code{nil}.
66 66
67@cindex implicit @code{progn} 67@cindex implicit @code{progn}
68 In the early days of Lisp, @code{progn} was the only way to execute 68 In the early days of Lisp, @code{progn} was the only way to execute
@@ -72,8 +72,8 @@ body of a function, where (at that time) only one form was allowed. So
72the body of a function was made into an ``implicit @code{progn}'': 72the body of a function was made into an ``implicit @code{progn}'':
73several forms are allowed just as in the body of an actual @code{progn}. 73several forms are allowed just as in the body of an actual @code{progn}.
74Many other control structures likewise contain an implicit @code{progn}. 74Many other control structures likewise contain an implicit @code{progn}.
75As a result, @code{progn} is not used as often as it used to be. It is 75As a result, @code{progn} is not used as much as it was many years ago.
76needed now most often inside an @code{unwind-protect}, @code{and}, 76It is needed now most often inside an @code{unwind-protect}, @code{and},
77@code{or}, or in the @var{then}-part of an @code{if}. 77@code{or}, or in the @var{then}-part of an @code{if}.
78 78
79@defspec progn forms@dots{} 79@defspec progn forms@dots{}
@@ -265,6 +265,7 @@ For example,
265 265
266@example 266@example
267@group 267@group
268(setq a 5)
268(cond ((eq a 'hack) 'foo) 269(cond ((eq a 'hack) 'foo)
269 (t "default")) 270 (t "default"))
270@result{} "default" 271@result{} "default"
@@ -272,8 +273,8 @@ For example,
272@end example 273@end example
273 274
274@noindent 275@noindent
275This expression is a @code{cond} which returns @code{foo} if the value 276This @code{cond} expression returns @code{foo} if the value of @code{a}
276of @code{a} is @code{hack}, and returns the string @code{"default"} otherwise. 277is @code{hack}, and returns the string @code{"default"} otherwise.
277@end defspec 278@end defspec
278 279
279Any conditional construct can be expressed with @code{cond} or with 280Any conditional construct can be expressed with @code{cond} or with
@@ -310,11 +311,14 @@ order written.
310 311
311If any of the @var{conditions} evaluates to @code{nil}, then the result 312If any of the @var{conditions} evaluates to @code{nil}, then the result
312of the @code{and} must be @code{nil} regardless of the remaining 313of the @code{and} must be @code{nil} regardless of the remaining
313@var{conditions}; so @code{and} returns right away, ignoring the 314@var{conditions}; so @code{and} returns @code{nil} right away, ignoring
314remaining @var{conditions}. 315the remaining @var{conditions}.
315 316
316If all the @var{conditions} turn out non-@code{nil}, then the value of 317If all the @var{conditions} turn out non-@code{nil}, then the value of
317the last of them becomes the value of the @code{and} form. 318the last of them becomes the value of the @code{and} form. Just
319@code{(and)}, with no @var{conditions}, returns @code{t}, appropriate
320because all the @var{conditions} turned out non-@code{nil}. (Think
321about it; which one did not?)
318 322
319Here is an example. The first condition returns the integer 1, which is 323Here is an example. The first condition returns the integer 1, which is
320not @code{nil}. Similarly, the second condition returns the integer 2, 324not @code{nil}. Similarly, the second condition returns the integer 2,
@@ -368,10 +372,13 @@ right away, ignoring the remaining @var{conditions}. The value it
368returns is the non-@code{nil} value of the condition just evaluated. 372returns is the non-@code{nil} value of the condition just evaluated.
369 373
370If all the @var{conditions} turn out @code{nil}, then the @code{or} 374If all the @var{conditions} turn out @code{nil}, then the @code{or}
371expression returns @code{nil}. 375expression returns @code{nil}. Just @code{(or)}, with no
376@var{conditions}, returns @code{nil}, appropriate because all the
377@var{conditions} turned out @code{nil}. (Think about it; which one
378did not?)
372 379
373For example, this expression tests whether @code{x} is either 0 or 380For example, this expression tests whether @code{x} is either
374@code{nil}: 381@code{nil} or the integer zero:
375 382
376@example 383@example
377(or (eq x nil) (eq x 0)) 384(or (eq x nil) (eq x 0))
@@ -446,9 +453,10 @@ The value of a @code{while} form is always @code{nil}.
446@end group 453@end group
447@end example 454@end example
448 455
449If you would like to execute something on each iteration before the 456To write a ``repeat...until'' loop, which will execute something on each
450end-test, put it together with the end-test in a @code{progn} as the 457iteration and then do the end-test, put the body followed by the
451first argument of @code{while}, as shown here: 458end-test in a @code{progn} as the first argument of @code{while}, as
459shown here:
452 460
453@example 461@example
454@group 462@group
@@ -560,9 +568,10 @@ With the return point in effect, @code{catch} evaluates the forms of the
560error or nonlocal exit) the value of the last body form is returned from 568error or nonlocal exit) the value of the last body form is returned from
561the @code{catch}. 569the @code{catch}.
562 570
563If a @code{throw} is done within @var{body} specifying the same value 571If a @code{throw} is executed during the execution of @var{body},
564@var{tag}, the @code{catch} exits immediately; the value it returns is 572specifying the same value @var{tag}, the @code{catch} form exits
565whatever was specified as the second argument of @code{throw}. 573immediately; the value it returns is whatever was specified as the
574second argument of @code{throw}.
566@end defspec 575@end defspec
567 576
568@defun throw tag value 577@defun throw tag value
@@ -641,13 +650,6 @@ printed. Finally the second body form in the outer @code{catch}, which is
641 650
642@example 651@example
643@group 652@group
644(defun catch2 (tag)
645 (catch tag
646 (throw 'hack 'yes)))
647@result{} catch2
648@end group
649
650@group
651(catch 'hack 653(catch 'hack
652 (print (catch2 'quux)) 654 (print (catch2 'quux))
653 'no) 655 'no)
@@ -709,6 +711,11 @@ buffer. You can also signal errors explicitly with the functions
709considered an error, but it is handled almost like an error. 711considered an error, but it is handled almost like an error.
710@xref{Quitting}. 712@xref{Quitting}.
711 713
714 The error message should state what is wrong (``File does not
715exist''), not how things ought to be (``File must exist''). The
716convention in Emacs Lisp is that error messages should start with a
717capital letter, but should not end with any sort of punctuation.
718
712@defun error format-string &rest args 719@defun error format-string &rest args
713This function signals an error with an error message constructed by 720This function signals an error with an error message constructed by
714applying @code{format} (@pxref{String Conversion}) to 721applying @code{format} (@pxref{String Conversion}) to
@@ -852,7 +859,7 @@ above, there is one handler, and it specifies one condition name,
852 The search for an applicable handler checks all the established handlers 859 The search for an applicable handler checks all the established handlers
853starting with the most recently established one. Thus, if two nested 860starting with the most recently established one. Thus, if two nested
854@code{condition-case} forms offer to handle the same error, the inner of 861@code{condition-case} forms offer to handle the same error, the inner of
855the two will actually handle it. 862the two gets to handle it.
856 863
857 If an error is handled by some @code{condition-case} form, this 864 If an error is handled by some @code{condition-case} form, this
858ordinarily prevents the debugger from being run, even if 865ordinarily prevents the debugger from being run, even if
@@ -881,10 +888,11 @@ totally unpredictable, such as when the program evaluates an expression
881read from the user. 888read from the user.
882 889
883 Error signaling and handling have some resemblance to @code{throw} and 890 Error signaling and handling have some resemblance to @code{throw} and
884@code{catch}, but they are entirely separate facilities. An error 891@code{catch} (@pxref{Catch and Throw}), but they are entirely separate
885cannot be caught by a @code{catch}, and a @code{throw} cannot be handled 892facilities. An error cannot be caught by a @code{catch}, and a
886by an error handler (though using @code{throw} when there is no suitable 893@code{throw} cannot be handled by an error handler (though using
887@code{catch} signals an error that can be handled). 894@code{throw} when there is no suitable @code{catch} signals an error
895that can be handled).
888 896
889@defspec condition-case var protected-form handlers@dots{} 897@defspec condition-case var protected-form handlers@dots{}
890This special form establishes the error handlers @var{handlers} around 898This special form establishes the error handlers @var{handlers} around
@@ -1127,9 +1135,9 @@ the value of the last @var{body} form, after it evaluates the
1127@var{cleanup-forms}. If the @var{body} forms do not finish, 1135@var{cleanup-forms}. If the @var{body} forms do not finish,
1128@code{unwind-protect} does not return any value in the normal sense. 1136@code{unwind-protect} does not return any value in the normal sense.
1129 1137
1130Only the @var{body} is actually protected by the @code{unwind-protect}. 1138Only the @var{body} is protected by the @code{unwind-protect}. If any
1131If any of the @var{cleanup-forms} themselves exits nonlocally (e.g., via 1139of the @var{cleanup-forms} themselves exits nonlocally (via a
1132a @code{throw} or an error), @code{unwind-protect} is @emph{not} 1140@code{throw} or an error), @code{unwind-protect} is @emph{not}
1133guaranteed to evaluate the rest of them. If the failure of one of the 1141guaranteed to evaluate the rest of them. If the failure of one of the
1134@var{cleanup-forms} has the potential to cause trouble, then protect it 1142@var{cleanup-forms} has the potential to cause trouble, then protect it
1135with another @code{unwind-protect} around that form. 1143with another @code{unwind-protect} around that form.
@@ -1167,13 +1175,13 @@ Several of the macros defined in this manual use @code{unwind-protect}
1167in this way. 1175in this way.
1168 1176
1169@findex ftp-login 1177@findex ftp-login
1170 Here is an actual example taken from the file @file{ftp.el}. It 1178 Here is an actual example derived from an FTP package. It creates a
1171creates a process (@pxref{Processes}) to try to establish a connection 1179process (@pxref{Processes}) to try to establish a connection to a remote
1172to a remote machine. As the function @code{ftp-login} is highly 1180machine. As the function @code{ftp-login} is highly susceptible to
1173susceptible to numerous problems that the writer of the function cannot 1181numerous problems that the writer of the function cannot anticipate, it
1174anticipate, it is protected with a form that guarantees deletion of the 1182is protected with a form that guarantees deletion of the process in the
1175process in the event of failure. Otherwise, Emacs might fill up with 1183event of failure. Otherwise, Emacs might fill up with useless
1176useless subprocesses. 1184subprocesses.
1177 1185
1178@smallexample 1186@smallexample
1179@group 1187@group
@@ -1188,7 +1196,7 @@ useless subprocesses.
1188@end group 1196@end group
1189@end smallexample 1197@end smallexample
1190 1198
1191 This example actually has a small bug: if the user types @kbd{C-g} to 1199 This example has a small bug: if the user types @kbd{C-g} to
1192quit, and the quit happens immediately after the function 1200quit, and the quit happens immediately after the function
1193@code{ftp-setup-buffer} returns but before the variable @code{process} is 1201@code{ftp-setup-buffer} returns but before the variable @code{process} is
1194set, the process will not be killed. There is no easy way to fix this bug, 1202set, the process will not be killed. There is no easy way to fix this bug,
diff --git a/lispref/customize.texi b/lispref/customize.texi
index 51ed4e0d526..ff5f724cd74 100644
--- a/lispref/customize.texi
+++ b/lispref/customize.texi
@@ -19,7 +19,7 @@ definitions---as well as face definitions (@pxref{Defining Faces}).
19@end menu 19@end menu
20 20
21@node Common Keywords 21@node Common Keywords
22@section Common Keywords for All Kinds of Items 22@section Common Item Keywords
23 23
24 All kinds of customization declarations (for variables and groups, and 24 All kinds of customization declarations (for variables and groups, and
25for faces) accept keyword arguments for specifying various information. 25for faces) accept keyword arguments for specifying various information.
@@ -31,8 +31,8 @@ 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} 34@item :tag @var{label}
35Use @var{name}, a string, instead of the item's name, to label the item 35Use @var{label}, a string, instead of the item's name, to label the item
36in customization menus and buffers. 36in customization menus and buffers.
37 37
38@item :group @var{group} 38@item :group @var{group}
@@ -42,7 +42,7 @@ Put this customization item in group @var{group}. When you use
42 42
43If you use this keyword more than once, you can put a single item into 43If you use this keyword more than once, you can put a single item into
44more than one group. Displaying any of those groups will show this 44more than one group. Displaying any of those groups will show this
45item. Be careful not to overdo this! 45item. Please don't overdo this, since the result would be annoying.
46 46
47@item :link @var{link-data} 47@item :link @var{link-data}
48Include an external link after the documentation string for this item. 48Include an external link after the documentation string for this item.
@@ -113,7 +113,8 @@ keyword.
113@tindex defgroup 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. It should not start with a
117@samp{*} as in @code{defcustom}; that convention is for variables only.
117 118
118The argument @var{members} is a list specifying an initial set of 119The argument @var{members} is a list specifying an initial set of
119customization items to be members of the group. However, most often 120customization items to be members of the group. However, most often
@@ -165,12 +166,20 @@ turn this feature back on, if someone would like to do the work.
165@tindex defcustom 166@tindex defcustom
166Declare @var{option} as a customizable user option variable. Do not 167Declare @var{option} as a customizable user option variable. Do not
167quote @var{option}. The argument @var{doc} specifies the documentation 168quote @var{option}. The argument @var{doc} specifies the documentation
168string for the variable. 169string for the variable; it should normally start with a @samp{*}. This
170marks the variable, for other purposes, as one that users may want to
171customize.
169 172
170If @var{option} is void, @code{defcustom} initializes it to 173If @var{option} is void, @code{defcustom} initializes it to
171@var{default}. @var{default} should be an expression to compute the 174@var{default}. @var{default} should be an expression to compute the
172value; be careful in writing it, because it can be evaluated on more 175value; be careful in writing it, because it can be evaluated on more
173than one occasion. 176than one occasion.
177
178When you evaluate a @code{defcustom} form with @kbd{C-M-x} in Emacs Lisp
179mode (@code{eval-defun}), a special feature of @code{eval-defun}
180arranges to set the variable unconditionally, without testing whether
181its value is void. (The same feature applies to @code{defvar}.)
182@xref{Defining Variables}.
174@end defmac 183@end defmac
175 184
176 @code{defcustom} accepts the following additional keywords: 185 @code{defcustom} accepts the following additional keywords:
@@ -277,7 +286,8 @@ options for @code{emacs-lisp-mode-hook}, but not by editing its
277definition. You can do it thus: 286definition. You can do it thus:
278 287
279@example 288@example
280(custom-add-option 'emacs-lisp-mode-hook 'my-lisp-mode-initialization) 289(custom-add-option 'emacs-lisp-mode-hook
290 'my-lisp-mode-initialization)
281@end example 291@end example
282 292
283@defun custom-add-option symbol option 293@defun custom-add-option symbol option
@@ -392,10 +402,9 @@ edit both the key and the value of each pair.
392 402
393You can specify the key and value types like this: 403You can specify the key and value types like this:
394 404
395@example 405@smallexample
396(alist :key-type @var{key-type} 406(alist :key-type @var{key-type} :value-type @var{value-type})
397 :value-type @var{value-type}) 407@end smallexample
398@end example
399 408
400@noindent 409@noindent
401where @var{key-type} and @var{value-type} are customization type 410where @var{key-type} and @var{value-type} are customization type
@@ -414,9 +423,9 @@ The argument to the @code{:options} keywords should be a list of option
414specifications. Ordinarily, the options are simply atoms, which are the 423specifications. Ordinarily, the options are simply atoms, which are the
415specified keys. For example: 424specified keys. For example:
416 425
417@example 426@smallexample
418:options '("foo" "bar" "baz") 427:options '("foo" "bar" "baz")
419@end example 428@end smallexample
420 429
421@noindent 430@noindent
422specifies that there are three ``known'' keys, namely @code{"foo"}, 431specifies that there are three ``known'' keys, namely @code{"foo"},
@@ -428,9 +437,9 @@ You can specify this by using a list instead of an atom in the option
428specification. The first element will specify the key, like before, 437specification. The first element will specify the key, like before,
429while the second element will specify the value type. 438while the second element will specify the value type.
430 439
431@example 440@smallexample
432:options '("foo" ("bar" integer) "baz") 441:options '("foo" ("bar" integer) "baz")
433@end example 442@end smallexample
434 443
435Finally, you may want to change how the key is presented. By default, 444Finally, you may want to change how the key is presented. By default,
436the key is simply shown as a @code{const}, since the user cannot change 445the key is simply shown as a @code{const}, since the user cannot change
@@ -440,36 +449,36 @@ you may want to use a more specialized type for presenting the key, like
440This is done by using a customization type specification instead of a 449This is done by using a customization type specification instead of a
441symbol for the key. 450symbol for the key.
442 451
443@example 452@smallexample
444:options '("foo" ((function-item some-function) integer) "baz") 453:options '("foo" ((function-item some-function) integer) "baz")
445@end example 454@end smallexample
446 455
447Many alists use lists with two elements, instead of cons cells. For 456Many alists use lists with two elements, instead of cons cells. For
448example, 457example,
449 458
450@example 459@smallexample
451(defcustom list-alist '(("foo" 1) ("bar" 2) ("baz" 3)) 460(defcustom list-alist '(("foo" 1) ("bar" 2) ("baz" 3))
452 "Each element is a list of the form (KEY VALUE).") 461 "Each element is a list of the form (KEY VALUE).")
453@end example 462@end smallexample
454 463
455@noindent 464@noindent
456instead of 465instead of
457 466
458@example 467@smallexample
459(defcustom cons-alist '(("foo" . 1) ("bar" . 2) ("baz" . 3)) 468(defcustom cons-alist '(("foo" . 1) ("bar" . 2) ("baz" . 3))
460 "Each element is a cons-cell (KEY . VALUE).") 469 "Each element is a cons-cell (KEY . VALUE).")
461@end example 470@end smallexample
462 471
463Because of the way lists are implemented on top of cons cells, you can 472Because of the way lists are implemented on top of cons cells, you can
464treat @code{list-alist} in the example above as a cons cell alist, where 473treat @code{list-alist} in the example above as a cons cell alist, where
465the value type is a list with a single element containing the real 474the value type is a list with a single element containing the real
466value. 475value.
467 476
468@example 477@smallexample
469(defcustom list-alist '(("foo" 1) ("bar" 2) ("baz" 3)) 478(defcustom list-alist '(("foo" 1) ("bar" 2) ("baz" 3))
470 "Each element is a list of the form (KEY VALUE)." 479 "Each element is a list of the form (KEY VALUE)."
471 :type '(alist :value-type (group integer))) 480 :type '(alist :value-type (group integer)))
472@end example 481@end smallexample
473 482
474The @code{group} widget is used here instead of @code{list} only because 483The @code{group} widget is used here instead of @code{list} only because
475the formatting is better suited for the purpose. 484the formatting is better suited for the purpose.
@@ -477,7 +486,7 @@ the formatting is better suited for the purpose.
477Similarily, you can have alists with more values associated with each 486Similarily, you can have alists with more values associated with each
478key, using variations of this trick: 487key, using variations of this trick:
479 488
480@example 489@smallexample
481(defcustom person-data '(("brian" 50 t) 490(defcustom person-data '(("brian" 50 t)
482 ("dorith" 55 nil) 491 ("dorith" 55 nil)
483 ("ken" 52 t)) 492 ("ken" 52 t))
@@ -489,16 +498,16 @@ key, using variations of this trick:
489 ("ken" "cat")) 498 ("ken" "cat"))
490 "Alist where the KEY is a person, and the VALUE is a list of pets." 499 "Alist where the KEY is a person, and the VALUE is a list of pets."
491 :type '(alist :value-type (repeat string))) 500 :type '(alist :value-type (repeat string)))
492@end example 501@end smallexample
493 502
494@item plist 503@item plist
495The @code{plist} custom type is similar to the @code{alist} (see above), 504The @code{plist} custom type is similar to the @code{alist} (see above),
496except that the information is stored as a property list, i.e. a list of 505except that the information is stored as a property list, i.e. a list of
497this form: 506this form:
498 507
499@example 508@smallexample
500(@var{key} @var{value} @var{key} @var{value} @var{key} @var{value} @dots{}) 509(@var{key} @var{value} @var{key} @var{value} @var{key} @var{value} @dots{})
501@end example 510@end smallexample
502 511
503The default @code{:key-type} for @code{plist} is @code{symbol}, 512The default @code{:key-type} for @code{plist} is @code{symbol},
504rather than @code{sexp}. 513rather than @code{sexp}.
diff --git a/lispref/debugging.texi b/lispref/debugging.texi
index 4bc3d07d69b..8946cf0baab 100644
--- a/lispref/debugging.texi
+++ b/lispref/debugging.texi
@@ -510,9 +510,9 @@ debugger.
510 510
511@defvar debugger 511@defvar debugger
512The value of this variable is the function to call to invoke the 512The value of this variable is the function to call to invoke the
513debugger. Its value must be a function of any number of arguments (or, 513debugger. Its value must be a function of any number of arguments, or,
514more typically, the name of a function). Presumably this function will 514more typically, the name of a function. This function should invoke
515enter some kind of debugger. The default value of the variable is 515some kind of debugger. The default value of the variable is
516@code{debug}. 516@code{debug}.
517 517
518The first argument that Lisp hands to the function indicates why it 518The first argument that Lisp hands to the function indicates why it
@@ -531,11 +531,13 @@ value is always @code{nil}.
531 531
532In the following example, a Lisp expression calls @code{backtrace} 532In the following example, a Lisp expression calls @code{backtrace}
533explicitly. This prints the backtrace to the stream 533explicitly. This prints the backtrace to the stream
534@code{standard-output}: in this case, to the buffer 534@code{standard-output}, which, in this case, is the buffer
535@samp{backtrace-output}. Each line of the backtrace represents one 535@samp{backtrace-output}.
536function call. The line shows the values of the function's arguments if 536
537they are all known. If they are still being computed, the line says so. 537Each line of the backtrace represents one function call. The line shows
538The arguments of special forms are elided. 538the values of the function's arguments if they are all known; if they
539are still being computed, the line says so. The arguments of special
540forms are elided.
539 541
540@smallexample 542@smallexample
541@group 543@group
@@ -620,9 +622,9 @@ bound to @code{nil}. The debugger can set this variable to leave
620information for future debugger invocations during the same command 622information for future debugger invocations during the same command
621invocation. 623invocation.
622 624
623The advantage, for the debugger, of using this variable rather than an 625The advantage of using this variable rather than an ordinary global
624ordinary global variable is that the data will never carry over to a 626variable is that the data will never carry over to a subsequent command
625subsequent command invocation. 627invocation.
626@end defvar 628@end defvar
627 629
628@defun backtrace-frame frame-number 630@defun backtrace-frame frame-number
@@ -630,11 +632,11 @@ The function @code{backtrace-frame} is intended for use in Lisp
630debuggers. It returns information about what computation is happening 632debuggers. It returns information about what computation is happening
631in the stack frame @var{frame-number} levels down. 633in the stack frame @var{frame-number} levels down.
632 634
633If that frame has not evaluated the arguments yet (or is a special 635If that frame has not evaluated the arguments yet, or is a special
634form), the value is @code{(nil @var{function} @var{arg-forms}@dots{})}. 636form, the value is @code{(nil @var{function} @var{arg-forms}@dots{})}.
635 637
636If that frame has evaluated its arguments and called its function 638If that frame has evaluated its arguments and called its function
637already, the value is @code{(t @var{function} 639already, the return value is @code{(t @var{function}
638@var{arg-values}@dots{})}. 640@var{arg-values}@dots{})}.
639 641
640In the return value, @var{function} is whatever was supplied as the 642In the return value, @var{function} is whatever was supplied as the
@@ -679,12 +681,9 @@ find the mismatch.)
679@subsection Excess Open Parentheses 681@subsection Excess Open Parentheses
680 682
681 The first step is to find the defun that is unbalanced. If there is 683 The first step is to find the defun that is unbalanced. If there is
682an excess open parenthesis, the way to do this is to insert a 684an excess open parenthesis, the way to do this is to go to the end of
683close parenthesis at the end of the file and type @kbd{C-M-b} 685the file and type @kbd{C-u C-M-u}. This will move you to the beginning
684(@code{backward-sexp}). This will move you to the beginning of the 686of the defun that is unbalanced.
685defun that is unbalanced. (Then type @kbd{C-@key{SPC} C-_ C-u
686C-@key{SPC}} to set the mark there, undo the insertion of the
687close parenthesis, and finally return to the mark.)
688 687
689 The next step is to determine precisely what is wrong. There is no 688 The next step is to determine precisely what is wrong. There is no
690way to be sure of this except by studying the program, but often the 689way to be sure of this except by studying the program, but often the
@@ -715,11 +714,9 @@ anything.
715@node Excess Close 714@node Excess Close
716@subsection Excess Close Parentheses 715@subsection Excess Close Parentheses
717 716
718 To deal with an excess close parenthesis, first insert an open 717 To deal with an excess close parenthesis, first go to the beginning of
719parenthesis at the beginning of the file, back up over it, and type 718the file, then type @kbd{C-u -1 C-M-u} to find the end of the unbalanced
720@kbd{C-M-f} to find the end of the unbalanced defun. (Then type 719defun.
721@kbd{C-@key{SPC} C-_ C-u C-@key{SPC}} to set the mark there, undo the
722insertion of the open parenthesis, and finally return to the mark.)
723 720
724 Then find the actual matching close parenthesis by typing @kbd{C-M-f} 721 Then find the actual matching close parenthesis by typing @kbd{C-M-f}
725at the beginning of that defun. This will leave you somewhere short of 722at the beginning of that defun. This will leave you somewhere short of
diff --git a/lispref/display.texi b/lispref/display.texi
index 1ada1dbd373..2f9cb0c9bdc 100644
--- a/lispref/display.texi
+++ b/lispref/display.texi
@@ -11,6 +11,7 @@ that Emacs presents to the user.
11 11
12@menu 12@menu
13* Refresh Screen:: Clearing the screen and redrawing everything on it. 13* Refresh Screen:: Clearing the screen and redrawing everything on it.
14* Forcing Redisplay:: Forcing redisplay.
14* Truncation:: Folding or wrapping long text lines. 15* Truncation:: Folding or wrapping long text lines.
15* The Echo Area:: Where messages are displayed. 16* The Echo Area:: Where messages are displayed.
16* Invisible Text:: Hiding part of the buffer text. 17* Invisible Text:: Hiding part of the buffer text.
@@ -20,6 +21,8 @@ that Emacs presents to the user.
20* Overlays:: Use overlays to highlight parts of the buffer. 21* Overlays:: Use overlays to highlight parts of the buffer.
21* Width:: How wide is a character or string. 22* Width:: How wide is a character or string.
22* Faces:: A face defines a graphics appearance: font, color, etc. 23* Faces:: A face defines a graphics appearance: font, color, etc.
24* Display Property:: Enabling special display features.
25* Images:: Displaying images in Emacs buffers.
23* Blinking:: How Emacs shows the matching open parenthesis. 26* Blinking:: How Emacs shows the matching open parenthesis.
24* Inverse Video:: Specifying how the screen looks. 27* Inverse Video:: Specifying how the screen looks.
25* Usual Display:: The usual conventions for displaying nonprinting chars. 28* Usual Display:: The usual conventions for displaying nonprinting chars.
@@ -64,6 +67,32 @@ has been suspended and resumed. Non-@code{nil} means there is no need
64to redraw, @code{nil} means redrawing is needed. The default is @code{nil}. 67to redraw, @code{nil} means redrawing is needed. The default is @code{nil}.
65@end defvar 68@end defvar
66 69
70@node Forcing Redisplay
71@section Forcing Redisplay
72@cindex forcing redisplay
73
74 Emacs redisplay normally stops if input arrives, and does not happen
75at all if input is available before it starts. Most of the time, this
76is exactly what you want. However, you can prevent preemption by
77binding @code{redisplay-dont-pause} to a non-@code{nil} value.
78
79@tindex redisplay-dont-pause
80@defvar redisplay-dont-pause
81If this variable is non-@code{nil}, pending input does not
82prevent or halt redisplay; redisplay occurs, and finishes,
83regardless of whether input is available. This feature is available
84as of Emacs 21.
85@end defvar
86
87 You can request a display update, but only if no input is pending,
88with @code{(sit-for 0)}. To force a display update even when input is
89pending, do this:
90
91@example
92(let ((redisplay-dont-pause t))
93 (sit-for 0))
94@end example
95
67@node Truncation 96@node Truncation
68@section Truncation 97@section Truncation
69@cindex line wrapping 98@cindex line wrapping
@@ -158,10 +187,14 @@ constructed string.
158In batch mode, @code{message} prints the message text on the standard 187In batch mode, @code{message} prints the message text on the standard
159error stream, followed by a newline. 188error stream, followed by a newline.
160 189
190If @var{string}, or strings among the @var{arguments}, have @code{face}
191text properties, these affect the way the message is displayed.
192
161@c Emacs 19 feature 193@c Emacs 19 feature
162If @var{string} is @code{nil}, @code{message} clears the echo area. If 194If @var{string} is @code{nil}, @code{message} clears the echo area; if
163the minibuffer is active, this brings the minibuffer contents back onto 195the echo area has been expanded automatically, this brings it back to
164the screen immediately. 196its normal size. If the minibuffer is active, this brings the
197minibuffer contents back onto the screen immediately.
165 198
166@example 199@example
167@group 200@group
@@ -682,7 +715,7 @@ these affect the display of the text within the overlay.
682@node Overlay Properties 715@node Overlay Properties
683@subsection Overlay Properties 716@subsection Overlay Properties
684 717
685Overlay properties are like text properties in that the properties that 718 Overlay properties are like text properties in that the properties that
686alter how a character is displayed can come from either source. But in 719alter how a character is displayed can come from either source. But in
687most respects they are different. Text properties are considered a part 720most respects they are different. Text properties are considered a part
688of the text; overlays are specifically considered not to be part of the 721of the text; overlays are specifically considered not to be part of the
@@ -693,6 +726,29 @@ overlay or changing its properties does not. Unlike text property
693changes, overlay changes are not recorded in the buffer's undo list. 726changes, overlay changes are not recorded in the buffer's undo list.
694@xref{Text Properties}, for comparison. 727@xref{Text Properties}, for comparison.
695 728
729 These functions are used for reading and writing the properties of an
730overlay:
731
732@defun overlay-get overlay prop
733This function returns the value of property @var{prop} recorded in
734@var{overlay}, if any. If @var{overlay} does not record any value for
735that property, but it does have a @code{category} property which is a
736symbol, that symbol's @var{prop} property is used. Otherwise, the value
737is @code{nil}.
738@end defun
739
740@defun overlay-put overlay prop value
741This function sets the value of property @var{prop} recorded in
742@var{overlay} to @var{value}. It returns @var{value}.
743@end defun
744
745 See also the function @code{get-char-property} which checks both
746overlay properties and text properties for a given character.
747@xref{Examining Properties}.
748
749 Many overlay properties have special meanings; here is a table
750of them:
751
696@table @code 752@table @code
697@item priority 753@item priority
698@kindex priority @r{(overlay property)} 754@kindex priority @r{(overlay property)}
@@ -721,20 +777,51 @@ of the symbol serve as defaults for the properties of the overlay.
721@item face 777@item face
722@kindex face @r{(overlay property)} 778@kindex face @r{(overlay property)}
723This property controls the way text is displayed---for example, which 779This property controls the way text is displayed---for example, which
724font and which colors. Its value is a face name or a list of face 780font and which colors. @xref{Faces}, for more information.
725names. @xref{Faces}, for more information.
726 781
727If the property value is a list, elements may also have the form 782In the simplest case, the value is a face name. It can also be a list;
728@code{(foreground-color . @var{color-name})} or @code{(background-color 783then each element can be any of these possibilities;
729. @var{color-name})}. These elements specify just the foreground color 784
730or just the background color; therefore, there is no need to create a 785@itemize @bullet
731face for each color that you want to use. 786@item
787A face name (a symbol or string).
788
789@item
790Starting in Emacs 21, a property list of face attributes. This has the
791form (@var{keyword} @var{value} @dots{}), where each @var{keyword} is a
792face attribute name and @var{value} is a meaningful value for that
793attribute. With this feature, you do not need to create a face each
794time you want to specify a particular attribute for certain text.
795@xref{Face Attributes}.
796
797@item
798A cons cell of the form @code{(foreground-color . @var{color-name})} or
799@code{(background-color . @var{color-name})}. These elements specify
800just the foreground color or just the background color.
801
802@code{(foreground-color . @var{color-name})} is equivalent to
803@code{(:foreground @var{color-name})}, and likewise for the background.
804@end itemize
732 805
733@item mouse-face 806@item mouse-face
734@kindex mouse-face @r{(overlay property)} 807@kindex mouse-face @r{(overlay property)}
735This property is used instead of @code{face} when the mouse is within 808This property is used instead of @code{face} when the mouse is within
736the range of the overlay. 809the range of the overlay.
737 810
811@item display
812@kindex display @r{(overlay property)}
813This property activates various features that change the
814way text is displayed. For example, it can make text appear taller
815or shorter, higher or lower, wider or narror, or replaced with an image.
816@xref{Display Property}.
817
818@item help-echo
819@kindex help-echo @r{(text property)}
820If an overlay has a string as its @code{help-echo} property, then when
821you move the mouse onto the text in the overlay, Emacs displays that
822string in the echo area, or in the tooltip window. It is available
823starting in Emacs 21.
824
738@item modification-hooks 825@item modification-hooks
739@kindex modification-hooks @r{(overlay property)} 826@kindex modification-hooks @r{(overlay property)}
740This property's value is a list of functions to be called if any 827This property's value is a list of functions to be called if any
@@ -818,26 +905,6 @@ of the text. The property's value replaces the buffer's local map, when
818the character after point is within the overlay. @xref{Active Keymaps}. 905the character after point is within the overlay. @xref{Active Keymaps}.
819@end table 906@end table
820 907
821 These are the functions for reading and writing the properties of an
822overlay.
823
824@defun overlay-get overlay prop
825This function returns the value of property @var{prop} recorded in
826@var{overlay}, if any. If @var{overlay} does not record any value for
827that property, but it does have a @code{category} property which is a
828symbol, that symbol's @var{prop} property is used. Otherwise, the value
829is @code{nil}.
830@end defun
831
832@defun overlay-put overlay prop value
833This function sets the value of property @var{prop} recorded in
834@var{overlay} to @var{value}. It returns @var{value}.
835@end defun
836
837 See also the function @code{get-char-property} which checks both
838overlay properties and text properties for a given character.
839@xref{Examining Properties}.
840
841@node Managing Overlays 908@node Managing Overlays
842@subsection Managing Overlays 909@subsection Managing Overlays
843 910
@@ -974,13 +1041,14 @@ the beginning of the result if one multi-column character in
974@section Faces 1041@section Faces
975@cindex face 1042@cindex face
976 1043
977A @dfn{face} is a named collection of graphical attributes: font, 1044 A @dfn{face} is a named collection of graphical attributes: font
978foreground color, background color, and optional underlining. Faces 1045family, foreground color, background color, optional underlining, and
979control the display of text on the screen. 1046many others. Faces are used in Emacs to control the style of display of
1047particular parts of the text or the frame.
980 1048
981@cindex face id 1049@cindex face id
982Each face has its own @dfn{face number}, which distinguishes faces at 1050Each face has its own @dfn{face number}, which distinguishes faces at
983low levels within Emacs. However, for most purposes, you can refer to 1051low levels within Emacs. However, for most purposes, you refer to
984faces in Lisp programs by their names. 1052faces in Lisp programs by their names.
985 1053
986@defun facep object 1054@defun facep object
@@ -996,23 +1064,56 @@ face name a special meaning in one frame if you wish.
996@menu 1064@menu
997* Standard Faces:: The faces Emacs normally comes with. 1065* Standard Faces:: The faces Emacs normally comes with.
998* Defining Faces:: How to define a face with @code{defface}. 1066* Defining Faces:: How to define a face with @code{defface}.
999* Merging Faces:: How Emacs decides which face to use for a character. 1067* Face Attributes:: What is in a face?
1068* Attribute Functions:: Functions to examine and set face attributes.
1069* Merging Faces:: How Emacs combines the faces specified for a character.
1070* Font Selection:: Finding the best available font for a face.
1000* Face Functions:: How to define and examine faces. 1071* Face Functions:: How to define and examine faces.
1072* Auto Faces:: Hook for automatic face assignment.
1073* Font Lookup:: Looking up the names of available fonts
1074 and information about them.
1075* Fontsets:: A fontset is a collection of fonts
1076 that handle a range of character sets.
1001@end menu 1077@end menu
1002 1078
1003@node Standard Faces 1079@node Standard Faces
1004@subsection Standard Faces 1080@subsection Standard Faces
1005 1081
1006 This table lists all the standard faces and their uses. 1082 This table lists all the standard faces and their uses. Most of them
1083are used for displaying certain parts of the frames or certain kinds of
1084text; you can control how those places look by customizing these faces.
1007 1085
1008@table @code 1086@table @code
1009@item default 1087@item default
1010@kindex default @r{(face name)} 1088@kindex default @r{(face name)}
1011This face is used for ordinary text. 1089This face is used for ordinary text.
1012 1090
1091@item mode-line
1092@kindex mode-line @r{(face name)}
1093This face is used for mode lines, and for menu bars
1094when toolkit menus are not used.
1095
1013@item modeline 1096@item modeline
1014@kindex modeline @r{(face name)} 1097@kindex modeline @r{(face name)}
1015This face is used for mode lines and menu bars. 1098This is an alias for the @code{mode-line} face, for compatibility with
1099old Emacs versions.
1100
1101@item header-line
1102@kindex header-line @r{(face name)}
1103This face is used for the header lines of windows that have them.
1104
1105@item fringe
1106@kindex fringe @r{(face name)}
1107This face controls the colors of window fringes, the thin areas on
1108either side that are used to display continuation and truncation glyphs.
1109
1110@item scroll-bar
1111@kindex scroll-bar @r{(face name)}
1112This face controls the colors for display of scroll bars.
1113
1114@item tool-bar
1115@kindex tool-bar @r{(face name)}
1116This face is used for display of the tool bar, if any.
1016 1117
1017@item region 1118@item region
1018@kindex region @r{(face name)} 1119@kindex region @r{(face name)}
@@ -1026,10 +1127,16 @@ This face is used to show any secondary selection you have made.
1026@kindex highlight @r{(face name)} 1127@kindex highlight @r{(face name)}
1027This face is meant to be used for highlighting for various purposes. 1128This face is meant to be used for highlighting for various purposes.
1028 1129
1029@item underline 1130@item trailing-whitespace
1030@kindex underline @r{(face name)} 1131@kindex trailing-whitespace @r{(face name)}
1031This face underlines text. 1132This face is used to display excess whitespace at the end of a line.
1133@end table
1032 1134
1135 In contrast, these faces are provided to change the appearance of text
1136in specific ways. You can use them on specific text, when you want
1137the effects they produce.
1138
1139@table @code
1033@item bold 1140@item bold
1034@kindex bold @r{(face name)} 1141@kindex bold @r{(face name)}
1035This face uses a bold font, if possible. It uses the bold variant of 1142This face uses a bold font, if possible. It uses the bold variant of
@@ -1044,6 +1151,20 @@ This face uses the italic variant of the frame's font, if it has one.
1044@kindex bold-italic @r{(face name)} 1151@kindex bold-italic @r{(face name)}
1045This face uses the bold italic variant of the frame's font, if it has 1152This face uses the bold italic variant of the frame's font, if it has
1046one. 1153one.
1154
1155@item underline
1156@kindex underline @r{(face name)}
1157This face underlines text.
1158
1159@item fixed-patch
1160@kindex fixed-patch @r{(face name)}
1161This face forces use of a particular fixed-width font.
1162
1163@item variable-patch
1164@kindex variable-patch @r{(face name)}
1165This face forces use of a particular variable-width font. It's
1166reasonable to customize this to use a diffrent variable-width font, if
1167you like, but you should not make it a fixed-width font.
1047@end table 1168@end table
1048 1169
1049@node Defining Faces 1170@node Defining Faces
@@ -1139,90 +1260,223 @@ background colors. If it is @code{light}, then Emacs treats all frames
1139as if they had a light background. 1260as if they had a light background.
1140@end defopt 1261@end defopt
1141 1262
1142@node Merging Faces 1263@node Face Attributes
1143@subsection Merging Faces for Display 1264@subsection Face Attributes
1265@cindex face attributes
1144 1266
1145 Here are all the ways to specify which face to use for display of text: 1267 The effect of using a face is determined by a fixed set of @dfn{face
1268attributes}. This table lists all the face attributes, and what they
1269mean. Note that in general, more than one face be specified for a given
1270piece of text; when that happens, the attributes of all the faces are
1271merged to specify how to display the text. @xref{Merging Faces}.
1146 1272
1147@itemize @bullet 1273 In Emacs 21, any attribute in a face can have the value
1148@item 1274@code{unspecified}. This means the face doesn't specify that attribute.
1149With defaults. Each frame has a @dfn{default face}, which is used for 1275In face merging, when the first face fails to specify a particular
1150all text that doesn't somehow specify another face. (We may change this 1276attribute, that means the next face gets a chance. However, the
1151in a forthcoming Emacs version to serve as a default for all text.) 1277@code{default} face must specify all attributes.
1152 1278
1153@item 1279 Some of these font attributes are meaningful only on certain
1154With text properties. A character may have a @code{face} property; if so, 1280kinds of displays---if your display cannot handle a certain attribute,
1155it is displayed with that face. @xref{Special Properties}. 1281the attribute is ignored.
1156 1282
1157If the character has a @code{mouse-face} property, that is used instead 1283@table @code
1158of the @code{face} property when the mouse is ``near enough'' to the 1284@item :family
1159character. 1285Font family name, or fontset name (@pxref{Fontsets}). If you specify a
1286font family name, the wild-cards @samp{*} and @samp{?} are allowed.
1287
1288@item :width
1289Relative proportionate width, also known as the character set width or
1290set width. This should be one of the symbols @code{ultra-condensed},
1291@code{extra-condensed}, @code{condensed}, @code{semi-condensed},
1292@code{normal}, @code{semi-expanded}, @code{expanded},
1293@code{extra-expanded}, or @code{ultra-expanded}.
1294
1295@item :height
1296Font height, an integer in units of 1/10pt.
1297
1298@item :weight
1299Font weight---a symbol from this series (from most dense to most faint):
1300@code{ultra-bold}, @code{extra-bold}, @code{bold}, @code{semi-bold},
1301@code{normal}, @code{semi-light}, @code{light}, @code{extra-light},
1302@code{ultra-light}, or else @code{nil} meaning this attribute is not
1303specified.
1304
1305@item :slant
1306Font slant---one of the symbols @code{italic}, @code{oblique}, @code{normal},
1307@code{reverse-italic}, or @code{reverse-oblique}.
1308
1309@item :foreground
1310Foreground color, a string.
1311
1312@item :background
1313Background color, a string.
1314
1315@item :inverse-video
1316Whether or not characters should be displayed in inverse video. The
1317value should be @code{t} (yes) or @code{nil} (no).
1318
1319@item :stipple
1320The background stipple, a bitmap name.
1321
1322The value can be a string; then is the name of a file of pixmap data.
1323The file is found in the directories listed in the variable
1324@code{x-bitmap-file-path}.
1325
1326Alternatively, the value can be a list of the form @code{(@var{width}
1327@var{height} @var{data})}. Here, width and height are the size in
1328pixels, and @var{data} is a string containing the raw bits of the
1329bitmap.
1330
1331If the value is @code{nil}, that means use no stipple pattern.
1332
1333Normally you do not need to set the stipple attribute, because it is
1334used automatically to handle certain shades of gray.
1335
1336@item :underline
1337Whether or not characters should be underlined, and in what color. If
1338the value is @code{t}, underlining uses the foreground color of the
1339face. If the value is a string, underlining uses that color. The
1340value @code{nil} means do not underline.
1341
1342@item :overline
1343Whether or not characters should be overlined, and in what color.
1344The value is used like that of @code{:underline}.
1345
1346@item :strike-through
1347Whether or not characters should be strike-through, and in what
1348color. The value is used like that of @code{:underline}.
1349
1350@item :box
1351Whether or not a box should be drawn around characters, its color, the
1352width of the box lines, and 3D appearance. See below for the possible
1353values and what they mean.
1354@end table
1160 1355
1161@item 1356 Here are the possible values of the @code{:box} attribute, and what
1162With overlays. An overlay may have @code{face} and @code{mouse-face} 1357they mean:
1163properties too; they apply to all the text covered by the overlay.
1164 1358
1165@item 1359@table @asis
1166With a region that is active. In Transient Mark mode, the region is 1360@item @code{nil}
1167highlighted with a particular face (see @code{region-face}, below). 1361Don't draw a box.
1168 1362
1169@item 1363@item @code{t}
1170With special glyphs. Each glyph can specify a particular face 1364Draw a box with lines of width 1, in the foreground color.
1171number. @xref{Glyphs}.
1172@end itemize
1173 1365
1174 If these various sources together specify more than one face for a 1366@item @var{color}
1175particular character, Emacs merges the attributes of the various faces 1367Draw a box with lines of width 1, in color @var{color}.
1176specified. The attributes of the faces of special glyphs come first;
1177then comes the face for region highlighting, if appropriate;
1178then come attributes of faces from overlays, followed by those from text
1179properties, and last the default face.
1180 1368
1181 When multiple overlays cover one character, an overlay with higher 1369@item @code{(:line-width @var{width} :color @var{color} :style @var{style})}
1182priority overrides those with lower priority. @xref{Overlays}. 1370This way you can explicitly specify all aspects of the box. The value
1371@var{width} specifies the width of the lines to draw; it defaults to 1.
1183 1372
1184 If an attribute such as the font or a color is not specified in any of 1373The value @var{color} specifies the color to draw with. The default is
1185the above ways, the frame's own font or color is used. 1374the foreground color of the face for simple boxes, and the background
1375color of the face for 3D boxes.
1186 1376
1187@node Face Functions 1377The value @var{style} specifies whether to draw a 3D box. If it is
1188@subsection Functions for Working with Faces 1378@code{released-button}, the box looks like a 3D button that is not being
1379pressed. If it is @code{pressed-button}, the box looks like a 3D button
1380that is being pressed. If it is @code{nil} or omitted, a plain 2D box
1381is used.
1382@end table
1189 1383
1190 The attributes a face can specify include the font, the foreground 1384 The attributes @code{:overline}, @code{:strike-through} and
1191color, the background color, and underlining. The face can also leave 1385@code{:box} are new in Emacs 21. The attributes @code{:family},
1192these unspecified by giving the value @code{nil} for them. 1386@code{:height}, @code{:width}, @code{:weight}, @code{:slant} are also
1387new, previous versions had another way to specify some of the same
1388information.
1193 1389
1194 Here are the primitives for creating and changing faces. 1390@table @code
1391@item :font
1392This attribute specified the font name.
1195 1393
1196@defun make-face name 1394@item :bold
1197This function defines a new face named @var{name}, initially with all 1395A non-@code{nil} value specifies a bold font.
1198attributes @code{nil}. It does nothing if there is already a face named
1199@var{name}.
1200@end defun
1201 1396
1202@defun face-list 1397@item :italic
1203This function returns a list of all defined face names. 1398A non-@code{nil} value specifies an italic font.
1204@end defun 1399@end table
1205 1400
1206@defun copy-face old-face new-name &optional frame new-frame 1401 For compatibility, you can still set these ``attributes'' in Emacs 21,
1207This function defines the face @var{new-name} as a copy of the existing 1402even though they are not real face attributes. Here is what that does:
1208face named @var{old-face}. It creates the face @var{new-name} if that
1209doesn't already exist.
1210 1403
1211If the optional argument @var{frame} is given, this function applies 1404@table @code
1212only to that frame. Otherwise it applies to each frame individually, 1405@item :font
1213copying attributes from @var{old-face} in each frame to @var{new-face} 1406@code{:font} is not really a font attribute, but you can use it in
1214in the same frame. 1407@code{set-face-attribute} to specify several attributes at once. You
1408specify an X font name as the value, and based on this font name, and
1409it sets the attributes @code{:family}, @code{:width}, @code{:height},
1410@code{:weight}, and @code{:slant} according to the font name.
1411
1412If the value is a pattern with wildcards, the first font that matches
1413the pattern is used to set these attributes.
1414
1415@item :bold
1416A non-@code{nil} makes the face bold; @code{nil} makes it normal.
1417This actually works by setting the @code{:weight} attribute.
1418
1419@item :italic
1420A non-@code{nil} makes the face italic; @code{nil} makes it normal.
1421This actually works by setting the @code{:slant} attribute.
1422@end table
1215 1423
1216If the optional argument @var{new-frame} is given, then @code{copy-face} 1424@defvar x-bitmap-file-path
1217copies the attributes of @var{old-face} in @var{frame} to @var{new-name} 1425This variable specifies a list of directories for searching
1218in @var{new-frame}. 1426for bitmap files, for the @code{:stipple} attribute.
1219@end defun 1427@end defvar
1428
1429@node Attribute Functions
1430@subsection Face Attribute Functions
1220 1431
1221 You can modify the attributes of an existing face with the following 1432 You can modify the attributes of an existing face with the following
1222functions. If you specify @var{frame}, they affect just that frame; 1433functions. If you specify @var{frame}, they affect just that frame;
1223otherwise, they affect all frames as well as the defaults that apply to 1434otherwise, they affect all frames as well as the defaults that apply to
1224new frames. 1435new frames.
1225 1436
1437@tindex set-face-attribute
1438@defun set-face-attribute face frame &rest arguments
1439This function sets one or more attributes of face @var{face}
1440for frame @var{frame}. If @var{frame} is @code{nil}, it sets
1441the attribute for all frames, and the defaults for new frames.
1442
1443The extra arguments @var{arguments} specify the attributes to set, and
1444the values for them. They should consist of alternating attribute names
1445(such as @code{:family} or @code{:underline} and corresponding values.
1446Thus,
1447
1448@example
1449(set-face-attribute 'foo nil
1450 :width :extended
1451 :weight :bold
1452 :underline "red")
1453@end example
1454
1455@noindent
1456sets the attributes @code{:width}, @code{:weight} and @code{:underline}
1457to the corresponding values.
1458@end defun
1459
1460@tindex face-attribute
1461@defun face-attribute face attribute &optional frame
1462This returns the value of the @var{attribute} attribute of face
1463@var{face} on @var{frame}. If @var{frame} is @code{nil},
1464that means the selected frame.
1465
1466If @var{frame} is @code{t}, the value is the default for
1467@var{face} for new frames.
1468
1469For example,
1470
1471@example
1472(face-attribute 'bold :weight)
1473 @result{} bold
1474@end example
1475@end defun
1476
1477 For older Emacs versions, you can these functions to set
1478and examine the face attributes which existed in those versions.
1479
1226@defun set-face-foreground face color &optional frame 1480@defun set-face-foreground face color &optional frame
1227@defunx set-face-background face color &optional frame 1481@defunx set-face-background face color &optional frame
1228These functions set the foreground (or background, respectively) color 1482These functions set the foreground (or background, respectively) color
@@ -1244,23 +1498,33 @@ they are used automatically to handle certain shades of gray.
1244@end defun 1498@end defun
1245 1499
1246@defun set-face-font face font &optional frame 1500@defun set-face-font face font &optional frame
1247This function sets the font of face @var{face}. The argument @var{font} 1501This function sets the font of face @var{face}.
1248should be a string, either a valid font name for your system or the name 1502
1249of an Emacs fontset (@pxref{Fontsets}). Note that if you set the font 1503In Emacs 21, this actually sets the attributes @code{:family},
1504@code{:width}, @code{:height}, @code{:weight}, and @code{:slant}
1505according to the font name @var{font}.
1506
1507In Emacs 20, this sets the font attribute. Once you set the font
1250explicitly, the bold and italic attributes cease to have any effect, 1508explicitly, the bold and italic attributes cease to have any effect,
1251because the precise font that you specified is always used. 1509because the precise font that you specified is used.
1252@end defun 1510@end defun
1253 1511
1254@defun set-face-bold-p face bold-p &optional frame 1512@defun set-face-bold-p face bold-p &optional frame
1255@tindex set-face-bold-p 1513@tindex set-face-bold-p
1256This function sets the bold attribute of face @var{face}. 1514This function specifies whether @var{face} should be bold. If
1257Non-@code{nil} means bold; @code{nil} means non-bold. 1515@var{bold-p} is non-@code{nil}, that means yes; @code{nil} means no.
1516
1517In Emacs 21, this sets the @code{:weight} attribute.
1518In Emacs 20, it sets the @code{:bold} attribute.
1258@end defun 1519@end defun
1259 1520
1260@defun set-face-italic-p face italic-p &optional frame 1521@defun set-face-italic-p face italic-p &optional frame
1261@tindex set-face-italic-p 1522@tindex set-face-italic-p
1262This function sets the italic attribute of face @var{face}. 1523This function specifies whether @var{face} should be italic. If
1263Non-@code{nil} means italic; @code{nil} means non-italic. 1524@var{italic-p} is non-@code{nil}, that means yes; @code{nil} means no.
1525
1526In Emacs 21, this sets the @code{:slant} attribute.
1527In Emacs 20, it sets the @code{:italic} attribute.
1264@end defun 1528@end defun
1265 1529
1266@defun set-face-underline-p face underline-p &optional frame 1530@defun set-face-underline-p face underline-p &optional frame
@@ -1269,10 +1533,9 @@ Non-@code{nil} means do underline; @code{nil} means don't.
1269@end defun 1533@end defun
1270 1534
1271@defun invert-face face &optional frame 1535@defun invert-face face &optional frame
1272Swap the foreground and background colors of face @var{face}. If the 1536This function inverts the @code{:inverse-video} attribute of face
1273face doesn't specify both foreground and background, then its foreground 1537@var{face}. If the attribute is @code{nil}, this function sets it to
1274and background are set to the default background and foreground, 1538@code{t}, and vice versa.
1275respectively.
1276@end defun 1539@end defun
1277 1540
1278 These functions examine the attributes of a face. If you don't 1541 These functions examine the attributes of a face. If you don't
@@ -1295,16 +1558,220 @@ This function returns the name of the font of face @var{face}.
1295 1558
1296@defun face-bold-p face &optional frame 1559@defun face-bold-p face &optional frame
1297@tindex face-bold-p 1560@tindex face-bold-p
1298This function returns the bold attribute of face @var{face}. 1561This function returns @code{t} if @var{face} is bold---that is, if it is
1562bolder than normal. It returns @code{nil} otherwise.
1299@end defun 1563@end defun
1300 1564
1301@defun face-italic-p face &optional frame 1565@defun face-italic-p face &optional frame
1302@tindex face-italic-p 1566@tindex face-italic-p
1303This function returns the italic attribute of face @var{face}. 1567This function returns @code{t} if @var{face} is italic or oblique,
1568@code{nil} otherwise.
1304@end defun 1569@end defun
1305 1570
1306@defun face-underline-p face &optional frame 1571@defun face-underline-p face &optional frame
1307This function returns the underline attribute of face @var{face}. 1572This function returns the @code{:underline} attribute of face @var{face}.
1573@end defun
1574
1575@defun face-inverse-video-p face &optional frame
1576This function returns the @code{:inverse-video} attribute of face @var{face}.
1577@end defun
1578
1579@node Merging Faces
1580@subsection Merging Faces for Display
1581
1582 Here are the ways to specify which faces to use for display of text:
1583
1584@itemize @bullet
1585@item
1586With defaults. The @code{default} face is used as the ultimate
1587default for all text. (In Emacs 19 and 20, the @code{default}
1588face is used only when no other face is specified.)
1589
1590For a mode line or header line, the face @code{modeline} or
1591@code{header-line} is used just before @code{default}.
1592
1593@item
1594With text properties. A character can have a @code{face} property; if
1595so, the faces and face attributes specified there apply. @xref{Special
1596Properties}.
1597
1598If the character has a @code{mouse-face} property, that is used instead
1599of the @code{face} property when the mouse is ``near enough'' to the
1600character.
1601
1602@item
1603With overlays. An overlay can have @code{face} and @code{mouse-face}
1604properties too; they apply to all the text covered by the overlay.
1605
1606@item
1607With a region that is active. In Transient Mark mode, the region is
1608highlighted with the face @code{region} (@pxref{Standard Faces}).
1609
1610@item
1611With special glyphs. Each glyph can specify a particular face
1612number. @xref{Glyphs}.
1613@end itemize
1614
1615 If these various sources together specify more than one face for a
1616particular character, Emacs merges the attributes of the various faces
1617specified. The attributes of the faces of special glyphs come first;
1618then comes the face for region highlighting, if appropriate;
1619then come attributes of faces from overlays, followed by those from text
1620properties, and last the default face.
1621
1622 When multiple overlays cover one character, an overlay with higher
1623priority overrides those with lower priority. @xref{Overlays}.
1624
1625 In Emacs 20, if an attribute such as the font or a color is not
1626specified in any of the above ways, the frame's own font or color is
1627used. In newer Emacs versions, this cannot happen, because the
1628@code{default} face specifies all attributes---in fact, the frame's own
1629font and colors are synonymous with those of the default face.
1630
1631@node Font Selection
1632@subsection Font Selection
1633
1634 @dfn{Selecting a font} means mapping the specified face attributes for
1635a character to a font that is available on a particular display. The
1636face attributes, as determined by face merging, specify most of the
1637font choice, but not all. Part of the choice depends on what character
1638it is.
1639
1640 For multibyte characters, typically each font covers only one
1641character set. So each character set (@pxref{Character Sets}) specifies
1642a registry and encoding to use, with the character set's
1643@code{x-charset-registry} property. Its value is a string containing
1644the registry and the encoding, with a dash between them:
1645
1646@example
1647(plist-get (charset-plist 'latin-iso8859-1)
1648 'x-charset-registry)
1649 @result{} "ISO8859-1"
1650@end example
1651
1652 Unibyte text does not have character sets, so displaying a unibyte
1653character takes the registry and encoding from the variable
1654@code{face-default-registry}.
1655
1656@defvar face-default-registry
1657This variable specifies which registry and encoding to use in choosing
1658fonts for unibyte characters. The value is initialized at Emacs startup
1659time from the font the user specified for Emacs.
1660@end defvar
1661
1662 If the face specifies a fontset name, that fontset determines a
1663pattern for fonts of the given charset. If the face specifies a font
1664family, a font pattern is constructed.
1665
1666 Emacs tries to find an available font for the given face attributes
1667and character's registry and encoding. If there is a font that matches
1668exactly, it is used, of course. The hard case is when no available font
1669exactly fits the specification. Then Emacs looks for one that is
1670``close''---one attribute at a time. You can specify the order
1671to consider the attributes.
1672
1673@defvar face-font-selection-order
1674@tindex face-font-selection-order
1675This variable specifies the order of importance of the face attributes
1676@code{:width}, @code{:height}, @code{:weight}, and @code{:slant}. The
1677value should be a list containing those four symbols, in order of
1678decreasing importance.
1679
1680Font selection first finds the best available matches for the first
1681attribute listed; then, among the fonts which are best in that way, it
1682searches for the best matches in the second attribute, and so on.
1683
1684The attributes @code{:weight} and @code{:width} have symbolic values in
1685a range centered around @code{normal}. Matches that are more extreme
1686(farther from @code{normal}) are somewhat preferred to matches that are
1687less extreme (closer to @code{normal}); this is designed to ensure that
1688non-normal faces contrast with normal ones, whenever possible.
1689
1690The default is @code{(:width :height :weight :slant)}, which means first
1691find the fonts closest to the specified @code{:width}, then---among the
1692fonts with that width---find a best match for the specified font height,
1693and so on.
1694
1695One example of a case where this variable makes a difference is when the
1696default font has no italic equivalent. With the default ordering, the
1697@code{italic} face will use a non-italic font that is similar to the
1698default one. But if you put @code{:slant} before @code{:height}, the
1699@code{italic} face will use an italic font, even if its height is not
1700quite right.
1701@end defvar
1702
1703@defvar face-alternative-font-family-alist
1704@tindex face-alternative-font-family-alist
1705This variable lets you specify alternative font families to try, if a
1706given family is specified and doesn't exist. Each element should have
1707this form:
1708
1709@example
1710(@var{family} @var{alternate-families}@dots{})
1711@end example
1712
1713If @var{family} is specified but not available, Emacs will try the other
1714families given in @var{alternate-families}, one by one, until it finds a
1715family that does exist.
1716@end defvar
1717
1718 Emacs can make use of scalable fonts, but by default it does not use
1719them, since the use of too many or too big scalable fonts can crash
1720XFree86 servers.
1721
1722@defvar scalable-fonts-allowed
1723@tindex scalable-fonts-allowed
1724This variable controls which scalable fonts to use. A value of
1725@code{nil}, the default, means do not use scalable fonts. @code{t}
1726means to use any scalable font that seems appropriate for the text.
1727
1728Otherwise, the value must be a list of regular expressions. Then a
1729scalable font is enabled for use if its name matches any regular
1730expression in the list. For example,
1731
1732@example
1733(setq scalable-fonts-allowed '("muleindian-2$"))
1734@end example
1735
1736@noindent
1737allows the use of scalable fonts with registry @code{muleindian-2}.
1738@end example
1739
1740@defun clear-face-cache &optional unload-p
1741@tindex clear-face-cache
1742This function clears the face cache for all frames.
1743If @var{unload-p} is non-@code{nil}, that means to unload
1744all unused fonts as well.
1745@end defun
1746
1747@node Face Functions
1748@subsection Functions for Working with Faces
1749
1750 Here are additional functions for creating and working with faces.
1751
1752@defun make-face name
1753This function defines a new face named @var{name}, initially with all
1754attributes @code{nil}. It does nothing if there is already a face named
1755@var{name}.
1756@end defun
1757
1758@defun face-list
1759This function returns a list of all defined face names.
1760@end defun
1761
1762@defun copy-face old-face new-name &optional frame new-frame
1763This function defines the face @var{new-name} as a copy of the existing
1764face named @var{old-face}. It creates the face @var{new-name} if that
1765doesn't already exist.
1766
1767If the optional argument @var{frame} is given, this function applies
1768only to that frame. Otherwise it applies to each frame individually,
1769copying attributes from @var{old-face} in each frame to @var{new-face}
1770in the same frame.
1771
1772If the optional argument @var{new-frame} is given, then @code{copy-face}
1773copies the attributes of @var{old-face} in @var{frame} to @var{new-name}
1774in @var{new-frame}.
1308@end defun 1775@end defun
1309 1776
1310@defun face-id face 1777@defun face-id face
@@ -1329,22 +1796,801 @@ face if each attribute is either the same as that of the default face or
1329@code{nil} (meaning to inherit from the default). 1796@code{nil} (meaning to inherit from the default).
1330@end defun 1797@end defun
1331 1798
1332@defvar region-face
1333This variable's value specifies the face number to use to display characters
1334in the region when it is active (in Transient Mark mode only). The face
1335thus specified takes precedence over all faces that come from text
1336properties and overlays, for characters in the region. @xref{The Mark},
1337for more information about Transient Mark mode.
1338
1339Normally, the value is the face number of the face named @code{region}.
1340@end defvar
1341
1342@tindex frame-update-face-colors 1799@tindex frame-update-face-colors
1343@defun frame-update-face-colors frame 1800@defun frame-update-face-colors frame
1344This function updates the way faces display on @var{frame}, for a change 1801This function updates the way faces display on @var{frame}, for a change
1345in @var{frame}'s foreground or background color. 1802in @var{frame}'s foreground or background color.
1346@end defun 1803@end defun
1347 1804
1805@node Auto Faces
1806@subsection Automatic Face Assignment
1807@cindex automatic face assignment
1808@cindex faces, automatic choice
1809
1810@cindex Font-Lock mode
1811 Starting with Emacs 21, a hook is available for automatically
1812assigning faces to text in the buffer. This hook is used for part of
1813the implementation of Font-Lock mode.
1814
1815@tindex fontification-functions
1816@defvar fontification-functions
1817This variable holds a list of functions that are called by Emacs
1818redisplay as needed to assign faces automatically to text in the buffer.
1819
1820The functions are called in the order listed, with one argument, a
1821buffer position @var{pos}. Each function should attempt to assign faces
1822to the text in the current buffer starting at @var{pos}.
1823
1824Each function should record the faces they assign by setting the
1825@code{face} property. It should also add a non-@code{nil}
1826@code{fontified} property for all the text it has assigned faces to.
1827That property tells redisplay that faces have been assigned to that text
1828already.
1829
1830It is probably a good idea for each function to do nothing if the
1831character after @var{pos} already has a non-@code{nil} @code{fontified}
1832property, but this is not required. If one function overrides the
1833assignments made by a previous one, the properties as they are
1834after the last function finishes are the ones that really matter.
1835
1836For efficiency, we recommend writing these functions so that they
1837usually assign faces to around 400 to 600 characters at each call.
1838@end defvar
1839
1840@node Font Lookup
1841@subsection Looking Up Fonts
1842
1843@defun x-list-fonts pattern &optional face frame maximum
1844This function returns a list of available font names that match
1845@var{pattern}. If the optional arguments @var{face} and @var{frame} are
1846specified, then the list is limited to fonts that are the same size as
1847@var{face} currently is on @var{frame}.
1848
1849The argument @var{pattern} should be a string, perhaps with wildcard
1850characters: the @samp{*} character matches any substring, and the
1851@samp{?} character matches any single character. Pattern matching
1852of font names ignores case.
1853
1854If you specify @var{face} and @var{frame}, @var{face} should be a face name
1855(a symbol) and @var{frame} should be a frame.
1856
1857The optional argument @var{maximum} sets a limit on how many fonts to
1858return. If this is non-@code{nil}, then the return value is truncated
1859after the first @var{maximum} matching fonts. Specifying a small value
1860for @var{maximum} can make this function much faster, in cases where
1861many fonts match the pattern.
1862@end defun
1863
1864 These additional functions are available starting in Emacs 21.
1865
1866@defun x-family-fonts &optional family frame
1867@tindex x-family-fonts
1868This function returns a list describing the available fonts for family
1869@var{family} on @var{frame}. If @var{family} is omitted or @code{nil},
1870this list applies to all families, and therefore, it contains all
1871available fonts. Otherwise, @var{family} must be a string; it may
1872contain the wildcards @samp{?} and @samp{*}.
1873
1874The list describes the display that @var{frame} is on; if @var{frame} is
1875omitted or @code{nil}, it applies to the selected frame's display.
1876
1877The list contains a vector of the following form for each font:
1878
1879@example
1880[@var{family} @var{width} @var{point-size} @var{weight} @var{slant}
1881 @var{fixed-p} @var{full} @var{registry-and-encoding}]
1882@end example
1883
1884The first five elements correspond to face attributes; if you
1885specify these attributes for a face, it will use this font.
1886
1887The last three elements give additional information about the font.
1888@var{fixed-p} is non-nil if the font is fixed-pitch. @var{full} is the
1889full name of the font, and @var{registry-and-encoding} is a string
1890giving the registry and encoding of the font.
1891
1892The result list is sorted according to the current face font sort order.
1893@end defun
1894
1895@defun x-font-family-list &optional frame
1896@tindex x-font-family-list
1897This function returns a list of the font families available for
1898@var{frame}'s display. If @var{frame} is omitted or @code{nil}, it
1899describes the selected frame's display.
1900
1901The value is a list of elements of this form:
1902
1903@example
1904(@var{family} . @var{fixed-p})
1905@end example
1906
1907@noindent
1908Here @var{family} is a font family, and @var{fixed-p} is
1909non-@code{nil} if fonts of that family are fixed-pitch.
1910@end defun
1911
1912@defvar font-list-limit
1913@tindex font-list-limit
1914This variable specifies maximum number of fonts to consider in font
1915matching. The function @code{x-family-fonts} will not return more than
1916that many fonts, and font selection will consider only that many fonts
1917when searching a matching font for face attributes. The default is
1918currently 100.
1919@end defvar
1920
1921@node Fontsets
1922@subsection Fontsets
1923
1924 A @dfn{fontset} is a list of fonts, each assigned to a range of
1925character codes. An individual font cannot display the whole range of
1926characters that Emacs supports, but a fontset can. Fontsets have names,
1927just as fonts do, and you can use a fontset name in place of a font name
1928when you specify the ``font'' for a frame or a face. Here is
1929information about defining a fontset under Lisp program control.
1930
1931@defun create-fontset-from-fontset-spec fontset-spec &optional style-variant-p noerror
1932This function defines a new fontset according to the specification
1933string @var{fontset-spec}. The string should have this format:
1934
1935@smallexample
1936@var{fontpattern}, @r{[}@var{charsetname}:@var{fontname}@r{]@dots{}}
1937@end smallexample
1938
1939@noindent
1940Whitespace characters before and after the commas are ignored.
1941
1942The first part of the string, @var{fontpattern}, should have the form of
1943a standard X font name, except that the last two fields should be
1944@samp{fontset-@var{alias}}.
1945
1946The new fontset has two names, one long and one short. The long name is
1947@var{fontpattern} in its entirety. The short name is
1948@samp{fontset-@var{alias}}. You can refer to the fontset by either
1949name. If a fontset with the same name already exists, an error is
1950signaled, unless @var{noerror} is non-@code{nil}, in which case this
1951function does nothing.
1952
1953If optional argument @var{style-variant-p} is non-@code{nil}, that says
1954to create bold, italic and bold-italic variants of the fontset as well.
1955These variant fontsets do not have a short name, only a long one, which
1956is made by altering @var{fontpattern} to indicate the bold or italic
1957status.
1958
1959The specification string also says which fonts to use in the fontset.
1960See below for the details.
1961@end defun
1962
1963 The construct @samp{@var{charset}:@var{font}} specifies which font to
1964use (in this fontset) for one particular character set. Here,
1965@var{charset} is the name of a character set, and @var{font} is the font
1966to use for that character set. You can use this construct any number of
1967times in the specification string.
1968
1969 For the remaining character sets, those that you don't specify
1970explicitly, Emacs chooses a font based on @var{fontpattern}: it replaces
1971@samp{fontset-@var{alias}} with a value that names one character set.
1972For the @sc{ascii} character set, @samp{fontset-@var{alias}} is replaced
1973with @samp{ISO8859-1}.
1974
1975 In addition, when several consecutive fields are wildcards, Emacs
1976collapses them into a single wildcard. This is to prevent use of
1977auto-scaled fonts. Fonts made by scaling larger fonts are not usable
1978for editing, and scaling a smaller font is not useful because it is
1979better to use the smaller font in its own size, which Emacs does.
1980
1981 Thus if @var{fontpattern} is this,
1982
1983@example
1984-*-fixed-medium-r-normal-*-24-*-*-*-*-*-fontset-24
1985@end example
1986
1987@noindent
1988the font specification for ASCII characters would be this:
1989
1990@example
1991-*-fixed-medium-r-normal-*-24-*-ISO8859-1
1992@end example
1993
1994@noindent
1995and the font specification for Chinese GB2312 characters would be this:
1996
1997@example
1998-*-fixed-medium-r-normal-*-24-*-gb2312*-*
1999@end example
2000
2001 You may not have any Chinese font matching the above font
2002specification. Most X distributions include only Chinese fonts that
2003have @samp{song ti} or @samp{fangsong ti} in the @var{family} field. In
2004such a case, @samp{Fontset-@var{n}} can be specified as below:
2005
2006@smallexample
2007Emacs.Fontset-0: -*-fixed-medium-r-normal-*-24-*-*-*-*-*-fontset-24,\
2008 chinese-gb2312:-*-*-medium-r-normal-*-24-*-gb2312*-*
2009@end smallexample
2010
2011@noindent
2012Then, the font specifications for all but Chinese GB2312 characters have
2013@samp{fixed} in the @var{family} field, and the font specification for
2014Chinese GB2312 characters has a wild card @samp{*} in the @var{family}
2015field.
2016
2017@node Display Property
2018@section The @code{display} Property
2019@cindex display specification
2020@kindex display @r{(text property)}
2021
2022 The @code{display} text property is used to insert images into text,
2023and also control other aspects of how text displays. These features are
2024available starting in Emacs 21. The value of the @code{display}
2025property should be a display specification, or a list or vector
2026containing several display specifications. The rest of this section
2027describes several kinds of display specifications and what they mean.
2028
2029@menu
2030* Specified Space::
2031* Other Display Specs::
2032* Display Margins::
2033* Conditional Display::
2034@end menu
2035
2036@node Specified Space
2037@subsection Specified Spaces
2038@cindex spaces, specified height or width
2039@cindex specified spaces
2040@cindex variable-width spaces
2041
2042 To display a space of specified width and/or height, use a display
2043specification of the form @code{(space @var{props})}, where @var{props}
2044is a property list (see below). You can put this property on one or
2045more consecutive characters; a space of the specified height and width
2046is displayed in place of @emph{all} of those characters.
2047
2048@table @code
2049@item :width @var{width}
2050Specifies that the space width should be @var{width} times the normal
2051character width. @var{width} can be an integer or floating point
2052number.
2053
2054@item :relative-width @var{factor}
2055Specifies that the width of the stretch should be computed from the
2056first character in the group of consecutive characters that have the
2057same @code{display} property. The space width is the width of that
2058character, multiplied by @var{factor}.
2059
2060@item :align-to @var{hpos}
2061Specifies that the space should be wide enough to reach @var{hpos}. The
2062value @var{hpos} is measured in units of the normal character width.
2063@end table
2064
2065 Exactly one of the above properties should be used. You can also
2066specify the height of the space, with other properties:
2067
2068@table @code
2069@item :height @var{height}
2070Specifies the height of the space, as @var{height},
2071measured in terms of the normal line height.
2072
2073@item :relative-height @var{factor}
2074Specifies the height of the space, multiplying the ordinary height
2075of the text having this display specification by @var{factor}.
2076
2077@item :ascent @var{ascent}
2078Specifies that @var{ascent} percent of the height of the space should be
2079considered as the ascent of the space. The value of @var{ascent} must
2080be a non-negative number no greater than 100.
2081@end table
2082
2083 You should not use both @code{:height} and @code{:relative-height}
2084together.
2085
2086@node Other Display Specs
2087@subsection Other Display Specifications
2088
2089@table @code
2090@item (image . @var{image-props})
2091This is in fact an image descriptor (@pxref{Images}). When used as a
2092display specification, it means to display the image instead of the text
2093that has the display specification.
2094
2095@item (space-width @var{factor})
2096This display specification affects all the spaces in the text that has
2097the specification. It displays all of these spaces @var{factor} times
2098as wide as normal. The element @var{factor} should be an integer or
2099float.
2100
2101@item (height @var{height})
2102This display specification makes the text taller or shorter.
2103Here are the possibilities for @var{height}:
2104
2105@table @asis
2106@item @code{(+ @var{n})}
2107This means to use a font that is @var{n} steps larger. A ``step'' is
2108defined by the set of available fonts; each size for which a font is
2109available counts as a step. @var{n} should be an integer.
2110
2111@item @code{(- @var{n})}
2112This means to use a font that is @var{n} steps smaller.
2113
2114@item a number, @var{factor}
2115A number, @var{factor}, means to use a font that is @var{factor} times
2116as tall as the default font.
2117
2118@item a symbol, @var{function}
2119A symbol is a function to compute the height. It is called with the
2120current height as argument, and should return the new height to use.
2121
2122@item anything else, @var{form}
2123If the @var{height} value doesn't fit the previous possibilities, it is
2124a form. Emacs evaluates it to get the new height, with the symbol
2125@code{height} bound to the current specified font height.
2126@end table
2127
2128@item (raise @var{factor})
2129This kind of display specification raises or lowers the text
2130it applies to, relative to the baseline of the line.
2131
2132@var{factor} must be a number, which is interpreted as a multiple of the
2133height of the affected text. If it is positive, that means to display
2134the characters raised. If it is negative, that means to display them
2135lower down.
2136
2137If the text also has a @code{height} display specification, that does
2138not affect the amount of raising or lowering, which is based on the
2139faces used for the text.
2140@end table
2141
2142@node Display Margins
2143@subsection Displaying in the Margins
2144@cindex display margins
2145@cindex margins, display
2146
2147 A buffer can have blank areas called @dfn{display margins} on the left
2148and on the right. Ordinary text never appears in these areas, but you
2149can put things into the display margins using the @code{display}
2150property.
2151
2152 To put text in the left or right display margin of the window, use a
2153display specification of the form @code{(margin right-margin)} or
2154@code{(margin left-margin)} on it. To put an image in a display margin,
2155use that display specification along with the display specification for
2156the image.
2157
2158 Before the display margins can display anything, you must give
2159them a nonzero width. The usual way to do that is to set these
2160variables:
2161
2162@defvar left-margin-width
2163@tindex left-margin-width
2164This variable specifies the width of the left margin.
2165It is buffer-local in all buffers.
2166@end defvar
2167
2168@defvar right-margin-width
2169@tindex right-margin-width
2170This variable specifies the width of the right margin.
2171It is buffer-local in all buffers.
2172@end defvar
2173
2174 Setting these variables does not immediately affect the window. These
2175variables are checked when a new buffer is displayed in the window.
2176Thus, you can make changes take effect by calling
2177@code{set-window-buffer}.
2178
2179 You can also set the margin widths immediately.
2180
2181@defun set-window-margins window left right
2182@tindex set-window-margins
2183This function specifies the margin widths for window @var{window}.
2184The argument @var{left} controls the left margin and
2185@var{right} controls the right margin.
2186@end defun
2187
2188@defun window-margins &optional window
2189@tindex window-margins
2190This function returns the left and right margins of @var{window}
2191as a cons cell of the form @code{(@var{left} . @var{right})}.
2192If @var{window} is @code{nil}, the selected window is used.
2193@end defun
2194
2195@node Conditional Display
2196@subsection Conditional Display Specifications
2197@cindex conditional display specifications
2198
2199 You can make any display specification conditional. To do that,
2200package it in another list of the form @code{(when @var{condition}
2201@var{spec})}. Then the specification @var{spec} applies only when
2202@var{condition} evaluates to a non-@code{nil} value. During the
2203evaluation, point is temporarily set at the end position of the text
2204having this conditional display specification.
2205
2206@node Images
2207@section Images
2208@cindex images in buffers
2209
2210 To display an image in an Emacs buffer, you must first create an image
2211descriptor, then use it as a display specifier in the @code{display}
2212property of text that is displayed (@pxref{Display Property}). Like the
2213@code{display} property, this feature is available starting in Emacs 21.
2214
2215 Emacs can display a number of different image formats; some of them
2216are supported only if particular support libraries are installed on your
2217machine. The supported image formats include XBM, XPM (needing the
2218libraries @code{libXpm} version 3.4k and @code{libz}), GIF (needing
2219@code{libungif} 4.1.0), Postscript, PBM, JPEG (needing the
2220@code{libjpeg} library version v6a), TIFF (needing @code{libtiff} v3.4),
2221and PNG (needing @code{libpng} 1.0.2).
2222
2223 You specify one of these formats with an image type symbol. The image
2224type symbols are @code{xbm}, @code{xpm}, @code{gif}, @code{postscript},
2225@code{pbm}, @code{jpeg}, @code{tiff}, and @code{png}.
2226
2227@defvar image-types
2228This variable contains a list of those image type symbols that are
2229supported in the current configuration.
2230@end defvar
2231
2232@menu
2233* Image Descriptors::
2234* XBM Images::
2235* XPM Images::
2236* GIF Images::
2237* Postscript Images::
2238* Other Image Types::
2239* Defining Images::
2240* Showing Images::
2241* Image Cache::
2242@end menu
2243
2244@node Image Descriptors
2245@subsection Image Descriptors
2246@cindex image descriptor
2247
2248 An image description is a list of the form @code{(image
2249. @var{props})}, where @var{props} is a property list containing
2250alternating keyword symbols (symbols whose names start with a colon) and
2251their values. Every image descriptor must contain the property
2252@code{:type @var{type}} to specify the format of the image. The value
2253of @var{type} should be an image type symbol; for example, @code{xpm}
2254for an image in XPM format.
2255
2256 Here is a list of other properties that are meaningful for all image
2257types:
2258
2259@table @code
2260@item :ascent @var{ascent}
2261The @code{:ascent} property specifies the percentage of the image's
2262height to use for its ascent---that is, the part above the baseline. The
2263value, @var{ascent}, must be a number in the range 0 to 100. If this
2264property is omitted, it defaults to 50.
2265
2266@item :margin @var{margin}
2267The @code{:margin} property specifies how many pixels to add as an extra
2268margin around the image. The value, @var{margin}, must be a
2269non-negative number; if it is not specified, the default is zero.
2270
2271@item :relief @var{relief}
2272The @code{:relief} property, if non-@code{nil}, adds a shadow rectangle
2273around the image. The value, @var{relief}, specifies the width of the
2274shadow lines, in pixels. If @var{relief} is negative, shadows are drawn
2275so that the image appears as a pressed button; otherwise, it appears as
2276an unpressed button.
2277
2278@item :algorithm @var{algorithm}
2279The @code{:algorithm} property, if non-@code{nil}, specifies a
2280conversion algorithm that should be applied to the image before it is
2281displayed; the value, @var{algorithm}, specifies which algorithm.
2282
2283Currently, the only meaningful value for @var{algorithm} (aside from
2284@code{nil}) is @code{laplace}; this applies the Laplace edge detection
2285algorithm, which blurs out small differences in color while highlighting
2286larger differences. People sometimes consider this useful for
2287displaying the image for a ``disabled'' button.
2288
2289@item :heuristic-mask @var{transparent-color}
2290The @code{:heuristic-mask} property, if non-@code{nil}, specifies that a
2291certain color in the image should be transparent. Each pixel where this
2292color appears will actually allow the frame's background to show
2293through.
2294
2295If @var{transparent-color} is @code{t}, then determine the transparent
2296color by looking at the four corners of the image. This uses the color
2297that occurs most frequently near the corners as the transparent color.
2298
2299Otherwise, @var{heuristic-mask} should specify the transparent color
2300directly, as a list of three integers in the form @code{(@var{red}
2301@var{green} @var{blue})}.
2302
2303@item :file @var{file}
2304The @code{:file} property specifies to load the image from file
2305@var{file}. If @var{file} is not an absolute file name, it is expanded
2306in @code{data-directory}.
2307
2308@item :data @var{data}
2309The @code{:data} property specifies the actual contents of the image.
2310Each image must use either @code{:data} or @code{:file}, but not both.
2311However, only certain image types support @code{:data}; for other types,
2312you must use @code{:file}.
2313
2314The formats that support @code{:data} include XBM and XPM.
2315Before using @code{:data}, see the section describing the specific
2316format you wish to use for further information.
2317@end table
2318
2319@node XBM Images
2320@subsection XBM Images
2321@cindex XBM
2322
2323 To use XBM format, specify @code{xbm} as the image type. This image
2324format doesn't require an external library, so images of this type are
2325always supported.
2326
2327 Additional image properties supported for the @code{xbm} image type are:
2328
2329@table @code
2330@item :foreground @var{foreground}
2331The value, @var{foreground}, should be a string specifying the image
2332foreground color. This color is used for each pixel in the XBM that is
23331. The default is the frame's foreground color.
2334
2335@item :background @var{background}
2336The value, @var{background}, should be a string specifying the image
2337background color. This color is used for each pixel in the XBM that is
23380. The default is the frame's background color.
2339@end table
2340
2341 You can specify an XBM image using data within Emacs instead
2342of an external file. To do this, don't use @code{:file}; instead,
2343use the following three properties (all of them):
2344
2345@table @code
2346@item :width @var{width}
2347The value, @var{width}, specifies the width the image in pixels.
2348
2349@item :height @var{height}
2350The value, @var{height}, specifies the height of the image in pixels.
2351
2352@item :data @var{data}
2353The value, @var{data}, is normally a string or a bool-vector. Either
2354way, it must contain enough bits for the area of the image: at least
2355@var{width} * @code{height}.
2356
2357Alternatively, @var{data} can be a vector of strings or bool-vectors,
2358each specifying one line of the image.
2359@end table
2360
2361@node XPM Images
2362@subsection XPM Images
2363@cindex XPM
2364
2365 To use XPM format, specify @code{xpm} as the image type. These
2366additional image properties are meaningful with the @code{xpm} image
2367type:
2368
2369@table @code
2370@item :color-symbols @var{symbols}
2371The value, @var{symbols}, should be an alist whose elements have the
2372form @code{(@var{name} . @var{color})}. In each element, @var{name} is
2373the name of a color as it appears in the image file, and @var{color}
2374specifies the actual color to use for displaying that name.
2375
2376@item :data @var{data}
2377XPM images can be displayed from data instead of files. In that case,
2378use the @code{:data} property instead of the @code{:file} property.
2379
2380The value @var{data} must be a string containing an XPM image. The
2381contents of the string have same format as an external XPM file.
2382@end table
2383
2384@node GIF Images
2385@subsection GIF Images
2386@cindex GIF
2387
2388 For GIF images, specify image type @code{gif}. Because of the patents
2389in the US covering the LZW algorithm, the continued use of GIF format is
2390a problem for the whole Internet; to end this problem, it is a good idea
2391for everyone, even outside the US, to stop using GIFS right away
2392(@uref{http://www.burnallgifs.org/}). But if you still want to use
2393them, Emacs can display them.
2394
2395@table @code
2396@item :index @var{index}
2397You can use @code{:index} to specify one image from a GIF file that
2398contains more than one image. This property specifies use of image
2399number @var{index} from the file. An error is signaled if the GIF file
2400doesn't contain an image with index @var{index}.
2401@end table
2402
2403@ignore
2404This could be used to implement limited support for animated GIFs.
2405For example, the following function displays a multi-image GIF file
2406at point-min in the current buffer, switching between sub-images
2407every 0.1 seconds.
2408
2409(defun show-anim (file max)
2410 "Display multi-image GIF file FILE which contains MAX subimages."
2411 (display-anim (current-buffer) file 0 max t))
2412
2413(defun display-anim (buffer file idx max first-time)
2414 (when (= idx max)
2415 (setq idx 0))
2416 (let ((img (create-image file nil :image idx)))
2417 (save-excursion
2418 (set-buffer buffer)
2419 (goto-char (point-min))
2420 (unless first-time (delete-char 1))
2421 (insert-image img))
2422 (run-with-timer 0.1 nil 'display-anim buffer file (1+ idx) max nil)))
2423@end ignore
2424
2425@node Postscript Images
2426@subsection Postscript Images
2427@cindex Postscript images
2428
2429 To use Postscript for an image, specify image type @code{postscript}.
2430This works only if you have Ghostscript installed. You must always use
2431these three properties:
2432
2433@table @code
2434@item :pt-width @var{width}
2435The value, @var{width}, specifies the width of the image measured in
2436points (1/72 inch). @var{width} must be an integer.
2437
2438@item :pt-height @var{height}
2439The value, @var{height}, specifies the height of the image in points
2440(1/72 inch). @var{height} must be an integer.
2441
2442@item :bounding-box @var{box}
2443The value, @var{box}, must be a list or vector of four integers, which
2444specifying the bounding box of the Postscript image, analogous to the
2445@samp{BoundingBox} comment found in Postscript files.
2446
2447@example
2448%%BoundingBox: 22 171 567 738
2449@end example
2450@end table
2451
2452@node Other Image Types
2453@subsection Other Image Types
2454@cindex PBM
2455
2456 For PBM images, specify image type @code{pbm}. Color, gray-scale and
2457monochromatic images are supported.
2458
2459 For JPEG images, specify image type @code{jpeg}. There are no
2460additional image properties defined.
2461
2462 For TIFF images, specify image type @code{tiff}.
2463
2464 For PNG images, specify image type @code{png}.
2465
2466@node Defining Images
2467@subsection Defining Images
2468
2469 The functions @code{create-image} and @code{defimage} provide
2470convenient ways to create image descriptors.
2471
2472@defun create-image file &optional type &rest props
2473@tindex create-image
2474This function creates and returns an image descriptor which uses the
2475data in @var{file}.
2476
2477The optional argument @var{type} is a symbol specifying the image type.
2478If @var{type} is omitted or @code{nil}, @code{create-image} tries to
2479determine the image type from the file's first few bytes, or else
2480from the file's name.
2481
2482The remaining arguments, @var{props}, specify additional image
2483properties---for example,
2484
2485@example
2486(create-image "foo.xpm" 'xpm :heuristic-mask t)
2487@end example
2488
2489The function returns @code{nil} if images of this type are not
2490supported. Otherwise it returns an image descriptor.
2491@end defun
2492
2493@defmac defimage variable doc &rest specs
2494@tindex defimage
2495This macro defines @var{variable} as an image name. The second argument,
2496@var{doc}, is an optional documentation string. The remaining
2497arguments, @var{specs}, specify alternative ways to display the image.
2498
2499Each argument in @var{specs} has the form of a property list, and each
2500one should specify at least the @code{:type} property and the
2501@code{:file} property. Here is an example:
2502
2503@smallexample
2504(defimage test-image ((:type xpm :file \"~/test1.xpm\")
2505 (:type xbm :file \"~/test1.xbm\")))"
2506@end smallexample
2507
2508@code{defimage} tests each argument, one by one, to see if it is
2509usable---that is, if the type is supported and the file exists. The
2510first usable argument is used to make an image descriptor which is
2511stored in the variable @var{variable}.
2512
2513If none of the alternatives will work, then @var{variable} is defined
2514as @code{nil}.
2515@end defmac
2516
2517@node Showing Images
2518@subsection Showing Images
2519
2520 You can use an image descriptor by setting up the @code{display}
2521property yourself, but it is easier to use the functions in this
2522section.
2523
2524@defun insert-image image &optional area
2525This function inserts @var{image} in the current buffer at point. The
2526value @var{image} should be an image descriptor; it could be a value
2527returned by @code{create-image}, or the value of a symbol defined with
2528@code{defimage}.
2529
2530The argument @var{area} specifies whether to put the image in a margin.
2531If it is @code{left-margin}, the image appears in the left margin;
2532@code{right-margin} specifies the right margin. If @var{area} is
2533@code{nil} or omitted, the image is displayed at point within the
2534buffer's text.
2535
2536Internally, this function inserts an @samp{x} in the buffer, and gives
2537it a @code{display} property which specifies this image. @xref{Display
2538Property}.
2539@end defun
2540
2541@defun put-image image pos &optional area
2542This function puts image @var{image} in front of @var{pos} in the
2543current buffer. The argument @var{pos} should be an integer or a
2544marker. It specifies the buffer position where the image should appear.
2545
2546The argument @var{image} must be an image descriptor, perhaps returned
2547by @code{create-image} or stored by @code{defimage}.
2548
2549The argument @var{area} specifies whether to put the image in a margin.
2550If it is @code{left-margin}, the image appears in the left margin;
2551@code{right-margin} specifies the right margin. If @var{area} is
2552@code{nil} or omitted, the image is displayed at point within the
2553buffer's text.
2554
2555Internally, this function creates an overlay, and gives it a
2556@code{before-string} property containing text that has a @code{display}
2557property whose value is the image. (Whew!)
2558@end defun
2559
2560@defun remove-images start end &optional buffer
2561This function removes images in @var{buffer} between positions
2562@var{start} and @var{end}. If @var{buffer} is omitted or @code{nil},
2563images are removed from the current buffer.
2564
2565This remove only images that were put into @var{buffer} the way
2566@code{put-image} does it, not images that were inserted with
2567@code{insert-image} or in other ways.
2568@end defun
2569
2570@node Image Cache
2571@subsection Image Cache
2572
2573 Emacs stores images in an image cache when it displays them, so it can
2574display them again more efficiently. It removes an image from the cache
2575when it hasn't been displayed for a specified period of time.
2576
2577@defvar image-cache-eviction-delay
2578@tindex image-cache-eviction-delay
2579This variable specifies the number of seconds an image can remain in the
2580cache without being displayed. When an image is not displayed for this
2581length of time, Emacs removes it from the image cache.
2582
2583If the value is @code{nil}, Emacs does not remove images from the cache
2584except when you explicitly clear it. This mode can be useful for
2585debugging.
2586@end defvar
2587
2588@defun clear-image-cache &optional frame
2589@tindex clear-image-cache
2590This function clears the image cache. If @var{frame} is non-@code{nil},
2591only the cache for that frame is cleared. Otherwise all frames' caches
2592are cleared.
2593@end defun
1348@node Blinking 2594@node Blinking
1349@section Blinking Parentheses 2595@section Blinking Parentheses
1350@cindex parenthesis matching 2596@cindex parenthesis matching
@@ -1451,13 +2697,19 @@ Character code 10 is a newline.
1451All other codes in the range 0 through 31, and code 127, display in one 2697All other codes in the range 0 through 31, and code 127, display in one
1452of two ways according to the value of @code{ctl-arrow}. If it is 2698of two ways according to the value of @code{ctl-arrow}. If it is
1453non-@code{nil}, these codes map to sequences of two glyphs, where the 2699non-@code{nil}, these codes map to sequences of two glyphs, where the
1454first glyph is the @sc{ASCII} code for @samp{^}. (A display table can 2700first glyph is the @sc{ascii} code for @samp{^}. (A display table can
1455specify a glyph to use instead of @samp{^}.) Otherwise, these codes map 2701specify a glyph to use instead of @samp{^}.) Otherwise, these codes map
1456just like the codes in the range 128 to 255. 2702just like the codes in the range 128 to 255.
1457 2703
2704On MS-DOS terminals, Emacs arranges by default for the character code
2705127 to be mapped to the glyph code 127, which normally displays as an
2706empty polygon. This glyph is used to display non-@sc{ascii} characters
2707that the MS-DOS terminal doesn't support. @xref{MS-DOS and MULE,,,
2708emacs, The GNU Emacs Manual}.
2709
1458@item 2710@item
1459Character codes 128 through 255 map to sequences of four glyphs, where 2711Character codes 128 through 255 map to sequences of four glyphs, where
1460the first glyph is the @sc{ASCII} code for @samp{\}, and the others are 2712the first glyph is the @sc{ascii} code for @samp{\}, and the others are
1461digit characters representing the character code in octal. (A display 2713digit characters representing the character code in octal. (A display
1462table can specify a glyph to use instead of @samp{\}.) 2714table can specify a glyph to use instead of @samp{\}.)
1463 2715
@@ -1511,11 +2763,11 @@ stops used by the command @code{tab-to-tab-stop}. @xref{Indent Tabs}.
1511@cindex display table 2763@cindex display table
1512You can use the @dfn{display table} feature to control how all possible 2764You can use the @dfn{display table} feature to control how all possible
1513character codes display on the screen. This is useful for displaying 2765character codes display on the screen. This is useful for displaying
1514European languages that have letters not in the @sc{ASCII} character 2766European languages that have letters not in the @sc{ascii} character
1515set. 2767set.
1516 2768
1517The display table maps each character code into a sequence of 2769The display table maps each character code into a sequence of
1518@dfn{glyphs}, each glyph being an image that takes up one character 2770@dfn{glyphs}, each glyph being a graphic that takes up one character
1519position on the screen. You can also define how to display each glyph 2771position on the screen. You can also define how to display each glyph
1520on your terminal, using the @dfn{glyph table}. 2772on your terminal, using the @dfn{glyph table}.
1521 2773
@@ -1557,9 +2809,14 @@ means to use the default for that slot, as stated below.
1557@table @asis 2809@table @asis
1558@item 0 2810@item 0
1559The glyph for the end of a truncated screen line (the default for this 2811The glyph for the end of a truncated screen line (the default for this
1560is @samp{$}). @xref{Glyphs}. 2812is @samp{$}). @xref{Glyphs}. Newer Emacs versions, on some platforms,
2813display arrows to indicate truncation---the display table has no effect
2814in these situations.
1561@item 1 2815@item 1
1562The glyph for the end of a continued line (the default is @samp{\}). 2816The glyph for the end of a continued line (the default is @samp{\}).
2817Newer Emacs versions, on some platforms, display curved arrows to
2818indicate truncation---the display table has no effect in these
2819situations.
1563@item 2 2820@item 2
1564The glyph for indicating a character displayed as an octal character 2821The glyph for indicating a character displayed as an octal character
1565code (the default is @samp{\}). 2822code (the default is @samp{\}).
@@ -1570,7 +2827,9 @@ A vector of glyphs for indicating the presence of invisible lines (the
1570default is @samp{...}). @xref{Selective Display}. 2827default is @samp{...}). @xref{Selective Display}.
1571@item 5 2828@item 5
1572The glyph used to draw the border between side-by-side windows (the 2829The glyph used to draw the border between side-by-side windows (the
1573default is @samp{|}). @xref{Splitting Windows}. 2830default is @samp{|}). @xref{Splitting Windows}. This takes effect only
2831when there are no scroll bars; if scroll bars are supported and in use,
2832a scroll bar separates the two windows.
1574@end table 2833@end table
1575 2834
1576 For example, here is how to construct a display table that mimics the 2835 For example, here is how to construct a display table that mimics the
@@ -1604,6 +2863,18 @@ This function stores @var{value} in the extra slot @var{slot} of
1604@code{selective-display}, and @code{vertical-border}. 2863@code{selective-display}, and @code{vertical-border}.
1605@end defun 2864@end defun
1606 2865
2866@defun describe-display-table display-table
2867@tindex describe-display-table
2868This function displays a description of the display table
2869@var{display-table} in a help buffer.
2870@end defun
2871
2872@deffn Command describe-current-display-table
2873@tindex describe-current-display-table
2874This command displays a description of the current display table in a
2875help buffer.
2876@end deffn
2877
1607@node Active Display Table 2878@node Active Display Table
1608@subsection Active Display Table 2879@subsection Active Display Table
1609@cindex active display table 2880@cindex active display table
@@ -1645,6 +2916,9 @@ if the window specifies none, its buffer specifies none, and
1645display conventions for all character codes in that window. @xref{Usual 2916display conventions for all character codes in that window. @xref{Usual
1646Display}. 2917Display}.
1647 2918
2919A number of functions for changing the standard display table
2920are defined in the library @file{disp-table}.
2921
1648@node Glyphs 2922@node Glyphs
1649@subsection Glyphs 2923@subsection Glyphs
1650 2924
@@ -1694,6 +2968,12 @@ $2^{19}$.)
1694 If a glyph code is greater than or equal to the length of the glyph 2968 If a glyph code is greater than or equal to the length of the glyph
1695table, that code is automatically simple. 2969table, that code is automatically simple.
1696 2970
2971@defun create-glyph string
2972@tindex create-glyph
2973This function returns a newly-allocated glyph code which is set up to
2974display by sending @var{string} to the terminal.
2975@end defun
2976
1697@node Beeping 2977@node Beeping
1698@section Beeping 2978@section Beeping
1699@cindex beeping 2979@cindex beeping
@@ -1747,9 +3027,11 @@ under. The possible values are
1747@cindex X Window System 3027@cindex X Window System
1748Emacs is displaying using X. 3028Emacs is displaying using X.
1749@item pc 3029@item pc
1750Emacs is displaying using MSDOS. 3030Emacs is displaying using MS-DOS.
1751@item w32 3031@item w32
1752Emacs is displaying using Windows NT or Windows 95. 3032Emacs is displaying using Windows NT or Windows 9x.
3033@item mac
3034Emacs is displaying using a Macintosh.
1753@item nil 3035@item nil
1754Emacs is using a character-based terminal. 3036Emacs is using a character-based terminal.
1755@end table 3037@end table
diff --git a/lispref/edebug.texi b/lispref/edebug.texi
index c40a70d753b..d06275bb9f7 100644
--- a/lispref/edebug.texi
+++ b/lispref/edebug.texi
@@ -66,9 +66,9 @@ enable you to use it.
66* Jumping:: Commands to jump to a specified place. 66* Jumping:: Commands to jump to a specified place.
67* Misc: Edebug Misc. Miscellaneous commands. 67* Misc: Edebug Misc. Miscellaneous commands.
68* Breakpoints:: Setting breakpoints to make the program stop. 68* Breakpoints:: Setting breakpoints to make the program stop.
69* Trapping Errors:: trapping errors with Edebug. 69* Trapping Errors:: Trapping errors with Edebug.
70* Views: Edebug Views. Views inside and outside of Edebug. 70* Views: Edebug Views. Views inside and outside of Edebug.
71* Eval: Edebug Eval. Evaluating expressions within Edebug. 71* Eval: Edebug Eval. Evaluating expressions within Edebug.
72* Eval List:: Expressions whose values are displayed 72* Eval List:: Expressions whose values are displayed
73 each time you enter Edebug. 73 each time you enter Edebug.
74* Printing in Edebug:: Customization of printing. 74* Printing in Edebug:: Customization of printing.
@@ -89,23 +89,23 @@ first move point into the definition of a function or macro and then do
89@ref{Instrumenting}, for alternative ways to instrument code. 89@ref{Instrumenting}, for alternative ways to instrument code.
90 90
91 Once a function is instrumented, any call to the function activates 91 Once a function is instrumented, any call to the function activates
92Edebug. Activating Edebug may stop execution and let you step through 92Edebug. Depending on which Edebug execution mode you have selected,
93the function, or it may update the display and continue execution while 93activating Edebug may stop execution and let you step through the
94checking for debugging commands, depending on which Edebug execution 94function, or it may update the display and continue execution while
95mode you have selected. The default execution mode is step, which does 95checking for debugging commands. The default execution mode is step,
96stop execution. @xref{Edebug Execution Modes}. 96which stops execution. @xref{Edebug Execution Modes}.
97 97
98 Within Edebug, you normally view an Emacs buffer showing the source of 98 Within Edebug, you normally view an Emacs buffer showing the source of
99the Lisp code you are debugging. This is referred to as the @dfn{source 99the Lisp code you are debugging. This is referred to as the @dfn{source
100code buffer}. This buffer is temporarily read-only. 100code buffer}, and is is temporarily read-only.
101 101
102 An arrow at the left margin indicates the line where the function is 102 An arrow at the left margin indicates the line where the function is
103executing. Point initially shows where within the line the function is 103executing. Point initially shows where within the line the function is
104executing, but this ceases to be true if you move point yourself. 104executing, but this ceases to be true if you move point yourself.
105 105
106 If you instrument the definition of @code{fac} (shown below) and then 106 If you instrument the definition of @code{fac} (shown below) and then
107execute @code{(fac 3)}, here is what you normally see. Point is at the 107execute @code{(fac 3)}, here is what you would normally see. Point is
108open-parenthesis before @code{if}. 108at the open-parenthesis before @code{if}.
109 109
110@example 110@example
111(defun fac (n) 111(defun fac (n)
@@ -118,7 +118,7 @@ open-parenthesis before @code{if}.
118The places within a function where Edebug can stop execution are called 118The places within a function where Edebug can stop execution are called
119@dfn{stop points}. These occur both before and after each subexpression 119@dfn{stop points}. These occur both before and after each subexpression
120that is a list, and also after each variable reference. 120that is a list, and also after each variable reference.
121Here we show with periods the stop points found in the function 121Here we use periods to show the stop points in the function
122@code{fac}: 122@code{fac}:
123 123
124@example 124@example
@@ -163,7 +163,7 @@ into it, to invoke Edebug at the proper places.
163argument on a definition, it instruments the definition before 163argument on a definition, it instruments the definition before
164evaluating it. (The source code itself is not modified.) If the 164evaluating it. (The source code itself is not modified.) If the
165variable @code{edebug-all-defs} is non-@code{nil}, that inverts the 165variable @code{edebug-all-defs} is non-@code{nil}, that inverts the
166meaning of the prefix argument: then @kbd{C-M-x} instruments the 166meaning of the prefix argument: in this case, @kbd{C-M-x} instruments the
167definition @emph{unless} it has a prefix argument. The default value of 167definition @emph{unless} it has a prefix argument. The default value of
168@code{edebug-all-defs} is @code{nil}. The command @kbd{M-x 168@code{edebug-all-defs} is @code{nil}. The command @kbd{M-x
169edebug-all-defs} toggles the value of the variable 169edebug-all-defs} toggles the value of the variable
@@ -188,10 +188,11 @@ instrument any top-level form regardless of the values of
188(@code{edebug-instrument-callee}) instruments the definition of the 188(@code{edebug-instrument-callee}) instruments the definition of the
189function or macro called by the list form after point, if is not already 189function or macro called by the list form after point, if is not already
190instrumented. This is possible only if Edebug knows where to find the 190instrumented. This is possible only if Edebug knows where to find the
191source for that function; after loading Edebug, @code{eval-region} 191source for that function; for this reading, after loading Edebug,
192records the position of every definition it evaluates, even if not 192@code{eval-region} records the position of every definition it
193instrumenting it. See also the @kbd{i} command (@pxref{Jumping}), which 193evaluates, even if not instrumenting it. See also the @kbd{i} command
194steps into the call after instrumenting the function. 194(@pxref{Jumping}), which steps into the call after instrumenting the
195function.
195 196
196@cindex special forms (Edebug) 197@cindex special forms (Edebug)
197@cindex interactive commands (Edebug) 198@cindex interactive commands (Edebug)
@@ -201,15 +202,16 @@ steps into the call after instrumenting the function.
201@pindex cl-specs.el 202@pindex cl-specs.el
202 Edebug knows how to instrument all the standard special forms, 203 Edebug knows how to instrument all the standard special forms,
203@code{interactive} forms with an expression argument, anonymous lambda 204@code{interactive} forms with an expression argument, anonymous lambda
204expressions, and other defining forms. Edebug cannot know what a 205expressions, and other defining forms. However, Edebug cannot determine
205user-defined macro will do with the arguments of a macro call, so you 206on its own what a user-defined macro will do with the arguments of a
206must tell it; see @ref{Instrumenting Macro Calls}, for details. 207macro call, so you must provide that information; see @ref{Instrumenting
208Macro Calls}, for details.
207 209
208 When Edebug is about to instrument code for the first time in a 210 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 211session, it runs the hook @code{edebug-setup-hook}, then sets it to
210@code{nil}. You can use this to arrange to load Edebug specifications 212@code{nil}. You can use this to load Edebug specifications
211(@pxref{Instrumenting Macro Calls}) associated with a package you are 213(@pxref{Instrumenting Macro Calls}) associated with a package you are
212using, but actually load them only if you use Edebug. 214using, but only when you use Edebug.
213 215
214@findex eval-expression @r{(Edebug)} 216@findex eval-expression @r{(Edebug)}
215 To remove instrumentation from a definition, simply re-evaluate its 217 To remove instrumentation from a definition, simply re-evaluate its
@@ -238,12 +240,12 @@ before it stops.
238 240
239Normally, you specify the Edebug execution mode by typing a command to 241Normally, you specify the Edebug execution mode by typing a command to
240continue the program in a certain mode. Here is a table of these 242continue the program in a certain mode. Here is a table of these
241commands. All except for @kbd{S} resume execution of the program, at 243commands; all except for @kbd{S} resume execution of the program, at
242least for a certain distance. 244least for a certain distance.
243 245
244@table @kbd 246@table @kbd
245@item S 247@item S
246Stop: don't execute any more of the program for now, just wait for more 248Stop: don't execute any more of the program, but wait for more
247Edebug commands (@code{edebug-stop}). 249Edebug commands (@code{edebug-stop}).
248 250
249@item @key{SPC} 251@item @key{SPC}
@@ -296,7 +298,7 @@ Keyboard macros containing the commands in this section do not
296completely work: exiting from Edebug, to resume the program, loses track 298completely work: exiting from Edebug, to resume the program, loses track
297of the keyboard macro. This is not easy to fix. Also, defining or 299of the keyboard macro. This is not easy to fix. Also, defining or
298executing a keyboard macro outside of Edebug does not affect commands 300executing a keyboard macro outside of Edebug does not affect commands
299inside Edebug. This is usually an advantage. But see the 301inside Edebug. This is usually an advantage. See also the
300@code{edebug-continue-kbd-macro} option (@pxref{Edebug Options}). 302@code{edebug-continue-kbd-macro} option (@pxref{Edebug Options}).
301 303
302When you enter a new Edebug level, the initial execution mode comes from 304When you enter a new Edebug level, the initial execution mode comes from
@@ -316,8 +318,8 @@ breakpoint reached before the intended stop point will also stop
316execution. @xref{Breakpoints}, for the details on breakpoints. 318execution. @xref{Breakpoints}, for the details on breakpoints.
317 319
318 These commands may fail to work as expected in case of nonlocal exit, 320 These commands may fail to work as expected in case of nonlocal exit,
319because a nonlocal exit can bypass the temporary breakpoint where you 321as that can bypass the temporary breakpoint where you expected the
320expected the program to stop. 322program to stop.
321 323
322@table @kbd 324@table @kbd
323@item h 325@item h
@@ -348,13 +350,13 @@ With a prefix argument @var{n}, the temporary breakpoint is placed
348more elements, then the place to stop is after the containing 350more elements, then the place to stop is after the containing
349expression. 351expression.
350 352
351Be careful that the position @kbd{C-M-f} finds is a place that the 353You must check that the position @kbd{C-M-f} finds is a place that the
352program will really get to; this may not be true in a 354program will really get to. In @code{cond}, for example, this may not
353@code{cond}, for example. 355be true.
354 356
355The @kbd{f} command does @code{forward-sexp} starting at point, rather 357For flexibility, the @kbd{f} command does @code{forward-sexp} starting
356than at the stop point, for flexibility. If you want to execute one 358at point, rather than at the stop point. If you want to execute one
357expression @emph{from the current stop point}, type @kbd{w} first, to 359expression @emph{from the current stop point}, first type @kbd{w}, to
358move point there, and then type @kbd{f}. 360move point there, and then type @kbd{f}.
359 361
360The @kbd{o} command continues ``out of'' an expression. It places a 362The @kbd{o} command continues ``out of'' an expression. It places a
@@ -397,7 +399,7 @@ activity. However, instrumented code protected with
397debugging. 399debugging.
398 400
399@item Q 401@item Q
400Like @kbd{q} but don't stop even for protected code 402Like @kbd{q}, but don't stop even for protected code
401(@code{top-level-nonstop}). 403(@code{top-level-nonstop}).
402 404
403@item r 405@item r
@@ -415,22 +417,21 @@ The backtrace buffer is killed automatically when you continue
415execution. 417execution.
416@end table 418@end table
417 419
418From the Edebug recursive edit, you may invoke commands that activate 420You can invoke commands from Edebug that activate Edebug again
419Edebug again recursively. Any time Edebug is active, you can quit to 421recursively. Whenever Edebug is active, you can quit to the top level
420the top level with @kbd{q} or abort one recursive edit level with 422with @kbd{q} or abort one recursive edit level with @kbd{C-]}. You can
421@kbd{C-]}. You can display a backtrace of all the 423display a backtrace of all the pending evaluations with @kbd{d}.
422pending evaluations with @kbd{d}.
423 424
424@node Breakpoints 425@node Breakpoints
425@subsection Breakpoints 426@subsection Breakpoints
426 427
427@cindex breakpoints 428@cindex breakpoints
428Edebug's step mode stops execution at the next stop point reached. 429Edebug's step mode stops execution when the next stop point is reached.
429There are three other ways to stop Edebug execution once it has started: 430There are three other ways to stop Edebug execution once it has started:
430breakpoints, the global break condition, and source breakpoints. 431breakpoints, the global break condition, and source breakpoints.
431 432
432While using Edebug, you can specify @dfn{breakpoints} in the program you 433While using Edebug, you can specify @dfn{breakpoints} in the program you
433are testing: points where execution should stop. You can set a 434are testing: these are places where execution should stop. You can set a
434breakpoint at any stop point, as defined in @ref{Using Edebug}. For 435breakpoint at any stop point, as defined in @ref{Using Edebug}. For
435setting and unsetting breakpoints, the stop point that is affected is 436setting and unsetting breakpoints, the stop point that is affected is
436the first one at or after point in the source code buffer. Here are the 437the first one at or after point in the source code buffer. Here are the
@@ -440,8 +441,8 @@ Edebug commands for breakpoints:
440@item b 441@item b
441Set a breakpoint at the stop point at or after point 442Set a breakpoint at the stop point at or after point
442(@code{edebug-set-breakpoint}). If you use a prefix argument, the 443(@code{edebug-set-breakpoint}). If you use a prefix argument, the
443breakpoint is temporary (it turns off the first time it stops the 444breakpoint is temporary---it turns off the first time it stops the
444program). 445program.
445 446
446@item u 447@item u
447Unset the breakpoint (if any) at the stop point at or after 448Unset the breakpoint (if any) at the stop point at or after
@@ -463,7 +464,8 @@ 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. 464then type @kbd{b} or @kbd{u} to set or unset a breakpoint there.
464Unsetting a breakpoint where none has been set has no effect. 465Unsetting a breakpoint where none has been set has no effect.
465 466
466Re-evaluating or reinstrumenting a definition forgets all its breakpoints. 467Re-evaluating or reinstrumenting a definition removes all of its
468previous breakpoints.
467 469
468A @dfn{conditional breakpoint} tests a condition each time the program 470A @dfn{conditional breakpoint} tests a condition each time the program
469gets there. Any errors that occur as a result of evaluating the 471gets there. Any errors that occur as a result of evaluating the
@@ -478,7 +480,7 @@ You can make a conditional or unconditional breakpoint
478breakpoint. When a temporary breakpoint stops the program, it is 480breakpoint. When a temporary breakpoint stops the program, it is
479automatically unset. 481automatically unset.
480 482
481Edebug always stops or pauses at a breakpoint except when the Edebug 483Edebug always stops or pauses at a breakpoint, except when the Edebug
482mode is Go-nonstop. In that mode, it ignores breakpoints entirely. 484mode is Go-nonstop. In that mode, it ignores breakpoints entirely.
483 485
484To find out where your breakpoints are, use the @kbd{B} command, which 486To find out where your breakpoints are, use the @kbd{B} command, which
@@ -500,7 +502,7 @@ point in the buffer.
500@cindex global break condition 502@cindex global break condition
501 A @dfn{global break condition} stops execution when a specified 503 A @dfn{global break condition} stops execution when a specified
502condition is satisfied, no matter where that may occur. Edebug 504condition is satisfied, no matter where that may occur. Edebug
503evaluates the global break condition at every stop point. If it 505evaluates the global break condition at every stop point; if it
504evaluates to a non-@code{nil} value, then execution stops or pauses 506evaluates to a non-@code{nil} value, then execution stops or pauses
505depending on the execution mode, as if a breakpoint had been hit. If 507depending on the execution mode, as if a breakpoint had been hit. If
506evaluating the condition gets an error, execution does not stop. 508evaluating the condition gets an error, execution does not stop.
@@ -520,11 +522,12 @@ should reset the condition to @code{nil} when not using it.
520@findex edebug 522@findex edebug
521@cindex source breakpoints 523@cindex source breakpoints
522 All breakpoints in a definition are forgotten each time you 524 All breakpoints in a definition are forgotten each time you
523reinstrument it. To make a breakpoint that won't be forgotten, you can 525reinstrument it. If you wish to make a breakpoint that won't be
524write a @dfn{source breakpoint}, which is simply a call to the function 526forgotten, you can write a @dfn{source breakpoint}, which is simply a
525@code{edebug} in your source code. You can, of course, make such a call 527call to the function @code{edebug} in your source code. You can, of
526conditional. For example, in the @code{fac} function, insert the first 528course, make such a call conditional. For example, in the @code{fac}
527line as shown below to stop when the argument reaches zero: 529function, you can insert the first line as shown below, to stop when the
530argument reaches zero:
528 531
529@example 532@example
530(defun fac (n) 533(defun fac (n)
@@ -553,10 +556,10 @@ and @code{edebug-on-quit}; see @ref{Edebug Options}.
553 556
554 When Edebug responds to an error, it shows the last stop point 557 When Edebug responds to an error, it shows the last stop point
555encountered before the error. This may be the location of a call to a 558encountered before the error. This may be the location of a call to a
556function which was not instrumented, within which the error actually 559function which was not instrumented, and within which the error actually
557occurred. For an unbound variable error, the last known stop point 560occurred. For an unbound variable error, the last known stop point
558might be quite distant from the offending variable reference. In that 561might be quite distant from the offending variable reference. In that
559case you might want to display a full backtrace (@pxref{Edebug Misc}). 562case, you might want to display a full backtrace (@pxref{Edebug Misc}).
560 563
561@c Edebug should be changed for the following: -- dan 564@c Edebug should be changed for the following: -- dan
562 If you change @code{debug-on-error} or @code{debug-on-quit} while 565 If you change @code{debug-on-error} or @code{debug-on-quit} while
@@ -616,12 +619,12 @@ open.
616@node Edebug Eval 619@node Edebug Eval
617@subsection Evaluation 620@subsection Evaluation
618 621
619 While within Edebug, you can evaluate expressions ``as if'' Edebug were 622 While within Edebug, you can evaluate expressions ``as if'' Edebug
620not running. Edebug tries to be invisible to the expression's 623were not running. Edebug tries to be invisible to the expression's
621evaluation and printing. Evaluation of expressions that cause side 624evaluation and printing. Evaluation of expressions that cause side
622effects will work as expected except for things that Edebug explicitly 625effects will work as expected, except for changes to data that Edebug
623saves and restores. @xref{The Outside Context}, for details on this 626explicitly saves and restores. @xref{The Outside Context}, for details
624process. 627on this process.
625 628
626@table @kbd 629@table @kbd
627@item e @var{exp} @key{RET} 630@item e @var{exp} @key{RET}
@@ -739,9 +742,9 @@ eval-last-sexp
739To delete a group, move point into it and type @kbd{C-c C-d}, or simply 742To delete a group, move point into it and type @kbd{C-c C-d}, or simply
740delete the text for the group and update the evaluation list with 743delete the text for the group and update the evaluation list with
741@kbd{C-c C-u}. To add a new expression to the evaluation list, insert 744@kbd{C-c C-u}. To add a new expression to the evaluation list, insert
742the expression at a suitable place, and insert a new comment line. (You 745the expression at a suitable place, insert a new comment line, then type
743need not insert dashes in the comment line---its contents don't matter.) 746@kbd{C-c C-u}. You need not insert dashes in the comment line---its
744Then type @kbd{C-c C-u}. 747contents don't matter.
745 748
746After selecting @samp{*edebug*}, you can return to the source code 749After selecting @samp{*edebug*}, you can return to the source code
747buffer with @kbd{C-c C-w}. The @samp{*edebug*} buffer is killed when 750buffer with @kbd{C-c C-w}. The @samp{*edebug*} buffer is killed when
@@ -764,22 +767,18 @@ and @code{edebug-print-level} specify the values to use within Edebug.)
764@xref{Output Variables}. 767@xref{Output Variables}.
765 768
766@defopt edebug-print-length 769@defopt edebug-print-length
767If non-@code{nil}, bind @code{print-length} to this while printing 770If non-@code{nil}, Edebug binds @code{print-length} to this value while
768results in Edebug. The default value is @code{50}. 771printing results. The default value is @code{50}.
769@end defopt 772@end defopt
770 773
771@defopt edebug-print-level 774@defopt edebug-print-level
772If non-@code{nil}, bind @code{print-level} to this while printing 775If non-@code{nil}, Edebug binds @code{print-level} to this value while
773results in Edebug. The default value is @code{50}. 776printing results. The default value is @code{50}.
774@end defopt 777@end defopt
775 778
776 You can also print circular structures and structures that share 779 You can also print circular structures and structures that share
777elements more informatively by using the @file{cust-print} package. 780elements more informatively by binding @code{print-circle}
778 781to a non-@code{nil} value.
779 To load @file{cust-print} and activate custom printing only for
780Edebug, simply use the command @kbd{M-x edebug-install-custom-print}.
781To restore the standard print functions, use @kbd{M-x
782edebug-uninstall-custom-print}.
783 782
784 Here is an example of code that creates a circular structure: 783 Here is an example of code that creates a circular structure:
785 784
@@ -796,8 +795,8 @@ structure. This notation is used for any shared elements of lists or
796vectors. 795vectors.
797 796
798@defopt edebug-print-circle 797@defopt edebug-print-circle
799If non-@code{nil}, bind @code{print-circle} to this while printing 798If non-@code{nil}, Edebug binds @code{print-circle} to this value while
800results in Edebug. The default value is @code{nil}. 799printing results. The default value is @code{nil}.
801@end defopt 800@end defopt
802 801
803 Other programs can also use custom printing; see @file{cust-print.el} 802 Other programs can also use custom printing; see @file{cust-print.el}
@@ -816,9 +815,9 @@ trace recording, set @code{edebug-trace} to a non-@code{nil} value.
816mode (@pxref{Edebug Execution Modes}). 815mode (@pxref{Edebug Execution Modes}).
817 816
818 When trace recording is enabled, each function entry and exit adds 817 When trace recording is enabled, each function entry and exit adds
819lines to the trace buffer. A function entry record looks like 818lines to the trace buffer. A function entry record consists of
820@samp{::::@{} followed by the function name and argument values. A 819@samp{::::@{}, followed by the function name and argument values. A
821function exit record looks like @samp{::::@}} followed by the function 820function exit record consists of @samp{::::@}}, followed by the function
822name and result of the function. 821name and result of the function.
823 822
824 The number of @samp{:}s in an entry shows its recursion depth. You 823 The number of @samp{:}s in an entry shows its recursion depth. You
@@ -834,7 +833,7 @@ redefining the functions @code{edebug-print-trace-before} and
834@defmac edebug-tracing string body@dots{} 833@defmac edebug-tracing string body@dots{}
835This macro requests additional trace information around the execution 834This macro requests additional trace information around the execution
836of the @var{body} forms. The argument @var{string} specifies text 835of the @var{body} forms. The argument @var{string} specifies text
837to put in the trace buffer. All the arguments are evaluated. 836to put in the trace buffer. All the arguments are evaluated, and
838@code{edebug-tracing} returns the value of the last form in @var{body}. 837@code{edebug-tracing} returns the value of the last form in @var{body}.
839@end defmac 838@end defmac
840 839
@@ -964,15 +963,15 @@ the current window configuration from ``outside'' Edebug
964the program), it restores the previous window configuration. 963the program), it restores the previous window configuration.
965 964
966Emacs redisplays only when it pauses. Usually, when you continue 965Emacs redisplays only when it pauses. Usually, when you continue
967execution, the program comes back into Edebug at a breakpoint or after 966execution, the program re-enters Edebug at a breakpoint or after
968stepping without pausing or reading input in between. In such cases, 967stepping, without pausing or reading input in between. In such cases,
969Emacs never gets a chance to redisplay the ``outside'' configuration. 968Emacs never gets a chance to redisplay the ``outside'' configuration.
970What you see is the same window configuration as the last time Edebug 969Consequently, what you see is the same window configuration as the last
971was active, with no interruption. 970time Edebug was active, with no interruption.
972 971
973Entry to Edebug for displaying something also saves and restores the 972Entry to Edebug for displaying something also saves and restores the
974following data, but some of these are deliberately not restored if an 973following data (though some of them are deliberately not restored if an
975error or quit signal occurs. 974error or quit signal occurs).
976 975
977@itemize @bullet 976@itemize @bullet
978@item 977@item
diff --git a/lispref/elisp.texi b/lispref/elisp.texi
index aebd78d50c6..182d9d121f3 100644
--- a/lispref/elisp.texi
+++ b/lispref/elisp.texi
@@ -12,8 +12,8 @@
12@smallbook 12@smallbook
13 13
14@ifinfo 14@ifinfo
15This Info file contains edition 2.5.1 of the GNU Emacs Lisp 15This Info file contains edition 2.6 of the GNU Emacs Lisp
16Reference Manual, corresponding to Emacs version 20.4. 16Reference Manual, corresponding to Emacs version 21.1.
17@c Please REMEMBER to update edition number in *four* places in this file 17@c Please REMEMBER to update edition number in *four* places in this file
18@c and also in *one* place in intro.texi 18@c and also in *one* place in intro.texi
19 19
@@ -75,7 +75,7 @@ instead of in the original English.
75@subtitle For Emacs Version 20.4 75@subtitle For Emacs Version 20.4
76@c The edition number appears in several places in this file 76@c The edition number appears in several places in this file
77@c and also in the file intro.texi. 77@c and also in the file intro.texi.
78@subtitle Revision 2.5.1, January 1999 78@subtitle Revision 2.6, September 1999
79 79
80@author by Bil Lewis, Dan LaLiberte, Richard Stallman 80@author by Bil Lewis, Dan LaLiberte, Richard Stallman
81@author and the GNU Manual Group 81@author and the GNU Manual Group
@@ -85,11 +85,11 @@ Copyright @copyright{} 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1998, 1999
85Free Software Foundation, Inc. 85Free Software Foundation, Inc.
86 86
87@sp 2 87@sp 2
88Edition 2.5.1 @* 88Edition 2.6 @*
89Revised for Emacs Version 20.4,@* 89Revised for Emacs Version 21.1,@*
90January 1999.@* 90September 1999.@*
91@sp 2 91@sp 2
92ISBN 1-882114-72-8 92ISBN 1-882114-73-6
93 93
94@sp 2 94@sp 2
95Published by the Free Software Foundation @* 95Published by the Free Software Foundation @*
@@ -120,8 +120,8 @@ Cover art by Etienne Suvasa.
120@node Top, Copying, (dir), (dir) 120@node Top, Copying, (dir), (dir)
121 121
122@ifinfo 122@ifinfo
123This Info file contains edition 2.5.1 of the GNU Emacs Lisp 123This Info file contains edition 2.6 of the GNU Emacs Lisp
124Reference Manual, corresponding to GNU Emacs version 20.4. 124Reference Manual, corresponding to GNU Emacs version 21.1.
125@end ifinfo 125@end ifinfo
126 126
127@menu 127@menu
@@ -136,6 +136,7 @@ Reference Manual, corresponding to GNU Emacs version 20.4.
136* Sequences Arrays Vectors:: Lists, strings and vectors are called sequences. 136* Sequences Arrays Vectors:: Lists, strings and vectors are called sequences.
137 Certain functions act on any kind of sequence. 137 Certain functions act on any kind of sequence.
138 The description of vectors is here as well. 138 The description of vectors is here as well.
139* Hash Tables:: Very fast lookup-tables.
139* Symbols:: Symbols represent names, uniquely. 140* Symbols:: Symbols represent names, uniquely.
140 141
141* Evaluation:: How Lisp expressions are evaluated. 142* Evaluation:: How Lisp expressions are evaluated.
@@ -867,10 +868,10 @@ Operating System Interface
867 868
868Starting Up Emacs 869Starting Up Emacs
869 870
870* Start-up Summary:: Sequence of actions Emacs performs at start-up. 871* Startup Summary:: Sequence of actions Emacs performs at start-up.
871* Init File:: Details on reading the init file (@file{.emacs}). 872* Init File:: Details on reading the init file (@file{.emacs}).
872* Terminal-Specific:: How the terminal-specific Lisp file is read. 873* Terminal-Specific:: How the terminal-specific Lisp file is read.
873* Command Line Arguments:: How command line arguments are processed, 874* Command-Line Arguments:: How command line arguments are processed,
874 and how you can customize them. 875 and how you can customize them.
875 876
876Getting out of Emacs 877Getting out of Emacs
@@ -914,6 +915,7 @@ Object Internals
914 915
915@include lists.texi 916@include lists.texi
916@include sequences.texi 917@include sequences.texi
918@include hash.texi
917@include symbols.texi 919@include symbols.texi
918@include eval.texi 920@include eval.texi
919 921
diff --git a/lispref/errors.texi b/lispref/errors.texi
index 700884ebd67..e58e99d537f 100644
--- a/lispref/errors.texi
+++ b/lispref/errors.texi
@@ -64,12 +64,12 @@ See @code{/} and @code{%} in @ref{Numbers}.
64 64
65@item end-of-file 65@item end-of-file
66@code{"End of file during parsing"}@* 66@code{"End of file during parsing"}@*
67Note that this is not a @code{file-error} 67Note that this is not a subcategory of @code{file-error},
68because it pertains to the Lisp reader, not to file I/O. 68because it pertains to the Lisp reader, not to file I/O.
69@xref{Input Functions}. 69@xref{Input Functions}.
70 70
71@item file-already-exists 71@item file-already-exists
72This is a @code{file-error}.@* 72This is a subcategory of @code{file-error}.@*
73@xref{Writing to Files}. 73@xref{Writing to Files}.
74 74
75@item file-date-error 75@item file-date-error
@@ -84,11 +84,11 @@ condition @code{file-error} is present.@*
84@xref{Files}. 84@xref{Files}.
85 85
86@item file-locked 86@item file-locked
87This is a @code{file-error}.@* 87This is a subcategory of @code{file-error}.@*
88@xref{File Locks}. 88@xref{File Locks}.
89 89
90@item file-supersession 90@item file-supersession
91This is a @code{file-error}.@* 91This is a subcategory of @code{file-error}.@*
92@xref{Modification Time}. 92@xref{Modification Time}.
93 93
94@item invalid-function 94@item invalid-function
diff --git a/lispref/files.texi b/lispref/files.texi
index a94cb2c080e..f82e724e4da 100644
--- a/lispref/files.texi
+++ b/lispref/files.texi
@@ -126,7 +126,7 @@ the user whether to reread the changed file. If the user says
126This function displays warning or advisory messages in various peculiar 126This function displays warning or advisory messages in various peculiar
127cases, unless the optional argument @var{nowarn} is non-@code{nil}. For 127cases, unless the optional argument @var{nowarn} is non-@code{nil}. For
128example, if it needs to create a buffer, and there is no file named 128example, if it needs to create a buffer, and there is no file named
129@var{filename}, it displays the message @samp{New file} in the echo 129@var{filename}, it displays the message @samp{(New file)} in the echo
130area, and leaves the buffer empty. 130area, and leaves the buffer empty.
131 131
132The @code{find-file-noselect} function normally calls 132The @code{find-file-noselect} function normally calls
@@ -260,7 +260,7 @@ and by the default revert function (@pxref{Reverting}).
260If reading the file got an error because the file does not exist, but 260If reading the file got an error because the file does not exist, but
261its directory does exist, the caller should pass a non-@code{nil} value 261its directory does exist, the caller should pass a non-@code{nil} value
262for @var{error}. In that case, @code{after-find-file} issues a warning: 262for @var{error}. In that case, @code{after-find-file} issues a warning:
263@samp{(New File)}. For more serious errors, the caller should usually not 263@samp{(New file)}. For more serious errors, the caller should usually not
264call @code{after-find-file}. 264call @code{after-find-file}.
265 265
266If @var{warn} is non-@code{nil}, then this function issues a warning 266If @var{warn} is non-@code{nil}, then this function issues a warning
@@ -312,7 +312,7 @@ the user.
312The optional @var{exiting} argument, if non-@code{nil}, requests this 312The optional @var{exiting} argument, if non-@code{nil}, requests this
313function to offer also to save certain other buffers that are not 313function to offer also to save certain other buffers that are not
314visiting files. These are buffers that have a non-@code{nil} 314visiting files. These are buffers that have a non-@code{nil}
315buffer-local value of @code{buffer-offer-save}. (A user who says yes to 315buffer-local value of @code{buffer-offer-save}. (A user who says @samp{yes} to
316saving one of these is asked to specify a file name to use.) The 316saving one of these is asked to specify a file name to use.) The
317@code{save-buffers-kill-emacs} function passes a non-@code{nil} value 317@code{save-buffers-kill-emacs} function passes a non-@code{nil} value
318for this argument. 318for this argument.
@@ -447,7 +447,9 @@ The function @code{insert-file-contents} checks the file contents
447against the defined file formats, and converts the file contents if 447against the defined file formats, and converts the file contents if
448appropriate. @xref{Format Conversion}. It also calls the functions in 448appropriate. @xref{Format Conversion}. It also calls the functions in
449the list @code{after-insert-file-functions}; see @ref{Saving 449the list @code{after-insert-file-functions}; see @ref{Saving
450Properties}. 450Properties}. Normally, one of the functions in the
451@code{after-insert-file-functions} list determines the coding system
452(@pxref{Coding Systems}) used for decoding the file's contents.
451 453
452If @var{visit} is non-@code{nil}, this function additionally marks the 454If @var{visit} is non-@code{nil}, this function additionally marks the
453buffer as unmodified and sets up various fields in the buffer so that it 455buffer as unmodified and sets up various fields in the buffer so that it
@@ -510,19 +512,29 @@ An error is signaled if @var{filename} specifies a nonwritable file,
510or a nonexistent file in a directory where files cannot be created. 512or a nonexistent file in a directory where files cannot be created.
511@end deffn 513@end deffn
512 514
513@deffn Command write-region start end filename &optional append visit confirm 515@deffn Command write-region start end filename &optional append visit mustbenew
514This function writes the region delimited by @var{start} and @var{end} 516This function writes the region delimited by @var{start} and @var{end}
515in the current buffer into the file specified by @var{filename}. 517in the current buffer into the file specified by @var{filename}.
516 518
517@c Emacs 19 feature 519@c Emacs 19 feature
518If @var{start} is a string, then @code{write-region} writes or appends 520If @var{start} is a string, then @code{write-region} writes or appends
519that string, rather than text from the buffer. 521that string, rather than text from the buffer. @var{end} is ignored in
522this case.
520 523
521If @var{append} is non-@code{nil}, then the specified text is appended 524If @var{append} is non-@code{nil}, then the specified text is appended
522to the existing file contents (if any). 525to the existing file contents (if any).
523 526
524If @var{confirm} is non-@code{nil}, then @code{write-region} asks 527If @var{mustbenew} is non-@code{nil}, then @code{write-region} asks
525for confirmation if @var{filename} names an existing file. 528for confirmation if @var{filename} names an existing file.
529Starting in Emacs 21, if @var{mustbenew} is the symbol @code{excl},
530then @code{write-region} does not ask for confirmation, but instead
531it signals an error @code{file-already-exists} if the file already
532exists.
533
534The test for an existing file, when @var{mustbenew} is @code{excl}, uses
535a special system feature. At least for files on a local disk, there is
536no chance that some other program could create a file of the same name
537before Emacs does, without Emacs's noticing.
526 538
527If @var{visit} is @code{t}, then Emacs establishes an association 539If @var{visit} is @code{t}, then Emacs establishes an association
528between the buffer and the file: the buffer is then visiting that file. 540between the buffer and the file: the buffer is then visiting that file.
@@ -615,6 +627,10 @@ the file should not be locked, so this function does nothing. It also
615does nothing if the current buffer is not visiting a file. 627does nothing if the current buffer is not visiting a file.
616@end defun 628@end defun
617 629
630 File locking is not supported on some systems. On systems that do not
631support it, the functions @code{lock-buffer}, @code{unlock-buffer} and
632@code{file-locked-p} do nothing and return @code{nil}.
633
618@defun ask-user-about-lock file other-user 634@defun ask-user-about-lock file other-user
619This function is called when the user tries to modify @var{file}, but it 635This function is called when the user tries to modify @var{file}, but it
620is locked by another user named @var{other-user}. The default 636is locked by another user named @var{other-user}. The default
@@ -710,10 +726,10 @@ and you can read it. It returns @code{nil} otherwise.
710@c Emacs 19 feature 726@c Emacs 19 feature
711@defun file-executable-p filename 727@defun file-executable-p filename
712This function returns @code{t} if a file named @var{filename} exists and 728This function returns @code{t} if a file named @var{filename} exists and
713you can execute it. It returns @code{nil} otherwise. If the file is a 729you can execute it. It returns @code{nil} otherwise. On Unix, if the
714directory, execute permission means you can check the existence and 730file is a directory, execute permission means you can check the
715attributes of files inside the directory, and open those files if their 731existence and attributes of files inside the directory, and open those
716modes permit. 732files if their modes permit.
717@end defun 733@end defun
718 734
719@defun file-writable-p filename 735@defun file-writable-p filename
@@ -1081,7 +1097,8 @@ was last modified on Aug 19 00:09.
1081last had its inode changed on Aug 19 00:09. 1097last had its inode changed on Aug 19 00:09.
1082 1098
1083@item 14906 1099@item 14906
1084is 14906 characters long. 1100is 14906 bytes long. (It may not contain 14906 characters, though,
1101if some of the bytes belong to multibyte sequences.)
1085 1102
1086@item "-rw-rw-rw-" 1103@item "-rw-rw-rw-"
1087has a mode of read and write access for the owner, group, and world. 1104has a mode of read and write access for the owner, group, and world.
@@ -1186,7 +1203,8 @@ contents of @file{foo3} are lost.
1186@end example 1203@end example
1187 1204
1188This function is meaningless on operating systems where multiple names 1205This function is meaningless on operating systems where multiple names
1189for one file are not allowed. 1206for one file are not allowed. Some systems implement multiple names
1207by copying the file instead.
1190 1208
1191See also @code{file-nlinks} in @ref{File Attributes}. 1209See also @code{file-nlinks} in @ref{File Attributes}.
1192@end defun 1210@end defun
@@ -1241,6 +1259,9 @@ This command makes a symbolic link to @var{filename}, named
1241In an interactive call, this function prompts for @var{filename} and 1259In an interactive call, this function prompts for @var{filename} and
1242@var{newname} in the minibuffer; also, it requests confirmation if 1260@var{newname} in the minibuffer; also, it requests confirmation if
1243@var{newname} already exists. 1261@var{newname} already exists.
1262
1263This function is not available on systems that don't support symbolic
1264links.
1244@end deffn 1265@end deffn
1245 1266
1246@defun define-logical-name varname string 1267@defun define-logical-name varname string
@@ -1275,9 +1296,13 @@ This function returns the current default protection value.
1275@cindex MS-DOS and file modes 1296@cindex MS-DOS and file modes
1276@cindex file modes and MS-DOS 1297@cindex file modes and MS-DOS
1277 On MS-DOS, there is no such thing as an ``executable'' file mode bit. 1298 On MS-DOS, there is no such thing as an ``executable'' file mode bit.
1278So Emacs considers a file executable if its name ends in @samp{.com}, 1299So Emacs considers a file executable if its name ends in one of the
1279@samp{.bat} or @samp{.exe}. This is reflected in the values returned 1300standard executable extensions, such as @file{.com}, @file{.bat},
1280by @code{file-modes} and @code{file-attributes}. 1301@file{.exe}, and some others. Files that begin with the Unix-standard
1302@samp{#!} signature, such as shell and Perl scripts, are also considered
1303as executable files. This is reflected in the values returned by
1304@code{file-modes} and @code{file-attributes}. Directories are also
1305reported with executable bit set, for compatibility with Unix.
1281 1306
1282@node File Names 1307@node File Names
1283@section File Names 1308@section File Names
@@ -1327,22 +1352,22 @@ parts: the @dfn{directory name} part, and the @dfn{nondirectory} part
1327(or @dfn{file name within the directory}). Either part may be empty. 1352(or @dfn{file name within the directory}). Either part may be empty.
1328Concatenating these two parts reproduces the original file name. 1353Concatenating these two parts reproduces the original file name.
1329 1354
1330 On Unix, the directory part is everything up to and including the last 1355 On most systems, the directory part is everything up to and including
1331slash; the nondirectory part is the rest. The rules in VMS syntax are 1356the last slash; the nondirectory part is the rest. The rules in VMS
1332complicated. 1357syntax are complicated.
1333 1358
1334 For some purposes, the nondirectory part is further subdivided into 1359 For some purposes, the nondirectory part is further subdivided into
1335the name proper and the @dfn{version number}. On Unix, only backup 1360the name proper and the @dfn{version number}. On most systems, only
1336files have version numbers in their names. On VMS, every file has a 1361backup files have version numbers in their names. On VMS, every file
1337version number, but most of the time the file name actually used in 1362has a version number, but most of the time the file name actually used
1338Emacs omits the version number, so that version numbers in Emacs are 1363in Emacs omits the version number, so that version numbers in Emacs are
1339found mostly in directory lists. 1364found mostly in directory lists.
1340 1365
1341@defun file-name-directory filename 1366@defun file-name-directory filename
1342This function returns the directory part of @var{filename} (or 1367This function returns the directory part of @var{filename} (or
1343@code{nil} if @var{filename} does not include a directory part). On 1368@code{nil} if @var{filename} does not include a directory part). On
1344Unix, the function returns a string ending in a slash. On VMS, it 1369most systems, the function returns a string ending in a slash. On VMS,
1345returns a string ending in one of the three characters @samp{:}, 1370it returns a string ending in one of the three characters @samp{:},
1346@samp{]}, or @samp{>}. 1371@samp{]}, or @samp{>}.
1347 1372
1348@example 1373@example
@@ -1429,7 +1454,7 @@ The extension, in a file name, is the part that starts with the last
1429kind of file, and it has a file name, which is related to the directory 1454kind of file, and it has a file name, which is related to the directory
1430name but not identical to it. (This is not quite the same as the usual 1455name but not identical to it. (This is not quite the same as the usual
1431Unix terminology.) These two different names for the same entity are 1456Unix terminology.) These two different names for the same entity are
1432related by a syntactic transformation. On Unix, this is simple: a 1457related by a syntactic transformation. On most systems, this is simple: a
1433directory name ends in a slash, whereas the directory's name as a file 1458directory name ends in a slash, whereas the directory's name as a file
1434lacks that slash. On VMS, the relationship is more complicated. 1459lacks that slash. On VMS, the relationship is more complicated.
1435 1460
@@ -1444,9 +1469,9 @@ such as @samp{$HOME}, and the constructs @samp{~}, and @samp{..}.
1444 1469
1445@defun file-name-as-directory filename 1470@defun file-name-as-directory filename
1446This function returns a string representing @var{filename} in a form 1471This function returns a string representing @var{filename} in a form
1447that the operating system will interpret as the name of a directory. In 1472that the operating system will interpret as the name of a directory. On
1448Unix, this means appending a slash to the string (if it does not already 1473most systems, this means appending a slash to the string (if it does not
1449end in one). On VMS, the function converts a string of the form 1474already end in one). On VMS, the function converts a string of the form
1450@file{[X]Y.DIR.1} to the form @file{[X.Y]}. 1475@file{[X]Y.DIR.1} to the form @file{[X.Y]}.
1451 1476
1452@example 1477@example
@@ -1459,9 +1484,9 @@ end in one). On VMS, the function converts a string of the form
1459 1484
1460@defun directory-file-name dirname 1485@defun directory-file-name dirname
1461This function returns a string representing @var{dirname} in a form that 1486This function returns a string representing @var{dirname} in a form that
1462the operating system will interpret as the name of a file. On Unix, 1487the operating system will interpret as the name of a file. On most
1463this means removing the final slash from the string. On VMS, the 1488systems, this means removing the final slash from the string. On VMS,
1464function converts a string of the form @file{[X.Y]} to 1489the function converts a string of the form @file{[X.Y]} to
1465@file{[X]Y.DIR.1}. 1490@file{[X]Y.DIR.1}.
1466 1491
1467@example 1492@example
@@ -1522,8 +1547,10 @@ starting from the root of the tree; then it is called an @dfn{absolute}
1522file name. Or it can specify the position of the file in the tree 1547file name. Or it can specify the position of the file in the tree
1523relative to a default directory; then it is called a @dfn{relative} 1548relative to a default directory; then it is called a @dfn{relative}
1524file name. On Unix, an absolute file name starts with a slash or a 1549file name. On Unix, an absolute file name starts with a slash or a
1525tilde (@samp{~}), and a relative one does not. The rules on VMS are 1550tilde (@samp{~}), and a relative one does not. On MS-DOS and
1526complicated. 1551MS-Windows, an absolute file name starts with a slash or a backslash, or
1552with a drive specification @samp{@var{x}:/}, where @var{x} is the
1553@dfn{drive letter}. The rules on VMS are complicated.
1527 1554
1528@defun file-name-absolute-p filename 1555@defun file-name-absolute-p filename
1529This function returns @code{t} if file @var{filename} is an absolute 1556This function returns @code{t} if file @var{filename} is an absolute
@@ -1625,7 +1652,7 @@ with @samp{~}. This variable is buffer-local in every buffer.
1625@code{expand-file-name} uses the default directory when its second 1652@code{expand-file-name} uses the default directory when its second
1626argument is @code{nil}. 1653argument is @code{nil}.
1627 1654
1628On Unix systems, the value is always a string ending with a slash. 1655Aside from VMS, the value is always a string ending with a slash.
1629 1656
1630@example 1657@example
1631@group 1658@group
@@ -1680,45 +1707,74 @@ on VMS except discard superfluous initial components as shown above.
1680@subsection Generating Unique File Names 1707@subsection Generating Unique File Names
1681 1708
1682 Some programs need to write temporary files. Here is the usual way to 1709 Some programs need to write temporary files. Here is the usual way to
1683construct a name for such a file: 1710construct a name for such a file, starting in Emacs 21:
1684 1711
1685@example 1712@example
1686(make-temp-name 1713(make-temp-file @var{name-of-application})
1687 (expand-file-name @var{name-of-application}
1688 temporary-file-directory))
1689@end example 1714@end example
1690 1715
1691@noindent 1716@noindent
1692The job of @code{make-temp-name} is to prevent two different users or 1717The job of @code{make-temp-file} is to prevent two different users or
1693two different jobs from trying to use the exact same file name. This 1718two different jobs from trying to use the exact same file name.
1694example uses the variable @code{temporary-file-directory} to decide
1695where to put the temporary file. All Emacs Lisp programs should
1696use @code{temporary-file-directory} for this purpose, to give the user
1697a uniform way to specify the directory for all temporary files.
1698 1719
1699@defun make-temp-name string 1720@defun make-temp-file prefix &optional dir-flag
1700This function generates a string that can be used as a unique file name. 1721@tindex make-temp-file
1701The name starts with @var{string}, and contains a number that is 1722This function creates a temporary file and returns its name.
1702different in each Emacs job. 1723The name starts with @var{prefix}; it also contains a number that is
1724different in each Emacs job. If @var{prefix} is a relative file name,
1725it is expanded against @code{temporary-file-directory}.
1703 1726
1704@example 1727@example
1705@group 1728@group
1706(make-temp-name "/tmp/foo") 1729(make-temp-file "foo")
1707 @result{} "/tmp/foo232J6v" 1730 @result{} "/tmp/foo232J6v"
1708@end group 1731@end group
1709@end example 1732@end example
1710 1733
1734When @code{make-temp-file} returns, the file has been created and is
1735empty. At that point, you should write the intended contents into the
1736file.
1737
1738If @var{dir-flag} is non-@code{nil}, @code{make-temp-file} creates
1739an empty directory instead of an empty file.
1740
1711To prevent conflicts among different libraries running in the same 1741To prevent conflicts among different libraries running in the same
1712Emacs, each Lisp program that uses @code{make-temp-name} should have its 1742Emacs, each Lisp program that uses @code{make-temp-file} should have its
1713own @var{string}. The number added to the end of @var{string} 1743own @var{prefix}. The number added to the end of @var{prefix}
1714distinguishes between the same application running in different Emacs 1744distinguishes between the same application running in different Emacs
1715jobs. Additional added characters permit a large number of distinct 1745jobs. Additional added characters permit a large number of distinct
1716names even in one Emacs job. 1746names even in one Emacs job.
1717@end defun 1747@end defun
1718 1748
1749 The default directory for temporary files is controlled by the
1750variable @code{temporary-file-directory}. This variable gives the user
1751a uniform way to specify the directory for all temporary files. Some
1752programs use @code{small-temporary-file-directory} instead, if that is
1753non-@code{nil}. To use it, you should expand the prefix against
1754the proper directory before calling @code{make-temp-file}.
1755
1756 In older Emacs versions where @code{make-temp-file} does not exist,
1757you should use @code{make-temp-name} instead:
1758
1759@example
1760(make-temp-name
1761 (expand-file-name @var{name-of-application}
1762 temporary-file-directory))
1763@end example
1764
1765@defun make-temp-name string
1766This function generates a string that can be used as a unique file name.
1767The name starts with @var{string}, and contains a number that is
1768different in each Emacs job. It is like @code{make-temp-file} except
1769that it just constructs a name, and does not create a file. On MS-DOS,
1770the @var{string} prefix can be truncated to fit into the 8+3 file-name
1771limits.
1772@end defun
1773
1719@defvar temporary-file-directory 1774@defvar temporary-file-directory
1720@cindex @code{TMPDIR} environment variable. 1775@cindex @code{TMPDIR} environment variable
1721@cindex @code{TMP} environment variable. 1776@cindex @code{TMP} environment variable
1777@cindex @code{TEMP} environment variable
1722This variable specifies the directory name for creating temporary files. 1778This variable specifies the directory name for creating temporary files.
1723Its value should be a directory name (@pxref{Directory Names}), but it 1779Its value should be a directory name (@pxref{Directory Names}), but it
1724is good for Lisp programs to cope if the value is a directory's file 1780is good for Lisp programs to cope if the value is a directory's file
@@ -1726,12 +1782,31 @@ name instead. Using the value as the second argument to
1726@code{expand-file-name} is a good way to achieve that. 1782@code{expand-file-name} is a good way to achieve that.
1727 1783
1728The default value is determined in a reasonable way for your operating 1784The default value is determined in a reasonable way for your operating
1729system; on GNU and Unix systems it is based on the @code{TMP} and 1785system; it is based on the @code{TMPDIR}, @code{TMP} and @code{TEMP}
1730@code{TMPDIR} environment variables. 1786environment variables, with a fall-back to a system-dependent name if
1787none of these variables is defined.
1731 1788
1732Even if you do not use @code{make-temp-name} to choose the temporary 1789Even if you do not use @code{make-temp-name} to choose the temporary
1733file's name, you should still use this variable to decide which 1790file's name, you should still use this variable to decide which
1734directory to put the file in. 1791directory to put the file in. However, if you expect the file to be
1792small, you should use @code{small-temporary-file-directory} first if
1793that is non-@code{nil}.
1794@end defvar
1795
1796@tindex small-temporary-file-directory
1797@defvar small-temporary-file-directory
1798This variable (new in Emacs 21) specifies the directory name for
1799creating certain temporary files, which are likely to be small.
1800
1801If you want to write a temporary file which is likely to be small, you
1802should compute the directory like this:
1803
1804@example
1805(make-temp-file
1806 (expand-file-name @var{prefix}
1807 (or small-temporary-file-directory
1808 temporary-file-directory)))
1809@end example
1735@end defvar 1810@end defvar
1736 1811
1737@node File Name Completion 1812@node File Name Completion
@@ -1953,15 +2028,20 @@ not contain @samp{-d}. (The @samp{-d} option to @code{ls} says to
1953describe a directory itself as a file, rather than showing its 2028describe a directory itself as a file, rather than showing its
1954contents.) 2029contents.)
1955 2030
1956This function works by running a directory listing program whose name is 2031On most systems, this function works by running a directory listing
1957in the variable @code{insert-directory-program}. If @var{wildcard} is 2032program whose name is in the variable @code{insert-directory-program}.
1958non-@code{nil}, it also runs the shell specified by 2033If @var{wildcard} is non-@code{nil}, it also runs the shell specified by
1959@code{shell-file-name}, to expand the wildcards. 2034@code{shell-file-name}, to expand the wildcards.
2035
2036MS-DOS and MS-Windows systems usually lack the standard Unix program
2037@code{ls}, so this function emulates the standard Unix program @code{ls}
2038with Lisp code.
1960@end defun 2039@end defun
1961 2040
1962@defvar insert-directory-program 2041@defvar insert-directory-program
1963This variable's value is the program to run to generate a directory listing 2042This variable's value is the program to run to generate a directory listing
1964for the function @code{insert-directory}. 2043for the function @code{insert-directory}. It is ignored on systems
2044which generate the listing with Lisp code.
1965@end defvar 2045@end defvar
1966 2046
1967@node Create/Delete Dirs 2047@node Create/Delete Dirs
@@ -2070,6 +2150,7 @@ Here are the operations that a magic file name handler gets to handle:
2070@end ifinfo 2150@end ifinfo
2071@iftex 2151@iftex
2072@noindent 2152@noindent
2153@flushleft
2073@code{add-name-to-file}, @code{copy-file}, @code{delete-directory}, 2154@code{add-name-to-file}, @code{copy-file}, @code{delete-directory},
2074@code{delete-file}, 2155@code{delete-file},
2075@code{diff-latest-backup-file}, 2156@code{diff-latest-backup-file},
@@ -2103,6 +2184,7 @@ Here are the operations that a magic file name handler gets to handle:
2103@code{vc-regis@discretionary{}{}{}tered}, 2184@code{vc-regis@discretionary{}{}{}tered},
2104@code{verify-visited-file-modtime}, 2185@code{verify-visited-file-modtime},
2105@code{write-region}. 2186@code{write-region}.
2187@end flushleft
2106@end iftex 2188@end iftex
2107 2189
2108Handlers for @code{insert-file-contents} typically need to clear the 2190Handlers for @code{insert-file-contents} typically need to clear the
diff --git a/lispref/frames.texi b/lispref/frames.texi
index b75f9529060..b371e658b6c 100644
--- a/lispref/frames.texi
+++ b/lispref/frames.texi
@@ -24,8 +24,22 @@ a single @dfn{window frame}, but you can create more, and Emacs can
24display several such frames at once as is usual for window systems. 24display several such frames at once as is usual for window systems.
25 25
26@defun framep object 26@defun framep object
27This predicate returns @code{t} if @var{object} is a frame, and 27This predicate returns a non-@code{nil} value if @var{object} is a
28@code{nil} otherwise. 28frame, and @code{nil} otherwise. For a frame, the value indicates which
29kind of display the frame uses:
30
31@table @code
32@item x
33The frame is displayed in an X window.
34@item t
35A terminal frame on a character display.
36@item mac
37The frame is displayed on a Macintosh.
38@item w32
39The frame is displayed on MS-Windows 9X/NT.
40@item pc
41The frame is displayed on an MS-DOS terminal.
42@end table
29@end defun 43@end defun
30 44
31@menu 45@menu
@@ -49,10 +63,8 @@ This predicate returns @code{t} if @var{object} is a frame, and
49* Dialog Boxes:: Displaying a box to ask yes or no. 63* Dialog Boxes:: Displaying a box to ask yes or no.
50* Pointer Shapes:: Specifying the shape of the mouse pointer. 64* Pointer Shapes:: Specifying the shape of the mouse pointer.
51* Window System Selections:: Transferring text to and from other X clients. 65* Window System Selections:: Transferring text to and from other X clients.
52* Font Names:: Looking up font names.
53* Fontsets:: A fontset is a collection of fonts
54 for displaying various character sets.
55* Color Names:: Getting the definitions of color names. 66* Color Names:: Getting the definitions of color names.
67* Text Terminal Colors:: Defining colors for text-only terminals.
56* Resources:: Getting resource values from the server. 68* Resources:: Getting resource values from the server.
57* Server Data:: Getting info about the X server. 69* Server Data:: Getting info about the X server.
58@end menu 70@end menu
@@ -86,8 +98,8 @@ A normal hook run by @code{make-frame} before it actually creates the
86frame. 98frame.
87@end defvar 99@end defvar
88 100
89@defvar after-make-frame-hook 101@defvar after-make-frame-functions
90@tindex after-make-frame-hook 102@tindex after-make-frame-functions
91An abnormal hook run by @code{make-frame} after it creates the frame. 103An abnormal hook run by @code{make-frame} after it creates the frame.
92Each function in @code{after-make-frame-hook} receives one argument, the 104Each function in @code{after-make-frame-hook} receives one argument, the
93frame just created. 105frame just created.
@@ -163,14 +175,17 @@ that display (@pxref{Deleting Frames}).
163@node Frame Parameters 175@node Frame Parameters
164@section Frame Parameters 176@section Frame Parameters
165 177
166A frame has many parameters that control its appearance and behavior. 178 A frame has many parameters that control its appearance and behavior.
167Just what parameters a frame has depends on what display mechanism it 179Just what parameters a frame has depends on what display mechanism it
168uses. 180uses.
169 181
170Frame parameters exist for the sake of window systems. A terminal frame 182 Frame parameters exist mostly for the sake of window systems. A
171has a few parameters, mostly for compatibility's sake; only the @code{height}, 183terminal frame has a few parameters, mostly for compatibility's sake;
172@code{width}, @code{name}, @code{title}, @code{buffer-list} and 184only the @code{height}, @code{width}, @code{name}, @code{title},
173@code{buffer-predicate} parameters do something special. 185@code{menu-bar-lines}, @code{buffer-list} and @code{buffer-predicate}
186parameters do something special. If the terminal supports colors, the
187parameters @code{foreground-color}, @code{background-color},
188@code{background-mode} and @code{display-type} are also meaningful.
174 189
175@menu 190@menu
176* Parameter Access:: How to change a frame's parameters. 191* Parameter Access:: How to change a frame's parameters.
@@ -222,7 +237,7 @@ created initial frame.
222If these settings affect the frame geometry and appearance, you'll see 237If these settings affect the frame geometry and appearance, you'll see
223the frame appear with the wrong ones and then change to the specified 238the frame appear with the wrong ones and then change to the specified
224ones. If that bothers you, you can specify the same geometry and 239ones. If that bothers you, you can specify the same geometry and
225appearance with X resources; those do take affect before the frame is 240appearance with X resources; those do take effect before the frame is
226created. @xref{Resources X,, X Resources, emacs, The GNU Emacs Manual}. 241created. @xref{Resources X,, X Resources, emacs, The GNU Emacs Manual}.
227 242
228X resource settings typically apply to all frames. If you want to 243X resource settings typically apply to all frames. If you want to
@@ -391,7 +406,9 @@ ordered most-recently-selected first.
391@item font 406@item font
392The name of the font for displaying text in the frame. This is a 407The name of the font for displaying text in the frame. This is a
393string, either a valid font name for your system or the name of an Emacs 408string, either a valid font name for your system or the name of an Emacs
394fontset (@pxref{Fontsets}). 409fontset (@pxref{Fontsets}). Changing this frame parameter on a frame,
410also changes the font-related attributes of the default face on that
411frame.
395 412
396@item auto-raise 413@item auto-raise
397Whether selecting the frame raises it (non-@code{nil} means yes). 414Whether selecting the frame raises it (non-@code{nil} means yes).
@@ -424,30 +441,40 @@ appears. If this is @code{nil}, the frame's title is used.
424 441
425@item foreground-color 442@item foreground-color
426The color to use for the image of a character. This is a string; the 443The color to use for the image of a character. This is a string; the
427window system defines the meaningful color names. 444window system defines the meaningful color names. Changing this
428 445parameter is equivalent to changing the foreground color of the face
429If you set the @code{foreground-color} frame parameter, you should 446@code{default} on the frame in question.
430call @code{frame-update-face-colors} to update faces accordingly.
431 447
432@item background-color 448@item background-color
433The color to use for the background of characters. 449The color to use for the background of characters. Changing this
434 450parameter is equivalent to changing the foreground color of the face
435If you set the @code{background-color} frame parameter, you should 451@code{default} on the frame in question.
436call @code{frame-update-face-colors} to update faces accordingly.
437@xref{Face Functions}.
438 452
439@item background-mode 453@item background-mode
440This parameter is either @code{dark} or @code{light}, according 454This parameter is either @code{dark} or @code{light}, according
441to whether the background color is a light one or a dark one. 455to whether the background color is a light one or a dark one.
442 456
443@item mouse-color 457@item mouse-color
444The color for the mouse pointer. 458The color for the mouse pointer. Changing this parameter is equivalent
459to changing the background color of face @code{mouse}.
445 460
446@item cursor-color 461@item cursor-color
447The color for the cursor that shows point. 462The color for the cursor that shows point. Changing this parameter is
463equivalent to changing the background color of face @code{cursor}.
448 464
449@item border-color 465@item border-color
450The color for the border of the frame. 466The color for the border of the frame. Changing this parameter is
467equivalent to changing the background color of face @code{border}.
468
469@item scroll-bar-foreground
470If non-@code{nil}, the color for the foreground of scroll bars.
471Changing this parameter is equivalent to setting the foreground color of
472face @code{scroll-bar}.
473
474@item scroll-bar-background
475If non-@code{nil}, the color for the background of scroll bars.
476Changing this parameter is equivalent to setting the foreground color of
477face @code{scroll-bar}.
451 478
452@item display-type 479@item display-type
453This parameter describes the range of possible colors that can be used 480This parameter describes the range of possible colors that can be used
@@ -482,6 +509,17 @@ The default is 1. @xref{Menu Bar}. (In Emacs versions that use the X
482toolkit, there is only one menu bar line; all that matters about the 509toolkit, there is only one menu bar line; all that matters about the
483number you specify is whether it is greater than zero.) 510number you specify is whether it is greater than zero.)
484 511
512@item screen-gamma
513If this is a number, Emacs performs ``gamma correction'' on colors. The
514value should be the screen gamma of your display, a floating point
515number. Usual PC monitors have a screen gamma of 2.2. Smaller values
516result in darker colors; you might want to try a screen gamma of 1.5 for
517LCD color displays. The viewing gamma Emacs uses is 0.4545 (1/2.2).
518
519@item tool-bar-lines
520The number of lines to use for the toolbar. A value of @code{nil} means
521don't display a tool bar.
522
485@ignore 523@ignore
486@item parent-id 524@item parent-id
487@c ??? Not yet working. 525@c ??? Not yet working.
@@ -755,7 +793,7 @@ upper left corner, down and to the right, until it reaches the window at
755the lower right corner (always the minibuffer window, if the frame has 793the lower right corner (always the minibuffer window, if the frame has
756one), and then it moves back to the top. @xref{Cyclic Window Ordering}. 794one), and then it moves back to the top. @xref{Cyclic Window Ordering}.
757 795
758@defun frame-top-window frame 796@defun frame-first-window frame
759This returns the topmost, leftmost window of frame @var{frame}. 797This returns the topmost, leftmost window of frame @var{frame}.
760@end defun 798@end defun
761 799
@@ -1309,180 +1347,160 @@ like the way successive kills in Emacs move down the kill ring.
1309@defvar selection-coding-system 1347@defvar selection-coding-system
1310@tindex selection-coding-system 1348@tindex selection-coding-system
1311This variable specifies the coding system to use when reading and 1349This variable specifies the coding system to use when reading and
1312writing a selections, the clipboard, or a cut buffer. @xref{Coding 1350writing selections, the clipboard, or a cut buffer. @xref{Coding
1313Systems}. The default is @code{compound-text}. 1351Systems}. The default is @code{compound-text}.
1314@end defvar 1352@end defvar
1315 1353
1316@need 1500 1354@cindex clipboard support (for MS-Windows)
1317@node Font Names 1355When Emacs runs on MS-Windows, it does not implement X selections in
1318@section Looking up Font Names 1356general, but it it does support the clipboard. @code{x-get-selection}
1319 1357and @code{x-set-selection} on MS-Windows support the text data type
1320@defun x-list-font pattern &optional face frame maximum 1358only; if the clipboard holds other types of data, Emacs treats the
1321This function returns a list of available font names that match 1359clipboard as empty.
1322@var{pattern}. If the optional arguments @var{face} and @var{frame} are 1360
1323specified, then the list is limited to fonts that are the same size as 1361@defopt x-select-enable-clipboard
1324@var{face} currently is on @var{frame}. 1362If this is non-@code{nil}, the Emacs yank functions consult the
1325 1363clipboard before the primary selection, and the kill functions store in
1326The argument @var{pattern} should be a string, perhaps with wildcard 1364the clipboard as well as the primary selection. Otherwise they do not
1327characters: the @samp{*} character matches any substring, and the 1365access the clipboard at all. The default is @code{nil} on most systems,
1328@samp{?} character matches any single character. Pattern matching 1366but @code{t} on MS-Windows.
1329of font names ignores case. 1367@end defopt
1330
1331If you specify @var{face} and @var{frame}, @var{face} should be a face name
1332(a symbol) and @var{frame} should be a frame.
1333
1334The optional argument @var{maximum} sets a limit on how many fonts to
1335return. If this is non-@code{nil}, then the return value is truncated
1336after the first @var{maximum} matching fonts. Specifying a small value
1337for @var{maximum} can make this function much faster, in cases where
1338many fonts match the pattern.
1339@end defun
1340
1341@node Fontsets
1342@section Fontsets
1343
1344 A @dfn{fontset} is a list of fonts, each assigned to a range of
1345character codes. An individual font cannot display the whole range of
1346characters that Emacs supports, but a fontset can. Fontsets have names,
1347just as fonts do, and you can use a fontset name in place of a font name
1348when you specify the ``font'' for a frame or a face. Here is
1349information about defining a fontset under Lisp program control.
1350
1351@defun create-fontset-from-fontset-spec fontset-spec &optional style-variant-p noerror
1352This function defines a new fontset according to the specification
1353string @var{fontset-spec}. The string should have this format:
1354
1355@smallexample
1356@var{fontpattern}, @r{[}@var{charsetname}:@var{fontname}@r{]@dots{}}
1357@end smallexample
1358
1359@noindent
1360Whitespace characters before and after the commas are ignored.
1361
1362The first part of the string, @var{fontpattern}, should have the form of
1363a standard X font name, except that the last two fields should be
1364@samp{fontset-@var{alias}}.
1365
1366The new fontset has two names, one long and one short. The long name is
1367@var{fontpattern} in its entirety. The short name is
1368@samp{fontset-@var{alias}}. You can refer to the fontset by either
1369name. If a fontset with the same name already exists, an error is
1370signaled, unless @var{noerror} is non-@code{nil}, in which case this
1371function does nothing.
1372
1373If optional argument @var{style-variant-p} is non-@code{nil}, that says
1374to create bold, italic and bold-italic variants of the fontset as well.
1375These variant fontsets do not have a short name, only a long one, which
1376is made by altering @var{fontpattern} to indicate the bold or italic
1377status.
1378
1379The specification string also says which fonts to use in the fontset.
1380See below for the details.
1381@end defun
1382
1383 The construct @samp{@var{charset}:@var{font}} specifies which font to
1384use (in this fontset) for one particular character set. Here,
1385@var{charset} is the name of a character set, and @var{font} is the font
1386to use for that character set. You can use this construct any number of
1387times in the specification string.
1388
1389 For the remaining character sets, those that you don't specify
1390explicitly, Emacs chooses a font based on @var{fontpattern}: it replaces
1391@samp{fontset-@var{alias}} with a value that names one character set.
1392For the @sc{ASCII} character set, @samp{fontset-@var{alias}} is replaced
1393with @samp{ISO8859-1}.
1394
1395 In addition, when several consecutive fields are wildcards, Emacs
1396collapses them into a single wildcard. This is to prevent use of
1397auto-scaled fonts. Fonts made by scaling larger fonts are not usable
1398for editing, and scaling a smaller font is not useful because it is
1399better to use the smaller font in its own size, which Emacs does.
1400
1401 Thus if @var{fontpattern} is this,
1402
1403@example
1404-*-fixed-medium-r-normal-*-24-*-*-*-*-*-fontset-24
1405@end example
1406
1407@noindent
1408the font specification for ASCII characters would be this:
1409
1410@example
1411-*-fixed-medium-r-normal-*-24-*-ISO8859-1
1412@end example
1413
1414@noindent
1415and the font specification for Chinese GB2312 characters would be this:
1416
1417@example
1418-*-fixed-medium-r-normal-*-24-*-gb2312*-*
1419@end example
1420
1421 You may not have any Chinese font matching the above font
1422specification. Most X distributions include only Chinese fonts that
1423have @samp{song ti} or @samp{fangsong ti} in the @var{family} field. In
1424such a case, @samp{Fontset-@var{n}} can be specified as below:
1425
1426@smallexample
1427Emacs.Fontset-0: -*-fixed-medium-r-normal-*-24-*-*-*-*-*-fontset-24,\
1428 chinese-gb2312:-*-*-medium-r-normal-*-24-*-gb2312*-*
1429@end smallexample
1430
1431@noindent
1432Then, the font specifications for all but Chinese GB2312 characters have
1433@samp{fixed} in the @var{family} field, and the font specification for
1434Chinese GB2312 characters has a wild card @samp{*} in the @var{family}
1435field.
1436 1368
1437@node Color Names 1369@node Color Names
1438@section Color Names 1370@section Color Names
1439 1371
1440@defun x-color-defined-p color &optional frame 1372 These functions provide a way to determine which color names are
1373valid, and what they look like.
1374
1375@defun color-defined-p color &optional frame
1376@tindex color-defined-p
1441This function reports whether a color name is meaningful. It returns 1377This function reports whether a color name is meaningful. It returns
1442@code{t} if so; otherwise, @code{nil}. The argument @var{frame} says 1378@code{t} if so; otherwise, @code{nil}. The argument @var{frame} says
1443which frame's display to ask about; if @var{frame} is omitted or 1379which frame's display to ask about; if @var{frame} is omitted or
1444@code{nil}, the selected frame is used. 1380@code{nil}, the selected frame is used.
1445 1381
1446Note that this does not tell you whether the display you are using 1382Note that this does not tell you whether the display you are using
1447really supports that color. You can ask for any defined color on any 1383really supports that color. When using X, you can ask for any defined
1448kind of display, and you will get some result---that is how the X server 1384color on any kind of display, and you will get some result---typically,
1449works. Here's an approximate way to test whether your display supports 1385the best it knows how to do. Here's an approximate way to test whether
1450the color @var{color}: 1386your display supports the color @var{color}:
1451 1387
1452@example 1388@example
1453(defun x-color-supported-p (color &optional frame) 1389(defun x-color-supported-p (color &optional frame)
1454 (and (x-color-defined-p color frame) 1390 (and (color-defined-p color frame)
1455 (or (x-display-color-p frame) 1391 (or (x-display-color-p frame)
1456 (member color '("black" "white")) 1392 (member color '("black" "white"))
1457 (and (> (x-display-planes frame) 1) 1393 (and (> (x-display-planes frame) 1)
1458 (equal color "gray"))))) 1394 (equal color "gray")))))
1459@end example 1395@end example
1396
1397This function used to be called @code{x-color-defined-p},
1398and that name is still supported as an alias.
1399@end defun
1400
1401@defun defined-colors &optional frame
1402@tindex defined-colors
1403This function returns a list of the color names that are defined
1404and supported on frame @var{frame} (default, the selected frame).
1405
1406This function used to be called @code{x-defined-colors},
1407and that name is still supported as an alias.
1460@end defun 1408@end defun
1461 1409
1462@defun x-color-values color &optional frame 1410@defun color-values color &optional frame
1411@tindex color-values
1463This function returns a value that describes what @var{color} should 1412This function returns a value that describes what @var{color} should
1464ideally look like. If @var{color} is defined, the value is a list of 1413ideally look like. If @var{color} is defined, the value is a list of
1465three integers, which give the amount of red, the amount of green, and 1414three integers, which give the amount of red, the amount of green, and
1466the amount of blue. Each integer ranges in principle from 0 to 65535, 1415the amount of blue. Each integer ranges in principle from 0 to 65535,
1467but in practice no value seems to be above 65280. If @var{color} is not 1416but in practice no value seems to be above 65280. This kind
1468defined, the value is @code{nil}. 1417of three-element list is called an @dfn{rgb value}.
1418
1419If @var{color} is not defined, the value is @code{nil}.
1469 1420
1470@example 1421@example
1471(x-color-values "black") 1422(color-values "black")
1472 @result{} (0 0 0) 1423 @result{} (0 0 0)
1473(x-color-values "white") 1424(color-values "white")
1474 @result{} (65280 65280 65280) 1425 @result{} (65280 65280 65280)
1475(x-color-values "red") 1426(color-values "red")
1476 @result{} (65280 0 0) 1427 @result{} (65280 0 0)
1477(x-color-values "pink") 1428(color-values "pink")
1478 @result{} (65280 49152 51968) 1429 @result{} (65280 49152 51968)
1479(x-color-values "hungry") 1430(color-values "hungry")
1480 @result{} nil 1431 @result{} nil
1481@end example 1432@end example
1482 1433
1483The color values are returned for @var{frame}'s display. If @var{frame} 1434The color values are returned for @var{frame}'s display. If @var{frame}
1484is omitted or @code{nil}, the information is returned for the selected 1435is omitted or @code{nil}, the information is returned for the selected
1485frame's display. 1436frame's display.
1437
1438This function used to be called @code{x-color-values},
1439and that name is still supported as an alias.
1440@end defun
1441
1442@node Text Terminal Colors
1443@section Text Terminal Colors
1444@cindex colors on text-only terminals
1445
1446 Emacs can display color on text-only terminals, starting with version
144721. These terminals support only a small number of colors, and the
1448computer uses small integers to select colors on the terminal. This
1449means that the computer cannot reliably tell what the selected color
1450looks like; instead, you have to inform your application which small
1451integers correspond to which colors. However, Emacs does know the
1452standard set of colors and will try to use them automatically.
1453
1454@cindex rgb value
1455 Several of these functions use or return @dfn{rgb values}. An rgb
1456value is a list of three integers, which give the amount of red, the
1457amount of green, and the amount of blue. Each integer ranges in
1458principle from 0 to 65535, but in practice the largest value used is
145965280.
1460
1461@defun tty-define-color name number &optional rgb
1462@tindex tty-define-color
1463This function associates the color name @var{name} with
1464color number @var{number} on the terminal.
1465
1466The optional argument @var{rgb}, if specified, is an rgb value; it says
1467what the color actually looks like. If you do not specify @var{rgb},
1468then this color cannot be used by @code{tty-color-approximate} to
1469approximate other colors, because Emacs does not know what it looks
1470like.
1471@end defun
1472
1473@defun tty-clear-colors
1474@tindex tty-clear-colors
1475This function clears the table of defined colors for a text-only terminal.
1476@end defun
1477
1478@defvar tty-color-alist
1479@tindex tty-color-alist
1480This variable holds an alist recording the colors supported by the
1481terminal.
1482
1483Each element has the form @code{(@var{name} @var{number} . @var{rgb})}
1484or @code{(@var{name} @var{number})}. Here, @var{name} is the color
1485name, @var{number} is the number used to specify it to the terminal.
1486If present, @var{rgb} is an rgb value that says what the color
1487actually looks like.
1488@end defun
1489
1490@defun tty-color-approximate rgb
1491@tindex tty-color-approximate
1492This function finds the closest available color, among those in
1493@code{tty-color-alist}, to that described by the rgb value @var{rgb}.
1494@end defun
1495
1496@defun tty-color-translate color
1497@tindex tty-color-translate
1498This function finds the closest available color, among those in
1499@code{tty-color-alist}, to the name @var{color}. If that name
1500is not defined, the value is @code{nil}.
1501
1502@var{color} can be an X-style @code{#@var{xxxyyyzzz}} specification
1503instead of an actual name.
1486@end defun 1504@end defun
1487 1505
1488@node Resources 1506@node Resources
diff --git a/lispref/functions.texi b/lispref/functions.texi
index 510b3e1766d..edec40d5072 100644
--- a/lispref/functions.texi
+++ b/lispref/functions.texi
@@ -879,6 +879,7 @@ comment:
879(function @var{symbol}) @equiv{} (quote @var{symbol}) @equiv{} '@var{symbol} 879(function @var{symbol}) @equiv{} (quote @var{symbol}) @equiv{} '@var{symbol}
880@end example 880@end example
881 881
882@cindex @samp{#'} syntax
882 The read syntax @code{#'} is a short-hand for using @code{function}. 883 The read syntax @code{#'} is a short-hand for using @code{function}.
883For example, 884For example,
884 885
diff --git a/lispref/internals.texi b/lispref/internals.texi
index 33f5cb26dbd..0df7f9ec509 100644
--- a/lispref/internals.texi
+++ b/lispref/internals.texi
@@ -97,7 +97,7 @@ installation directory for Lisp files when you install Emacs.
97 97
98@item 98@item
99Specify a non-@code{nil} value for 99Specify a non-@code{nil} value for
100@code{byte-compile-dynamic-docstrings} as a local variable in each these 100@code{byte-compile-dynamic-docstrings} as a local variable in each of these
101files, and load them with either @file{site-load.el} or 101files, and load them with either @file{site-load.el} or
102@file{site-init.el}. (This method has the drawback that the 102@file{site-init.el}. (This method has the drawback that the
103documentation strings take up space in Emacs all the time.) 103documentation strings take up space in Emacs all the time.)
@@ -107,7 +107,7 @@ documentation strings take up space in Emacs all the time.)
107@file{site-init.el} that would alter any of the features that users 107@file{site-init.el} that would alter any of the features that users
108expect in an ordinary unmodified Emacs. If you feel you must override 108expect in an ordinary unmodified Emacs. If you feel you must override
109normal features for your site, do it with @file{default.el}, so that 109normal features for your site, do it with @file{default.el}, so that
110users can override your changes if they wish. @xref{Start-up Summary}. 110users can override your changes if they wish. @xref{Startup Summary}.
111 111
112@defun dump-emacs to-file from-file 112@defun dump-emacs to-file from-file
113@cindex unexec 113@cindex unexec
@@ -125,7 +125,7 @@ you must run Emacs with @samp{-batch}.
125 125
126 Emacs Lisp uses two kinds of storage for user-created Lisp objects: 126 Emacs Lisp uses two kinds of storage for user-created Lisp objects:
127@dfn{normal storage} and @dfn{pure storage}. Normal storage is where 127@dfn{normal storage} and @dfn{pure storage}. Normal storage is where
128all the new data created during an Emacs session is kept; see the 128all the new data created during an Emacs session are kept; see the
129following section for information on normal storage. Pure storage is 129following section for information on normal storage. Pure storage is
130used for certain data in the preloaded standard Lisp files---data that 130used for certain data in the preloaded standard Lisp files---data that
131should never change during actual use of Emacs. 131should never change during actual use of Emacs.
@@ -142,8 +142,8 @@ increase the compilation parameter @code{PURESIZE} in the file
142preload additional libraries or add features to the standard ones. 142preload additional libraries or add features to the standard ones.
143 143
144@defun purecopy object 144@defun purecopy object
145This function makes a copy of @var{object} in pure storage and returns 145This function makes a copy in pure storage of @var{object}, and returns
146it. It copies strings by simply making a new string with the same 146it. It copies a string by simply making a new string with the same
147characters in pure storage. It recursively copies the contents of 147characters in pure storage. It recursively copies the contents of
148vectors and cons cells. It does not make copies of other objects such 148vectors and cons cells. It does not make copies of other objects such
149as symbols, but just returns them unchanged. It signals an error if 149as symbols, but just returns them unchanged. It signals an error if
@@ -553,10 +553,10 @@ you use @code{GCPRO2}, you must declare @code{gcpro1} and @code{gcpro2}.
553Alas, we can't explain all the tricky details here. 553Alas, we can't explain all the tricky details here.
554 554
555 You must not use C initializers for static or global variables unless 555 You must not use C initializers for static or global variables unless
556they are never written once Emacs is dumped. These variables with 556the variables are never stored in once Emacs is dumped. These variables
557initializers are allocated in an area of memory that becomes read-only 557with initializers are allocated in an area of memory that becomes
558(on certain operating systems) as a result of dumping Emacs. @xref{Pure 558read-only (on certain operating systems) as a result of dumping Emacs.
559Storage}. 559@xref{Pure Storage}.
560 560
561 Do not use static variables within functions---place all static 561 Do not use static variables within functions---place all static
562variables at top level in the file. This is necessary because Emacs on 562variables at top level in the file. This is necessary because Emacs on
@@ -587,16 +587,19 @@ file, add to it a @code{syms_of_@var{filename}} (e.g.,
587of these functions are called, and add a call to 587of these functions are called, and add a call to
588@code{syms_of_@var{filename}} there. 588@code{syms_of_@var{filename}} there.
589 589
590@vindex byte-boolean-vars
590 The function @code{syms_of_@var{filename}} is also the place to define 591 The function @code{syms_of_@var{filename}} is also the place to define
591any C variables that are to be visible as Lisp variables. 592any C variables that are to be visible as Lisp variables.
592@code{DEFVAR_LISP} makes a C variable of type @code{Lisp_Object} visible 593@code{DEFVAR_LISP} makes a C variable of type @code{Lisp_Object} visible
593in Lisp. @code{DEFVAR_INT} makes a C variable of type @code{int} 594in Lisp. @code{DEFVAR_INT} makes a C variable of type @code{int}
594visible in Lisp with a value that is always an integer. 595visible in Lisp with a value that is always an integer.
595@code{DEFVAR_BOOL} makes a C variable of type @code{int} visible in Lisp 596@code{DEFVAR_BOOL} makes a C variable of type @code{int} visible in Lisp
596with a value that is either @code{t} or @code{nil}. 597with a value that is either @code{t} or @code{nil}. Note that variables
598defined with @code{DEFVAR_BOOL} are automatically added to the list
599@code{byte-boolean-vars} used by the byte compiler.
597 600
598 If you define a file-scope C variable of type @code{Lisp_Object}, 601 If you define a file-scope C variable of type @code{Lisp_Object},
599you must protect it for garbage-collection by calling @code{staticpro} 602you must protect it from garbage-collection by calling @code{staticpro}
600in @code{syms_of_@var{filename}}, like this: 603in @code{syms_of_@var{filename}}, like this:
601 604
602@example 605@example
@@ -681,6 +684,11 @@ number of arguments. They work by calling @code{Ffuncall}.
681@file{lisp.h} contains the definitions for some important macros and 684@file{lisp.h} contains the definitions for some important macros and
682functions. 685functions.
683 686
687 If you define a function which is side-effect free, update the code in
688@file{byte-opt.el} which binds @code{side-effect-free-fns} and
689@code{side-effect-and-error-free-fns} to include it. This will help the
690optimizer.
691
684@node Object Internals 692@node Object Internals
685@appendixsec Object Internals 693@appendixsec Object Internals
686@cindex object internals 694@cindex object internals
@@ -729,9 +737,9 @@ This field contains the time when the buffer was last saved, as an integer.
729 737
730@item modtime 738@item modtime
731This field contains the modification time of the visited file. It is 739This field contains the modification time of the visited file. It is
732set when the file is written or read. Every time the buffer is written 740set when the file is written or read. Before writing the buffer into a
733to the file, this field is compared to the modification time of the 741file, this field is compared to the modification time of the file to see
734file. @xref{Buffer Modification}. 742if the file has changed on disk. @xref{Buffer Modification}.
735 743
736@item auto_save_modified 744@item auto_save_modified
737This field contains the time when the buffer was last auto-saved. 745This field contains the time when the buffer was last auto-saved.
@@ -872,7 +880,9 @@ the screen is @w{line 0}.)
872The height of the window, measured in lines. 880The height of the window, measured in lines.
873 881
874@item width 882@item width
875The width of the window, measured in columns. 883The width of the window, measured in columns. This width includes the
884scroll bar and fringes, and/or the separator line on the right of the
885window (if any).
876 886
877@item next 887@item next
878This is the window that is the next in the chain of siblings. It is 888This is the window that is the next in the chain of siblings. It is
diff --git a/lispref/intro.texi b/lispref/intro.texi
index 10c3763822a..34a6ae12fac 100644
--- a/lispref/intro.texi
+++ b/lispref/intro.texi
@@ -343,7 +343,7 @@ the ``copyright'' line and a pointer to where the full notice is found.
343 343
344@smallexample 344@smallexample
345@var{one line to give the program's name and an idea of what it does.} 345@var{one line to give the program's name and an idea of what it does.}
346Copyright (C) 19@var{yy} @var{name of author} 346Copyright (C) @var{year} @var{name of author}
347 347
348This program is free software; you can redistribute it and/or 348This program is free software; you can redistribute it and/or
349modify it under the terms of the GNU General Public License 349modify it under the terms of the GNU General Public License
@@ -366,7 +366,7 @@ If the program is interactive, make it output a short notice like this
366when it starts in an interactive mode: 366when it starts in an interactive mode:
367 367
368@smallexample 368@smallexample
369Gnomovision version 69, Copyright (C) 19@var{yy} @var{name of author} 369Gnomovision version 69, Copyright (C) @var{year} @var{name of author}
370Gnomovision comes with ABSOLUTELY NO WARRANTY; for details 370Gnomovision comes with ABSOLUTELY NO WARRANTY; for details
371type `show w'. This is free software, and you are welcome 371type `show w'. This is free software, and you are welcome
372to redistribute it under certain conditions; type `show c' 372to redistribute it under certain conditions; type `show c'
@@ -521,7 +521,7 @@ worry about it; this manual is self-contained.
521 521
522@pindex cl 522@pindex cl
523 A certain amount of Common Lisp emulation is available via the 523 A certain amount of Common Lisp emulation is available via the
524@file{cl} library @xref{Top,, Common Lisp Extension, cl, Common Lisp 524@file{cl} library. @xref{Top,, Common Lisp Extension, cl, Common Lisp
525Extensions}. 525Extensions}.
526 526
527 Emacs Lisp is not at all influenced by Scheme; but the GNU project has 527 Emacs Lisp is not at all influenced by Scheme; but the GNU project has
@@ -556,10 +556,9 @@ addressed as ``you''. ``The user'' is the person who uses Lisp
556programs, including those you write. 556programs, including those you write.
557 557
558@cindex fonts 558@cindex fonts
559 Examples of Lisp code appear in this font or form: @code{(list 1 2 559 Examples of Lisp code are formatted like this: @code{(list 1 2 3)}.
5603)}. Names that represent metasyntactic variables, or arguments to a 560Names that represent metasyntactic variables, or arguments to a function
561function being described, appear in this font or form: 561being described, are formatted like this: @var{first-number}.
562@var{first-number}.
563 562
564@node nil and t 563@node nil and t
565@subsection @code{nil} and @code{t} 564@subsection @code{nil} and @code{t}
@@ -685,13 +684,13 @@ the echo area.
685@subsection Buffer Text Notation 684@subsection Buffer Text Notation
686@cindex buffer text notation 685@cindex buffer text notation
687 686
688 Some examples show modifications to text in a buffer, with ``before'' 687 Some examples describe modifications to the contents of a buffer, by
689and ``after'' versions of the text. These examples show the contents of 688showing the ``before'' and ``after'' versions of the text. These
690the buffer in question between two lines of dashes containing the buffer 689examples show the contents of the buffer in question between two lines
691name. In addition, @samp{@point{}} indicates the location of point. 690of dashes containing the buffer name. In addition, @samp{@point{}}
692(The symbol for point, of course, is not part of the text in the buffer; 691indicates the location of point. (The symbol for point, of course, is
693it indicates the place @emph{between} two characters where point is 692not part of the text in the buffer; it indicates the place
694currently located.) 693@emph{between} two characters where point is currently located.)
695 694
696@example 695@example
697---------- Buffer: foo ---------- 696---------- Buffer: foo ----------
@@ -900,7 +899,9 @@ emacs-build-time
900The value of this variable is the version of Emacs being run. It is a 899The value of this variable is the version of Emacs being run. It is a
901string such as @code{"20.3.1"}. The last number in this string is not 900string such as @code{"20.3.1"}. The last number in this string is not
902really part of the Emacs release version number; it is incremented each 901really part of the Emacs release version number; it is incremented each
903time you build Emacs in any given directory. 902time you build Emacs in any given directory. A value with three numeric
903components, such as @code{"20.3.9.1"}, indicates an unreleased test
904version.
904@end defvar 905@end defvar
905 906
906 The following two variables have existed since Emacs version 19.23: 907 The following two variables have existed since Emacs version 19.23:
diff --git a/lispref/keymaps.texi b/lispref/keymaps.texi
index b036679d4f6..d6ed2e3e4c9 100644
--- a/lispref/keymaps.texi
+++ b/lispref/keymaps.texi
@@ -124,17 +124,17 @@ completely masks any lower-precedence keymap.
124 124
125@item @var{vector} 125@item @var{vector}
126If an element of a keymap is a vector, the vector counts as bindings for 126If an element of a keymap is a vector, the vector counts as bindings for
127all the @sc{ASCII} characters, codes 0 through 127; vector element 127all the @sc{ascii} characters, codes 0 through 127; vector element
128@var{n} is the binding for the character with code @var{n}. This is a 128@var{n} is the binding for the character with code @var{n}. This is a
129compact way to record lots of bindings. A keymap with such a vector is 129compact way to record lots of bindings. A keymap with such a vector is
130called a @dfn{full keymap}. Other keymaps are called @dfn{sparse 130called a @dfn{full keymap}. Other keymaps are called @dfn{sparse
131keymaps}. 131keymaps}.
132 132
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, for @sc{ASCII} characters. However, default 136binding in the keymap, for @sc{ascii} characters. However, default
137bindings are still meaningful for events other than @sc{ASCII} 137bindings are still meaningful for events other than @sc{ascii}
138characters. A binding of @code{nil} does @emph{not} override 138characters. A binding of @code{nil} does @emph{not} override
139lower-precedence keymaps; thus, if the local map gives a binding of 139lower-precedence keymaps; thus, if the local map gives a binding of
140@code{nil}, Emacs uses the binding from the global map. 140@code{nil}, Emacs uses the binding from the global map.
@@ -215,8 +215,8 @@ otherwise. More precisely, this function tests for a list whose
215@c ??? This should come after make-sparse-keymap 215@c ??? This should come after make-sparse-keymap
216@defun make-keymap &optional prompt 216@defun make-keymap &optional prompt
217This function creates and returns a new full keymap (i.e., one 217This function creates and returns a new full keymap (i.e., one
218containing a vector of length 128 for defining all the @sc{ASCII} 218containing a vector of length 128 for defining all the @sc{ascii}
219characters). The new keymap initially binds all @sc{ASCII} characters 219characters). The new keymap initially binds all @sc{ascii} characters
220to @code{nil}, and does not bind any other kind of event. 220to @code{nil}, and does not bind any other kind of event.
221 221
222@example 222@example
@@ -567,7 +567,7 @@ other.
567This function returns the current buffer's local keymap, or @code{nil} 567This function returns the current buffer's local keymap, or @code{nil}
568if it has none. In the following example, the keymap for the 568if it has none. In the following example, the keymap for the
569@samp{*scratch*} buffer (using Lisp Interaction mode) is a sparse keymap 569@samp{*scratch*} buffer (using Lisp Interaction mode) is a sparse keymap
570in which the entry for @key{ESC}, @sc{ASCII} code 27, is another sparse 570in which the entry for @key{ESC}, @sc{ascii} code 27, is another sparse
571keymap. 571keymap.
572 572
573@example 573@example
@@ -953,7 +953,7 @@ This variable is the meta-prefix character code. It is used when
953translating a meta character to a two-character sequence so it can be 953translating a meta character to a two-character sequence so it can be
954looked up in a keymap. For useful results, the value should be a prefix 954looked up in a keymap. For useful results, the value should be a prefix
955event (@pxref{Prefix Keys}). The default value is 27, which is the 955event (@pxref{Prefix Keys}). The default value is 27, which is the
956@sc{ASCII} code for @key{ESC}. 956@sc{ascii} code for @key{ESC}.
957 957
958As long as the value of @code{meta-prefix-char} remains 27, key 958As long as the value of @code{meta-prefix-char} remains 27, key
959lookup translates @kbd{M-b} into @kbd{@key{ESC} b}, which is normally 959lookup translates @kbd{M-b} into @kbd{@key{ESC} b}, which is normally
@@ -1256,6 +1256,35 @@ redefines @kbd{C-x C-\} to move down a line.
1256redefines the first (leftmost) mouse button, typed with the Meta key, to 1256redefines the first (leftmost) mouse button, typed with the Meta key, to
1257set point where you click. 1257set point where you click.
1258 1258
1259@cindex non-ASCII text in keybindings
1260 Be careful when using non-@sc{ascii} text characters in Lisp
1261specifications of keys to bind. If these are read as multibyte text, as
1262they usually will be in a Lisp file (@pxref{Loading Non-ASCII}), you
1263must type the keys as multibyte too. For instance, if you use this:
1264
1265@smallexample
1266(global-set-key "@"o" 'my-function) ; bind o-umlaut
1267@end smallexample
1268
1269@noindent
1270or
1271
1272@smallexample
1273(global-set-key ?@"o 'my-function) ; bind o-umlaut
1274@end smallexample
1275
1276@noindent
1277and your language environment is multibyte Latin-1, these commands
1278actually bind the multibyte character with code 2294, not the unibyte
1279Latin-1 character with code 246 (@kbd{M-v}). In order to use this
1280binding, you need to enter the multibyte Latin-1 character as keyboard
1281input. One way to do this is by using an appropriate input method
1282(@pxref{Input Methods, , Input Methods, emacs,The GNU Emacs Manual}).
1283
1284 If you want to use a unibyte character in the key binding, you can
1285construct the key sequence string using @code{multibyte-char-to-unibyte}
1286or @code{string-make-unibyte} (@pxref{Converting Representations}).
1287
1259@deffn Command global-set-key key definition 1288@deffn Command global-set-key key definition
1260This function sets the binding of @var{key} in the current global map 1289This function sets the binding of @var{key} in the current global map
1261to @var{definition}. 1290to @var{definition}.
@@ -1431,7 +1460,7 @@ If @var{firstonly} is @code{non-ascii}, then the value is a single
1431string representing the first key sequence found, rather than a list of 1460string representing the first key sequence found, rather than a list of
1432all possible key sequences. If @var{firstonly} is @code{t}, then the 1461all possible key sequences. If @var{firstonly} is @code{t}, then the
1433value is the first key sequence, except that key sequences consisting 1462value is the first key sequence, except that key sequences consisting
1434entirely of @sc{ASCII} characters (or meta variants of @sc{ASCII} 1463entirely of @sc{ascii} characters (or meta variants of @sc{ascii}
1435characters) are preferred to all other key sequences. 1464characters) are preferred to all other key sequences.
1436 1465
1437If @var{noindirect} is non-@code{nil}, @code{where-is-internal} doesn't 1466If @var{noindirect} is non-@code{nil}, @code{where-is-internal} doesn't
@@ -1457,13 +1486,13 @@ listing includes only keys that start with @var{prefix}.
1457The listing describes meta characters as @key{ESC} followed by the 1486The listing describes meta characters as @key{ESC} followed by the
1458corresponding non-meta character. 1487corresponding non-meta character.
1459 1488
1460When several characters with consecutive @sc{ASCII} codes have the 1489When several characters with consecutive @sc{ascii} codes have the
1461same definition, they are shown together, as 1490same definition, they are shown together, as
1462@samp{@var{firstchar}..@var{lastchar}}. In this instance, you need to 1491@samp{@var{firstchar}..@var{lastchar}}. In this instance, you need to
1463know the @sc{ASCII} codes to understand which characters this means. 1492know the @sc{ascii} codes to understand which characters this means.
1464For example, in the default global map, the characters @samp{@key{SPC} 1493For example, in the default global map, the characters @samp{@key{SPC}
1465..@: ~} are described by a single line. @key{SPC} is @sc{ASCII} 32, 1494..@: ~} are described by a single line. @key{SPC} is @sc{ascii} 32,
1466@kbd{~} is @sc{ASCII} 126, and the characters between them include all 1495@kbd{~} is @sc{ascii} 126, and the characters between them include all
1467the normal printing characters, (e.g., letters, digits, punctuation, 1496the normal printing characters, (e.g., letters, digits, punctuation,
1468etc.@:); all these characters are bound to @code{self-insert-command}. 1497etc.@:); all these characters are bound to @code{self-insert-command}.
1469@end deffn 1498@end deffn
@@ -1483,6 +1512,7 @@ work with the keyboard also.
1483* Keyboard Menus:: How they actuate it with the keyboard. 1512* Keyboard Menus:: How they actuate it with the keyboard.
1484* Menu Example:: Making a simple menu. 1513* Menu Example:: Making a simple menu.
1485* Menu Bar:: How to customize the menu bar. 1514* Menu Bar:: How to customize the menu bar.
1515* Tool Bar:: A tool bar is a row of images.
1486* Modifying Menus:: How to add new items to a menu. 1516* Modifying Menus:: How to add new items to a menu.
1487@end menu 1517@end menu
1488 1518
@@ -1509,10 +1539,11 @@ an existing menu, you can specify its position in the menu using
1509@menu 1539@menu
1510* Simple Menu Items:: A simple kind of menu key binding, 1540* Simple Menu Items:: A simple kind of menu key binding,
1511 limited in capabilities. 1541 limited in capabilities.
1512* Alias Menu Items:: Using command aliases in menu items.
1513* Extended Menu Items:: More powerful menu item definitions 1542* Extended Menu Items:: More powerful menu item definitions
1514 let you specify keywords to enable 1543 let you specify keywords to enable
1515 various features. 1544 various features.
1545* Menu Separators:: Drawing a horizontal line through a menu.
1546* Alias Menu Items:: Using command aliases in menu items.
1516@end menu 1547@end menu
1517 1548
1518@node Simple Menu Items 1549@node Simple Menu Items
@@ -1591,7 +1622,8 @@ the item looks like this:
1591@end example 1622@end example
1592 1623
1593@noindent 1624@noindent
1594where a string consisting of two or more dashes specifies a separator line. 1625A string starting with two or more dashes specifies a separator line;
1626see @ref{Menu Separators}.
1595 1627
1596 To define a real menu item which can be selected, the extended format 1628 To define a real menu item which can be selected, the extended format
1597item looks like this: 1629item looks like this:
@@ -1609,11 +1641,12 @@ string. Thus, the string need not be a constant. The third element,
1609other information. Here is a table of the properties that are supported: 1641other information. Here is a table of the properties that are supported:
1610 1642
1611@table @code 1643@table @code
1612@item :enable FORM 1644@item :enable @var{form}
1613The result of evaluating @var{form} determines whether the item is 1645The result of evaluating @var{form} determines whether the item is
1614enabled (non-@code{nil} means yes). 1646enabled (non-@code{nil} means yes). If the item is not enabled,
1647you can't really click on it.
1615 1648
1616@item :visible FORM 1649@item :visible @var{form}
1617The result of evaluating @var{form} determines whether the item should 1650The result of evaluating @var{form} determines whether the item should
1618actually appear in the menu (non-@code{nil} means yes). If the item 1651actually appear in the menu (non-@code{nil} means yes). If the item
1619does not appear, then the menu is displayed as if this item were 1652does not appear, then the menu is displayed as if this item were
@@ -1684,6 +1717,80 @@ when it is called, its argument will be @var{real-binding}. The
1684function should return the binding to use instead. 1717function should return the binding to use instead.
1685@end table 1718@end table
1686 1719
1720@node Menu Separators
1721@subsubsection Menu Separators
1722@cindex menu separators
1723
1724 A menu separator is a kind of menu item that doesn't display any
1725text--instead, it divides the menu into subparts with a horizontal line.
1726A separator looks like this in the menu keymap:
1727
1728@example
1729(menu-item @var{separator-type})
1730@end example
1731
1732@noindent
1733where @var{separator-type} is a string starting with two or more dashes.
1734
1735 In the simplest case, @var{separator-type} consists of only dashes.
1736That specifies the default kind of separator. (For compatibility,
1737@code{""} and @code{-} also count as separators.)
1738
1739 Starting in Emacs 21, certain other values of @var{separator-type}
1740specify a different style of separator. Here is a table of them:
1741
1742@table @code
1743@item "--no-line"
1744@itemx "--space"
1745An extra vertical space, with no actual line.
1746
1747@item "--single-line"
1748A single line in the menu's foreground color.
1749
1750@item "--double-line"
1751A double line in the menu's foreground color.
1752
1753@item "--single-dashed-line"
1754A single dashed line in the menu's foreground color.
1755
1756@item "--double-dashed-line"
1757A double dashed line in the menu's foreground color.
1758
1759@item "--shadow-etched-in"
1760A single line with a 3D sunken appearance. This is the default,
1761used separators consisting of dashes only.
1762
1763@item "--shadow-etched-out"
1764A single line with a 3D raised appearance.
1765
1766@item "--shadow-etched-in-dash"
1767A single dashed line with a 3D sunken appearance.
1768
1769@item "--shadow-etched-out-dash"
1770A single dashed line with a 3D raised appearance.
1771
1772@item "--shadow-double-etched-in"
1773Two lines with a 3D sunken appearance.
1774
1775@item "--shadow-double-etched-out"
1776Two lines with a 3D raised appearance.
1777
1778@item "--shadow-double-etched-in-dash"
1779Two dashed lines with a 3D sunken appearance.
1780
1781@item "--shadow-double-etched-out-dash"
1782Two dashed lines with a 3D raised appearance.
1783@end table
1784
1785 You can also give these names in another style, adding a colon after
1786the double-dash and replacing each single dash with capitalization of
1787the following word. Thus, @code{"--:singleLine"}, is equivalent to
1788@code{"--single-line"}.
1789
1790 Some systems and display toolkits don't really handle all of these
1791separator types. If you use a type that isn't supported, the menu
1792displays a similar kind of separator that is supported.
1793
1687@node Alias Menu Items 1794@node Alias Menu Items
1688@subsubsection Alias Menu Items 1795@subsubsection Alias Menu Items
1689 1796
@@ -1978,6 +2085,115 @@ displaying a submenu. You can use it to update submenus whose contents
1978should vary. 2085should vary.
1979@end defvar 2086@end defvar
1980 2087
2088@node Tool Bar
2089@subsection Tool bars
2090@cindex tool bar
2091
2092 A @dfn{tool bar} is a row of icons at the top of a frame, that execute
2093commands when you click on them---in effect, a kind of graphical menu
2094bar. Emacs supports tool bars starting with version 21.
2095
2096 The frame parameter @code{tool-bar-lines} (X resource @samp{toolBar})
2097controls how may lines' worth of height to reserve for the tool bar. A
2098zero value suppresses the tool bar. If the value is nonzero, and
2099@code{auto-resize-tool-bars} is non-@code{nil}, the tool bar expands and
2100contracts automatically as needed to hold the specified contents.
2101
2102 The tool bar contents are controlled by a menu keymap attached to a
2103fake ``function key'' called @code{tool-bar} (much like the way the menu
2104bar is controlled). So you define a tool bar item using
2105@code{define-key}, like this:
2106
2107@example
2108(define-key global-map [tool-bar @var{key}] @var{item})
2109@end example
2110
2111@noindent
2112where @var{key} is a fake ``function key'' to distinguish this item from
2113other items, and @var{item} is a menu item key binding (@pxref{Extended
2114Menu Items}), which says how to display this item and how it behaves.
2115
2116 The usual menu keymap item properties, @code{:visible},
2117@code{:enable}, @code{:button}, and @code{:filter}, are useful in
2118tool bar bindings and have their normal meanings. The @var{real-binding}
2119in the item must be a command, not a keymap; in other words, it does not
2120work to define a tool bar icon as a prefix key.
2121
2122 The @code{:help} property is meaningful, and specifies a ``help-echo''
2123string to display while the mouse is on that item.
2124
2125 In addition, you should use the @code{:image} property;
2126this is how you specify the image to display in the tool bar:
2127
2128@table @code
2129@item :image @var{image}
2130@var{images} is either a single image specification or a vector of four
2131image specifications. If you use a vector of four,
2132one of them is used, depending on circumstances:
2133
2134@table @asis
2135@item item 0
2136Used when the iitem is enabled and selected.
2137@item item 1
2138Used when the item is enabled and deselected.
2139@item item 2
2140Used when the item is disabled and selected.
2141@item item 3
2142Used when the item is disabled and deselected.
2143@end table
2144@end table
2145
2146@tindex auto-resize-tool-bar
2147@defvar auto-resize-tool-bar
2148If this variable is non-@code{nil}, the tool bar automatically resizes to
2149show all defined tool bar items---but not larger than a quarter of the
2150frame's height.
2151@end defvar
2152
2153@tindex auto-raise-tool-bar-items
2154@defvar auto-raise-tool-bar-items
2155If this variable is non-@code{nil}, tool bar items display
2156in raised form when the mouse moves over them.
2157@end defvar
2158
2159@tindex tool-bar-item-margin
2160@defvar tool-bar-item-margin
2161This variable specifies an extra margin to add around tool bar items.
2162The value is an integer, a number of pixels. The default is 1.
2163@end defvar
2164
2165@tindex tool-bar-item-relief
2166@defvar tool-bar-item-relief
2167This variable specifies the shadow width for tool bar items.
2168The value is an integer, a number of pixels. The default is 3.
2169@end defvar
2170
2171 You can define a special meaning for clicking on a tool bar item with
2172the shift, control, meta, etc., modifiers. You do this by setting up
2173additional items that relate to the original item through the fake
2174function keys. Specifically, the additional items should use the
2175modified versions of the same fake function key used to name the
2176original item.
2177
2178 Thus, if the original item was defined this way,
2179
2180@example
2181(define-key global-map [tool-bar shell]
2182 '(menu-item "Shell" shell
2183 :image (image :type xpm :file "shell.xpm")))
2184@end example
2185
2186@noindent
2187then here is how you can define clicking on the same tool bar image with
2188the shift modifier:
2189
2190@example
2191(define-key global-map [tool-bar S-shell] 'some-command)
2192@end example
2193
2194@xref{Function Keys}, for more information about how to add modifiers to
2195function keys.
2196
1981@node Modifying Menus 2197@node Modifying Menus
1982@subsection Modifying Menus 2198@subsection Modifying Menus
1983 2199
diff --git a/lispref/lists.texi b/lispref/lists.texi
index ca310235940..58b1cfe4de8 100644
--- a/lispref/lists.texi
+++ b/lispref/lists.texi
@@ -302,6 +302,26 @@ This is in contrast to @code{cdr}, which signals an error if
302@end example 302@end example
303@end defun 303@end defun
304 304
305@tindex pop
306@defmac pop listname
307This macro is a way of examining the @sc{car} of a list,
308and taking it off the list, all at once. It is new in Emacs 21.
309
310It operates on the list which is stored in the symbol @var{listname}.
311It removes this element from the list by setting @var{listname}
312to the @sc{cdr} of its old value---but it also returns the @sc{car}
313of that list, which is the element being removed.
314
315@example
316x
317 @result{} (a b c)
318(pop x)
319 @result{} a
320x
321 @result{} (b c)
322@end example
323@end defmac
324
305@defun nth n list 325@defun nth n list
306This function returns the @var{n}th element of @var{list}. Elements 326This function returns the @var{n}th element of @var{list}. Elements
307are numbered starting with zero, so the @sc{car} of @var{list} is 327are numbered starting with zero, so the @sc{car} of @var{list} is
@@ -441,6 +461,13 @@ used in this example and the function named @code{list} described below;
441any symbol can serve both purposes. 461any symbol can serve both purposes.
442@end defun 462@end defun
443 463
464@tindex push
465@defmac push newelt listname
466This macro provides an alternative way to write
467@code{(setq @var{listname} (cons @var{newelt} @var{listname}))}.
468It is new in Emacs 21.
469@end defmac
470
444@defun list &rest objects 471@defun list &rest objects
445This function creates a list with @var{objects} as its elements. The 472This function creates a list with @var{objects} as its elements. The
446resulting list is always @code{nil}-terminated. If no @var{objects} 473resulting list is always @code{nil}-terminated. If no @var{objects}
@@ -1509,4 +1536,14 @@ the associations of one copy without affecting the other:
1509@end smallexample 1536@end smallexample
1510@end defun 1537@end defun
1511 1538
1539@defun assoc-delete-all key alist
1540@tindex assoc-delete-all
1541This function deletes from @var{alist} all the elements whose @sc{car}
1542is @var{key}. It returns the modified alist.
1512 1543
1544@example
1545(assoc-delete-all 'foo
1546 '((foo 1) (bar 2) (foo 3) (lose 4)))
1547 @result{} ((bar 2) (lose 4))
1548@end example
1549@end defun
diff --git a/lispref/loading.texi b/lispref/loading.texi
index b5b03abc93b..813e03338f6 100644
--- a/lispref/loading.texi
+++ b/lispref/loading.texi
@@ -36,7 +36,7 @@ containing Lisp code.
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. 38* Library Search:: Finding a library to load.
39* Loading Non-ASCII:: Non-@sc{ASCII} characters in Emacs Lisp files. 39* Loading Non-ASCII:: Non-@sc{ascii} characters in Emacs Lisp files.
40* Autoload:: Setting up a function to autoload. 40* Autoload:: Setting up a function to autoload.
41* Repeated Loading:: Precautions about loading a file twice. 41* Repeated Loading:: Precautions about loading a file twice.
42* Named Features:: Loading a library if it isn't already loaded. 42* Named Features:: Loading a library if it isn't already loaded.
@@ -257,10 +257,10 @@ subdirectories multiple levels down are added to @code{load-path}.
257 257
258 Not all subdirectories are included, though. Subdirectories whose 258 Not all subdirectories are included, though. Subdirectories whose
259names do not start with a letter or digit are excluded. Subdirectories 259names do not start with a letter or digit are excluded. Subdirectories
260named @file{RCS} are excluded. Also, a subdirectory which contains a 260named @file{RCS} or @file{CVS} are excluded. Also, a subdirectory which
261file named @file{.nosearch} is excluded. You can use these methods to 261contains a file named @file{.nosearch} is excluded. You can use these
262prevent certain subdirectories of the @file{site-lisp} directories from 262methods to prevent certain subdirectories of the @file{site-lisp}
263being searched. 263directories from being searched.
264 264
265 If you run Emacs from the directory where it was built---that is, an 265 If you run Emacs from the directory where it was built---that is, an
266executable that has not been formally installed---then @code{load-path} 266executable that has not been formally installed---then @code{load-path}
@@ -287,7 +287,7 @@ tells @code{locate-library} to display the file name in the echo area.
287@node Loading Non-ASCII 287@node Loading Non-ASCII
288@section Loading Non-ASCII Characters 288@section Loading Non-ASCII Characters
289 289
290 When Emacs Lisp programs contain string constants with non-@sc{ASCII} 290 When Emacs Lisp programs contain string constants with non-@sc{ascii}
291characters, these can be represented within Emacs either as unibyte 291characters, these can be represented within Emacs either as unibyte
292strings or as multibyte strings (@pxref{Text Representations}). Which 292strings or as multibyte strings (@pxref{Text Representations}). Which
293representation is used depends on how the file is read into Emacs. If 293representation is used depends on how the file is read into Emacs. If
@@ -301,7 +301,7 @@ unibyte text, and its string constants will be unibyte strings.
301 To make the results more predictable, Emacs always performs decoding 301 To make the results more predictable, Emacs always performs decoding
302into the multibyte representation when loading Lisp files, even if it 302into the multibyte representation when loading Lisp files, even if it
303was started with the @samp{--unibyte} option. This means that string 303was started with the @samp{--unibyte} option. This means that string
304constants with non-@sc{ASCII} characters translate into multibyte 304constants with non-@sc{ascii} characters translate into multibyte
305strings. The only exception is when a particular file specifies no 305strings. The only exception is when a particular file specifies no
306decoding. 306decoding.
307 307
@@ -313,13 +313,13 @@ notice whether the user prefers unibyte or multibyte text, by checking
313@code{default-enable-multibyte-characters}, and convert representations 313@code{default-enable-multibyte-characters}, and convert representations
314appropriately. 314appropriately.
315 315
316 In most Emacs Lisp programs, the fact that non-@sc{ASCII} strings are 316 In most Emacs Lisp programs, the fact that non-@sc{ascii} strings are
317multibyte strings should not be noticeable, since inserting them in 317multibyte strings should not be noticeable, since inserting them in
318unibyte buffers converts them to unibyte automatically. However, if 318unibyte buffers converts them to unibyte automatically. However, if
319this does make a difference, you can force a particular Lisp file to be 319this does make a difference, you can force a particular Lisp file to be
320interpreted as unibyte by writing @samp{-*-unibyte: t;-*-} in a 320interpreted as unibyte by writing @samp{-*-unibyte: t;-*-} in a
321comment on the file's first line. With that designator, the file will 321comment on the file's first line. With that designator, the file will
322be unconditionally be interpreted as unibyte, even in an ordinary 322unconditionally be interpreted as unibyte, even in an ordinary
323multibyte Emacs session. 323multibyte Emacs session.
324 324
325@node Autoload 325@node Autoload
@@ -432,13 +432,20 @@ autoloads for all files in the current directory.
432 432
433 The same magic comment can copy any kind of form into 433 The same magic comment can copy any kind of form into
434@file{loaddefs.el}. If the form following the magic comment is not a 434@file{loaddefs.el}. If the form following the magic comment is not a
435function definition, it is copied verbatim. You can also use a magic 435function-defining form or a @code{defcustom} form, it is copied
436comment to execute a form at build time @emph{without} executing it when 436verbatim. ``Function-defining forms'' include @code{define-skeleton},
437the file itself is loaded. To do this, write the form @emph{on the same 437@code{define-derived-mode}, @code{define-generic-mode} and
438line} as the magic comment. Since it is in a comment, it does nothing 438@code{easy-mmode-define-minor-mode} as well as @code{defun} and
439when you load the source file; but @kbd{M-x update-file-autoloads} 439@code{defmacro}. To save space, a @code{defcustom} form is converted to
440copies it to @file{loaddefs.el}, where it is executed while building 440a @code{defvar} in @file{loaddefs.el}, with some additional information
441Emacs. 441if it uses @code{:require}.
442
443 You can also use a magic comment to execute a form at build time
444@emph{without} executing it when the file itself is loaded. To do this,
445write the form @emph{on the same line} as the magic comment. Since it
446is in a comment, it does nothing when you load the source file; but
447@kbd{M-x update-file-autoloads} copies it to @file{loaddefs.el}, where
448it is executed while building Emacs.
442 449
443 The following example shows how @code{doctor} is prepared for 450 The following example shows how @code{doctor} is prepared for
444autoloading with a magic comment: 451autoloading with a magic comment:
@@ -456,17 +463,17 @@ autoloading with a magic comment:
456Here's what that produces in @file{loaddefs.el}: 463Here's what that produces in @file{loaddefs.el}:
457 464
458@smallexample 465@smallexample
459(autoload 'doctor "doctor" 466(autoload 'doctor "doctor" "\
460 "\
461Switch to *doctor* buffer and start giving psychotherapy." 467Switch to *doctor* buffer and start giving psychotherapy."
462 t) 468 t)
463@end smallexample 469@end smallexample
464 470
465@noindent 471@noindent
466The backslash and newline immediately following the double-quote are a 472The backslash and newline immediately following the double-quote are a
467convention used only in the preloaded Lisp files such as 473convention used only in the preloaded uncompiled Lisp files such as
468@file{loaddefs.el}; they tell @code{make-docfile} to put the 474@file{loaddefs.el}; they tell @code{make-docfile} to put the
469documentation string in the @file{etc/DOC} file. @xref{Building Emacs}. 475documentation string in the @file{etc/DOC} file. @xref{Building Emacs}.
476See also the commentary in @file{lib-src/make-docfile.c}.
470 477
471@node Repeated Loading 478@node Repeated Loading
472@section Repeated Loading 479@section Repeated Loading
@@ -591,7 +598,9 @@ done.
591 When @code{require} is used at top level in a file, it takes effect 598 When @code{require} is used at top level in a file, it takes effect
592when you byte-compile that file (@pxref{Byte Compilation}) as well as 599when you byte-compile that file (@pxref{Byte Compilation}) as well as
593when you load it. This is in case the required package contains macros 600when you load it. This is in case the required package contains macros
594that the byte compiler must know about. 601that the byte compiler must know about. It also avoids byte-compiler
602warnings for functions and variables defined in the file loaded with
603@code{require}.
595 604
596 Although top-level calls to @code{require} are evaluated during 605 Although top-level calls to @code{require} are evaluated during
597byte compilation, @code{provide} calls are not. Therefore, you can 606byte compilation, @code{provide} calls are not. Therefore, you can
@@ -701,6 +710,8 @@ is defined, it is run as a normal hook before restoring the previous
701definitions, @emph{instead of} the usual hook-removing actions. The 710definitions, @emph{instead of} the usual hook-removing actions. The
702unload hook ought to undo all the global state changes made by the 711unload hook ought to undo all the global state changes made by the
703library that might cease to work once the library is unloaded. 712library that might cease to work once the library is unloaded.
713@code{unload-feature} can cause problems with libraries that fail to do
714this, so it should be used with caution.
704 715
705Ordinarily, @code{unload-feature} refuses to unload a library on which 716Ordinarily, @code{unload-feature} refuses to unload a library on which
706other loaded libraries depend. (A library @var{a} depends on library 717other loaded libraries depend. (A library @var{a} depends on library
@@ -741,7 +752,16 @@ The value of @code{load-history} may have one element whose @sc{car} is
741by adding the symbols defined to the element for the file being visited, 752by adding the symbols defined to the element for the file being visited,
742rather than replacing that element. @xref{Eval}. 753rather than replacing that element. @xref{Eval}.
743 754
744 Preloaded libraries don't contribute to @code{load-history}. 755 Preloaded libraries don't contribute initially to @code{load-history}.
756Instead, preloading writes information about preloaded libraries into a
757file, which can be loaded later on to to add information to
758@code{load-history} describing the preloaded files. This file is
759installed in @code{exec-directory} and has a name of the form
760@file{fns-@var{emacsversion}.el}.
761
762@findex symbol-file
763 See the source for the function @code{symbol-file}, for an example of
764code that loads this file to find functions in preloaded libraries.
745 765
746@tindex loadhist-special-hooks 766@tindex loadhist-special-hooks
747@defvar loadhist-special-hooks 767@defvar loadhist-special-hooks
@@ -784,8 +804,8 @@ customizations if you don't feel they must meet the design standards for
784programs meant for wider use. 804programs meant for wider use.
785 805
786@defvar after-load-alist 806@defvar after-load-alist
787An alist of expressions to evaluate if and when particular libraries are 807This variable holds an alist of expressions to evaluate if and when
788loaded. Each element looks like this: 808particular libraries are loaded. Each element looks like this:
789 809
790@example 810@example
791(@var{filename} @var{forms}@dots{}) 811(@var{filename} @var{forms}@dots{})
diff --git a/lispref/maps.texi b/lispref/maps.texi
index 96f8d0921ee..38734cd6523 100644
--- a/lispref/maps.texi
+++ b/lispref/maps.texi
@@ -67,34 +67,35 @@ A sparse keymap used by Emacs Lisp mode.
67 67
68@item facemenu-menu 68@item facemenu-menu
69@vindex facemenu-menu 69@vindex facemenu-menu
70The keymap that displays the Text Properties menu. 70The sparse keymap that displays the Text Properties menu.
71 71
72@item facemenu-background-menu 72@item facemenu-background-menu
73@vindex facemenu-background-menu 73@vindex facemenu-background-menu
74The keymap that displays the Background Color submenu of the Text 74The sparse keymap that displays the Background Color submenu of the Text
75Properties menu. 75Properties menu.
76 76
77@item facemenu-face-menu 77@item facemenu-face-menu
78@vindex facemenu-face-menu 78@vindex facemenu-face-menu
79The keymap that displays the Face submenu of the Text Properties menu. 79The sparse keymap that displays the Face submenu of the Text Properties menu.
80 80
81@item facemenu-foreground-menu 81@item facemenu-foreground-menu
82@vindex facemenu-foreground-menu 82@vindex facemenu-foreground-menu
83The keymap that displays the Foreground Color submenu of the Text 83The sparse keymap that displays the Foreground Color submenu of the Text
84Properties menu. 84Properties menu.
85 85
86@item facemenu-indentation-menu 86@item facemenu-indentation-menu
87@vindex facemenu-indentation-menu 87@vindex facemenu-indentation-menu
88The keymap that displays the Indentation submenu of the Text Properties menu. 88The sparse keymap that displays the Indentation submenu of the Text
89Properties menu.
89 90
90@item facemenu-justification-menu 91@item facemenu-justification-menu
91@vindex facemenu-justification-menu 92@vindex facemenu-justification-menu
92The keymap that displays the Justification submenu of the Text 93The sparse keymap that displays the Justification submenu of the Text
93Properties menu. 94Properties menu.
94 95
95@item facemenu-special-menu 96@item facemenu-special-menu
96@vindex facemenu-special-menu 97@vindex facemenu-special-menu
97The keymap that displays the Special Props submenu of the Text 98The sparse keymap that displays the Special Props submenu of the Text
98Properties menu. 99Properties menu.
99 100
100@item function-key-map 101@item function-key-map
@@ -104,7 +105,7 @@ If there are none, then it contains an empty sparse keymap.
104 105
105@item fundamental-mode-map 106@item fundamental-mode-map
106@vindex fundamental-mode-map 107@vindex fundamental-mode-map
107The local keymap for Fundamental mode.@* 108The sparse keymap for Fundamental mode.@*
108It is empty and should not be changed. 109It is empty and should not be changed.
109 110
110@item Helper-help-map 111@item Helper-help-map
@@ -132,7 +133,7 @@ bindings, unlike @code{function-key-map}. @xref{Translating Input}.
132 133
133@item lisp-interaction-mode-map 134@item lisp-interaction-mode-map
134@vindex lisp-interaction-mode-map 135@vindex lisp-interaction-mode-map
135A sparse keymap used by Lisp mode. 136A sparse keymap used by Lisp Interaction mode.
136 137
137@item lisp-mode-map 138@item lisp-mode-map
138@vindex lisp-mode-map 139@vindex lisp-mode-map
@@ -171,10 +172,10 @@ where it describes the main use of the @kbd{C-c} prefix key.
171 172
172@item occur-mode-map 173@item occur-mode-map
173@vindex occur-mode-map 174@vindex occur-mode-map
174A local keymap used by Occur mode. 175A sparse keymap used by Occur mode.
175 176
176@item query-replace-map 177@item query-replace-map
177A local keymap used for responses in @code{query-replace} and related 178A sparse keymap used for responses in @code{query-replace} and related
178commands; also for @code{y-or-n-p} and @code{map-y-or-n-p}. The functions 179commands; also for @code{y-or-n-p} and @code{map-y-or-n-p}. The functions
179that use this map do not support prefix keys; they look up one event at a 180that use this map do not support prefix keys; they look up one event at a
180time. 181time.
diff --git a/lispref/markers.texi b/lispref/markers.texi
index ee4d2144498..095e6a7f46b 100644
--- a/lispref/markers.texi
+++ b/lispref/markers.texi
@@ -136,7 +136,7 @@ integer 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
139@section Functions That Create Markers 139@section Functions that Create Markers
140 140
141 When you create a new marker, you can make it point nowhere, or point 141 When you create a new marker, you can make it point nowhere, or point
142to the present position of point, or to the beginning or end of the 142to the present position of point, or to the beginning or end of the
diff --git a/lispref/minibuf.texi b/lispref/minibuf.texi
index e6aeb01a163..7eacbc64279 100644
--- a/lispref/minibuf.texi
+++ b/lispref/minibuf.texi
@@ -42,12 +42,26 @@ windows always appear at the bottom of a frame. (Sometimes frames have
42no minibuffer window, and sometimes a special kind of frame contains 42no minibuffer window, and sometimes a special kind of frame contains
43nothing but a minibuffer window; see @ref{Minibuffers and Frames}.) 43nothing but a minibuffer window; see @ref{Minibuffers and Frames}.)
44 44
45 The minibuffer's window is normally a single line. You can resize it 45 The text in the minibuffer always starts with the @dfn{prompt string},
46temporarily with the window sizing commands; it reverts to its normal 46the text that was specified by the program that is using the minibuffer
47size when the minibuffer is exited. You can resize it permanently by 47to tell the user what sort of input to type. This text is marked
48using the window sizing commands in the frame's other window, when the 48read-only so you won't accidentally delete or change it. In other
49minibuffer is not active. If the frame contains just a minibuffer, you 49respects, it is an ordinary part of the buffer contents, but certain
50can change the minibuffer's size by changing the frame's size. 50functions such as @code{erase-buffer}, @code{buffer-string},
51@code{beginning-of-line}, @code{forward-word}, @code{forward-sentence},
52and @code{forward-paragraph}, treat it a little bit specially. (In
53older Emacs versions, the prompt was displayed using a special mechanism
54and was not part of the buffer contents.)
55
56@c ???
57 The minibuffer's window is normally a single line; it grows
58automatically if necessary if the contents require more space. You can
59explicitly resize it temporarily with the window sizing commands; it
60reverts to its normal size when the minibuffer is exited. You can
61resize it permanently by using the window sizing commands in the frame's
62other window, when the minibuffer is not active. If the frame contains
63just a minibuffer, you can change the minibuffer's size by changing the
64frame's size.
51 65
52 If a command uses a minibuffer while there is an active minibuffer, 66 If a command uses a minibuffer while there is an active minibuffer,
53this is called a @dfn{recursive minibuffer}. The first minibuffer is 67this is called a @dfn{recursive minibuffer}. The first minibuffer is
@@ -724,7 +738,7 @@ see @ref{Completion Commands}.
724@end defun 738@end defun
725 739
726@node Completion Commands 740@node Completion Commands
727@subsection Minibuffer Commands That Do Completion 741@subsection Minibuffer Commands that Do Completion
728 742
729 This section describes the keymaps, commands and user options used in 743 This section describes the keymaps, commands and user options used in
730the minibuffer to do completion. 744the minibuffer to do completion.
@@ -1483,9 +1497,16 @@ This function returns the prompt string of the currently active
1483minibuffer. If no minibuffer is active, it returns @code{nil}. 1497minibuffer. If no minibuffer is active, it returns @code{nil}.
1484@end defun 1498@end defun
1485 1499
1486@defun minibuffer-prompt-width 1500@tindex minubuffer-prompt-end
1487This function returns the display width of the prompt string of the 1501@defun minubuffer-prompt-end
1488currently active minibuffer. If no minibuffer is active, it returns 0. 1502This function, available starting in Emacs 21, returns the current
1503position of the end of the minibuffer prompt, if a minibuffer is
1504current. Otherwise, it returns zero.
1505@end defun
1506
1507@defun minubuffer-prompt-width
1508This function returns the current display-width of the minibuffer
1509prompt, if a minibuffer is current. Otherwise, it returns zero.
1489@end defun 1510@end defun
1490 1511
1491@defvar minibuffer-setup-hook 1512@defvar minibuffer-setup-hook
diff --git a/lispref/modes.texi b/lispref/modes.texi
index 3b51b2e7559..432d94679dd 100644
--- a/lispref/modes.texi
+++ b/lispref/modes.texi
@@ -61,7 +61,7 @@ definition is distinct from that of Text mode, but was derived from it.
61 Rmail Edit mode offers an example of changing the major mode 61 Rmail Edit mode offers an example of changing the major mode
62temporarily for a buffer, so it can be edited in a different way (with 62temporarily for a buffer, so it can be edited in a different way (with
63ordinary Emacs commands rather than Rmail commands). In such cases, the 63ordinary Emacs commands rather than Rmail commands). In such cases, the
64temporary major mode usually has a command to switch back to the 64temporary major mode usually provides a command to switch back to the
65buffer's usual mode (Rmail mode, in this case). You might be tempted to 65buffer's usual mode (Rmail mode, in this case). You might be tempted to
66present the temporary redefinitions inside a recursive edit and restore 66present the temporary redefinitions inside a recursive edit and restore
67the usual ones when the user exits; but this is a bad idea because it 67the usual ones when the user exits; but this is a bad idea because it
@@ -70,8 +70,8 @@ recursive edits must be exited most-recently-entered first. Using an
70alternative major mode avoids this limitation. @xref{Recursive 70alternative major mode avoids this limitation. @xref{Recursive
71Editing}. 71Editing}.
72 72
73 The standard GNU Emacs Lisp library directory contains the code for 73 The standard GNU Emacs Lisp library directory tree contains the code
74several major modes, in files such as @file{text-mode.el}, 74for several major modes, in files such as @file{text-mode.el},
75@file{texinfo.el}, @file{lisp-mode.el}, @file{c-mode.el}, and 75@file{texinfo.el}, @file{lisp-mode.el}, @file{c-mode.el}, and
76@file{rmail.el}. You can study these libraries to see how modes are 76@file{rmail.el}. You can study these libraries to see how modes are
77written. Text mode is perhaps the simplest major mode aside from 77written. Text mode is perhaps the simplest major mode aside from
@@ -245,7 +245,7 @@ with value @code{special}, put on as follows:
245@end example 245@end example
246 246
247@noindent 247@noindent
248This tells Emacs that new buffers created while the current buffer has 248This tells Emacs that new buffers created while the current buffer is in
249Funny mode should not inherit Funny mode. Modes such as Dired, Rmail, 249Funny mode should not inherit Funny mode. Modes such as Dired, Rmail,
250and Buffer List use this feature. 250and Buffer List use this feature.
251 251
@@ -368,7 +368,7 @@ correspondingly more complicated. Here are excerpts from
368@group 368@group
369 ;; @r{Set syntax of chars up to 0 to class of chars that are} 369 ;; @r{Set syntax of chars up to 0 to class of chars that are}
370 ;; @r{part of symbol names but not words.} 370 ;; @r{part of symbol names but not words.}
371 ;; @r{(The number 0 is @code{48} in the @sc{ASCII} character set.)} 371 ;; @r{(The number 0 is @code{48} in the @sc{ascii} character set.)}
372 (while (< i ?0) 372 (while (< i ?0)
373 (modify-syntax-entry i "_ " emacs-lisp-mode-syntax-table) 373 (modify-syntax-entry i "_ " emacs-lisp-mode-syntax-table)
374 (setq i (1+ i))) 374 (setq i (1+ i)))
@@ -782,7 +782,8 @@ individually or in combination. Minor modes would be better named
782``generally available, optional feature modes,'' except that such a name 782``generally available, optional feature modes,'' except that such a name
783would be unwieldy. 783would be unwieldy.
784 784
785 A minor mode is not usually a modification of single major mode. For 785 A minor mode is not usually meant as a variation of a single major mode.
786Usually they are general and can apply to many major modes. For
786example, Auto Fill mode works with any major mode that permits text 787example, Auto Fill mode works with any major mode that permits text
787insertion. To be general, a minor mode must be effectively independent 788insertion. To be general, a minor mode must be effectively independent
788of the things major modes do. 789of the things major modes do.
@@ -825,7 +826,7 @@ mode. We call this the @dfn{mode variable}. The minor mode command
825should set this variable (@code{nil} to disable; anything else to 826should set this variable (@code{nil} to disable; anything else to
826enable). 827enable).
827 828
828If it is possible, implement the mode so that setting the variable 829If possible, implement the mode so that setting the variable
829automatically enables or disables the mode. Then the minor mode command 830automatically enables or disables the mode. Then the minor mode command
830does not need to do anything except set the variable. 831does not need to do anything except set the variable.
831 832
@@ -890,6 +891,40 @@ check for an existing element, to avoid duplication. For example:
890 You can also use @code{add-to-list} to add an element to this list 891 You can also use @code{add-to-list} to add an element to this list
891just once (@pxref{Setting Variables}). 892just once (@pxref{Setting Variables}).
892 893
894 Global minor modes distributed with Emacs should if possible support
895enabling and disabling via Custom (@pxref{Customization}). To do this,
896the first step is to define the mode variable with @code{defcustom}, and
897specify @code{:type boolean}.
898
899 If just setting the variable is not sufficient to enable the mode, you
900should also specify a @code{:set} method which enables the mode by
901invoke the mode command. Note in the variable's documentation string that
902setting the variable other than via Custom may not take effect.
903
904 Also mark the definition with an autoload cookie (@pxref{Autoload}),
905and specify a @code{:require} so that customizing the variable will load
906the library that defines the mode. This will copy suitable definitions
907into @file{loaddefs.el} so that users can use @code{customize-option} to
908enable the mode. For example:
909
910@smallexample
911@group
912
913;;;###autoload
914(defcustom msb-mode nil
915 "Toggle msb-mode.
916Setting this variable directly does not take effect;
917use either \\[customize] or the function `msb-mode'."
918 :set (lambda (symbol value)
919 (msb-mode (or value 0)))
920 :initialize 'custom-initialize-default
921 :version "20.4"
922 :type 'boolean
923 :group 'msb
924 :require 'msb)
925@end group
926@end smallexample
927
893@node Keymaps and Minor Modes 928@node Keymaps and Minor Modes
894@subsection Keymaps and Minor Modes 929@subsection Keymaps and Minor Modes
895 930
@@ -908,15 +943,15 @@ standard one. The editor command loop handles this function specially.)
908 943
909The key sequences bound in a minor mode should consist of @kbd{C-c} 944The key sequences bound in a minor mode should consist of @kbd{C-c}
910followed by a punctuation character @emph{other than} @kbd{@{}, 945followed by a punctuation character @emph{other than} @kbd{@{},
911@kbd{@}}, @kbd{<}, @kbd{>}, @kbd{:} or @kbd{;}. (Those few punctuation 946@kbd{@}}, @kbd{<}, @kbd{>}, @kbd{:}, and @kbd{;}. (Those few punctuation
912characters are reserved for major modes.) 947characters are reserved for major modes.)
913 948
914@node Easy-Mmode 949@node Easy-Mmode
915@subsection Easy-Mmode 950@subsection Easy-Mmode
916 951
917 The easy-mmode package provides a convenient way of implementing a 952 The easy-mmode package provides a convenient way of implementing a
918minor mode; with it, you can specify everything about a simple minor 953mode in one self-contained definition. It currently supports only
919mode in one self-contained definition. 954buffer-local minor modes, not global ones.
920 955
921@defmac easy-mmode-define-minor-mode mode doc &optional init-value mode-indicator keymap 956@defmac easy-mmode-define-minor-mode mode doc &optional init-value mode-indicator keymap
922@tindex easy-mmode-define-minor-mode 957@tindex easy-mmode-define-minor-mode
@@ -978,35 +1013,39 @@ mode is enabled. It initializes the keymap with key bindings for
978@section Mode Line Format 1013@section Mode Line Format
979@cindex mode line 1014@cindex mode line
980 1015
981 Each Emacs window (aside from minibuffer windows) includes a mode line, 1016 Each Emacs window (aside from minibuffer windows) typically has a mode
982which displays status information about the buffer displayed in the 1017line at the bottom, which displays status information about the buffer
983window. The mode line contains information about the buffer, such as its 1018displayed in the window. The mode line contains information about the
984name, associated file, depth of recursive editing, and the major and 1019buffer, such as its name, associated file, depth of recursive editing,
985minor modes. 1020and major and minor modes. A window can also have a @dfn{header
1021line}, which is much like the mode line but appears at the top of the
1022window (starting in Emacs 21).
986 1023
987 This section describes how the contents of the mode line are 1024 This section describes how to control the contents of the mode line
988controlled. We include it in this chapter because much of the 1025and header line. We include it in this chapter because much of the
989information displayed in the mode line relates to the enabled major and 1026information displayed in the mode line relates to the enabled major and
990minor modes. 1027minor modes.
991 1028
992 @code{mode-line-format} is a buffer-local variable that holds a 1029 @code{mode-line-format} is a buffer-local variable that holds a
993template used to display the mode line of the current buffer. All 1030template used to display the mode line of the current buffer. All
994windows for the same buffer use the same @code{mode-line-format} and 1031windows for the same buffer use the same @code{mode-line-format}, so
995their mode lines appear the same (except for scrolling percentages, and 1032their mode lines appear the same---except for scrolling percentages, and
996line and column numbers). 1033line and column numbers, since those depend on point and on how the
997 1034window is scrolled. @code{header-line-format} is used likewise for
998 The mode line of a window is normally updated whenever a different 1035header lines.
999buffer is shown in the window, or when the buffer's modified-status 1036
1000changes from @code{nil} to @code{t} or vice-versa. If you modify any of 1037 The mode line and header line of a window are normally updated
1001the variables referenced by @code{mode-line-format} (@pxref{Mode Line 1038whenever a different buffer is shown in the window, or when the buffer's
1002Variables}), or any other variables and data structures that affect how 1039modified-status changes from @code{nil} to @code{t} or vice-versa. If
1003text is displayed (@pxref{Display}), you may want to force an update of 1040you modify any of the variables referenced by @code{mode-line-format}
1004the mode line so as to display the new information or display it in 1041(@pxref{Mode Line Variables}), or any other variables and data
1005the new way. 1042structures that affect how text is displayed (@pxref{Display}), you may
1043want to force an update of the mode line so as to display the new
1044information or display it in the new way.
1006 1045
1007@c Emacs 19 feature 1046@c Emacs 19 feature
1008@defun force-mode-line-update 1047@defun force-mode-line-update
1009Force redisplay of the current buffer's mode line. 1048Force redisplay of the current buffer's mode line and header line.
1010@end defun 1049@end defun
1011 1050
1012 The mode line is usually displayed in inverse video; see 1051 The mode line is usually displayed in inverse video; see
@@ -1016,6 +1055,8 @@ Force redisplay of the current buffer's mode line.
1016* Mode Line Data:: The data structure that controls the mode line. 1055* Mode Line Data:: The data structure that controls the mode line.
1017* Mode Line Variables:: Variables used in that data structure. 1056* Mode Line Variables:: Variables used in that data structure.
1018* %-Constructs:: Putting information into a mode line. 1057* %-Constructs:: Putting information into a mode line.
1058* Properties in Mode:: Using text properties in the mode line.
1059* Header Lines:: Like a mode line, but at the top.
1019@end menu 1060@end menu
1020 1061
1021@node Mode Line Data 1062@node Mode Line Data
@@ -1034,6 +1075,9 @@ The value of this variable is a mode line construct with overall
1034responsibility for the mode line format. The value of this variable 1075responsibility for the mode line format. The value of this variable
1035controls which other variables are used to form the mode line text, and 1076controls which other variables are used to form the mode line text, and
1036where they appear. 1077where they appear.
1078
1079If you set this variable to @code{nil} in a buffer, that buffer does not
1080have a mode line. (This feature was added in Emacs 21.)
1037@end defvar 1081@end defvar
1038 1082
1039 A mode line construct may be as simple as a fixed string of text, but 1083 A mode line construct may be as simple as a fixed string of text, but
@@ -1050,6 +1094,11 @@ variables that @code{mode-line-format} refers to.
1050 A mode line construct may be a list, a symbol, or a string. If the 1094 A mode line construct may be a list, a symbol, or a string. If the
1051value is a list, each element may be a list, a symbol, or a string. 1095value is a list, each element may be a list, a symbol, or a string.
1052 1096
1097 The mode line can display various faces, if the strings that control
1098it have the @code{face} property. @xref{Properties in Mode}. In
1099addition, the face @code{mode-line} is used as a default for the whole
1100mode line (@pxref{Standard Faces}).
1101
1053@table @code 1102@table @code
1054@cindex percent symbol in mode line 1103@cindex percent symbol in mode line
1055@item @var{string} 1104@item @var{string}
@@ -1061,7 +1110,7 @@ is left justified). @xref{%-Constructs}.
1061@item @var{symbol} 1110@item @var{symbol}
1062A symbol as a mode line construct stands for its value. The value of 1111A symbol as a mode line construct stands for its value. The value of
1063@var{symbol} is used as a mode line construct, in place of @var{symbol}. 1112@var{symbol} is used as a mode line construct, in place of @var{symbol}.
1064However, the symbols @code{t} and @code{nil} are ignored; so is any 1113However, the symbols @code{t} and @code{nil} are ignored, as is any
1065symbol whose value is void. 1114symbol whose value is void.
1066 1115
1067There is one exception: if the value of @var{symbol} is a string, it is 1116There is one exception: if the value of @var{symbol} is a string, it is
@@ -1072,14 +1121,19 @@ A list whose first element is a string or list means to process all the
1072elements recursively and concatenate the results. This is the most 1121elements recursively and concatenate the results. This is the most
1073common form of mode line construct. 1122common form of mode line construct.
1074 1123
1124@item (:eval @var{form})
1125A list whose first element is the symbol @code{:eval} says to evaluate
1126@var{form}, and use the result as a string to display.
1127(This feature is new as of Emacs 21.)
1128
1075@item (@var{symbol} @var{then} @var{else}) 1129@item (@var{symbol} @var{then} @var{else})
1076A list whose first element is a symbol is a conditional. Its meaning 1130A list whose first element is a symbol that is not a keyword specifies a
1077depends on the value of @var{symbol}. If the value is non-@code{nil}, 1131conditional. Its meaning depends on the value of @var{symbol}. If the
1078the second element, @var{then}, is processed recursively as a mode line 1132value is non-@code{nil}, the second element, @var{then}, is processed
1079element. But if the value of @var{symbol} is @code{nil}, the third 1133recursively as a mode line element. But if the value of @var{symbol} is
1080element, @var{else}, is processed recursively. You may omit @var{else}; 1134@code{nil}, the third element, @var{else}, is processed recursively.
1081then the mode line element displays nothing if the value of @var{symbol} 1135You may omit @var{else}; then the mode line element displays nothing if
1082is @code{nil}. 1136the value of @var{symbol} is @code{nil}.
1083 1137
1084@item (@var{width} @var{rest}@dots{}) 1138@item (@var{width} @var{rest}@dots{})
1085A list whose first element is an integer specifies truncation or 1139A list whose first element is an integer specifies truncation or
@@ -1124,7 +1178,7 @@ directory.
1124 " " 1178 " "
1125 'global-mode-string 1179 'global-mode-string
1126 " %[(" 1180 " %[("
1127 'mode-name 1181 '(:eval (mode-line-mode-name))
1128 'mode-line-process 1182 'mode-line-process
1129 'minor-mode-alist 1183 'minor-mode-alist
1130 "%n" 1184 "%n"
@@ -1268,7 +1322,7 @@ The default value of @code{default-mode-line-format} is this list:
1268 global-mode-string 1322 global-mode-string
1269@group 1323@group
1270 " %[(" 1324 " %[("
1271 mode-name 1325 (:eval (mode-line-mode-name))
1272 mode-line-process 1326 mode-line-process
1273 minor-mode-alist 1327 minor-mode-alist
1274 "%n" 1328 "%n"
@@ -1315,7 +1369,8 @@ The title (only on a window system) or the name of the selected frame.
1315The current column number of point. 1369The current column number of point.
1316 1370
1317@item %l 1371@item %l
1318The current line number of point. 1372The current line number of point, counting within the accessible portion
1373of the buffer.
1319 1374
1320@item %* 1375@item %*
1321@samp{%} if the buffer is read only (see @code{buffer-read-only}); @* 1376@samp{%} if the buffer is read only (see @code{buffer-read-only}); @*
@@ -1383,6 +1438,64 @@ The value of @code{global-mode-string}. Currently, only
1383@code{display-time} modifies the value of @code{global-mode-string}. 1438@code{display-time} modifies the value of @code{global-mode-string}.
1384@end table 1439@end table
1385 1440
1441@node Properties in Mode
1442@subsection Properties in the Mode Line
1443
1444 Starting in Emacs 21, certain text properties are meaningful in the
1445mode line. The @code{face} property affects the appearance of text; the
1446@code{help-echo} property associate help strings with the text, and
1447@code{local-map} can make the text mouse-sensitive.
1448
1449 There are three ways to specify text properties for text in the mode
1450line:
1451
1452@enumerate
1453@item
1454Put a string with the @code{local-map} property directly into the
1455mode-line data structure.
1456
1457@item
1458Put a @code{local-map} property on a mode-line %-construct
1459such as @samp{%12b}; then the expansion of the %-construct
1460will have that same text property.
1461
1462@item
1463Use a list containing @code{:eval @var{form}} in the mode-line data
1464structure, and make @var{form} evaluate to a string that has a
1465@code{local-map} property.
1466@end enumerate
1467
1468 You use the @code{local-map} property to specify a keymap. Like any
1469keymap, it can bind character keys and function keys; but that has no
1470effect, since is impossible to move point into the mode line, This
1471keymap can only take real effect for mouse clicks.
1472
1473@node Header Lines
1474@subsection Window Header Lines
1475@cindex header line (of a window)
1476@cindex window header line
1477
1478 Starting in Emacs 21, a window can have a @dfn{header line} at the
1479top, just as it can have a mode line at the bottom. The header line
1480feature works just like the mode line feature, except that it's
1481controlled by different variables.
1482
1483@tindex header-line-format
1484@defvar header-line-format
1485This variable, local in every buffer, specifies how to display the
1486header line, for windows displaying the buffer. The format of the value
1487is the same as for @code{mode-line-format} (@xref{Mode Line Data}).
1488@end defvar
1489
1490@tindex default-header-line-format
1491@defvar default-header-line-format
1492This variable holds the default @code{header-line-format} for buffers
1493that do not override it. This is the same as @code{(default-value
1494'header-line-format)}.
1495
1496It is normally @code{nil}, so that ordinary buffers have no header line.
1497@end defvar
1498
1386@node Imenu 1499@node Imenu
1387@section Imenu 1500@section Imenu
1388 1501
@@ -1390,9 +1503,10 @@ The value of @code{global-mode-string}. Currently, only
1390 @dfn{Imenu} is a feature that lets users select a definition or 1503 @dfn{Imenu} is a feature that lets users select a definition or
1391section in the buffer, from a menu which lists all of them, to go 1504section in the buffer, from a menu which lists all of them, to go
1392directly to that location in the buffer. Imenu works by constructing a 1505directly to that location in the buffer. Imenu works by constructing a
1393buffer index which lists the names and positions of the definitions or 1506buffer index which lists the names and buffer positions of the
1394portions of in the buffer, so the user can pick one of them to move to. 1507definitions, or portions of the buffer, so the user can pick one of them
1395This section explains how to customize Imenu for a major mode. 1508to move to. This section explains how to customize Imenu for a major
1509mode.
1396 1510
1397 The usual and simplest way is to set the variable 1511 The usual and simplest way is to set the variable
1398@code{imenu-generic-expression}: 1512@code{imenu-generic-expression}:
@@ -1413,9 +1527,10 @@ for this element should go in a submenu of the buffer index;
1413in the top level of the buffer index. 1527in the top level of the buffer index.
1414 1528
1415The second item in the list, @var{regexp}, is a regular expression 1529The second item in the list, @var{regexp}, is a regular expression
1416(@pxref{Regular Expressions}); wherever it matches, that is a definition 1530(@pxref{Regular Expressions}); anything in the buffer that it matches is
1417to mention in the buffer index. The third item, @var{subexp}, indicates 1531considered a definition, to mention in the buffer index. The third
1418which subexpression in @var{regexp} matches the definition's name. 1532item, @var{subexp}, indicates which subexpression in @var{regexp}
1533matches the definition's name.
1419 1534
1420An element can also look like this: 1535An element can also look like this:
1421 1536
@@ -1483,7 +1598,7 @@ For example, Fortran mode uses it this way:
1483 1598
1484The @code{imenu-generic-expression} patterns can then use @samp{\\sw+} 1599The @code{imenu-generic-expression} patterns can then use @samp{\\sw+}
1485instead of @samp{\\(\\sw\\|\\s_\\)+}. Note that this technique may be 1600instead of @samp{\\(\\sw\\|\\s_\\)+}. Note that this technique may be
1486inconvenient to use when the mode needs to limit the initial character 1601inconvenient when the mode needs to limit the initial character
1487of a name to a smaller set of characters than are allowed in the rest 1602of a name to a smaller set of characters than are allowed in the rest
1488of a name. 1603of a name.
1489 1604
@@ -1682,7 +1797,7 @@ expression or a function, as described above. The @sc{cdr},
1682highlighted (instead of the entire text that @var{matcher} matched). 1797highlighted (instead of the entire text that @var{matcher} matched).
1683 1798
1684@example 1799@example
1685;; @r{Highlight the @samp{bar} in each occurrences of @samp{fubar},} 1800;; @r{Highlight the @samp{bar} in each occurrence of @samp{fubar},}
1686;; @r{using @code{font-lock-keyword-face}.} 1801;; @r{using @code{font-lock-keyword-face}.}
1687("fu\\(bar\\)" . 1) 1802("fu\\(bar\\)" . 1)
1688@end example 1803@end example
@@ -1734,7 +1849,7 @@ Here are some examples of elements of this kind, and what they do:
1734;; @r{@code{foo-bar-face} should be a variable whose value is a face.} 1849;; @r{@code{foo-bar-face} should be a variable whose value is a face.}
1735("foo\\|bar" 0 foo-bar-face t) 1850("foo\\|bar" 0 foo-bar-face t)
1736 1851
1737;; @r{Highlight the first subexpression within each occurrences} 1852;; @r{Highlight the first subexpression within each occurrence}
1738;; @r{that the function @code{fubar-match} finds,} 1853;; @r{that the function @code{fubar-match} finds,}
1739;; @r{using the face which is the value of @code{fubar-face}.} 1854;; @r{using the face which is the value of @code{fubar-face}.}
1740(fubar-match 1 fubar-face) 1855(fubar-match 1 fubar-face)
diff --git a/lispref/nonascii.texi b/lispref/nonascii.texi
index 7b6745945df..053bdbe4f50 100644
--- a/lispref/nonascii.texi
+++ b/lispref/nonascii.texi
@@ -8,7 +8,7 @@
8@cindex multibyte characters 8@cindex multibyte characters
9@cindex non-ASCII characters 9@cindex non-ASCII characters
10 10
11 This chapter covers the special issues relating to non-@sc{ASCII} 11 This chapter covers the special issues relating to non-@sc{ascii}
12characters and how they are stored in strings and buffers. 12characters and how they are stored in strings and buffers.
13 13
14@menu 14@menu
@@ -40,8 +40,8 @@ attention to the difference.
40@cindex unibyte text 40@cindex unibyte text
41 In unibyte representation, each character occupies one byte and 41 In unibyte representation, each character occupies one byte and
42therefore the possible character codes range from 0 to 255. Codes 0 42therefore the possible character codes range from 0 to 255. Codes 0
43through 127 are @sc{ASCII} characters; the codes from 128 through 255 43through 127 are @sc{ascii} characters; the codes from 128 through 255
44are used for one non-@sc{ASCII} character set (you can choose which 44are used for one non-@sc{ascii} character set (you can choose which
45character set by setting the variable @code{nonascii-insert-offset}). 45character set by setting the variable @code{nonascii-insert-offset}).
46 46
47@cindex leading code 47@cindex leading code
@@ -132,30 +132,30 @@ alternative, to convert the buffer contents to multibyte, is not
132acceptable because the buffer's representation is a choice made by the 132acceptable because the buffer's representation is a choice made by the
133user that cannot be overridden automatically. 133user that cannot be overridden automatically.
134 134
135 Converting unibyte text to multibyte text leaves @sc{ASCII} characters 135 Converting unibyte text to multibyte text leaves @sc{ascii} characters
136unchanged, and likewise 128 through 159. It converts the non-@sc{ASCII} 136unchanged, and likewise 128 through 159. It converts the non-@sc{ascii}
137codes 160 through 255 by adding the value @code{nonascii-insert-offset} 137codes 160 through 255 by adding the value @code{nonascii-insert-offset}
138to each character code. By setting this variable, you specify which 138to each character code. By setting this variable, you specify which
139character set the unibyte characters correspond to (@pxref{Character 139character set the unibyte characters correspond to (@pxref{Character
140Sets}). For example, if @code{nonascii-insert-offset} is 2048, which is 140Sets}). For example, if @code{nonascii-insert-offset} is 2048, which is
141@code{(- (make-char 'latin-iso8859-1) 128)}, then the unibyte 141@code{(- (make-char 'latin-iso8859-1) 128)}, then the unibyte
142non-@sc{ASCII} characters correspond to Latin 1. If it is 2688, which 142non-@sc{ascii} characters correspond to Latin 1. If it is 2688, which
143is @code{(- (make-char 'greek-iso8859-7) 128)}, then they correspond to 143is @code{(- (make-char 'greek-iso8859-7) 128)}, then they correspond to
144Greek letters. 144Greek letters.
145 145
146 Converting multibyte text to unibyte is simpler: it performs 146 Converting multibyte text to unibyte is simpler: it discards all but
147logical-and of each character code with 255. If 147the low 8 bits of each character code. If @code{nonascii-insert-offset}
148@code{nonascii-insert-offset} has a reasonable value, corresponding to 148has a reasonable value, corresponding to the beginning of some character
149the beginning of some character set, this conversion is the inverse of 149set, this conversion is the inverse of the other: converting unibyte
150the other: converting unibyte text to multibyte and back to unibyte 150text to multibyte and back to unibyte reproduces the original unibyte
151reproduces the original unibyte text. 151text.
152 152
153@defvar nonascii-insert-offset 153@defvar nonascii-insert-offset
154@tindex nonascii-insert-offset 154@tindex nonascii-insert-offset
155This variable specifies the amount to add to a non-@sc{ASCII} character 155This variable specifies the amount to add to a non-@sc{ascii} character
156when converting unibyte text to multibyte. It also applies when 156when converting unibyte text to multibyte. It also applies when
157@code{self-insert-command} inserts a character in the unibyte 157@code{self-insert-command} inserts a character in the unibyte
158non-@sc{ASCII} range, 128 through 255. However, the function 158non-@sc{ascii} range, 128 through 255. However, the function
159@code{insert-char} does not perform this conversion. 159@code{insert-char} does not perform this conversion.
160 160
161The right value to use to select character set @var{cs} is @code{(- 161The right value to use to select character set @var{cs} is @code{(-
@@ -245,7 +245,7 @@ codes. The valid character codes for unibyte representation range from
245codes for multibyte representation range from 0 to 524287, but not all 245codes for multibyte representation range from 0 to 524287, but not all
246values in that range are valid. In particular, the values 128 through 246values in that range are valid. In particular, the values 128 through
247255 are not legitimate in multibyte text (though they can occur in ``raw 247255 are not legitimate in multibyte text (though they can occur in ``raw
248bytes''; @pxref{Explicit Encoding}). Only the @sc{ASCII} codes 0 248bytes''; @pxref{Explicit Encoding}). Only the @sc{ascii} codes 0
249through 127 are fully legitimate in both representations. 249through 127 are fully legitimate in both representations.
250 250
251@defun char-valid-p charcode 251@defun char-valid-p charcode
@@ -281,7 +281,7 @@ character sets, @code{chinese-big5-1} and @code{chinese-big5-2}.
281 281
282@defun charsetp object 282@defun charsetp object
283@tindex charsetp 283@tindex charsetp
284Return @code{t} if @var{object} is a character set name symbol, 284Returns @code{t} if @var{object} is a symbol that names a character set,
285@code{nil} otherwise. 285@code{nil} otherwise.
286@end defun 286@end defun
287 287
@@ -296,6 +296,15 @@ This function returns the name of the character set that @var{character}
296belongs to. 296belongs to.
297@end defun 297@end defun
298 298
299@defun charset-plist charset
300@tindex charset-plist
301This function returns the charset property list of the character set
302@var{charset}. Although @var{charset} is a symbol, this is not the same
303as the property list of that symbol. Charset properties are used for
304special purposes within Emacs; for example, @code{x-charset-registry}
305helps determine which fonts to use (@pxref{Font Selection}).
306@end defun
307
299@node Chars and Bytes 308@node Chars and Bytes
300@section Characters and Bytes 309@section Characters and Bytes
301@cindex bytes and characters 310@cindex bytes and characters
@@ -304,7 +313,7 @@ belongs to.
304@cindex dimension (of character set) 313@cindex dimension (of character set)
305 In multibyte representation, each character occupies one or more 314 In multibyte representation, each character occupies one or more
306bytes. Each character set has an @dfn{introduction sequence}, which is 315bytes. Each character set has an @dfn{introduction sequence}, which is
307normally one or two bytes long. (Exception: the @sc{ASCII} character 316normally one or two bytes long. (Exception: the @sc{ascii} character
308set has a zero-length introduction sequence.) The introduction sequence 317set has a zero-length introduction sequence.) The introduction sequence
309is the beginning of the byte sequence for any character in the character 318is the beginning of the byte sequence for any character in the character
310set. The rest of the character's bytes distinguish it from the other 319set. The rest of the character's bytes distinguish it from the other
@@ -354,7 +363,7 @@ values is the character set's dimension.
354 @result{} (ascii 65) 363 @result{} (ascii 65)
355@end example 364@end example
356 365
357Unibyte non-@sc{ASCII} characters are considered as part of 366Unibyte non-@sc{ascii} characters are considered as part of
358the @code{ascii} character set: 367the @code{ascii} character set:
359 368
360@example 369@example
@@ -418,7 +427,7 @@ In two peculiar cases, the value includes the symbol @code{unknown}:
418 427
419@itemize @bullet 428@itemize @bullet
420@item 429@item
421When a unibyte buffer contains non-@sc{ASCII} characters. 430When a unibyte buffer contains non-@sc{ascii} characters.
422 431
423@item 432@item
424When a multibyte buffer contains invalid byte-sequences (raw bytes). 433When a multibyte buffer contains invalid byte-sequences (raw bytes).
@@ -445,10 +454,10 @@ for other purposes. Some coding systems specify their own particular
445translation tables; there are also default translation tables which 454translation tables; there are also default translation tables which
446apply to all other coding systems. 455apply to all other coding systems.
447 456
448@defun make-translation-table translations 457@defun make-translation-table &rest translations
449This function returns a translation table based on the arguments 458This function returns a translation table based on the argument
450@var{translations}. Each argument---each element of 459@var{translations}. Each element of
451@var{translations}---should be a list of the form @code{(@var{from} 460@var{translations} should be a list of the form @code{(@var{from}
452. @var{to})}; this says to translate the character @var{from} into 461. @var{to})}; this says to translate the character @var{from} into
453@var{to}. 462@var{to}.
454 463
@@ -495,7 +504,8 @@ subprocess or receives text from a subprocess, it normally performs
495character code conversion and end-of-line conversion as specified 504character code conversion and end-of-line conversion as specified
496by a particular @dfn{coding system}. 505by a particular @dfn{coding system}.
497 506
498 How to define a coding system is an arcane matter, not yet documented. 507 How to define a coding system is an arcane matter, and is not
508documented here.
499 509
500@menu 510@menu
501* Coding System Basics:: 511* Coding System Basics::
@@ -523,16 +533,15 @@ characters; for example, there are three coding systems for the Cyrillic
523(Russian) alphabet: ISO, Alternativnyj, and KOI8. 533(Russian) alphabet: ISO, Alternativnyj, and KOI8.
524 534
525 Most coding systems specify a particular character code for 535 Most coding systems specify a particular character code for
526conversion, but some of them leave this unspecified---to be chosen 536conversion, but some of them leave the choice unspecified---to be chosen
527heuristically based on the data. 537heuristically for each file, based on the data.
528 538
529@cindex end of line conversion 539@cindex end of line conversion
530 @dfn{End of line conversion} handles three different conventions used 540 @dfn{End of line conversion} handles three different conventions used
531on various systems for representing end of line in files. The Unix 541on various systems for representing end of line in files. The Unix
532convention is to use the linefeed character (also called newline). The 542convention is to use the linefeed character (also called newline). The
533DOS convention is to use the two character sequence, carriage-return 543DOS convention is to use a carriage-return and a linefeed at the end of
534linefeed, at the end of a line. The Mac convention is to use just 544a line. The Mac convention is to use just carriage-return.
535carriage-return.
536 545
537@cindex base coding system 546@cindex base coding system
538@cindex variant coding system 547@cindex variant coding system
@@ -610,10 +619,14 @@ to a subprocess.
610@defvar save-buffer-coding-system 619@defvar save-buffer-coding-system
611@tindex save-buffer-coding-system 620@tindex save-buffer-coding-system
612This variable specifies the coding system for saving the buffer---but it 621This variable specifies the coding system for saving the buffer---but it
613is not used for @code{write-region}. When saving the buffer asks the 622is not used for @code{write-region}.
614user to specify a different coding system, and 623
615@code{save-buffer-coding-system} was used, then it is updated to the 624When a command to save the buffer starts out to use
616coding system that was specified. 625@code{save-buffer-coding-system}, and that coding system cannot handle
626the actual text in the buffer, the command asks the user to choose
627another coding system. After that happens, the command also updates
628@code{save-buffer-coding-system} to represent the coding system that the
629user specified.
617@end defvar 630@end defvar
618 631
619@defvar last-coding-system-used 632@defvar last-coding-system-used
@@ -623,8 +636,8 @@ coding system name that was used. The explicit encoding and decoding
623functions (@pxref{Explicit Encoding}) set it too. 636functions (@pxref{Explicit Encoding}) set it too.
624 637
625@strong{Warning:} Since receiving subprocess output sets this variable, 638@strong{Warning:} Since receiving subprocess output sets this variable,
626it can change whenever Emacs waits; therefore, you should use copy the 639it can change whenever Emacs waits; therefore, you should copy the
627value shortly after the function call which stores the value you are 640value shortly after the function call that stores the value you are
628interested in. 641interested in.
629@end defvar 642@end defvar
630 643
@@ -634,7 +647,7 @@ selections for the window system. @xref{Window System Selections}.
634@node Lisp and Coding Systems 647@node Lisp and Coding Systems
635@subsection Coding Systems in Lisp 648@subsection Coding Systems in Lisp
636 649
637 Here are Lisp facilities for working with coding systems; 650 Here are the Lisp facilities for working with coding systems:
638 651
639@defun coding-system-list &optional base-only 652@defun coding-system-list &optional base-only
640@tindex coding-system-list 653@tindex coding-system-list
@@ -711,7 +724,7 @@ decreasing priority. But if @var{highest} is non-@code{nil}, then the
711return value is just one coding system, the one that is highest in 724return value is just one coding system, the one that is highest in
712priority. 725priority.
713 726
714If the region contains only @sc{ASCII} characters, the value 727If the region contains only @sc{ascii} characters, the value
715is @code{undecided} or @code{(undecided)}. 728is @code{undecided} or @code{(undecided)}.
716@end defun 729@end defun
717 730
@@ -788,13 +801,14 @@ expression that matches certain file names. The element applies to file
788names that match @var{pattern}. 801names that match @var{pattern}.
789 802
790The @sc{cdr} of the element, @var{coding}, should be either a coding 803The @sc{cdr} of the element, @var{coding}, should be either a coding
791system, a cons cell containing two coding systems, or a function symbol. 804system, a cons cell containing two coding systems, or a function name (a
792If @var{val} is a coding system, that coding system is used for both 805symbol with a function definition). If @var{coding} is a coding system,
793reading the file and writing it. If @var{val} is a cons cell containing 806that coding system is used for both reading the file and writing it. If
794two coding systems, its @sc{car} specifies the coding system for 807@var{coding} is a cons cell containing two coding systems, its @sc{car}
795decoding, and its @sc{cdr} specifies the coding system for encoding. 808specifies the coding system for decoding, and its @sc{cdr} specifies the
796 809coding system for encoding.
797If @var{val} is a function symbol, the function must return a coding 810
811If @var{coding} is a function name, the function must return a coding
798system or a cons cell containing two coding systems. This value is used 812system or a cons cell containing two coding systems. This value is used
799as described above. 813as described above.
800@end defvar 814@end defvar
@@ -810,8 +824,8 @@ coding systems used for I/O to the subprocess, but you can specify
810other coding systems later using @code{set-process-coding-system}. 824other coding systems later using @code{set-process-coding-system}.
811@end defvar 825@end defvar
812 826
813 @strong{Warning:} Coding systems such as @code{undecided} which 827 @strong{Warning:} Coding systems such as @code{undecided}, which
814determine the coding system from the data do not work entirely reliably 828determine the coding system from the data, do not work entirely reliably
815with asynchronous subprocess output. This is because Emacs handles 829with asynchronous subprocess output. This is because Emacs handles
816asynchronous subprocess output in batches, as it arrives. If the coding 830asynchronous subprocess output in batches, as it arrives. If the coding
817system leaves the character code conversion unspecified, or leaves the 831system leaves the character code conversion unspecified, or leaves the
@@ -859,13 +873,14 @@ for decoding (in case @var{operation} does decoding), and
859@var{encoding-system} is the coding system for encoding (in case 873@var{encoding-system} is the coding system for encoding (in case
860@var{operation} does encoding). 874@var{operation} does encoding).
861 875
862The argument @var{operation} should be an Emacs I/O primitive: 876The argument @var{operation} should be a symbol, one of
863@code{insert-file-contents}, @code{write-region}, @code{call-process}, 877@code{insert-file-contents}, @code{write-region}, @code{call-process},
864@code{call-process-region}, @code{start-process}, or 878@code{call-process-region}, @code{start-process}, or
865@code{open-network-stream}. 879@code{open-network-stream}. These are the names of the Emacs I/O primitives
880that can do coding system conversion.
866 881
867The remaining arguments should be the same arguments that might be given 882The remaining arguments should be the same arguments that might be given
868to that I/O primitive. Depending on which primitive, one of those 883to that I/O primitive. Depending on the primitive, one of those
869arguments is selected as the @dfn{target}. For example, if 884arguments is selected as the @dfn{target}. For example, if
870@var{operation} does file I/O, whichever argument specifies the file 885@var{operation} does file I/O, whichever argument specifies the file
871name is the target. For subprocess primitives, the process name is the 886name is the target. For subprocess primitives, the process name is the
@@ -1079,13 +1094,15 @@ that means do not encode terminal output.
1079@cindex text files and binary files 1094@cindex text files and binary files
1080@cindex binary files and text files 1095@cindex binary files and text files
1081 1096
1082 Emacs on MS-DOS and on MS-Windows recognizes certain file names as 1097 On MS-DOS and Microsoft Windows, Emacs guesses the appropriate
1083text files or binary files. By ``binary file'' we mean a file of 1098end-of-line conversion for a file by looking at the file's name. This
1084literal byte values that are not necessary meant to be characters. 1099feature classifies fils as @dfn{text files} and @dfn{binary files}. By
1085Emacs does no end-of-line conversion and no character code conversion 1100``binary file'' we mean a file of literal byte values that are not
1086for a binary file. Meanwhile, when you create a new file which is 1101necessarily meant to be characters; Emacs does no end-of-line conversion
1087marked by its name as a ``text file'', Emacs uses DOS end-of-line 1102and no character code conversion for them. On the other hand, the bytes
1088conversion. 1103in a text file are intended to represent characters; when you create a
1104new file whose name implies that it is a text file, Emacs uses DOS
1105end-of-line conversion.
1089 1106
1090@defvar buffer-file-type 1107@defvar buffer-file-type
1091This variable, automatically buffer-local in each buffer, records the 1108This variable, automatically buffer-local in each buffer, records the
@@ -1108,7 +1125,7 @@ Each element has the form (@var{regexp} . @var{type}), where
1108compute which. If it is a function, then it is called with a single 1125compute which. If it is a function, then it is called with a single
1109argument (the file name) and should return @code{t} or @code{nil}. 1126argument (the file name) and should return @code{t} or @code{nil}.
1110 1127
1111Emacs when running on MS-DOS or MS-Windows checks this alist to decide 1128When running on MS-DOS or MS-Windows, Emacs checks this alist to decide
1112which coding system to use when reading a file. For a text file, 1129which coding system to use when reading a file. For a text file,
1113@code{undecided-dos} is used. For a binary file, @code{no-conversion} 1130@code{undecided-dos} is used. For a binary file, @code{no-conversion}
1114is used. 1131is used.
@@ -1131,9 +1148,9 @@ from the file contents, in the usual Emacs fashion.
1131@section Input Methods 1148@section Input Methods
1132@cindex input methods 1149@cindex input methods
1133 1150
1134 @dfn{Input methods} provide convenient ways of entering non-@sc{ASCII} 1151 @dfn{Input methods} provide convenient ways of entering non-@sc{ascii}
1135characters from the keyboard. Unlike coding systems, which translate 1152characters from the keyboard. Unlike coding systems, which translate
1136non-@sc{ASCII} characters to and from encodings meant to be read by 1153non-@sc{ascii} characters to and from encodings meant to be read by
1137programs, input methods provide human-friendly commands. (@xref{Input 1154programs, input methods provide human-friendly commands. (@xref{Input
1138Methods,,, emacs, The GNU Emacs Manual}, for information on how users 1155Methods,,, emacs, The GNU Emacs Manual}, for information on how users
1139use input methods to enter text.) How to define input methods is not 1156use input methods to enter text.) How to define input methods is not
diff --git a/lispref/numbers.texi b/lispref/numbers.texi
index 3bba60a7f9f..eda707e9040 100644
--- a/lispref/numbers.texi
+++ b/lispref/numbers.texi
@@ -40,14 +40,14 @@ minimum range is @minus{}134217728 to 134217727 (28 bits; i.e.,
40-2**27 40-2**27
41@end ifinfo 41@end ifinfo
42@tex 42@tex
43$-2^{27}$ 43@math{-2^{27}}
44@end tex 44@end tex
45to 45to
46@ifinfo 46@ifinfo
472**27 - 1), 472**27 - 1),
48@end ifinfo 48@end ifinfo
49@tex 49@tex
50$2^{27}-1$), 50@math{2^{27}-1}),
51@end tex 51@end tex
52but some machines may provide a wider range. Many examples in this 52but some machines may provide a wider range. Many examples in this
53chapter assume an integer has 28 bits. 53chapter assume an integer has 28 bits.
@@ -312,6 +312,8 @@ otherwise.
312 312
313@defun max number-or-marker &rest numbers-or-markers 313@defun max number-or-marker &rest numbers-or-markers
314This function returns the largest of its arguments. 314This function returns the largest of its arguments.
315If any of the argument is floating-point, the value is returned
316as floating point, even if it was given as an integer.
315 317
316@example 318@example
317(max 20) 319(max 20)
@@ -319,12 +321,14 @@ This function returns the largest of its arguments.
319(max 1 2.5) 321(max 1 2.5)
320 @result{} 2.5 322 @result{} 2.5
321(max 1 3 2.5) 323(max 1 3 2.5)
322 @result{} 3 324 @result{} 3.0
323@end example 325@end example
324@end defun 326@end defun
325 327
326@defun min number-or-marker &rest numbers-or-markers 328@defun min number-or-marker &rest numbers-or-markers
327This function returns the smallest of its arguments. 329This function returns the smallest of its arguments.
330If any of the argument is floating-point, the value is returned
331as floating point, even if it was given as an integer.
328 332
329@example 333@example
330(min -4 1) 334(min -4 1)
@@ -958,14 +962,14 @@ The value of @code{(asin @var{arg})} is a number between
958@minus{}pi/2 962@minus{}pi/2
959@end ifinfo 963@end ifinfo
960@tex 964@tex
961$-\pi/2$ 965@math{-\pi/2}
962@end tex 966@end tex
963and 967and
964@ifinfo 968@ifinfo
965pi/2 969pi/2
966@end ifinfo 970@end ifinfo
967@tex 971@tex
968$\pi/2$ 972@math{\pi/2}
969@end tex 973@end tex
970(inclusive) whose sine is @var{arg}; if, however, @var{arg} 974(inclusive) whose sine is @var{arg}; if, however, @var{arg}
971is out of range (outside [-1, 1]), then the result is a NaN. 975is out of range (outside [-1, 1]), then the result is a NaN.
@@ -977,7 +981,7 @@ The value of @code{(acos @var{arg})} is a number between 0 and
977pi 981pi
978@end ifinfo 982@end ifinfo
979@tex 983@tex
980$\pi$ 984@math{\pi}
981@end tex 985@end tex
982(inclusive) whose cosine is @var{arg}; if, however, @var{arg} 986(inclusive) whose cosine is @var{arg}; if, however, @var{arg}
983is out of range (outside [-1, 1]), then the result is a NaN. 987is out of range (outside [-1, 1]), then the result is a NaN.
@@ -989,14 +993,14 @@ The value of @code{(atan @var{arg})} is a number between
989@minus{}pi/2 993@minus{}pi/2
990@end ifinfo 994@end ifinfo
991@tex 995@tex
992$-\pi/2$ 996@math{-\pi/2}
993@end tex 997@end tex
994and 998and
995@ifinfo 999@ifinfo
996pi/2 1000pi/2
997@end ifinfo 1001@end ifinfo
998@tex 1002@tex
999$\pi/2$ 1003@math{\pi/2}
1000@end tex 1004@end tex
1001(exclusive) whose tangent is @var{arg}. 1005(exclusive) whose tangent is @var{arg}.
1002@end defun 1006@end defun
@@ -1004,14 +1008,14 @@ $\pi/2$
1004@defun exp arg 1008@defun exp arg
1005This is the exponential function; it returns 1009This is the exponential function; it returns
1006@tex 1010@tex
1007$e$ 1011@math{e}
1008@end tex 1012@end tex
1009@ifinfo 1013@ifinfo
1010@i{e} 1014@i{e}
1011@end ifinfo 1015@end ifinfo
1012to the power @var{arg}. 1016to the power @var{arg}.
1013@tex 1017@tex
1014$e$ 1018@math{e}
1015@end tex 1019@end tex
1016@ifinfo 1020@ifinfo
1017@i{e} 1021@i{e}
@@ -1024,7 +1028,7 @@ logarithms.
1024This function returns the logarithm of @var{arg}, with base @var{base}. 1028This function returns the logarithm of @var{arg}, with base @var{base}.
1025If you don't specify @var{base}, the base 1029If you don't specify @var{base}, the base
1026@tex 1030@tex
1027$e$ 1031@math{e}
1028@end tex 1032@end tex
1029@ifinfo 1033@ifinfo
1030@i{e} 1034@i{e}
@@ -1085,9 +1089,9 @@ first call to @code{(random)} after you start Emacs always returns
1085-1457731, and the second one always returns -7692030. This 1089-1457731, and the second one always returns -7692030. This
1086repeatability is helpful for debugging. 1090repeatability is helpful for debugging.
1087 1091
1088If you want truly unpredictable random numbers, execute @code{(random 1092If you want random numbers that don't always come out the same, execute
1089t)}. This chooses a new seed based on the current time of day and on 1093@code{(random t)}. This chooses a new seed based on the current time of
1090Emacs's process @sc{id} number. 1094day and on Emacs's process @sc{id} number.
1091 1095
1092@defun random &optional limit 1096@defun random &optional limit
1093This function returns a pseudo-random integer. Repeated calls return a 1097This function returns a pseudo-random integer. Repeated calls return a
diff --git a/lispref/objects.texi b/lispref/objects.texi
index fcd50f3c1e9..7a70f4417ac 100644
--- a/lispref/objects.texi
+++ b/lispref/objects.texi
@@ -25,7 +25,7 @@ but not for ``the'' type of an object.
25which all other types are constructed, are called @dfn{primitive 25which all other types are constructed, are called @dfn{primitive
26types}. Each object belongs to one and only one primitive type. These 26types}. Each object belongs to one and only one primitive type. These
27types include @dfn{integer}, @dfn{float}, @dfn{cons}, @dfn{symbol}, 27types include @dfn{integer}, @dfn{float}, @dfn{cons}, @dfn{symbol},
28@dfn{string}, @dfn{vector}, @dfn{subr}, @dfn{byte-code function}, plus 28@dfn{string}, @dfn{vector}, @dfn{subr}, and @dfn{byte-code function}, plus
29several special types, such as @dfn{buffer}, that are related to 29several special types, such as @dfn{buffer}, that are related to
30editing. (@xref{Editing Types}.) 30editing. (@xref{Editing Types}.)
31 31
@@ -52,6 +52,7 @@ to use these types can be found in later chapters.
52* Comments:: Comments and their formatting conventions. 52* Comments:: Comments and their formatting conventions.
53* Programming Types:: Types found in all Lisp systems. 53* Programming Types:: Types found in all Lisp systems.
54* Editing Types:: Types specific to Emacs. 54* Editing Types:: Types specific to Emacs.
55* Circular Objects:: Read syntax for circular structure.
55* Type Predicates:: Tests related to types. 56* Type Predicates:: Tests related to types.
56* Equality Predicates:: Tests of equality between any two objects. 57* Equality Predicates:: Tests of equality between any two objects.
57@end menu 58@end menu
@@ -146,6 +147,7 @@ latter are unique to Emacs Lisp.
146* Vector Type:: One-dimensional arrays. 147* Vector Type:: One-dimensional arrays.
147* Char-Table Type:: One-dimensional sparse arrays indexed by characters. 148* Char-Table Type:: One-dimensional sparse arrays indexed by characters.
148* Bool-Vector Type:: One-dimensional arrays of @code{t} or @code{nil}. 149* Bool-Vector Type:: One-dimensional arrays of @code{t} or @code{nil}.
150* Hash Table Type:: Super-fast lookup tables.
149* Function Type:: A piece of executable code you can call from elsewhere. 151* Function Type:: A piece of executable code you can call from elsewhere.
150* Macro Type:: A method of expanding an expression into another 152* Macro Type:: A method of expanding an expression into another
151 expression, more fundamental but less pretty. 153 expression, more fundamental but less pretty.
@@ -164,14 +166,14 @@ latter are unique to Emacs Lisp.
164-2**27 166-2**27
165@end ifinfo 167@end ifinfo
166@tex 168@tex
167$-2^{27}$ 169@math{-2^{27}}
168@end tex 170@end tex
169to 171to
170@ifinfo 172@ifinfo
1712**27 - 1) 1732**27 - 1)
172@end ifinfo 174@end ifinfo
173@tex 175@tex
174$2^{28}-1$) 176@math{2^{28}-1})
175@end tex 177@end tex
176on most machines. (Some machines may provide a wider range.) It is 178on most machines. (Some machines may provide a wider range.) It is
177important to note that the Emacs Lisp arithmetic functions do not check 179important to note that the Emacs Lisp arithmetic functions do not check
@@ -187,7 +189,7 @@ leading @samp{+} or a final @samp{.}.
187@group 189@group
188-1 ; @r{The integer -1.} 190-1 ; @r{The integer -1.}
1891 ; @r{The integer 1.} 1911 ; @r{The integer 1.}
1901. ; @r{Also The integer 1.} 1921. ; @r{Also the integer 1.}
191+1 ; @r{Also the integer 1.} 193+1 ; @r{Also the integer 1.}
192268435457 ; @r{Also the integer 1 on a 28-bit implementation.} 194268435457 ; @r{Also the integer 1 on a 28-bit implementation.}
193@end group 195@end group
@@ -212,7 +214,7 @@ number whose value is 1500. They are all equivalent.
212 214
213@node Character Type 215@node Character Type
214@subsection Character Type 216@subsection Character Type
215@cindex @sc{ASCII} character codes 217@cindex @sc{ascii} character codes
216 218
217 A @dfn{character} in Emacs Lisp is nothing more than an integer. In 219 A @dfn{character} in Emacs Lisp is nothing more than an integer. In
218other words, characters are represented by their character codes. For 220other words, characters are represented by their character codes. For
@@ -290,6 +292,7 @@ respectively. Thus,
290?\r @result{} 13 ; @r{carriage return, @key{RET}, @kbd{C-m}} 292?\r @result{} 13 ; @r{carriage return, @key{RET}, @kbd{C-m}}
291?\e @result{} 27 ; @r{escape character, @key{ESC}, @kbd{C-[}} 293?\e @result{} 27 ; @r{escape character, @key{ESC}, @kbd{C-[}}
292?\\ @result{} 92 ; @r{backslash character, @kbd{\}} 294?\\ @result{} 92 ; @r{backslash character, @kbd{\}}
295?\d @result{} 127 ; @r{delete character, @key{DEL}}
293@end example 296@end example
294 297
295@cindex escape sequence 298@cindex escape sequence
@@ -312,17 +315,17 @@ equivalent to @samp{?\^I} and to @samp{?\^i}:
312@end example 315@end example
313 316
314 In strings and buffers, the only control characters allowed are those 317 In strings and buffers, the only control characters allowed are those
315that exist in @sc{ASCII}; but for keyboard input purposes, you can turn 318that exist in @sc{ascii}; but for keyboard input purposes, you can turn
316any character into a control character with @samp{C-}. The character 319any character into a control character with @samp{C-}. The character
317codes for these non-@sc{ASCII} control characters include the 320codes for these non-@sc{ascii} control characters include the
318@tex 321@tex
319$2^{26}$ 322@math{2^{26}}
320@end tex 323@end tex
321@ifinfo 324@ifinfo
3222**26 3252**26
323@end ifinfo 326@end ifinfo
324bit as well as the code for the corresponding non-control 327bit as well as the code for the corresponding non-control
325character. Ordinary terminals have no way of generating non-@sc{ASCII} 328character. Ordinary terminals have no way of generating non-@sc{ascii}
326control characters, but you can generate them straightforwardly using X 329control characters, but you can generate them straightforwardly using X
327and other window systems. 330and other window systems.
328 331
@@ -349,7 +352,7 @@ people who read it.
349 A @dfn{meta character} is a character typed with the @key{META} 352 A @dfn{meta character} is a character typed with the @key{META}
350modifier key. The integer that represents such a character has the 353modifier key. The integer that represents such a character has the
351@tex 354@tex
352$2^{27}$ 355@math{2^{27}}
353@end tex 356@end tex
354@ifinfo 357@ifinfo
3552**27 3582**27
@@ -360,14 +363,14 @@ of basic character codes.
360 363
361 In a string, the 364 In a string, the
362@tex 365@tex
363$2^{7}$ 366@math{2^{7}}
364@end tex 367@end tex
365@ifinfo 368@ifinfo
3662**7 3692**7
367@end ifinfo 370@end ifinfo
368bit attached to an ASCII character indicates a meta character; thus, the 371bit attached to an ASCII character indicates a meta character; thus, the
369meta characters that can fit in a string have codes in the range from 372meta characters that can fit in a string have codes in the range from
370128 to 255, and are the meta versions of the ordinary @sc{ASCII} 373128 to 255, and are the meta versions of the ordinary @sc{ascii}
371characters. (In Emacs versions 18 and older, this convention was used 374characters. (In Emacs versions 18 and older, this convention was used
372for characters outside of strings as well.) 375for characters outside of strings as well.)
373 376
@@ -379,11 +382,11 @@ or as @samp{?\M-\101}. Likewise, you can write @kbd{C-M-b} as
379@samp{?\M-\C-b}, @samp{?\C-\M-b}, or @samp{?\M-\002}. 382@samp{?\M-\C-b}, @samp{?\C-\M-b}, or @samp{?\M-\002}.
380 383
381 The case of a graphic character is indicated by its character code; 384 The case of a graphic character is indicated by its character code;
382for example, @sc{ASCII} distinguishes between the characters @samp{a} 385for example, @sc{ascii} distinguishes between the characters @samp{a}
383and @samp{A}. But @sc{ASCII} has no way to represent whether a control 386and @samp{A}. But @sc{ascii} has no way to represent whether a control
384character is upper case or lower case. Emacs uses the 387character is upper case or lower case. Emacs uses the
385@tex 388@tex
386$2^{25}$ 389@math{2^{25}}
387@end tex 390@end tex
388@ifinfo 391@ifinfo
3892**25 3922**25
@@ -405,7 +408,7 @@ significant in these prefixes.) Thus, @samp{?\H-\M-\A-x} represents
405@kbd{Alt-Hyper-Meta-x}. 408@kbd{Alt-Hyper-Meta-x}.
406@tex 409@tex
407Numerically, the 410Numerically, the
408bit values are $2^{22}$ for alt, $2^{23}$ for super and $2^{24}$ for hyper. 411bit values are @math{2^{22}} for alt, @math{2^{23}} for super and @math{2^{24}} for hyper.
409@end tex 412@end tex
410@ifinfo 413@ifinfo
411Numerically, the 414Numerically, the
@@ -420,9 +423,9 @@ character code in either octal or hex. To use octal, write a question
420mark followed by a backslash and the octal character code (up to three 423mark followed by a backslash and the octal character code (up to three
421octal digits); thus, @samp{?\101} for the character @kbd{A}, 424octal digits); thus, @samp{?\101} for the character @kbd{A},
422@samp{?\001} for the character @kbd{C-a}, and @code{?\002} for the 425@samp{?\001} for the character @kbd{C-a}, and @code{?\002} for the
423character @kbd{C-b}. Although this syntax can represent any @sc{ASCII} 426character @kbd{C-b}. Although this syntax can represent any @sc{ascii}
424character, it is preferred only when the precise octal value is more 427character, it is preferred only when the precise octal value is more
425important than the @sc{ASCII} representation. 428important than the @sc{ascii} representation.
426 429
427@example 430@example
428@group 431@group
@@ -520,6 +523,11 @@ char-to-string ; @r{A symbol named @samp{char-to-string}.}
520@end group 523@end group
521@end example 524@end example
522 525
526@cindex @samp{#:} read syntax
527 Normally the Lisp reader interns all symbols (@pxref{Creating
528Symbols}). To prevent interning, you can write @samp{#:} before the
529name of the symbol.
530
523@node Sequence Type 531@node Sequence Type
524@subsection Sequence Types 532@subsection Sequence Types
525 533
@@ -559,7 +567,7 @@ same object, @code{nil}.
559 567
560 A @dfn{cons cell} is an object that consists of two slots, called the 568 A @dfn{cons cell} is an object that consists of two slots, called the
561@sc{car} slot and the @sc{cdr} slot. Each slot can @dfn{hold} or 569@sc{car} slot and the @sc{cdr} slot. Each slot can @dfn{hold} or
562@dfn{refer to} any Lisp object. We also say that the ``the @sc{car} of 570@dfn{refer to} any Lisp object. We also say that ``the @sc{car} of
563this cons cell is'' whatever object its @sc{car} slot currently holds, 571this cons cell is'' whatever object its @sc{car} slot currently holds,
564and likewise for the @sc{cdr}. 572and likewise for the @sc{cdr}.
565 573
@@ -794,7 +802,8 @@ sets the variable @code{alist-of-colors} to an alist of three elements. In the
794first element, @code{rose} is the key and @code{red} is the value. 802first element, @code{rose} is the key and @code{red} is the value.
795 803
796 @xref{Association Lists}, for a further explanation of alists and for 804 @xref{Association Lists}, for a further explanation of alists and for
797functions that work on alists. 805functions that work on alists. @xref{Hash Tables}, for another kind of
806lookup table, which is much faster for handling a large number of keys.
798 807
799@node Array Type 808@node Array Type
800@subsection Array Type 809@subsection Array Type
@@ -884,9 +893,9 @@ but the newline is ignored if escaped."
884@node Non-ASCII in Strings 893@node Non-ASCII in Strings
885@subsubsection Non-ASCII Characters in Strings 894@subsubsection Non-ASCII Characters in Strings
886 895
887 You can include a non-@sc{ASCII} international character in a string 896 You can include a non-@sc{ascii} international character in a string
888constant by writing it literally. There are two text representations 897constant by writing it literally. There are two text representations
889for non-@sc{ASCII} characters in Emacs strings (and in buffers): unibyte 898for non-@sc{ascii} characters in Emacs strings (and in buffers): unibyte
890and multibyte. If the string constant is read from a multibyte source, 899and multibyte. If the string constant is read from a multibyte source,
891such as a multibyte buffer or string, or a file that would be visited as 900such as a multibyte buffer or string, or a file that would be visited as
892multibyte, then the character is read as a multibyte character, and that 901multibyte, then the character is read as a multibyte character, and that
@@ -895,7 +904,7 @@ unibyte source, then the character is read as unibyte and that makes the
895string unibyte. 904string unibyte.
896 905
897 You can also represent a multibyte non-@sc{ASCII} character with its 906 You can also represent a multibyte non-@sc{ASCII} character with its
898character code, using a hex escape, @samp{\x@var{nnnnnnn}}, with as many 907character code: use a hex escape, @samp{\x@var{nnnnnnn}}, with as many
899digits as necessary. (Multibyte non-@sc{ASCII} character codes are all 908digits as necessary. (Multibyte non-@sc{ASCII} character codes are all
900greater than 256.) Any character which is not a valid hex digit 909greater than 256.) Any character which is not a valid hex digit
901terminates this construct. If the next character in the string could be 910terminates this construct. If the next character in the string could be
@@ -906,7 +915,7 @@ constant is just like backslash-newline; it does not contribute any
906character to the string, but it does terminate the preceding hex escape. 915character to the string, but it does terminate the preceding hex escape.
907 916
908 Using a multibyte hex escape forces the string to multibyte. You can 917 Using a multibyte hex escape forces the string to multibyte. You can
909represent a unibyte non-@sc{ASCII} character with its character code, 918represent a unibyte non-@sc{ascii} character with its character code,
910which must be in the range from 128 (0200 octal) to 255 (0377 octal). 919which must be in the range from 128 (0200 octal) to 255 (0377 octal).
911This forces a unibyte string. 920This forces a unibyte string.
912 921
@@ -925,16 +934,16 @@ description of the read syntax for characters.
925 934
926 However, not all of the characters you can write with backslash 935 However, not all of the characters you can write with backslash
927escape-sequences are valid in strings. The only control characters that 936escape-sequences are valid in strings. The only control characters that
928a string can hold are the @sc{ASCII} control characters. Strings do not 937a string can hold are the @sc{ascii} control characters. Strings do not
929distinguish case in @sc{ASCII} control characters. 938distinguish case in @sc{ascii} control characters.
930 939
931 Properly speaking, strings cannot hold meta characters; but when a 940 Properly speaking, strings cannot hold meta characters; but when a
932string is to be used as a key sequence, there is a special convention 941string is to be used as a key sequence, there is a special convention
933that provides a way to represent meta versions of @sc{ASCII} characters in a 942that provides a way to represent meta versions of @sc{ascii} characters in a
934string. If you use the @samp{\M-} syntax to indicate a meta character 943string. If you use the @samp{\M-} syntax to indicate a meta character
935in a string constant, this sets the 944in a string constant, this sets the
936@tex 945@tex
937$2^{7}$ 946@math{2^{7}}
938@end tex 947@end tex
939@ifinfo 948@ifinfo
9402**7 9492**7
@@ -1043,7 +1052,7 @@ Syntax tables (@pxref{Syntax Tables}).
1043 A @dfn{bool-vector} is a one-dimensional array of elements that 1052 A @dfn{bool-vector} is a one-dimensional array of elements that
1044must be @code{t} or @code{nil}. 1053must be @code{t} or @code{nil}.
1045 1054
1046 The printed representation of a Bool-vector is like a string, except 1055 The printed representation of a bool-vector is like a string, except
1047that it begins with @samp{#&} followed by the length. The string 1056that it begins with @samp{#&} followed by the length. The string
1048constant that follows actually specifies the contents of the bool-vector 1057constant that follows actually specifies the contents of the bool-vector
1049as a bitmap---each ``character'' in the string contains 8 bits, which 1058as a bitmap---each ``character'' in the string contains 8 bits, which
@@ -1063,6 +1072,19 @@ these extras really make no difference.
1063 @result{} t 1072 @result{} t
1064@end example 1073@end example
1065 1074
1075@node Hash Table Type
1076@subsection Hash Table Type
1077
1078 A hash table is a very fast kind of lookup table, somewhat like an
1079alist in that it maps keys to corresponding values, but much faster.
1080Hash tables are a new feature in Emacs 21; they have no read syntax, and
1081print using hash notation. @xref{Hash Tables}.
1082
1083@example
1084(make-hash-table)
1085 @result{} #<hash-table 'eql nil 0/65 0x83af980>
1086@end example
1087
1066@node Function Type 1088@node Function Type
1067@subsection Function Type 1089@subsection Function Type
1068 1090
@@ -1156,11 +1178,11 @@ opening @samp{[}.
1156@subsection Autoload Type 1178@subsection Autoload Type
1157 1179
1158 An @dfn{autoload object} is a list whose first element is the symbol 1180 An @dfn{autoload object} is a list whose first element is the symbol
1159@code{autoload}. It is stored as the function definition of a symbol as 1181@code{autoload}. It is stored as the function definition of a symbol,
1160a placeholder for the real definition; it says that the real definition 1182where it serves as a placeholder for the real definition. The autoload
1161is found in a file of Lisp code that should be loaded when necessary. 1183object says that the real definition is found in a file of Lisp code
1162The autoload object contains the name of the file, plus some other 1184that should be loaded when necessary. It contains the name of the file,
1163information about the real definition. 1185plus some other information about the real definition.
1164 1186
1165 After the file has been loaded, the symbol should have a new function 1187 After the file has been loaded, the symbol should have a new function
1166definition that is not an autoload object. The new definition is then 1188definition that is not an autoload object. The new definition is then
@@ -1207,9 +1229,9 @@ buffer need not be displayed in any window.
1207 The contents of a buffer are much like a string, but buffers are not 1229 The contents of a buffer are much like a string, but buffers are not
1208used like strings in Emacs Lisp, and the available operations are 1230used like strings in Emacs Lisp, and the available operations are
1209different. For example, you can insert text efficiently into an 1231different. For example, you can insert text efficiently into an
1210existing buffer, whereas ``inserting'' text into a string requires 1232existing buffer, altering the buffer's contents, whereas ``inserting''
1211concatenating substrings, and the result is an entirely new string 1233text into a string requires concatenating substrings, and the result is
1212object. 1234an entirely new string object.
1213 1235
1214 Each buffer has a designated position called @dfn{point} 1236 Each buffer has a designated position called @dfn{point}
1215(@pxref{Positions}). At any time, one buffer is the @dfn{current 1237(@pxref{Positions}). At any time, one buffer is the @dfn{current
@@ -1431,6 +1453,69 @@ positions.
1431 1453
1432 @xref{Overlays}, for how to create and use overlays. 1454 @xref{Overlays}, for how to create and use overlays.
1433 1455
1456@node Circular Objects
1457@section Read Syntax for Circular Objects
1458@cindex circular structure, read syntax
1459@cindex shared structure, read syntax
1460@cindex @samp{#@var{n}=} read syntax
1461@cindex @samp{#@var{n}#} read syntax
1462
1463 In Emacs 21, to represent shared or circular structure within a
1464complex of Lisp objects, you can use the reader constructs
1465@samp{#@var{n}=} and @samp{#@var{n}#}.
1466
1467 Use @code{#@var{n}=} before an object to label it for later reference;
1468subsequently, you can use @code{#@var{n}#} to refer the same object in
1469another place. Here, @var{n} is some integer. For example, here is how
1470to make a list in which the first element recurs as the third element:
1471
1472@example
1473(#1=(a) b #1#)
1474@end example
1475
1476@noindent
1477This differs from ordinary syntax such as this
1478
1479@example
1480((a) b (a))
1481@end example
1482
1483@noindent
1484which would result in a list whose first and third elements
1485look alike but are not the same Lisp object. This shows the difference:
1486
1487@example
1488(prog1 nil
1489 (setq x '(#1=(a) b #1#)))
1490(eq (nth 0 x) (nth 2 x))
1491 @result{} t
1492(setq x '((a) b (a)))
1493(eq (nth 0 x) (nth 2 x))
1494 @result{} nil
1495@end example
1496
1497 You can also use the same syntax to make a circular structure, which
1498appears as an ``element'' within itself. Here is an example:
1499
1500@example
1501#1=(a #1#)
1502@end example
1503
1504@noindent
1505This makes a list whose second element is the list itself.
1506Here's how you can see that it really works:
1507
1508@example
1509(prog1 nil
1510 (setq x '#1=(a #1#)))
1511(eq x (cadr x))
1512 @result{} t
1513@end example
1514
1515 The Lisp printer can produce this syntax to record circular and shared
1516structure in a Lisp object, if you bind the variable @code{print-circle}
1517to a non-@code{nil} value. @xref{Output Variables}.
1518
1434@node Type Predicates 1519@node Type Predicates
1435@section Type Predicates 1520@section Type Predicates
1436@cindex predicates 1521@cindex predicates
@@ -1764,7 +1849,7 @@ arguments to see if their elements are the same. So, if two objects are
1764Comparison of strings is case-sensitive, but does not take account of 1849Comparison of strings is case-sensitive, but does not take account of
1765text properties---it compares only the characters in the strings. 1850text properties---it compares only the characters in the strings.
1766A unibyte string never equals a multibyte string unless the 1851A unibyte string never equals a multibyte string unless the
1767contents are entirely @sc{ASCII} (@pxref{Text Representations}). 1852contents are entirely @sc{ascii} (@pxref{Text Representations}).
1768 1853
1769@example 1854@example
1770@group 1855@group
diff --git a/lispref/os.texi b/lispref/os.texi
index 380b67abb17..06c297ab881 100644
--- a/lispref/os.texi
+++ b/lispref/os.texi
@@ -15,7 +15,7 @@ and flow control.
15pertaining to the terminal and the screen. 15pertaining to the terminal and the screen.
16 16
17@menu 17@menu
18* Starting Up:: Customizing Emacs start-up processing. 18* Starting Up:: Customizing Emacs startup processing.
19* Getting Out:: How exiting works (permanent or temporary). 19* Getting Out:: How exiting works (permanent or temporary).
20* System Environment:: Distinguish the name and kind of system. 20* System Environment:: Distinguish the name and kind of system.
21* User Identification:: Finding the name and user id of the user. 21* User Identification:: Finding the name and user id of the user.
@@ -25,6 +25,7 @@ pertaining to the terminal and the screen.
25* Timers:: Setting a timer to call a function at a certain time. 25* Timers:: Setting a timer to call a function at a certain time.
26* Terminal Input:: Recording terminal input for debugging. 26* Terminal Input:: Recording terminal input for debugging.
27* Terminal Output:: Recording terminal output for debugging. 27* Terminal Output:: Recording terminal output for debugging.
28* Sound Output:: Playing sounds on the computer's speaker.
28* Special Keysyms:: Defining system-specific key symbols for X windows. 29* Special Keysyms:: Defining system-specific key symbols for X windows.
29* Flow Control:: How to turn output flow control on or off. 30* Flow Control:: How to turn output flow control on or off.
30* Batch Mode:: Running Emacs without terminal interaction. 31* Batch Mode:: Running Emacs without terminal interaction.
@@ -37,17 +38,17 @@ pertaining to the terminal and the screen.
37can customize these actions. 38can customize these actions.
38 39
39@menu 40@menu
40* Start-up Summary:: Sequence of actions Emacs performs at start-up. 41* Startup Summary:: Sequence of actions Emacs performs at startup.
41* Init File:: Details on reading the init file (@file{.emacs}). 42* Init File:: Details on reading the init file (@file{.emacs}).
42* Terminal-Specific:: How the terminal-specific Lisp file is read. 43* Terminal-Specific:: How the terminal-specific Lisp file is read.
43* Command Line Arguments:: How command line arguments are processed, 44* Command-Line Arguments:: How command-line arguments are processed,
44 and how you can customize them. 45 and how you can customize them.
45@end menu 46@end menu
46 47
47@node Start-up Summary 48@node Startup Summary
48@subsection Summary: Sequence of Actions at Start Up 49@subsection Summary: Sequence of Actions at Startup
49@cindex initialization 50@cindex initialization
50@cindex start up of Emacs 51@cindex startup of Emacs
51@cindex @file{startup.el} 52@cindex @file{startup.el}
52 53
53 The order of operations performed (in @file{startup.el}) by Emacs when 54 The order of operations performed (in @file{startup.el}) by Emacs when
@@ -86,7 +87,7 @@ It loads the library @file{site-start}, unless the option
86@item 87@item
87It loads the file @file{~/.emacs}, unless @samp{-q} or @samp{-batch} was 88It loads the file @file{~/.emacs}, unless @samp{-q} or @samp{-batch} was
88specified on the command line. The @samp{-u} option can specify another 89specified on the command line. The @samp{-u} option can specify another
89user name whose home directory should be used instead of @file{~}. 90user whose home directory should be used instead of @file{~}.
90 91
91@item 92@item
92It loads the library @file{default}, unless @code{inhibit-default-init} 93It loads the library @file{default}, unless @code{inhibit-default-init}
@@ -127,7 +128,7 @@ It runs @code{window-setup-hook}. @xref{Window Systems}.
127 128
128@item 129@item
129It displays copyleft, nonwarranty, and basic use information, provided 130It displays copyleft, nonwarranty, and basic use information, provided
130there were no remaining command line arguments (a few steps above), 131there were no remaining command-line arguments (a few steps above),
131the value of @code{inhibit-startup-message} is @code{nil}, and the 132the value of @code{inhibit-startup-message} is @code{nil}, and the
132buffer is still empty. 133buffer is still empty.
133@end enumerate 134@end enumerate
@@ -170,12 +171,12 @@ message for someone else.
170@cindex @file{.emacs} 171@cindex @file{.emacs}
171 172
172 When you start Emacs, it normally attempts to load the file 173 When you start Emacs, it normally attempts to load the file
173@file{.emacs} from your home directory. This file, if it exists, must 174@file{.emacs} from your home directory. This file is called your
174contain Lisp code. It is called your @dfn{init file}. The command line 175@dfn{init file}. If it exists, it must contain Lisp code. The
175switches @samp{-q} and @samp{-u} affect the use of the init file; 176command-line switches @samp{-q} and @samp{-u} affect the use of the init
176@samp{-q} says not to load an init file, and @samp{-u} says to load a 177file; @samp{-q} says not to load an init file, and @samp{-u} says to
177specified user's init file instead of yours. @xref{Entering Emacs,,, 178load a specified user's init file instead of yours. @xref{Entering
178emacs, The GNU Emacs Manual}. 179Emacs,,, emacs, The GNU Emacs Manual}.
179 180
180@cindex default init file 181@cindex default init file
181 A site may have a @dfn{default init file}, which is the library named 182 A site may have a @dfn{default init file}, which is the library named
@@ -200,9 +201,8 @@ Emacs.
200@end defvar 201@end defvar
201 202
202 If there is a great deal of code in your @file{.emacs} file, you 203 If there is a great deal of code in your @file{.emacs} file, you
203should move it into another file named @file{@var{something}.el}, 204can make it load faster by renaming it to @file{.emacs.el}
204byte-compile it (@pxref{Byte Compilation}), and make your @file{.emacs} 205and then byte-compiling it (@pxref{Byte Compilation}).
205file load the other file using @code{load} (@pxref{Loading}).
206 206
207 @xref{Init File Examples,,, emacs, The GNU Emacs Manual}, for 207 @xref{Init File Examples,,, emacs, The GNU Emacs Manual}, for
208examples of how to make various commonly desired customizations in your 208examples of how to make various commonly desired customizations in your
@@ -234,7 +234,8 @@ before the terminal-specific initialization.
234 Each terminal type can have its own Lisp library that Emacs loads when 234 Each terminal type can have its own Lisp library that Emacs loads when
235run on that type of terminal. The library's name is constructed by 235run on that type of terminal. The library's name is constructed by
236concatenating the value of the variable @code{term-file-prefix} and the 236concatenating the value of the variable @code{term-file-prefix} and the
237terminal type. Normally, @code{term-file-prefix} has the value 237terminal type (specified by the environment variable @code{TERM}).
238Normally, @code{term-file-prefix} has the value
238@code{"term/"}; changing this is not recommended. Emacs finds the file 239@code{"term/"}; changing this is not recommended. Emacs finds the file
239in the normal manner, by searching the @code{load-path} directories, and 240in the normal manner, by searching the @code{load-path} directories, and
240trying the @samp{.elc} and @samp{.el} suffixes. 241trying the @samp{.elc} and @samp{.el} suffixes.
@@ -279,6 +280,9 @@ You may set the @code{term-file-prefix} variable to @code{nil} in your
279@file{.emacs} file if you do not wish to load the 280@file{.emacs} file if you do not wish to load the
280terminal-initialization file. To do this, put the following in 281terminal-initialization file. To do this, put the following in
281your @file{.emacs} file: @code{(setq term-file-prefix nil)}. 282your @file{.emacs} file: @code{(setq term-file-prefix nil)}.
283
284On MS-DOS, if the environment variable @code{TERM} is not set, Emacs
285uses @samp{internal} as the terminal type.
282@end defvar 286@end defvar
283 287
284@defvar term-setup-hook 288@defvar term-setup-hook
@@ -293,27 +297,27 @@ terminal-specific file.
293 See @code{window-setup-hook} in @ref{Window Systems}, for a related 297 See @code{window-setup-hook} in @ref{Window Systems}, for a related
294feature. 298feature.
295 299
296@node Command Line Arguments 300@node Command-Line Arguments
297@subsection Command Line Arguments 301@subsection Command-Line Arguments
298@cindex command line arguments 302@cindex command-line arguments
299 303
300 You can use command line arguments to request various actions when you 304 You can use command-line arguments to request various actions when you
301start Emacs. Since you do not need to start Emacs more than once per 305start Emacs. Since you do not need to start Emacs more than once per
302day, and will often leave your Emacs session running longer than that, 306day, and will often leave your Emacs session running longer than that,
303command line arguments are hardly ever used. As a practical matter, it 307command-line arguments are hardly ever used. As a practical matter, it
304is best to avoid making the habit of using them, since this habit would 308is best to avoid making the habit of using them, since this habit would
305encourage you to kill and restart Emacs unnecessarily often. These 309encourage you to kill and restart Emacs unnecessarily often. These
306options exist for two reasons: to be compatible with other editors (for 310options exist for two reasons: to be compatible with other editors (for
307invocation by other programs) and to enable shell scripts to run 311invocation by other programs) and to enable shell scripts to run
308specific Lisp programs. 312specific Lisp programs.
309 313
310 This section describes how Emacs processes command line arguments, 314 This section describes how Emacs processes command-line arguments,
311and how you can customize them. 315and how you can customize them.
312 316
313@ignore 317@ignore
314 (Note that some other editors require you to start afresh each time 318 (Note that some other editors require you to start afresh each time
315you want to edit a file. With this kind of editor, you will probably 319you want to edit a file. With this kind of editor, you will probably
316specify the file as a command line argument. The recommended way to 320specify the file as a command-line argument. The recommended way to
317use GNU Emacs is to start it only once, just after you log in, and do 321use GNU Emacs is to start it only once, just after you log in, and do
318all your editing in the same Emacs process. Each time you want to edit 322all your editing in the same Emacs process. Each time you want to edit
319a different file, you visit it with the existing Emacs, which eventually 323a different file, you visit it with the existing Emacs, which eventually
@@ -333,19 +337,19 @@ processed.
333 337
334If you redump Emacs by calling @code{dump-emacs}, you may wish to set 338If you redump Emacs by calling @code{dump-emacs}, you may wish to set
335this variable to @code{nil} first in order to cause the new dumped Emacs 339this variable to @code{nil} first in order to cause the new dumped Emacs
336to process its new command line arguments. 340to process its new command-line arguments.
337@end defvar 341@end defvar
338 342
339@defvar command-switch-alist 343@defvar command-switch-alist
340@cindex switches on command line 344@cindex switches on command line
341@cindex options on command line 345@cindex options on command line
342@cindex command line options 346@cindex command-line options
343The value of this variable is an alist of user-defined command-line 347The value of this variable is an alist of user-defined command-line
344options and associated handler functions. This variable exists so you 348options and associated handler functions. This variable exists so you
345can add elements to it. 349can add elements to it.
346 350
347A @dfn{command line option} is an argument on the command line of the 351A @dfn{command-line option} is an argument on the command line, which
348form: 352has the form:
349 353
350@example 354@example
351-@var{option} 355-@var{option}
@@ -357,8 +361,10 @@ The elements of the @code{command-switch-alist} look like this:
357(@var{option} . @var{handler-function}) 361(@var{option} . @var{handler-function})
358@end example 362@end example
359 363
360The @var{handler-function} is called to handle @var{option} and receives 364The @sc{car}, @var{option}, is a string, the name of a command-line
361the option name as its sole argument. 365option (not including the initial hyphen). The @var{handler-function}
366is called to handle @var{option}, and receives the option name as its
367sole argument.
362 368
363In some cases, the option is followed in the command line by an 369In some cases, the option is followed in the command line by an
364argument. In these cases, the @var{handler-function} can find all the 370argument. In these cases, the @var{handler-function} can find all the
@@ -366,14 +372,14 @@ remaining command-line arguments in the variable
366@code{command-line-args-left}. (The entire list of command-line 372@code{command-line-args-left}. (The entire list of command-line
367arguments is in @code{command-line-args}.) 373arguments is in @code{command-line-args}.)
368 374
369The command line arguments are parsed by the @code{command-line-1} 375The command-line arguments are parsed by the @code{command-line-1}
370function in the @file{startup.el} file. See also @ref{Command 376function in the @file{startup.el} file. See also @ref{Command
371Switches, , Command Line Switches and Arguments, emacs, The GNU Emacs 377Switches, , Command Line Switches and Arguments, emacs, The GNU Emacs
372Manual}. 378Manual}.
373@end defvar 379@end defvar
374 380
375@defvar command-line-args 381@defvar command-line-args
376The value of this variable is the list of command line arguments passed 382The value of this variable is the list of command-line arguments passed
377to Emacs. 383to Emacs.
378@end defvar 384@end defvar
379 385
@@ -436,10 +442,10 @@ input) can read them.
436@end defun 442@end defun
437 443
438 All the information in the Emacs process, aside from files that have 444 All the information in the Emacs process, aside from files that have
439been saved, is lost when the Emacs is killed. Because killing Emacs 445been saved, is lost when the Emacs process is killed. Because killing
440inadvertently can lose a lot of work, Emacs queries for confirmation 446Emacs inadvertently can lose a lot of work, Emacs queries for
441before actually terminating if you have buffers that need saving or 447confirmation before actually terminating if you have buffers that need
442subprocesses that are running. This is done in the function 448saving or subprocesses that are running. This is done in the function
443@code{save-buffers-kill-emacs}. 449@code{save-buffers-kill-emacs}.
444 450
445@defvar kill-emacs-query-functions 451@defvar kill-emacs-query-functions
@@ -475,7 +481,7 @@ subprocess of Emacs. Then you would exit the shell to return to Emacs.
475may not have a parent that can resume it again, and in any case you can 481may not have a parent that can resume it again, and in any case you can
476give input to some other job such as a shell merely by moving to a 482give input to some other job such as a shell merely by moving to a
477different window. Therefore, suspending is not allowed when Emacs is using 483different window. Therefore, suspending is not allowed when Emacs is using
478a window system. 484a window system (X Windows or MS Windows).
479 485
480@defun suspend-emacs string 486@defun suspend-emacs string
481This function stops Emacs and returns control to the superior process. 487This function stops Emacs and returns control to the superior process.
@@ -545,11 +551,12 @@ Resumed!
545@end defun 551@end defun
546 552
547@defvar suspend-hook 553@defvar suspend-hook
548This variable is a normal hook run before suspending. 554This variable is a normal hook that Emacs runs before suspending.
549@end defvar 555@end defvar
550 556
551@defvar suspend-resume-hook 557@defvar suspend-resume-hook
552This variable is a normal hook run after suspending. 558This variable is a normal hook that Emacs runs on resuming
559after a suspension.
553@end defvar 560@end defvar
554 561
555@node System Environment 562@node System Environment
@@ -598,7 +605,9 @@ Hewlett-Packard HPUX operating system.
598Silicon Graphics Irix system. 605Silicon Graphics Irix system.
599 606
600@item ms-dos 607@item ms-dos
601Microsoft MS-DOS ``operating system.'' 608Microsoft MS-DOS ``operating system.'' Emacs compiled with DJGPP for
609MS-DOS binds @code{system-type} to @code{ms-dos} even when you run it on
610MS-Windows.
602 611
603@item next-mach 612@item next-mach
604NeXT Mach-based system. 613NeXT Mach-based system.
@@ -616,7 +625,8 @@ AT&T System V.
616VAX VMS. 625VAX VMS.
617 626
618@item windows-nt 627@item windows-nt
619Microsoft windows NT. 628Microsoft windows NT. The same executable supports Windows 9X, but the
629value of @code{system-type} is @code{windows-nt} in either case.
620 630
621@item xenix 631@item xenix
622SCO Xenix 386. 632SCO Xenix 386.
@@ -710,7 +720,7 @@ process-environment
710This variable holds a string which says which character separates 720This variable holds a string which says which character separates
711directories in a search path (as found in an environment variable). Its 721directories in a search path (as found in an environment variable). Its
712value is @code{":"} for Unix and GNU systems, and @code{";"} for MS-DOS 722value is @code{":"} for Unix and GNU systems, and @code{";"} for MS-DOS
713and Windows NT. 723and MS-Windows.
714@end defvar 724@end defvar
715 725
716@defvar invocation-name 726@defvar invocation-name
@@ -770,10 +780,11 @@ in the system's terminal driver, before Emacs was started.
770 780
771@defun setprv privilege-name &optional setp getprv 781@defun setprv privilege-name &optional setp getprv
772This function sets or resets a VMS privilege. (It does not exist on 782This function sets or resets a VMS privilege. (It does not exist on
773Unix.) The first arg is the privilege name, as a string. The second 783other systems.) The first argument is the privilege name, as a string.
774argument, @var{setp}, is @code{t} or @code{nil}, indicating whether the 784The second argument, @var{setp}, is @code{t} or @code{nil}, indicating
775privilege is to be turned on or off. Its default is @code{nil}. The 785whether the privilege is to be turned on or off. Its default is
776function returns @code{t} if successful, @code{nil} otherwise. 786@code{nil}. The function returns @code{t} if successful, @code{nil}
787otherwise.
777 788
778 If the third argument, @var{getprv}, is non-@code{nil}, @code{setprv} 789 If the third argument, @var{getprv}, is non-@code{nil}, @code{setprv}
779does not change the privilege, but returns @code{t} or @code{nil} 790does not change the privilege, but returns @code{t} or @code{nil}
@@ -785,7 +796,7 @@ indicating whether the privilege is currently enabled.
785 796
786@defvar init-file-user 797@defvar init-file-user
787This variable says which user's init files should be used by Emacs---or 798This variable says which user's init files should be used by Emacs---or
788@code{nil} if none. The value reflects command line options such as 799@code{nil} if none. The value reflects command-line options such as
789@samp{-q} or @samp{-u @var{user}}. 800@samp{-q} or @samp{-u @var{user}}.
790 801
791Lisp packages that load files of customizations, or any other sort of 802Lisp packages that load files of customizations, or any other sort of
@@ -830,8 +841,9 @@ environment variables @code{LOGNAME} and @code{USER}.
830 841
831@defun user-full-name &optional uid 842@defun user-full-name &optional uid
832This function returns the full name of the logged-in user---or the value 843This function returns the full name of the logged-in user---or the value
833of the environment variables @code{NAME}, if that is set. 844of the environment variable @code{NAME}, if that is set.
834 845
846@c "Bil" is the correct spelling.
835@example 847@example
836@group 848@group
837(user-full-name) 849(user-full-name)
@@ -907,7 +919,7 @@ two elements are integers. Thus, you can use times obtained from
907This function returns the system's time value as a list of three 919This function returns the system's time value as a list of three
908integers: @code{(@var{high} @var{low} @var{microsec})}. The integers 920integers: @code{(@var{high} @var{low} @var{microsec})}. The integers
909@var{high} and @var{low} combine to give the number of seconds since 921@var{high} and @var{low} combine to give the number of seconds since
9100:00 January 1, 1970, which is 9220:00 January 1, 1970 (local time), which is
911@ifinfo 923@ifinfo
912@var{high} * 2**16 + @var{low}. 924@var{high} * 2**16 + @var{low}.
913@end ifinfo 925@end ifinfo
@@ -916,8 +928,8 @@ $high*2^{16}+low$.
916@end tex 928@end tex
917 929
918The third element, @var{microsec}, gives the microseconds since the 930The third element, @var{microsec}, gives the microseconds since the
919start of the current second (or 0 for systems that return time only on 931start of the current second (or 0 for systems that return time with
920the resolution of a second). 932the resolution of only one second).
921 933
922The first two elements can be compared with file time values such as you 934The first two elements can be compared with file time values such as you
923get with the function @code{file-attributes}. @xref{File Attributes}. 935get with the function @code{file-attributes}. @xref{File Attributes}.
@@ -931,7 +943,7 @@ in.
931The value has the form @code{(@var{offset} @var{name})}. Here 943The value has the form @code{(@var{offset} @var{name})}. Here
932@var{offset} is an integer giving the number of seconds ahead of UTC 944@var{offset} is an integer giving the number of seconds ahead of UTC
933(east of Greenwich). A negative value means west of Greenwich. The 945(east of Greenwich). A negative value means west of Greenwich. The
934second element, @var{name} is a string giving the name of the time 946second element, @var{name}, is a string giving the name of the time
935zone. Both elements change when daylight savings time begins or ends; 947zone. Both elements change when daylight savings time begins or ends;
936if the user has specified a time zone that does not use a seasonal time 948if the user has specified a time zone that does not use a seasonal time
937adjustment, then the value is constant through time. 949adjustment, then the value is constant through time.
@@ -998,7 +1010,7 @@ This is a synonym for @samp{%b}.
998@item %H 1010@item %H
999This stands for the hour (00-23). 1011This stands for the hour (00-23).
1000@item %I 1012@item %I
1001This stands for the hour (00-12). 1013This stands for the hour (01-12).
1002@item %j 1014@item %j
1003This stands for the day of the year (001-366). 1015This stands for the day of the year (001-366).
1004@item %k 1016@item %k
@@ -1018,7 +1030,7 @@ This is a synonym for @samp{%I:%M:%S %p}.
1018@item %R 1030@item %R
1019This is a synonym for @samp{%H:%M}. 1031This is a synonym for @samp{%H:%M}.
1020@item %S 1032@item %S
1021This stands for the seconds (00-60). 1033This stands for the seconds (00-59).
1022@item %t 1034@item %t
1023This stands for a tab character. 1035This stands for a tab character.
1024@item %T 1036@item %T
@@ -1068,9 +1080,9 @@ return value is a list of nine elements, as follows:
1068Here is what the elements mean: 1080Here is what the elements mean:
1069 1081
1070@table @var 1082@table @var
1071@item sec 1083@item seconds
1072The number of seconds past the minute, as an integer between 0 and 59. 1084The number of seconds past the minute, as an integer between 0 and 59.
1073@item minute 1085@item minutes
1074The number of minutes past the hour, as an integer between 0 and 59. 1086The number of minutes past the hour, as an integer between 0 and 59.
1075@item hour 1087@item hour
1076The hour of the day, as an integer between 0 and 23. 1088The hour of the day, as an integer between 0 and 23.
@@ -1099,9 +1111,9 @@ This function is the inverse of @code{decode-time}. It converts seven
1099items of calendrical data into a time value. For the meanings of the 1111items of calendrical data into a time value. For the meanings of the
1100arguments, see the table above under @code{decode-time}. 1112arguments, see the table above under @code{decode-time}.
1101 1113
1102Year numbers less than 100 are treated just like other year numbers. If 1114Year numbers less than 100 are not treated specially. If you want them
1103you want them to stand for years above 1900, you must alter them yourself 1115to stand for years above 1900, you must alter them yourself before you
1104before you call @code{encode-time}. 1116call @code{encode-time}.
1105 1117
1106The optional argument @var{zone} defaults to the current time zone and 1118The optional argument @var{zone} defaults to the current time zone and
1107its daylight savings time rules. If specified, it can be either a list 1119its daylight savings time rules. If specified, it can be either a list
@@ -1121,7 +1133,7 @@ feature makes it possible to use the elements of a list returned by
1121@end example 1133@end example
1122 1134
1123You can perform simple date arithmetic by using out-of-range values for 1135You can perform simple date arithmetic by using out-of-range values for
1124the @var{sec}, @var{minute}, @var{hour}, @var{day}, and @var{month} 1136the @var{seconds}, @var{minutes}, @var{hour}, @var{day}, and @var{month}
1125arguments; for example, day 0 means the day preceding the given month. 1137arguments; for example, day 0 means the day preceding the given month.
1126 1138
1127The operating system puts limits on the range of possible time values; 1139The operating system puts limits on the range of possible time values;
@@ -1175,6 +1187,9 @@ denotes 65 seconds from now.
1175denotes exactly 103 months, 123 days, and 10862 seconds from now. 1187denotes exactly 103 months, 123 days, and 10862 seconds from now.
1176@end table 1188@end table
1177 1189
1190For relative time values, Emacs considers a month to be exactly thirty
1191days, and a year to be exactly 365.25 days.
1192
1178If @var{time} is a number (integer or floating point), that specifies a 1193If @var{time} is a number (integer or floating point), that specifies a
1179relative time measured in seconds. 1194relative time measured in seconds.
1180 1195
@@ -1236,10 +1251,10 @@ can use in calling @code{cancel-timer} (see below).
1236 Emacs becomes ``idle'' when it starts waiting for user input, and it 1251 Emacs becomes ``idle'' when it starts waiting for user input, and it
1237remains idle until the user provides some input. If a timer is set for 1252remains idle until the user provides some input. If a timer is set for
1238five seconds of idleness, it runs approximately five seconds after Emacs 1253five seconds of idleness, it runs approximately five seconds after Emacs
1239first became idle. Even if its @var{repeat} is true, this timer will 1254first becomes idle. Even if @var{repeat} is non-@code{nil}, this timer
1240not run again as long as Emacs remains idle, because the duration of 1255will not run again as long as Emacs remains idle, because the duration
1241idleness will continue to increase and will not go down to five seconds 1256of idleness will continue to increase and will not go down to five
1242again. 1257seconds again.
1243 1258
1244 Emacs can do various things while idle: garbage collect, autosave or 1259 Emacs can do various things while idle: garbage collect, autosave or
1245handle data from a subprocess. But these interludes during idleness do 1260handle data from a subprocess. But these interludes during idleness do
@@ -1247,7 +1262,7 @@ not interfere with idle timers, because they do not reset the clock of
1247idleness to zero. An idle timer set for 600 seconds will run when ten 1262idleness to zero. An idle timer set for 600 seconds will run when ten
1248minutes have elapsed since the last user command was finished, even if 1263minutes have elapsed since the last user command was finished, even if
1249subprocess output has been accepted thousands of times within those ten 1264subprocess output has been accepted thousands of times within those ten
1250minutes, even if there have been garbage collections and autosaves. 1265minutes, and even if there have been garbage collections and autosaves.
1251 1266
1252 When the user supplies input, Emacs becomes non-idle while executing the 1267 When the user supplies input, Emacs becomes non-idle while executing the
1253input. Then it becomes idle again, and all the idle timers that are 1268input. Then it becomes idle again, and all the idle timers that are
@@ -1284,7 +1299,7 @@ functions.
1284This function sets the mode for reading keyboard input. If 1299This function sets the mode for reading keyboard input. If
1285@var{interrupt} is non-null, then Emacs uses input interrupts. If it is 1300@var{interrupt} is non-null, then Emacs uses input interrupts. If it is
1286@code{nil}, then it uses @sc{cbreak} mode. The default setting is 1301@code{nil}, then it uses @sc{cbreak} mode. The default setting is
1287system dependent. Some systems always use @sc{cbreak} mode regardless 1302system-dependent. Some systems always use @sc{cbreak} mode regardless
1288of what is specified. 1303of what is specified.
1289 1304
1290When Emacs communicates directly with X, it ignores this argument and 1305When Emacs communicates directly with X, it ignores this argument and
@@ -1314,7 +1329,7 @@ Emacs is currently using.
1314 1329
1315@c Emacs 19 feature 1330@c Emacs 19 feature
1316@defun current-input-mode 1331@defun current-input-mode
1317This function returns current mode for reading keyboard input. It 1332This function returns the current mode for reading keyboard input. It
1318returns a list, corresponding to the arguments of @code{set-input-mode}, 1333returns a list, corresponding to the arguments of @code{set-input-mode},
1319of the form @code{(@var{interrupt} @var{flow} @var{meta} @var{quit})} in 1334of the form @code{(@var{interrupt} @var{flow} @var{meta} @var{quit})} in
1320which: 1335which:
@@ -1379,10 +1394,10 @@ This variable is the translate table for keyboard characters. It lets
1379you reshuffle the keys on the keyboard without changing any command 1394you reshuffle the keys on the keyboard without changing any command
1380bindings. Its value is normally a char-table, or else @code{nil}. 1395bindings. Its value is normally a char-table, or else @code{nil}.
1381 1396
1382If @code{keyboard-translate-table} is a char-table, then each character 1397If @code{keyboard-translate-table} is a char-table
1383read from the keyboard is looked up in this character. If the value 1398(@pxref{Char-Tables}), then each character read from the keyboard is
1384found there is non-@code{nil}, then it is used instead of the 1399looked up in this char-table. If the value found there is
1385actual input character. 1400non-@code{nil}, then it is used instead of the actual input character.
1386 1401
1387In the example below, we set @code{keyboard-translate-table} to a 1402In the example below, we set @code{keyboard-translate-table} to a
1388char-table. Then we fill it in to swap the characters @kbd{C-s} and 1403char-table. Then we fill it in to swap the characters @kbd{C-s} and
@@ -1573,7 +1588,7 @@ trigger an Emacs bug, for the sake of a bug report.
1573@section Terminal Output 1588@section Terminal Output
1574@cindex terminal output 1589@cindex terminal output
1575 1590
1576 The terminal output functions send output to the terminal or keep 1591 The terminal output functions send output to the terminal, or keep
1577track of output sent to the terminal. The variable @code{baud-rate} 1592track of output sent to the terminal. The variable @code{baud-rate}
1578tells you what Emacs thinks is the output speed of the terminal. 1593tells you what Emacs thinks is the output speed of the terminal.
1579 1594
@@ -1607,8 +1622,8 @@ This function sends @var{string} to the terminal without alteration.
1607Control characters in @var{string} have terminal-dependent effects. 1622Control characters in @var{string} have terminal-dependent effects.
1608 1623
1609One use of this function is to define function keys on terminals that 1624One use of this function is to define function keys on terminals that
1610have downloadable function key definitions. For example, this is how on 1625have downloadable function key definitions. For example, this is how (on
1611certain terminals to define function key 4 to move forward four 1626certain terminals) to define function key 4 to move forward four
1612characters (by transmitting the characters @kbd{C-u C-f} to the 1627characters (by transmitting the characters @kbd{C-u C-f} to the
1613computer): 1628computer):
1614 1629
@@ -1641,6 +1656,51 @@ See also @code{open-dribble-file} in @ref{Terminal Input}.
1641@end example 1656@end example
1642@end deffn 1657@end deffn
1643 1658
1659@node Sound Output
1660@section Sound Output
1661@cindex sound
1662
1663 To play sound using Emacs, use the function @code{play-sound}. Only
1664certain systems are supported; if you call @code{play-sound} on a system
1665which cannot really do the job, it gives an error. Emacs version 20 and
1666earlier did not support sound at all.
1667
1668 The sound must be stored as a file in RIFF-WAVE format (@samp{.wav})
1669or Sun Audio format (@samp{.au}).
1670
1671@tindex play-sound
1672@defun play-sound sound
1673This function plays a specified sound. The argument, @var{sound}, has
1674the form @code{(sound @var{properties}...)}, where the @var{properties}
1675consist of alternating keywords (particular symbols recognized
1676specially) and values corresponding to them.
1677
1678Here is a table of the keywords that are currently meaningful in
1679@var{sound}, and their meanings:
1680
1681@table @code
1682@item :file @var{file}
1683This specifies the file containing the sound to play.
1684If the file name is not absolute, it is expanded against
1685the directory @code{data-directory}.
1686
1687@item :volume @var{volume}
1688This specifies how loud to play the sound. It should be a number in the
1689range of 0 to 1. The default is to use whatever volume has been
1690specified before.
1691@end table
1692
1693Before actually playing the sound, @code{play-sound}
1694calls the functions in the list @code{play-sound-functions}.
1695Each function is called with one argument, @var{sound}.
1696@end defun
1697
1698@tindex play-sound-functions
1699@defvar play-sound-functions
1700A list of functions to be called before playing a sound. Each function
1701is called with one argument, a property list that describes the sound.
1702@end defvar
1703
1644@node Special Keysyms 1704@node Special Keysyms
1645@section System-Specific X11 Keysyms 1705@section System-Specific X11 Keysyms
1646 1706
@@ -1649,7 +1709,7 @@ To define system-specific X11 keysyms, set the variable
1649 1709
1650@defvar system-key-alist 1710@defvar system-key-alist
1651This variable's value should be an alist with one element for each 1711This variable's value should be an alist with one element for each
1652system-specific keysym. An element has this form: @code{(@var{code} 1712system-specific keysym. Each element has the form @code{(@var{code}
1653. @var{symbol})}, where @var{code} is the numeric keysym code (not 1713. @var{symbol})}, where @var{code} is the numeric keysym code (not
1654including the ``vendor specific'' bit, 1714including the ``vendor specific'' bit,
1655@ifinfo 1715@ifinfo
@@ -1660,8 +1720,8 @@ $-2^{28}$),
1660@end tex 1720@end tex
1661and @var{symbol} is the name for the function key. 1721and @var{symbol} is the name for the function key.
1662 1722
1663For example @code{(168 . mute-acute)} defines a system-specific key used 1723For example @code{(168 . mute-acute)} defines a system-specific key (used
1664by HP X servers whose numeric code is 1724by HP X servers) whose numeric code is
1665@ifinfo 1725@ifinfo
1666-2**28 1726-2**28
1667@end ifinfo 1727@end ifinfo
@@ -1694,7 +1754,7 @@ entries and DEC terminal concentrators, see @file{emacs/etc/TERMS}.
1694@code{C-s} and @kbd{C-q} for flow control. Therefore, the choice of 1754@code{C-s} and @kbd{C-q} for flow control. Therefore, the choice of
1695@kbd{C-s} and @kbd{C-q} as command characters for searching and quoting 1755@kbd{C-s} and @kbd{C-q} as command characters for searching and quoting
1696was natural and uncontroversial. With so many commands needing key 1756was natural and uncontroversial. With so many commands needing key
1697assignments, of course we assigned meanings to nearly all @sc{ASCII} 1757assignments, of course we assigned meanings to nearly all @sc{ascii}
1698control characters. 1758control characters.
1699 1759
1700 Later, some terminals were introduced which required these characters 1760 Later, some terminals were introduced which required these characters
@@ -1769,7 +1829,7 @@ speed when calculating the padding needed. @xref{Terminal Output}.
1769@cindex batch mode 1829@cindex batch mode
1770@cindex noninteractive use 1830@cindex noninteractive use
1771 1831
1772 The command line option @samp{-batch} causes Emacs to run 1832 The command-line option @samp{-batch} causes Emacs to run
1773noninteractively. In this mode, Emacs does not read commands from the 1833noninteractively. In this mode, Emacs does not read commands from the
1774terminal, it does not alter the terminal modes, and it does not expect 1834terminal, it does not alter the terminal modes, and it does not expect
1775to be outputting to an erasable screen. The idea is that you specify 1835to be outputting to an erasable screen. The idea is that you specify
@@ -1779,7 +1839,7 @@ loads the library named @var{file}, and @samp{-f @var{function}}, which
1779calls @var{function} with no arguments. 1839calls @var{function} with no arguments.
1780 1840
1781 Any Lisp program output that would normally go to the echo area, 1841 Any Lisp program output that would normally go to the echo area,
1782either using @code{message} or using @code{prin1}, etc., with @code{t} 1842either using @code{message}, or using @code{prin1}, etc., with @code{t}
1783as the stream, goes instead to Emacs's standard error descriptor when 1843as the stream, goes instead to Emacs's standard error descriptor when
1784in batch mode. Thus, Emacs behaves much like a noninteractive 1844in batch mode. Thus, Emacs behaves much like a noninteractive
1785application program. (The echo area output that Emacs itself normally 1845application program. (The echo area output that Emacs itself normally
diff --git a/lispref/positions.texi b/lispref/positions.texi
index 43be1bad65e..49c42bc1d3c 100644
--- a/lispref/positions.texi
+++ b/lispref/positions.texi
@@ -42,10 +42,10 @@ the character that immediately follows point; point is actually before
42the character on which the cursor sits. 42the character on which the cursor sits.
43 43
44@cindex point with narrowing 44@cindex point with narrowing
45 The value of point is a number between 1 and the buffer size plus 1. 45 The value of point is a number no less than 1, and no greater than the
46If narrowing is in effect (@pxref{Narrowing}), then point is constrained 46buffer size plus 1. If narrowing is in effect (@pxref{Narrowing}), then
47to fall within the accessible portion of the buffer (possibly at one end 47point is constrained to fall within the accessible portion of the buffer
48of it). 48(possibly at one end of it).
49 49
50 Each buffer has its own value of point, which is independent of the 50 Each buffer has its own value of point, which is independent of the
51value of point in other buffers. Each window also has a value of point, 51value of point in other buffers. Each window also has a value of point,
@@ -81,7 +81,7 @@ is the position of the start of the region that you narrowed to.
81This function returns the maximum accessible value of point in the 81This function returns the maximum accessible value of point in the
82current buffer. This is @code{(1+ (buffer-size))}, unless narrowing is 82current buffer. This is @code{(1+ (buffer-size))}, unless narrowing is
83in effect, in which case it is the position of the end of the region 83in effect, in which case it is the position of the end of the region
84that you narrowed to. (@pxref{Narrowing}). 84that you narrowed to. (@xref{Narrowing}.)
85@end defun 85@end defun
86 86
87@defun buffer-end flag 87@defun buffer-end flag
@@ -89,11 +89,14 @@ This function returns @code{(point-min)} if @var{flag} is less than 1,
89@code{(point-max)} otherwise. The argument @var{flag} must be a number. 89@code{(point-max)} otherwise. The argument @var{flag} must be a number.
90@end defun 90@end defun
91 91
92@defun buffer-size 92@defun buffer-size &optional buffer
93This function returns the total number of characters in the current 93This function returns the total number of characters in the current
94buffer. In the absence of any narrowing (@pxref{Narrowing}), 94buffer. In the absence of any narrowing (@pxref{Narrowing}),
95@code{point-max} returns a value one larger than this. 95@code{point-max} returns a value one larger than this.
96 96
97If you specify a buffer, @var{buffer}, then the value is the
98size of @var{buffer}.
99
97@example 100@example
98@group 101@group
99(buffer-size) 102(buffer-size)
@@ -190,6 +193,9 @@ the buffer boundary (except perhaps after the last word), the value is
190@code{t}. Otherwise, the return value is @code{nil} and point stops 193@code{t}. Otherwise, the return value is @code{nil} and point stops
191at the buffer boundary. 194at the buffer boundary.
192 195
196In the minibuffer, the end of the prompt always acts as a word boundary,
197regardless of what characters appear before and after it.
198
193In an interactive call, @var{count} is set to the numeric prefix 199In an interactive call, @var{count} is set to the numeric prefix
194argument. 200argument.
195@end deffn 201@end deffn
@@ -241,7 +247,8 @@ they set the mark and display messages in the echo area.
241This function moves point to the beginning of the buffer (or the limits 247This function moves point to the beginning of the buffer (or the limits
242of the accessible portion, when narrowing is in effect), setting the 248of the accessible portion, when narrowing is in effect), setting the
243mark at the previous position. If @var{n} is non-@code{nil}, then it 249mark at the previous position. If @var{n} is non-@code{nil}, then it
244puts point @var{n} tenths of the way from the beginning of the buffer. 250puts point @var{n} tenths of the way from the beginning of the
251accessible portion of the buffer.
245 252
246In an interactive call, @var{n} is the numeric prefix argument, 253In an interactive call, @var{n} is the numeric prefix argument,
247if provided; otherwise @var{n} defaults to @code{nil}. 254if provided; otherwise @var{n} defaults to @code{nil}.
@@ -250,10 +257,11 @@ if provided; otherwise @var{n} defaults to @code{nil}.
250@end deffn 257@end deffn
251 258
252@deffn Command end-of-buffer &optional n 259@deffn Command end-of-buffer &optional n
253This function moves point to the end of the buffer (or the limits of 260This function moves point to the end of the buffer (or the limits of the
254the accessible portion, when narrowing is in effect), setting the mark 261accessible portion, when narrowing is in effect), setting the mark at
255at the previous position. If @var{n} is non-@code{nil}, then it puts 262the previous position. If @var{n} is non-@code{nil}, then it puts point
256point @var{n} tenths of the way from the end of the buffer. 263@var{n} tenths of the way from the end of the accessible portion of the
264buffer.
257 265
258In an interactive call, @var{n} is the numeric prefix argument, 266In an interactive call, @var{n} is the numeric prefix argument,
259if provided; otherwise @var{n} defaults to @code{nil}. 267if provided; otherwise @var{n} defaults to @code{nil}.
@@ -308,6 +316,9 @@ argument @var{count} not @code{nil} or 1, it moves forward
308If this function reaches the end of the buffer (or of the accessible 316If this function reaches the end of the buffer (or of the accessible
309portion, if narrowing is in effect), it positions point there. No error 317portion, if narrowing is in effect), it positions point there. No error
310is signaled. 318is signaled.
319
320As a special feature, in the minibuffer, this command will not
321move back into the prompt, if it starts from after the prompt.
311@end deffn 322@end deffn
312 323
313@defun line-beginning-position &optional count 324@defun line-beginning-position &optional count
@@ -584,7 +595,7 @@ expressions (also called @dfn{sexps} in connection with moving across
584them in Emacs). The syntax table controls how these functions interpret 595them in Emacs). The syntax table controls how these functions interpret
585various characters; see @ref{Syntax Tables}. @xref{Parsing 596various characters; see @ref{Syntax Tables}. @xref{Parsing
586Expressions}, for lower-level primitives for scanning sexps or parts of 597Expressions}, for lower-level primitives for scanning sexps or parts of
587sexps. For user-level commands, see @ref{Lists Commands,,, emacs, GNU 598sexps. For user-level commands, see @ref{Lists Commands,,, emacs, The GNU
588Emacs Manual}. 599Emacs Manual}.
589 600
590@deffn Command forward-list arg 601@deffn Command forward-list arg
@@ -725,9 +736,9 @@ is zero or less.
725 It is often useful to move point ``temporarily'' within a localized 736 It is often useful to move point ``temporarily'' within a localized
726portion of the program, or to switch buffers temporarily. This is 737portion of the program, or to switch buffers temporarily. This is
727called an @dfn{excursion}, and it is done with the @code{save-excursion} 738called an @dfn{excursion}, and it is done with the @code{save-excursion}
728special form. This construct saves the current buffer and its values of 739special form. This construct initially remembers the identity of the
729point and the mark so they can be restored after the completion of the 740current buffer, and its values of point and the mark, and restores them
730excursion. 741after the completion of the excursion.
731 742
732 The forms for saving and restoring the configuration of windows are 743 The forms for saving and restoring the configuration of windows are
733described elsewhere (see @ref{Window Configurations}, and @pxref{Frame 744described elsewhere (see @ref{Window Configurations}, and @pxref{Frame
diff --git a/lispref/processes.texi b/lispref/processes.texi
index 908ed240bc5..16aa65a3ffd 100644
--- a/lispref/processes.texi
+++ b/lispref/processes.texi
@@ -58,7 +58,7 @@ The other two, @code{call-process} and @code{call-process-region},
58create a synchronous process and do not return a process object 58create a synchronous process and do not return a process object
59(@pxref{Synchronous Processes}). 59(@pxref{Synchronous Processes}).
60 60
61 Synchronous and asynchronous processes are explained in following 61 Synchronous and asynchronous processes are explained in the following
62sections. Since the three functions are all called in a similar 62sections. Since the three functions are all called in a similar
63fashion, their common arguments are described here. 63fashion, their common arguments are described here.
64 64
@@ -108,7 +108,7 @@ Environment}.
108 108
109@defvar exec-directory 109@defvar exec-directory
110@pindex movemail 110@pindex movemail
111The value of this variable is the name of a directory (a string) that 111The value of this variable is a string, the name of a directory that
112contains programs that come with GNU Emacs, programs intended for Emacs 112contains programs that come with GNU Emacs, programs intended for Emacs
113to invoke. The program @code{movemail} is an example of such a program; 113to invoke. The program @code{movemail} is an example of such a program;
114Rmail uses it to fetch new mail from an inbox. 114Rmail uses it to fetch new mail from an inbox.
@@ -130,7 +130,7 @@ file name.
130@section Shell Arguments 130@section Shell Arguments
131 131
132 Lisp programs sometimes need to run a shell and give it a command 132 Lisp programs sometimes need to run a shell and give it a command
133which contains file names that were specified by the user. These 133that contains file names that were specified by the user. These
134programs ought to be able to support any valid file name. But the shell 134programs ought to be able to support any valid file name. But the shell
135gives special treatment to certain characters, and if these characters 135gives special treatment to certain characters, and if these characters
136occur in the file name, they will confuse the shell. To handle these 136occur in the file name, they will confuse the shell. To handle these
@@ -143,16 +143,18 @@ work reliably to concatenate the return value into a shell command
143and then pass it to a shell for execution. 143and then pass it to a shell for execution.
144 144
145Precisely what this function does depends on your operating system. The 145Precisely what this function does depends on your operating system. The
146function is designed to work with the usual shell syntax; if you use an 146function is designed to work with the syntax of your system's standard
147unusual shell, you will need to redefine this function. On MS-DOS, the 147shell; if you use an unusual shell, you will need to redefine this
148function returns @var{argument} unchanged; while this is not really 148function.
149correct, it is the best one can do, since the MS-DOS shell has no
150quoting features.
151 149
152@example 150@example
153;; @r{This example shows the behavior on GNU and Unix systems.} 151;; @r{This example shows the behavior on GNU and Unix systems.}
154(shell-quote-argument "foo > bar") 152(shell-quote-argument "foo > bar")
155 @result{} "foo\\ \\>\\ bar" 153 @result{} "foo\\ \\>\\ bar"
154
155;; @r{This example shows the behavior on MS-DOS and MS-Windows systems.}
156(shell-quote-argument "foo > bar")
157 @result{} "\"foo > bar\""
156@end example 158@end example
157 159
158Here's an example of using @code{shell-quote-argument} to construct 160Here's an example of using @code{shell-quote-argument} to construct
@@ -171,18 +173,20 @@ a shell command:
171@cindex synchronous subprocess 173@cindex synchronous subprocess
172 174
173 After a @dfn{synchronous process} is created, Emacs waits for the 175 After a @dfn{synchronous process} is created, Emacs waits for the
174process to terminate before continuing. Starting Dired is an example of 176process to terminate before continuing. Starting Dired on GNU or
175this: it runs @code{ls} in a synchronous process, then modifies the 177Unix@footnote{On other systems, Emacs uses a Lisp emulation of
176output slightly. Because the process is synchronous, the entire 178@code{ls}; see @ref{Contents of Directories}.} is an example of this: it
177directory listing arrives in the buffer before Emacs tries to do 179runs @code{ls} in a synchronous process, then modifies the output
178anything with it. 180slightly. Because the process is synchronous, the entire directory
181listing arrives in the buffer before Emacs tries to do anything with it.
179 182
180 While Emacs waits for the synchronous subprocess to terminate, the 183 While Emacs waits for the synchronous subprocess to terminate, the
181user can quit by typing @kbd{C-g}. The first @kbd{C-g} tries to kill 184user can quit by typing @kbd{C-g}. The first @kbd{C-g} tries to kill
182the subprocess with a @code{SIGINT} signal; but it waits until the 185the subprocess with a @code{SIGINT} signal; but it waits until the
183subprocess actually terminates before quitting. If during that time the 186subprocess actually terminates before quitting. If during that time the
184user types another @kbd{C-g}, that kills the subprocess instantly with 187user types another @kbd{C-g}, that kills the subprocess instantly with
185@code{SIGKILL} and quits immediately. @xref{Quitting}. 188@code{SIGKILL} and quits immediately (except on MS-DOS, where killing
189other processes doesn't work). @xref{Quitting}.
186 190
187 The synchronous subprocess functions return an indication of how the 191 The synchronous subprocess functions return an indication of how the
188process terminated. 192process terminated.
@@ -197,7 +201,7 @@ This function calls @var{program} in a separate process and waits for
197it to finish. 201it to finish.
198 202
199The standard input for the process comes from file @var{infile} if 203The standard input for the process comes from file @var{infile} if
200@var{infile} is not @code{nil}, and from @file{/dev/null} otherwise. 204@var{infile} is not @code{nil}, and from the null device otherwise.
201The argument @var{destination} says where to put the process output. 205The argument @var{destination} says where to put the process output.
202Here are the possibilities: 206Here are the possibilities:
203 207
@@ -216,7 +220,7 @@ Insert the output in the current buffer, before point.
216Discard the output. 220Discard the output.
217 221
218@item 0 222@item 0
219Discard the output, and return immediately without waiting 223Discard the output, and return @code{nil} immediately without waiting
220for the subprocess to finish. 224for the subprocess to finish.
221 225
222In this case, the process is not truly synchronous, since it can run in 226In this case, the process is not truly synchronous, since it can run in
@@ -224,6 +228,9 @@ parallel with Emacs; but you can think of it as synchronous in that
224Emacs is essentially finished with the subprocess as soon as this 228Emacs is essentially finished with the subprocess as soon as this
225function returns. 229function returns.
226 230
231MS-DOS doesn't support asynchronous subprocesses, so this option doesn't
232work there.
233
227@item @code{(@var{real-destination} @var{error-destination})} 234@item @code{(@var{real-destination} @var{error-destination})}
228Keep the standard output stream separate from the standard error stream; 235Keep the standard output stream separate from the standard error stream;
229deal with the ordinary output as specified by @var{real-destination}, 236deal with the ordinary output as specified by @var{real-destination},
@@ -242,11 +249,12 @@ If @var{display} is non-@code{nil}, then @code{call-process} redisplays
242the buffer as output is inserted. (However, if the coding system chosen 249the buffer as output is inserted. (However, if the coding system chosen
243for decoding output is @code{undecided}, meaning deduce the encoding 250for decoding output is @code{undecided}, meaning deduce the encoding
244from the actual data, then redisplay sometimes cannot continue once 251from the actual data, then redisplay sometimes cannot continue once
245non-@sc{ASCII} characters are encountered. There are fundamental 252non-@sc{ascii} characters are encountered. There are fundamental
246reasons why it is hard to fix this.) Otherwise the function 253reasons why it is hard to fix this; see @ref{Output from Processes}.)
247@code{call-process} does no redisplay, and the results become visible on 254
248the screen only when Emacs redisplays that buffer in the normal course 255Otherwise the function @code{call-process} does no redisplay, and the
249of events. 256results become visible on the screen only when Emacs redisplays that
257buffer in the normal course of events.
250 258
251The remaining arguments, @var{args}, are strings that specify command 259The remaining arguments, @var{args}, are strings that specify command
252line arguments for the program. 260line arguments for the program.
@@ -262,7 +270,7 @@ In the examples below, the buffer @samp{foo} is current.
262@smallexample 270@smallexample
263@group 271@group
264(call-process "pwd" nil t) 272(call-process "pwd" nil t)
265 @result{} nil 273 @result{} 0
266 274
267---------- Buffer: foo ---------- 275---------- Buffer: foo ----------
268/usr/user/lewis/manual 276/usr/user/lewis/manual
@@ -271,7 +279,7 @@ In the examples below, the buffer @samp{foo} is current.
271 279
272@group 280@group
273(call-process "grep" nil "bar" nil "lewis" "/etc/passwd") 281(call-process "grep" nil "bar" nil "lewis" "/etc/passwd")
274 @result{} nil 282 @result{} 0
275 283
276---------- Buffer: bar ---------- 284---------- Buffer: bar ----------
277lewis:5LTsHm66CSWKg:398:21:Bil Lewis:/user/lewis:/bin/csh 285lewis:5LTsHm66CSWKg:398:21:Bil Lewis:/user/lewis:/bin/csh
@@ -294,7 +302,7 @@ be found in the definition of @code{insert-directory}:
294@end defun 302@end defun
295 303
296@defun call-process-region start end program &optional delete destination display &rest args 304@defun call-process-region start end program &optional delete destination display &rest args
297This function sends the text between @var{start} to @var{end} as 305This function sends the text from @var{start} to @var{end} as
298standard input to a process running @var{program}. It deletes the text 306standard input to a process running @var{program}. It deletes the text
299sent if @var{delete} is non-@code{nil}; this is useful when 307sent if @var{delete} is non-@code{nil}; this is useful when
300@var{destination} is @code{t}, to insert the output in the current 308@var{destination} is @code{t}, to insert the output in the current
@@ -305,7 +313,8 @@ with the output from the subprocess, and whether to update the display
305as it comes in. For details, see the description of 313as it comes in. For details, see the description of
306@code{call-process}, above. If @var{destination} is the integer 0, 314@code{call-process}, above. If @var{destination} is the integer 0,
307@code{call-process-region} discards the output and returns @code{nil} 315@code{call-process-region} discards the output and returns @code{nil}
308immediately, without waiting for the subprocess to finish. 316immediately, without waiting for the subprocess to finish (this only
317works if asynchronous subprocess are supported).
309 318
310The remaining arguments, @var{args}, are strings that specify command 319The remaining arguments, @var{args}, are strings that specify command
311line arguments for the program. 320line arguments for the program.
@@ -331,7 +340,7 @@ input@point{}
331 340
332@group 341@group
333(call-process-region 1 6 "cat" nil t) 342(call-process-region 1 6 "cat" nil t)
334 @result{} nil 343 @result{} 0
335 344
336---------- Buffer: foo ---------- 345---------- Buffer: foo ----------
337inputinput@point{} 346inputinput@point{}
@@ -368,7 +377,7 @@ then returns the command's output as a string.
368 After an @dfn{asynchronous process} is created, Emacs and the subprocess 377 After an @dfn{asynchronous process} is created, Emacs and the subprocess
369both continue running immediately. The process thereafter runs 378both continue running immediately. The process thereafter runs
370in parallel with Emacs, and the two can communicate with each other 379in parallel with Emacs, and the two can communicate with each other
371using the functions described in following sections. However, 380using the functions described in the following sections. However,
372communication is only partially asynchronous: Emacs sends data to the 381communication is only partially asynchronous: Emacs sends data to the
373process only when certain functions are called, and Emacs accepts data 382process only when certain functions are called, and Emacs accepts data
374from the process only when Emacs is waiting for input or for a time 383from the process only when Emacs is waiting for input or for a time
@@ -429,10 +438,10 @@ use.
429The point of running a program through the shell, rather than directly 438The point of running a program through the shell, rather than directly
430with @code{start-process}, is so that you can employ shell features such 439with @code{start-process}, is so that you can employ shell features such
431as wildcards in the arguments. It follows that if you include an 440as wildcards in the arguments. It follows that if you include an
432arbitrary user-specified filename in the command, you should quote it 441arbitrary user-specified arguments in the command, you should quote it
433with @code{shell-quote-argument} first, so that any special shell 442with @code{shell-quote-argument} first, so that any special shell
434characters in the file name do @emph{not} have their special shell 443characters do @emph{not} have their special shell meanings. @xref{Shell
435meanings. @xref{Shell Arguments}. 444Arguments}.
436@end defun 445@end defun
437 446
438@defvar process-connection-type 447@defvar process-connection-type
@@ -450,7 +459,7 @@ often better to use a pipe, because they are more efficient. In
450addition, the total number of @sc{pty}s is limited on many systems and 459addition, the total number of @sc{pty}s is limited on many systems and
451it is good not to waste them. 460it is good not to waste them.
452 461
453The value @code{process-connection-type} is used when 462The value of @code{process-connection-type} is used when
454@code{start-process} is called. So you can specify how to communicate 463@code{start-process} is called. So you can specify how to communicate
455with one subprocess by binding the variable around the call to 464with one subprocess by binding the variable around the call to
456@code{start-process}. 465@code{start-process}.
@@ -727,7 +736,7 @@ introduction.txt text.texi~
727@end smallexample 736@end smallexample
728@end defun 737@end defun
729 738
730@deffn Command process-send-region process-name start end 739@defun process-send-region process-name start end
731This function sends the text in the region defined by @var{start} and 740This function sends the text in the region defined by @var{start} and
732@var{end} as standard input to @var{process-name}, which is a process or 741@var{end} as standard input to @var{process-name}, which is a process or
733a process name. (If it is @code{nil}, the current buffer's process is 742a process name. (If it is @code{nil}, the current buffer's process is
@@ -736,7 +745,7 @@ used.)
736An error is signaled unless both @var{start} and @var{end} are 745An error is signaled unless both @var{start} and @var{end} are
737integers or markers that indicate positions in the current buffer. (It 746integers or markers that indicate positions in the current buffer. (It
738is unimportant which number is larger.) 747is unimportant which number is larger.)
739@end deffn 748@end defun
740 749
741@defun process-send-eof &optional process-name 750@defun process-send-eof &optional process-name
742 This function makes @var{process-name} see an end-of-file in its 751 This function makes @var{process-name} see an end-of-file in its
diff --git a/lispref/searching.texi b/lispref/searching.texi
index 0f465edc011..68593e4bbef 100644
--- a/lispref/searching.texi
+++ b/lispref/searching.texi
@@ -34,9 +34,9 @@ portions of it.
34 34
35 These are the primitive functions for searching through the text in a 35 These are the primitive functions for searching through the text in a
36buffer. They are meant for use in programs, but you may call them 36buffer. They are meant for use in programs, but you may call them
37interactively. If you do so, they prompt for the search string; 37interactively. If you do so, they prompt for the search string; the
38@var{limit} and @var{noerror} are set to @code{nil}, and @var{repeat} 38arguments @var{limit} and @var{noerror} are @code{nil}, and @var{repeat}
39is set to 1. 39is 1.
40 40
41 These search functions convert the search string to multibyte if the 41 These search functions convert the search string to multibyte if the
42buffer is multibyte; they convert the search string to unibyte if the 42buffer is multibyte; they convert the search string to unibyte if the
@@ -167,6 +167,7 @@ regexps; the following section says how to search for them.
167 167
168@menu 168@menu
169* Syntax of Regexps:: Rules for writing regular expressions. 169* Syntax of Regexps:: Rules for writing regular expressions.
170* Regexp Functions:: Functions for operating on regular expressions.
170* Regexp Example:: Illustrates regular expression syntax. 171* Regexp Example:: Illustrates regular expression syntax.
171@end menu 172@end menu
172 173
@@ -182,21 +183,33 @@ special characters will be defined in the future. Any other character
182appearing in a regular expression is ordinary, unless a @samp{\} 183appearing in a regular expression is ordinary, unless a @samp{\}
183precedes it. 184precedes it.
184 185
185For example, @samp{f} is not a special character, so it is ordinary, and 186 For example, @samp{f} is not a special character, so it is ordinary, and
186therefore @samp{f} is a regular expression that matches the string 187therefore @samp{f} is a regular expression that matches the string
187@samp{f} and no other string. (It does @emph{not} match the string 188@samp{f} and no other string. (It does @emph{not} match the string
188@samp{ff}.) Likewise, @samp{o} is a regular expression that matches 189@samp{fg}, but it does match a @emph{part} of that string.) Likewise,
189only @samp{o}.@refill 190@samp{o} is a regular expression that matches only @samp{o}.@refill
190 191
191Any two regular expressions @var{a} and @var{b} can be concatenated. The 192 Any two regular expressions @var{a} and @var{b} can be concatenated. The
192result is a regular expression that matches a string if @var{a} matches 193result is a regular expression that matches a string if @var{a} matches
193some amount of the beginning of that string and @var{b} matches the rest of 194some amount of the beginning of that string and @var{b} matches the rest of
194the string.@refill 195the string.@refill
195 196
196As a simple example, we can concatenate the regular expressions @samp{f} 197 As a simple example, we can concatenate the regular expressions @samp{f}
197and @samp{o} to get the regular expression @samp{fo}, which matches only 198and @samp{o} to get the regular expression @samp{fo}, which matches only
198the string @samp{fo}. Still trivial. To do something more powerful, you 199the string @samp{fo}. Still trivial. To do something more powerful, you
199need to use one of the special characters. Here is a list of them: 200need to use one of the special regular expression constructs.
201
202@menu
203* Regexp Special:: Special characters in regular expressions.
204* Char Classes:: Character classes used in regular expressions.
205* Regexp Backslash:: Backslash-sequences in regular expressions.
206@end menu
207
208@node Regexp Special
209@subsubsection Special Characters in Regular Expressions
210
211 Here is a list of the characters that are special in a regular
212expression.
200 213
201@need 800 214@need 800
202@table @asis 215@table @asis
@@ -266,23 +279,10 @@ matches @samp{cr}, @samp{car}, @samp{cdr}, @samp{caddaar}, etc.
266 279
267You can also include character ranges in a character alternative, by 280You can also include character ranges in a character alternative, by
268writing the starting and ending characters with a @samp{-} between them. 281writing the starting and ending characters with a @samp{-} between them.
269Thus, @samp{[a-z]} matches any lower-case @sc{ASCII} letter. Ranges may be 282Thus, @samp{[a-z]} matches any lower-case @sc{ascii} letter. Ranges may be
270intermixed freely with individual characters, as in @samp{[a-z$%.]}, 283intermixed freely with individual characters, as in @samp{[a-z$%.]},
271which matches any lower case @sc{ASCII} letter or @samp{$}, @samp{%} or 284which matches any lower case @sc{ascii} letter or @samp{$}, @samp{%} or
272period. 285period.
273
274You cannot always match all non-@sc{ASCII} characters with the regular
275expression @samp{[\200-\377]}. This works when searching a unibyte
276buffer or string (@pxref{Text Representations}), but not in a multibyte
277buffer or string, because many non-@sc{ASCII} characters have codes
278above octal 0377. However, the regular expression @samp{[^\000-\177]}
279does match all non-@sc{ASCII} characters, in both multibyte and unibyte
280representations, because only the @sc{ASCII} characters are excluded.
281
282The beginning and end of a range must be in the same character set
283(@pxref{Character Sets}). Thus, @samp{[a-\x8e0]} is invalid because
284@samp{a} is in the @sc{ASCII} character set but the character 0x8e0
285(@samp{a} with grave accent) is in the Emacs character set for Latin-1.
286 286
287Note that the usual regexp special characters are not special inside a 287Note that the usual regexp special characters are not special inside a
288character alternative. A completely different set of characters is 288character alternative. A completely different set of characters is
@@ -297,6 +297,27 @@ matches both @samp{]} and @samp{-}.
297To include @samp{^} in a character alternative, put it anywhere but at 297To include @samp{^} in a character alternative, put it anywhere but at
298the beginning. 298the beginning.
299 299
300The beginning and end of a range must be in the same character set
301(@pxref{Character Sets}). Thus, @samp{[a-\x8e0]} is invalid because
302@samp{a} is in the @sc{ascii} character set but the character 0x8e0
303(@samp{a} with grave accent) is in the Emacs character set for Latin-1.
304
305You cannot always match all non-@sc{ascii} characters with the regular
306expression @samp{[\200-\377]}. This works when searching a unibyte
307buffer or string (@pxref{Text Representations}), but not in a multibyte
308buffer or string, because many non-@sc{ascii} characters have codes
309above octal 0377. However, the regular expression @samp{[^\000-\177]}
310does match all non-@sc{ascii} characters (see below regarding @samp{^}),
311in both multibyte and unibyte representations, because only the
312@sc{ascii} characters are excluded.
313
314Starting in Emacs 21, a character alternative can also specify named
315character classes (@pxref{Char Classes}). This is a POSIX feature whose
316syntax is @samp{[:@var{class}:]}. Using a character class is equivalent
317to mentioning each of the characters in that class; but the latter is
318not feasible in practice, since some classes include thousands of
319different characters.
320
300@item @samp{[^ @dots{} ]} 321@item @samp{[^ @dots{} ]}
301@cindex @samp{^} in regexp 322@cindex @samp{^} in regexp
302@samp{[^} begins a @dfn{complemented character alternative}, which matches any 323@samp{[^} begins a @dfn{complemented character alternative}, which matches any
@@ -321,14 +342,21 @@ the beginning of a line.
321When matching a string instead of a buffer, @samp{^} matches at the 342When matching a string instead of a buffer, @samp{^} matches at the
322beginning of the string or after a newline character @samp{\n}. 343beginning of the string or after a newline character @samp{\n}.
323 344
345For historical compatibility reasons, @samp{^} can be used only at the
346beginning of the regular expression, or after @samp{\(} or @samp{\|}.
347
324@item @samp{$} 348@item @samp{$}
325@cindex @samp{$} in regexp 349@cindex @samp{$} in regexp
350@cindex end of line in regexp
326is similar to @samp{^} but matches only at the end of a line. Thus, 351is similar to @samp{^} but matches only at the end of a line. Thus,
327@samp{x+$} matches a string of one @samp{x} or more at the end of a line. 352@samp{x+$} matches a string of one @samp{x} or more at the end of a line.
328 353
329When matching a string instead of a buffer, @samp{$} matches at the end 354When matching a string instead of a buffer, @samp{$} matches at the end
330of the string or before a newline character @samp{\n}. 355of the string or before a newline character @samp{\n}.
331 356
357For historical compatibility reasons, @samp{$} can be used only at the
358end of the regular expression, or before @samp{\)} or @samp{\|}.
359
332@item @samp{\} 360@item @samp{\}
333@cindex @samp{\} in regexp 361@cindex @samp{\} in regexp
334has two functions: it quotes the special characters (including 362has two functions: it quotes the special characters (including
@@ -354,11 +382,66 @@ ordinary since there is no preceding expression on which the @samp{*}
354can act. It is poor practice to depend on this behavior; quote the 382can act. It is poor practice to depend on this behavior; quote the
355special character anyway, regardless of where it appears.@refill 383special character anyway, regardless of where it appears.@refill
356 384
357For the most part, @samp{\} followed by any character matches only that 385@node Char Classes
358character. However, there are several exceptions: two-character 386@subsubsection Character Classes
359sequences starting with @samp{\} which have special meanings. (The 387@cindex character classes in regexp
360second character in such a sequence is always ordinary when used on its 388
361own.) Here is a table of @samp{\} constructs. 389 Here is a table of the classes you can use in a character alternative,
390in Emacs 21, and what they mean:
391
392@table @samp
393@item [:ascii:]
394This matches any ASCII (unibyte) character.
395@item [:alnum:]
396This matches any letter or digit. (At present, for multibyte
397characters, it matches anything that has word syntax.)
398@item [:alpha:]
399This matches any letter. (At present, for multibyte characters, it
400matches anything that has word syntax.)
401@item [:blank:]
402This matches space and tab only.
403@item [:cntrl:]
404This matches any ASCII control character.
405@item [:digit:]
406This matches @samp{0} through @samp{9}. Thus, @samp{[-+[:digit:]]}
407matches any digit, as well as @samp{+} and @samp{-}.
408@item [:graph:]
409This matches graphic characters---everything except ASCII control characters,
410space, and DEL.
411@item [:lower:]
412This matches any lower-case letter, as determined by
413the current case table (@pxref{Case Tables}).
414@item [:nonascii:]
415This matches any non-ASCII (multibyte) character.
416@item [:print:]
417This matches printing characters---everything except ASCII control
418characters and DEL.
419@item [:punct:]
420This matches any punctuation character. (At present, for multibyte
421characters, it matches anything that has non-word syntax.)
422@item [:space:]
423This matches any character that has whitespace syntax
424(@pxref{Syntax Class Table}).
425@item [:upper:]
426This matches any upper-case letter, as determined by
427the current case table (@pxref{Case Tables}).
428@item [:word:]
429This matches any character that has word syntax (@pxref{Syntax Class
430Table}).
431@item [:xdigit:]
432This matches the hexadecimal digits: @samp{0} through @samp{9}, @samp{a}
433through @samp{f} and @samp{A} through @samp{F}.
434@end table
435
436@node Regexp Backslash
437@subsubsection Backslash Constructs in Regular Expressions
438
439 For the most part, @samp{\} followed by any character matches only
440that character. However, there are several exceptions: certain
441two-character sequences starting with @samp{\} that have special
442meanings. (The character after the @samp{\} in such a sequence is
443always ordinary when used on its own.) Here is a table of the special
444@samp{\} constructs.
362 445
363@table @samp 446@table @samp
364@item \| 447@item \|
@@ -376,7 +459,9 @@ but no other string.@refill
376surrounding @samp{\( @dots{} \)} grouping can limit the grouping power of 459surrounding @samp{\( @dots{} \)} grouping can limit the grouping power of
377@samp{\|}.@refill 460@samp{\|}.@refill
378 461
379Full backtracking capability exists to handle multiple uses of @samp{\|}. 462Full backtracking capability exists to handle multiple uses of
463@samp{\|}, if you use the POSIX regular expression functions
464(@pxref{POSIX Regexps}).
380 465
381@item \( @dots{} \) 466@item \( @dots{} \)
382@cindex @samp{(} in regexp 467@cindex @samp{(} in regexp
@@ -505,62 +590,6 @@ as @samp{[]]}), and so is a string that ends with a single @samp{\}. If
505an invalid regular expression is passed to any of the search functions, 590an invalid regular expression is passed to any of the search functions,
506an @code{invalid-regexp} error is signaled. 591an @code{invalid-regexp} error is signaled.
507 592
508@defun regexp-quote string
509This function returns a regular expression string that matches exactly
510@var{string} and nothing else. This allows you to request an exact
511string match when calling a function that wants a regular expression.
512
513@example
514@group
515(regexp-quote "^The cat$")
516 @result{} "\\^The cat\\$"
517@end group
518@end example
519
520One use of @code{regexp-quote} is to combine an exact string match with
521context described as a regular expression. For example, this searches
522for the string that is the value of @var{string}, surrounded by
523whitespace:
524
525@example
526@group
527(re-search-forward
528 (concat "\\s-" (regexp-quote string) "\\s-"))
529@end group
530@end example
531@end defun
532
533@defun regexp-opt strings &optional paren
534@tindex regexp-opt
535This function returns an efficient regular expression that will match
536any 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
538mode.
539
540If the optional argument @var{paren} is non-@code{nil}, then the
541returned regular expression is always enclosed by at least one
542parentheses-grouping construct.
543
544This simplified definition of @code{regexp-opt} produces a
545regular expression which is equivalent to the actual value
546(but not as efficient):
547
548@example
549(defun regexp-opt (strings paren)
550 (let ((open-paren (if paren "\\(" ""))
551 (close-paren (if paren "\\)" "")))
552 (concat open-paren
553 (mapconcat 'regexp-quote strings "\\|")
554 close-paren)))
555@end example
556@end defun
557
558@defun regexp-opt-depth regexp
559@tindex regexp-opt-depth
560This function returns the total number of grouping constructs
561(parenthesized expressions) in @var{regexp}.
562@end defun
563
564@node Regexp Example 593@node Regexp Example
565@comment node-name, next, previous, up 594@comment node-name, next, previous, up
566@subsection Complex Regexp Example 595@subsection Complex Regexp Example
@@ -624,6 +653,72 @@ Finally, the last part of the pattern matches any additional whitespace
624beyond the minimum needed to end a sentence. 653beyond the minimum needed to end a sentence.
625@end table 654@end table
626 655
656@node Regexp Functions
657@subsection Regular Expression Functions
658
659 These functions operate on regular expressions.
660
661@defun regexp-quote string
662This function returns a regular expression whose only exact match is
663@var{string}. Using this regular expression in @code{looking-at} will
664succeed only if the next characters in the buffer are @var{string};
665using it in a search function will succeed if the text being searched
666contains @var{string}.
667
668This allows you to request an exact string match or search when calling
669a function that wants a regular expression.
670
671@example
672@group
673(regexp-quote "^The cat$")
674 @result{} "\\^The cat\\$"
675@end group
676@end example
677
678One use of @code{regexp-quote} is to combine an exact string match with
679context described as a regular expression. For example, this searches
680for the string that is the value of @var{string}, surrounded by
681whitespace:
682
683@example
684@group
685(re-search-forward
686 (concat "\\s-" (regexp-quote string) "\\s-"))
687@end group
688@end example
689@end defun
690
691@defun regexp-opt strings &optional paren
692@tindex regexp-opt
693This function returns an efficient regular expression that will match
694any of the strings @var{strings}. This is useful when you need to make
695matching or searching as fast as possible---for example, for Font Lock
696mode.
697
698If the optional argument @var{paren} is non-@code{nil}, then the
699returned regular expression is always enclosed by at least one
700parentheses-grouping construct.
701
702This simplified definition of @code{regexp-opt} produces a
703regular expression which is equivalent to the actual value
704(but not as efficient):
705
706@example
707(defun regexp-opt (strings paren)
708 (let ((open-paren (if paren "\\(" ""))
709 (close-paren (if paren "\\)" "")))
710 (concat open-paren
711 (mapconcat 'regexp-quote strings "\\|")
712 close-paren)))
713@end example
714@end defun
715
716@defun regexp-opt-depth regexp
717@tindex regexp-opt-depth
718This function returns the total number of grouping constructs
719(parenthesized expressions) in @var{regexp}.
720@end defun
721
627@node Regexp Search 722@node Regexp Search
628@section Regular Expression Searching 723@section Regular Expression Searching
629@cindex regular expression searching 724@cindex regular expression searching
@@ -908,10 +1003,19 @@ The argument @var{replacements} specifies what to replace occurrences
908with. If it is a string, that string is used. It can also be a list of 1003with. If it is a string, that string is used. It can also be a list of
909strings, to be used in cyclic order. 1004strings, to be used in cyclic order.
910 1005
1006If @var{replacements} is a cons cell, @var{(@var{function}
1007. @var{data})}, this means to call @var{function} after each match to
1008get the replacement text. This function is called with two arguments:
1009@var{data}, and the number of replacements already made.
1010
911If @var{repeat-count} is non-@code{nil}, it should be an integer. Then 1011If @var{repeat-count} is non-@code{nil}, it should be an integer. Then
912it specifies how many times to use each of the strings in the 1012it specifies how many times to use each of the strings in the
913@var{replacements} list before advancing cyclicly to the next one. 1013@var{replacements} list before advancing cyclicly to the next one.
914 1014
1015If @var{from-string} contains upper-case letters, then
1016@code{perform-replace} binds @code{case-fold-search} to @code{nil}, and
1017it uses the @code{replacements} without altering the case of them.
1018
915Normally, the keymap @code{query-replace-map} defines the possible user 1019Normally, the keymap @code{query-replace-map} defines the possible user
916responses for queries. The argument @var{map}, if non-@code{nil}, is a 1020responses for queries. The argument @var{map}, if non-@code{nil}, is a
917keymap to use instead of @code{query-replace-map}. 1021keymap to use instead of @code{query-replace-map}.
@@ -1009,7 +1113,7 @@ match data around it, to prevent it from being overwritten.
1009@end menu 1113@end menu
1010 1114
1011@node Replacing Match 1115@node Replacing Match
1012@subsection Replacing the Text That Matched 1116@subsection Replacing the Text that Matched
1013 1117
1014 This function replaces the text matched by the last search with 1118 This function replaces the text matched by the last search with
1015@var{replacement}. 1119@var{replacement}.
@@ -1039,9 +1143,6 @@ If the original text contains just one word, and that word is a capital
1039letter, @code{replace-match} considers this a capitalized first word 1143letter, @code{replace-match} considers this a capitalized first word
1040rather than all upper case. 1144rather than all upper case.
1041 1145
1042If @code{case-replace} is @code{nil}, then case conversion is not done,
1043regardless of the value of @var{fixed-case}. @xref{Searching and Case}.
1044
1045If @var{literal} is non-@code{nil}, then @var{replacement} is inserted 1146If @var{literal} is non-@code{nil}, then @var{replacement} is inserted
1046exactly as it is, the only alterations being case changes as needed. 1147exactly as it is, the only alterations being case changes as needed.
1047If it is @code{nil} (the default), then the character @samp{\} is treated 1148If it is @code{nil} (the default), then the character @samp{\} is treated
@@ -1361,8 +1462,8 @@ preserve case. If the variable is @code{nil}, that means to use the
1361replacement text verbatim. A non-@code{nil} value means to convert the 1462replacement text verbatim. A non-@code{nil} value means to convert the
1362case of the replacement text according to the text being replaced. 1463case of the replacement text according to the text being replaced.
1363 1464
1364The function @code{replace-match} is where this variable actually has 1465This variable is used by passing it as an argument to the function
1365its effect. @xref{Replacing Match}. 1466@code{replace-match}. @xref{Replacing Match}.
1366@end defopt 1467@end defopt
1367 1468
1368@defopt case-fold-search 1469@defopt case-fold-search
diff --git a/lispref/sequences.texi b/lispref/sequences.texi
index f812112e243..006b863e7ed 100644
--- a/lispref/sequences.texi
+++ b/lispref/sequences.texi
@@ -3,7 +3,7 @@
3@c Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1998 Free Software Foundation, Inc. 3@c Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 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/sequences 5@setfilename ../info/sequences
6@node Sequences Arrays Vectors, Symbols, Lists, Top 6@node Sequences Arrays Vectors, Hash Tables, Lists, Top
7@chapter Sequences, Arrays, and Vectors 7@chapter Sequences, Arrays, and Vectors
8@cindex sequence 8@cindex sequence
9 9
@@ -312,7 +312,7 @@ first element is at index zero.
312@end group 312@end group
313@group 313@group
314(aref "abcdefg" 1) 314(aref "abcdefg" 1)
315 @result{} 98 ; @r{@samp{b} is @sc{ASCII} code 98.} 315 @result{} 98 ; @r{@samp{b} is @sc{ascii} code 98.}
316@end group 316@end group
317@end example 317@end example
318 318
diff --git a/lispref/streams.texi b/lispref/streams.texi
index 2209a40baf9..90089b10bf7 100644
--- a/lispref/streams.texi
+++ b/lispref/streams.texi
@@ -716,25 +716,25 @@ In the second expression, the local binding of
716 716
717@tindex print-escape-nonascii 717@tindex print-escape-nonascii
718@defvar print-escape-nonascii 718@defvar print-escape-nonascii
719If this variable is non-@code{nil}, then unibyte non-@sc{ASCII} 719If this variable is non-@code{nil}, then unibyte non-@sc{ascii}
720characters in strings are unconditionally printed as backslash sequences 720characters in strings are unconditionally printed as backslash sequences
721by the print functions @code{prin1} and @code{print} that print with 721by the print functions @code{prin1} and @code{print} that print with
722quoting. 722quoting.
723 723
724Those functions also use backslash sequences for unibyte non-@sc{ASCII} 724Those functions also use backslash sequences for unibyte non-@sc{ascii}
725characters, regardless of the value of this variable, when the output 725characters, regardless of the value of this variable, when the output
726stream is a multibyte buffer or a marker pointing into one. 726stream is a multibyte buffer or a marker pointing into one.
727@end defvar 727@end defvar
728 728
729@tindex print-escape-multibyte 729@tindex print-escape-multibyte
730@defvar print-escape-multibyte 730@defvar print-escape-multibyte
731If this variable is non-@code{nil}, then multibyte non-@sc{ASCII} 731If this variable is non-@code{nil}, then multibyte non-@sc{ascii}
732characters in strings are unconditionally printed as backslash sequences 732characters in strings are unconditionally printed as backslash sequences
733by the print functions @code{prin1} and @code{print} that print with 733by the print functions @code{prin1} and @code{print} that print with
734quoting. 734quoting.
735 735
736Those functions also use backslash sequences for multibyte 736Those functions also use backslash sequences for multibyte
737non-@sc{ASCII} characters, regardless of the value of this variable, 737non-@sc{ascii} characters, regardless of the value of this variable,
738when the output stream is a unibyte buffer or a marker pointing into 738when the output stream is a unibyte buffer or a marker pointing into
739one. 739one.
740@end defvar 740@end defvar
@@ -766,3 +766,48 @@ parentheses and brackets when printed. Any list or vector at a depth
766exceeding this limit is abbreviated with an ellipsis. A value of 766exceeding this limit is abbreviated with an ellipsis. A value of
767@code{nil} (which is the default) means no limit. 767@code{nil} (which is the default) means no limit.
768@end defvar 768@end defvar
769
770 These variables are used for detecting and reporting circular
771and shared structure---but they are only defined in Emacs 21.
772
773@tindex print-circle
774@defvar print-circle
775If non-@code{nil}, this variable enables detection of circular
776and shared structure in printing.
777@end defvar
778
779@tindex print-gensym
780@defvar print-gensym
781If non-@code{nil}, this variable enables detection of uninterned symbols
782(@pxref{Creating Symbols}) in printing. When this is enabled,
783uninterned symbols print with the prefix @samp{#:}, which tells the Lisp
784reader to produce an uninterned symbol.
785@end defvar
786
787@tindex print-continuous-numbering
788@defvar print-continuous-numbering
789To print several objects with shared structure in common, you should
790bind @code{print-continuous-numbering} to @code{t} around them all.
791That tells @code{print} not to reinitialize @code{print-number-table}
792each time.
793@end defvar
794
795@tindex print-number-table
796@defvar print-number-table
797This variable holds the table used as the basis of outputting
798@samp{#@var{n}=} and @samp{#@var{n}#} constructs for circular and shared
799structure. When you want to print several objects with shared structure
800in common, you should bind @code{print-number-table} to @code{nil}
801around them all.
802@end defvar
803
804 Here is an example of printing two objects with a common
805set of shared substructure:
806
807@example
808(let ((print-circle t)
809 (print-continuous-numbering t)
810 print-number-table)
811 (print1 x)
812 (print1 y))
813@end example
diff --git a/lispref/strings.texi b/lispref/strings.texi
index eb7e35293d1..bec0864de71 100644
--- a/lispref/strings.texi
+++ b/lispref/strings.texi
@@ -27,7 +27,7 @@ keyboard character events.
27* Creating Strings:: Functions to allocate new strings. 27* Creating Strings:: Functions to allocate new strings.
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 to and from characters and strings.
31* Formatting Strings:: @code{format}: Emacs's analogue 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.
@@ -43,7 +43,7 @@ used. Thus, strings really contain integers.
43 The length of a string (like any array) is fixed, and cannot be 43 The length of a string (like any array) is fixed, and cannot be
44altered once the string exists. Strings in Lisp are @emph{not} 44altered once the string exists. Strings in Lisp are @emph{not}
45terminated by a distinguished character code. (By contrast, strings in 45terminated by a distinguished character code. (By contrast, strings in
46C are terminated by a character with @sc{ASCII} code 0.) 46C are terminated by a character with @sc{ascii} code 0.)
47 47
48 Since strings are arrays, and therefore sequences as well, you can 48 Since strings are arrays, and therefore sequences as well, you can
49operate on them with the general array and sequence functions. 49operate on them with the general array and sequence functions.
@@ -51,25 +51,25 @@ operate on them with the general array and sequence functions.
51change individual characters in a string using the functions @code{aref} 51change individual characters in a string using the functions @code{aref}
52and @code{aset} (@pxref{Array Functions}). 52and @code{aset} (@pxref{Array Functions}).
53 53
54 There are two text representations for non-@sc{ASCII} characters in 54 There are two text representations for non-@sc{ascii} characters in
55Emacs strings (and in buffers): unibyte and multibyte (@pxref{Text 55Emacs strings (and in buffers): unibyte and multibyte (@pxref{Text
56Representations}). @sc{ASCII} characters always occupy one byte in a 56Representations}). An @sc{ascii} character always occupies one byte in a
57string; in fact, when a string is all @sc{ASCII}, there is no real 57string; in fact, when a string is all @sc{ascii}, there is no real
58difference between the unibyte and multibyte representations. 58difference between the unibyte and multibyte representations.
59For most Lisp programming, you don't need to be concerned with these two 59For most Lisp programming, you don't need to be concerned with these two
60representations. 60representations.
61 61
62 Sometimes key sequences are represented as strings. When a string is 62 Sometimes key sequences are represented as strings. When a string is
63a key sequence, string elements in the range 128 to 255 represent meta 63a key sequence, string elements in the range 128 to 255 represent meta
64characters (which are extremely large integers) rather than character 64characters (which are large integers) rather than character
65codes in the range 128 to 255. 65codes in the range 128 to 255.
66 66
67 Strings cannot hold characters that have the hyper, super or alt 67 Strings cannot hold characters that have the hyper, super or alt
68modifiers; they can hold @sc{ASCII} control characters, but no other 68modifiers; they can hold @sc{ascii} control characters, but no other
69control characters. They do not distinguish case in @sc{ASCII} control 69control characters. They do not distinguish case in @sc{ascii} control
70characters. If you want to store such characters in a sequence, such as 70characters. If you want to store such characters in a sequence, such as
71a key sequence, you must use a vector instead of a string. 71a key sequence, you must use a vector instead of a string.
72@xref{Character Type}, for more information about representation of meta 72@xref{Character Type}, for more information about the representation of meta
73and other modifiers for keyboard input characters. 73and other modifiers for keyboard input characters.
74 74
75 Strings are useful for holding regular expressions. You can also 75 Strings are useful for holding regular expressions. You can also
@@ -200,7 +200,7 @@ Functions}).
200If the characters copied from @var{string} have text properties, the 200If the characters copied from @var{string} have text properties, the
201properties are copied into the new string also. @xref{Text Properties}. 201properties are copied into the new string also. @xref{Text Properties}.
202 202
203@code{substring} also allows vectors for the first argument. 203@code{substring} also accepts a vector for the first argument.
204For example: 204For example:
205 205
206@example 206@example
@@ -250,8 +250,8 @@ When an argument is an integer (not a sequence of integers), it is
250converted to a string of digits making up the decimal printed 250converted to a string of digits making up the decimal printed
251representation of the integer. @strong{Don't use this feature; we plan 251representation of the integer. @strong{Don't use this feature; we plan
252to eliminate it. If you already use this feature, change your programs 252to eliminate it. If you already use this feature, change your programs
253now!} The proper way to convert an integer to a decimal number in this 253now!} The proper way to convert an integer to its decimal printed form
254way is with @code{format} (@pxref{Formatting Strings}) or 254is with @code{format} (@pxref{Formatting Strings}) or
255@code{number-to-string} (@pxref{String Conversion}). 255@code{number-to-string} (@pxref{String Conversion}).
256 256
257@example 257@example
@@ -271,7 +271,7 @@ Lists}.
271 271
272@defun split-string string separators 272@defun split-string string separators
273@tindex split-string 273@tindex split-string
274Split @var{string} into substrings in between matches for the regular 274This function splits @var{string} into substrings at matches for the regular
275expression @var{separators}. Each match for @var{separators} defines a 275expression @var{separators}. Each match for @var{separators} defines a
276splitting point; the substrings between the splitting points are made 276splitting point; the substrings between the splitting points are made
277into a list, which is the value returned by @code{split-string}. 277into a list, which is the value returned by @code{split-string}.
@@ -367,7 +367,7 @@ The function @code{string=} ignores the text properties of the two
367strings. When @code{equal} (@pxref{Equality Predicates}) compares two 367strings. When @code{equal} (@pxref{Equality Predicates}) compares two
368strings, it uses @code{string=}. 368strings, it uses @code{string=}.
369 369
370If the strings contain non-@sc{ASCII} characters, and one is unibyte 370If the strings contain non-@sc{ascii} characters, and one is unibyte
371while the other is multibyte, then they cannot be equal. @xref{Text 371while the other is multibyte, then they cannot be equal. @xref{Text
372Representations}. 372Representations}.
373@end defun 373@end defun
@@ -379,9 +379,9 @@ Representations}.
379@cindex lexical comparison 379@cindex lexical comparison
380@defun string< string1 string2 380@defun string< string1 string2
381@c (findex string< causes problems for permuted index!!) 381@c (findex string< causes problems for permuted index!!)
382This function compares two strings a character at a time. First it 382This function compares two strings a character at a time. It
383scans both the strings at once to find the first pair of corresponding 383scans both the strings at the same time to find the first pair of corresponding
384characters that do not match. If the lesser character of those two is 384characters that do not match. If the lesser character of these two is
385the character from @var{string1}, then @var{string1} is less, and this 385the character from @var{string1}, then @var{string1} is less, and this
386function returns @code{t}. If the lesser character is the one from 386function returns @code{t}. If the lesser character is the one from
387@var{string2}, then @var{string1} is greater, and this function returns 387@var{string2}, then @var{string1} is greater, and this function returns
@@ -389,11 +389,11 @@ function returns @code{t}. If the lesser character is the one from
389 389
390Pairs of characters are compared according to their character codes. 390Pairs of characters are compared according to their character codes.
391Keep in mind that lower case letters have higher numeric values in the 391Keep in mind that lower case letters have higher numeric values in the
392@sc{ASCII} character set than their upper case counterparts; digits and 392@sc{ascii} character set than their upper case counterparts; digits and
393many punctuation characters have a lower numeric value than upper case 393many punctuation characters have a lower numeric value than upper case
394letters. An @sc{ASCII} character is less than any non-@sc{ASCII} 394letters. An @sc{ascii} character is less than any non-@sc{ascii}
395character; a unibyte non-@sc{ASCII} character is always less than any 395character; a unibyte non-@sc{ascii} character is always less than any
396multibyte non-@sc{ASCII} character (@pxref{Text Representations}). 396multibyte non-@sc{ascii} character (@pxref{Text Representations}).
397 397
398@example 398@example
399@group 399@group
@@ -433,11 +433,12 @@ no characters is less than any other string.
433 433
434@defun compare-strings string1 start1 end1 string2 start2 end2 &optional ignore-case 434@defun compare-strings string1 start1 end1 string2 start2 end2 &optional ignore-case
435@tindex compare-strings 435@tindex compare-strings
436This function compares a specified part of @var{string1} with a 436This function compares the specified part of @var{string1} with the
437specified part of @var{string2}. The specified part of @var{string1} 437specified part of @var{string2}. The specified part of @var{string1}
438runs from index @var{start1} up to index @var{end1} (default, the end of 438runs from index @var{start1} up to index @var{end1} (@code{nil} means
439the string). The specified part of @var{string2} runs from index 439the end of the string). The specified part of @var{string2} runs from
440@var{start2} up to index @var{end2} (default, the end of the string). 440index @var{start2} up to index @var{end2} (@code{nil} means the end of
441the string).
441 442
442The strings are both converted to multibyte for the comparison 443The strings are both converted to multibyte for the comparison
443(@pxref{Text Representations}) so that a unibyte string can be equal to 444(@pxref{Text Representations}) so that a unibyte string can be equal to
@@ -500,7 +501,7 @@ This function returns a new string containing one character,
500@cindex string to character 501@cindex string to character
501 This function returns the first character in @var{string}. If the 502 This function returns the first character in @var{string}. If the
502string is empty, the function returns 0. The value is also 0 when the 503string is empty, the function returns 0. The value is also 0 when the
503first character of @var{string} is the null character, @sc{ASCII} code 504first character of @var{string} is the null character, @sc{ascii} code
5040. 5050.
505 506
506@example 507@example
@@ -510,8 +511,10 @@ first character of @var{string} is the null character, @sc{ASCII} code
510 @result{} 120 511 @result{} 120
511(string-to-char "") 512(string-to-char "")
512 @result{} 0 513 @result{} 0
514@group
513(string-to-char "\000") 515(string-to-char "\000")
514 @result{} 0 516 @result{} 0
517@end group
515@end example 518@end example
516 519
517This function may be eliminated in the future if it does not seem useful 520This function may be eliminated in the future if it does not seem useful
@@ -523,7 +526,7 @@ enough to retain.
523@cindex integer to decimal 526@cindex integer to decimal
524This function returns a string consisting of the printed base-ten 527This function returns a string consisting of the printed base-ten
525representation of @var{number}, which may be an integer or a floating 528representation of @var{number}, which may be an integer or a floating
526point number. The value starts with a sign if the argument is 529point number. The returned value starts with a minus sign if the argument is
527negative. 530negative.
528 531
529@example 532@example
@@ -553,8 +556,9 @@ more work and does not seem useful.
553The parsing skips spaces and tabs at the beginning of @var{string}, then 556The parsing skips spaces and tabs at the beginning of @var{string}, then
554reads as much of @var{string} as it can interpret as a number. (On some 557reads as much of @var{string} as it can interpret as a number. (On some
555systems it ignores other whitespace at the beginning, not just spaces 558systems it ignores other whitespace at the beginning, not just spaces
556and tabs.) If the first character after the ignored whitespace is not a 559and tabs.) If the first character after the ignored whitespace is
557digit or a plus or minus sign, this function returns 0. 560neither a digit, nor a plus or minus sign, nor the leading dot of a
561floating point number, this function returns 0.
558 562
559@example 563@example
560(string-to-number "256") 564(string-to-number "256")
@@ -607,6 +611,10 @@ This function returns a new string that is made by copying
607@var{string} and then replacing any format specification 611@var{string} and then replacing any format specification
608in the copy with encodings of the corresponding @var{objects}. The 612in the copy with encodings of the corresponding @var{objects}. The
609arguments @var{objects} are the computed values to be formatted. 613arguments @var{objects} are the computed values to be formatted.
614
615The characters in @var{string}, other than the format specifications,
616are copied directly into the output; starting in Emacs 21, if they have
617text properties, these are copied into the output also.
610@end defun 618@end defun
611 619
612@cindex @samp{%} in format 620@cindex @samp{%} in format
@@ -646,6 +654,10 @@ made without quoting (that is, using @code{princ}, not
646by their contents alone, with no @samp{"} characters, and symbols appear 654by their contents alone, with no @samp{"} characters, and symbols appear
647without @samp{\} characters. 655without @samp{\} characters.
648 656
657Starting in Emacs 21, if the object is a string, its text properties are
658copied into the output. The text properties of the @samp{%s} itself
659are also copied, but those of the object take priority.
660
649If there is no corresponding object, the empty string is used. 661If there is no corresponding object, the empty string is used.
650 662
651@item %S 663@item %S
@@ -774,15 +786,15 @@ not truncated. In the third case, the padding is on the right.
774 The character case functions change the case of single characters or 786 The character case functions change the case of single characters or
775of the contents of strings. The functions normally convert only 787of the contents of strings. The functions normally convert only
776alphabetic characters (the letters @samp{A} through @samp{Z} and 788alphabetic characters (the letters @samp{A} through @samp{Z} and
777@samp{a} through @samp{z}, as well as non-ASCII letters); other 789@samp{a} through @samp{z}, as well as non-@sc{ascii} letters); other
778characters are not altered. (You can specify a different case 790characters are not altered. You can specify a different case
779conversion mapping by specifying a case table---@pxref{Case Tables}.) 791conversion mapping by specifying a case table (@pxref{Case Tables}).
780 792
781 These functions do not modify the strings that are passed to them as 793 These functions do not modify the strings that are passed to them as
782arguments. 794arguments.
783 795
784 The examples below use the characters @samp{X} and @samp{x} which have 796 The examples below use the characters @samp{X} and @samp{x} which have
785@sc{ASCII} codes 88 and 120 respectively. 797@sc{ascii} codes 88 and 120 respectively.
786 798
787@defun downcase string-or-char 799@defun downcase string-or-char
788This function converts a character or a string to lower case. 800This function converts a character or a string to lower case.
@@ -814,7 +826,7 @@ lower case is converted to upper case.
814When the argument to @code{upcase} is a character, @code{upcase} 826When the argument to @code{upcase} is a character, @code{upcase}
815returns the corresponding upper case character. This value is an integer. 827returns the corresponding upper case character. This value is an integer.
816If the original character is upper case, or is not a letter, then the 828If the original character is upper case, or is not a letter, then the
817value equals the original character. 829value returned equals the original character.
818 830
819@example 831@example
820(upcase "The cat in the hat") 832(upcase "The cat in the hat")
@@ -921,7 +933,7 @@ of them, or @samp{A} for both of them).
921 933
922 The extra table @var{equivalences} is a map that cyclicly permutes 934 The extra table @var{equivalences} is a map that cyclicly permutes
923each equivalence class (of characters with the same canonical 935each equivalence class (of characters with the same canonical
924equivalent). (For ordinary @sc{ASCII}, this would map @samp{a} into 936equivalent). (For ordinary @sc{ascii}, this would map @samp{a} into
925@samp{A} and @samp{A} into @samp{a}, and likewise for each set of 937@samp{A} and @samp{A} into @samp{a}, and likewise for each set of
926equivalent characters.) 938equivalent characters.)
927 939
@@ -958,7 +970,7 @@ This sets the current buffer's case table to @var{table}.
958@end defun 970@end defun
959 971
960 The following three functions are convenient subroutines for packages 972 The following three functions are convenient subroutines for packages
961that define non-@sc{ASCII} character sets. They modify the specified 973that define non-@sc{ascii} character sets. They modify the specified
962case table @var{case-table}; they also modify the standard syntax table. 974case table @var{case-table}; they also modify the standard syntax table.
963@xref{Syntax Tables}. Normally you would use these functions to change 975@xref{Syntax Tables}. Normally you would use these functions to change
964the standard case table. 976the standard case table.
diff --git a/lispref/symbols.texi b/lispref/symbols.texi
index c9a2d34d5ef..3239a9ecaef 100644
--- a/lispref/symbols.texi
+++ b/lispref/symbols.texi
@@ -3,7 +3,7 @@
3@c Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1998 Free Software Foundation, Inc. 3@c Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 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/symbols 5@setfilename ../info/symbols
6@node Symbols, Evaluation, Sequences Arrays Vectors, Top 6@node Symbols, Evaluation, Hash Tables, Top
7@chapter Symbols 7@chapter Symbols
8@cindex symbol 8@cindex symbol
9 9
@@ -57,7 +57,7 @@ The @dfn{function cell} holds the function definition of the symbol.
57When a symbol is used as a function, its function definition is used in 57When a symbol is used as a function, its function definition is used in
58its place. This cell is also used to make a symbol stand for a keymap 58its place. This cell is also used to make a symbol stand for a keymap
59or a keyboard macro, for editor command execution. Because each symbol 59or a keyboard macro, for editor command execution. Because each symbol
60has separate value and function cells, variables and function names do 60has separate value and function cells, variables names and function names do
61not conflict. See @code{symbol-function} in @ref{Function Cells}. 61not conflict. See @code{symbol-function} in @ref{Function Cells}.
62 62
63@item Property list 63@item Property list
@@ -194,7 +194,9 @@ book cover to cover when looking up Jan Jones, you start with the J's
194and go from there. That is a simple version of hashing. Each element 194and go from there. That is a simple version of hashing. Each element
195of the obarray is a @dfn{bucket} which holds all the symbols with a 195of the obarray is a @dfn{bucket} which holds all the symbols with a
196given hash code; to look for a given name, it is sufficient to look 196given hash code; to look for a given name, it is sufficient to look
197through all the symbols in the bucket for that name's hash code. 197through all the symbols in the bucket for that name's hash code. (The
198same idea is used for general Emacs hash tables, but they are a
199different data type; see @ref{Hash Tables}.)
198 200
199@cindex interning 201@cindex interning
200 If a symbol with the desired name is found, the reader uses that 202 If a symbol with the desired name is found, the reader uses that
@@ -208,6 +210,11 @@ particular name. Other like-named symbols may exist, but not in the
208same obarray. Thus, the reader gets the same symbols for the same 210same obarray. Thus, the reader gets the same symbols for the same
209names, as long as you keep reading with the same obarray. 211names, as long as you keep reading with the same obarray.
210 212
213 Interning usually happens automatically in the reader, but sometimes
214other programs need to do it. For example, after the @kbd{M-x} command
215obtains the command name as a string using the minibuffer, it then
216interns the string, to get the interned symbol with that name.
217
211@cindex symbol equality 218@cindex symbol equality
212@cindex uninterned symbol 219@cindex uninterned symbol
213 No obarray contains all symbols; in fact, some symbols are not in any 220 No obarray contains all symbols; in fact, some symbols are not in any
@@ -216,6 +223,10 @@ symbol has the same four cells as other symbols; however, the only way
216to gain access to it is by finding it in some other object or as the 223to gain access to it is by finding it in some other object or as the
217value of a variable. 224value of a variable.
218 225
226 Creating an uninterned symbol is useful in generating Lisp code,
227because an uninterned symbol used as a variable in the code you generate
228cannot clash with any variables used in other Lisp programs.
229
219 In Emacs Lisp, an obarray is actually a vector. Each element of the 230 In Emacs Lisp, an obarray is actually a vector. Each element of the
220vector is a bucket; its value is either an interned symbol whose name 231vector is a bucket; its value is either an interned symbol whose name
221hashes to that bucket, or 0 if the bucket is empty. Each interned 232hashes to that bucket, or 0 if the bucket is empty. Each interned
@@ -224,7 +235,7 @@ in the bucket. Because these links are invisible, there is no way to
224find all the symbols in an obarray except using @code{mapatoms} (below). 235find all the symbols in an obarray except using @code{mapatoms} (below).
225The order of symbols in a bucket is not significant. 236The order of symbols in a bucket is not significant.
226 237
227 In an empty obarray, every element is 0, and you can create an obarray 238 In an empty obarray, every element is 0, so you can create an obarray
228with @code{(make-vector @var{length} 0)}. @strong{This is the only 239with @code{(make-vector @var{length} 0)}. @strong{This is the only
229valid way to create an obarray.} Prime numbers as lengths tend 240valid way to create an obarray.} Prime numbers as lengths tend
230to result in good hashing; lengths one less than a power of two are also 241to result in good hashing; lengths one less than a power of two are also
diff --git a/lispref/syntax.texi b/lispref/syntax.texi
index 35cde861d15..4405be5a4f8 100644
--- a/lispref/syntax.texi
+++ b/lispref/syntax.texi
@@ -71,7 +71,7 @@ A syntax table can inherit the data for some characters from the
71standard syntax table, while specifying other characters itself. The 71standard syntax table, while specifying other characters itself. The
72``inherit'' syntax class means ``inherit this character's syntax from 72``inherit'' syntax class means ``inherit this character's syntax from
73the standard syntax table.'' Just changing the standard syntax for a 73the standard syntax table.'' Just changing the standard syntax for a
74characters affects all syntax tables which inherit from it. 74character affects all syntax tables that inherit from it.
75 75
76@defun syntax-table-p object 76@defun syntax-table-p object
77This function returns @code{t} if @var{object} is a syntax table. 77This function returns @code{t} if @var{object} is a syntax table.
@@ -92,9 +92,11 @@ syntax table and its class in any other table.
92 92
93 Each class is designated by a mnemonic character, which serves as the 93 Each class is designated by a mnemonic character, which serves as the
94name of the class when you need to specify a class. Usually the 94name of the class when you need to specify a class. Usually the
95designator character is one that is frequently in that class; however, 95designator character is one that is often assigned that class; however,
96its meaning as a designator is unvarying and independent of what syntax 96its meaning as a designator is unvarying and independent of what syntax
97that character currently has. 97that character currently has. Thus, @samp{\} as a designator character
98always gives ``escape character'' syntax, regardless of what syntax
99@samp{\} currently has.
98 100
99@cindex syntax descriptor 101@cindex syntax descriptor
100 A syntax descriptor is a Lisp string that specifies a syntax class, a 102 A syntax descriptor is a Lisp string that specifies a syntax class, a
@@ -106,7 +108,7 @@ character or flags are needed, one character is sufficient.
106 108
107 For example, the syntax descriptor for the character @samp{*} in C 109 For example, the syntax descriptor for the character @samp{*} in C
108mode is @samp{@w{. 23}} (i.e., punctuation, matching character slot 110mode is @samp{@w{. 23}} (i.e., punctuation, matching character slot
109unused, second character of a comment-starter, first character of an 111unused, second character of a comment-starter, first character of a
110comment-ender), and the entry for @samp{/} is @samp{@w{. 14}} (i.e., 112comment-ender), and the entry for @samp{/} is @samp{@w{. 14}} (i.e.,
111punctuation, matching character slot unused, first character of a 113punctuation, matching character slot unused, first character of a
112comment-starter, second character of a comment-ender). 114comment-starter, second character of a comment-ender).
@@ -542,6 +544,10 @@ This function moves point forward across characters having syntax classes
542mentioned in @var{syntaxes}. It stops when it encounters the end of 544mentioned in @var{syntaxes}. It stops when it encounters the end of
543the buffer, or position @var{limit} (if specified), or a character it is 545the buffer, or position @var{limit} (if specified), or a character it is
544not supposed to skip. 546not supposed to skip.
547
548If @var{syntaxes} starts with @samp{^}, then the function skips
549characters whose syntax is @emph{not} in @var{syntaxes}.
550
545The return value is the distance traveled, which is a nonnegative 551The return value is the distance traveled, which is a nonnegative
546integer. 552integer.
547@end defun 553@end defun
@@ -549,8 +555,11 @@ integer.
549@defun skip-syntax-backward syntaxes &optional limit 555@defun skip-syntax-backward syntaxes &optional limit
550This function moves point backward across characters whose syntax 556This function moves point backward across characters whose syntax
551classes are mentioned in @var{syntaxes}. It stops when it encounters 557classes are mentioned in @var{syntaxes}. It stops when it encounters
552the beginning of the buffer, or position @var{limit} (if specified), or a 558the beginning of the buffer, or position @var{limit} (if specified), or
553character it is not supposed to skip. 559a character it is not supposed to skip.
560
561If @var{syntaxes} starts with @samp{^}, then the function skips
562characters whose syntax is @emph{not} in @var{syntaxes}.
554 563
555The return value indicates the distance traveled. It is an integer that 564The return value indicates the distance traveled. It is an integer that
556is zero or less. 565is zero or less.
@@ -856,7 +865,7 @@ category table defines its own categories, but normally these are
856initialized by copying from the standard categories table, so that the 865initialized by copying from the standard categories table, so that the
857standard categories are available in all modes. 866standard categories are available in all modes.
858 867
859 Each category has a name, which is an @sc{ASCII} printing character in 868 Each category has a name, which is an @sc{ascii} printing character in
860the range @w{@samp{ }} to @samp{~}. You specify the name of a category 869the range @w{@samp{ }} to @samp{~}. You specify the name of a category
861when you define it with @code{define-category}. 870when you define it with @code{define-category}.
862 871
diff --git a/lispref/text.texi b/lispref/text.texi
index 840601bc4c8..b5b5c58af2b 100644
--- a/lispref/text.texi
+++ b/lispref/text.texi
@@ -220,6 +220,9 @@ This is the contents of buffer foo
220" 220"
221@end group 221@end group
222@end example 222@end example
223
224When this function is used in the minibuffer, the value does not include
225the prompt.
223@end defun 226@end defun
224 227
225@defun thing-at-point thing 228@defun thing-at-point thing
@@ -275,7 +278,7 @@ and @samp{rara!}. The value is 2 because the first substring is greater
275at the second character. 278at the second character.
276 279
277@example 280@example
278(compare-buffer-substring nil 6 11 nil 16 21) 281(compare-buffer-substrings nil 6 11 nil 16 21)
279 @result{} 2 282 @result{} 2
280@end example 283@end example
281@end defun 284@end defun
@@ -482,6 +485,8 @@ empty. If the buffer is read-only, it signals a @code{buffer-read-only}
482error. Otherwise, it deletes the text without asking for any 485error. Otherwise, it deletes the text without asking for any
483confirmation. It returns @code{nil}. 486confirmation. It returns @code{nil}.
484 487
488In the minibuffer, @code{erase-buffer} does not delete the prompt.
489
485Normally, deleting a large amount of text from a buffer inhibits further 490Normally, deleting a large amount of text from a buffer inhibits further
486auto-saving of that buffer ``because it has shrunk''. However, 491auto-saving of that buffer ``because it has shrunk''. However,
487@code{erase-buffer} does not do this, the idea being that the future 492@code{erase-buffer} does not do this, the idea being that the future
@@ -1790,8 +1795,8 @@ converts the tab into spaces so that it can move precisely to column
1790@var{force}, since there is no way to split them. 1795@var{force}, since there is no way to split them.
1791 1796
1792The argument @var{force} also has an effect if the line isn't long 1797The argument @var{force} also has an effect if the line isn't long
1793enough to reach column @var{column}; in that case, it says to add 1798enough to reach column @var{column}; if it is @code{t}, that means to
1794whitespace at the end of the line to reach that column. 1799add whitespace at the end of the line to reach that column.
1795 1800
1796If @var{column} is not an integer, an error is signaled. 1801If @var{column} is not an integer, an error is signaled.
1797 1802
@@ -2540,14 +2545,31 @@ of the symbol serve as defaults for the properties of the character.
2540@cindex face codes of text 2545@cindex face codes of text
2541@kindex face @r{(text property)} 2546@kindex face @r{(text property)}
2542You can use the property @code{face} to control the font and color of 2547You can use the property @code{face} to control the font and color of
2543text. Its value is a face name or a list of face names. @xref{Faces}, 2548text. @xref{Faces}, for more information.
2544for more information. 2549
2550In the simplest case, the value is a face name. It can also be a list;
2551then each element can be any of these possibilities;
2552
2553@itemize @bullet
2554@item
2555A face name (a symbol or string).
2545 2556
2546If the property value is a list, elements may also have the form 2557@item
2547@code{(foreground-color . @var{color-name})} or @code{(background-color 2558Starting in Emacs 21, a property list of face attributes. This has the
2548. @var{color-name})}. These elements specify just the foreground color 2559form (@var{keyword} @var{value} @dots{}), where each @var{keyword} is a
2549or just the background color; therefore, there is no need to create a 2560face attribute name and @var{value} is a meaningful value for that
2550face for each color that you want to use. 2561attribute. With this feature, you do not need to create a face each
2562time you want to specify a particular attribute for certain text.
2563@xref{Face Attributes}.
2564
2565@item
2566A cons cell of the form @code{(foreground-color . @var{color-name})} or
2567@code{(background-color . @var{color-name})}. These elements specify
2568just the foreground color or just the background color.
2569
2570@code{(foreground-color . @var{color-name})} is equivalent to
2571@code{(:foreground @var{color-name})}, and likewise for the background.
2572@end itemize
2551 2573
2552@xref{Font Lock Mode}, for information on how to update @code{face} 2574@xref{Font Lock Mode}, for information on how to update @code{face}
2553properties automatically based on the contents of the text. 2575properties automatically based on the contents of the text.
@@ -2559,6 +2581,26 @@ mouse is on or near the character. For this purpose, ``near'' means
2559that all text between the character and where the mouse is have the same 2581that all text between the character and where the mouse is have the same
2560@code{mouse-face} property value. 2582@code{mouse-face} property value.
2561 2583
2584@item fontified
2585@kindex fontified @r{(text property)}
2586This property, if non-@code{nil}, says that text in the buffer has
2587had faces assigned automatically by a feature such as Font-Lock mode.
2588@xref{Auto Faces}.
2589
2590@item display
2591@kindex display @r{(text property)}
2592This property activates various features that change the
2593way text is displayed. For example, it can make text appear taller
2594or shorter, higher or lower, wider or narror, or replaced with an image.
2595@xref{Display Property}.
2596
2597@item help-echo
2598@kindex help-echo @r{(text property)}
2599If text has a string as its @code{help-echo} property, then when you
2600move the mouse onto that text, Emacs displays that string in the echo
2601area, or in the tooltip window. This feature is used in the mode line.
2602It is available starting in Emacs 21.
2603
2562@item local-map 2604@item local-map
2563@cindex keymap of character 2605@cindex keymap of character
2564@kindex local-map @r{(text property)} 2606@kindex local-map @r{(text property)}
@@ -3231,7 +3273,7 @@ all markers unrelocated.
3231@cindex base 64 encoding 3273@cindex base 64 encoding
3232 3274
3233 Base 64 code is used in email to encode a sequence of 8-bit bytes as a 3275 Base 64 code is used in email to encode a sequence of 8-bit bytes as a
3234longer sequence of @sc{ASCII} graphic characters. This section 3276longer sequence of @sc{ascii} graphic characters. This section
3235describes the functions for converting to and from this code. 3277describes the functions for converting to and from this code.
3236 3278
3237@defun base64-encode-region beg end &optional no-line-break 3279@defun base64-encode-region beg end &optional no-line-break
@@ -3377,3 +3419,14 @@ to call. Here is an example:
3377This variable is a normal hook that is run whenever a buffer is changed 3419This variable is a normal hook that is run whenever a buffer is changed
3378that was previously in the unmodified state. 3420that was previously in the unmodified state.
3379@end defvar 3421@end defvar
3422
3423@defvar inhibit-modification-hooks
3424@tindex inhibit-modification-hooks
3425If this variable is non-@code{nil}, all of the change hooks are
3426disabled; none of them run. This affects all the hook variables
3427described above in this section, as well as the hooks attached to
3428certain special text properties (@pxref{Special Properties}) and overlay
3429properties (@pxref{Overlay Properties}).
3430
3431This variable is available starting in Emacs 21.
3432@end defvar
diff --git a/lispref/tips.texi b/lispref/tips.texi
index 5e7ac75302b..5ce4c437176 100644
--- a/lispref/tips.texi
+++ b/lispref/tips.texi
@@ -14,6 +14,12 @@ it gives advice on making effective use of the features described in the
14previous chapters, and describes conventions Emacs Lisp programmers 14previous chapters, and describes conventions Emacs Lisp programmers
15should follow. 15should follow.
16 16
17 You can automatically check some of the conventions described below by
18running the command @kbd{M-x checkdoc RET} when visiting a Lisp file.
19It cannot check all of the conventions, and not all the warnings it
20gives necessarily correspond to problems, but it is worth examining them
21all.
22
17@menu 23@menu
18* Coding Conventions:: Conventions for clean and robust programs. 24* Coding Conventions:: Conventions for clean and robust programs.
19* Compilation Tips:: Making compiled code run fast. 25* Compilation Tips:: Making compiled code run fast.
@@ -287,6 +293,17 @@ coherent if all libraries use the same conventions.
287Try to avoid compiler warnings about undefined free variables, by adding 293Try to avoid compiler warnings about undefined free variables, by adding
288@code{defvar} definitions for these variables. 294@code{defvar} definitions for these variables.
289 295
296Sometimes adding a @code{require} for another package is useful to avoid
297compilation warnings for variables and functions defined in that
298package. If you do this, often it is better if the @cpde{require} acts
299only at compile time. Here's how to do that:
300
301@example
302(eval-when-compile
303 (require 'foo)
304 (defvar bar-baz))
305@end example
306
290If you bind a variable in one function, and use it or set it in another 307If you bind a variable in one function, and use it or set it in another
291function, the compiler warns about the latter function unless the 308function, the compiler warns about the latter function unless the
292variable has a definition. But often these variables have short names, 309variable has a definition. But often these variables have short names,
@@ -421,12 +438,12 @@ should be made up of complete sentences also, but they may be filled if
421that looks good. 438that looks good.
422 439
423@item 440@item
424For consistency, phrase the verb in the first sentence of a 441For consistency, phrase the verb in the first sentence of a function's
425function's documentation string as an infinitive with ``to'' omitted. For 442documentation string as an imperative--for instance, use ``Return the
426instance, use ``Return the cons of A and B.'' in preference to ``Returns 443cons of A and B.'' in preference to ``Returns the cons of A and B@.''
427the cons of A and B@.'' Usually it looks good to do likewise for the 444Usually it looks good to do likewise for the rest of the first
428rest of the first paragraph. Subsequent paragraphs usually look better 445paragraph. Subsequent paragraphs usually look better if each sentence
429if they have proper subjects. 446has a proper subject.
430 447
431@item 448@item
432Write documentation strings in the active voice, not the passive, and in 449Write documentation strings in the active voice, not the passive, and in
@@ -485,9 +502,15 @@ a name for that value. Thus, the documentation string of the function
485@code{/} refers to its second argument as @samp{DIVISOR}, because the 502@code{/} refers to its second argument as @samp{DIVISOR}, because the
486actual argument name is @code{divisor}. 503actual argument name is @code{divisor}.
487 504
488Also use all caps for meta-syntactic variables, such as when you show 505Also use all caps for metasyntactic variables, such as when you show
489the decomposition of a list or vector into subunits, some of which may 506the decomposition of a list or vector into subunits, some of which may
490vary. 507vary. @samp{KEY} and @samp{VALUE} in the following example
508illustrate this practice:
509
510@example
511The argument TABLE should be an alist whose elements
512have the form (KEY . VALUE). Here, KEY is ...
513@end example
491 514
492@item 515@item
493@iftex 516@iftex
@@ -537,6 +560,14 @@ that satisfy the criterion.
537does not make a hyperlink to the documentation, irrelevant here, of the 560does not make a hyperlink to the documentation, irrelevant here, of the
538function @code{list}. 561function @code{list}.
539 562
563To make a hyperlink to Info documentation, write the name of the Info
564node in single quotes, preceded by @samp{info node} or @samp{Info
565node}. The Info file name defaults to @samp{emacs}. For example,
566
567@smallexample
568See Info node `Font Lock' and Info node `(elisp)Font Lock Basics'.
569@end smallexample
570
540@item 571@item
541Don't write key sequences directly in documentation strings. Instead, 572Don't write key sequences directly in documentation strings. Instead,
542use the @samp{\\[@dots{}]} construct to stand for them. For example, 573use the @samp{\\[@dots{}]} construct to stand for them. For example,
@@ -659,7 +690,21 @@ Manipulating Comments, emacs, The GNU Emacs Manual}.
659 690
660 Emacs has conventions for using special comments in Lisp libraries 691 Emacs has conventions for using special comments in Lisp libraries
661to divide them into sections and give information such as who wrote 692to divide them into sections and give information such as who wrote
662them. This section explains these conventions. First, an example: 693them. This section explains these conventions.
694
695 We'll start with an example, a package that is included in the Emacs
696distribution.
697
698 Parts of this example reflect its status as part of Emacs; for
699example, the copyright notice lists the Free Software Foundation as the
700copyright holder, and the copying permission says the file is part of
701Emacs. When you write a package and post it, the copyright holder would
702be you (unless your employer claims to own it instead), and you should
703get the suggested copying permission from the end of the GNU General
704Public License itself. Don't say your file is part of Emacs
705if we haven't installed it in Emacs yet!
706
707 With that warning out of the way, on to the example:
663 708
664@smallexample 709@smallexample
665@group 710@group
@@ -773,7 +818,8 @@ This begins change log information stored in the library file (if you
773store the change history there). For most of the Lisp 818store the change history there). For most of the Lisp
774files distributed with Emacs, the change history is kept in the file 819files distributed with Emacs, the change history is kept in the file
775@file{ChangeLog} and not in the source file at all; these files do 820@file{ChangeLog} and not in the source file at all; these files do
776not have a @samp{;;; Change Log:} line. 821not have a @samp{;;; Change Log:} line. @samp{History} is an
822alternative to @samp{Change Log}.
777 823
778@item ;;; Code: 824@item ;;; Code:
779This begins the actual code of the program. 825This begins the actual code of the program.
diff --git a/lispref/variables.texi b/lispref/variables.texi
index 4d46e19d0dc..b37af877b3c 100644
--- a/lispref/variables.texi
+++ b/lispref/variables.texi
@@ -94,7 +94,7 @@ x
94@end example 94@end example
95 95
96@node Constant Variables 96@node Constant Variables
97@section Variables That Never Change 97@section Variables that Never Change
98@vindex nil 98@vindex nil
99@vindex t 99@vindex t
100@kindex setting-constant 100@kindex setting-constant
@@ -104,8 +104,8 @@ 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 a symbol to 107starts with @samp{:} (if it is interned in the standard obarray), except
108itself. 108that you are allowed to set such a symbol to itself.
109 109
110@example 110@example
111@group 111@group
@@ -563,8 +563,9 @@ then the variable is a user option.
563 If a user option variable has a @code{variable-interactive} property, 563 If a user option variable has a @code{variable-interactive} property,
564the @code{set-variable} command uses that value to control reading the 564the @code{set-variable} command uses that value to control reading the
565new 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
566to @code{interactive} (@pxref{Using Interactive}). However, this feature 566specified in @code{interactive} (@pxref{Using Interactive}). However,
567is largely obsoleted by @code{defcustom} (@pxref{Customization}). 567this feature is largely obsoleted by @code{defcustom}
568(@pxref{Customization}).
568 569
569 @strong{Warning:} If the @code{defconst} and @code{defvar} special 570 @strong{Warning:} If the @code{defconst} and @code{defvar} special
570forms are used while the variable has a local binding, they set the 571forms are used while the variable has a local binding, they set the
@@ -606,8 +607,7 @@ variable. Here's a safe way to avoid that:
606@example 607@example
607(defvar my-mode-map nil 608(defvar my-mode-map nil
608 @var{docstring}) 609 @var{docstring})
609(if my-mode-map 610(unless my-mode-map
610 nil
611 (let ((map (make-sparse-keymap))) 611 (let ((map (make-sparse-keymap)))
612 (define-key my-mode-map "\C-c\C-a" 'my-command) 612 (define-key my-mode-map "\C-c\C-a" 'my-command)
613 @dots{} 613 @dots{}
@@ -624,8 +624,7 @@ each form, if you do want to reinitialize the variable.
624@example 624@example
625(defvar my-mode-map nil 625(defvar my-mode-map nil
626 @var{docstring}) 626 @var{docstring})
627(if my-mode-map 627(unless my-mode-map
628 nil
629 (setq my-mode-map (make-sparse-keymap)) 628 (setq my-mode-map (make-sparse-keymap))
630 (define-key my-mode-map "\C-c\C-a" 'my-command) 629 (define-key my-mode-map "\C-c\C-a" 'my-command)
631 @dots{}) 630 @dots{})
@@ -854,10 +853,10 @@ the others.
854@cindex dynamic scoping 853@cindex dynamic scoping
855 Local bindings in Emacs Lisp have @dfn{indefinite scope} and 854 Local bindings in Emacs Lisp have @dfn{indefinite scope} and
856@dfn{dynamic extent}. @dfn{Scope} refers to @emph{where} textually in 855@dfn{dynamic extent}. @dfn{Scope} refers to @emph{where} textually in
857the source code the binding can be accessed. Indefinite scope means 856the source code the binding can be accessed. ``Indefinite scope'' means
858that any part of the program can potentially access the variable 857that any part of the program can potentially access the variable
859binding. @dfn{Extent} refers to @emph{when}, as the program is 858binding. @dfn{Extent} refers to @emph{when}, as the program is
860executing, the binding exists. Dynamic extent means that the binding 859executing, the binding exists. ``Dynamic extent'' means that the binding
861lasts as long as the activation of the construct that established it. 860lasts as long as the activation of the construct that established it.
862 861
863 The combination of dynamic extent and indefinite scope is called 862 The combination of dynamic extent and indefinite scope is called
@@ -902,9 +901,9 @@ definitions:
902 In a lexically scoped language, the binding of @code{x} in 901 In a lexically scoped language, the binding of @code{x} in
903@code{binder} would never be accessible in @code{user}, because 902@code{binder} would never be accessible in @code{user}, because
904@code{user} is not textually contained within the function 903@code{user} is not textually contained within the function
905@code{binder}. However, in dynamically scoped Emacs Lisp, @code{user} 904@code{binder}. However, in dynamically-scoped Emacs Lisp, @code{user}
906may or may not refer to the binding of @code{x} established in 905may or may not refer to the binding of @code{x} established in
907@code{binder}, depending on circumstances: 906@code{binder}, depending on the circumstances:
908 907
909@itemize @bullet 908@itemize @bullet
910@item 909@item
@@ -1065,9 +1064,9 @@ use short names like @code{x}.
1065@cindex buffer-local variables 1064@cindex buffer-local variables
1066 1065
1067 Global and local variable bindings are found in most programming 1066 Global and local variable bindings are found in most programming
1068languages in one form or another. Emacs also supports additional, 1067languages in one form or another. Emacs, however, also supports additional,
1069unusual kinds of variable binding: @dfn{buffer-local} bindings, which 1068unusual kinds of variable binding: @dfn{buffer-local} bindings, which
1070apply only in one buffer, and frame-local bindings, which apply only in 1069apply only in one buffer, and @dfn{frame-local} bindings, which apply only in
1071one frame. Having different values for a variable in different buffers 1070one frame. Having different values for a variable in different buffers
1072and/or frames is an important customization method. 1071and/or frames is an important customization method.
1073 1072
@@ -1100,7 +1099,7 @@ this is the global binding.
1100 A variable can have buffer-local bindings in some buffers but not in 1099 A variable can have buffer-local bindings in some buffers but not in
1101other buffers. The default binding is shared by all the buffers that 1100other buffers. The default binding is shared by all the buffers that
1102don't have their own bindings for the variable. (This includes all 1101don't have their own bindings for the variable. (This includes all
1103newly created buffers.) If you set the variable in a buffer that does 1102newly-created buffers.) If you set the variable in a buffer that does
1104not have a buffer-local binding for it, this sets the default binding 1103not have a buffer-local binding for it, this sets the default binding
1105(assuming there are no frame-local bindings to complicate the matter), 1104(assuming there are no frame-local bindings to complicate the matter),
1106so the new value is visible in all the buffers that see the default 1105so the new value is visible in all the buffers that see the default
@@ -1239,7 +1238,7 @@ If the variable is terminal-local, this function signals an error. Such
1239variables cannot have buffer-local bindings as well. @xref{Multiple 1238variables cannot have buffer-local bindings as well. @xref{Multiple
1240Displays}. 1239Displays}.
1241 1240
1242@strong{Note:} do not use @code{make-local-variable} for a hook 1241@strong{Note:} Do not use @code{make-local-variable} for a hook
1243variable. Instead, use @code{make-local-hook}. @xref{Hooks}. 1242variable. Instead, use @code{make-local-hook}. @xref{Hooks}.
1244@end deffn 1243@end deffn
1245 1244
diff --git a/lispref/windows.texi b/lispref/windows.texi
index 29307467d42..5596a597ca4 100644
--- a/lispref/windows.texi
+++ b/lispref/windows.texi
@@ -23,8 +23,9 @@ displayed in windows.
23* Window Point:: Each window has its own location of point. 23* Window Point:: Each window has its own location of point.
24* Window Start:: The display-start position controls which text 24* Window Start:: The display-start position controls which text
25 is on-screen in the window. 25 is on-screen in the window.
26* Vertical Scrolling:: Moving text up and down in the window. 26* Textual Scrolling:: Moving text up and down through the window.
27* Horizontal Scrolling:: Moving text sideways on the window. 27* Vertical Scrolling:: Moving the contents up and down on the window.
28* Horizontal Scrolling:: Moving the contents sideways on the window.
28* Size of Window:: Accessing the size of a window. 29* Size of Window:: Accessing the size of a window.
29* Resizing Windows:: Changing the size of a window. 30* Resizing Windows:: Changing the size of a window.
30* Coordinates and Windows:: Converting coordinates to windows. 31* Coordinates and Windows:: Converting coordinates to windows.
@@ -251,40 +252,32 @@ characters. The display table can specify alternative border
251characters; see @ref{Display Tables}. 252characters; see @ref{Display Tables}.
252@end deffn 253@end deffn
253 254
254@deffn Command split-window-vertically size 255@deffn Command split-window-vertically &optional size
255This function splits the selected window into two windows, one above the 256This function splits the selected window into two windows, one above the
256other, leaving the upper of the two windows selected, with @var{size} 257other, leaving the upper of the two windows selected, with @var{size}
257lines. (If @var{size} is negative, then the lower of the two windows 258lines. (If @var{size} is negative, then the lower of the two windows
258gets @minus{} @var{size} lines and the upper window gets the rest, but 259gets @minus{} @var{size} lines and the upper window gets the rest, but
259the upper window is still the one selected.) 260the upper window is still the one selected.)
260
261This function is simply an interface to @code{split-window}.
262Here is the complete function definition for it:
263
264@smallexample
265@group
266(defun split-window-vertically (&optional arg)
267 "Split current window into two windows, @dots{}"
268 (interactive "P")
269 (split-window nil (and arg (prefix-numeric-value arg))))
270@end group
271@end smallexample
272@end deffn 261@end deffn
273 262
274@deffn Command split-window-horizontally size 263@deffn Command split-window-horizontally size
275This function splits the selected window into two windows 264This function splits the selected window into two windows
276side-by-side, leaving the selected window with @var{size} columns. 265side-by-side, leaving the selected window with @var{size} columns.
277 266
278This function is simply an interface to @code{split-window}. Here is 267This function is basically an interface to @code{split-window}.
279the complete definition for @code{split-window-horizontally} (except for 268You could define a simplified version of the function like this:
280part of the documentation string):
281 269
282@smallexample 270@smallexample
283@group 271@group
284(defun split-window-horizontally (&optional arg) 272(defun split-window-horizontally (&optional arg)
285 "Split selected window into two windows, side by side..." 273 "Split selected window into two windows, side by side..."
286 (interactive "P") 274 (interactive "P")
287 (split-window nil (and arg (prefix-numeric-value arg)) t)) 275@endgroup
276@group
277 (let ((size (and arg (prefix-numeric-value arg))))
278 (and size (< size 0)
279 (setq size (+ (window-width) size)))
280 (split-window nil size t)))
288@end group 281@end group
289@end smallexample 282@end smallexample
290@end deffn 283@end deffn
@@ -565,11 +558,15 @@ ordering of windows. The other arguments specify which windows to
565include in the cycle, as in @code{next-window}. 558include in the cycle, as in @code{next-window}.
566@end defun 559@end defun
567 560
568@deffn Command other-window count 561@deffn Command other-window count &optional all-frames
569This function selects the @var{count}th following window in the cyclic 562This function selects the @var{count}th following window in the cyclic
570order. If count is negative, then it moves back @minus{}@var{count} 563order. If count is negative, then it moves back @minus{}@var{count}
571windows in the cycle, rather than forward. It returns @code{nil}. 564windows in the cycle, rather than forward. It returns @code{nil}.
572 565
566The argument @var{all-frames} has the same meaning is as in
567@code{next-window}, but the @var{minibuf} argument of @code{next-window}
568is always effectively @code{nil}.
569
573In an interactive call, @var{count} is the numeric prefix argument. 570In an interactive call, @var{count} is the numeric prefix argument.
574@end deffn 571@end deffn
575 572
@@ -895,11 +892,11 @@ variable is a function that creates a frame using parameters from
895@code{pop-up-frame-alist}. 892@code{pop-up-frame-alist}.
896@end defvar 893@end defvar
897 894
898@defvar pop-up-frame-alist 895@defopt pop-up-frame-alist
899This variable holds an alist specifying frame parameters used when 896This variable holds an alist specifying frame parameters used when
900@code{display-buffer} makes a new frame. @xref{Frame Parameters}, for 897@code{display-buffer} makes a new frame. @xref{Frame Parameters}, for
901more information about frame parameters. 898more information about frame parameters.
902@end defvar 899@end defopt
903 900
904@defopt special-display-buffer-names 901@defopt special-display-buffer-names
905A list of buffer names for buffers that should be displayed specially. 902A list of buffer names for buffers that should be displayed specially.
@@ -938,16 +935,24 @@ The default value of this variable is
938@code{special-display-popup-frame}. 935@code{special-display-popup-frame}.
939@end defvar 936@end defvar
940 937
941@defun special-display-popup-frame buffer 938@defun special-display-popup-frame buffer &rest args
942This function makes @var{buffer} visible in a frame of its own. If 939This function makes @var{buffer} visible in a frame of its own. If
943@var{buffer} is already displayed in a window in some frame, it makes 940@var{buffer} is already displayed in a window in some frame, it makes
944the frame visible and raises it, to use that window. Otherwise, it 941the frame visible and raises it, to use that window. Otherwise, it
945creates a frame that will be dedicated to @var{buffer}. 942creates a frame that will be dedicated to @var{buffer}.
946 943
947This function uses an existing window displaying @var{buffer} whether or 944If @var{args} is an alist, it specifies frame parameters for the new
948not it is in a frame of its own; but if you set up the above variables 945frame.
949in your init file, before @var{buffer} was created, then presumably the 946
950window was previously made by this function. 947If @var{args} is a list whose @sc{car} is a symbol, then @code{(car
948@var{args})} is called as a function to actually create and set up the
949frame; it is called with @var{buffer} as first argument, and @code{(cdr
950@var{args})} as additional arguments.
951
952This function always uses an existing window displaying @var{buffer},
953whether or not it is in a frame of its own; but if you set up the above
954variables in your init file, before @var{buffer} was created, then
955presumably the window was previously made by this function.
951@end defun 956@end defun
952 957
953@defopt special-display-frame-alist 958@defopt special-display-frame-alist
@@ -1035,10 +1040,11 @@ point and the buffer's point always move together; they remain equal.
1035when the user switches to another buffer, the cursor jumps to the 1040when the user switches to another buffer, the cursor jumps to the
1036position of point in that buffer. 1041position of point in that buffer.
1037 1042
1038@defun window-point window 1043@defun window-point &optional window
1039This function returns the current position of point in @var{window}. 1044This function returns the current position of point in @var{window}.
1040For a nonselected window, this is the value point would have (in that 1045For a nonselected window, this is the value point would have (in that
1041window's buffer) if that window were selected. 1046window's buffer) if that window were selected. If @var{window} is
1047@code{nil}, the selected window is used.
1042 1048
1043When @var{window} is the selected window and its buffer is also the 1049When @var{window} is the selected window and its buffer is also the
1044current buffer, the value returned is the same as point in that buffer. 1050current buffer, the value returned is the same as point in that buffer.
@@ -1081,10 +1087,11 @@ display-start position is set to a display-start position recently used
1081for the same buffer, or 1 if the buffer doesn't have any. 1087for the same buffer, or 1 if the buffer doesn't have any.
1082 1088
1083Redisplay updates the window-start position (if you have not specified 1089Redisplay updates the window-start position (if you have not specified
1084it explicitly since the previous redisplay) so that point appears on the 1090it explicitly since the previous redisplay)---for example, to make sure
1085screen. Nothing except redisplay automatically changes the window-start 1091point appears on the screen. Nothing except redisplay automatically
1086position; if you move point, do not expect the window-start position to 1092changes the window-start position; if you move point, do not expect the
1087change in response until after the next redisplay. 1093window-start position to change in response until after the next
1094redisplay.
1088 1095
1089For a realistic example of using @code{window-start}, see the 1096For a realistic example of using @code{window-start}, see the
1090description of @code{count-lines} in @ref{Text Lines}. 1097description of @code{count-lines} in @ref{Text Lines}.
@@ -1188,18 +1195,22 @@ argument @var{position} defaults to the current position of point;
1188The @code{pos-visible-in-window-p} function considers only vertical 1195The @code{pos-visible-in-window-p} function considers only vertical
1189scrolling. If @var{position} is out of view only because @var{window} 1196scrolling. If @var{position} is out of view only because @var{window}
1190has been scrolled horizontally, @code{pos-visible-in-window-p} returns 1197has been scrolled horizontally, @code{pos-visible-in-window-p} returns
1191@code{t}. @xref{Horizontal Scrolling}. 1198@code{t} anyway. @xref{Horizontal Scrolling}.
1192@end defun 1199@end defun
1193 1200
1194@node Vertical Scrolling 1201@node Textual Scrolling
1195@section Vertical Scrolling 1202@section Textual Scrolling
1196@cindex vertical scrolling 1203@cindex textual scrolling
1197@cindex scrolling vertically 1204@cindex scrolling textually
1205
1206 @dfn{Textual scrolling} means moving the text up or down though a
1207window. It works by changing the value of the window's display-start
1208location. It may also change the value of @code{window-point} to keep
1209point on the screen.
1198 1210
1199 Vertical scrolling means moving the text up or down in a window. It 1211 Textual scrolling was formerly called ``vertical scrolling,'' but we
1200works by changing the value of the window's display-start location. It 1212changed its name to distinguish it from the new vertical fractional
1201may also change the value of @code{window-point} to keep it on the 1213scrolling feature (@pxref{Vertical Scrolling}).
1202screen.
1203 1214
1204 In the commands @code{scroll-up} and @code{scroll-down}, the directions 1215 In the commands @code{scroll-up} and @code{scroll-down}, the directions
1205``up'' and ``down'' refer to the motion of the text in the buffer at which 1216``up'' and ``down'' refer to the motion of the text in the buffer at which
@@ -1218,9 +1229,10 @@ position of a window on the terminal does not move, and short scrolling
1218commands clearly move the text up or down on the screen. We have chosen 1229commands clearly move the text up or down on the screen. We have chosen
1219names that fit the user's point of view. 1230names that fit the user's point of view.
1220 1231
1221 The scrolling functions (aside from @code{scroll-other-window}) have 1232 The textual scrolling functions (aside from
1222unpredictable results if the current buffer is different from the buffer 1233@code{scroll-other-window}) have unpredictable results if the current
1223that is displayed in the selected window. @xref{Current Buffer}. 1234buffer is different from the buffer that is displayed in the selected
1235window. @xref{Current Buffer}.
1224 1236
1225@deffn Command scroll-up &optional count 1237@deffn Command scroll-up &optional count
1226This function scrolls the text in the selected window upward 1238This function scrolls the text in the selected window upward
@@ -1251,10 +1263,14 @@ This function scrolls the text in another window upward @var{count}
1251lines. Negative values of @var{count}, or @code{nil}, are handled 1263lines. Negative values of @var{count}, or @code{nil}, are handled
1252as in @code{scroll-up}. 1264as in @code{scroll-up}.
1253 1265
1254You can specify a buffer to scroll with the variable 1266You can specify which buffer to scroll by setting the variable
1255@code{other-window-scroll-buffer}. When the selected window is the 1267@code{other-window-scroll-buffer} to a buffer. If that buffer isn't
1256minibuffer, the next window is normally the one at the top left corner. 1268already displayed, @code{scroll-other-window} displays it in some
1257You can specify a different window to scroll with the variable 1269window.
1270
1271When the selected window is the minibuffer, the next window is normally
1272the one at the top left corner. You can specify a different window to
1273scroll, when the minibuffer is selected, by setting the variable
1258@code{minibuffer-scroll-window}. This variable has no effect when any 1274@code{minibuffer-scroll-window}. This variable has no effect when any
1259other window is selected. @xref{Minibuffer Misc}. 1275other window is selected. @xref{Minibuffer Misc}.
1260 1276
@@ -1353,43 +1369,122 @@ Replaces three keystroke sequence C-u 0 C-l."
1353@end example 1369@end example
1354@end deffn 1370@end deffn
1355 1371
1372@node Vertical Scrolling
1373@section Vertical Fractional Scrolling
1374@cindex Vertical Fractional Scrolling
1375
1376 @dfn{Vertical fractional scrolling} means shifting the image in the
1377window up or down by a specified multiple or fraction of a line.
1378Starting in Emacs 21, each window has a @dfn{vertical scroll position},
1379which is a number, never less than zero. It specifies how far to raise
1380the contents of the window. Raising the window contents generally makes
1381all or part of some lines disappear off the top, and all or part of some
1382other lines appear at the bottom. The usual value is zero.
1383
1384 The vertical scroll position is measured in units of the normal line
1385height, which is the height of the default font. Thus, if the value is
1386.5, that means the window contents are scrolled up half the normal line
1387height. If it is 3.3, that means the window contents are scrolled up
1388somewhat over three times the normal line height.
1389
1390 What fraction of a line the vertical scrolling covers, or how many
1391lines, depends on what the lines contain. A value of .5 could scroll a
1392line whose height is very short off the screen, while a value of 3.3
1393could scroll just part of the way through a tall line or an image.
1394
1395@defun window-vscroll &optional window
1396This function returns the current vertical scroll position of
1397@var{window}, If @var{window} is @code{nil}, the selected window is
1398used.
1399
1400@example
1401@group
1402(window-vscroll)
1403 @result{} 0
1404@end group
1405@end example
1406@end defun
1407
1408@defun set-window-vscroll window lines
1409This function sets @var{window}'s vertical scroll position to
1410@var{lines}. The argument @var{lines} should be zero or positive; if
1411not, it is taken as zero.
1412
1413The actual vertical scroll position must always correspond
1414to an integral number of pixels, so the value you specify
1415is rounded accordingly.
1416
1417The return value is the result of this rounding.
1418
1419@example
1420@group
1421(set-window-vscroll (selected-window) 1.2)
1422 @result{} 1.13
1423@end group
1424@end example
1425@end defun
1426
1356@node Horizontal Scrolling 1427@node Horizontal Scrolling
1357@section Horizontal Scrolling 1428@section Horizontal Scrolling
1358@cindex horizontal scrolling 1429@cindex horizontal scrolling
1359 1430
1360 Because we read English from left to right in the ``inner loop'', and 1431 @dfn{Horizontal scrolling} means shifting the image in the window left
1361from top to bottom in the ``outer loop'', horizontal scrolling is not 1432or right by a specified multiple of the normal character width. Each
1362like vertical scrolling. Vertical scrolling involves selection of a 1433window has a @dfn{vertical scroll position}, which is a number, never
1363contiguous portion of text to display, but horizontal scrolling causes 1434less than zero. It specifies how far to shift the contents left.
1364part of each line to go off screen. The amount of horizontal scrolling 1435Shifting the window contents left generally makes all or part of some
1365is therefore specified as a number of columns rather than as a position 1436characters disappear off the left, and all or part of some other
1366in the buffer. It has nothing to do with the display-start position 1437characters appear at the right. The usual value is zero.
1367returned by @code{window-start}. 1438
1439 The horizontal scroll position is measured in units of the normal
1440character width, which is the width of space in the default font. Thus,
1441if the value is 5, that means the window contents are scrolled left by 5
1442times the the normal character width. How many characters actually
1443disappear off to the left depends on their width, and could vary from
1444line to line.
1445
1446 Because we read from side to side in the ``inner loop'', and from top
1447to bottom in the ``outer loop'', the effect of horizontal scrolling is
1448not like that of textual or vertical scrolling. Textual scrolling
1449involves selection of a portion of text to display, and vertical
1450scrolling moves the window contents contiguously; but horizontal
1451scrolling causes part of @emph{each line} to go off screen.
1368 1452
1369 Usually, no horizontal scrolling is in effect; then the leftmost 1453 Usually, no horizontal scrolling is in effect; then the leftmost
1370column is at the left edge of the window. In this state, scrolling to 1454column is at the left edge of the window. In this state, scrolling to
1371the right is meaningless, since there is no data to the left of the 1455the right is meaningless, since there is no data to the left of the edge
1372screen to be revealed by it; so this is not allowed. Scrolling to the 1456to be revealed by it; so this is not allowed. Scrolling to the left is
1373left is allowed; it scrolls the first columns of text off the edge of 1457allowed; it scrolls the first columns of text off the edge of the window
1374the window and can reveal additional columns on the right that were 1458and can reveal additional columns on the right that were truncated
1375truncated before. Once a window has a nonzero amount of leftward 1459before. Once a window has a nonzero amount of leftward horizontal
1376horizontal scrolling, you can scroll it back to the right, but only so 1460scrolling, you can scroll it back to the right, but only so far as to
1377far as to reduce the net horizontal scroll to zero. There is no limit 1461reduce the net horizontal scroll to zero. There is no limit to how far
1378to how far left you can scroll, but eventually all the text will 1462left you can scroll, but eventually all the text will disappear off the
1379disappear off the left edge. 1463left edge.
1380 1464
1381@deffn Command scroll-left count 1465 In Emacs 21, redisplay automatically alters the horizontal scrolling
1466of a window as necessary to ensure that point is always visible.
1467However, you can still set the horizontal scrolling value explicitly.
1468The value you specify will be used, provided it leaves point visible.
1469
1470@deffn Command scroll-left &optional count
1382This function scrolls the selected window @var{count} columns to the 1471This function scrolls the selected window @var{count} columns to the
1383left (or to the right if @var{count} is negative). The return value is 1472left (or to the right if @var{count} is negative). The default
1384the total amount of leftward horizontal scrolling in effect after the 1473for @var{count} is the window width, minus 2.
1385change---just like the value returned by @code{window-hscroll} (below). 1474
1475The return value is the total amount of leftward horizontal scrolling in
1476effect after the change---just like the value returned by
1477@code{window-hscroll} (below).
1386@end deffn 1478@end deffn
1387 1479
1388@deffn Command scroll-right count 1480@deffn Command scroll-right &optional count
1389This function scrolls the selected window @var{count} columns to the 1481This function scrolls the selected window @var{count} columns to the
1390right (or to the left if @var{count} is negative). The return value is 1482right (or to the left if @var{count} is negative). The default
1391the total amount of leftward horizontal scrolling in effect after the 1483for @var{count} is the window width, minus 2.
1392change---just like the value returned by @code{window-hscroll} (below). 1484
1485The return value is the total amount of leftward horizontal scrolling in
1486effect after the change---just like the value returned by
1487@code{window-hscroll} (below).
1393 1488
1394Once you scroll a window as far right as it can go, back to its normal 1489Once you scroll a window as far right as it can go, back to its normal
1395position where the total leftward scrolling is zero, attempts to scroll 1490position where the total leftward scrolling is zero, attempts to scroll
@@ -1426,6 +1521,7 @@ If @var{window} is @code{nil}, the selected window is used.
1426This function sets the number of columns from the left margin that 1521This function sets the number of columns from the left margin that
1427@var{window} is scrolled from the value of @var{columns}. The argument 1522@var{window} is scrolled from the value of @var{columns}. The argument
1428@var{columns} should be zero or positive; if not, it is taken as zero. 1523@var{columns} should be zero or positive; if not, it is taken as zero.
1524Fractional values of @var{columns} are not supported at present.
1429 1525
1430The value returned is @var{columns}. 1526The value returned is @var{columns}.
1431 1527
@@ -1516,12 +1612,12 @@ the frame. The element @var{right} of the value is one more than the
1516rightmost column used by @var{window}, and @var{bottom} is one more than 1612rightmost column used by @var{window}, and @var{bottom} is one more than
1517the bottommost row used by @var{window} and its mode-line. 1613the bottommost row used by @var{window} and its mode-line.
1518 1614
1519When you have side-by-side windows, the right edge value for a window 1615If a window has a scroll bar, the right edge value includes the width of
1520with a neighbor on the right includes the width of the separator between 1616the scroll bar. Otherwise, if the window has a neighbor on the right,
1521the window and that neighbor. This separator may be a column of 1617its right edge value includes the width of the separator line between
1522@samp{|} characters or it may be a scroll bar. Since the width of the 1618the window and that neighbor. Since the width of the window does not
1523window does not include this separator, the width does not equal the 1619include this separator, the width does not usually equal the difference
1524difference between the right and left edges in this case. 1620between the right and left edges.
1525 1621
1526Here is the result obtained on a typical 24-line terminal with just one 1622Here is the result obtained on a typical 24-line terminal with just one
1527window: 1623window:
@@ -1538,14 +1634,12 @@ The bottom edge is at line 23 because the last line is the echo area.
1538 1634
1539If @var{window} is at the upper left corner of its frame, then 1635If @var{window} is at the upper left corner of its frame, then
1540@var{bottom} is the same as the value of @code{(window-height)}, 1636@var{bottom} is the same as the value of @code{(window-height)},
1541@var{right} is almost the same as the value of 1637@var{right} is almost the same as the value of @code{(window-width)},
1542@code{(window-width)}@footnote{They are not exactly equal because 1638and @var{top} and @var{left} are zero. For example, the edges of the
1543@var{right} includes the vertical separator line or scroll bar, while 1639following window are @w{@samp{0 0 8 5}}. Assuming that the frame has
1544@code{(window-width)} does not.}, and @var{top} and @var{left} are zero. 1640more than 8 columns, the last column of the window (column 7) holds a
1545For example, the edges of the following window are @w{@samp{0 0 5 8}}. 1641border rather than text. The last row (row 4) holds the mode line,
1546Assuming that the frame has more than 8 columns, the last column of the 1642shown here with @samp{xxxxxxxxx}.
1547window (column 7) holds a border rather than text. The last row (row 4)
1548holds the mode line, shown here with @samp{xxxxxxxxx}.
1549 1643
1550@example 1644@example
1551@group 1645@group
@@ -1561,15 +1655,9 @@ holds the mode line, shown here with @samp{xxxxxxxxx}.
1561@end group 1655@end group
1562@end example 1656@end example
1563 1657
1564When there are side-by-side windows, any window not at the right edge of
1565its frame has a separator in its last column or columns. The separator
1566counts as one or two columns in the width of the window. A window never
1567includes a separator on its left, since that belongs to the window to
1568the left.
1569
1570In the following example, let's suppose that the frame is 7 1658In the following example, let's suppose that the frame is 7
1571columns wide. Then the edges of the left window are @w{@samp{0 0 4 3}} 1659columns wide. Then the edges of the left window are @w{@samp{0 0 4 3}}
1572and the edges of the right window are @w{@samp{4 0 7 3}}. 1660and the edges of the right window are @w{@samp{4 0 8 3}}.
1573 1661
1574@example 1662@example
1575@group 1663@group
@@ -1610,6 +1698,13 @@ If the requested size would exceed that of the window's frame, then the
1610function makes the window occupy the entire height (or width) of the 1698function makes the window occupy the entire height (or width) of the
1611frame. 1699frame.
1612 1700
1701If there are various other windows from which lines or columns can be
1702stolen, and some of them specify fixed size (using
1703@code{window-size-fixed}, see below), they are left untouched while
1704other windows are ``robbed.'' If it would be necessary to alter the
1705size of a fixed-size window, @code{enlarge-window} gets an error
1706instead.
1707
1613If @var{size} is negative, this function shrinks the window by 1708If @var{size} is negative, this function shrinks the window by
1614@minus{}@var{size} lines or columns. If that makes the window smaller 1709@minus{}@var{size} lines or columns. If that makes the window smaller
1615than the minimum size (@code{window-min-height} and 1710than the minimum size (@code{window-min-height} and
@@ -1652,10 +1747,11 @@ It could be defined as follows:
1652@end example 1747@end example
1653@end deffn 1748@end deffn
1654 1749
1655@deffn Command shrink-window-if-larger-than-buffer window 1750@deffn Command shrink-window-if-larger-than-buffer &optional window
1656This command shrinks @var{window} to be as small as possible while still 1751This command shrinks @var{window} to be as small as possible while still
1657showing the full contents of its buffer---but not less than 1752showing the full contents of its buffer---but not less than
1658@code{window-min-height} lines. 1753@code{window-min-height} lines. If @var{window} is not given,
1754it defaults to the selected window.
1659 1755
1660However, the command does nothing if the window is already too small to 1756However, the command does nothing if the window is already too small to
1661display the whole text of the buffer, or if part of the contents are 1757display the whole text of the buffer, or if part of the contents are
@@ -1663,6 +1759,35 @@ currently scrolled off screen, or if the window is not the full width of
1663its frame, or if the window is the only window in its frame. 1759its frame, or if the window is the only window in its frame.
1664@end deffn 1760@end deffn
1665 1761
1762@tindex window-size-fixed
1763@defvar window-size-fixed
1764If this variable is non-@code{nil}, in any given buffer,
1765then the size of any window displaying the buffer remains fixed
1766unless you explicitly change it or Emacs has no other choice.
1767(This feature is new in Emacs 21.)
1768
1769If the value is @code{height}, then only the window's height is fixed;
1770if the value is @code{width}, then only the window's width is fixed.
1771Any other non-@code{nil} value fixes both the width and the height.
1772
1773The usual way to use this variable is to give it a buffer-local value in
1774a particular buffer. That way, the windows (but usually there is only
1775one) displaying that buffer have fixed size.
1776
1777Explicit size-change functions such as @code{enlarge-window}
1778get an error if they would have to change a window size which is fixed.
1779Therefore, when you want to change the size of such a window,
1780you should bind @code{window-size-fixed} to @code{nil}, like this:
1781
1782@example
1783(let ((window-size-fixed nil))
1784 (enlarge-window 10))
1785@end example
1786
1787Note that changing the frame size will change the size of a
1788fixed-size window, if there is no other alternative.
1789@end defvar
1790
1666@cindex minimum window size 1791@cindex minimum window size
1667 The following two variables constrain the window-size-changing 1792 The following two variables constrain the window-size-changing
1668functions to a minimum height and width. 1793functions to a minimum height and width.
@@ -1721,11 +1846,14 @@ window.
1721@item mode-line 1846@item mode-line
1722The coordinates are in the mode line of @var{window}. 1847The coordinates are in the mode line of @var{window}.
1723 1848
1724@item vertical-split 1849@item header-line
1850The coordinates are in the header line of @var{window}.
1851
1852@item vertical-line
1725The coordinates are in the vertical line between @var{window} and its 1853The coordinates are in the vertical line between @var{window} and its
1726neighbor to the right. This value occurs only if the window doesn't 1854neighbor to the right. This value occurs only if the window doesn't
1727have a scroll bar; positions in a scroll bar are considered outside the 1855have a scroll bar; positions in a scroll bar are considered outside the
1728window. 1856window for these purposes.
1729 1857
1730@item nil 1858@item nil
1731The coordinates are not in any part of @var{window}. 1859The coordinates are not in any part of @var{window}.
@@ -1750,8 +1878,8 @@ configuration previously saved.
1750configuration instead of a window configuration. @xref{Frame 1878configuration instead of a window configuration. @xref{Frame
1751Configurations}. 1879Configurations}.
1752 1880
1753@defun current-window-configuration 1881@defun current-window-configuration &optional frame
1754This function returns a new object representing the selected frame's 1882This function returns a new object representing @var{frame}'s
1755current window configuration, including the number of windows, their 1883current window configuration, including the number of windows, their
1756sizes and current buffers, which window is the selected window, and for 1884sizes and current buffers, which window is the selected window, and for
1757each window the displayed buffer, the display-start position, and the 1885each window the displayed buffer, the display-start position, and the
@@ -1759,16 +1887,20 @@ positions of point and the mark. It also includes the values of
1759@code{window-min-height}, @code{window-min-width} and 1887@code{window-min-height}, @code{window-min-width} and
1760@code{minibuffer-scroll-window}. An exception is made for point in the 1888@code{minibuffer-scroll-window}. An exception is made for point in the
1761current buffer, whose value is not saved. 1889current buffer, whose value is not saved.
1890
1891If @var{frame} is omitted, the selected frame is used.
1762@end defun 1892@end defun
1763 1893
1764@defun set-window-configuration configuration 1894@defun set-window-configuration configuration
1765This function restores the configuration of windows and buffers as 1895This function restores the configuration of windows and buffers as
1766specified by @var{configuration}. The argument @var{configuration} must 1896specified by @var{configuration}, for the frame that @var{configuration}
1767be a value that was previously returned by 1897was created for.
1768@code{current-window-configuration}. This configuration is restored in 1898
1769the frame from which @var{configuration} was made, whether that frame is 1899The argument @var{configuration} must be a value that was previously
1770selected or not. This always counts as a window size change and 1900returned by @code{current-window-configuration}. This configuration is
1771triggers execution of the @code{window-size-change-functions} 1901restored in the frame from which @var{configuration} was made, whether
1902that frame is selected or not. This always counts as a window size
1903change and triggers execution of the @code{window-size-change-functions}
1772(@pxref{Window Hooks}), because @code{set-window-configuration} doesn't 1904(@pxref{Window Hooks}), because @code{set-window-configuration} doesn't
1773know how to tell whether the new configuration actually differs from the 1905know how to tell whether the new configuration actually differs from the
1774old one. 1906old one.
@@ -1913,7 +2045,7 @@ This function sets @var{window}'s end trigger position at
1913@var{position}. 2045@var{position}.
1914@end defun 2046@end defun
1915 2047
1916@defun window-redisplay-end-trigger window 2048@defun window-redisplay-end-trigger &optional window
1917@tindex window-redisplay-end-trigger 2049@tindex window-redisplay-end-trigger
1918This function returns @var{window}'s current end trigger position. 2050This function returns @var{window}'s current end trigger position.
1919@end defun 2051@end defun