diff options
| author | Richard M. Stallman | 1999-09-17 06:59:04 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1999-09-17 06:59:04 +0000 |
| commit | 8241495da57ca0efed1b2e86ff693b5614e0aebd (patch) | |
| tree | ee1fca7ca3eafe24dbbf651622196bc849203e69 | |
| parent | 106217c6600b3049f1c62afaf198b9382206acba (diff) | |
| download | emacs-8241495da57ca0efed1b2e86ff693b5614e0aebd.tar.gz emacs-8241495da57ca0efed1b2e86ff693b5614e0aebd.zip | |
*** empty log message ***
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 | |||
| 174 | list, then the first one (the one with the smallest position) found in | 174 | list, then the first one (the one with the smallest position) found in |
| 175 | the list of all classes of advice is used. | 175 | the list of all classes of advice is used. |
| 176 | 176 | ||
| 177 | @xref{Argument Access in Advice}, for more information about argument | ||
| 178 | lists and advice. | ||
| 179 | |||
| 177 | The remaining elements, @var{flags}, are symbols that specify further | 180 | The remaining elements, @var{flags}, are symbols that specify further |
| 178 | information about how to use this piece of advice. Here are the valid | 181 | information about how to use this piece of advice. Here are the valid |
| 179 | symbols and their meanings: | 182 | symbols and their meanings: |
| @@ -210,7 +213,7 @@ unless subsequently explicitly enabled. @xref{Enabling Advice}. | |||
| 210 | Activate advice for @var{function} when this @code{defadvice} is | 213 | Activate advice for @var{function} when this @code{defadvice} is |
| 211 | compiled or macroexpanded. This generates a compiled advised definition | 214 | compiled or macroexpanded. This generates a compiled advised definition |
| 212 | according to the current advice state, which will be used during | 215 | according to the current advice state, which will be used during |
| 213 | activation if appropriate. | 216 | activation if appropriate. @xref{Preactivation}. |
| 214 | 217 | ||
| 215 | This is useful only if this @code{defadvice} is byte-compiled. | 218 | This 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 | |||
| 301 | to put the new piece of advice. The value of @var{position} can either | 304 | to put the new piece of advice. The value of @var{position} can either |
| 302 | be @code{first}, @code{last}, or a number (counting from 0 at the | 305 | be @code{first}, @code{last}, or a number (counting from 0 at the |
| 303 | beginning of the list). Numbers outside the range are mapped to the | 306 | beginning of the list). Numbers outside the range are mapped to the |
| 304 | closest extreme position. | 307 | beginning or the end of the range, whichever is closer. The |
| 308 | @var{position} value is ignored when redefining an existing piece of | ||
| 309 | advice. | ||
| 305 | 310 | ||
| 306 | If @var{function} already has a piece of @var{advice} with the same | 311 | If @var{function} already has a piece of @var{advice} with the same |
| 307 | name, then the position argument is ignored and the old advice is | 312 | name, 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 | |||
| 339 | advice. | 344 | advice. |
| 340 | 345 | ||
| 341 | @deffn Command ad-activate function &optional compile | 346 | @deffn Command ad-activate function &optional compile |
| 342 | This command activates the advice for @var{function}. | 347 | This command activates all the advice defined for @var{function}. |
| 343 | @end deffn | 348 | @end deffn |
| 344 | 349 | ||
| 345 | To activate advice for a function whose advice is already active is not | 350 | To 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 | ||
| 8 | For those users who live backwards in time, here is information about | 8 | For those users who live backwards in time, here is information about |
| 9 | downgrading to Emacs version 19.34. We hope you will enjoy the greater | 9 | downgrading to Emacs version 20.4. We hope you will enjoy the greater |
| 10 | simplicity that results from the absence of many Emacs 20 features. In | 10 | simplicity that results from the absence of many Emacs 21 features. In |
| 11 | the following section, we carry this information back as far as Emacs | 11 | the following section, we carry this information back to Emacs |
| 12 | 19.29, for which the previous printed edition of this manual was made. | 12 | 20.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 | |||
| 16 | Here are the most important of the features that you will learn | ||
| 17 | to do without in Emacs 19: | ||
| 18 | 15 | ||
| 19 | @itemize @bullet | 16 | @itemize @bullet |
| 20 | @item | 17 | @item |
| 21 | In a great simplification, Emacs 19 supports ASCII characters only. | 18 | The @code{push} and @code{pop} macros are not defined. |
| 22 | There are no multibyte characters, character sets, language | ||
| 23 | environments, coding systems, or input methods; all the functions that | ||
| 24 | specifically relate to them are gone as well. | ||
| 25 | |||
| 26 | Valid character codes for text must be in the range 0 through 255. | ||
| 27 | Within this range, there are no invalid character codes. | ||
| 28 | 19 | ||
| 29 | @item | 20 | @item |
| 30 | The Custom facility has been replaced with a much simpler and more | 21 | You can't display images in buffers. (Emacs is meant for editing text.) |
| 31 | general method of defining user option variables. Instead of | 22 | With no images, there are no display margins, and no tool bars. |
| 32 | @code{defcustom}, which requires you to specify each user option's data | ||
| 33 | type 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 | |||
| 38 | Here are changes in the Lisp language itself: | ||
| 39 | 23 | ||
| 40 | @itemize @bullet | ||
| 41 | @item | 24 | @item |
| 42 | Symbols whose names start with @samp{:} are no longer special | 25 | The @code{display} text property has no special meaning; you can use it |
| 43 | in any way. They start out void, like most other symbols. | 26 | freely in Lisp programs, with no effects except what you implement for |
| 27 | yourself. With no images, who needs the @code{display} text property? | ||
| 44 | 28 | ||
| 45 | @item | 29 | @item |
| 46 | The macros @code{when} and @code{unless} have been deleted. | 30 | Faces have fewer attributes. The attributes @code{:family}, |
| 31 | @code{:height}, @code{:width}, @code{:weight}, and @code{:slant}, | ||
| 32 | have been replaced with a font name, a ``bold'' flag, and an | ||
| 33 | ``italic'' flag. | ||
| 47 | 34 | ||
| 48 | @item | 35 | The attributes @code{:overline}, @code{:strike-through} |
| 49 | The functions @code{caar}, @code{cadr}, @code{cdar} and @code{cddr} | 36 | and @code{:box} have been eliminated too. |
| 50 | no longer exist. | ||
| 51 | 37 | ||
| 52 | @item | 38 | With fewer font attributes, there are no functions |
| 53 | The function @code{functionp} is now gone. If you don't know | 39 | @code{set-face-attribute} and @code{face-attribute}. Instead, you |
| 54 | by now whether something is a function, Emacs can't tell you. | 40 | access these attributes using functions such as @code{face-font}, and |
| 55 | @end itemize | 41 | set them with functions such as @code{set-face-font}. (These functions |
| 42 | were available in Emacs 21, but are not as useful there.) | ||
| 56 | 43 | ||
| 57 | Here are changes in handling strings and text. | 44 | @item |
| 45 | There are no facilities for playing sound. This means Emacs will | ||
| 46 | respect your peace and quiet, aside from occasional beeps. | ||
| 58 | 47 | ||
| 59 | @itemize @bullet | ||
| 60 | @item | 48 | @item |
| 61 | The function @code{substring} works only on strings, not on vectors. | 49 | Regular expressions do not support the POSIX character classes |
| 50 | such as @samp{[:alpha:]}. All characters are created equal. | ||
| 62 | 51 | ||
| 63 | @item | 52 | @item |
| 64 | There are no more character categories. | 53 | Hash tables have been eliminated; use alists instead. |
| 65 | 54 | ||
| 66 | @item | 55 | @item |
| 67 | When you compare strings with @code{equal}, it now compares | 56 | The Lisp printer does not detect and report circular structure. That is |
| 68 | their string properties as well as their text. All must match, | 57 | ok, because the Lisp reader cannot recreate circular structure anyway. |
| 69 | or the strings are not equal. | 58 | However, there is a library @samp{cust-print.el} which can report |
| 59 | circular structure. | ||
| 70 | 60 | ||
| 71 | @item | 61 | @item |
| 72 | @code{format-time-string} no longer supports specified field width | 62 | Emacs provides its own implementation of scroll bars, instead |
| 73 | or specified padding. | 63 | of using those of the X toolkit. They always use the frame foreground |
| 64 | and background colors, so you cannot specify different colors for | ||
| 65 | the scroll bars. | ||
| 74 | 66 | ||
| 75 | @item | 67 | @item |
| 76 | The functions @code{split-string} and @code{string} no longer exist. | 68 | For simplicity, all ASCII characters now have the same height and width. |
| 77 | Neither does @code{store-substring} or @code{sref}. | 69 | (Certain characters, such as Chinese characters, always have have twice |
| 70 | the standard width.) All characters are created equal. | ||
| 78 | 71 | ||
| 79 | @item | 72 | @item |
| 80 | All printing characters have the same width. Therefore, we have deleted | 73 | Tooltips 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 |
| 85 | We have eliminated the functions @code{next-char-property-change} and | 76 | Areas of the mode line are not mouse-sensitive; however, some mouse |
| 86 | @code{previous-char-property-change} also. | 77 | commands are available for the mode line as a whole. |
| 87 | 78 | ||
| 88 | @item | 79 | @item |
| 89 | Syntax parsing now determines the syntax of each character from the | 80 | Windows cannot have header lines. Conversely, there is no way to turn |
| 90 | syntax table alone---not from text properties. This makes the syntax | 81 | off the mode line of a window unless it is a minibuffer. |
| 91 | codes @samp{|} and @samp{!}, which were meant for use with text | ||
| 92 | properties, useless; so we have deleted them. | ||
| 93 | 82 | ||
| 94 | @item | 83 | @item |
| 95 | In the function @code{parse-partial-sexp}, passing @code{syntax-table} | 84 | Plain dashes are the only separators you can use in a menu. |
| 96 | as the sixth argument @var{commentstop} no longer has any special meaning. | ||
| 97 | And the return value has only eight elements. | ||
| 98 | @end itemize | ||
| 99 | 85 | ||
| 100 | Here are changes in other areas of Emacs Lisp: | 86 | @item |
| 87 | Vertical fractional scrolling does not exist. | ||
| 101 | 88 | ||
| 102 | @itemize @bullet | ||
| 103 | @item | 89 | @item |
| 104 | The macros @code{save-current-buffer}, @code{with-current-buffer}, | 90 | The functions @code{format} and @code{message} ignore and discard text |
| 105 | @code{with-temp-buffer}, @code{with-temp-file}, @code{save-selected-window}, | 91 | properties. |
| 106 | and @code{with-output-to-string} are gone. | ||
| 107 | 92 | ||
| 108 | @item | 93 | @item |
| 109 | The easy-mmode facility for defining minor modes is gone too. | 94 | Colors are supported only on window systems, not on text-only terminals. |
| 95 | So the support functions for colors on text-only terminals are | ||
| 96 | not needed. | ||
| 110 | 97 | ||
| 111 | @item | 98 | @item |
| 112 | Process filters and sentinels must explicitly save the match data, with | 99 | The 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}, |
| 114 | something horrible will happen. | 101 | @code{x-color-defined-p} and @code{x-defined-colors}. |
| 115 | 102 | ||
| 116 | @item | 103 | @item |
| 117 | As part of our effort to loosen up, @code{batch-byte-compile-file} no | 104 | Windows cannot be made fixed-width or fixed-height; |
| 118 | longer returns a nonzero status code if there is a compilation error. | 105 | Emacs will adjust the size of all windows when it needs to. |
| 119 | 106 | ||
| 120 | @item | 107 | @item |
| 121 | The ``mail user agent'' feature is gone. | 108 | The minibuffer prompt does not actually appear in content of the |
| 109 | minibuffer; it is displayed specially in the minibuffer window. | ||
| 122 | 110 | ||
| 123 | @item | 111 | @item |
| 124 | We have removed the functions @code{add-to-invisibility-spec} and | 112 | The ``exclusive open'' feature of @code{write-region} |
| 125 | @code{remove-from-invisibility-spec}, so you should manipulate | 113 | has been eliminated; any non-@code{nil} value for the seventh |
| 126 | the value of @code{buffer-invisibility-spec} by hand. | 114 | argument now means to ask the user for confirmation. |
| 127 | 115 | ||
| 128 | @item | 116 | @item |
| 129 | The functions @code{face-documentation}, @code{face-bold-p}, | 117 | The function @code{buffer-size} always reports on the |
| 130 | @code{face-italic-p}, @code{set-face-bold-p}, @code{set-face-italic-p} | 118 | current buffer. |
| 131 | are gone. Instead, use @code{make-face-bold} and friends. | ||
| 132 | 119 | ||
| 133 | @item | 120 | @item |
| 134 | All the functions that operate on a file now discard an extra redundant | 121 | The function @code{assoc-delete-all} has itself been deleted. |
| 135 | directory name from the beginning of the file name---just like | 122 | So there! |
| 136 | @code{substitute-in-file-name}. | ||
| 137 | 123 | ||
| 138 | @item | 124 | @item |
| 139 | We have got rid of the function @code{access-file}. | 125 | The variable @code{small-temporary-file-directory} has no special |
| 126 | meaning. There's only one variable for specifying which directory to | ||
| 127 | use for temporary files, @code{temporary-file-directory}, but not all | ||
| 128 | Emacs features use it anyway. Some use the @code{TMP} environment | ||
| 129 | variable, and some use the @code{TMPDIR} environment variable. | ||
| 140 | 130 | ||
| 141 | @item | 131 | @item |
| 142 | Most of the minibuffer input functions no longer take a default value as | 132 | The variable @code{inhibit-modification-hooks} |
| 143 | an argument. Also, they do not discard text properties from the result. | 133 | has no special meaning. |
| 144 | This means that if you insert text with text properties into the minibuffer, | ||
| 145 | the minibuffer value really will contain text properties. | ||
| 146 | 134 | ||
| 147 | @item | 135 | @item |
| 148 | Only the simple menu item format is supported (@pxref{Simple Menu Items}). | 136 | The hook @code{fontification-functions} has been eliminated, |
| 137 | but there are other hooks, such as @code{window-scroll-functions}, | ||
| 138 | that you can use to do a similar job. | ||
| 149 | 139 | ||
| 150 | @item | 140 | @item |
| 151 | You can still bind @code{x-resource-class} around a call to | 141 | The variable @code{redisplay-dont-pause} |
| 152 | @code{x-get-resource}, but it won't do anything special. | 142 | has no special meaning. |
| 153 | 143 | ||
| 154 | @item | 144 | @item |
| 155 | Wave goodbye to the hooks @code{before-make-frame-hook}, | 145 | The 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 |
| 160 | The functions and variables that deal with MS Windows NT/95 | 148 | The function @code{move-to-column} treats any non-@code{nil} |
| 161 | have been renamed to start with @samp{win32-} instead of @samp{w32-}. | 149 | second argument just like @code{t}. |
| 162 | This is because we admire Microsoft more each day as we go back | ||
| 163 | into 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 | ||
| 168 | Here we go even further back, as far as Emacs 19.29, for which the | 154 | Here are the most important of the features that you will learn |
| 169 | previous printed edition of the Emacs Lisp manual was made. | 155 | to do without in Emacs 20.3: |
| 170 | 156 | ||
| 171 | @itemize @bullet | 157 | Here are changes in the Lisp language itself: |
| 172 | @item | ||
| 173 | There are no char-tables or bool-vectors. Syntax tables, display | ||
| 174 | tables, 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 |
| 178 | There is only one kind of marker. When you insert text at the place | 161 | The functions @code{line-beginning-position} and @code{line-end-position} |
| 179 | where a marker points, the marker always ends up before that text, | 162 | have been eliminated. |
| 180 | unless you use @code{insert-before-markers}, which puts all the markers | ||
| 181 | after the inserted text. | ||
| 182 | 163 | ||
| 183 | @item | 164 | @item |
| 184 | There is no function @code{overlays-in}. | 165 | The functions @code{directory-files-and-attributes}, |
| 166 | @code{file-attributes-lessp}, and @code{file-expand-wildcards}, have | ||
| 167 | been eliminated. | ||
| 185 | 168 | ||
| 186 | @item | 169 | @item |
| 187 | The variable @code{print-length} applies only to lists, not to | 170 | The functions @code{decode-coding-region} and @code{encode-coding-region} |
| 188 | vectors or strings. | 171 | leave text properties untouched, in case that is useful. (It rarely makes |
| 172 | any sense, though.) | ||
| 189 | 173 | ||
| 190 | @item | 174 | @item |
| 191 | The function @code{convert-standard-filename} no longer exists, so each | 175 | The functions @code{position-bytes} and @code{byte-to-position} have |
| 192 | Lisp package must independently figure out which file names to use for | 176 | been eliminated. |
| 193 | its initialization files on each kind of operating system. | ||
| 194 | 177 | ||
| 195 | @item | 178 | @item |
| 196 | The macro @code{with-timeout} has been eliminated, along with the | 179 | Temporary buffers made with @code{with-output-to-temp-buffer} are now |
| 197 | function @code{y-or-n-p-with-timeout}. Idle timers don't exist at all; | 180 | modifiable by default, and use Fundamental mode rather than Help mode. |
| 198 | instead, maybe you can use @code{post-command-idle-hook} to do some of | ||
| 199 | the same job. | ||
| 200 | 181 | ||
| 201 | @item | 182 | @item |
| 202 | The functions @code{keymap-parent} and @code{set-keymap-parent} are | 183 | The functions @code{sref} interprets its @var{index} argument as a |
| 203 | gone. We expect keymaps to recognize their own parents. | 184 | number 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 | ||
| 186 | character occupies. | ||
| 204 | 187 | ||
| 205 | @item | 188 | @item |
| 206 | When you delete text and then undo a deletion, markers that were | 189 | The function @code{process-running-child-p} has been eliminated. |
| 207 | originally inside the deleted text end up either at the beginning | ||
| 208 | or the end of it---not back in their original places. | ||
| 209 | 190 | ||
| 210 | @item | 191 | @item |
| 211 | The interactive specification @samp{N} is gone now. | 192 | The function @code{interrupt-process} and similar functions no longer do |
| 193 | anything special when the second argument is @code{lambda}. | ||
| 212 | 194 | ||
| 213 | @item | 195 | @item |
| 214 | There is no more @code{safe-length}. Don't try to be so safe! Did you | 196 | The function @code{define-prefix-command} accepts only two arguments. |
| 215 | expect to live forever? | ||
| 216 | 197 | ||
| 217 | @item | 198 | @item |
| 218 | We got rid of @code{insert-file-contents-literally}, because | 199 | The meaning of the second argument to @code{read-char}, |
| 219 | programmers are too literal-minded anyway. | 200 | @code{read-event}, and @code{read-char-exclusive} has been reversed: |
| 201 | they use the current input method if the argument is if @code{nil}. | ||
| 220 | 202 | ||
| 221 | @item | 203 | @item |
| 222 | As part of our continuing effort to help Lisp programmers to relax, we | 204 | The function @code{with-temp-message} has been eliminated. |
| 223 | threw out the function @code{error-message-string}. Don't worry so much | ||
| 224 | about errors! We all make mistakes. | ||
| 225 | 205 | ||
| 226 | @item | 206 | @item |
| 227 | The keymap @code{special-event-map} is gone, because Emacs has no more | 207 | The function @code{clear-this-command-keys} has been eliminated. |
| 228 | special events. If you want to hold a party in Emacs, please let us | ||
| 229 | know. | ||
| 230 | 208 | ||
| 231 | @item | 209 | @item |
| 232 | You can't do date arithmetic with @code{encode-time} any more. | 210 | The functions @code{gap-position} and @code{gap-size} have been eliminated. |
| 233 | 211 | ||
| 234 | @item | 212 | @item |
| 235 | The functions @code{command-execute} and @code{call-interactively} no | 213 | In @code{modify-face}, an argument of @code{(nil)} has no special |
| 236 | longer accept the optional argument @var{keys}. | 214 | meaning. |
| 237 | 215 | ||
| 238 | @item | 216 | @item |
| 239 | @code{get-buffer-window-list} is gone as well. | 217 | The base64 conversion functions have been eliminated. |
| 240 | 218 | ||
| 241 | @item | 219 | @item |
| 242 | With the function @code{replace-match}, you can only replace the whole | 220 | Wildcard support has been eliminated from @code{find-file} |
| 243 | match, not a subexpression of it. | 221 | and allied functions. |
| 244 | 222 | ||
| 245 | @item | 223 | @item |
| 246 | We 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}. | 225 | only 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 | |||
| 179 | non-@code{nil}. | 179 | non-@code{nil}. |
| 180 | @end defvar | 180 | @end defvar |
| 181 | 181 | ||
| 182 | @defvar backup-by-copying-when-privileged-mismatch | ||
| 183 | This variable, if non-@code{nil}, specifies the same behavior as | ||
| 184 | @code{backup-by-copying-when-mismatch}, but only for certain user-id | ||
| 185 | values: namely, those less than or equal to a certain number. You set | ||
| 186 | this variable to that number. | ||
| 187 | |||
| 188 | Thus, if you set @code{backup-by-copying-when-privileged-mismatch} | ||
| 189 | to 0, backup by copying is done for the superuser only, | ||
| 190 | when necessary to prevent a change in the owner of the file. | ||
| 191 | |||
| 192 | The 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 |
| 395 | This function returns a non-@code{nil} value if @var{filename} is a | 408 | This function returns a non-@code{nil} value if @var{filename} is a |
| 396 | string that could be the name of an auto-save file. It works based on | 409 | string that could be the name of an auto-save file. It assumes |
| 397 | knowledge of the naming convention for auto-save files: a name that | 410 | the usual naming convention for auto-save files: a name that |
| 398 | begins and ends with hash marks (@samp{#}) is a possible auto-save file | 411 | begins and ends with hash marks (@samp{#}) is a possible auto-save file |
| 399 | name. The argument @var{filename} should not contain a directory part. | 412 | name. The argument @var{filename} should not contain a directory part. |
| 400 | 413 | ||
| @@ -433,8 +446,8 @@ correspondingly. | |||
| 433 | This function returns the file name to use for auto-saving the current | 446 | This function returns the file name to use for auto-saving the current |
| 434 | buffer. This is just the file name with hash marks (@samp{#}) prepended | 447 | buffer. This is just the file name with hash marks (@samp{#}) prepended |
| 435 | and appended to it. This function does not look at the variable | 448 | and 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 |
| 437 | that before calling this function. | 450 | function 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 | |||
| 475 | auto-save files have distinct names that are created by | 488 | auto-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 | ||
| 478 | When you change the value of this variable, the value does not take | 491 | When you change the value of this variable, the new value does not take |
| 479 | effect until the next time auto-save mode is reenabled in any given | 492 | effect in an existing buffer until the next time auto-save mode is |
| 480 | buffer. If auto-save mode is already enabled, auto-saves continue to go | 493 | reenabled in it. If auto-save mode is already enabled, auto-saves |
| 481 | in the same file name until @code{auto-save-mode} is called again. | 494 | continue to go in the same file name until @code{auto-save-mode} is |
| 495 | called 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 |
| 496 | The value of this variable is the number of characters that Emacs | 510 | The value of this variable specifies how often to do auto-saving, in |
| 497 | reads from the keyboard between auto-saves. Each time this many more | 511 | terms of number of input events. Each time this many additional input |
| 498 | characters are read, auto-saving is done for all buffers in which it is | 512 | events are read, Emacs does auto-saving for all buffers in which that is |
| 499 | enabled. | 513 | enabled. |
| 500 | @end defopt | 514 | @end defopt |
| 501 | 515 | ||
| 502 | @defopt auto-save-timeout | 516 | @defopt auto-save-timeout |
| 503 | The value of this variable is the number of seconds of idle time that | 517 | The value of this variable is the number of seconds of idle time that |
| 504 | should cause auto-saving. Each time the user pauses for this long, | 518 | should cause auto-saving. Each time the user pauses for this long, |
| 505 | Emacs auto-saves any buffers that need it. (Actually, the specified | 519 | Emacs does auto-saving for all buffers in which that is enabled. |
| 506 | timeout is multiplied by a factor depending on the size of the current | 520 | (Actually, the specified timeout is multiplied by a factor depending on |
| 507 | buffer.) | 521 | the 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 |
| 554 | The value of this buffer-local variable is the length of the current | 568 | The value of this buffer-local variable is the length of the current |
| 555 | buffer as of the last time it was read in, saved, or auto-saved. This is | 569 | buffer, when it was last read in, saved, or auto-saved. This is |
| 556 | used to detect a substantial decrease in size, and turn off auto-saving | 570 | used to detect a substantial decrease in size, and turn off auto-saving |
| 557 | in response. | 571 | in response. |
| 558 | 572 | ||
| 559 | If it is @minus{}1, that means auto-saving is temporarily shut off in this | 573 | If it is @minus{}1, that means auto-saving is temporarily shut off in |
| 560 | buffer due to a substantial deletion. Explicitly saving the buffer | 574 | this buffer due to a substantial decrease in size. Explicitly saving |
| 561 | stores a positive value in this variable, thus reenabling auto-saving. | 575 | the buffer stores a positive value in this variable, thus reenabling |
| 562 | Turning auto-save mode off or on also alters this variable. | 576 | auto-saving. Turning auto-save mode off or on also updates this |
| 577 | variable, 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 | |||
| 570 | if the buffer has none), and the second gives the name of the auto-save | 585 | if the buffer has none), and the second gives the name of the auto-save |
| 571 | file. | 586 | file. |
| 572 | 587 | ||
| 573 | If Emacs exits normally, it deletes this file. If Emacs crashes, you | 588 | When Emacs exits normally, it deletes this file; if Emacs crashes, you |
| 574 | can look in the file to find all the auto-save files that might contain | 589 | can look in the file to find all the auto-save files that might contain |
| 575 | work that was otherwise lost. The @code{recover-session} command uses | 590 | work that was otherwise lost. The @code{recover-session} command uses |
| 576 | these files. | 591 | this file to find them. |
| 577 | 592 | ||
| 578 | The default name for this file is in your home directory and starts with | 593 | The 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 | 594 | with @samp{.saves-}. It also contains the Emacs process @sc{id} and the |
| 580 | name. | 595 | host 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 | |||
| 594 | or saved. | 609 | or saved. |
| 595 | 610 | ||
| 596 | By default, if the latest auto-save file is more recent than the visited | 611 | By default, if the latest auto-save file is more recent than the visited |
| 597 | file, @code{revert-buffer} asks the user whether to use that instead. | 612 | file, and the argument @var{ignore-auto} is non-@code{nil}, |
| 598 | But 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 |
| 599 | the visited file itself is used. Interactively, @var{ignore-auto} is | 614 | instead. When you invoke this command interactively, @var{ignore-auto} |
| 600 | @code{t} unless there is a numeric prefix argument; thus, the | 615 | is @code{t} unless there is a numeric prefix argument; thus, the |
| 601 | interactive default is to check the auto-save file. | 616 | interactive default is to check the auto-save file. |
| 602 | 617 | ||
| 603 | Normally, @code{revert-buffer} asks for confirmation before it changes | 618 | Normally, @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 | |||
| 608 | replacement feature of @code{insert-file-contents}. If the buffer | 623 | replacement feature of @code{insert-file-contents}. If the buffer |
| 609 | contents and the file contents are identical before the revert | 624 | contents and the file contents are identical before the revert |
| 610 | operation, reverting preserves all the markers. If they are not | 625 | operation, reverting preserves all the markers. If they are not |
| 611 | identical, reverting does change the buffer; then it preserves the | 626 | identical, reverting does change the buffer; in that case, it preserves |
| 612 | markers in the unchanged text (if any) at the beginning and end of the | 627 | the markers in the unchanged text (if any) at the beginning and end of |
| 613 | buffer. Preserving any additional markers would be problematical. | 628 | the buffer. Preserving any additional markers would be problematical. |
| 614 | @end deffn | 629 | @end deffn |
| 615 | 630 | ||
| 616 | You can customize how @code{revert-buffer} does its work by setting | 631 | You 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 |
| 620 | This variable holds a list of files that should be reverted without | 635 | This variable holds a list of files that should be reverted without |
| 621 | query. The value is a list of regular expressions. If a file name | 636 | query. The value is a list of regular expressions. If the visited file |
| 622 | matches one of these regular expressions, then @code{revert-buffer} | 637 | name matches one of these regular expressions, and the file has changed |
| 623 | reverts the file without asking the user for confirmation, if the file | 638 | on disk but the buffer is not modified, then @code{revert-buffer} |
| 624 | has changed on disk and the buffer is not modified. | 639 | reverts 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 |
| 640 | The value of this variable, if non-@code{nil}, is the function to use to | 655 | The value of this variable, if non-@code{nil}, specifies the function to use to |
| 641 | insert the updated contents when reverting this buffer. The function | 656 | insert the updated contents when reverting this buffer. The function |
| 642 | receives two arguments: first the file name to use; second, @code{t} if | 657 | receives two arguments: first the file name to use; second, @code{t} if |
| 643 | the user has asked to read the auto-save file. | 658 | the 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 |
| 647 | This normal hook is run by @code{revert-buffer} before actually | 662 | This normal hook is run by @code{revert-buffer} before |
| 648 | inserting the modified contents---but only if | 663 | inserting 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 |
| 653 | This normal hook is run by @code{revert-buffer} after actually inserting | 668 | This normal hook is run by @code{revert-buffer} after inserting |
| 654 | the modified contents---but only if @code{revert-buffer-function} is | 669 | the 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 |
| 11 | are used to hold the contents of files that are being visited; there may | 11 | are used to hold the contents of files that are being visited; there may |
| 12 | also be buffers that are not visiting files. While several buffers may | 12 | also be buffers that are not visiting files. While several buffers may |
| 13 | exist at one time, exactly one buffer is designated the @dfn{current | 13 | exist at one time, only one buffer is designated the @dfn{current |
| 14 | buffer} at any time. Most editing commands act on the contents of the | 14 | buffer} at any time. Most editing commands act on the contents of the |
| 15 | current buffer. Each buffer, including the current buffer, may or may | 15 | current buffer. Each buffer, including the current buffer, may or may |
| 16 | not be displayed in any windows. | 16 | not 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 |
| 41 | are used to hold the contents of files that are being visited; there may | 41 | are used to hold the contents of files that are being visited; there may |
| 42 | also be buffers that are not visiting files. While several buffers may | 42 | also be buffers that are not visiting files. Although several buffers |
| 43 | exist at one time, exactly one buffer is designated the @dfn{current | 43 | normally exist, only one buffer is designated the @dfn{current |
| 44 | buffer} at any time. Most editing commands act on the contents of the | 44 | buffer} at any time. Most editing commands act on the contents of the |
| 45 | current buffer. Each buffer, including the current buffer, may or may | 45 | current buffer. Each buffer, including the current buffer, may or may |
| 46 | not be displayed in any windows. | 46 | not be displayed in any windows. |
| @@ -103,12 +103,12 @@ current, to prevent confusion: the buffer that the cursor is in when | |||
| 103 | Emacs reads a command is the buffer that the command will apply to. | 103 | Emacs 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 |
| 105 | switch visibly to a different buffer so that the user can edit it. For | 105 | switch visibly to a different buffer so that the user can edit it. For |
| 106 | this, you must use the functions described in @ref{Displaying Buffers}. | 106 | that, 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 |
| 109 | should not depend on the command loop to set it back afterwards. | 109 | should not depend on the command loop to set it back afterwards. |
| 110 | Editing commands written in Emacs Lisp can be called from other programs | 110 | Editing commands written in Emacs Lisp can be called from other programs |
| 111 | as well as from the command loop. It is convenient for the caller if | 111 | as well as from the command loop; it is convenient for the caller if |
| 112 | the subroutine does not change which buffer is current (unless, of | 112 | the subroutine does not change which buffer is current (unless, of |
| 113 | course, that is the subroutine's purpose). Therefore, you should | 113 | course, that is the subroutine's purpose). Therefore, you should |
| 114 | normally use @code{set-buffer} within a @code{save-current-buffer} or | 114 | normally 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 |
| 154 | beginning is current again whenever the variable is unbound. | 154 | beginning 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 | 157 | back, because that won't do the job if a quit happens while the wrong |
| 158 | the wrong buffer is current. Here is what @emph{not} to do: | 158 | buffer 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 |
| 195 | This function makes @var{buffer-or-name} the current buffer. It does | 195 | This function makes @var{buffer-or-name} the current buffer. This does |
| 196 | not display the buffer in the currently selected window or in any other | 196 | not display the buffer in any window, so the user cannot necessarily see |
| 197 | window, so the user cannot necessarily see the buffer. But Lisp | 197 | the buffer. But Lisp programs will now operate on it. |
| 198 | programs can in any case work on it. | ||
| 199 | 198 | ||
| 200 | This function returns the buffer identified by @var{buffer-or-name}. | 199 | This function returns the buffer identified by @var{buffer-or-name}. |
| 201 | An error is signaled if @var{buffer-or-name} does not identify an | 200 | An 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 | |||
| 302 | already in use. However, if @var{unique} is non-@code{nil}, it modifies | 301 | already 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 |
| 304 | make @var{unique} non-@code{nil} with a numeric prefix argument. | 303 | make @var{unique} non-@code{nil} with a numeric prefix argument. |
| 305 | 304 | (This is how the command @code{rename-uniquely} is implemented.) | |
| 306 | One application of this command is to rename the @samp{*shell*} buffer | ||
| 307 | to some other name, thus making it possible to create a second shell | ||
| 308 | buffer 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 |
| 312 | This function returns the buffer specified by @var{buffer-or-name}. | 308 | This function returns the buffer specified by @var{buffer-or-name}. |
| 313 | If @var{buffer-or-name} is a string and there is no buffer with that | 309 | If @var{buffer-or-name} is a string and there is no buffer with that |
| 314 | name, the value is @code{nil}. If @var{buffer-or-name} is a buffer, it | 310 | name, the value is @code{nil}. If @var{buffer-or-name} is a buffer, it |
| 315 | is returned as given. (That is not very useful, so the argument is usually | 311 | is returned as given; that is not very useful, so the argument is usually |
| 316 | a name.) For example: | 312 | a 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 |
| 375 | This buffer-local variable contains the name of the file being visited | 371 | This buffer-local variable contains the name of the file being visited |
| 376 | in the current buffer, or @code{nil} if it is not visiting a file. It | 372 | in the current buffer, or @code{nil} if it is not visiting a file. It |
| 377 | is a permanent local, unaffected by @code{kill-local-variables}. | 373 | is 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 |
| 623 | Modes such as Dired and Rmail make buffers read-only when altering the | 619 | Modes such as Dired and Rmail make buffers read-only when altering the |
| 624 | contents with the usual editing commands is probably a mistake. | 620 | contents with the usual editing commands would probably be a mistake. |
| 625 | 621 | ||
| 626 | The special commands of these modes bind @code{buffer-read-only} to | 622 | The 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 |
| 651 | This command changes whether the current buffer is read-only. It is | 647 | This command changes whether the current buffer is read-only. It is |
| 652 | intended for interactive use; don't use it in programs. At any given | 648 | intended for interactive use; do not use it in programs. At any given |
| 653 | point in a program, you should know whether you want the read-only flag | 649 | point in a program, you should know whether you want the read-only flag |
| 654 | on or off; so you can set @code{buffer-read-only} explicitly to the | 650 | on or off; so you can set @code{buffer-read-only} explicitly to the |
| 655 | proper value, @code{t} or @code{nil}. | 651 | proper 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 |
| 858 | existence as long as anything refers to it, but it is specially marked | 854 | existence as long as anything refers to it, but it is specially marked |
| 859 | so that you cannot make it current or display it. Killed buffers retain | 855 | so that you cannot make it current or display it. Killed buffers retain |
| 860 | their identity, however; two distinct buffers, when killed, remain | 856 | their identity, however; if you kill two distinct buffers, they remain |
| 861 | distinct according to @code{eq}. | 857 | distinct 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 |
| 864 | automatically selects or displays some other buffer instead. This means | 860 | automatically selects or displays some other buffer instead. This means |
| @@ -916,9 +912,9 @@ Buffer foo.changed modified; kill anyway? (yes or no) @kbd{yes} | |||
| 916 | After confirming unsaved changes, @code{kill-buffer} calls the functions | 912 | After confirming unsaved changes, @code{kill-buffer} calls the functions |
| 917 | in the list @code{kill-buffer-query-functions}, in order of appearance, | 913 | in the list @code{kill-buffer-query-functions}, in order of appearance, |
| 918 | with no arguments. The buffer being killed is the current buffer when | 914 | with no arguments. The buffer being killed is the current buffer when |
| 919 | they are called. The idea is that these functions ask for confirmation | 915 | they are called. The idea of this feature is that these functions will |
| 920 | from the user for various nonstandard reasons. If any of them returns | 916 | ask 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 | |||
| 951 | in the other. This includes the text properties as well as the characters | 947 | in the other. This includes the text properties as well as the characters |
| 952 | themselves. | 948 | themselves. |
| 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 |
| 955 | completely separate. They have different names, different values of | 951 | completely separate. They have different names, different values of |
| 956 | point, different narrowing, different markers and overlays (though | 952 | point, different narrowing, different markers and overlays (though |
| 957 | inserting or deleting text in either buffer relocates the markers and | 953 | inserting or deleting text in either buffer relocates the markers and |
| @@ -959,8 +955,8 @@ overlays for both), different major modes, and different buffer-local | |||
| 959 | variables. | 955 | variables. |
| 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 |
| 962 | you try to save the indirect buffer, that actually works by saving the | 958 | you try to save the indirect buffer, that actually saves the base |
| 963 | base buffer. | 959 | buffer. |
| 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 |
| 966 | the base buffer effectively kills the indirect buffer in that it cannot | 962 | the 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 |
| 118 | the current date is @emph{not} visible in the window. | 118 | the 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 | ||
| 122 | runs 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 |
| 777 | and the fancy diary will show | 781 | and the fancy diary will show |
| 778 | @smallexample | 782 | @smallexample |
| 779 | Ruth & Ed's anniversary | 783 | Ed's anniversary |
| 780 | @end smallexample | 784 | @end smallexample |
| 781 | @noindent | 785 | @noindent |
| 782 | both on December 15 and on December 22. | 786 | both 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 | |||
| 322 | specification. If the key sequence that invoked the command has | 322 | specification. 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 |
| 325 | and @sc{ASCII} characters, do not count where @samp{e} is concerned. | 325 | and @sc{ascii} characters, do not count where @samp{e} is concerned. |
| 326 | 326 | ||
| 327 | @item f | 327 | @item f |
| 328 | A file name of an existing file (@pxref{File Names}). The default | 328 | A 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 |
| 763 | The value is 5 because that is the @sc{ASCII} code for @kbd{C-e}. | 763 | The value is 5 because that is the @sc{ascii} code for @kbd{C-e}. |
| 764 | 764 | ||
| 765 | The alias @code{last-command-char} exists for compatibility with | 765 | The alias @code{last-command-char} exists for compatibility with |
| 766 | Emacs version 18. | 766 | Emacs 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 |
| 835 | The | 835 | The |
| 836 | @tex | 836 | @tex |
| 837 | $2^{27}$ | 837 | @math{2^{27}} |
| 838 | @end tex | 838 | @end tex |
| 839 | @ifinfo | 839 | @ifinfo |
| 840 | 2**27 | 840 | 2**27 |
| @@ -845,57 +845,57 @@ typed with the meta key held down. | |||
| 845 | @item control | 845 | @item control |
| 846 | The | 846 | The |
| 847 | @tex | 847 | @tex |
| 848 | $2^{26}$ | 848 | @math{2^{26}} |
| 849 | @end tex | 849 | @end tex |
| 850 | @ifinfo | 850 | @ifinfo |
| 851 | 2**26 | 851 | 2**26 |
| 852 | @end ifinfo | 852 | @end ifinfo |
| 853 | bit in the character code indicates a non-@sc{ASCII} | 853 | bit in the character code indicates a non-@sc{ascii} |
| 854 | control character. | 854 | control 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 |
| 857 | codes of their own, so Emacs needs no special bit to indicate them. | 857 | codes of their own, so Emacs needs no special bit to indicate them. |
| 858 | Thus, the code for @kbd{C-a} is just 1. | 858 | Thus, the code for @kbd{C-a} is just 1. |
| 859 | 859 | ||
| 860 | But if you type a control combination not in @sc{ASCII}, such as | 860 | But 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 |
| 862 | for @kbd{%} plus | 862 | for @kbd{%} plus |
| 863 | @tex | 863 | @tex |
| 864 | $2^{26}$ | 864 | @math{2^{26}} |
| 865 | @end tex | 865 | @end tex |
| 866 | @ifinfo | 866 | @ifinfo |
| 867 | 2**26 | 867 | 2**26 |
| 868 | @end ifinfo | 868 | @end ifinfo |
| 869 | (assuming the terminal supports non-@sc{ASCII} | 869 | (assuming the terminal supports non-@sc{ascii} |
| 870 | control characters). | 870 | control characters). |
| 871 | 871 | ||
| 872 | @item shift | 872 | @item shift |
| 873 | The | 873 | The |
| 874 | @tex | 874 | @tex |
| 875 | $2^{25}$ | 875 | @math{2^{25}} |
| 876 | @end tex | 876 | @end tex |
| 877 | @ifinfo | 877 | @ifinfo |
| 878 | 2**25 | 878 | 2**25 |
| 879 | @end ifinfo | 879 | @end ifinfo |
| 880 | bit in the character code indicates an @sc{ASCII} control | 880 | bit in the character code indicates an @sc{ascii} control |
| 881 | character typed with the shift key held down. | 881 | character typed with the shift key held down. |
| 882 | 882 | ||
| 883 | For letters, the basic code itself indicates upper versus lower case; | 883 | For letters, the basic code itself indicates upper versus lower case; |
| 884 | for digits and punctuation, the shift key selects an entirely different | 884 | for digits and punctuation, the shift key selects an entirely different |
| 885 | character with a different basic code. In order to keep within the | 885 | character 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 |
| 891 | 2**25 | 891 | 2**25 |
| 892 | @end ifinfo | 892 | @end ifinfo |
| 893 | bit for those characters. | 893 | bit for those characters. |
| 894 | 894 | ||
| 895 | However, @sc{ASCII} provides no way to distinguish @kbd{C-A} from | 895 | However, @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 |
| 901 | 2**25 | 901 | 2**25 |
| @@ -906,7 +906,7 @@ bit in @kbd{C-A} and not in | |||
| 906 | @item hyper | 906 | @item hyper |
| 907 | The | 907 | The |
| 908 | @tex | 908 | @tex |
| 909 | $2^{24}$ | 909 | @math{2^{24}} |
| 910 | @end tex | 910 | @end tex |
| 911 | @ifinfo | 911 | @ifinfo |
| 912 | 2**24 | 912 | 2**24 |
| @@ -917,7 +917,7 @@ typed with the hyper key held down. | |||
| 917 | @item super | 917 | @item super |
| 918 | The | 918 | The |
| 919 | @tex | 919 | @tex |
| 920 | $2^{23}$ | 920 | @math{2^{23}} |
| 921 | @end tex | 921 | @end tex |
| 922 | @ifinfo | 922 | @ifinfo |
| 923 | 2**23 | 923 | 2**23 |
| @@ -928,7 +928,7 @@ typed with the super key held down. | |||
| 928 | @item alt | 928 | @item alt |
| 929 | The | 929 | The |
| 930 | @tex | 930 | @tex |
| 931 | $2^{22}$ | 931 | @math{2^{22}} |
| 932 | @end tex | 932 | @end tex |
| 933 | @ifinfo | 933 | @ifinfo |
| 934 | 2**22 | 934 | 2**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} |
| 969 | These keys correspond to common @sc{ASCII} control characters that have | 969 | These keys correspond to common @sc{ascii} control characters that have |
| 970 | special keys on most keyboards. | 970 | special keys on most keyboards. |
| 971 | 971 | ||
| 972 | In @sc{ASCII}, @kbd{C-i} and @key{TAB} are the same character. If the | 972 | In @sc{ascii}, @kbd{C-i} and @key{TAB} are the same character. If the |
| 973 | terminal can distinguish between them, Emacs conveys the distinction to | 973 | terminal can distinguish between them, Emacs conveys the distinction to |
| 974 | Lisp programs by representing the former as the integer 9, and the | 974 | Lisp programs by representing the former as the integer 9, and the |
| 975 | latter as the symbol @code{tab}. | 975 | latter as the symbol @code{tab}. |
| @@ -981,7 +981,7 @@ character @kbd{C-i}) also applies to @code{tab}. Likewise for the other | |||
| 981 | symbols in this group. The function @code{read-char} likewise converts | 981 | symbols in this group. The function @code{read-char} likewise converts |
| 982 | these events into characters. | 982 | these events into characters. |
| 983 | 983 | ||
| 984 | In @sc{ASCII}, @key{BS} is really @kbd{C-h}. But @code{backspace} | 984 | In @sc{ascii}, @key{BS} is really @kbd{C-h}. But @code{backspace} |
| 985 | converts into the character code 127 (@key{DEL}), not into code 8 | 985 | converts 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 | |||
| 1657 | characters. Now the flag that represents the Meta modifier in a | 1657 | characters. Now the flag that represents the Meta modifier in a |
| 1658 | character is | 1658 | character is |
| 1659 | @tex | 1659 | @tex |
| 1660 | $2^{27}$ | 1660 | @math{2^{27}} |
| 1661 | @end tex | 1661 | @end tex |
| 1662 | @ifinfo | 1662 | @ifinfo |
| 1663 | 2**27 | 1663 | 2**27 |
| @@ -1677,14 +1677,14 @@ in the string unchanged. | |||
| 1677 | @item | 1677 | @item |
| 1678 | The meta variants of those characters, with codes in the range of | 1678 | The 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 |
| 1683 | 2**27 | 1683 | 2**27 |
| 1684 | @end ifinfo | 1684 | @end ifinfo |
| 1685 | to | 1685 | to |
| 1686 | @tex | 1686 | @tex |
| 1687 | $2^{27} + 127$, | 1687 | @math{2^{27} + 127}, |
| 1688 | @end tex | 1688 | @end tex |
| 1689 | @ifinfo | 1689 | @ifinfo |
| 1690 | 2**27+127, | 1690 | 2**27+127, |
| @@ -1692,14 +1692,14 @@ $2^{27} + 127$, | |||
| 1692 | can also go in the string, but you must change their | 1692 | can also go in the string, but you must change their |
| 1693 | numeric values. You must set the | 1693 | numeric 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 |
| 1698 | 2**7 | 1698 | 2**7 |
| 1699 | @end ifinfo | 1699 | @end ifinfo |
| 1700 | bit instead of the | 1700 | bit instead of the |
| 1701 | @tex | 1701 | @tex |
| 1702 | $2^{27}$ | 1702 | @math{2^{27}} |
| 1703 | @end tex | 1703 | @end tex |
| 1704 | @ifinfo | 1704 | @ifinfo |
| 1705 | 2**27 | 1705 | 2**27 |
| @@ -1708,7 +1708,7 @@ bit, resulting in a value between 128 and 255. Only a unibyte string | |||
| 1708 | can include these codes. | 1708 | can include these codes. |
| 1709 | 1709 | ||
| 1710 | @item | 1710 | @item |
| 1711 | Non-@sc{ASCII} characters above 256 can be included in a multibyte string. | 1711 | Non-@sc{ascii} characters above 256 can be included in a multibyte string. |
| 1712 | 1712 | ||
| 1713 | @item | 1713 | @item |
| 1714 | Other keyboard character events cannot fit in a string. This includes | 1714 | Other keyboard character events cannot fit in a string. This includes |
| @@ -1869,7 +1869,7 @@ Echo Area}. | |||
| 1869 | 1869 | ||
| 1870 | If @var{inherit-input-method} is non-@code{nil}, then the current input | 1870 | If @var{inherit-input-method} is non-@code{nil}, then the current input |
| 1871 | method (if any) is employed to make it possible to enter a | 1871 | method (if any) is employed to make it possible to enter a |
| 1872 | non-@sc{ASCII} character. Otherwise, input method handling is disabled | 1872 | non-@sc{ascii} character. Otherwise, input method handling is disabled |
| 1873 | for reading this event. | 1873 | for reading this event. |
| 1874 | 1874 | ||
| 1875 | If @code{cursor-in-echo-area} is non-@code{nil}, then @code{read-event} | 1875 | If @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 | |||
| 1899 | function key event), @code{read-char} signals an error. The arguments | 1899 | function key event), @code{read-char} signals an error. The arguments |
| 1900 | work as in @code{read-event}. | 1900 | work as in @code{read-event}. |
| 1901 | 1901 | ||
| 1902 | In the first example, the user types the character @kbd{1} (@sc{ASCII} | 1902 | In the first example, the user types the character @kbd{1} (@sc{ascii} |
| 1903 | code 49). The second example shows a keyboard macro definition that | 1903 | code 49). The second example shows a keyboard macro definition that |
| 1904 | calls @code{read-char} from the minibuffer using @code{eval-expression}. | 1904 | calls @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 | |||
| 2078 | as part of a command or explicitly by a Lisp program. | 2078 | as part of a command or explicitly by a Lisp program. |
| 2079 | 2079 | ||
| 2080 | In the example below, the Lisp program reads the character @kbd{1}, | 2080 | In 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}, |
| 2082 | while @kbd{C-e} (we assume @kbd{C-x C-e} command is used to evaluate | 2082 | while @kbd{C-e} (we assume @kbd{C-x C-e} command is used to evaluate |
| 2083 | this expression) remains the value of @code{last-command-event}. | 2083 | this 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 |
| 2172 | second, you get an error if you specify nonzero @var{millisec}. | 2172 | second, you get an error if you specify nonzero @var{millisec}. |
| 2173 | 2173 | ||
| 2174 | @cindex forcing redisplay | 2174 | The expression @code{(sit-for 0)} is a convenient way to request a |
| 2175 | Redisplay is always preempted if input arrives, and does not happen at | 2175 | redisplay, without any delay. @xref{Forcing Redisplay}. |
| 2176 | all if input is available before it starts. Thus, there is no way to | ||
| 2177 | force screen updating if there is pending input; however, if there is no | ||
| 2178 | input pending, you can force an update with no delay by using | ||
| 2179 | @code{(sit-for 0)}. | ||
| 2180 | 2176 | ||
| 2181 | If @var{nodisp} is non-@code{nil}, then @code{sit-for} does not | 2177 | If @var{nodisp} is non-@code{nil}, then @code{sit-for} does not |
| 2182 | redisplay, but it still returns as soon as input is available (or when | 2178 | redisplay, 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 | |||
| 20 | level in a file of Lisp code---the forms are executed in the order | 20 | level in a file of Lisp code---the forms are executed in the order |
| 21 | written. We call this @dfn{textual order}. For example, if a function | 21 | written. We call this @dfn{textual order}. For example, if a function |
| 22 | body consists of two forms @var{a} and @var{b}, evaluation of the | 22 | body consists of two forms @var{a} and @var{b}, evaluation of the |
| 23 | function evaluates first @var{a} and then @var{b}, and the function's | 23 | function evaluates first @var{a} and then @var{b}. The result of |
| 24 | value is the value of @var{b}. | 24 | evaluating @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 |
| 27 | than sequential. | 27 | than sequential. |
| @@ -60,9 +60,9 @@ control construct of Lisp. | |||
| 60 | 60 | ||
| 61 | @noindent | 61 | @noindent |
| 62 | and it says to execute the forms @var{a}, @var{b}, @var{c}, and so on, in | 62 | and it says to execute the forms @var{a}, @var{b}, @var{c}, and so on, in |
| 63 | that order. These forms are called the body of the @code{progn} form. | 63 | that order. These forms are called the @dfn{body} of the @code{progn} form. |
| 64 | The value of the last form in the body becomes the value of the entire | 64 | The 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 | |||
| 72 | the body of a function was made into an ``implicit @code{progn}'': | 72 | the body of a function was made into an ``implicit @code{progn}'': |
| 73 | several forms are allowed just as in the body of an actual @code{progn}. | 73 | several forms are allowed just as in the body of an actual @code{progn}. |
| 74 | Many other control structures likewise contain an implicit @code{progn}. | 74 | Many other control structures likewise contain an implicit @code{progn}. |
| 75 | As a result, @code{progn} is not used as often as it used to be. It is | 75 | As a result, @code{progn} is not used as much as it was many years ago. |
| 76 | needed now most often inside an @code{unwind-protect}, @code{and}, | 76 | It 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 |
| 275 | This expression is a @code{cond} which returns @code{foo} if the value | 276 | This @code{cond} expression returns @code{foo} if the value of @code{a} |
| 276 | of @code{a} is @code{hack}, and returns the string @code{"default"} otherwise. | 277 | is @code{hack}, and returns the string @code{"default"} otherwise. |
| 277 | @end defspec | 278 | @end defspec |
| 278 | 279 | ||
| 279 | Any conditional construct can be expressed with @code{cond} or with | 280 | Any conditional construct can be expressed with @code{cond} or with |
| @@ -310,11 +311,14 @@ order written. | |||
| 310 | 311 | ||
| 311 | If any of the @var{conditions} evaluates to @code{nil}, then the result | 312 | If any of the @var{conditions} evaluates to @code{nil}, then the result |
| 312 | of the @code{and} must be @code{nil} regardless of the remaining | 313 | of 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 |
| 314 | remaining @var{conditions}. | 315 | the remaining @var{conditions}. |
| 315 | 316 | ||
| 316 | If all the @var{conditions} turn out non-@code{nil}, then the value of | 317 | If all the @var{conditions} turn out non-@code{nil}, then the value of |
| 317 | the last of them becomes the value of the @code{and} form. | 318 | the last of them becomes the value of the @code{and} form. Just |
| 319 | @code{(and)}, with no @var{conditions}, returns @code{t}, appropriate | ||
| 320 | because all the @var{conditions} turned out non-@code{nil}. (Think | ||
| 321 | about it; which one did not?) | ||
| 318 | 322 | ||
| 319 | Here is an example. The first condition returns the integer 1, which is | 323 | Here is an example. The first condition returns the integer 1, which is |
| 320 | not @code{nil}. Similarly, the second condition returns the integer 2, | 324 | not @code{nil}. Similarly, the second condition returns the integer 2, |
| @@ -368,10 +372,13 @@ right away, ignoring the remaining @var{conditions}. The value it | |||
| 368 | returns is the non-@code{nil} value of the condition just evaluated. | 372 | returns is the non-@code{nil} value of the condition just evaluated. |
| 369 | 373 | ||
| 370 | If all the @var{conditions} turn out @code{nil}, then the @code{or} | 374 | If all the @var{conditions} turn out @code{nil}, then the @code{or} |
| 371 | expression returns @code{nil}. | 375 | expression 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 | ||
| 378 | did not?) | ||
| 372 | 379 | ||
| 373 | For example, this expression tests whether @code{x} is either 0 or | 380 | For 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 | ||
| 449 | If you would like to execute something on each iteration before the | 456 | To write a ``repeat...until'' loop, which will execute something on each |
| 450 | end-test, put it together with the end-test in a @code{progn} as the | 457 | iteration and then do the end-test, put the body followed by the |
| 451 | first argument of @code{while}, as shown here: | 458 | end-test in a @code{progn} as the first argument of @code{while}, as |
| 459 | shown 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 | |||
| 560 | error or nonlocal exit) the value of the last body form is returned from | 568 | error or nonlocal exit) the value of the last body form is returned from |
| 561 | the @code{catch}. | 569 | the @code{catch}. |
| 562 | 570 | ||
| 563 | If a @code{throw} is done within @var{body} specifying the same value | 571 | If a @code{throw} is executed during the execution of @var{body}, |
| 564 | @var{tag}, the @code{catch} exits immediately; the value it returns is | 572 | specifying the same value @var{tag}, the @code{catch} form exits |
| 565 | whatever was specified as the second argument of @code{throw}. | 573 | immediately; the value it returns is whatever was specified as the |
| 574 | second 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 | |||
| 709 | considered an error, but it is handled almost like an error. | 711 | considered 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 | ||
| 715 | exist''), not how things ought to be (``File must exist''). The | ||
| 716 | convention in Emacs Lisp is that error messages should start with a | ||
| 717 | capital 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 |
| 713 | This function signals an error with an error message constructed by | 720 | This function signals an error with an error message constructed by |
| 714 | applying @code{format} (@pxref{String Conversion}) to | 721 | applying @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 |
| 853 | starting with the most recently established one. Thus, if two nested | 860 | starting 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 |
| 855 | the two will actually handle it. | 862 | the 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 |
| 858 | ordinarily prevents the debugger from being run, even if | 865 | ordinarily prevents the debugger from being run, even if |
| @@ -881,10 +888,11 @@ totally unpredictable, such as when the program evaluates an expression | |||
| 881 | read from the user. | 888 | read 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 |
| 885 | cannot be caught by a @code{catch}, and a @code{throw} cannot be handled | 892 | facilities. An error cannot be caught by a @code{catch}, and a |
| 886 | by 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 |
| 895 | that can be handled). | ||
| 888 | 896 | ||
| 889 | @defspec condition-case var protected-form handlers@dots{} | 897 | @defspec condition-case var protected-form handlers@dots{} |
| 890 | This special form establishes the error handlers @var{handlers} around | 898 | This 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 | ||
| 1130 | Only the @var{body} is actually protected by the @code{unwind-protect}. | 1138 | Only the @var{body} is protected by the @code{unwind-protect}. If any |
| 1131 | If any of the @var{cleanup-forms} themselves exits nonlocally (e.g., via | 1139 | of the @var{cleanup-forms} themselves exits nonlocally (via a |
| 1132 | a @code{throw} or an error), @code{unwind-protect} is @emph{not} | 1140 | @code{throw} or an error), @code{unwind-protect} is @emph{not} |
| 1133 | guaranteed to evaluate the rest of them. If the failure of one of the | 1141 | guaranteed 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 |
| 1135 | with another @code{unwind-protect} around that form. | 1143 | with another @code{unwind-protect} around that form. |
| @@ -1167,13 +1175,13 @@ Several of the macros defined in this manual use @code{unwind-protect} | |||
| 1167 | in this way. | 1175 | in 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 |
| 1171 | creates a process (@pxref{Processes}) to try to establish a connection | 1179 | process (@pxref{Processes}) to try to establish a connection to a remote |
| 1172 | to a remote machine. As the function @code{ftp-login} is highly | 1180 | machine. As the function @code{ftp-login} is highly susceptible to |
| 1173 | susceptible to numerous problems that the writer of the function cannot | 1181 | numerous problems that the writer of the function cannot anticipate, it |
| 1174 | anticipate, it is protected with a form that guarantees deletion of the | 1182 | is protected with a form that guarantees deletion of the process in the |
| 1175 | process in the event of failure. Otherwise, Emacs might fill up with | 1183 | event of failure. Otherwise, Emacs might fill up with useless |
| 1176 | useless subprocesses. | 1184 | subprocesses. |
| 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 |
| 1192 | quit, and the quit happens immediately after the function | 1200 | quit, 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 |
| 1194 | set, the process will not be killed. There is no easy way to fix this bug, | 1202 | set, 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 |
| 25 | for faces) accept keyword arguments for specifying various information. | 25 | for 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 | |||
| 31 | display one name. | 31 | display one name. |
| 32 | 32 | ||
| 33 | @table @code | 33 | @table @code |
| 34 | @item :tag @var{name} | 34 | @item :tag @var{label} |
| 35 | Use @var{name}, a string, instead of the item's name, to label the item | 35 | Use @var{label}, a string, instead of the item's name, to label the item |
| 36 | in customization menus and buffers. | 36 | in 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 | ||
| 43 | If you use this keyword more than once, you can put a single item into | 43 | If you use this keyword more than once, you can put a single item into |
| 44 | more than one group. Displaying any of those groups will show this | 44 | more than one group. Displaying any of those groups will show this |
| 45 | item. Be careful not to overdo this! | 45 | item. 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} |
| 48 | Include an external link after the documentation string for this item. | 48 | Include an external link after the documentation string for this item. |
| @@ -113,7 +113,8 @@ keyword. | |||
| 113 | @tindex defgroup | 113 | @tindex defgroup |
| 114 | Declare @var{group} as a customization group containing @var{members}. | 114 | Declare @var{group} as a customization group containing @var{members}. |
| 115 | Do not quote the symbol @var{group}. The argument @var{doc} specifies | 115 | Do not quote the symbol @var{group}. The argument @var{doc} specifies |
| 116 | the documentation string for the group. | 116 | the 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 | ||
| 118 | The argument @var{members} is a list specifying an initial set of | 119 | The argument @var{members} is a list specifying an initial set of |
| 119 | customization items to be members of the group. However, most often | 120 | customization 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 |
| 166 | Declare @var{option} as a customizable user option variable. Do not | 167 | Declare @var{option} as a customizable user option variable. Do not |
| 167 | quote @var{option}. The argument @var{doc} specifies the documentation | 168 | quote @var{option}. The argument @var{doc} specifies the documentation |
| 168 | string for the variable. | 169 | string for the variable; it should normally start with a @samp{*}. This |
| 170 | marks the variable, for other purposes, as one that users may want to | ||
| 171 | customize. | ||
| 169 | 172 | ||
| 170 | If @var{option} is void, @code{defcustom} initializes it to | 173 | If @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 |
| 172 | value; be careful in writing it, because it can be evaluated on more | 175 | value; be careful in writing it, because it can be evaluated on more |
| 173 | than one occasion. | 176 | than one occasion. |
| 177 | |||
| 178 | When you evaluate a @code{defcustom} form with @kbd{C-M-x} in Emacs Lisp | ||
| 179 | mode (@code{eval-defun}), a special feature of @code{eval-defun} | ||
| 180 | arranges to set the variable unconditionally, without testing whether | ||
| 181 | its 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 | |||
| 277 | definition. You can do it thus: | 286 | definition. 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 | ||
| 393 | You can specify the key and value types like this: | 403 | You 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 |
| 401 | where @var{key-type} and @var{value-type} are customization type | 410 | where @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 | |||
| 414 | specifications. Ordinarily, the options are simply atoms, which are the | 423 | specifications. Ordinarily, the options are simply atoms, which are the |
| 415 | specified keys. For example: | 424 | specified 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 |
| 422 | specifies that there are three ``known'' keys, namely @code{"foo"}, | 431 | specifies 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 | |||
| 428 | specification. The first element will specify the key, like before, | 437 | specification. The first element will specify the key, like before, |
| 429 | while the second element will specify the value type. | 438 | while 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 | ||
| 435 | Finally, you may want to change how the key is presented. By default, | 444 | Finally, you may want to change how the key is presented. By default, |
| 436 | the key is simply shown as a @code{const}, since the user cannot change | 445 | the 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 | |||
| 440 | This is done by using a customization type specification instead of a | 449 | This is done by using a customization type specification instead of a |
| 441 | symbol for the key. | 450 | symbol 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 | ||
| 447 | Many alists use lists with two elements, instead of cons cells. For | 456 | Many alists use lists with two elements, instead of cons cells. For |
| 448 | example, | 457 | example, |
| 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 |
| 456 | instead of | 465 | instead 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 | ||
| 463 | Because of the way lists are implemented on top of cons cells, you can | 472 | Because of the way lists are implemented on top of cons cells, you can |
| 464 | treat @code{list-alist} in the example above as a cons cell alist, where | 473 | treat @code{list-alist} in the example above as a cons cell alist, where |
| 465 | the value type is a list with a single element containing the real | 474 | the value type is a list with a single element containing the real |
| 466 | value. | 475 | value. |
| 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 | ||
| 474 | The @code{group} widget is used here instead of @code{list} only because | 483 | The @code{group} widget is used here instead of @code{list} only because |
| 475 | the formatting is better suited for the purpose. | 484 | the formatting is better suited for the purpose. |
| @@ -477,7 +486,7 @@ the formatting is better suited for the purpose. | |||
| 477 | Similarily, you can have alists with more values associated with each | 486 | Similarily, you can have alists with more values associated with each |
| 478 | key, using variations of this trick: | 487 | key, 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 |
| 495 | The @code{plist} custom type is similar to the @code{alist} (see above), | 504 | The @code{plist} custom type is similar to the @code{alist} (see above), |
| 496 | except that the information is stored as a property list, i.e. a list of | 505 | except that the information is stored as a property list, i.e. a list of |
| 497 | this form: | 506 | this 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 | ||
| 503 | The default @code{:key-type} for @code{plist} is @code{symbol}, | 512 | The default @code{:key-type} for @code{plist} is @code{symbol}, |
| 504 | rather than @code{sexp}. | 513 | rather 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 |
| 512 | The value of this variable is the function to call to invoke the | 512 | The value of this variable is the function to call to invoke the |
| 513 | debugger. Its value must be a function of any number of arguments (or, | 513 | debugger. Its value must be a function of any number of arguments, or, |
| 514 | more typically, the name of a function). Presumably this function will | 514 | more typically, the name of a function. This function should invoke |
| 515 | enter some kind of debugger. The default value of the variable is | 515 | some kind of debugger. The default value of the variable is |
| 516 | @code{debug}. | 516 | @code{debug}. |
| 517 | 517 | ||
| 518 | The first argument that Lisp hands to the function indicates why it | 518 | The first argument that Lisp hands to the function indicates why it |
| @@ -531,11 +531,13 @@ value is always @code{nil}. | |||
| 531 | 531 | ||
| 532 | In the following example, a Lisp expression calls @code{backtrace} | 532 | In the following example, a Lisp expression calls @code{backtrace} |
| 533 | explicitly. This prints the backtrace to the stream | 533 | explicitly. 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}. |
| 536 | function call. The line shows the values of the function's arguments if | 536 | |
| 537 | they are all known. If they are still being computed, the line says so. | 537 | Each line of the backtrace represents one function call. The line shows |
| 538 | The arguments of special forms are elided. | 538 | the values of the function's arguments if they are all known; if they |
| 539 | are still being computed, the line says so. The arguments of special | ||
| 540 | forms 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 | |||
| 620 | information for future debugger invocations during the same command | 622 | information for future debugger invocations during the same command |
| 621 | invocation. | 623 | invocation. |
| 622 | 624 | ||
| 623 | The advantage, for the debugger, of using this variable rather than an | 625 | The advantage of using this variable rather than an ordinary global |
| 624 | ordinary global variable is that the data will never carry over to a | 626 | variable is that the data will never carry over to a subsequent command |
| 625 | subsequent command invocation. | 627 | invocation. |
| 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 | |||
| 630 | debuggers. It returns information about what computation is happening | 632 | debuggers. It returns information about what computation is happening |
| 631 | in the stack frame @var{frame-number} levels down. | 633 | in the stack frame @var{frame-number} levels down. |
| 632 | 634 | ||
| 633 | If that frame has not evaluated the arguments yet (or is a special | 635 | If that frame has not evaluated the arguments yet, or is a special |
| 634 | form), the value is @code{(nil @var{function} @var{arg-forms}@dots{})}. | 636 | form, the value is @code{(nil @var{function} @var{arg-forms}@dots{})}. |
| 635 | 637 | ||
| 636 | If that frame has evaluated its arguments and called its function | 638 | If that frame has evaluated its arguments and called its function |
| 637 | already, the value is @code{(t @var{function} | 639 | already, the return value is @code{(t @var{function} |
| 638 | @var{arg-values}@dots{})}. | 640 | @var{arg-values}@dots{})}. |
| 639 | 641 | ||
| 640 | In the return value, @var{function} is whatever was supplied as the | 642 | In 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 |
| 682 | an excess open parenthesis, the way to do this is to insert a | 684 | an excess open parenthesis, the way to do this is to go to the end of |
| 683 | close parenthesis at the end of the file and type @kbd{C-M-b} | 685 | the 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 | 686 | of the defun that is unbalanced. |
| 685 | defun that is unbalanced. (Then type @kbd{C-@key{SPC} C-_ C-u | ||
| 686 | C-@key{SPC}} to set the mark there, undo the insertion of the | ||
| 687 | close 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 |
| 690 | way to be sure of this except by studying the program, but often the | 689 | way 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 |
| 719 | parenthesis at the beginning of the file, back up over it, and type | 718 | the 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 | 719 | defun. |
| 721 | @kbd{C-@key{SPC} C-_ C-u C-@key{SPC}} to set the mark there, undo the | ||
| 722 | insertion 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} |
| 725 | at the beginning of that defun. This will leave you somewhere short of | 722 | at 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 | |||
| 64 | to redraw, @code{nil} means redrawing is needed. The default is @code{nil}. | 67 | to 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 | ||
| 75 | at all if input is available before it starts. Most of the time, this | ||
| 76 | is exactly what you want. However, you can prevent preemption by | ||
| 77 | binding @code{redisplay-dont-pause} to a non-@code{nil} value. | ||
| 78 | |||
| 79 | @tindex redisplay-dont-pause | ||
| 80 | @defvar redisplay-dont-pause | ||
| 81 | If this variable is non-@code{nil}, pending input does not | ||
| 82 | prevent or halt redisplay; redisplay occurs, and finishes, | ||
| 83 | regardless of whether input is available. This feature is available | ||
| 84 | as of Emacs 21. | ||
| 85 | @end defvar | ||
| 86 | |||
| 87 | You can request a display update, but only if no input is pending, | ||
| 88 | with @code{(sit-for 0)}. To force a display update even when input is | ||
| 89 | pending, 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. | |||
| 158 | In batch mode, @code{message} prints the message text on the standard | 187 | In batch mode, @code{message} prints the message text on the standard |
| 159 | error stream, followed by a newline. | 188 | error stream, followed by a newline. |
| 160 | 189 | ||
| 190 | If @var{string}, or strings among the @var{arguments}, have @code{face} | ||
| 191 | text properties, these affect the way the message is displayed. | ||
| 192 | |||
| 161 | @c Emacs 19 feature | 193 | @c Emacs 19 feature |
| 162 | If @var{string} is @code{nil}, @code{message} clears the echo area. If | 194 | If @var{string} is @code{nil}, @code{message} clears the echo area; if |
| 163 | the minibuffer is active, this brings the minibuffer contents back onto | 195 | the echo area has been expanded automatically, this brings it back to |
| 164 | the screen immediately. | 196 | its normal size. If the minibuffer is active, this brings the |
| 197 | minibuffer 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 | ||
| 685 | Overlay properties are like text properties in that the properties that | 718 | Overlay properties are like text properties in that the properties that |
| 686 | alter how a character is displayed can come from either source. But in | 719 | alter how a character is displayed can come from either source. But in |
| 687 | most respects they are different. Text properties are considered a part | 720 | most respects they are different. Text properties are considered a part |
| 688 | of the text; overlays are specifically considered not to be part of the | 721 | of 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 | |||
| 693 | changes, overlay changes are not recorded in the buffer's undo list. | 726 | changes, 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 | ||
| 730 | overlay: | ||
| 731 | |||
| 732 | @defun overlay-get overlay prop | ||
| 733 | This function returns the value of property @var{prop} recorded in | ||
| 734 | @var{overlay}, if any. If @var{overlay} does not record any value for | ||
| 735 | that property, but it does have a @code{category} property which is a | ||
| 736 | symbol, that symbol's @var{prop} property is used. Otherwise, the value | ||
| 737 | is @code{nil}. | ||
| 738 | @end defun | ||
| 739 | |||
| 740 | @defun overlay-put overlay prop value | ||
| 741 | This 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 | ||
| 746 | overlay properties and text properties for a given character. | ||
| 747 | @xref{Examining Properties}. | ||
| 748 | |||
| 749 | Many overlay properties have special meanings; here is a table | ||
| 750 | of 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)} |
| 723 | This property controls the way text is displayed---for example, which | 779 | This property controls the way text is displayed---for example, which |
| 724 | font and which colors. Its value is a face name or a list of face | 780 | font and which colors. @xref{Faces}, for more information. |
| 725 | names. @xref{Faces}, for more information. | ||
| 726 | 781 | ||
| 727 | If the property value is a list, elements may also have the form | 782 | In 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 | 783 | then each element can be any of these possibilities; |
| 729 | . @var{color-name})}. These elements specify just the foreground color | 784 | |
| 730 | or just the background color; therefore, there is no need to create a | 785 | @itemize @bullet |
| 731 | face for each color that you want to use. | 786 | @item |
| 787 | A face name (a symbol or string). | ||
| 788 | |||
| 789 | @item | ||
| 790 | Starting in Emacs 21, a property list of face attributes. This has the | ||
| 791 | form (@var{keyword} @var{value} @dots{}), where each @var{keyword} is a | ||
| 792 | face attribute name and @var{value} is a meaningful value for that | ||
| 793 | attribute. With this feature, you do not need to create a face each | ||
| 794 | time you want to specify a particular attribute for certain text. | ||
| 795 | @xref{Face Attributes}. | ||
| 796 | |||
| 797 | @item | ||
| 798 | A cons cell of the form @code{(foreground-color . @var{color-name})} or | ||
| 799 | @code{(background-color . @var{color-name})}. These elements specify | ||
| 800 | just 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)} |
| 735 | This property is used instead of @code{face} when the mouse is within | 808 | This property is used instead of @code{face} when the mouse is within |
| 736 | the range of the overlay. | 809 | the range of the overlay. |
| 737 | 810 | ||
| 811 | @item display | ||
| 812 | @kindex display @r{(overlay property)} | ||
| 813 | This property activates various features that change the | ||
| 814 | way text is displayed. For example, it can make text appear taller | ||
| 815 | or 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)} | ||
| 820 | If an overlay has a string as its @code{help-echo} property, then when | ||
| 821 | you move the mouse onto the text in the overlay, Emacs displays that | ||
| 822 | string in the echo area, or in the tooltip window. It is available | ||
| 823 | starting 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)} |
| 740 | This property's value is a list of functions to be called if any | 827 | This 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 | |||
| 818 | the character after point is within the overlay. @xref{Active Keymaps}. | 905 | the 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 | ||
| 822 | overlay. | ||
| 823 | |||
| 824 | @defun overlay-get overlay prop | ||
| 825 | This function returns the value of property @var{prop} recorded in | ||
| 826 | @var{overlay}, if any. If @var{overlay} does not record any value for | ||
| 827 | that property, but it does have a @code{category} property which is a | ||
| 828 | symbol, that symbol's @var{prop} property is used. Otherwise, the value | ||
| 829 | is @code{nil}. | ||
| 830 | @end defun | ||
| 831 | |||
| 832 | @defun overlay-put overlay prop value | ||
| 833 | This 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 | ||
| 838 | overlay 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 | ||
| 977 | A @dfn{face} is a named collection of graphical attributes: font, | 1044 | A @dfn{face} is a named collection of graphical attributes: font |
| 978 | foreground color, background color, and optional underlining. Faces | 1045 | family, foreground color, background color, optional underlining, and |
| 979 | control the display of text on the screen. | 1046 | many others. Faces are used in Emacs to control the style of display of |
| 1047 | particular parts of the text or the frame. | ||
| 980 | 1048 | ||
| 981 | @cindex face id | 1049 | @cindex face id |
| 982 | Each face has its own @dfn{face number}, which distinguishes faces at | 1050 | Each face has its own @dfn{face number}, which distinguishes faces at |
| 983 | low levels within Emacs. However, for most purposes, you can refer to | 1051 | low levels within Emacs. However, for most purposes, you refer to |
| 984 | faces in Lisp programs by their names. | 1052 | faces 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 |
| 1083 | are used for displaying certain parts of the frames or certain kinds of | ||
| 1084 | text; 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)} |
| 1011 | This face is used for ordinary text. | 1089 | This face is used for ordinary text. |
| 1012 | 1090 | ||
| 1091 | @item mode-line | ||
| 1092 | @kindex mode-line @r{(face name)} | ||
| 1093 | This face is used for mode lines, and for menu bars | ||
| 1094 | when toolkit menus are not used. | ||
| 1095 | |||
| 1013 | @item modeline | 1096 | @item modeline |
| 1014 | @kindex modeline @r{(face name)} | 1097 | @kindex modeline @r{(face name)} |
| 1015 | This face is used for mode lines and menu bars. | 1098 | This is an alias for the @code{mode-line} face, for compatibility with |
| 1099 | old Emacs versions. | ||
| 1100 | |||
| 1101 | @item header-line | ||
| 1102 | @kindex header-line @r{(face name)} | ||
| 1103 | This face is used for the header lines of windows that have them. | ||
| 1104 | |||
| 1105 | @item fringe | ||
| 1106 | @kindex fringe @r{(face name)} | ||
| 1107 | This face controls the colors of window fringes, the thin areas on | ||
| 1108 | either side that are used to display continuation and truncation glyphs. | ||
| 1109 | |||
| 1110 | @item scroll-bar | ||
| 1111 | @kindex scroll-bar @r{(face name)} | ||
| 1112 | This face controls the colors for display of scroll bars. | ||
| 1113 | |||
| 1114 | @item tool-bar | ||
| 1115 | @kindex tool-bar @r{(face name)} | ||
| 1116 | This 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)} |
| 1027 | This face is meant to be used for highlighting for various purposes. | 1128 | This 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)} |
| 1031 | This face underlines text. | 1132 | This 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 | ||
| 1136 | in specific ways. You can use them on specific text, when you want | ||
| 1137 | the 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)} |
| 1035 | This face uses a bold font, if possible. It uses the bold variant of | 1142 | This 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)} |
| 1045 | This face uses the bold italic variant of the frame's font, if it has | 1152 | This face uses the bold italic variant of the frame's font, if it has |
| 1046 | one. | 1153 | one. |
| 1154 | |||
| 1155 | @item underline | ||
| 1156 | @kindex underline @r{(face name)} | ||
| 1157 | This face underlines text. | ||
| 1158 | |||
| 1159 | @item fixed-patch | ||
| 1160 | @kindex fixed-patch @r{(face name)} | ||
| 1161 | This face forces use of a particular fixed-width font. | ||
| 1162 | |||
| 1163 | @item variable-patch | ||
| 1164 | @kindex variable-patch @r{(face name)} | ||
| 1165 | This face forces use of a particular variable-width font. It's | ||
| 1166 | reasonable to customize this to use a diffrent variable-width font, if | ||
| 1167 | you 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 | |||
| 1139 | as if they had a light background. | 1260 | as 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 |
| 1268 | attributes}. This table lists all the face attributes, and what they | ||
| 1269 | mean. Note that in general, more than one face be specified for a given | ||
| 1270 | piece of text; when that happens, the attributes of all the faces are | ||
| 1271 | merged 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. |
| 1149 | With defaults. Each frame has a @dfn{default face}, which is used for | 1275 | In face merging, when the first face fails to specify a particular |
| 1150 | all text that doesn't somehow specify another face. (We may change this | 1276 | attribute, that means the next face gets a chance. However, the |
| 1151 | in 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 |
| 1154 | With text properties. A character may have a @code{face} property; if so, | 1280 | kinds of displays---if your display cannot handle a certain attribute, |
| 1155 | it is displayed with that face. @xref{Special Properties}. | 1281 | the attribute is ignored. |
| 1156 | 1282 | ||
| 1157 | If the character has a @code{mouse-face} property, that is used instead | 1283 | @table @code |
| 1158 | of the @code{face} property when the mouse is ``near enough'' to the | 1284 | @item :family |
| 1159 | character. | 1285 | Font family name, or fontset name (@pxref{Fontsets}). If you specify a |
| 1286 | font family name, the wild-cards @samp{*} and @samp{?} are allowed. | ||
| 1287 | |||
| 1288 | @item :width | ||
| 1289 | Relative proportionate width, also known as the character set width or | ||
| 1290 | set 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 | ||
| 1296 | Font height, an integer in units of 1/10pt. | ||
| 1297 | |||
| 1298 | @item :weight | ||
| 1299 | Font 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 | ||
| 1303 | specified. | ||
| 1304 | |||
| 1305 | @item :slant | ||
| 1306 | Font slant---one of the symbols @code{italic}, @code{oblique}, @code{normal}, | ||
| 1307 | @code{reverse-italic}, or @code{reverse-oblique}. | ||
| 1308 | |||
| 1309 | @item :foreground | ||
| 1310 | Foreground color, a string. | ||
| 1311 | |||
| 1312 | @item :background | ||
| 1313 | Background color, a string. | ||
| 1314 | |||
| 1315 | @item :inverse-video | ||
| 1316 | Whether or not characters should be displayed in inverse video. The | ||
| 1317 | value should be @code{t} (yes) or @code{nil} (no). | ||
| 1318 | |||
| 1319 | @item :stipple | ||
| 1320 | The background stipple, a bitmap name. | ||
| 1321 | |||
| 1322 | The value can be a string; then is the name of a file of pixmap data. | ||
| 1323 | The file is found in the directories listed in the variable | ||
| 1324 | @code{x-bitmap-file-path}. | ||
| 1325 | |||
| 1326 | Alternatively, 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 | ||
| 1328 | pixels, and @var{data} is a string containing the raw bits of the | ||
| 1329 | bitmap. | ||
| 1330 | |||
| 1331 | If the value is @code{nil}, that means use no stipple pattern. | ||
| 1332 | |||
| 1333 | Normally you do not need to set the stipple attribute, because it is | ||
| 1334 | used automatically to handle certain shades of gray. | ||
| 1335 | |||
| 1336 | @item :underline | ||
| 1337 | Whether or not characters should be underlined, and in what color. If | ||
| 1338 | the value is @code{t}, underlining uses the foreground color of the | ||
| 1339 | face. If the value is a string, underlining uses that color. The | ||
| 1340 | value @code{nil} means do not underline. | ||
| 1341 | |||
| 1342 | @item :overline | ||
| 1343 | Whether or not characters should be overlined, and in what color. | ||
| 1344 | The value is used like that of @code{:underline}. | ||
| 1345 | |||
| 1346 | @item :strike-through | ||
| 1347 | Whether or not characters should be strike-through, and in what | ||
| 1348 | color. The value is used like that of @code{:underline}. | ||
| 1349 | |||
| 1350 | @item :box | ||
| 1351 | Whether or not a box should be drawn around characters, its color, the | ||
| 1352 | width of the box lines, and 3D appearance. See below for the possible | ||
| 1353 | values and what they mean. | ||
| 1354 | @end table | ||
| 1160 | 1355 | ||
| 1161 | @item | 1356 | Here are the possible values of the @code{:box} attribute, and what |
| 1162 | With overlays. An overlay may have @code{face} and @code{mouse-face} | 1357 | they mean: |
| 1163 | properties too; they apply to all the text covered by the overlay. | ||
| 1164 | 1358 | ||
| 1165 | @item | 1359 | @table @asis |
| 1166 | With a region that is active. In Transient Mark mode, the region is | 1360 | @item @code{nil} |
| 1167 | highlighted with a particular face (see @code{region-face}, below). | 1361 | Don't draw a box. |
| 1168 | 1362 | ||
| 1169 | @item | 1363 | @item @code{t} |
| 1170 | With special glyphs. Each glyph can specify a particular face | 1364 | Draw a box with lines of width 1, in the foreground color. |
| 1171 | number. @xref{Glyphs}. | ||
| 1172 | @end itemize | ||
| 1173 | 1365 | ||
| 1174 | If these various sources together specify more than one face for a | 1366 | @item @var{color} |
| 1175 | particular character, Emacs merges the attributes of the various faces | 1367 | Draw a box with lines of width 1, in color @var{color}. |
| 1176 | specified. The attributes of the faces of special glyphs come first; | ||
| 1177 | then comes the face for region highlighting, if appropriate; | ||
| 1178 | then come attributes of faces from overlays, followed by those from text | ||
| 1179 | properties, 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})} |
| 1182 | priority overrides those with lower priority. @xref{Overlays}. | 1370 | This 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 | 1373 | The value @var{color} specifies the color to draw with. The default is |
| 1185 | the above ways, the frame's own font or color is used. | 1374 | the foreground color of the face for simple boxes, and the background |
| 1375 | color of the face for 3D boxes. | ||
| 1186 | 1376 | ||
| 1187 | @node Face Functions | 1377 | The 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 |
| 1379 | pressed. If it is @code{pressed-button}, the box looks like a 3D button | ||
| 1380 | that is being pressed. If it is @code{nil} or omitted, a plain 2D box | ||
| 1381 | is 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 |
| 1191 | color, the background color, and underlining. The face can also leave | 1385 | @code{:box} are new in Emacs 21. The attributes @code{:family}, |
| 1192 | these unspecified by giving the value @code{nil} for them. | 1386 | @code{:height}, @code{:width}, @code{:weight}, @code{:slant} are also |
| 1387 | new, previous versions had another way to specify some of the same | ||
| 1388 | information. | ||
| 1193 | 1389 | ||
| 1194 | Here are the primitives for creating and changing faces. | 1390 | @table @code |
| 1391 | @item :font | ||
| 1392 | This attribute specified the font name. | ||
| 1195 | 1393 | ||
| 1196 | @defun make-face name | 1394 | @item :bold |
| 1197 | This function defines a new face named @var{name}, initially with all | 1395 | A non-@code{nil} value specifies a bold font. |
| 1198 | attributes @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 |
| 1203 | This function returns a list of all defined face names. | 1398 | A 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, |
| 1207 | This function defines the face @var{new-name} as a copy of the existing | 1402 | even though they are not real face attributes. Here is what that does: |
| 1208 | face named @var{old-face}. It creates the face @var{new-name} if that | ||
| 1209 | doesn't already exist. | ||
| 1210 | 1403 | ||
| 1211 | If the optional argument @var{frame} is given, this function applies | 1404 | @table @code |
| 1212 | only to that frame. Otherwise it applies to each frame individually, | 1405 | @item :font |
| 1213 | copying 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 |
| 1214 | in the same frame. | 1407 | @code{set-face-attribute} to specify several attributes at once. You |
| 1408 | specify an X font name as the value, and based on this font name, and | ||
| 1409 | it sets the attributes @code{:family}, @code{:width}, @code{:height}, | ||
| 1410 | @code{:weight}, and @code{:slant} according to the font name. | ||
| 1411 | |||
| 1412 | If the value is a pattern with wildcards, the first font that matches | ||
| 1413 | the pattern is used to set these attributes. | ||
| 1414 | |||
| 1415 | @item :bold | ||
| 1416 | A non-@code{nil} makes the face bold; @code{nil} makes it normal. | ||
| 1417 | This actually works by setting the @code{:weight} attribute. | ||
| 1418 | |||
| 1419 | @item :italic | ||
| 1420 | A non-@code{nil} makes the face italic; @code{nil} makes it normal. | ||
| 1421 | This actually works by setting the @code{:slant} attribute. | ||
| 1422 | @end table | ||
| 1215 | 1423 | ||
| 1216 | If the optional argument @var{new-frame} is given, then @code{copy-face} | 1424 | @defvar x-bitmap-file-path |
| 1217 | copies the attributes of @var{old-face} in @var{frame} to @var{new-name} | 1425 | This variable specifies a list of directories for searching |
| 1218 | in @var{new-frame}. | 1426 | for 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 |
| 1222 | functions. If you specify @var{frame}, they affect just that frame; | 1433 | functions. If you specify @var{frame}, they affect just that frame; |
| 1223 | otherwise, they affect all frames as well as the defaults that apply to | 1434 | otherwise, they affect all frames as well as the defaults that apply to |
| 1224 | new frames. | 1435 | new frames. |
| 1225 | 1436 | ||
| 1437 | @tindex set-face-attribute | ||
| 1438 | @defun set-face-attribute face frame &rest arguments | ||
| 1439 | This function sets one or more attributes of face @var{face} | ||
| 1440 | for frame @var{frame}. If @var{frame} is @code{nil}, it sets | ||
| 1441 | the attribute for all frames, and the defaults for new frames. | ||
| 1442 | |||
| 1443 | The extra arguments @var{arguments} specify the attributes to set, and | ||
| 1444 | the values for them. They should consist of alternating attribute names | ||
| 1445 | (such as @code{:family} or @code{:underline} and corresponding values. | ||
| 1446 | Thus, | ||
| 1447 | |||
| 1448 | @example | ||
| 1449 | (set-face-attribute 'foo nil | ||
| 1450 | :width :extended | ||
| 1451 | :weight :bold | ||
| 1452 | :underline "red") | ||
| 1453 | @end example | ||
| 1454 | |||
| 1455 | @noindent | ||
| 1456 | sets the attributes @code{:width}, @code{:weight} and @code{:underline} | ||
| 1457 | to the corresponding values. | ||
| 1458 | @end defun | ||
| 1459 | |||
| 1460 | @tindex face-attribute | ||
| 1461 | @defun face-attribute face attribute &optional frame | ||
| 1462 | This returns the value of the @var{attribute} attribute of face | ||
| 1463 | @var{face} on @var{frame}. If @var{frame} is @code{nil}, | ||
| 1464 | that means the selected frame. | ||
| 1465 | |||
| 1466 | If @var{frame} is @code{t}, the value is the default for | ||
| 1467 | @var{face} for new frames. | ||
| 1468 | |||
| 1469 | For 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 | ||
| 1478 | and 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 |
| 1228 | These functions set the foreground (or background, respectively) color | 1482 | These 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 |
| 1247 | This function sets the font of face @var{face}. The argument @var{font} | 1501 | This function sets the font of face @var{face}. |
| 1248 | should be a string, either a valid font name for your system or the name | 1502 | |
| 1249 | of an Emacs fontset (@pxref{Fontsets}). Note that if you set the font | 1503 | In Emacs 21, this actually sets the attributes @code{:family}, |
| 1504 | @code{:width}, @code{:height}, @code{:weight}, and @code{:slant} | ||
| 1505 | according to the font name @var{font}. | ||
| 1506 | |||
| 1507 | In Emacs 20, this sets the font attribute. Once you set the font | ||
| 1250 | explicitly, the bold and italic attributes cease to have any effect, | 1508 | explicitly, the bold and italic attributes cease to have any effect, |
| 1251 | because the precise font that you specified is always used. | 1509 | because 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 |
| 1256 | This function sets the bold attribute of face @var{face}. | 1514 | This function specifies whether @var{face} should be bold. If |
| 1257 | Non-@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 | |||
| 1517 | In Emacs 21, this sets the @code{:weight} attribute. | ||
| 1518 | In 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 |
| 1262 | This function sets the italic attribute of face @var{face}. | 1523 | This function specifies whether @var{face} should be italic. If |
| 1263 | Non-@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 | |||
| 1526 | In Emacs 21, this sets the @code{:slant} attribute. | ||
| 1527 | In 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 |
| 1272 | Swap the foreground and background colors of face @var{face}. If the | 1536 | This function inverts the @code{:inverse-video} attribute of face |
| 1273 | face doesn't specify both foreground and background, then its foreground | 1537 | @var{face}. If the attribute is @code{nil}, this function sets it to |
| 1274 | and background are set to the default background and foreground, | 1538 | @code{t}, and vice versa. |
| 1275 | respectively. | ||
| 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 |
| 1298 | This function returns the bold attribute of face @var{face}. | 1561 | This function returns @code{t} if @var{face} is bold---that is, if it is |
| 1562 | bolder 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 |
| 1303 | This function returns the italic attribute of face @var{face}. | 1567 | This 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 |
| 1307 | This function returns the underline attribute of face @var{face}. | 1572 | This function returns the @code{:underline} attribute of face @var{face}. |
| 1573 | @end defun | ||
| 1574 | |||
| 1575 | @defun face-inverse-video-p face &optional frame | ||
| 1576 | This 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 | ||
| 1586 | With defaults. The @code{default} face is used as the ultimate | ||
| 1587 | default for all text. (In Emacs 19 and 20, the @code{default} | ||
| 1588 | face is used only when no other face is specified.) | ||
| 1589 | |||
| 1590 | For a mode line or header line, the face @code{modeline} or | ||
| 1591 | @code{header-line} is used just before @code{default}. | ||
| 1592 | |||
| 1593 | @item | ||
| 1594 | With text properties. A character can have a @code{face} property; if | ||
| 1595 | so, the faces and face attributes specified there apply. @xref{Special | ||
| 1596 | Properties}. | ||
| 1597 | |||
| 1598 | If the character has a @code{mouse-face} property, that is used instead | ||
| 1599 | of the @code{face} property when the mouse is ``near enough'' to the | ||
| 1600 | character. | ||
| 1601 | |||
| 1602 | @item | ||
| 1603 | With overlays. An overlay can have @code{face} and @code{mouse-face} | ||
| 1604 | properties too; they apply to all the text covered by the overlay. | ||
| 1605 | |||
| 1606 | @item | ||
| 1607 | With a region that is active. In Transient Mark mode, the region is | ||
| 1608 | highlighted with the face @code{region} (@pxref{Standard Faces}). | ||
| 1609 | |||
| 1610 | @item | ||
| 1611 | With special glyphs. Each glyph can specify a particular face | ||
| 1612 | number. @xref{Glyphs}. | ||
| 1613 | @end itemize | ||
| 1614 | |||
| 1615 | If these various sources together specify more than one face for a | ||
| 1616 | particular character, Emacs merges the attributes of the various faces | ||
| 1617 | specified. The attributes of the faces of special glyphs come first; | ||
| 1618 | then comes the face for region highlighting, if appropriate; | ||
| 1619 | then come attributes of faces from overlays, followed by those from text | ||
| 1620 | properties, and last the default face. | ||
| 1621 | |||
| 1622 | When multiple overlays cover one character, an overlay with higher | ||
| 1623 | priority overrides those with lower priority. @xref{Overlays}. | ||
| 1624 | |||
| 1625 | In Emacs 20, if an attribute such as the font or a color is not | ||
| 1626 | specified in any of the above ways, the frame's own font or color is | ||
| 1627 | used. In newer Emacs versions, this cannot happen, because the | ||
| 1628 | @code{default} face specifies all attributes---in fact, the frame's own | ||
| 1629 | font 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 | ||
| 1635 | a character to a font that is available on a particular display. The | ||
| 1636 | face attributes, as determined by face merging, specify most of the | ||
| 1637 | font choice, but not all. Part of the choice depends on what character | ||
| 1638 | it is. | ||
| 1639 | |||
| 1640 | For multibyte characters, typically each font covers only one | ||
| 1641 | character set. So each character set (@pxref{Character Sets}) specifies | ||
| 1642 | a registry and encoding to use, with the character set's | ||
| 1643 | @code{x-charset-registry} property. Its value is a string containing | ||
| 1644 | the 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 | ||
| 1653 | character takes the registry and encoding from the variable | ||
| 1654 | @code{face-default-registry}. | ||
| 1655 | |||
| 1656 | @defvar face-default-registry | ||
| 1657 | This variable specifies which registry and encoding to use in choosing | ||
| 1658 | fonts for unibyte characters. The value is initialized at Emacs startup | ||
| 1659 | time from the font the user specified for Emacs. | ||
| 1660 | @end defvar | ||
| 1661 | |||
| 1662 | If the face specifies a fontset name, that fontset determines a | ||
| 1663 | pattern for fonts of the given charset. If the face specifies a font | ||
| 1664 | family, a font pattern is constructed. | ||
| 1665 | |||
| 1666 | Emacs tries to find an available font for the given face attributes | ||
| 1667 | and character's registry and encoding. If there is a font that matches | ||
| 1668 | exactly, it is used, of course. The hard case is when no available font | ||
| 1669 | exactly fits the specification. Then Emacs looks for one that is | ||
| 1670 | ``close''---one attribute at a time. You can specify the order | ||
| 1671 | to consider the attributes. | ||
| 1672 | |||
| 1673 | @defvar face-font-selection-order | ||
| 1674 | @tindex face-font-selection-order | ||
| 1675 | This variable specifies the order of importance of the face attributes | ||
| 1676 | @code{:width}, @code{:height}, @code{:weight}, and @code{:slant}. The | ||
| 1677 | value should be a list containing those four symbols, in order of | ||
| 1678 | decreasing importance. | ||
| 1679 | |||
| 1680 | Font selection first finds the best available matches for the first | ||
| 1681 | attribute listed; then, among the fonts which are best in that way, it | ||
| 1682 | searches for the best matches in the second attribute, and so on. | ||
| 1683 | |||
| 1684 | The attributes @code{:weight} and @code{:width} have symbolic values in | ||
| 1685 | a range centered around @code{normal}. Matches that are more extreme | ||
| 1686 | (farther from @code{normal}) are somewhat preferred to matches that are | ||
| 1687 | less extreme (closer to @code{normal}); this is designed to ensure that | ||
| 1688 | non-normal faces contrast with normal ones, whenever possible. | ||
| 1689 | |||
| 1690 | The default is @code{(:width :height :weight :slant)}, which means first | ||
| 1691 | find the fonts closest to the specified @code{:width}, then---among the | ||
| 1692 | fonts with that width---find a best match for the specified font height, | ||
| 1693 | and so on. | ||
| 1694 | |||
| 1695 | One example of a case where this variable makes a difference is when the | ||
| 1696 | default 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 | ||
| 1698 | default 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 | ||
| 1700 | quite right. | ||
| 1701 | @end defvar | ||
| 1702 | |||
| 1703 | @defvar face-alternative-font-family-alist | ||
| 1704 | @tindex face-alternative-font-family-alist | ||
| 1705 | This variable lets you specify alternative font families to try, if a | ||
| 1706 | given family is specified and doesn't exist. Each element should have | ||
| 1707 | this form: | ||
| 1708 | |||
| 1709 | @example | ||
| 1710 | (@var{family} @var{alternate-families}@dots{}) | ||
| 1711 | @end example | ||
| 1712 | |||
| 1713 | If @var{family} is specified but not available, Emacs will try the other | ||
| 1714 | families given in @var{alternate-families}, one by one, until it finds a | ||
| 1715 | family that does exist. | ||
| 1716 | @end defvar | ||
| 1717 | |||
| 1718 | Emacs can make use of scalable fonts, but by default it does not use | ||
| 1719 | them, since the use of too many or too big scalable fonts can crash | ||
| 1720 | XFree86 servers. | ||
| 1721 | |||
| 1722 | @defvar scalable-fonts-allowed | ||
| 1723 | @tindex scalable-fonts-allowed | ||
| 1724 | This variable controls which scalable fonts to use. A value of | ||
| 1725 | @code{nil}, the default, means do not use scalable fonts. @code{t} | ||
| 1726 | means to use any scalable font that seems appropriate for the text. | ||
| 1727 | |||
| 1728 | Otherwise, the value must be a list of regular expressions. Then a | ||
| 1729 | scalable font is enabled for use if its name matches any regular | ||
| 1730 | expression in the list. For example, | ||
| 1731 | |||
| 1732 | @example | ||
| 1733 | (setq scalable-fonts-allowed '("muleindian-2$")) | ||
| 1734 | @end example | ||
| 1735 | |||
| 1736 | @noindent | ||
| 1737 | allows 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 | ||
| 1742 | This function clears the face cache for all frames. | ||
| 1743 | If @var{unload-p} is non-@code{nil}, that means to unload | ||
| 1744 | all 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 | ||
| 1753 | This function defines a new face named @var{name}, initially with all | ||
| 1754 | attributes @code{nil}. It does nothing if there is already a face named | ||
| 1755 | @var{name}. | ||
| 1756 | @end defun | ||
| 1757 | |||
| 1758 | @defun face-list | ||
| 1759 | This 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 | ||
| 1763 | This function defines the face @var{new-name} as a copy of the existing | ||
| 1764 | face named @var{old-face}. It creates the face @var{new-name} if that | ||
| 1765 | doesn't already exist. | ||
| 1766 | |||
| 1767 | If the optional argument @var{frame} is given, this function applies | ||
| 1768 | only to that frame. Otherwise it applies to each frame individually, | ||
| 1769 | copying attributes from @var{old-face} in each frame to @var{new-face} | ||
| 1770 | in the same frame. | ||
| 1771 | |||
| 1772 | If the optional argument @var{new-frame} is given, then @code{copy-face} | ||
| 1773 | copies the attributes of @var{old-face} in @var{frame} to @var{new-name} | ||
| 1774 | in @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 | ||
| 1333 | This variable's value specifies the face number to use to display characters | ||
| 1334 | in the region when it is active (in Transient Mark mode only). The face | ||
| 1335 | thus specified takes precedence over all faces that come from text | ||
| 1336 | properties and overlays, for characters in the region. @xref{The Mark}, | ||
| 1337 | for more information about Transient Mark mode. | ||
| 1338 | |||
| 1339 | Normally, 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 |
| 1344 | This function updates the way faces display on @var{frame}, for a change | 1801 | This function updates the way faces display on @var{frame}, for a change |
| 1345 | in @var{frame}'s foreground or background color. | 1802 | in @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 | ||
| 1812 | assigning faces to text in the buffer. This hook is used for part of | ||
| 1813 | the implementation of Font-Lock mode. | ||
| 1814 | |||
| 1815 | @tindex fontification-functions | ||
| 1816 | @defvar fontification-functions | ||
| 1817 | This variable holds a list of functions that are called by Emacs | ||
| 1818 | redisplay as needed to assign faces automatically to text in the buffer. | ||
| 1819 | |||
| 1820 | The functions are called in the order listed, with one argument, a | ||
| 1821 | buffer position @var{pos}. Each function should attempt to assign faces | ||
| 1822 | to the text in the current buffer starting at @var{pos}. | ||
| 1823 | |||
| 1824 | Each 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. | ||
| 1827 | That property tells redisplay that faces have been assigned to that text | ||
| 1828 | already. | ||
| 1829 | |||
| 1830 | It is probably a good idea for each function to do nothing if the | ||
| 1831 | character after @var{pos} already has a non-@code{nil} @code{fontified} | ||
| 1832 | property, but this is not required. If one function overrides the | ||
| 1833 | assignments made by a previous one, the properties as they are | ||
| 1834 | after the last function finishes are the ones that really matter. | ||
| 1835 | |||
| 1836 | For efficiency, we recommend writing these functions so that they | ||
| 1837 | usually 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 | ||
| 1844 | This function returns a list of available font names that match | ||
| 1845 | @var{pattern}. If the optional arguments @var{face} and @var{frame} are | ||
| 1846 | specified, then the list is limited to fonts that are the same size as | ||
| 1847 | @var{face} currently is on @var{frame}. | ||
| 1848 | |||
| 1849 | The argument @var{pattern} should be a string, perhaps with wildcard | ||
| 1850 | characters: the @samp{*} character matches any substring, and the | ||
| 1851 | @samp{?} character matches any single character. Pattern matching | ||
| 1852 | of font names ignores case. | ||
| 1853 | |||
| 1854 | If 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 | |||
| 1857 | The optional argument @var{maximum} sets a limit on how many fonts to | ||
| 1858 | return. If this is non-@code{nil}, then the return value is truncated | ||
| 1859 | after the first @var{maximum} matching fonts. Specifying a small value | ||
| 1860 | for @var{maximum} can make this function much faster, in cases where | ||
| 1861 | many 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 | ||
| 1868 | This function returns a list describing the available fonts for family | ||
| 1869 | @var{family} on @var{frame}. If @var{family} is omitted or @code{nil}, | ||
| 1870 | this list applies to all families, and therefore, it contains all | ||
| 1871 | available fonts. Otherwise, @var{family} must be a string; it may | ||
| 1872 | contain the wildcards @samp{?} and @samp{*}. | ||
| 1873 | |||
| 1874 | The list describes the display that @var{frame} is on; if @var{frame} is | ||
| 1875 | omitted or @code{nil}, it applies to the selected frame's display. | ||
| 1876 | |||
| 1877 | The 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 | |||
| 1884 | The first five elements correspond to face attributes; if you | ||
| 1885 | specify these attributes for a face, it will use this font. | ||
| 1886 | |||
| 1887 | The 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 | ||
| 1889 | full name of the font, and @var{registry-and-encoding} is a string | ||
| 1890 | giving the registry and encoding of the font. | ||
| 1891 | |||
| 1892 | The 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 | ||
| 1897 | This function returns a list of the font families available for | ||
| 1898 | @var{frame}'s display. If @var{frame} is omitted or @code{nil}, it | ||
| 1899 | describes the selected frame's display. | ||
| 1900 | |||
| 1901 | The value is a list of elements of this form: | ||
| 1902 | |||
| 1903 | @example | ||
| 1904 | (@var{family} . @var{fixed-p}) | ||
| 1905 | @end example | ||
| 1906 | |||
| 1907 | @noindent | ||
| 1908 | Here @var{family} is a font family, and @var{fixed-p} is | ||
| 1909 | non-@code{nil} if fonts of that family are fixed-pitch. | ||
| 1910 | @end defun | ||
| 1911 | |||
| 1912 | @defvar font-list-limit | ||
| 1913 | @tindex font-list-limit | ||
| 1914 | This variable specifies maximum number of fonts to consider in font | ||
| 1915 | matching. The function @code{x-family-fonts} will not return more than | ||
| 1916 | that many fonts, and font selection will consider only that many fonts | ||
| 1917 | when searching a matching font for face attributes. The default is | ||
| 1918 | currently 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 | ||
| 1925 | character codes. An individual font cannot display the whole range of | ||
| 1926 | characters that Emacs supports, but a fontset can. Fontsets have names, | ||
| 1927 | just as fonts do, and you can use a fontset name in place of a font name | ||
| 1928 | when you specify the ``font'' for a frame or a face. Here is | ||
| 1929 | information about defining a fontset under Lisp program control. | ||
| 1930 | |||
| 1931 | @defun create-fontset-from-fontset-spec fontset-spec &optional style-variant-p noerror | ||
| 1932 | This function defines a new fontset according to the specification | ||
| 1933 | string @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 | ||
| 1940 | Whitespace characters before and after the commas are ignored. | ||
| 1941 | |||
| 1942 | The first part of the string, @var{fontpattern}, should have the form of | ||
| 1943 | a standard X font name, except that the last two fields should be | ||
| 1944 | @samp{fontset-@var{alias}}. | ||
| 1945 | |||
| 1946 | The 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 | ||
| 1949 | name. If a fontset with the same name already exists, an error is | ||
| 1950 | signaled, unless @var{noerror} is non-@code{nil}, in which case this | ||
| 1951 | function does nothing. | ||
| 1952 | |||
| 1953 | If optional argument @var{style-variant-p} is non-@code{nil}, that says | ||
| 1954 | to create bold, italic and bold-italic variants of the fontset as well. | ||
| 1955 | These variant fontsets do not have a short name, only a long one, which | ||
| 1956 | is made by altering @var{fontpattern} to indicate the bold or italic | ||
| 1957 | status. | ||
| 1958 | |||
| 1959 | The specification string also says which fonts to use in the fontset. | ||
| 1960 | See below for the details. | ||
| 1961 | @end defun | ||
| 1962 | |||
| 1963 | The construct @samp{@var{charset}:@var{font}} specifies which font to | ||
| 1964 | use (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 | ||
| 1966 | to use for that character set. You can use this construct any number of | ||
| 1967 | times in the specification string. | ||
| 1968 | |||
| 1969 | For the remaining character sets, those that you don't specify | ||
| 1970 | explicitly, Emacs chooses a font based on @var{fontpattern}: it replaces | ||
| 1971 | @samp{fontset-@var{alias}} with a value that names one character set. | ||
| 1972 | For the @sc{ascii} character set, @samp{fontset-@var{alias}} is replaced | ||
| 1973 | with @samp{ISO8859-1}. | ||
| 1974 | |||
| 1975 | In addition, when several consecutive fields are wildcards, Emacs | ||
| 1976 | collapses them into a single wildcard. This is to prevent use of | ||
| 1977 | auto-scaled fonts. Fonts made by scaling larger fonts are not usable | ||
| 1978 | for editing, and scaling a smaller font is not useful because it is | ||
| 1979 | better 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 | ||
| 1988 | the 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 | ||
| 1995 | and 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 | ||
| 2002 | specification. Most X distributions include only Chinese fonts that | ||
| 2003 | have @samp{song ti} or @samp{fangsong ti} in the @var{family} field. In | ||
| 2004 | such a case, @samp{Fontset-@var{n}} can be specified as below: | ||
| 2005 | |||
| 2006 | @smallexample | ||
| 2007 | Emacs.Fontset-0: -*-fixed-medium-r-normal-*-24-*-*-*-*-*-fontset-24,\ | ||
| 2008 | chinese-gb2312:-*-*-medium-r-normal-*-24-*-gb2312*-* | ||
| 2009 | @end smallexample | ||
| 2010 | |||
| 2011 | @noindent | ||
| 2012 | Then, the font specifications for all but Chinese GB2312 characters have | ||
| 2013 | @samp{fixed} in the @var{family} field, and the font specification for | ||
| 2014 | Chinese GB2312 characters has a wild card @samp{*} in the @var{family} | ||
| 2015 | field. | ||
| 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, | ||
| 2023 | and also control other aspects of how text displays. These features are | ||
| 2024 | available starting in Emacs 21. The value of the @code{display} | ||
| 2025 | property should be a display specification, or a list or vector | ||
| 2026 | containing several display specifications. The rest of this section | ||
| 2027 | describes 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 | ||
| 2043 | specification of the form @code{(space @var{props})}, where @var{props} | ||
| 2044 | is a property list (see below). You can put this property on one or | ||
| 2045 | more consecutive characters; a space of the specified height and width | ||
| 2046 | is displayed in place of @emph{all} of those characters. | ||
| 2047 | |||
| 2048 | @table @code | ||
| 2049 | @item :width @var{width} | ||
| 2050 | Specifies that the space width should be @var{width} times the normal | ||
| 2051 | character width. @var{width} can be an integer or floating point | ||
| 2052 | number. | ||
| 2053 | |||
| 2054 | @item :relative-width @var{factor} | ||
| 2055 | Specifies that the width of the stretch should be computed from the | ||
| 2056 | first character in the group of consecutive characters that have the | ||
| 2057 | same @code{display} property. The space width is the width of that | ||
| 2058 | character, multiplied by @var{factor}. | ||
| 2059 | |||
| 2060 | @item :align-to @var{hpos} | ||
| 2061 | Specifies that the space should be wide enough to reach @var{hpos}. The | ||
| 2062 | value @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 | ||
| 2066 | specify the height of the space, with other properties: | ||
| 2067 | |||
| 2068 | @table @code | ||
| 2069 | @item :height @var{height} | ||
| 2070 | Specifies the height of the space, as @var{height}, | ||
| 2071 | measured in terms of the normal line height. | ||
| 2072 | |||
| 2073 | @item :relative-height @var{factor} | ||
| 2074 | Specifies the height of the space, multiplying the ordinary height | ||
| 2075 | of the text having this display specification by @var{factor}. | ||
| 2076 | |||
| 2077 | @item :ascent @var{ascent} | ||
| 2078 | Specifies that @var{ascent} percent of the height of the space should be | ||
| 2079 | considered as the ascent of the space. The value of @var{ascent} must | ||
| 2080 | be a non-negative number no greater than 100. | ||
| 2081 | @end table | ||
| 2082 | |||
| 2083 | You should not use both @code{:height} and @code{:relative-height} | ||
| 2084 | together. | ||
| 2085 | |||
| 2086 | @node Other Display Specs | ||
| 2087 | @subsection Other Display Specifications | ||
| 2088 | |||
| 2089 | @table @code | ||
| 2090 | @item (image . @var{image-props}) | ||
| 2091 | This is in fact an image descriptor (@pxref{Images}). When used as a | ||
| 2092 | display specification, it means to display the image instead of the text | ||
| 2093 | that has the display specification. | ||
| 2094 | |||
| 2095 | @item (space-width @var{factor}) | ||
| 2096 | This display specification affects all the spaces in the text that has | ||
| 2097 | the specification. It displays all of these spaces @var{factor} times | ||
| 2098 | as wide as normal. The element @var{factor} should be an integer or | ||
| 2099 | float. | ||
| 2100 | |||
| 2101 | @item (height @var{height}) | ||
| 2102 | This display specification makes the text taller or shorter. | ||
| 2103 | Here are the possibilities for @var{height}: | ||
| 2104 | |||
| 2105 | @table @asis | ||
| 2106 | @item @code{(+ @var{n})} | ||
| 2107 | This means to use a font that is @var{n} steps larger. A ``step'' is | ||
| 2108 | defined by the set of available fonts; each size for which a font is | ||
| 2109 | available counts as a step. @var{n} should be an integer. | ||
| 2110 | |||
| 2111 | @item @code{(- @var{n})} | ||
| 2112 | This means to use a font that is @var{n} steps smaller. | ||
| 2113 | |||
| 2114 | @item a number, @var{factor} | ||
| 2115 | A number, @var{factor}, means to use a font that is @var{factor} times | ||
| 2116 | as tall as the default font. | ||
| 2117 | |||
| 2118 | @item a symbol, @var{function} | ||
| 2119 | A symbol is a function to compute the height. It is called with the | ||
| 2120 | current height as argument, and should return the new height to use. | ||
| 2121 | |||
| 2122 | @item anything else, @var{form} | ||
| 2123 | If the @var{height} value doesn't fit the previous possibilities, it is | ||
| 2124 | a 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}) | ||
| 2129 | This kind of display specification raises or lowers the text | ||
| 2130 | it 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 | ||
| 2133 | height of the affected text. If it is positive, that means to display | ||
| 2134 | the characters raised. If it is negative, that means to display them | ||
| 2135 | lower down. | ||
| 2136 | |||
| 2137 | If the text also has a @code{height} display specification, that does | ||
| 2138 | not affect the amount of raising or lowering, which is based on the | ||
| 2139 | faces 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 | ||
| 2148 | and on the right. Ordinary text never appears in these areas, but you | ||
| 2149 | can put things into the display margins using the @code{display} | ||
| 2150 | property. | ||
| 2151 | |||
| 2152 | To put text in the left or right display margin of the window, use a | ||
| 2153 | display specification of the form @code{(margin right-margin)} or | ||
| 2154 | @code{(margin left-margin)} on it. To put an image in a display margin, | ||
| 2155 | use that display specification along with the display specification for | ||
| 2156 | the image. | ||
| 2157 | |||
| 2158 | Before the display margins can display anything, you must give | ||
| 2159 | them a nonzero width. The usual way to do that is to set these | ||
| 2160 | variables: | ||
| 2161 | |||
| 2162 | @defvar left-margin-width | ||
| 2163 | @tindex left-margin-width | ||
| 2164 | This variable specifies the width of the left margin. | ||
| 2165 | It is buffer-local in all buffers. | ||
| 2166 | @end defvar | ||
| 2167 | |||
| 2168 | @defvar right-margin-width | ||
| 2169 | @tindex right-margin-width | ||
| 2170 | This variable specifies the width of the right margin. | ||
| 2171 | It is buffer-local in all buffers. | ||
| 2172 | @end defvar | ||
| 2173 | |||
| 2174 | Setting these variables does not immediately affect the window. These | ||
| 2175 | variables are checked when a new buffer is displayed in the window. | ||
| 2176 | Thus, 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 | ||
| 2183 | This function specifies the margin widths for window @var{window}. | ||
| 2184 | The 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 | ||
| 2190 | This function returns the left and right margins of @var{window} | ||
| 2191 | as a cons cell of the form @code{(@var{left} . @var{right})}. | ||
| 2192 | If @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, | ||
| 2200 | package 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 | ||
| 2203 | evaluation, point is temporarily set at the end position of the text | ||
| 2204 | having 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 | ||
| 2211 | descriptor, then use it as a display specifier in the @code{display} | ||
| 2212 | property 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 | ||
| 2216 | are supported only if particular support libraries are installed on your | ||
| 2217 | machine. The supported image formats include XBM, XPM (needing the | ||
| 2218 | libraries @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), | ||
| 2221 | and PNG (needing @code{libpng} 1.0.2). | ||
| 2222 | |||
| 2223 | You specify one of these formats with an image type symbol. The image | ||
| 2224 | type 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 | ||
| 2228 | This variable contains a list of those image type symbols that are | ||
| 2229 | supported 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 | ||
| 2250 | alternating keyword symbols (symbols whose names start with a colon) and | ||
| 2251 | their values. Every image descriptor must contain the property | ||
| 2252 | @code{:type @var{type}} to specify the format of the image. The value | ||
| 2253 | of @var{type} should be an image type symbol; for example, @code{xpm} | ||
| 2254 | for an image in XPM format. | ||
| 2255 | |||
| 2256 | Here is a list of other properties that are meaningful for all image | ||
| 2257 | types: | ||
| 2258 | |||
| 2259 | @table @code | ||
| 2260 | @item :ascent @var{ascent} | ||
| 2261 | The @code{:ascent} property specifies the percentage of the image's | ||
| 2262 | height to use for its ascent---that is, the part above the baseline. The | ||
| 2263 | value, @var{ascent}, must be a number in the range 0 to 100. If this | ||
| 2264 | property is omitted, it defaults to 50. | ||
| 2265 | |||
| 2266 | @item :margin @var{margin} | ||
| 2267 | The @code{:margin} property specifies how many pixels to add as an extra | ||
| 2268 | margin around the image. The value, @var{margin}, must be a | ||
| 2269 | non-negative number; if it is not specified, the default is zero. | ||
| 2270 | |||
| 2271 | @item :relief @var{relief} | ||
| 2272 | The @code{:relief} property, if non-@code{nil}, adds a shadow rectangle | ||
| 2273 | around the image. The value, @var{relief}, specifies the width of the | ||
| 2274 | shadow lines, in pixels. If @var{relief} is negative, shadows are drawn | ||
| 2275 | so that the image appears as a pressed button; otherwise, it appears as | ||
| 2276 | an unpressed button. | ||
| 2277 | |||
| 2278 | @item :algorithm @var{algorithm} | ||
| 2279 | The @code{:algorithm} property, if non-@code{nil}, specifies a | ||
| 2280 | conversion algorithm that should be applied to the image before it is | ||
| 2281 | displayed; the value, @var{algorithm}, specifies which algorithm. | ||
| 2282 | |||
| 2283 | Currently, the only meaningful value for @var{algorithm} (aside from | ||
| 2284 | @code{nil}) is @code{laplace}; this applies the Laplace edge detection | ||
| 2285 | algorithm, which blurs out small differences in color while highlighting | ||
| 2286 | larger differences. People sometimes consider this useful for | ||
| 2287 | displaying the image for a ``disabled'' button. | ||
| 2288 | |||
| 2289 | @item :heuristic-mask @var{transparent-color} | ||
| 2290 | The @code{:heuristic-mask} property, if non-@code{nil}, specifies that a | ||
| 2291 | certain color in the image should be transparent. Each pixel where this | ||
| 2292 | color appears will actually allow the frame's background to show | ||
| 2293 | through. | ||
| 2294 | |||
| 2295 | If @var{transparent-color} is @code{t}, then determine the transparent | ||
| 2296 | color by looking at the four corners of the image. This uses the color | ||
| 2297 | that occurs most frequently near the corners as the transparent color. | ||
| 2298 | |||
| 2299 | Otherwise, @var{heuristic-mask} should specify the transparent color | ||
| 2300 | directly, as a list of three integers in the form @code{(@var{red} | ||
| 2301 | @var{green} @var{blue})}. | ||
| 2302 | |||
| 2303 | @item :file @var{file} | ||
| 2304 | The @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 | ||
| 2306 | in @code{data-directory}. | ||
| 2307 | |||
| 2308 | @item :data @var{data} | ||
| 2309 | The @code{:data} property specifies the actual contents of the image. | ||
| 2310 | Each image must use either @code{:data} or @code{:file}, but not both. | ||
| 2311 | However, only certain image types support @code{:data}; for other types, | ||
| 2312 | you must use @code{:file}. | ||
| 2313 | |||
| 2314 | The formats that support @code{:data} include XBM and XPM. | ||
| 2315 | Before using @code{:data}, see the section describing the specific | ||
| 2316 | format 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 | ||
| 2324 | format doesn't require an external library, so images of this type are | ||
| 2325 | always supported. | ||
| 2326 | |||
| 2327 | Additional image properties supported for the @code{xbm} image type are: | ||
| 2328 | |||
| 2329 | @table @code | ||
| 2330 | @item :foreground @var{foreground} | ||
| 2331 | The value, @var{foreground}, should be a string specifying the image | ||
| 2332 | foreground color. This color is used for each pixel in the XBM that is | ||
| 2333 | 1. The default is the frame's foreground color. | ||
| 2334 | |||
| 2335 | @item :background @var{background} | ||
| 2336 | The value, @var{background}, should be a string specifying the image | ||
| 2337 | background color. This color is used for each pixel in the XBM that is | ||
| 2338 | 0. The default is the frame's background color. | ||
| 2339 | @end table | ||
| 2340 | |||
| 2341 | You can specify an XBM image using data within Emacs instead | ||
| 2342 | of an external file. To do this, don't use @code{:file}; instead, | ||
| 2343 | use the following three properties (all of them): | ||
| 2344 | |||
| 2345 | @table @code | ||
| 2346 | @item :width @var{width} | ||
| 2347 | The value, @var{width}, specifies the width the image in pixels. | ||
| 2348 | |||
| 2349 | @item :height @var{height} | ||
| 2350 | The value, @var{height}, specifies the height of the image in pixels. | ||
| 2351 | |||
| 2352 | @item :data @var{data} | ||
| 2353 | The value, @var{data}, is normally a string or a bool-vector. Either | ||
| 2354 | way, it must contain enough bits for the area of the image: at least | ||
| 2355 | @var{width} * @code{height}. | ||
| 2356 | |||
| 2357 | Alternatively, @var{data} can be a vector of strings or bool-vectors, | ||
| 2358 | each 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 | ||
| 2366 | additional image properties are meaningful with the @code{xpm} image | ||
| 2367 | type: | ||
| 2368 | |||
| 2369 | @table @code | ||
| 2370 | @item :color-symbols @var{symbols} | ||
| 2371 | The value, @var{symbols}, should be an alist whose elements have the | ||
| 2372 | form @code{(@var{name} . @var{color})}. In each element, @var{name} is | ||
| 2373 | the name of a color as it appears in the image file, and @var{color} | ||
| 2374 | specifies the actual color to use for displaying that name. | ||
| 2375 | |||
| 2376 | @item :data @var{data} | ||
| 2377 | XPM images can be displayed from data instead of files. In that case, | ||
| 2378 | use the @code{:data} property instead of the @code{:file} property. | ||
| 2379 | |||
| 2380 | The value @var{data} must be a string containing an XPM image. The | ||
| 2381 | contents 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 | ||
| 2389 | in the US covering the LZW algorithm, the continued use of GIF format is | ||
| 2390 | a problem for the whole Internet; to end this problem, it is a good idea | ||
| 2391 | for everyone, even outside the US, to stop using GIFS right away | ||
| 2392 | (@uref{http://www.burnallgifs.org/}). But if you still want to use | ||
| 2393 | them, Emacs can display them. | ||
| 2394 | |||
| 2395 | @table @code | ||
| 2396 | @item :index @var{index} | ||
| 2397 | You can use @code{:index} to specify one image from a GIF file that | ||
| 2398 | contains more than one image. This property specifies use of image | ||
| 2399 | number @var{index} from the file. An error is signaled if the GIF file | ||
| 2400 | doesn't contain an image with index @var{index}. | ||
| 2401 | @end table | ||
| 2402 | |||
| 2403 | @ignore | ||
| 2404 | This could be used to implement limited support for animated GIFs. | ||
| 2405 | For example, the following function displays a multi-image GIF file | ||
| 2406 | at point-min in the current buffer, switching between sub-images | ||
| 2407 | every 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}. | ||
| 2430 | This works only if you have Ghostscript installed. You must always use | ||
| 2431 | these three properties: | ||
| 2432 | |||
| 2433 | @table @code | ||
| 2434 | @item :pt-width @var{width} | ||
| 2435 | The value, @var{width}, specifies the width of the image measured in | ||
| 2436 | points (1/72 inch). @var{width} must be an integer. | ||
| 2437 | |||
| 2438 | @item :pt-height @var{height} | ||
| 2439 | The 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} | ||
| 2443 | The value, @var{box}, must be a list or vector of four integers, which | ||
| 2444 | specifying 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 | ||
| 2457 | monochromatic images are supported. | ||
| 2458 | |||
| 2459 | For JPEG images, specify image type @code{jpeg}. There are no | ||
| 2460 | additional 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 | ||
| 2470 | convenient ways to create image descriptors. | ||
| 2471 | |||
| 2472 | @defun create-image file &optional type &rest props | ||
| 2473 | @tindex create-image | ||
| 2474 | This function creates and returns an image descriptor which uses the | ||
| 2475 | data in @var{file}. | ||
| 2476 | |||
| 2477 | The optional argument @var{type} is a symbol specifying the image type. | ||
| 2478 | If @var{type} is omitted or @code{nil}, @code{create-image} tries to | ||
| 2479 | determine the image type from the file's first few bytes, or else | ||
| 2480 | from the file's name. | ||
| 2481 | |||
| 2482 | The remaining arguments, @var{props}, specify additional image | ||
| 2483 | properties---for example, | ||
| 2484 | |||
| 2485 | @example | ||
| 2486 | (create-image "foo.xpm" 'xpm :heuristic-mask t) | ||
| 2487 | @end example | ||
| 2488 | |||
| 2489 | The function returns @code{nil} if images of this type are not | ||
| 2490 | supported. Otherwise it returns an image descriptor. | ||
| 2491 | @end defun | ||
| 2492 | |||
| 2493 | @defmac defimage variable doc &rest specs | ||
| 2494 | @tindex defimage | ||
| 2495 | This macro defines @var{variable} as an image name. The second argument, | ||
| 2496 | @var{doc}, is an optional documentation string. The remaining | ||
| 2497 | arguments, @var{specs}, specify alternative ways to display the image. | ||
| 2498 | |||
| 2499 | Each argument in @var{specs} has the form of a property list, and each | ||
| 2500 | one 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 | ||
| 2509 | usable---that is, if the type is supported and the file exists. The | ||
| 2510 | first usable argument is used to make an image descriptor which is | ||
| 2511 | stored in the variable @var{variable}. | ||
| 2512 | |||
| 2513 | If none of the alternatives will work, then @var{variable} is defined | ||
| 2514 | as @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} | ||
| 2521 | property yourself, but it is easier to use the functions in this | ||
| 2522 | section. | ||
| 2523 | |||
| 2524 | @defun insert-image image &optional area | ||
| 2525 | This function inserts @var{image} in the current buffer at point. The | ||
| 2526 | value @var{image} should be an image descriptor; it could be a value | ||
| 2527 | returned by @code{create-image}, or the value of a symbol defined with | ||
| 2528 | @code{defimage}. | ||
| 2529 | |||
| 2530 | The argument @var{area} specifies whether to put the image in a margin. | ||
| 2531 | If 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 | ||
| 2534 | buffer's text. | ||
| 2535 | |||
| 2536 | Internally, this function inserts an @samp{x} in the buffer, and gives | ||
| 2537 | it a @code{display} property which specifies this image. @xref{Display | ||
| 2538 | Property}. | ||
| 2539 | @end defun | ||
| 2540 | |||
| 2541 | @defun put-image image pos &optional area | ||
| 2542 | This function puts image @var{image} in front of @var{pos} in the | ||
| 2543 | current buffer. The argument @var{pos} should be an integer or a | ||
| 2544 | marker. It specifies the buffer position where the image should appear. | ||
| 2545 | |||
| 2546 | The argument @var{image} must be an image descriptor, perhaps returned | ||
| 2547 | by @code{create-image} or stored by @code{defimage}. | ||
| 2548 | |||
| 2549 | The argument @var{area} specifies whether to put the image in a margin. | ||
| 2550 | If 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 | ||
| 2553 | buffer's text. | ||
| 2554 | |||
| 2555 | Internally, this function creates an overlay, and gives it a | ||
| 2556 | @code{before-string} property containing text that has a @code{display} | ||
| 2557 | property whose value is the image. (Whew!) | ||
| 2558 | @end defun | ||
| 2559 | |||
| 2560 | @defun remove-images start end &optional buffer | ||
| 2561 | This function removes images in @var{buffer} between positions | ||
| 2562 | @var{start} and @var{end}. If @var{buffer} is omitted or @code{nil}, | ||
| 2563 | images are removed from the current buffer. | ||
| 2564 | |||
| 2565 | This 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 | ||
| 2574 | display them again more efficiently. It removes an image from the cache | ||
| 2575 | when it hasn't been displayed for a specified period of time. | ||
| 2576 | |||
| 2577 | @defvar image-cache-eviction-delay | ||
| 2578 | @tindex image-cache-eviction-delay | ||
| 2579 | This variable specifies the number of seconds an image can remain in the | ||
| 2580 | cache without being displayed. When an image is not displayed for this | ||
| 2581 | length of time, Emacs removes it from the image cache. | ||
| 2582 | |||
| 2583 | If the value is @code{nil}, Emacs does not remove images from the cache | ||
| 2584 | except when you explicitly clear it. This mode can be useful for | ||
| 2585 | debugging. | ||
| 2586 | @end defvar | ||
| 2587 | |||
| 2588 | @defun clear-image-cache &optional frame | ||
| 2589 | @tindex clear-image-cache | ||
| 2590 | This function clears the image cache. If @var{frame} is non-@code{nil}, | ||
| 2591 | only the cache for that frame is cleared. Otherwise all frames' caches | ||
| 2592 | are 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. | |||
| 1451 | All other codes in the range 0 through 31, and code 127, display in one | 2697 | All other codes in the range 0 through 31, and code 127, display in one |
| 1452 | of two ways according to the value of @code{ctl-arrow}. If it is | 2698 | of two ways according to the value of @code{ctl-arrow}. If it is |
| 1453 | non-@code{nil}, these codes map to sequences of two glyphs, where the | 2699 | non-@code{nil}, these codes map to sequences of two glyphs, where the |
| 1454 | first glyph is the @sc{ASCII} code for @samp{^}. (A display table can | 2700 | first glyph is the @sc{ascii} code for @samp{^}. (A display table can |
| 1455 | specify a glyph to use instead of @samp{^}.) Otherwise, these codes map | 2701 | specify a glyph to use instead of @samp{^}.) Otherwise, these codes map |
| 1456 | just like the codes in the range 128 to 255. | 2702 | just like the codes in the range 128 to 255. |
| 1457 | 2703 | ||
| 2704 | On MS-DOS terminals, Emacs arranges by default for the character code | ||
| 2705 | 127 to be mapped to the glyph code 127, which normally displays as an | ||
| 2706 | empty polygon. This glyph is used to display non-@sc{ascii} characters | ||
| 2707 | that the MS-DOS terminal doesn't support. @xref{MS-DOS and MULE,,, | ||
| 2708 | emacs, The GNU Emacs Manual}. | ||
| 2709 | |||
| 1458 | @item | 2710 | @item |
| 1459 | Character codes 128 through 255 map to sequences of four glyphs, where | 2711 | Character codes 128 through 255 map to sequences of four glyphs, where |
| 1460 | the first glyph is the @sc{ASCII} code for @samp{\}, and the others are | 2712 | the first glyph is the @sc{ascii} code for @samp{\}, and the others are |
| 1461 | digit characters representing the character code in octal. (A display | 2713 | digit characters representing the character code in octal. (A display |
| 1462 | table can specify a glyph to use instead of @samp{\}.) | 2714 | table 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 |
| 1512 | You can use the @dfn{display table} feature to control how all possible | 2764 | You can use the @dfn{display table} feature to control how all possible |
| 1513 | character codes display on the screen. This is useful for displaying | 2765 | character codes display on the screen. This is useful for displaying |
| 1514 | European languages that have letters not in the @sc{ASCII} character | 2766 | European languages that have letters not in the @sc{ascii} character |
| 1515 | set. | 2767 | set. |
| 1516 | 2768 | ||
| 1517 | The display table maps each character code into a sequence of | 2769 | The 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 |
| 1519 | position on the screen. You can also define how to display each glyph | 2771 | position on the screen. You can also define how to display each glyph |
| 1520 | on your terminal, using the @dfn{glyph table}. | 2772 | on 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 |
| 1559 | The glyph for the end of a truncated screen line (the default for this | 2811 | The glyph for the end of a truncated screen line (the default for this |
| 1560 | is @samp{$}). @xref{Glyphs}. | 2812 | is @samp{$}). @xref{Glyphs}. Newer Emacs versions, on some platforms, |
| 2813 | display arrows to indicate truncation---the display table has no effect | ||
| 2814 | in these situations. | ||
| 1561 | @item 1 | 2815 | @item 1 |
| 1562 | The glyph for the end of a continued line (the default is @samp{\}). | 2816 | The glyph for the end of a continued line (the default is @samp{\}). |
| 2817 | Newer Emacs versions, on some platforms, display curved arrows to | ||
| 2818 | indicate truncation---the display table has no effect in these | ||
| 2819 | situations. | ||
| 1563 | @item 2 | 2820 | @item 2 |
| 1564 | The glyph for indicating a character displayed as an octal character | 2821 | The glyph for indicating a character displayed as an octal character |
| 1565 | code (the default is @samp{\}). | 2822 | code (the default is @samp{\}). |
| @@ -1570,7 +2827,9 @@ A vector of glyphs for indicating the presence of invisible lines (the | |||
| 1570 | default is @samp{...}). @xref{Selective Display}. | 2827 | default is @samp{...}). @xref{Selective Display}. |
| 1571 | @item 5 | 2828 | @item 5 |
| 1572 | The glyph used to draw the border between side-by-side windows (the | 2829 | The glyph used to draw the border between side-by-side windows (the |
| 1573 | default is @samp{|}). @xref{Splitting Windows}. | 2830 | default is @samp{|}). @xref{Splitting Windows}. This takes effect only |
| 2831 | when there are no scroll bars; if scroll bars are supported and in use, | ||
| 2832 | a 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 | ||
| 2868 | This 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 | ||
| 2874 | This command displays a description of the current display table in a | ||
| 2875 | help 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 | |||
| 1645 | display conventions for all character codes in that window. @xref{Usual | 2916 | display conventions for all character codes in that window. @xref{Usual |
| 1646 | Display}. | 2917 | Display}. |
| 1647 | 2918 | ||
| 2919 | A number of functions for changing the standard display table | ||
| 2920 | are 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 |
| 1695 | table, that code is automatically simple. | 2969 | table, that code is automatically simple. |
| 1696 | 2970 | ||
| 2971 | @defun create-glyph string | ||
| 2972 | @tindex create-glyph | ||
| 2973 | This function returns a newly-allocated glyph code which is set up to | ||
| 2974 | display 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 |
| 1748 | Emacs is displaying using X. | 3028 | Emacs is displaying using X. |
| 1749 | @item pc | 3029 | @item pc |
| 1750 | Emacs is displaying using MSDOS. | 3030 | Emacs is displaying using MS-DOS. |
| 1751 | @item w32 | 3031 | @item w32 |
| 1752 | Emacs is displaying using Windows NT or Windows 95. | 3032 | Emacs is displaying using Windows NT or Windows 9x. |
| 3033 | @item mac | ||
| 3034 | Emacs is displaying using a Macintosh. | ||
| 1753 | @item nil | 3035 | @item nil |
| 1754 | Emacs is using a character-based terminal. | 3036 | Emacs 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 |
| 92 | Edebug. Activating Edebug may stop execution and let you step through | 92 | Edebug. Depending on which Edebug execution mode you have selected, |
| 93 | the function, or it may update the display and continue execution while | 93 | activating Edebug may stop execution and let you step through the |
| 94 | checking for debugging commands, depending on which Edebug execution | 94 | function, or it may update the display and continue execution while |
| 95 | mode you have selected. The default execution mode is step, which does | 95 | checking for debugging commands. The default execution mode is step, |
| 96 | stop execution. @xref{Edebug Execution Modes}. | 96 | which 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 |
| 99 | the Lisp code you are debugging. This is referred to as the @dfn{source | 99 | the Lisp code you are debugging. This is referred to as the @dfn{source |
| 100 | code buffer}. This buffer is temporarily read-only. | 100 | code 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 |
| 103 | executing. Point initially shows where within the line the function is | 103 | executing. Point initially shows where within the line the function is |
| 104 | executing, but this ceases to be true if you move point yourself. | 104 | executing, 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 |
| 107 | execute @code{(fac 3)}, here is what you normally see. Point is at the | 107 | execute @code{(fac 3)}, here is what you would normally see. Point is |
| 108 | open-parenthesis before @code{if}. | 108 | at 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}. | |||
| 118 | The places within a function where Edebug can stop execution are called | 118 | The 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 |
| 120 | that is a list, and also after each variable reference. | 120 | that is a list, and also after each variable reference. |
| 121 | Here we show with periods the stop points found in the function | 121 | Here 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. | |||
| 163 | argument on a definition, it instruments the definition before | 163 | argument on a definition, it instruments the definition before |
| 164 | evaluating it. (The source code itself is not modified.) If the | 164 | evaluating it. (The source code itself is not modified.) If the |
| 165 | variable @code{edebug-all-defs} is non-@code{nil}, that inverts the | 165 | variable @code{edebug-all-defs} is non-@code{nil}, that inverts the |
| 166 | meaning of the prefix argument: then @kbd{C-M-x} instruments the | 166 | meaning of the prefix argument: in this case, @kbd{C-M-x} instruments the |
| 167 | definition @emph{unless} it has a prefix argument. The default value of | 167 | definition @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 |
| 169 | edebug-all-defs} toggles the value of the variable | 169 | edebug-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 |
| 189 | function or macro called by the list form after point, if is not already | 189 | function or macro called by the list form after point, if is not already |
| 190 | instrumented. This is possible only if Edebug knows where to find the | 190 | instrumented. This is possible only if Edebug knows where to find the |
| 191 | source for that function; after loading Edebug, @code{eval-region} | 191 | source for that function; for this reading, after loading Edebug, |
| 192 | records the position of every definition it evaluates, even if not | 192 | @code{eval-region} records the position of every definition it |
| 193 | instrumenting it. See also the @kbd{i} command (@pxref{Jumping}), which | 193 | evaluates, even if not instrumenting it. See also the @kbd{i} command |
| 194 | steps into the call after instrumenting the function. | 194 | (@pxref{Jumping}), which steps into the call after instrumenting the |
| 195 | function. | ||
| 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 |
| 204 | expressions, and other defining forms. Edebug cannot know what a | 205 | expressions, and other defining forms. However, Edebug cannot determine |
| 205 | user-defined macro will do with the arguments of a macro call, so you | 206 | on its own what a user-defined macro will do with the arguments of a |
| 206 | must tell it; see @ref{Instrumenting Macro Calls}, for details. | 207 | macro call, so you must provide that information; see @ref{Instrumenting |
| 208 | Macro 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 |
| 209 | session, it runs the hook @code{edebug-setup-hook}, then sets it to | 211 | session, 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 |
| 212 | using, but actually load them only if you use Edebug. | 214 | using, 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 | ||
| 239 | Normally, you specify the Edebug execution mode by typing a command to | 241 | Normally, you specify the Edebug execution mode by typing a command to |
| 240 | continue the program in a certain mode. Here is a table of these | 242 | continue the program in a certain mode. Here is a table of these |
| 241 | commands. All except for @kbd{S} resume execution of the program, at | 243 | commands; all except for @kbd{S} resume execution of the program, at |
| 242 | least for a certain distance. | 244 | least for a certain distance. |
| 243 | 245 | ||
| 244 | @table @kbd | 246 | @table @kbd |
| 245 | @item S | 247 | @item S |
| 246 | Stop: don't execute any more of the program for now, just wait for more | 248 | Stop: don't execute any more of the program, but wait for more |
| 247 | Edebug commands (@code{edebug-stop}). | 249 | Edebug 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 | |||
| 296 | completely work: exiting from Edebug, to resume the program, loses track | 298 | completely work: exiting from Edebug, to resume the program, loses track |
| 297 | of the keyboard macro. This is not easy to fix. Also, defining or | 299 | of the keyboard macro. This is not easy to fix. Also, defining or |
| 298 | executing a keyboard macro outside of Edebug does not affect commands | 300 | executing a keyboard macro outside of Edebug does not affect commands |
| 299 | inside Edebug. This is usually an advantage. But see the | 301 | inside 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 | ||
| 302 | When you enter a new Edebug level, the initial execution mode comes from | 304 | When 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 | |||
| 316 | execution. @xref{Breakpoints}, for the details on breakpoints. | 318 | execution. @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, |
| 319 | because a nonlocal exit can bypass the temporary breakpoint where you | 321 | as that can bypass the temporary breakpoint where you expected the |
| 320 | expected the program to stop. | 322 | program 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 | |||
| 348 | more elements, then the place to stop is after the containing | 350 | more elements, then the place to stop is after the containing |
| 349 | expression. | 351 | expression. |
| 350 | 352 | ||
| 351 | Be careful that the position @kbd{C-M-f} finds is a place that the | 353 | You must check that the position @kbd{C-M-f} finds is a place that the |
| 352 | program will really get to; this may not be true in a | 354 | program will really get to. In @code{cond}, for example, this may not |
| 353 | @code{cond}, for example. | 355 | be true. |
| 354 | 356 | ||
| 355 | The @kbd{f} command does @code{forward-sexp} starting at point, rather | 357 | For flexibility, the @kbd{f} command does @code{forward-sexp} starting |
| 356 | than at the stop point, for flexibility. If you want to execute one | 358 | at point, rather than at the stop point. If you want to execute one |
| 357 | expression @emph{from the current stop point}, type @kbd{w} first, to | 359 | expression @emph{from the current stop point}, first type @kbd{w}, to |
| 358 | move point there, and then type @kbd{f}. | 360 | move point there, and then type @kbd{f}. |
| 359 | 361 | ||
| 360 | The @kbd{o} command continues ``out of'' an expression. It places a | 362 | The @kbd{o} command continues ``out of'' an expression. It places a |
| @@ -397,7 +399,7 @@ activity. However, instrumented code protected with | |||
| 397 | debugging. | 399 | debugging. |
| 398 | 400 | ||
| 399 | @item Q | 401 | @item Q |
| 400 | Like @kbd{q} but don't stop even for protected code | 402 | Like @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 | |||
| 415 | execution. | 417 | execution. |
| 416 | @end table | 418 | @end table |
| 417 | 419 | ||
| 418 | From the Edebug recursive edit, you may invoke commands that activate | 420 | You can invoke commands from Edebug that activate Edebug again |
| 419 | Edebug again recursively. Any time Edebug is active, you can quit to | 421 | recursively. Whenever Edebug is active, you can quit to the top level |
| 420 | the top level with @kbd{q} or abort one recursive edit level with | 422 | with @kbd{q} or abort one recursive edit level with @kbd{C-]}. You can |
| 421 | @kbd{C-]}. You can display a backtrace of all the | 423 | display a backtrace of all the pending evaluations with @kbd{d}. |
| 422 | pending 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 |
| 428 | Edebug's step mode stops execution at the next stop point reached. | 429 | Edebug's step mode stops execution when the next stop point is reached. |
| 429 | There are three other ways to stop Edebug execution once it has started: | 430 | There are three other ways to stop Edebug execution once it has started: |
| 430 | breakpoints, the global break condition, and source breakpoints. | 431 | breakpoints, the global break condition, and source breakpoints. |
| 431 | 432 | ||
| 432 | While using Edebug, you can specify @dfn{breakpoints} in the program you | 433 | While using Edebug, you can specify @dfn{breakpoints} in the program you |
| 433 | are testing: points where execution should stop. You can set a | 434 | are testing: these are places where execution should stop. You can set a |
| 434 | breakpoint at any stop point, as defined in @ref{Using Edebug}. For | 435 | breakpoint at any stop point, as defined in @ref{Using Edebug}. For |
| 435 | setting and unsetting breakpoints, the stop point that is affected is | 436 | setting and unsetting breakpoints, the stop point that is affected is |
| 436 | the first one at or after point in the source code buffer. Here are the | 437 | the 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 |
| 441 | Set a breakpoint at the stop point at or after point | 442 | Set 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 |
| 443 | breakpoint is temporary (it turns off the first time it stops the | 444 | breakpoint is temporary---it turns off the first time it stops the |
| 444 | program). | 445 | program. |
| 445 | 446 | ||
| 446 | @item u | 447 | @item u |
| 447 | Unset the breakpoint (if any) at the stop point at or after | 448 | Unset 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, | |||
| 463 | then type @kbd{b} or @kbd{u} to set or unset a breakpoint there. | 464 | then type @kbd{b} or @kbd{u} to set or unset a breakpoint there. |
| 464 | Unsetting a breakpoint where none has been set has no effect. | 465 | Unsetting a breakpoint where none has been set has no effect. |
| 465 | 466 | ||
| 466 | Re-evaluating or reinstrumenting a definition forgets all its breakpoints. | 467 | Re-evaluating or reinstrumenting a definition removes all of its |
| 468 | previous breakpoints. | ||
| 467 | 469 | ||
| 468 | A @dfn{conditional breakpoint} tests a condition each time the program | 470 | A @dfn{conditional breakpoint} tests a condition each time the program |
| 469 | gets there. Any errors that occur as a result of evaluating the | 471 | gets there. Any errors that occur as a result of evaluating the |
| @@ -478,7 +480,7 @@ You can make a conditional or unconditional breakpoint | |||
| 478 | breakpoint. When a temporary breakpoint stops the program, it is | 480 | breakpoint. When a temporary breakpoint stops the program, it is |
| 479 | automatically unset. | 481 | automatically unset. |
| 480 | 482 | ||
| 481 | Edebug always stops or pauses at a breakpoint except when the Edebug | 483 | Edebug always stops or pauses at a breakpoint, except when the Edebug |
| 482 | mode is Go-nonstop. In that mode, it ignores breakpoints entirely. | 484 | mode is Go-nonstop. In that mode, it ignores breakpoints entirely. |
| 483 | 485 | ||
| 484 | To find out where your breakpoints are, use the @kbd{B} command, which | 486 | To 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 |
| 502 | condition is satisfied, no matter where that may occur. Edebug | 504 | condition is satisfied, no matter where that may occur. Edebug |
| 503 | evaluates the global break condition at every stop point. If it | 505 | evaluates the global break condition at every stop point; if it |
| 504 | evaluates to a non-@code{nil} value, then execution stops or pauses | 506 | evaluates to a non-@code{nil} value, then execution stops or pauses |
| 505 | depending on the execution mode, as if a breakpoint had been hit. If | 507 | depending on the execution mode, as if a breakpoint had been hit. If |
| 506 | evaluating the condition gets an error, execution does not stop. | 508 | evaluating 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 |
| 523 | reinstrument it. To make a breakpoint that won't be forgotten, you can | 525 | reinstrument it. If you wish to make a breakpoint that won't be |
| 524 | write a @dfn{source breakpoint}, which is simply a call to the function | 526 | forgotten, 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 | 527 | call to the function @code{edebug} in your source code. You can, of |
| 526 | conditional. For example, in the @code{fac} function, insert the first | 528 | course, make such a call conditional. For example, in the @code{fac} |
| 527 | line as shown below to stop when the argument reaches zero: | 529 | function, you can insert the first line as shown below, to stop when the |
| 530 | argument 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 |
| 555 | encountered before the error. This may be the location of a call to a | 558 | encountered before the error. This may be the location of a call to a |
| 556 | function which was not instrumented, within which the error actually | 559 | function which was not instrumented, and within which the error actually |
| 557 | occurred. For an unbound variable error, the last known stop point | 560 | occurred. For an unbound variable error, the last known stop point |
| 558 | might be quite distant from the offending variable reference. In that | 561 | might be quite distant from the offending variable reference. In that |
| 559 | case you might want to display a full backtrace (@pxref{Edebug Misc}). | 562 | case, 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 |
| 620 | not running. Edebug tries to be invisible to the expression's | 623 | were not running. Edebug tries to be invisible to the expression's |
| 621 | evaluation and printing. Evaluation of expressions that cause side | 624 | evaluation and printing. Evaluation of expressions that cause side |
| 622 | effects will work as expected except for things that Edebug explicitly | 625 | effects will work as expected, except for changes to data that Edebug |
| 623 | saves and restores. @xref{The Outside Context}, for details on this | 626 | explicitly saves and restores. @xref{The Outside Context}, for details |
| 624 | process. | 627 | on 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 | |||
| 739 | To delete a group, move point into it and type @kbd{C-c C-d}, or simply | 742 | To delete a group, move point into it and type @kbd{C-c C-d}, or simply |
| 740 | delete the text for the group and update the evaluation list with | 743 | delete 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 |
| 742 | the expression at a suitable place, and insert a new comment line. (You | 745 | the expression at a suitable place, insert a new comment line, then type |
| 743 | need 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 |
| 744 | Then type @kbd{C-c C-u}. | 747 | contents don't matter. |
| 745 | 748 | ||
| 746 | After selecting @samp{*edebug*}, you can return to the source code | 749 | After selecting @samp{*edebug*}, you can return to the source code |
| 747 | buffer with @kbd{C-c C-w}. The @samp{*edebug*} buffer is killed when | 750 | buffer 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 |
| 767 | If non-@code{nil}, bind @code{print-length} to this while printing | 770 | If non-@code{nil}, Edebug binds @code{print-length} to this value while |
| 768 | results in Edebug. The default value is @code{50}. | 771 | printing 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 |
| 772 | If non-@code{nil}, bind @code{print-level} to this while printing | 775 | If non-@code{nil}, Edebug binds @code{print-level} to this value while |
| 773 | results in Edebug. The default value is @code{50}. | 776 | printing 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 |
| 777 | elements more informatively by using the @file{cust-print} package. | 780 | elements more informatively by binding @code{print-circle} |
| 778 | 781 | to a non-@code{nil} value. | |
| 779 | To load @file{cust-print} and activate custom printing only for | ||
| 780 | Edebug, simply use the command @kbd{M-x edebug-install-custom-print}. | ||
| 781 | To restore the standard print functions, use @kbd{M-x | ||
| 782 | edebug-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 | |||
| 796 | vectors. | 795 | vectors. |
| 797 | 796 | ||
| 798 | @defopt edebug-print-circle | 797 | @defopt edebug-print-circle |
| 799 | If non-@code{nil}, bind @code{print-circle} to this while printing | 798 | If non-@code{nil}, Edebug binds @code{print-circle} to this value while |
| 800 | results in Edebug. The default value is @code{nil}. | 799 | printing 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. | |||
| 816 | mode (@pxref{Edebug Execution Modes}). | 815 | mode (@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 |
| 819 | lines to the trace buffer. A function entry record looks like | 818 | lines 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 |
| 821 | function exit record looks like @samp{::::@}} followed by the function | 820 | function exit record consists of @samp{::::@}}, followed by the function |
| 822 | name and result of the function. | 821 | name 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{} |
| 835 | This macro requests additional trace information around the execution | 834 | This macro requests additional trace information around the execution |
| 836 | of the @var{body} forms. The argument @var{string} specifies text | 835 | of the @var{body} forms. The argument @var{string} specifies text |
| 837 | to put in the trace buffer. All the arguments are evaluated. | 836 | to 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 | |||
| 964 | the program), it restores the previous window configuration. | 963 | the program), it restores the previous window configuration. |
| 965 | 964 | ||
| 966 | Emacs redisplays only when it pauses. Usually, when you continue | 965 | Emacs redisplays only when it pauses. Usually, when you continue |
| 967 | execution, the program comes back into Edebug at a breakpoint or after | 966 | execution, the program re-enters Edebug at a breakpoint or after |
| 968 | stepping without pausing or reading input in between. In such cases, | 967 | stepping, without pausing or reading input in between. In such cases, |
| 969 | Emacs never gets a chance to redisplay the ``outside'' configuration. | 968 | Emacs never gets a chance to redisplay the ``outside'' configuration. |
| 970 | What you see is the same window configuration as the last time Edebug | 969 | Consequently, what you see is the same window configuration as the last |
| 971 | was active, with no interruption. | 970 | time Edebug was active, with no interruption. |
| 972 | 971 | ||
| 973 | Entry to Edebug for displaying something also saves and restores the | 972 | Entry to Edebug for displaying something also saves and restores the |
| 974 | following data, but some of these are deliberately not restored if an | 973 | following data (though some of them are deliberately not restored if an |
| 975 | error or quit signal occurs. | 974 | error 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 |
| 15 | This Info file contains edition 2.5.1 of the GNU Emacs Lisp | 15 | This Info file contains edition 2.6 of the GNU Emacs Lisp |
| 16 | Reference Manual, corresponding to Emacs version 20.4. | 16 | Reference 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 | |||
| 85 | Free Software Foundation, Inc. | 85 | Free Software Foundation, Inc. |
| 86 | 86 | ||
| 87 | @sp 2 | 87 | @sp 2 |
| 88 | Edition 2.5.1 @* | 88 | Edition 2.6 @* |
| 89 | Revised for Emacs Version 20.4,@* | 89 | Revised for Emacs Version 21.1,@* |
| 90 | January 1999.@* | 90 | September 1999.@* |
| 91 | @sp 2 | 91 | @sp 2 |
| 92 | ISBN 1-882114-72-8 | 92 | ISBN 1-882114-73-6 |
| 93 | 93 | ||
| 94 | @sp 2 | 94 | @sp 2 |
| 95 | Published by the Free Software Foundation @* | 95 | Published 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 |
| 123 | This Info file contains edition 2.5.1 of the GNU Emacs Lisp | 123 | This Info file contains edition 2.6 of the GNU Emacs Lisp |
| 124 | Reference Manual, corresponding to GNU Emacs version 20.4. | 124 | Reference 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 | ||
| 868 | Starting Up Emacs | 869 | Starting 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 | ||
| 876 | Getting out of Emacs | 877 | Getting 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"}@* |
| 67 | Note that this is not a @code{file-error} | 67 | Note that this is not a subcategory of @code{file-error}, |
| 68 | because it pertains to the Lisp reader, not to file I/O. | 68 | because 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 |
| 72 | This is a @code{file-error}.@* | 72 | This 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 |
| 87 | This is a @code{file-error}.@* | 87 | This 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 |
| 91 | This is a @code{file-error}.@* | 91 | This 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 | |||
| 126 | This function displays warning or advisory messages in various peculiar | 126 | This function displays warning or advisory messages in various peculiar |
| 127 | cases, unless the optional argument @var{nowarn} is non-@code{nil}. For | 127 | cases, unless the optional argument @var{nowarn} is non-@code{nil}. For |
| 128 | example, if it needs to create a buffer, and there is no file named | 128 | example, 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 |
| 130 | area, and leaves the buffer empty. | 130 | area, and leaves the buffer empty. |
| 131 | 131 | ||
| 132 | The @code{find-file-noselect} function normally calls | 132 | The @code{find-file-noselect} function normally calls |
| @@ -260,7 +260,7 @@ and by the default revert function (@pxref{Reverting}). | |||
| 260 | If reading the file got an error because the file does not exist, but | 260 | If reading the file got an error because the file does not exist, but |
| 261 | its directory does exist, the caller should pass a non-@code{nil} value | 261 | its directory does exist, the caller should pass a non-@code{nil} value |
| 262 | for @var{error}. In that case, @code{after-find-file} issues a warning: | 262 | for @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 |
| 264 | call @code{after-find-file}. | 264 | call @code{after-find-file}. |
| 265 | 265 | ||
| 266 | If @var{warn} is non-@code{nil}, then this function issues a warning | 266 | If @var{warn} is non-@code{nil}, then this function issues a warning |
| @@ -312,7 +312,7 @@ the user. | |||
| 312 | The optional @var{exiting} argument, if non-@code{nil}, requests this | 312 | The optional @var{exiting} argument, if non-@code{nil}, requests this |
| 313 | function to offer also to save certain other buffers that are not | 313 | function to offer also to save certain other buffers that are not |
| 314 | visiting files. These are buffers that have a non-@code{nil} | 314 | visiting files. These are buffers that have a non-@code{nil} |
| 315 | buffer-local value of @code{buffer-offer-save}. (A user who says yes to | 315 | buffer-local value of @code{buffer-offer-save}. (A user who says @samp{yes} to |
| 316 | saving one of these is asked to specify a file name to use.) The | 316 | saving 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 |
| 318 | for this argument. | 318 | for this argument. |
| @@ -447,7 +447,9 @@ The function @code{insert-file-contents} checks the file contents | |||
| 447 | against the defined file formats, and converts the file contents if | 447 | against the defined file formats, and converts the file contents if |
| 448 | appropriate. @xref{Format Conversion}. It also calls the functions in | 448 | appropriate. @xref{Format Conversion}. It also calls the functions in |
| 449 | the list @code{after-insert-file-functions}; see @ref{Saving | 449 | the list @code{after-insert-file-functions}; see @ref{Saving |
| 450 | Properties}. | 450 | Properties}. 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 | ||
| 452 | If @var{visit} is non-@code{nil}, this function additionally marks the | 454 | If @var{visit} is non-@code{nil}, this function additionally marks the |
| 453 | buffer as unmodified and sets up various fields in the buffer so that it | 455 | buffer 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, | |||
| 510 | or a nonexistent file in a directory where files cannot be created. | 512 | or 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 |
| 514 | This function writes the region delimited by @var{start} and @var{end} | 516 | This function writes the region delimited by @var{start} and @var{end} |
| 515 | in the current buffer into the file specified by @var{filename}. | 517 | in the current buffer into the file specified by @var{filename}. |
| 516 | 518 | ||
| 517 | @c Emacs 19 feature | 519 | @c Emacs 19 feature |
| 518 | If @var{start} is a string, then @code{write-region} writes or appends | 520 | If @var{start} is a string, then @code{write-region} writes or appends |
| 519 | that string, rather than text from the buffer. | 521 | that string, rather than text from the buffer. @var{end} is ignored in |
| 522 | this case. | ||
| 520 | 523 | ||
| 521 | If @var{append} is non-@code{nil}, then the specified text is appended | 524 | If @var{append} is non-@code{nil}, then the specified text is appended |
| 522 | to the existing file contents (if any). | 525 | to the existing file contents (if any). |
| 523 | 526 | ||
| 524 | If @var{confirm} is non-@code{nil}, then @code{write-region} asks | 527 | If @var{mustbenew} is non-@code{nil}, then @code{write-region} asks |
| 525 | for confirmation if @var{filename} names an existing file. | 528 | for confirmation if @var{filename} names an existing file. |
| 529 | Starting in Emacs 21, if @var{mustbenew} is the symbol @code{excl}, | ||
| 530 | then @code{write-region} does not ask for confirmation, but instead | ||
| 531 | it signals an error @code{file-already-exists} if the file already | ||
| 532 | exists. | ||
| 533 | |||
| 534 | The test for an existing file, when @var{mustbenew} is @code{excl}, uses | ||
| 535 | a special system feature. At least for files on a local disk, there is | ||
| 536 | no chance that some other program could create a file of the same name | ||
| 537 | before Emacs does, without Emacs's noticing. | ||
| 526 | 538 | ||
| 527 | If @var{visit} is @code{t}, then Emacs establishes an association | 539 | If @var{visit} is @code{t}, then Emacs establishes an association |
| 528 | between the buffer and the file: the buffer is then visiting that file. | 540 | between 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 | |||
| 615 | does nothing if the current buffer is not visiting a file. | 627 | does 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 | ||
| 631 | support 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 |
| 619 | This function is called when the user tries to modify @var{file}, but it | 635 | This function is called when the user tries to modify @var{file}, but it |
| 620 | is locked by another user named @var{other-user}. The default | 636 | is 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 |
| 712 | This function returns @code{t} if a file named @var{filename} exists and | 728 | This function returns @code{t} if a file named @var{filename} exists and |
| 713 | you can execute it. It returns @code{nil} otherwise. If the file is a | 729 | you can execute it. It returns @code{nil} otherwise. On Unix, if the |
| 714 | directory, execute permission means you can check the existence and | 730 | file is a directory, execute permission means you can check the |
| 715 | attributes of files inside the directory, and open those files if their | 731 | existence and attributes of files inside the directory, and open those |
| 716 | modes permit. | 732 | files 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. | |||
| 1081 | last had its inode changed on Aug 19 00:09. | 1097 | last had its inode changed on Aug 19 00:09. |
| 1082 | 1098 | ||
| 1083 | @item 14906 | 1099 | @item 14906 |
| 1084 | is 14906 characters long. | 1100 | is 14906 bytes long. (It may not contain 14906 characters, though, |
| 1101 | if some of the bytes belong to multibyte sequences.) | ||
| 1085 | 1102 | ||
| 1086 | @item "-rw-rw-rw-" | 1103 | @item "-rw-rw-rw-" |
| 1087 | has a mode of read and write access for the owner, group, and world. | 1104 | has 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 | ||
| 1188 | This function is meaningless on operating systems where multiple names | 1205 | This function is meaningless on operating systems where multiple names |
| 1189 | for one file are not allowed. | 1206 | for one file are not allowed. Some systems implement multiple names |
| 1207 | by copying the file instead. | ||
| 1190 | 1208 | ||
| 1191 | See also @code{file-nlinks} in @ref{File Attributes}. | 1209 | See 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 | |||
| 1241 | In an interactive call, this function prompts for @var{filename} and | 1259 | In 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 | |||
| 1263 | This function is not available on systems that don't support symbolic | ||
| 1264 | links. | ||
| 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. |
| 1278 | So Emacs considers a file executable if its name ends in @samp{.com}, | 1299 | So 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 | 1300 | standard executable extensions, such as @file{.com}, @file{.bat}, |
| 1280 | by @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 | ||
| 1303 | as executable files. This is reflected in the values returned by | ||
| 1304 | @code{file-modes} and @code{file-attributes}. Directories are also | ||
| 1305 | reported 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. |
| 1328 | Concatenating these two parts reproduces the original file name. | 1353 | Concatenating 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 |
| 1331 | slash; the nondirectory part is the rest. The rules in VMS syntax are | 1356 | the last slash; the nondirectory part is the rest. The rules in VMS |
| 1332 | complicated. | 1357 | syntax 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 |
| 1335 | the name proper and the @dfn{version number}. On Unix, only backup | 1360 | the name proper and the @dfn{version number}. On most systems, only |
| 1336 | files have version numbers in their names. On VMS, every file has a | 1361 | backup files have version numbers in their names. On VMS, every file |
| 1337 | version number, but most of the time the file name actually used in | 1362 | has a version number, but most of the time the file name actually used |
| 1338 | Emacs omits the version number, so that version numbers in Emacs are | 1363 | in Emacs omits the version number, so that version numbers in Emacs are |
| 1339 | found mostly in directory lists. | 1364 | found mostly in directory lists. |
| 1340 | 1365 | ||
| 1341 | @defun file-name-directory filename | 1366 | @defun file-name-directory filename |
| 1342 | This function returns the directory part of @var{filename} (or | 1367 | This 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 |
| 1344 | Unix, the function returns a string ending in a slash. On VMS, it | 1369 | most systems, the function returns a string ending in a slash. On VMS, |
| 1345 | returns a string ending in one of the three characters @samp{:}, | 1370 | it 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 | |||
| 1429 | kind of file, and it has a file name, which is related to the directory | 1454 | kind of file, and it has a file name, which is related to the directory |
| 1430 | name but not identical to it. (This is not quite the same as the usual | 1455 | name but not identical to it. (This is not quite the same as the usual |
| 1431 | Unix terminology.) These two different names for the same entity are | 1456 | Unix terminology.) These two different names for the same entity are |
| 1432 | related by a syntactic transformation. On Unix, this is simple: a | 1457 | related by a syntactic transformation. On most systems, this is simple: a |
| 1433 | directory name ends in a slash, whereas the directory's name as a file | 1458 | directory name ends in a slash, whereas the directory's name as a file |
| 1434 | lacks that slash. On VMS, the relationship is more complicated. | 1459 | lacks 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 |
| 1446 | This function returns a string representing @var{filename} in a form | 1471 | This function returns a string representing @var{filename} in a form |
| 1447 | that the operating system will interpret as the name of a directory. In | 1472 | that the operating system will interpret as the name of a directory. On |
| 1448 | Unix, this means appending a slash to the string (if it does not already | 1473 | most systems, this means appending a slash to the string (if it does not |
| 1449 | end in one). On VMS, the function converts a string of the form | 1474 | already 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 |
| 1461 | This function returns a string representing @var{dirname} in a form that | 1486 | This function returns a string representing @var{dirname} in a form that |
| 1462 | the operating system will interpret as the name of a file. On Unix, | 1487 | the operating system will interpret as the name of a file. On most |
| 1463 | this means removing the final slash from the string. On VMS, the | 1488 | systems, this means removing the final slash from the string. On VMS, |
| 1464 | function converts a string of the form @file{[X.Y]} to | 1489 | the 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} | |||
| 1522 | file name. Or it can specify the position of the file in the tree | 1547 | file name. Or it can specify the position of the file in the tree |
| 1523 | relative to a default directory; then it is called a @dfn{relative} | 1548 | relative to a default directory; then it is called a @dfn{relative} |
| 1524 | file name. On Unix, an absolute file name starts with a slash or a | 1549 | file name. On Unix, an absolute file name starts with a slash or a |
| 1525 | tilde (@samp{~}), and a relative one does not. The rules on VMS are | 1550 | tilde (@samp{~}), and a relative one does not. On MS-DOS and |
| 1526 | complicated. | 1551 | MS-Windows, an absolute file name starts with a slash or a backslash, or |
| 1552 | with 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 |
| 1529 | This function returns @code{t} if file @var{filename} is an absolute | 1556 | This 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 |
| 1626 | argument is @code{nil}. | 1653 | argument is @code{nil}. |
| 1627 | 1654 | ||
| 1628 | On Unix systems, the value is always a string ending with a slash. | 1655 | Aside 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 |
| 1683 | construct a name for such a file: | 1710 | construct 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 |
| 1692 | The job of @code{make-temp-name} is to prevent two different users or | 1717 | The job of @code{make-temp-file} is to prevent two different users or |
| 1693 | two different jobs from trying to use the exact same file name. This | 1718 | two different jobs from trying to use the exact same file name. |
| 1694 | example uses the variable @code{temporary-file-directory} to decide | ||
| 1695 | where to put the temporary file. All Emacs Lisp programs should | ||
| 1696 | use @code{temporary-file-directory} for this purpose, to give the user | ||
| 1697 | a 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 |
| 1700 | This function generates a string that can be used as a unique file name. | 1721 | @tindex make-temp-file |
| 1701 | The name starts with @var{string}, and contains a number that is | 1722 | This function creates a temporary file and returns its name. |
| 1702 | different in each Emacs job. | 1723 | The name starts with @var{prefix}; it also contains a number that is |
| 1724 | different in each Emacs job. If @var{prefix} is a relative file name, | ||
| 1725 | it 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 | ||
| 1734 | When @code{make-temp-file} returns, the file has been created and is | ||
| 1735 | empty. At that point, you should write the intended contents into the | ||
| 1736 | file. | ||
| 1737 | |||
| 1738 | If @var{dir-flag} is non-@code{nil}, @code{make-temp-file} creates | ||
| 1739 | an empty directory instead of an empty file. | ||
| 1740 | |||
| 1711 | To prevent conflicts among different libraries running in the same | 1741 | To prevent conflicts among different libraries running in the same |
| 1712 | Emacs, each Lisp program that uses @code{make-temp-name} should have its | 1742 | Emacs, each Lisp program that uses @code{make-temp-file} should have its |
| 1713 | own @var{string}. The number added to the end of @var{string} | 1743 | own @var{prefix}. The number added to the end of @var{prefix} |
| 1714 | distinguishes between the same application running in different Emacs | 1744 | distinguishes between the same application running in different Emacs |
| 1715 | jobs. Additional added characters permit a large number of distinct | 1745 | jobs. Additional added characters permit a large number of distinct |
| 1716 | names even in one Emacs job. | 1746 | names even in one Emacs job. |
| 1717 | @end defun | 1747 | @end defun |
| 1718 | 1748 | ||
| 1749 | The default directory for temporary files is controlled by the | ||
| 1750 | variable @code{temporary-file-directory}. This variable gives the user | ||
| 1751 | a uniform way to specify the directory for all temporary files. Some | ||
| 1752 | programs use @code{small-temporary-file-directory} instead, if that is | ||
| 1753 | non-@code{nil}. To use it, you should expand the prefix against | ||
| 1754 | the proper directory before calling @code{make-temp-file}. | ||
| 1755 | |||
| 1756 | In older Emacs versions where @code{make-temp-file} does not exist, | ||
| 1757 | you 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 | ||
| 1766 | This function generates a string that can be used as a unique file name. | ||
| 1767 | The name starts with @var{string}, and contains a number that is | ||
| 1768 | different in each Emacs job. It is like @code{make-temp-file} except | ||
| 1769 | that it just constructs a name, and does not create a file. On MS-DOS, | ||
| 1770 | the @var{string} prefix can be truncated to fit into the 8+3 file-name | ||
| 1771 | limits. | ||
| 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 | ||
| 1722 | This variable specifies the directory name for creating temporary files. | 1778 | This variable specifies the directory name for creating temporary files. |
| 1723 | Its value should be a directory name (@pxref{Directory Names}), but it | 1779 | Its value should be a directory name (@pxref{Directory Names}), but it |
| 1724 | is good for Lisp programs to cope if the value is a directory's file | 1780 | is 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 | ||
| 1728 | The default value is determined in a reasonable way for your operating | 1784 | The default value is determined in a reasonable way for your operating |
| 1729 | system; on GNU and Unix systems it is based on the @code{TMP} and | 1785 | system; it is based on the @code{TMPDIR}, @code{TMP} and @code{TEMP} |
| 1730 | @code{TMPDIR} environment variables. | 1786 | environment variables, with a fall-back to a system-dependent name if |
| 1787 | none of these variables is defined. | ||
| 1731 | 1788 | ||
| 1732 | Even if you do not use @code{make-temp-name} to choose the temporary | 1789 | Even if you do not use @code{make-temp-name} to choose the temporary |
| 1733 | file's name, you should still use this variable to decide which | 1790 | file's name, you should still use this variable to decide which |
| 1734 | directory to put the file in. | 1791 | directory to put the file in. However, if you expect the file to be |
| 1792 | small, you should use @code{small-temporary-file-directory} first if | ||
| 1793 | that is non-@code{nil}. | ||
| 1794 | @end defvar | ||
| 1795 | |||
| 1796 | @tindex small-temporary-file-directory | ||
| 1797 | @defvar small-temporary-file-directory | ||
| 1798 | This variable (new in Emacs 21) specifies the directory name for | ||
| 1799 | creating certain temporary files, which are likely to be small. | ||
| 1800 | |||
| 1801 | If you want to write a temporary file which is likely to be small, you | ||
| 1802 | should 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 | |||
| 1953 | describe a directory itself as a file, rather than showing its | 2028 | describe a directory itself as a file, rather than showing its |
| 1954 | contents.) | 2029 | contents.) |
| 1955 | 2030 | ||
| 1956 | This function works by running a directory listing program whose name is | 2031 | On most systems, this function works by running a directory listing |
| 1957 | in the variable @code{insert-directory-program}. If @var{wildcard} is | 2032 | program whose name is in the variable @code{insert-directory-program}. |
| 1958 | non-@code{nil}, it also runs the shell specified by | 2033 | If @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 | |||
| 2036 | MS-DOS and MS-Windows systems usually lack the standard Unix program | ||
| 2037 | @code{ls}, so this function emulates the standard Unix program @code{ls} | ||
| 2038 | with Lisp code. | ||
| 1960 | @end defun | 2039 | @end defun |
| 1961 | 2040 | ||
| 1962 | @defvar insert-directory-program | 2041 | @defvar insert-directory-program |
| 1963 | This variable's value is the program to run to generate a directory listing | 2042 | This variable's value is the program to run to generate a directory listing |
| 1964 | for the function @code{insert-directory}. | 2043 | for the function @code{insert-directory}. It is ignored on systems |
| 2044 | which 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 | ||
| 2108 | Handlers for @code{insert-file-contents} typically need to clear the | 2190 | Handlers 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 | |||
| 24 | display several such frames at once as is usual for window systems. | 24 | display several such frames at once as is usual for window systems. |
| 25 | 25 | ||
| 26 | @defun framep object | 26 | @defun framep object |
| 27 | This predicate returns @code{t} if @var{object} is a frame, and | 27 | This predicate returns a non-@code{nil} value if @var{object} is a |
| 28 | @code{nil} otherwise. | 28 | frame, and @code{nil} otherwise. For a frame, the value indicates which |
| 29 | kind of display the frame uses: | ||
| 30 | |||
| 31 | @table @code | ||
| 32 | @item x | ||
| 33 | The frame is displayed in an X window. | ||
| 34 | @item t | ||
| 35 | A terminal frame on a character display. | ||
| 36 | @item mac | ||
| 37 | The frame is displayed on a Macintosh. | ||
| 38 | @item w32 | ||
| 39 | The frame is displayed on MS-Windows 9X/NT. | ||
| 40 | @item pc | ||
| 41 | The 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 | |||
| 86 | frame. | 98 | frame. |
| 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 |
| 91 | An abnormal hook run by @code{make-frame} after it creates the frame. | 103 | An abnormal hook run by @code{make-frame} after it creates the frame. |
| 92 | Each function in @code{after-make-frame-hook} receives one argument, the | 104 | Each function in @code{after-make-frame-hook} receives one argument, the |
| 93 | frame just created. | 105 | frame 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 | ||
| 166 | A frame has many parameters that control its appearance and behavior. | 178 | A frame has many parameters that control its appearance and behavior. |
| 167 | Just what parameters a frame has depends on what display mechanism it | 179 | Just what parameters a frame has depends on what display mechanism it |
| 168 | uses. | 180 | uses. |
| 169 | 181 | ||
| 170 | Frame parameters exist for the sake of window systems. A terminal frame | 182 | Frame parameters exist mostly for the sake of window systems. A |
| 171 | has a few parameters, mostly for compatibility's sake; only the @code{height}, | 183 | terminal frame has a few parameters, mostly for compatibility's sake; |
| 172 | @code{width}, @code{name}, @code{title}, @code{buffer-list} and | 184 | only 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} |
| 186 | parameters do something special. If the terminal supports colors, the | ||
| 187 | parameters @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. | |||
| 222 | If these settings affect the frame geometry and appearance, you'll see | 237 | If these settings affect the frame geometry and appearance, you'll see |
| 223 | the frame appear with the wrong ones and then change to the specified | 238 | the frame appear with the wrong ones and then change to the specified |
| 224 | ones. If that bothers you, you can specify the same geometry and | 239 | ones. If that bothers you, you can specify the same geometry and |
| 225 | appearance with X resources; those do take affect before the frame is | 240 | appearance with X resources; those do take effect before the frame is |
| 226 | created. @xref{Resources X,, X Resources, emacs, The GNU Emacs Manual}. | 241 | created. @xref{Resources X,, X Resources, emacs, The GNU Emacs Manual}. |
| 227 | 242 | ||
| 228 | X resource settings typically apply to all frames. If you want to | 243 | X 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 |
| 392 | The name of the font for displaying text in the frame. This is a | 407 | The name of the font for displaying text in the frame. This is a |
| 393 | string, either a valid font name for your system or the name of an Emacs | 408 | string, either a valid font name for your system or the name of an Emacs |
| 394 | fontset (@pxref{Fontsets}). | 409 | fontset (@pxref{Fontsets}). Changing this frame parameter on a frame, |
| 410 | also changes the font-related attributes of the default face on that | ||
| 411 | frame. | ||
| 395 | 412 | ||
| 396 | @item auto-raise | 413 | @item auto-raise |
| 397 | Whether selecting the frame raises it (non-@code{nil} means yes). | 414 | Whether 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 |
| 426 | The color to use for the image of a character. This is a string; the | 443 | The color to use for the image of a character. This is a string; the |
| 427 | window system defines the meaningful color names. | 444 | window system defines the meaningful color names. Changing this |
| 428 | 445 | parameter is equivalent to changing the foreground color of the face | |
| 429 | If you set the @code{foreground-color} frame parameter, you should | 446 | @code{default} on the frame in question. |
| 430 | call @code{frame-update-face-colors} to update faces accordingly. | ||
| 431 | 447 | ||
| 432 | @item background-color | 448 | @item background-color |
| 433 | The color to use for the background of characters. | 449 | The color to use for the background of characters. Changing this |
| 434 | 450 | parameter is equivalent to changing the foreground color of the face | |
| 435 | If you set the @code{background-color} frame parameter, you should | 451 | @code{default} on the frame in question. |
| 436 | call @code{frame-update-face-colors} to update faces accordingly. | ||
| 437 | @xref{Face Functions}. | ||
| 438 | 452 | ||
| 439 | @item background-mode | 453 | @item background-mode |
| 440 | This parameter is either @code{dark} or @code{light}, according | 454 | This parameter is either @code{dark} or @code{light}, according |
| 441 | to whether the background color is a light one or a dark one. | 455 | to whether the background color is a light one or a dark one. |
| 442 | 456 | ||
| 443 | @item mouse-color | 457 | @item mouse-color |
| 444 | The color for the mouse pointer. | 458 | The color for the mouse pointer. Changing this parameter is equivalent |
| 459 | to changing the background color of face @code{mouse}. | ||
| 445 | 460 | ||
| 446 | @item cursor-color | 461 | @item cursor-color |
| 447 | The color for the cursor that shows point. | 462 | The color for the cursor that shows point. Changing this parameter is |
| 463 | equivalent to changing the background color of face @code{cursor}. | ||
| 448 | 464 | ||
| 449 | @item border-color | 465 | @item border-color |
| 450 | The color for the border of the frame. | 466 | The color for the border of the frame. Changing this parameter is |
| 467 | equivalent to changing the background color of face @code{border}. | ||
| 468 | |||
| 469 | @item scroll-bar-foreground | ||
| 470 | If non-@code{nil}, the color for the foreground of scroll bars. | ||
| 471 | Changing this parameter is equivalent to setting the foreground color of | ||
| 472 | face @code{scroll-bar}. | ||
| 473 | |||
| 474 | @item scroll-bar-background | ||
| 475 | If non-@code{nil}, the color for the background of scroll bars. | ||
| 476 | Changing this parameter is equivalent to setting the foreground color of | ||
| 477 | face @code{scroll-bar}. | ||
| 451 | 478 | ||
| 452 | @item display-type | 479 | @item display-type |
| 453 | This parameter describes the range of possible colors that can be used | 480 | This 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 | |||
| 482 | toolkit, there is only one menu bar line; all that matters about the | 509 | toolkit, there is only one menu bar line; all that matters about the |
| 483 | number you specify is whether it is greater than zero.) | 510 | number you specify is whether it is greater than zero.) |
| 484 | 511 | ||
| 512 | @item screen-gamma | ||
| 513 | If this is a number, Emacs performs ``gamma correction'' on colors. The | ||
| 514 | value should be the screen gamma of your display, a floating point | ||
| 515 | number. Usual PC monitors have a screen gamma of 2.2. Smaller values | ||
| 516 | result in darker colors; you might want to try a screen gamma of 1.5 for | ||
| 517 | LCD color displays. The viewing gamma Emacs uses is 0.4545 (1/2.2). | ||
| 518 | |||
| 519 | @item tool-bar-lines | ||
| 520 | The number of lines to use for the toolbar. A value of @code{nil} means | ||
| 521 | don'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 | |||
| 755 | the lower right corner (always the minibuffer window, if the frame has | 793 | the lower right corner (always the minibuffer window, if the frame has |
| 756 | one), and then it moves back to the top. @xref{Cyclic Window Ordering}. | 794 | one), 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 |
| 759 | This returns the topmost, leftmost window of frame @var{frame}. | 797 | This 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 |
| 1311 | This variable specifies the coding system to use when reading and | 1349 | This variable specifies the coding system to use when reading and |
| 1312 | writing a selections, the clipboard, or a cut buffer. @xref{Coding | 1350 | writing selections, the clipboard, or a cut buffer. @xref{Coding |
| 1313 | Systems}. The default is @code{compound-text}. | 1351 | Systems}. 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 | 1355 | When Emacs runs on MS-Windows, it does not implement X selections in |
| 1318 | @section Looking up Font Names | 1356 | general, but it it does support the clipboard. @code{x-get-selection} |
| 1319 | 1357 | and @code{x-set-selection} on MS-Windows support the text data type | |
| 1320 | @defun x-list-font pattern &optional face frame maximum | 1358 | only; if the clipboard holds other types of data, Emacs treats the |
| 1321 | This function returns a list of available font names that match | 1359 | clipboard as empty. |
| 1322 | @var{pattern}. If the optional arguments @var{face} and @var{frame} are | 1360 | |
| 1323 | specified, 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}. | 1362 | If this is non-@code{nil}, the Emacs yank functions consult the |
| 1325 | 1363 | clipboard before the primary selection, and the kill functions store in | |
| 1326 | The argument @var{pattern} should be a string, perhaps with wildcard | 1364 | the clipboard as well as the primary selection. Otherwise they do not |
| 1327 | characters: the @samp{*} character matches any substring, and the | 1365 | access the clipboard at all. The default is @code{nil} on most systems, |
| 1328 | @samp{?} character matches any single character. Pattern matching | 1366 | but @code{t} on MS-Windows. |
| 1329 | of font names ignores case. | 1367 | @end defopt |
| 1330 | |||
| 1331 | If 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 | |||
| 1334 | The optional argument @var{maximum} sets a limit on how many fonts to | ||
| 1335 | return. If this is non-@code{nil}, then the return value is truncated | ||
| 1336 | after the first @var{maximum} matching fonts. Specifying a small value | ||
| 1337 | for @var{maximum} can make this function much faster, in cases where | ||
| 1338 | many 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 | ||
| 1345 | character codes. An individual font cannot display the whole range of | ||
| 1346 | characters that Emacs supports, but a fontset can. Fontsets have names, | ||
| 1347 | just as fonts do, and you can use a fontset name in place of a font name | ||
| 1348 | when you specify the ``font'' for a frame or a face. Here is | ||
| 1349 | information about defining a fontset under Lisp program control. | ||
| 1350 | |||
| 1351 | @defun create-fontset-from-fontset-spec fontset-spec &optional style-variant-p noerror | ||
| 1352 | This function defines a new fontset according to the specification | ||
| 1353 | string @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 | ||
| 1360 | Whitespace characters before and after the commas are ignored. | ||
| 1361 | |||
| 1362 | The first part of the string, @var{fontpattern}, should have the form of | ||
| 1363 | a standard X font name, except that the last two fields should be | ||
| 1364 | @samp{fontset-@var{alias}}. | ||
| 1365 | |||
| 1366 | The 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 | ||
| 1369 | name. If a fontset with the same name already exists, an error is | ||
| 1370 | signaled, unless @var{noerror} is non-@code{nil}, in which case this | ||
| 1371 | function does nothing. | ||
| 1372 | |||
| 1373 | If optional argument @var{style-variant-p} is non-@code{nil}, that says | ||
| 1374 | to create bold, italic and bold-italic variants of the fontset as well. | ||
| 1375 | These variant fontsets do not have a short name, only a long one, which | ||
| 1376 | is made by altering @var{fontpattern} to indicate the bold or italic | ||
| 1377 | status. | ||
| 1378 | |||
| 1379 | The specification string also says which fonts to use in the fontset. | ||
| 1380 | See below for the details. | ||
| 1381 | @end defun | ||
| 1382 | |||
| 1383 | The construct @samp{@var{charset}:@var{font}} specifies which font to | ||
| 1384 | use (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 | ||
| 1386 | to use for that character set. You can use this construct any number of | ||
| 1387 | times in the specification string. | ||
| 1388 | |||
| 1389 | For the remaining character sets, those that you don't specify | ||
| 1390 | explicitly, Emacs chooses a font based on @var{fontpattern}: it replaces | ||
| 1391 | @samp{fontset-@var{alias}} with a value that names one character set. | ||
| 1392 | For the @sc{ASCII} character set, @samp{fontset-@var{alias}} is replaced | ||
| 1393 | with @samp{ISO8859-1}. | ||
| 1394 | |||
| 1395 | In addition, when several consecutive fields are wildcards, Emacs | ||
| 1396 | collapses them into a single wildcard. This is to prevent use of | ||
| 1397 | auto-scaled fonts. Fonts made by scaling larger fonts are not usable | ||
| 1398 | for editing, and scaling a smaller font is not useful because it is | ||
| 1399 | better 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 | ||
| 1408 | the 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 | ||
| 1415 | and 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 | ||
| 1422 | specification. Most X distributions include only Chinese fonts that | ||
| 1423 | have @samp{song ti} or @samp{fangsong ti} in the @var{family} field. In | ||
| 1424 | such a case, @samp{Fontset-@var{n}} can be specified as below: | ||
| 1425 | |||
| 1426 | @smallexample | ||
| 1427 | Emacs.Fontset-0: -*-fixed-medium-r-normal-*-24-*-*-*-*-*-fontset-24,\ | ||
| 1428 | chinese-gb2312:-*-*-medium-r-normal-*-24-*-gb2312*-* | ||
| 1429 | @end smallexample | ||
| 1430 | |||
| 1431 | @noindent | ||
| 1432 | Then, the font specifications for all but Chinese GB2312 characters have | ||
| 1433 | @samp{fixed} in the @var{family} field, and the font specification for | ||
| 1434 | Chinese GB2312 characters has a wild card @samp{*} in the @var{family} | ||
| 1435 | field. | ||
| 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 |
| 1373 | valid, and what they look like. | ||
| 1374 | |||
| 1375 | @defun color-defined-p color &optional frame | ||
| 1376 | @tindex color-defined-p | ||
| 1441 | This function reports whether a color name is meaningful. It returns | 1377 | This 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 |
| 1443 | which frame's display to ask about; if @var{frame} is omitted or | 1379 | which 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 | ||
| 1446 | Note that this does not tell you whether the display you are using | 1382 | Note that this does not tell you whether the display you are using |
| 1447 | really supports that color. You can ask for any defined color on any | 1383 | really supports that color. When using X, you can ask for any defined |
| 1448 | kind of display, and you will get some result---that is how the X server | 1384 | color on any kind of display, and you will get some result---typically, |
| 1449 | works. Here's an approximate way to test whether your display supports | 1385 | the best it knows how to do. Here's an approximate way to test whether |
| 1450 | the color @var{color}: | 1386 | your 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 | |||
| 1397 | This function used to be called @code{x-color-defined-p}, | ||
| 1398 | and that name is still supported as an alias. | ||
| 1399 | @end defun | ||
| 1400 | |||
| 1401 | @defun defined-colors &optional frame | ||
| 1402 | @tindex defined-colors | ||
| 1403 | This function returns a list of the color names that are defined | ||
| 1404 | and supported on frame @var{frame} (default, the selected frame). | ||
| 1405 | |||
| 1406 | This function used to be called @code{x-defined-colors}, | ||
| 1407 | and 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 | ||
| 1463 | This function returns a value that describes what @var{color} should | 1412 | This function returns a value that describes what @var{color} should |
| 1464 | ideally look like. If @var{color} is defined, the value is a list of | 1413 | ideally look like. If @var{color} is defined, the value is a list of |
| 1465 | three integers, which give the amount of red, the amount of green, and | 1414 | three integers, which give the amount of red, the amount of green, and |
| 1466 | the amount of blue. Each integer ranges in principle from 0 to 65535, | 1415 | the amount of blue. Each integer ranges in principle from 0 to 65535, |
| 1467 | but in practice no value seems to be above 65280. If @var{color} is not | 1416 | but in practice no value seems to be above 65280. This kind |
| 1468 | defined, the value is @code{nil}. | 1417 | of three-element list is called an @dfn{rgb value}. |
| 1418 | |||
| 1419 | If @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 | ||
| 1483 | The color values are returned for @var{frame}'s display. If @var{frame} | 1434 | The color values are returned for @var{frame}'s display. If @var{frame} |
| 1484 | is omitted or @code{nil}, the information is returned for the selected | 1435 | is omitted or @code{nil}, the information is returned for the selected |
| 1485 | frame's display. | 1436 | frame's display. |
| 1437 | |||
| 1438 | This function used to be called @code{x-color-values}, | ||
| 1439 | and 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 | ||
| 1447 | 21. These terminals support only a small number of colors, and the | ||
| 1448 | computer uses small integers to select colors on the terminal. This | ||
| 1449 | means that the computer cannot reliably tell what the selected color | ||
| 1450 | looks like; instead, you have to inform your application which small | ||
| 1451 | integers correspond to which colors. However, Emacs does know the | ||
| 1452 | standard 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 | ||
| 1456 | value is a list of three integers, which give the amount of red, the | ||
| 1457 | amount of green, and the amount of blue. Each integer ranges in | ||
| 1458 | principle from 0 to 65535, but in practice the largest value used is | ||
| 1459 | 65280. | ||
| 1460 | |||
| 1461 | @defun tty-define-color name number &optional rgb | ||
| 1462 | @tindex tty-define-color | ||
| 1463 | This function associates the color name @var{name} with | ||
| 1464 | color number @var{number} on the terminal. | ||
| 1465 | |||
| 1466 | The optional argument @var{rgb}, if specified, is an rgb value; it says | ||
| 1467 | what the color actually looks like. If you do not specify @var{rgb}, | ||
| 1468 | then this color cannot be used by @code{tty-color-approximate} to | ||
| 1469 | approximate other colors, because Emacs does not know what it looks | ||
| 1470 | like. | ||
| 1471 | @end defun | ||
| 1472 | |||
| 1473 | @defun tty-clear-colors | ||
| 1474 | @tindex tty-clear-colors | ||
| 1475 | This 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 | ||
| 1480 | This variable holds an alist recording the colors supported by the | ||
| 1481 | terminal. | ||
| 1482 | |||
| 1483 | Each element has the form @code{(@var{name} @var{number} . @var{rgb})} | ||
| 1484 | or @code{(@var{name} @var{number})}. Here, @var{name} is the color | ||
| 1485 | name, @var{number} is the number used to specify it to the terminal. | ||
| 1486 | If present, @var{rgb} is an rgb value that says what the color | ||
| 1487 | actually looks like. | ||
| 1488 | @end defun | ||
| 1489 | |||
| 1490 | @defun tty-color-approximate rgb | ||
| 1491 | @tindex tty-color-approximate | ||
| 1492 | This 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 | ||
| 1498 | This function finds the closest available color, among those in | ||
| 1499 | @code{tty-color-alist}, to the name @var{color}. If that name | ||
| 1500 | is not defined, the value is @code{nil}. | ||
| 1501 | |||
| 1502 | @var{color} can be an X-style @code{#@var{xxxyyyzzz}} specification | ||
| 1503 | instead 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}. |
| 883 | For example, | 884 | For 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 |
| 99 | Specify a non-@code{nil} value for | 99 | Specify 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 |
| 101 | files, and load them with either @file{site-load.el} or | 101 | files, 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 |
| 103 | documentation strings take up space in Emacs all the time.) | 103 | documentation 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 |
| 108 | expect in an ordinary unmodified Emacs. If you feel you must override | 108 | expect in an ordinary unmodified Emacs. If you feel you must override |
| 109 | normal features for your site, do it with @file{default.el}, so that | 109 | normal features for your site, do it with @file{default.el}, so that |
| 110 | users can override your changes if they wish. @xref{Start-up Summary}. | 110 | users 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 |
| 128 | all the new data created during an Emacs session is kept; see the | 128 | all the new data created during an Emacs session are kept; see the |
| 129 | following section for information on normal storage. Pure storage is | 129 | following section for information on normal storage. Pure storage is |
| 130 | used for certain data in the preloaded standard Lisp files---data that | 130 | used for certain data in the preloaded standard Lisp files---data that |
| 131 | should never change during actual use of Emacs. | 131 | should never change during actual use of Emacs. |
| @@ -142,8 +142,8 @@ increase the compilation parameter @code{PURESIZE} in the file | |||
| 142 | preload additional libraries or add features to the standard ones. | 142 | preload additional libraries or add features to the standard ones. |
| 143 | 143 | ||
| 144 | @defun purecopy object | 144 | @defun purecopy object |
| 145 | This function makes a copy of @var{object} in pure storage and returns | 145 | This function makes a copy in pure storage of @var{object}, and returns |
| 146 | it. It copies strings by simply making a new string with the same | 146 | it. It copies a string by simply making a new string with the same |
| 147 | characters in pure storage. It recursively copies the contents of | 147 | characters in pure storage. It recursively copies the contents of |
| 148 | vectors and cons cells. It does not make copies of other objects such | 148 | vectors and cons cells. It does not make copies of other objects such |
| 149 | as symbols, but just returns them unchanged. It signals an error if | 149 | as 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}. | |||
| 553 | Alas, we can't explain all the tricky details here. | 553 | Alas, 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 |
| 556 | they are never written once Emacs is dumped. These variables with | 556 | the variables are never stored in once Emacs is dumped. These variables |
| 557 | initializers are allocated in an area of memory that becomes read-only | 557 | with initializers are allocated in an area of memory that becomes |
| 558 | (on certain operating systems) as a result of dumping Emacs. @xref{Pure | 558 | read-only (on certain operating systems) as a result of dumping Emacs. |
| 559 | Storage}. | 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 |
| 562 | variables at top level in the file. This is necessary because Emacs on | 562 | variables 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., | |||
| 587 | of these functions are called, and add a call to | 587 | of 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 |
| 591 | any C variables that are to be visible as Lisp variables. | 592 | any 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 |
| 593 | in Lisp. @code{DEFVAR_INT} makes a C variable of type @code{int} | 594 | in Lisp. @code{DEFVAR_INT} makes a C variable of type @code{int} |
| 594 | visible in Lisp with a value that is always an integer. | 595 | visible 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 |
| 596 | with a value that is either @code{t} or @code{nil}. | 597 | with a value that is either @code{t} or @code{nil}. Note that variables |
| 598 | defined 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}, |
| 599 | you must protect it for garbage-collection by calling @code{staticpro} | 602 | you must protect it from garbage-collection by calling @code{staticpro} |
| 600 | in @code{syms_of_@var{filename}}, like this: | 603 | in @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 |
| 682 | functions. | 685 | functions. |
| 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 | ||
| 690 | optimizer. | ||
| 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 |
| 731 | This field contains the modification time of the visited file. It is | 739 | This field contains the modification time of the visited file. It is |
| 732 | set when the file is written or read. Every time the buffer is written | 740 | set when the file is written or read. Before writing the buffer into a |
| 733 | to the file, this field is compared to the modification time of the | 741 | file, this field is compared to the modification time of the file to see |
| 734 | file. @xref{Buffer Modification}. | 742 | if the file has changed on disk. @xref{Buffer Modification}. |
| 735 | 743 | ||
| 736 | @item auto_save_modified | 744 | @item auto_save_modified |
| 737 | This field contains the time when the buffer was last auto-saved. | 745 | This field contains the time when the buffer was last auto-saved. |
| @@ -872,7 +880,9 @@ the screen is @w{line 0}.) | |||
| 872 | The height of the window, measured in lines. | 880 | The height of the window, measured in lines. |
| 873 | 881 | ||
| 874 | @item width | 882 | @item width |
| 875 | The width of the window, measured in columns. | 883 | The width of the window, measured in columns. This width includes the |
| 884 | scroll bar and fringes, and/or the separator line on the right of the | ||
| 885 | window (if any). | ||
| 876 | 886 | ||
| 877 | @item next | 887 | @item next |
| 878 | This is the window that is the next in the chain of siblings. It is | 888 | This 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.} |
| 346 | Copyright (C) 19@var{yy} @var{name of author} | 346 | Copyright (C) @var{year} @var{name of author} |
| 347 | 347 | ||
| 348 | This program is free software; you can redistribute it and/or | 348 | This program is free software; you can redistribute it and/or |
| 349 | modify it under the terms of the GNU General Public License | 349 | modify 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 | |||
| 366 | when it starts in an interactive mode: | 366 | when it starts in an interactive mode: |
| 367 | 367 | ||
| 368 | @smallexample | 368 | @smallexample |
| 369 | Gnomovision version 69, Copyright (C) 19@var{yy} @var{name of author} | 369 | Gnomovision version 69, Copyright (C) @var{year} @var{name of author} |
| 370 | Gnomovision comes with ABSOLUTELY NO WARRANTY; for details | 370 | Gnomovision comes with ABSOLUTELY NO WARRANTY; for details |
| 371 | type `show w'. This is free software, and you are welcome | 371 | type `show w'. This is free software, and you are welcome |
| 372 | to redistribute it under certain conditions; type `show c' | 372 | to 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 |
| 525 | Extensions}. | 525 | Extensions}. |
| 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 | |||
| 556 | programs, including those you write. | 556 | programs, 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)}. |
| 560 | 3)}. Names that represent metasyntactic variables, or arguments to a | 560 | Names that represent metasyntactic variables, or arguments to a function |
| 561 | function being described, appear in this font or form: | 561 | being 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 |
| 689 | and ``after'' versions of the text. These examples show the contents of | 688 | showing the ``before'' and ``after'' versions of the text. These |
| 690 | the buffer in question between two lines of dashes containing the buffer | 689 | examples show the contents of the buffer in question between two lines |
| 691 | name. In addition, @samp{@point{}} indicates the location of point. | 690 | of 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; | 691 | indicates the location of point. (The symbol for point, of course, is |
| 693 | it indicates the place @emph{between} two characters where point is | 692 | not part of the text in the buffer; it indicates the place |
| 694 | currently 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 | |||
| 900 | The value of this variable is the version of Emacs being run. It is a | 899 | The value of this variable is the version of Emacs being run. It is a |
| 901 | string such as @code{"20.3.1"}. The last number in this string is not | 900 | string such as @code{"20.3.1"}. The last number in this string is not |
| 902 | really part of the Emacs release version number; it is incremented each | 901 | really part of the Emacs release version number; it is incremented each |
| 903 | time you build Emacs in any given directory. | 902 | time you build Emacs in any given directory. A value with three numeric |
| 903 | components, such as @code{"20.3.9.1"}, indicates an unreleased test | ||
| 904 | version. | ||
| 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} |
| 126 | If an element of a keymap is a vector, the vector counts as bindings for | 126 | If an element of a keymap is a vector, the vector counts as bindings for |
| 127 | all the @sc{ASCII} characters, codes 0 through 127; vector element | 127 | all 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 |
| 129 | compact way to record lots of bindings. A keymap with such a vector is | 129 | compact way to record lots of bindings. A keymap with such a vector is |
| 130 | called a @dfn{full keymap}. Other keymaps are called @dfn{sparse | 130 | called a @dfn{full keymap}. Other keymaps are called @dfn{sparse |
| 131 | keymaps}. | 131 | keymaps}. |
| 132 | 132 | ||
| 133 | When a keymap contains a vector, it always defines a binding for each | 133 | When 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 |
| 135 | character. Such a binding of @code{nil} overrides any default key | 135 | character. Such a binding of @code{nil} overrides any default key |
| 136 | binding in the keymap, for @sc{ASCII} characters. However, default | 136 | binding in the keymap, for @sc{ascii} characters. However, default |
| 137 | bindings are still meaningful for events other than @sc{ASCII} | 137 | bindings are still meaningful for events other than @sc{ascii} |
| 138 | characters. A binding of @code{nil} does @emph{not} override | 138 | characters. A binding of @code{nil} does @emph{not} override |
| 139 | lower-precedence keymaps; thus, if the local map gives a binding of | 139 | lower-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 |
| 217 | This function creates and returns a new full keymap (i.e., one | 217 | This function creates and returns a new full keymap (i.e., one |
| 218 | containing a vector of length 128 for defining all the @sc{ASCII} | 218 | containing a vector of length 128 for defining all the @sc{ascii} |
| 219 | characters). The new keymap initially binds all @sc{ASCII} characters | 219 | characters). The new keymap initially binds all @sc{ascii} characters |
| 220 | to @code{nil}, and does not bind any other kind of event. | 220 | to @code{nil}, and does not bind any other kind of event. |
| 221 | 221 | ||
| 222 | @example | 222 | @example |
| @@ -567,7 +567,7 @@ other. | |||
| 567 | This function returns the current buffer's local keymap, or @code{nil} | 567 | This function returns the current buffer's local keymap, or @code{nil} |
| 568 | if it has none. In the following example, the keymap for the | 568 | if 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 |
| 570 | in which the entry for @key{ESC}, @sc{ASCII} code 27, is another sparse | 570 | in which the entry for @key{ESC}, @sc{ascii} code 27, is another sparse |
| 571 | keymap. | 571 | keymap. |
| 572 | 572 | ||
| 573 | @example | 573 | @example |
| @@ -953,7 +953,7 @@ This variable is the meta-prefix character code. It is used when | |||
| 953 | translating a meta character to a two-character sequence so it can be | 953 | translating a meta character to a two-character sequence so it can be |
| 954 | looked up in a keymap. For useful results, the value should be a prefix | 954 | looked up in a keymap. For useful results, the value should be a prefix |
| 955 | event (@pxref{Prefix Keys}). The default value is 27, which is the | 955 | event (@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 | ||
| 958 | As long as the value of @code{meta-prefix-char} remains 27, key | 958 | As long as the value of @code{meta-prefix-char} remains 27, key |
| 959 | lookup translates @kbd{M-b} into @kbd{@key{ESC} b}, which is normally | 959 | lookup 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. | |||
| 1256 | redefines the first (leftmost) mouse button, typed with the Meta key, to | 1256 | redefines the first (leftmost) mouse button, typed with the Meta key, to |
| 1257 | set point where you click. | 1257 | set 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 | ||
| 1261 | specifications of keys to bind. If these are read as multibyte text, as | ||
| 1262 | they usually will be in a Lisp file (@pxref{Loading Non-ASCII}), you | ||
| 1263 | must 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 | ||
| 1270 | or | ||
| 1271 | |||
| 1272 | @smallexample | ||
| 1273 | (global-set-key ?@"o 'my-function) ; bind o-umlaut | ||
| 1274 | @end smallexample | ||
| 1275 | |||
| 1276 | @noindent | ||
| 1277 | and your language environment is multibyte Latin-1, these commands | ||
| 1278 | actually bind the multibyte character with code 2294, not the unibyte | ||
| 1279 | Latin-1 character with code 246 (@kbd{M-v}). In order to use this | ||
| 1280 | binding, you need to enter the multibyte Latin-1 character as keyboard | ||
| 1281 | input. 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 | ||
| 1285 | construct the key sequence string using @code{multibyte-char-to-unibyte} | ||
| 1286 | or @code{string-make-unibyte} (@pxref{Converting Representations}). | ||
| 1287 | |||
| 1259 | @deffn Command global-set-key key definition | 1288 | @deffn Command global-set-key key definition |
| 1260 | This function sets the binding of @var{key} in the current global map | 1289 | This function sets the binding of @var{key} in the current global map |
| 1261 | to @var{definition}. | 1290 | to @var{definition}. |
| @@ -1431,7 +1460,7 @@ If @var{firstonly} is @code{non-ascii}, then the value is a single | |||
| 1431 | string representing the first key sequence found, rather than a list of | 1460 | string representing the first key sequence found, rather than a list of |
| 1432 | all possible key sequences. If @var{firstonly} is @code{t}, then the | 1461 | all possible key sequences. If @var{firstonly} is @code{t}, then the |
| 1433 | value is the first key sequence, except that key sequences consisting | 1462 | value is the first key sequence, except that key sequences consisting |
| 1434 | entirely of @sc{ASCII} characters (or meta variants of @sc{ASCII} | 1463 | entirely of @sc{ascii} characters (or meta variants of @sc{ascii} |
| 1435 | characters) are preferred to all other key sequences. | 1464 | characters) are preferred to all other key sequences. |
| 1436 | 1465 | ||
| 1437 | If @var{noindirect} is non-@code{nil}, @code{where-is-internal} doesn't | 1466 | If @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}. | |||
| 1457 | The listing describes meta characters as @key{ESC} followed by the | 1486 | The listing describes meta characters as @key{ESC} followed by the |
| 1458 | corresponding non-meta character. | 1487 | corresponding non-meta character. |
| 1459 | 1488 | ||
| 1460 | When several characters with consecutive @sc{ASCII} codes have the | 1489 | When several characters with consecutive @sc{ascii} codes have the |
| 1461 | same definition, they are shown together, as | 1490 | same 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 |
| 1463 | know the @sc{ASCII} codes to understand which characters this means. | 1492 | know the @sc{ascii} codes to understand which characters this means. |
| 1464 | For example, in the default global map, the characters @samp{@key{SPC} | 1493 | For 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 |
| 1467 | the normal printing characters, (e.g., letters, digits, punctuation, | 1496 | the normal printing characters, (e.g., letters, digits, punctuation, |
| 1468 | etc.@:); all these characters are bound to @code{self-insert-command}. | 1497 | etc.@:); 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 |
| 1594 | where a string consisting of two or more dashes specifies a separator line. | 1625 | A string starting with two or more dashes specifies a separator line; |
| 1626 | see @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 |
| 1597 | item looks like this: | 1629 | item looks like this: |
| @@ -1609,11 +1641,12 @@ string. Thus, the string need not be a constant. The third element, | |||
| 1609 | other information. Here is a table of the properties that are supported: | 1641 | other 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} |
| 1613 | The result of evaluating @var{form} determines whether the item is | 1645 | The result of evaluating @var{form} determines whether the item is |
| 1614 | enabled (non-@code{nil} means yes). | 1646 | enabled (non-@code{nil} means yes). If the item is not enabled, |
| 1647 | you can't really click on it. | ||
| 1615 | 1648 | ||
| 1616 | @item :visible FORM | 1649 | @item :visible @var{form} |
| 1617 | The result of evaluating @var{form} determines whether the item should | 1650 | The result of evaluating @var{form} determines whether the item should |
| 1618 | actually appear in the menu (non-@code{nil} means yes). If the item | 1651 | actually appear in the menu (non-@code{nil} means yes). If the item |
| 1619 | does not appear, then the menu is displayed as if this item were | 1652 | does 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 | |||
| 1684 | function should return the binding to use instead. | 1717 | function 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 | ||
| 1725 | text--instead, it divides the menu into subparts with a horizontal line. | ||
| 1726 | A separator looks like this in the menu keymap: | ||
| 1727 | |||
| 1728 | @example | ||
| 1729 | (menu-item @var{separator-type}) | ||
| 1730 | @end example | ||
| 1731 | |||
| 1732 | @noindent | ||
| 1733 | where @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. | ||
| 1736 | That 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} | ||
| 1740 | specify a different style of separator. Here is a table of them: | ||
| 1741 | |||
| 1742 | @table @code | ||
| 1743 | @item "--no-line" | ||
| 1744 | @itemx "--space" | ||
| 1745 | An extra vertical space, with no actual line. | ||
| 1746 | |||
| 1747 | @item "--single-line" | ||
| 1748 | A single line in the menu's foreground color. | ||
| 1749 | |||
| 1750 | @item "--double-line" | ||
| 1751 | A double line in the menu's foreground color. | ||
| 1752 | |||
| 1753 | @item "--single-dashed-line" | ||
| 1754 | A single dashed line in the menu's foreground color. | ||
| 1755 | |||
| 1756 | @item "--double-dashed-line" | ||
| 1757 | A double dashed line in the menu's foreground color. | ||
| 1758 | |||
| 1759 | @item "--shadow-etched-in" | ||
| 1760 | A single line with a 3D sunken appearance. This is the default, | ||
| 1761 | used separators consisting of dashes only. | ||
| 1762 | |||
| 1763 | @item "--shadow-etched-out" | ||
| 1764 | A single line with a 3D raised appearance. | ||
| 1765 | |||
| 1766 | @item "--shadow-etched-in-dash" | ||
| 1767 | A single dashed line with a 3D sunken appearance. | ||
| 1768 | |||
| 1769 | @item "--shadow-etched-out-dash" | ||
| 1770 | A single dashed line with a 3D raised appearance. | ||
| 1771 | |||
| 1772 | @item "--shadow-double-etched-in" | ||
| 1773 | Two lines with a 3D sunken appearance. | ||
| 1774 | |||
| 1775 | @item "--shadow-double-etched-out" | ||
| 1776 | Two lines with a 3D raised appearance. | ||
| 1777 | |||
| 1778 | @item "--shadow-double-etched-in-dash" | ||
| 1779 | Two dashed lines with a 3D sunken appearance. | ||
| 1780 | |||
| 1781 | @item "--shadow-double-etched-out-dash" | ||
| 1782 | Two 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 | ||
| 1786 | the double-dash and replacing each single dash with capitalization of | ||
| 1787 | the 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 | ||
| 1791 | separator types. If you use a type that isn't supported, the menu | ||
| 1792 | displays 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 | |||
| 1978 | should vary. | 2085 | should 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 | ||
| 2093 | commands when you click on them---in effect, a kind of graphical menu | ||
| 2094 | bar. Emacs supports tool bars starting with version 21. | ||
| 2095 | |||
| 2096 | The frame parameter @code{tool-bar-lines} (X resource @samp{toolBar}) | ||
| 2097 | controls how may lines' worth of height to reserve for the tool bar. A | ||
| 2098 | zero 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 | ||
| 2100 | contracts automatically as needed to hold the specified contents. | ||
| 2101 | |||
| 2102 | The tool bar contents are controlled by a menu keymap attached to a | ||
| 2103 | fake ``function key'' called @code{tool-bar} (much like the way the menu | ||
| 2104 | bar 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 | ||
| 2112 | where @var{key} is a fake ``function key'' to distinguish this item from | ||
| 2113 | other items, and @var{item} is a menu item key binding (@pxref{Extended | ||
| 2114 | Menu 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 | ||
| 2118 | tool bar bindings and have their normal meanings. The @var{real-binding} | ||
| 2119 | in the item must be a command, not a keymap; in other words, it does not | ||
| 2120 | work to define a tool bar icon as a prefix key. | ||
| 2121 | |||
| 2122 | The @code{:help} property is meaningful, and specifies a ``help-echo'' | ||
| 2123 | string to display while the mouse is on that item. | ||
| 2124 | |||
| 2125 | In addition, you should use the @code{:image} property; | ||
| 2126 | this 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 | ||
| 2131 | image specifications. If you use a vector of four, | ||
| 2132 | one of them is used, depending on circumstances: | ||
| 2133 | |||
| 2134 | @table @asis | ||
| 2135 | @item item 0 | ||
| 2136 | Used when the iitem is enabled and selected. | ||
| 2137 | @item item 1 | ||
| 2138 | Used when the item is enabled and deselected. | ||
| 2139 | @item item 2 | ||
| 2140 | Used when the item is disabled and selected. | ||
| 2141 | @item item 3 | ||
| 2142 | Used 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 | ||
| 2148 | If this variable is non-@code{nil}, the tool bar automatically resizes to | ||
| 2149 | show all defined tool bar items---but not larger than a quarter of the | ||
| 2150 | frame's height. | ||
| 2151 | @end defvar | ||
| 2152 | |||
| 2153 | @tindex auto-raise-tool-bar-items | ||
| 2154 | @defvar auto-raise-tool-bar-items | ||
| 2155 | If this variable is non-@code{nil}, tool bar items display | ||
| 2156 | in raised form when the mouse moves over them. | ||
| 2157 | @end defvar | ||
| 2158 | |||
| 2159 | @tindex tool-bar-item-margin | ||
| 2160 | @defvar tool-bar-item-margin | ||
| 2161 | This variable specifies an extra margin to add around tool bar items. | ||
| 2162 | The 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 | ||
| 2167 | This variable specifies the shadow width for tool bar items. | ||
| 2168 | The 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 | ||
| 2172 | the shift, control, meta, etc., modifiers. You do this by setting up | ||
| 2173 | additional items that relate to the original item through the fake | ||
| 2174 | function keys. Specifically, the additional items should use the | ||
| 2175 | modified versions of the same fake function key used to name the | ||
| 2176 | original 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 | ||
| 2187 | then here is how you can define clicking on the same tool bar image with | ||
| 2188 | the 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 | ||
| 2195 | function 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 | ||
| 307 | This macro is a way of examining the @sc{car} of a list, | ||
| 308 | and taking it off the list, all at once. It is new in Emacs 21. | ||
| 309 | |||
| 310 | It operates on the list which is stored in the symbol @var{listname}. | ||
| 311 | It removes this element from the list by setting @var{listname} | ||
| 312 | to the @sc{cdr} of its old value---but it also returns the @sc{car} | ||
| 313 | of that list, which is the element being removed. | ||
| 314 | |||
| 315 | @example | ||
| 316 | x | ||
| 317 | @result{} (a b c) | ||
| 318 | (pop x) | ||
| 319 | @result{} a | ||
| 320 | x | ||
| 321 | @result{} (b c) | ||
| 322 | @end example | ||
| 323 | @end defmac | ||
| 324 | |||
| 305 | @defun nth n list | 325 | @defun nth n list |
| 306 | This function returns the @var{n}th element of @var{list}. Elements | 326 | This function returns the @var{n}th element of @var{list}. Elements |
| 307 | are numbered starting with zero, so the @sc{car} of @var{list} is | 327 | are 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; | |||
| 441 | any symbol can serve both purposes. | 461 | any symbol can serve both purposes. |
| 442 | @end defun | 462 | @end defun |
| 443 | 463 | ||
| 464 | @tindex push | ||
| 465 | @defmac push newelt listname | ||
| 466 | This macro provides an alternative way to write | ||
| 467 | @code{(setq @var{listname} (cons @var{newelt} @var{listname}))}. | ||
| 468 | It is new in Emacs 21. | ||
| 469 | @end defmac | ||
| 470 | |||
| 444 | @defun list &rest objects | 471 | @defun list &rest objects |
| 445 | This function creates a list with @var{objects} as its elements. The | 472 | This function creates a list with @var{objects} as its elements. The |
| 446 | resulting list is always @code{nil}-terminated. If no @var{objects} | 473 | resulting 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 | ||
| 1541 | This function deletes from @var{alist} all the elements whose @sc{car} | ||
| 1542 | is @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 |
| 259 | names do not start with a letter or digit are excluded. Subdirectories | 259 | names do not start with a letter or digit are excluded. Subdirectories |
| 260 | named @file{RCS} are excluded. Also, a subdirectory which contains a | 260 | named @file{RCS} or @file{CVS} are excluded. Also, a subdirectory which |
| 261 | file named @file{.nosearch} is excluded. You can use these methods to | 261 | contains a file named @file{.nosearch} is excluded. You can use these |
| 262 | prevent certain subdirectories of the @file{site-lisp} directories from | 262 | methods to prevent certain subdirectories of the @file{site-lisp} |
| 263 | being searched. | 263 | directories 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 |
| 266 | executable that has not been formally installed---then @code{load-path} | 266 | executable 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} |
| 291 | characters, these can be represented within Emacs either as unibyte | 291 | characters, these can be represented within Emacs either as unibyte |
| 292 | strings or as multibyte strings (@pxref{Text Representations}). Which | 292 | strings or as multibyte strings (@pxref{Text Representations}). Which |
| 293 | representation is used depends on how the file is read into Emacs. If | 293 | representation 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 |
| 302 | into the multibyte representation when loading Lisp files, even if it | 302 | into the multibyte representation when loading Lisp files, even if it |
| 303 | was started with the @samp{--unibyte} option. This means that string | 303 | was started with the @samp{--unibyte} option. This means that string |
| 304 | constants with non-@sc{ASCII} characters translate into multibyte | 304 | constants with non-@sc{ascii} characters translate into multibyte |
| 305 | strings. The only exception is when a particular file specifies no | 305 | strings. The only exception is when a particular file specifies no |
| 306 | decoding. | 306 | decoding. |
| 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 |
| 314 | appropriately. | 314 | appropriately. |
| 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 |
| 317 | multibyte strings should not be noticeable, since inserting them in | 317 | multibyte strings should not be noticeable, since inserting them in |
| 318 | unibyte buffers converts them to unibyte automatically. However, if | 318 | unibyte buffers converts them to unibyte automatically. However, if |
| 319 | this does make a difference, you can force a particular Lisp file to be | 319 | this does make a difference, you can force a particular Lisp file to be |
| 320 | interpreted as unibyte by writing @samp{-*-unibyte: t;-*-} in a | 320 | interpreted as unibyte by writing @samp{-*-unibyte: t;-*-} in a |
| 321 | comment on the file's first line. With that designator, the file will | 321 | comment on the file's first line. With that designator, the file will |
| 322 | be unconditionally be interpreted as unibyte, even in an ordinary | 322 | unconditionally be interpreted as unibyte, even in an ordinary |
| 323 | multibyte Emacs session. | 323 | multibyte 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 |
| 435 | function definition, it is copied verbatim. You can also use a magic | 435 | function-defining form or a @code{defcustom} form, it is copied |
| 436 | comment to execute a form at build time @emph{without} executing it when | 436 | verbatim. ``Function-defining forms'' include @code{define-skeleton}, |
| 437 | the file itself is loaded. To do this, write the form @emph{on the same | 437 | @code{define-derived-mode}, @code{define-generic-mode} and |
| 438 | line} 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 |
| 439 | when 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 |
| 440 | copies it to @file{loaddefs.el}, where it is executed while building | 440 | a @code{defvar} in @file{loaddefs.el}, with some additional information |
| 441 | Emacs. | 441 | if 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, | ||
| 445 | write the form @emph{on the same line} as the magic comment. Since it | ||
| 446 | is 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 | ||
| 448 | it 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 |
| 444 | autoloading with a magic comment: | 451 | autoloading with a magic comment: |
| @@ -456,17 +463,17 @@ autoloading with a magic comment: | |||
| 456 | Here's what that produces in @file{loaddefs.el}: | 463 | Here's what that produces in @file{loaddefs.el}: |
| 457 | 464 | ||
| 458 | @smallexample | 465 | @smallexample |
| 459 | (autoload 'doctor "doctor" | 466 | (autoload 'doctor "doctor" "\ |
| 460 | "\ | ||
| 461 | Switch to *doctor* buffer and start giving psychotherapy." | 467 | Switch to *doctor* buffer and start giving psychotherapy." |
| 462 | t) | 468 | t) |
| 463 | @end smallexample | 469 | @end smallexample |
| 464 | 470 | ||
| 465 | @noindent | 471 | @noindent |
| 466 | The backslash and newline immediately following the double-quote are a | 472 | The backslash and newline immediately following the double-quote are a |
| 467 | convention used only in the preloaded Lisp files such as | 473 | convention 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 |
| 469 | documentation string in the @file{etc/DOC} file. @xref{Building Emacs}. | 475 | documentation string in the @file{etc/DOC} file. @xref{Building Emacs}. |
| 476 | See 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 |
| 592 | when you byte-compile that file (@pxref{Byte Compilation}) as well as | 599 | when you byte-compile that file (@pxref{Byte Compilation}) as well as |
| 593 | when you load it. This is in case the required package contains macros | 600 | when you load it. This is in case the required package contains macros |
| 594 | that the byte compiler must know about. | 601 | that the byte compiler must know about. It also avoids byte-compiler |
| 602 | warnings 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 |
| 597 | byte compilation, @code{provide} calls are not. Therefore, you can | 606 | byte 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 | |||
| 701 | definitions, @emph{instead of} the usual hook-removing actions. The | 710 | definitions, @emph{instead of} the usual hook-removing actions. The |
| 702 | unload hook ought to undo all the global state changes made by the | 711 | unload hook ought to undo all the global state changes made by the |
| 703 | library that might cease to work once the library is unloaded. | 712 | library that might cease to work once the library is unloaded. |
| 713 | @code{unload-feature} can cause problems with libraries that fail to do | ||
| 714 | this, so it should be used with caution. | ||
| 704 | 715 | ||
| 705 | Ordinarily, @code{unload-feature} refuses to unload a library on which | 716 | Ordinarily, @code{unload-feature} refuses to unload a library on which |
| 706 | other loaded libraries depend. (A library @var{a} depends on library | 717 | other 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 | |||
| 741 | by adding the symbols defined to the element for the file being visited, | 752 | by adding the symbols defined to the element for the file being visited, |
| 742 | rather than replacing that element. @xref{Eval}. | 753 | rather 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}. |
| 756 | Instead, preloading writes information about preloaded libraries into a | ||
| 757 | file, which can be loaded later on to to add information to | ||
| 758 | @code{load-history} describing the preloaded files. This file is | ||
| 759 | installed 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 | ||
| 764 | code 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 | |||
| 784 | programs meant for wider use. | 804 | programs meant for wider use. |
| 785 | 805 | ||
| 786 | @defvar after-load-alist | 806 | @defvar after-load-alist |
| 787 | An alist of expressions to evaluate if and when particular libraries are | 807 | This variable holds an alist of expressions to evaluate if and when |
| 788 | loaded. Each element looks like this: | 808 | particular 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 |
| 70 | The keymap that displays the Text Properties menu. | 70 | The 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 |
| 74 | The keymap that displays the Background Color submenu of the Text | 74 | The sparse keymap that displays the Background Color submenu of the Text |
| 75 | Properties menu. | 75 | Properties menu. |
| 76 | 76 | ||
| 77 | @item facemenu-face-menu | 77 | @item facemenu-face-menu |
| 78 | @vindex facemenu-face-menu | 78 | @vindex facemenu-face-menu |
| 79 | The keymap that displays the Face submenu of the Text Properties menu. | 79 | The 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 |
| 83 | The keymap that displays the Foreground Color submenu of the Text | 83 | The sparse keymap that displays the Foreground Color submenu of the Text |
| 84 | Properties menu. | 84 | Properties menu. |
| 85 | 85 | ||
| 86 | @item facemenu-indentation-menu | 86 | @item facemenu-indentation-menu |
| 87 | @vindex facemenu-indentation-menu | 87 | @vindex facemenu-indentation-menu |
| 88 | The keymap that displays the Indentation submenu of the Text Properties menu. | 88 | The sparse keymap that displays the Indentation submenu of the Text |
| 89 | Properties menu. | ||
| 89 | 90 | ||
| 90 | @item facemenu-justification-menu | 91 | @item facemenu-justification-menu |
| 91 | @vindex facemenu-justification-menu | 92 | @vindex facemenu-justification-menu |
| 92 | The keymap that displays the Justification submenu of the Text | 93 | The sparse keymap that displays the Justification submenu of the Text |
| 93 | Properties menu. | 94 | Properties menu. |
| 94 | 95 | ||
| 95 | @item facemenu-special-menu | 96 | @item facemenu-special-menu |
| 96 | @vindex facemenu-special-menu | 97 | @vindex facemenu-special-menu |
| 97 | The keymap that displays the Special Props submenu of the Text | 98 | The sparse keymap that displays the Special Props submenu of the Text |
| 98 | Properties menu. | 99 | Properties 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 |
| 107 | The local keymap for Fundamental mode.@* | 108 | The sparse keymap for Fundamental mode.@* |
| 108 | It is empty and should not be changed. | 109 | It 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 |
| 135 | A sparse keymap used by Lisp mode. | 136 | A 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 |
| 174 | A local keymap used by Occur mode. | 175 | A sparse keymap used by Occur mode. |
| 175 | 176 | ||
| 176 | @item query-replace-map | 177 | @item query-replace-map |
| 177 | A local keymap used for responses in @code{query-replace} and related | 178 | A sparse keymap used for responses in @code{query-replace} and related |
| 178 | commands; also for @code{y-or-n-p} and @code{map-y-or-n-p}. The functions | 179 | commands; also for @code{y-or-n-p} and @code{map-y-or-n-p}. The functions |
| 179 | that use this map do not support prefix keys; they look up one event at a | 180 | that use this map do not support prefix keys; they look up one event at a |
| 180 | time. | 181 | time. |
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 |
| 142 | to the present position of point, or to the beginning or end of the | 142 | to 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 | |||
| 42 | no minibuffer window, and sometimes a special kind of frame contains | 42 | no minibuffer window, and sometimes a special kind of frame contains |
| 43 | nothing but a minibuffer window; see @ref{Minibuffers and Frames}.) | 43 | nothing 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}, |
| 46 | temporarily with the window sizing commands; it reverts to its normal | 46 | the text that was specified by the program that is using the minibuffer |
| 47 | size when the minibuffer is exited. You can resize it permanently by | 47 | to tell the user what sort of input to type. This text is marked |
| 48 | using the window sizing commands in the frame's other window, when the | 48 | read-only so you won't accidentally delete or change it. In other |
| 49 | minibuffer is not active. If the frame contains just a minibuffer, you | 49 | respects, it is an ordinary part of the buffer contents, but certain |
| 50 | can change the minibuffer's size by changing the frame's size. | 50 | functions such as @code{erase-buffer}, @code{buffer-string}, |
| 51 | @code{beginning-of-line}, @code{forward-word}, @code{forward-sentence}, | ||
| 52 | and @code{forward-paragraph}, treat it a little bit specially. (In | ||
| 53 | older Emacs versions, the prompt was displayed using a special mechanism | ||
| 54 | and was not part of the buffer contents.) | ||
| 55 | |||
| 56 | @c ??? | ||
| 57 | The minibuffer's window is normally a single line; it grows | ||
| 58 | automatically if necessary if the contents require more space. You can | ||
| 59 | explicitly resize it temporarily with the window sizing commands; it | ||
| 60 | reverts to its normal size when the minibuffer is exited. You can | ||
| 61 | resize it permanently by using the window sizing commands in the frame's | ||
| 62 | other window, when the minibuffer is not active. If the frame contains | ||
| 63 | just a minibuffer, you can change the minibuffer's size by changing the | ||
| 64 | frame'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, |
| 53 | this is called a @dfn{recursive minibuffer}. The first minibuffer is | 67 | this 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 |
| 730 | the minibuffer to do completion. | 744 | the minibuffer to do completion. |
| @@ -1483,9 +1497,16 @@ This function returns the prompt string of the currently active | |||
| 1483 | minibuffer. If no minibuffer is active, it returns @code{nil}. | 1497 | minibuffer. 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 |
| 1487 | This function returns the display width of the prompt string of the | 1501 | @defun minubuffer-prompt-end |
| 1488 | currently active minibuffer. If no minibuffer is active, it returns 0. | 1502 | This function, available starting in Emacs 21, returns the current |
| 1503 | position of the end of the minibuffer prompt, if a minibuffer is | ||
| 1504 | current. Otherwise, it returns zero. | ||
| 1505 | @end defun | ||
| 1506 | |||
| 1507 | @defun minubuffer-prompt-width | ||
| 1508 | This function returns the current display-width of the minibuffer | ||
| 1509 | prompt, 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 |
| 62 | temporarily for a buffer, so it can be edited in a different way (with | 62 | temporarily for a buffer, so it can be edited in a different way (with |
| 63 | ordinary Emacs commands rather than Rmail commands). In such cases, the | 63 | ordinary Emacs commands rather than Rmail commands). In such cases, the |
| 64 | temporary major mode usually has a command to switch back to the | 64 | temporary major mode usually provides a command to switch back to the |
| 65 | buffer's usual mode (Rmail mode, in this case). You might be tempted to | 65 | buffer's usual mode (Rmail mode, in this case). You might be tempted to |
| 66 | present the temporary redefinitions inside a recursive edit and restore | 66 | present the temporary redefinitions inside a recursive edit and restore |
| 67 | the usual ones when the user exits; but this is a bad idea because it | 67 | the 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 | |||
| 70 | alternative major mode avoids this limitation. @xref{Recursive | 70 | alternative major mode avoids this limitation. @xref{Recursive |
| 71 | Editing}. | 71 | Editing}. |
| 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 |
| 74 | several major modes, in files such as @file{text-mode.el}, | 74 | for 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 |
| 77 | written. Text mode is perhaps the simplest major mode aside from | 77 | written. 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 |
| 248 | This tells Emacs that new buffers created while the current buffer has | 248 | This tells Emacs that new buffers created while the current buffer is in |
| 249 | Funny mode should not inherit Funny mode. Modes such as Dired, Rmail, | 249 | Funny mode should not inherit Funny mode. Modes such as Dired, Rmail, |
| 250 | and Buffer List use this feature. | 250 | and 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 |
| 783 | would be unwieldy. | 783 | would 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. |
| 786 | Usually they are general and can apply to many major modes. For | ||
| 786 | example, Auto Fill mode works with any major mode that permits text | 787 | example, Auto Fill mode works with any major mode that permits text |
| 787 | insertion. To be general, a minor mode must be effectively independent | 788 | insertion. To be general, a minor mode must be effectively independent |
| 788 | of the things major modes do. | 789 | of the things major modes do. |
| @@ -825,7 +826,7 @@ mode. We call this the @dfn{mode variable}. The minor mode command | |||
| 825 | should set this variable (@code{nil} to disable; anything else to | 826 | should set this variable (@code{nil} to disable; anything else to |
| 826 | enable). | 827 | enable). |
| 827 | 828 | ||
| 828 | If it is possible, implement the mode so that setting the variable | 829 | If possible, implement the mode so that setting the variable |
| 829 | automatically enables or disables the mode. Then the minor mode command | 830 | automatically enables or disables the mode. Then the minor mode command |
| 830 | does not need to do anything except set the variable. | 831 | does 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 |
| 891 | just once (@pxref{Setting Variables}). | 892 | just once (@pxref{Setting Variables}). |
| 892 | 893 | ||
| 894 | Global minor modes distributed with Emacs should if possible support | ||
| 895 | enabling and disabling via Custom (@pxref{Customization}). To do this, | ||
| 896 | the first step is to define the mode variable with @code{defcustom}, and | ||
| 897 | specify @code{:type boolean}. | ||
| 898 | |||
| 899 | If just setting the variable is not sufficient to enable the mode, you | ||
| 900 | should also specify a @code{:set} method which enables the mode by | ||
| 901 | invoke the mode command. Note in the variable's documentation string that | ||
| 902 | setting the variable other than via Custom may not take effect. | ||
| 903 | |||
| 904 | Also mark the definition with an autoload cookie (@pxref{Autoload}), | ||
| 905 | and specify a @code{:require} so that customizing the variable will load | ||
| 906 | the library that defines the mode. This will copy suitable definitions | ||
| 907 | into @file{loaddefs.el} so that users can use @code{customize-option} to | ||
| 908 | enable the mode. For example: | ||
| 909 | |||
| 910 | @smallexample | ||
| 911 | @group | ||
| 912 | |||
| 913 | ;;;###autoload | ||
| 914 | (defcustom msb-mode nil | ||
| 915 | "Toggle msb-mode. | ||
| 916 | Setting this variable directly does not take effect; | ||
| 917 | use 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 | ||
| 909 | The key sequences bound in a minor mode should consist of @kbd{C-c} | 944 | The key sequences bound in a minor mode should consist of @kbd{C-c} |
| 910 | followed by a punctuation character @emph{other than} @kbd{@{}, | 945 | followed 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 |
| 912 | characters are reserved for major modes.) | 947 | characters 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 |
| 918 | minor mode; with it, you can specify everything about a simple minor | 953 | mode in one self-contained definition. It currently supports only |
| 919 | mode in one self-contained definition. | 954 | buffer-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 |
| 982 | which displays status information about the buffer displayed in the | 1017 | line at the bottom, which displays status information about the buffer |
| 983 | window. The mode line contains information about the buffer, such as its | 1018 | displayed in the window. The mode line contains information about the |
| 984 | name, associated file, depth of recursive editing, and the major and | 1019 | buffer, such as its name, associated file, depth of recursive editing, |
| 985 | minor modes. | 1020 | and major and minor modes. A window can also have a @dfn{header |
| 1021 | line}, which is much like the mode line but appears at the top of the | ||
| 1022 | window (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 |
| 988 | controlled. We include it in this chapter because much of the | 1025 | and header line. We include it in this chapter because much of the |
| 989 | information displayed in the mode line relates to the enabled major and | 1026 | information displayed in the mode line relates to the enabled major and |
| 990 | minor modes. | 1027 | minor 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 |
| 993 | template used to display the mode line of the current buffer. All | 1030 | template used to display the mode line of the current buffer. All |
| 994 | windows for the same buffer use the same @code{mode-line-format} and | 1031 | windows for the same buffer use the same @code{mode-line-format}, so |
| 995 | their mode lines appear the same (except for scrolling percentages, and | 1032 | their mode lines appear the same---except for scrolling percentages, and |
| 996 | line and column numbers). | 1033 | line and column numbers, since those depend on point and on how the |
| 997 | 1034 | window is scrolled. @code{header-line-format} is used likewise for | |
| 998 | The mode line of a window is normally updated whenever a different | 1035 | header lines. |
| 999 | buffer is shown in the window, or when the buffer's modified-status | 1036 | |
| 1000 | changes 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 |
| 1001 | the variables referenced by @code{mode-line-format} (@pxref{Mode Line | 1038 | whenever a different buffer is shown in the window, or when the buffer's |
| 1002 | Variables}), or any other variables and data structures that affect how | 1039 | modified-status changes from @code{nil} to @code{t} or vice-versa. If |
| 1003 | text is displayed (@pxref{Display}), you may want to force an update of | 1040 | you modify any of the variables referenced by @code{mode-line-format} |
| 1004 | the mode line so as to display the new information or display it in | 1041 | (@pxref{Mode Line Variables}), or any other variables and data |
| 1005 | the new way. | 1042 | structures that affect how text is displayed (@pxref{Display}), you may |
| 1043 | want to force an update of the mode line so as to display the new | ||
| 1044 | information 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 |
| 1009 | Force redisplay of the current buffer's mode line. | 1048 | Force 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 | |||
| 1034 | responsibility for the mode line format. The value of this variable | 1075 | responsibility for the mode line format. The value of this variable |
| 1035 | controls which other variables are used to form the mode line text, and | 1076 | controls which other variables are used to form the mode line text, and |
| 1036 | where they appear. | 1077 | where they appear. |
| 1078 | |||
| 1079 | If you set this variable to @code{nil} in a buffer, that buffer does not | ||
| 1080 | have 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 |
| 1051 | value is a list, each element may be a list, a symbol, or a string. | 1095 | value 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 | ||
| 1098 | it have the @code{face} property. @xref{Properties in Mode}. In | ||
| 1099 | addition, the face @code{mode-line} is used as a default for the whole | ||
| 1100 | mode 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} |
| 1062 | A symbol as a mode line construct stands for its value. The value of | 1111 | A 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}. |
| 1064 | However, the symbols @code{t} and @code{nil} are ignored; so is any | 1113 | However, the symbols @code{t} and @code{nil} are ignored, as is any |
| 1065 | symbol whose value is void. | 1114 | symbol whose value is void. |
| 1066 | 1115 | ||
| 1067 | There is one exception: if the value of @var{symbol} is a string, it is | 1116 | There 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 | |||
| 1072 | elements recursively and concatenate the results. This is the most | 1121 | elements recursively and concatenate the results. This is the most |
| 1073 | common form of mode line construct. | 1122 | common form of mode line construct. |
| 1074 | 1123 | ||
| 1124 | @item (:eval @var{form}) | ||
| 1125 | A 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}) |
| 1076 | A list whose first element is a symbol is a conditional. Its meaning | 1130 | A list whose first element is a symbol that is not a keyword specifies a |
| 1077 | depends on the value of @var{symbol}. If the value is non-@code{nil}, | 1131 | conditional. Its meaning depends on the value of @var{symbol}. If the |
| 1078 | the second element, @var{then}, is processed recursively as a mode line | 1132 | value is non-@code{nil}, the second element, @var{then}, is processed |
| 1079 | element. But if the value of @var{symbol} is @code{nil}, the third | 1133 | recursively as a mode line element. But if the value of @var{symbol} is |
| 1080 | element, @var{else}, is processed recursively. You may omit @var{else}; | 1134 | @code{nil}, the third element, @var{else}, is processed recursively. |
| 1081 | then the mode line element displays nothing if the value of @var{symbol} | 1135 | You may omit @var{else}; then the mode line element displays nothing if |
| 1082 | is @code{nil}. | 1136 | the value of @var{symbol} is @code{nil}. |
| 1083 | 1137 | ||
| 1084 | @item (@var{width} @var{rest}@dots{}) | 1138 | @item (@var{width} @var{rest}@dots{}) |
| 1085 | A list whose first element is an integer specifies truncation or | 1139 | A 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. | |||
| 1315 | The current column number of point. | 1369 | The current column number of point. |
| 1316 | 1370 | ||
| 1317 | @item %l | 1371 | @item %l |
| 1318 | The current line number of point. | 1372 | The current line number of point, counting within the accessible portion |
| 1373 | of 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 | ||
| 1445 | mode 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 | ||
| 1450 | line: | ||
| 1451 | |||
| 1452 | @enumerate | ||
| 1453 | @item | ||
| 1454 | Put a string with the @code{local-map} property directly into the | ||
| 1455 | mode-line data structure. | ||
| 1456 | |||
| 1457 | @item | ||
| 1458 | Put a @code{local-map} property on a mode-line %-construct | ||
| 1459 | such as @samp{%12b}; then the expansion of the %-construct | ||
| 1460 | will have that same text property. | ||
| 1461 | |||
| 1462 | @item | ||
| 1463 | Use a list containing @code{:eval @var{form}} in the mode-line data | ||
| 1464 | structure, 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 | ||
| 1469 | keymap, it can bind character keys and function keys; but that has no | ||
| 1470 | effect, since is impossible to move point into the mode line, This | ||
| 1471 | keymap 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 | ||
| 1479 | top, just as it can have a mode line at the bottom. The header line | ||
| 1480 | feature works just like the mode line feature, except that it's | ||
| 1481 | controlled by different variables. | ||
| 1482 | |||
| 1483 | @tindex header-line-format | ||
| 1484 | @defvar header-line-format | ||
| 1485 | This variable, local in every buffer, specifies how to display the | ||
| 1486 | header line, for windows displaying the buffer. The format of the value | ||
| 1487 | is 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 | ||
| 1492 | This variable holds the default @code{header-line-format} for buffers | ||
| 1493 | that do not override it. This is the same as @code{(default-value | ||
| 1494 | 'header-line-format)}. | ||
| 1495 | |||
| 1496 | It 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 |
| 1391 | section in the buffer, from a menu which lists all of them, to go | 1504 | section in the buffer, from a menu which lists all of them, to go |
| 1392 | directly to that location in the buffer. Imenu works by constructing a | 1505 | directly to that location in the buffer. Imenu works by constructing a |
| 1393 | buffer index which lists the names and positions of the definitions or | 1506 | buffer index which lists the names and buffer positions of the |
| 1394 | portions of in the buffer, so the user can pick one of them to move to. | 1507 | definitions, or portions of the buffer, so the user can pick one of them |
| 1395 | This section explains how to customize Imenu for a major mode. | 1508 | to move to. This section explains how to customize Imenu for a major |
| 1509 | mode. | ||
| 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; | |||
| 1413 | in the top level of the buffer index. | 1527 | in the top level of the buffer index. |
| 1414 | 1528 | ||
| 1415 | The second item in the list, @var{regexp}, is a regular expression | 1529 | The 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 |
| 1417 | to mention in the buffer index. The third item, @var{subexp}, indicates | 1531 | considered a definition, to mention in the buffer index. The third |
| 1418 | which subexpression in @var{regexp} matches the definition's name. | 1532 | item, @var{subexp}, indicates which subexpression in @var{regexp} |
| 1533 | matches the definition's name. | ||
| 1419 | 1534 | ||
| 1420 | An element can also look like this: | 1535 | An element can also look like this: |
| 1421 | 1536 | ||
| @@ -1483,7 +1598,7 @@ For example, Fortran mode uses it this way: | |||
| 1483 | 1598 | ||
| 1484 | The @code{imenu-generic-expression} patterns can then use @samp{\\sw+} | 1599 | The @code{imenu-generic-expression} patterns can then use @samp{\\sw+} |
| 1485 | instead of @samp{\\(\\sw\\|\\s_\\)+}. Note that this technique may be | 1600 | instead of @samp{\\(\\sw\\|\\s_\\)+}. Note that this technique may be |
| 1486 | inconvenient to use when the mode needs to limit the initial character | 1601 | inconvenient when the mode needs to limit the initial character |
| 1487 | of a name to a smaller set of characters than are allowed in the rest | 1602 | of a name to a smaller set of characters than are allowed in the rest |
| 1488 | of a name. | 1603 | of a name. |
| 1489 | 1604 | ||
| @@ -1682,7 +1797,7 @@ expression or a function, as described above. The @sc{cdr}, | |||
| 1682 | highlighted (instead of the entire text that @var{matcher} matched). | 1797 | highlighted (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} |
| 12 | characters and how they are stored in strings and buffers. | 12 | characters 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 |
| 42 | therefore the possible character codes range from 0 to 255. Codes 0 | 42 | therefore the possible character codes range from 0 to 255. Codes 0 |
| 43 | through 127 are @sc{ASCII} characters; the codes from 128 through 255 | 43 | through 127 are @sc{ascii} characters; the codes from 128 through 255 |
| 44 | are used for one non-@sc{ASCII} character set (you can choose which | 44 | are used for one non-@sc{ascii} character set (you can choose which |
| 45 | character set by setting the variable @code{nonascii-insert-offset}). | 45 | character 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 | |||
| 132 | acceptable because the buffer's representation is a choice made by the | 132 | acceptable because the buffer's representation is a choice made by the |
| 133 | user that cannot be overridden automatically. | 133 | user 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 |
| 136 | unchanged, and likewise 128 through 159. It converts the non-@sc{ASCII} | 136 | unchanged, and likewise 128 through 159. It converts the non-@sc{ascii} |
| 137 | codes 160 through 255 by adding the value @code{nonascii-insert-offset} | 137 | codes 160 through 255 by adding the value @code{nonascii-insert-offset} |
| 138 | to each character code. By setting this variable, you specify which | 138 | to each character code. By setting this variable, you specify which |
| 139 | character set the unibyte characters correspond to (@pxref{Character | 139 | character set the unibyte characters correspond to (@pxref{Character |
| 140 | Sets}). For example, if @code{nonascii-insert-offset} is 2048, which is | 140 | Sets}). 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 |
| 142 | non-@sc{ASCII} characters correspond to Latin 1. If it is 2688, which | 142 | non-@sc{ascii} characters correspond to Latin 1. If it is 2688, which |
| 143 | is @code{(- (make-char 'greek-iso8859-7) 128)}, then they correspond to | 143 | is @code{(- (make-char 'greek-iso8859-7) 128)}, then they correspond to |
| 144 | Greek letters. | 144 | Greek 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 |
| 147 | logical-and of each character code with 255. If | 147 | the low 8 bits of each character code. If @code{nonascii-insert-offset} |
| 148 | @code{nonascii-insert-offset} has a reasonable value, corresponding to | 148 | has a reasonable value, corresponding to the beginning of some character |
| 149 | the beginning of some character set, this conversion is the inverse of | 149 | set, this conversion is the inverse of the other: converting unibyte |
| 150 | the other: converting unibyte text to multibyte and back to unibyte | 150 | text to multibyte and back to unibyte reproduces the original unibyte |
| 151 | reproduces the original unibyte text. | 151 | text. |
| 152 | 152 | ||
| 153 | @defvar nonascii-insert-offset | 153 | @defvar nonascii-insert-offset |
| 154 | @tindex nonascii-insert-offset | 154 | @tindex nonascii-insert-offset |
| 155 | This variable specifies the amount to add to a non-@sc{ASCII} character | 155 | This variable specifies the amount to add to a non-@sc{ascii} character |
| 156 | when converting unibyte text to multibyte. It also applies when | 156 | when 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 |
| 158 | non-@sc{ASCII} range, 128 through 255. However, the function | 158 | non-@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 | ||
| 161 | The right value to use to select character set @var{cs} is @code{(- | 161 | The 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 | |||
| 245 | codes for multibyte representation range from 0 to 524287, but not all | 245 | codes for multibyte representation range from 0 to 524287, but not all |
| 246 | values in that range are valid. In particular, the values 128 through | 246 | values in that range are valid. In particular, the values 128 through |
| 247 | 255 are not legitimate in multibyte text (though they can occur in ``raw | 247 | 255 are not legitimate in multibyte text (though they can occur in ``raw |
| 248 | bytes''; @pxref{Explicit Encoding}). Only the @sc{ASCII} codes 0 | 248 | bytes''; @pxref{Explicit Encoding}). Only the @sc{ascii} codes 0 |
| 249 | through 127 are fully legitimate in both representations. | 249 | through 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 |
| 284 | Return @code{t} if @var{object} is a character set name symbol, | 284 | Returns @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} | |||
| 296 | belongs to. | 296 | belongs to. |
| 297 | @end defun | 297 | @end defun |
| 298 | 298 | ||
| 299 | @defun charset-plist charset | ||
| 300 | @tindex charset-plist | ||
| 301 | This function returns the charset property list of the character set | ||
| 302 | @var{charset}. Although @var{charset} is a symbol, this is not the same | ||
| 303 | as the property list of that symbol. Charset properties are used for | ||
| 304 | special purposes within Emacs; for example, @code{x-charset-registry} | ||
| 305 | helps 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 |
| 306 | bytes. Each character set has an @dfn{introduction sequence}, which is | 315 | bytes. Each character set has an @dfn{introduction sequence}, which is |
| 307 | normally one or two bytes long. (Exception: the @sc{ASCII} character | 316 | normally one or two bytes long. (Exception: the @sc{ascii} character |
| 308 | set has a zero-length introduction sequence.) The introduction sequence | 317 | set has a zero-length introduction sequence.) The introduction sequence |
| 309 | is the beginning of the byte sequence for any character in the character | 318 | is the beginning of the byte sequence for any character in the character |
| 310 | set. The rest of the character's bytes distinguish it from the other | 319 | set. 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 | ||
| 357 | Unibyte non-@sc{ASCII} characters are considered as part of | 366 | Unibyte non-@sc{ascii} characters are considered as part of |
| 358 | the @code{ascii} character set: | 367 | the @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 |
| 421 | When a unibyte buffer contains non-@sc{ASCII} characters. | 430 | When a unibyte buffer contains non-@sc{ascii} characters. |
| 422 | 431 | ||
| 423 | @item | 432 | @item |
| 424 | When a multibyte buffer contains invalid byte-sequences (raw bytes). | 433 | When a multibyte buffer contains invalid byte-sequences (raw bytes). |
| @@ -445,10 +454,10 @@ for other purposes. Some coding systems specify their own particular | |||
| 445 | translation tables; there are also default translation tables which | 454 | translation tables; there are also default translation tables which |
| 446 | apply to all other coding systems. | 455 | apply to all other coding systems. |
| 447 | 456 | ||
| 448 | @defun make-translation-table translations | 457 | @defun make-translation-table &rest translations |
| 449 | This function returns a translation table based on the arguments | 458 | This 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 | |||
| 495 | character code conversion and end-of-line conversion as specified | 504 | character code conversion and end-of-line conversion as specified |
| 496 | by a particular @dfn{coding system}. | 505 | by 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 |
| 508 | documented 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 |
| 526 | conversion, but some of them leave this unspecified---to be chosen | 536 | conversion, but some of them leave the choice unspecified---to be chosen |
| 527 | heuristically based on the data. | 537 | heuristically 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 |
| 531 | on various systems for representing end of line in files. The Unix | 541 | on various systems for representing end of line in files. The Unix |
| 532 | convention is to use the linefeed character (also called newline). The | 542 | convention is to use the linefeed character (also called newline). The |
| 533 | DOS convention is to use the two character sequence, carriage-return | 543 | DOS convention is to use a carriage-return and a linefeed at the end of |
| 534 | linefeed, at the end of a line. The Mac convention is to use just | 544 | a line. The Mac convention is to use just carriage-return. |
| 535 | carriage-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 |
| 612 | This variable specifies the coding system for saving the buffer---but it | 621 | This variable specifies the coding system for saving the buffer---but it |
| 613 | is not used for @code{write-region}. When saving the buffer asks the | 622 | is not used for @code{write-region}. |
| 614 | user to specify a different coding system, and | 623 | |
| 615 | @code{save-buffer-coding-system} was used, then it is updated to the | 624 | When a command to save the buffer starts out to use |
| 616 | coding system that was specified. | 625 | @code{save-buffer-coding-system}, and that coding system cannot handle |
| 626 | the actual text in the buffer, the command asks the user to choose | ||
| 627 | another coding system. After that happens, the command also updates | ||
| 628 | @code{save-buffer-coding-system} to represent the coding system that the | ||
| 629 | user 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 | |||
| 623 | functions (@pxref{Explicit Encoding}) set it too. | 636 | functions (@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, |
| 626 | it can change whenever Emacs waits; therefore, you should use copy the | 639 | it can change whenever Emacs waits; therefore, you should copy the |
| 627 | value shortly after the function call which stores the value you are | 640 | value shortly after the function call that stores the value you are |
| 628 | interested in. | 641 | interested 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 | |||
| 711 | return value is just one coding system, the one that is highest in | 724 | return value is just one coding system, the one that is highest in |
| 712 | priority. | 725 | priority. |
| 713 | 726 | ||
| 714 | If the region contains only @sc{ASCII} characters, the value | 727 | If the region contains only @sc{ascii} characters, the value |
| 715 | is @code{undecided} or @code{(undecided)}. | 728 | is @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 | |||
| 788 | names that match @var{pattern}. | 801 | names that match @var{pattern}. |
| 789 | 802 | ||
| 790 | The @sc{cdr} of the element, @var{coding}, should be either a coding | 803 | The @sc{cdr} of the element, @var{coding}, should be either a coding |
| 791 | system, a cons cell containing two coding systems, or a function symbol. | 804 | system, a cons cell containing two coding systems, or a function name (a |
| 792 | If @var{val} is a coding system, that coding system is used for both | 805 | symbol with a function definition). If @var{coding} is a coding system, |
| 793 | reading the file and writing it. If @var{val} is a cons cell containing | 806 | that coding system is used for both reading the file and writing it. If |
| 794 | two coding systems, its @sc{car} specifies the coding system for | 807 | @var{coding} is a cons cell containing two coding systems, its @sc{car} |
| 795 | decoding, and its @sc{cdr} specifies the coding system for encoding. | 808 | specifies the coding system for decoding, and its @sc{cdr} specifies the |
| 796 | 809 | coding system for encoding. | |
| 797 | If @var{val} is a function symbol, the function must return a coding | 810 | |
| 811 | If @var{coding} is a function name, the function must return a coding | ||
| 798 | system or a cons cell containing two coding systems. This value is used | 812 | system or a cons cell containing two coding systems. This value is used |
| 799 | as described above. | 813 | as 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 | |||
| 810 | other coding systems later using @code{set-process-coding-system}. | 824 | other 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 |
| 814 | determine the coding system from the data do not work entirely reliably | 828 | determine the coding system from the data, do not work entirely reliably |
| 815 | with asynchronous subprocess output. This is because Emacs handles | 829 | with asynchronous subprocess output. This is because Emacs handles |
| 816 | asynchronous subprocess output in batches, as it arrives. If the coding | 830 | asynchronous subprocess output in batches, as it arrives. If the coding |
| 817 | system leaves the character code conversion unspecified, or leaves the | 831 | system 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 | ||
| 862 | The argument @var{operation} should be an Emacs I/O primitive: | 876 | The 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 |
| 880 | that can do coding system conversion. | ||
| 866 | 881 | ||
| 867 | The remaining arguments should be the same arguments that might be given | 882 | The remaining arguments should be the same arguments that might be given |
| 868 | to that I/O primitive. Depending on which primitive, one of those | 883 | to that I/O primitive. Depending on the primitive, one of those |
| 869 | arguments is selected as the @dfn{target}. For example, if | 884 | arguments 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 |
| 871 | name is the target. For subprocess primitives, the process name is the | 886 | name 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 |
| 1083 | text files or binary files. By ``binary file'' we mean a file of | 1098 | end-of-line conversion for a file by looking at the file's name. This |
| 1084 | literal byte values that are not necessary meant to be characters. | 1099 | feature classifies fils as @dfn{text files} and @dfn{binary files}. By |
| 1085 | Emacs 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 |
| 1086 | for a binary file. Meanwhile, when you create a new file which is | 1101 | necessarily meant to be characters; Emacs does no end-of-line conversion |
| 1087 | marked by its name as a ``text file'', Emacs uses DOS end-of-line | 1102 | and no character code conversion for them. On the other hand, the bytes |
| 1088 | conversion. | 1103 | in a text file are intended to represent characters; when you create a |
| 1104 | new file whose name implies that it is a text file, Emacs uses DOS | ||
| 1105 | end-of-line conversion. | ||
| 1089 | 1106 | ||
| 1090 | @defvar buffer-file-type | 1107 | @defvar buffer-file-type |
| 1091 | This variable, automatically buffer-local in each buffer, records the | 1108 | This variable, automatically buffer-local in each buffer, records the |
| @@ -1108,7 +1125,7 @@ Each element has the form (@var{regexp} . @var{type}), where | |||
| 1108 | compute which. If it is a function, then it is called with a single | 1125 | compute which. If it is a function, then it is called with a single |
| 1109 | argument (the file name) and should return @code{t} or @code{nil}. | 1126 | argument (the file name) and should return @code{t} or @code{nil}. |
| 1110 | 1127 | ||
| 1111 | Emacs when running on MS-DOS or MS-Windows checks this alist to decide | 1128 | When running on MS-DOS or MS-Windows, Emacs checks this alist to decide |
| 1112 | which coding system to use when reading a file. For a text file, | 1129 | which 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} |
| 1114 | is used. | 1131 | is 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} |
| 1135 | characters from the keyboard. Unlike coding systems, which translate | 1152 | characters from the keyboard. Unlike coding systems, which translate |
| 1136 | non-@sc{ASCII} characters to and from encodings meant to be read by | 1153 | non-@sc{ascii} characters to and from encodings meant to be read by |
| 1137 | programs, input methods provide human-friendly commands. (@xref{Input | 1154 | programs, input methods provide human-friendly commands. (@xref{Input |
| 1138 | Methods,,, emacs, The GNU Emacs Manual}, for information on how users | 1155 | Methods,,, emacs, The GNU Emacs Manual}, for information on how users |
| 1139 | use input methods to enter text.) How to define input methods is not | 1156 | use 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 |
| 45 | to | 45 | to |
| 46 | @ifinfo | 46 | @ifinfo |
| 47 | 2**27 - 1), | 47 | 2**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 |
| 52 | but some machines may provide a wider range. Many examples in this | 52 | but some machines may provide a wider range. Many examples in this |
| 53 | chapter assume an integer has 28 bits. | 53 | chapter 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 |
| 314 | This function returns the largest of its arguments. | 314 | This function returns the largest of its arguments. |
| 315 | If any of the argument is floating-point, the value is returned | ||
| 316 | as 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 |
| 327 | This function returns the smallest of its arguments. | 329 | This function returns the smallest of its arguments. |
| 330 | If any of the argument is floating-point, the value is returned | ||
| 331 | as 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 |
| 963 | and | 967 | and |
| 964 | @ifinfo | 968 | @ifinfo |
| 965 | pi/2 | 969 | pi/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} |
| 971 | is out of range (outside [-1, 1]), then the result is a NaN. | 975 | is 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 | |||
| 977 | pi | 981 | pi |
| 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} |
| 983 | is out of range (outside [-1, 1]), then the result is a NaN. | 987 | is 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 |
| 994 | and | 998 | and |
| 995 | @ifinfo | 999 | @ifinfo |
| 996 | pi/2 | 1000 | pi/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 |
| 1005 | This is the exponential function; it returns | 1009 | This 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 |
| 1012 | to the power @var{arg}. | 1016 | to 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. | |||
| 1024 | This function returns the logarithm of @var{arg}, with base @var{base}. | 1028 | This function returns the logarithm of @var{arg}, with base @var{base}. |
| 1025 | If you don't specify @var{base}, the base | 1029 | If 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 |
| 1086 | repeatability is helpful for debugging. | 1090 | repeatability is helpful for debugging. |
| 1087 | 1091 | ||
| 1088 | If you want truly unpredictable random numbers, execute @code{(random | 1092 | If you want random numbers that don't always come out the same, execute |
| 1089 | t)}. 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 |
| 1090 | Emacs's process @sc{id} number. | 1094 | day and on Emacs's process @sc{id} number. |
| 1091 | 1095 | ||
| 1092 | @defun random &optional limit | 1096 | @defun random &optional limit |
| 1093 | This function returns a pseudo-random integer. Repeated calls return a | 1097 | This 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. | |||
| 25 | which all other types are constructed, are called @dfn{primitive | 25 | which all other types are constructed, are called @dfn{primitive |
| 26 | types}. Each object belongs to one and only one primitive type. These | 26 | types}. Each object belongs to one and only one primitive type. These |
| 27 | types include @dfn{integer}, @dfn{float}, @dfn{cons}, @dfn{symbol}, | 27 | types 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 |
| 29 | several special types, such as @dfn{buffer}, that are related to | 29 | several special types, such as @dfn{buffer}, that are related to |
| 30 | editing. (@xref{Editing Types}.) | 30 | editing. (@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 |
| 169 | to | 171 | to |
| 170 | @ifinfo | 172 | @ifinfo |
| 171 | 2**27 - 1) | 173 | 2**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 |
| 176 | on most machines. (Some machines may provide a wider range.) It is | 178 | on most machines. (Some machines may provide a wider range.) It is |
| 177 | important to note that the Emacs Lisp arithmetic functions do not check | 179 | important 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.} |
| 189 | 1 ; @r{The integer 1.} | 191 | 1 ; @r{The integer 1.} |
| 190 | 1. ; @r{Also The integer 1.} | 192 | 1. ; @r{Also the integer 1.} |
| 191 | +1 ; @r{Also the integer 1.} | 193 | +1 ; @r{Also the integer 1.} |
| 192 | 268435457 ; @r{Also the integer 1 on a 28-bit implementation.} | 194 | 268435457 ; @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 |
| 218 | other words, characters are represented by their character codes. For | 220 | other 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 |
| 315 | that exist in @sc{ASCII}; but for keyboard input purposes, you can turn | 318 | that exist in @sc{ascii}; but for keyboard input purposes, you can turn |
| 316 | any character into a control character with @samp{C-}. The character | 319 | any character into a control character with @samp{C-}. The character |
| 317 | codes for these non-@sc{ASCII} control characters include the | 320 | codes 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 |
| 322 | 2**26 | 325 | 2**26 |
| 323 | @end ifinfo | 326 | @end ifinfo |
| 324 | bit as well as the code for the corresponding non-control | 327 | bit as well as the code for the corresponding non-control |
| 325 | character. Ordinary terminals have no way of generating non-@sc{ASCII} | 328 | character. Ordinary terminals have no way of generating non-@sc{ascii} |
| 326 | control characters, but you can generate them straightforwardly using X | 329 | control characters, but you can generate them straightforwardly using X |
| 327 | and other window systems. | 330 | and 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} |
| 350 | modifier key. The integer that represents such a character has the | 353 | modifier 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 |
| 355 | 2**27 | 358 | 2**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 |
| 366 | 2**7 | 369 | 2**7 |
| 367 | @end ifinfo | 370 | @end ifinfo |
| 368 | bit attached to an ASCII character indicates a meta character; thus, the | 371 | bit attached to an ASCII character indicates a meta character; thus, the |
| 369 | meta characters that can fit in a string have codes in the range from | 372 | meta characters that can fit in a string have codes in the range from |
| 370 | 128 to 255, and are the meta versions of the ordinary @sc{ASCII} | 373 | 128 to 255, and are the meta versions of the ordinary @sc{ascii} |
| 371 | characters. (In Emacs versions 18 and older, this convention was used | 374 | characters. (In Emacs versions 18 and older, this convention was used |
| 372 | for characters outside of strings as well.) | 375 | for 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; |
| 382 | for example, @sc{ASCII} distinguishes between the characters @samp{a} | 385 | for example, @sc{ascii} distinguishes between the characters @samp{a} |
| 383 | and @samp{A}. But @sc{ASCII} has no way to represent whether a control | 386 | and @samp{A}. But @sc{ascii} has no way to represent whether a control |
| 384 | character is upper case or lower case. Emacs uses the | 387 | character 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 |
| 389 | 2**25 | 392 | 2**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 |
| 407 | Numerically, the | 410 | Numerically, the |
| 408 | bit values are $2^{22}$ for alt, $2^{23}$ for super and $2^{24}$ for hyper. | 411 | bit 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 |
| 411 | Numerically, the | 414 | Numerically, the |
| @@ -420,9 +423,9 @@ character code in either octal or hex. To use octal, write a question | |||
| 420 | mark followed by a backslash and the octal character code (up to three | 423 | mark followed by a backslash and the octal character code (up to three |
| 421 | octal digits); thus, @samp{?\101} for the character @kbd{A}, | 424 | octal 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 |
| 423 | character @kbd{C-b}. Although this syntax can represent any @sc{ASCII} | 426 | character @kbd{C-b}. Although this syntax can represent any @sc{ascii} |
| 424 | character, it is preferred only when the precise octal value is more | 427 | character, it is preferred only when the precise octal value is more |
| 425 | important than the @sc{ASCII} representation. | 428 | important 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 | ||
| 528 | Symbols}). To prevent interning, you can write @samp{#:} before the | ||
| 529 | name 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 |
| 563 | this cons cell is'' whatever object its @sc{car} slot currently holds, | 571 | this cons cell is'' whatever object its @sc{car} slot currently holds, |
| 564 | and likewise for the @sc{cdr}. | 572 | and 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 | |||
| 794 | first element, @code{rose} is the key and @code{red} is the value. | 802 | first 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 |
| 797 | functions that work on alists. | 805 | functions that work on alists. @xref{Hash Tables}, for another kind of |
| 806 | lookup 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 |
| 888 | constant by writing it literally. There are two text representations | 897 | constant by writing it literally. There are two text representations |
| 889 | for non-@sc{ASCII} characters in Emacs strings (and in buffers): unibyte | 898 | for non-@sc{ascii} characters in Emacs strings (and in buffers): unibyte |
| 890 | and multibyte. If the string constant is read from a multibyte source, | 899 | and multibyte. If the string constant is read from a multibyte source, |
| 891 | such as a multibyte buffer or string, or a file that would be visited as | 900 | such as a multibyte buffer or string, or a file that would be visited as |
| 892 | multibyte, then the character is read as a multibyte character, and that | 901 | multibyte, 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 | |||
| 895 | string unibyte. | 904 | string 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 |
| 898 | character code, using a hex escape, @samp{\x@var{nnnnnnn}}, with as many | 907 | character code: use a hex escape, @samp{\x@var{nnnnnnn}}, with as many |
| 899 | digits as necessary. (Multibyte non-@sc{ASCII} character codes are all | 908 | digits as necessary. (Multibyte non-@sc{ASCII} character codes are all |
| 900 | greater than 256.) Any character which is not a valid hex digit | 909 | greater than 256.) Any character which is not a valid hex digit |
| 901 | terminates this construct. If the next character in the string could be | 910 | terminates 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 | |||
| 906 | character to the string, but it does terminate the preceding hex escape. | 915 | character 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 |
| 909 | represent a unibyte non-@sc{ASCII} character with its character code, | 918 | represent a unibyte non-@sc{ascii} character with its character code, |
| 910 | which must be in the range from 128 (0200 octal) to 255 (0377 octal). | 919 | which must be in the range from 128 (0200 octal) to 255 (0377 octal). |
| 911 | This forces a unibyte string. | 920 | This 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 |
| 927 | escape-sequences are valid in strings. The only control characters that | 936 | escape-sequences are valid in strings. The only control characters that |
| 928 | a string can hold are the @sc{ASCII} control characters. Strings do not | 937 | a string can hold are the @sc{ascii} control characters. Strings do not |
| 929 | distinguish case in @sc{ASCII} control characters. | 938 | distinguish 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 |
| 932 | string is to be used as a key sequence, there is a special convention | 941 | string is to be used as a key sequence, there is a special convention |
| 933 | that provides a way to represent meta versions of @sc{ASCII} characters in a | 942 | that provides a way to represent meta versions of @sc{ascii} characters in a |
| 934 | string. If you use the @samp{\M-} syntax to indicate a meta character | 943 | string. If you use the @samp{\M-} syntax to indicate a meta character |
| 935 | in a string constant, this sets the | 944 | in 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 |
| 940 | 2**7 | 949 | 2**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 |
| 1044 | must be @code{t} or @code{nil}. | 1053 | must 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 |
| 1047 | that it begins with @samp{#&} followed by the length. The string | 1056 | that it begins with @samp{#&} followed by the length. The string |
| 1048 | constant that follows actually specifies the contents of the bool-vector | 1057 | constant that follows actually specifies the contents of the bool-vector |
| 1049 | as a bitmap---each ``character'' in the string contains 8 bits, which | 1058 | as 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 | ||
| 1079 | alist in that it maps keys to corresponding values, but much faster. | ||
| 1080 | Hash tables are a new feature in Emacs 21; they have no read syntax, and | ||
| 1081 | print 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, |
| 1160 | a placeholder for the real definition; it says that the real definition | 1182 | where it serves as a placeholder for the real definition. The autoload |
| 1161 | is found in a file of Lisp code that should be loaded when necessary. | 1183 | object says that the real definition is found in a file of Lisp code |
| 1162 | The autoload object contains the name of the file, plus some other | 1184 | that should be loaded when necessary. It contains the name of the file, |
| 1163 | information about the real definition. | 1185 | plus 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 |
| 1166 | definition that is not an autoload object. The new definition is then | 1188 | definition 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 |
| 1208 | used like strings in Emacs Lisp, and the available operations are | 1230 | used like strings in Emacs Lisp, and the available operations are |
| 1209 | different. For example, you can insert text efficiently into an | 1231 | different. For example, you can insert text efficiently into an |
| 1210 | existing buffer, whereas ``inserting'' text into a string requires | 1232 | existing buffer, altering the buffer's contents, whereas ``inserting'' |
| 1211 | concatenating substrings, and the result is an entirely new string | 1233 | text into a string requires concatenating substrings, and the result is |
| 1212 | object. | 1234 | an 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 | ||
| 1464 | complex 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; | ||
| 1468 | subsequently, you can use @code{#@var{n}#} to refer the same object in | ||
| 1469 | another place. Here, @var{n} is some integer. For example, here is how | ||
| 1470 | to 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 | ||
| 1477 | This differs from ordinary syntax such as this | ||
| 1478 | |||
| 1479 | @example | ||
| 1480 | ((a) b (a)) | ||
| 1481 | @end example | ||
| 1482 | |||
| 1483 | @noindent | ||
| 1484 | which would result in a list whose first and third elements | ||
| 1485 | look 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 | ||
| 1498 | appears as an ``element'' within itself. Here is an example: | ||
| 1499 | |||
| 1500 | @example | ||
| 1501 | #1=(a #1#) | ||
| 1502 | @end example | ||
| 1503 | |||
| 1504 | @noindent | ||
| 1505 | This makes a list whose second element is the list itself. | ||
| 1506 | Here'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 | ||
| 1516 | structure in a Lisp object, if you bind the variable @code{print-circle} | ||
| 1517 | to 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 | |||
| 1764 | Comparison of strings is case-sensitive, but does not take account of | 1849 | Comparison of strings is case-sensitive, but does not take account of |
| 1765 | text properties---it compares only the characters in the strings. | 1850 | text properties---it compares only the characters in the strings. |
| 1766 | A unibyte string never equals a multibyte string unless the | 1851 | A unibyte string never equals a multibyte string unless the |
| 1767 | contents are entirely @sc{ASCII} (@pxref{Text Representations}). | 1852 | contents 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. | |||
| 15 | pertaining to the terminal and the screen. | 15 | pertaining 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. | |||
| 37 | can customize these actions. | 38 | can 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 |
| 87 | It loads the file @file{~/.emacs}, unless @samp{-q} or @samp{-batch} was | 88 | It loads the file @file{~/.emacs}, unless @samp{-q} or @samp{-batch} was |
| 88 | specified on the command line. The @samp{-u} option can specify another | 89 | specified on the command line. The @samp{-u} option can specify another |
| 89 | user name whose home directory should be used instead of @file{~}. | 90 | user whose home directory should be used instead of @file{~}. |
| 90 | 91 | ||
| 91 | @item | 92 | @item |
| 92 | It loads the library @file{default}, unless @code{inhibit-default-init} | 93 | It 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 |
| 129 | It displays copyleft, nonwarranty, and basic use information, provided | 130 | It displays copyleft, nonwarranty, and basic use information, provided |
| 130 | there were no remaining command line arguments (a few steps above), | 131 | there were no remaining command-line arguments (a few steps above), |
| 131 | the value of @code{inhibit-startup-message} is @code{nil}, and the | 132 | the value of @code{inhibit-startup-message} is @code{nil}, and the |
| 132 | buffer is still empty. | 133 | buffer 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 |
| 174 | contain 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 |
| 175 | switches @samp{-q} and @samp{-u} affect the use of the init file; | 176 | command-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 | 177 | file; @samp{-q} says not to load an init file, and @samp{-u} says to |
| 177 | specified user's init file instead of yours. @xref{Entering Emacs,,, | 178 | load a specified user's init file instead of yours. @xref{Entering |
| 178 | emacs, The GNU Emacs Manual}. | 179 | Emacs,,, 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 |
| 203 | should move it into another file named @file{@var{something}.el}, | 204 | can make it load faster by renaming it to @file{.emacs.el} |
| 204 | byte-compile it (@pxref{Byte Compilation}), and make your @file{.emacs} | 205 | and then byte-compiling it (@pxref{Byte Compilation}). |
| 205 | file 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 |
| 208 | examples of how to make various commonly desired customizations in your | 208 | examples 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 |
| 235 | run on that type of terminal. The library's name is constructed by | 235 | run on that type of terminal. The library's name is constructed by |
| 236 | concatenating the value of the variable @code{term-file-prefix} and the | 236 | concatenating the value of the variable @code{term-file-prefix} and the |
| 237 | terminal type. Normally, @code{term-file-prefix} has the value | 237 | terminal type (specified by the environment variable @code{TERM}). |
| 238 | Normally, @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 |
| 239 | in the normal manner, by searching the @code{load-path} directories, and | 240 | in the normal manner, by searching the @code{load-path} directories, and |
| 240 | trying the @samp{.elc} and @samp{.el} suffixes. | 241 | trying 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 |
| 280 | terminal-initialization file. To do this, put the following in | 281 | terminal-initialization file. To do this, put the following in |
| 281 | your @file{.emacs} file: @code{(setq term-file-prefix nil)}. | 282 | your @file{.emacs} file: @code{(setq term-file-prefix nil)}. |
| 283 | |||
| 284 | On MS-DOS, if the environment variable @code{TERM} is not set, Emacs | ||
| 285 | uses @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 |
| 294 | feature. | 298 | feature. |
| 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 |
| 301 | start Emacs. Since you do not need to start Emacs more than once per | 305 | start Emacs. Since you do not need to start Emacs more than once per |
| 302 | day, and will often leave your Emacs session running longer than that, | 306 | day, and will often leave your Emacs session running longer than that, |
| 303 | command line arguments are hardly ever used. As a practical matter, it | 307 | command-line arguments are hardly ever used. As a practical matter, it |
| 304 | is best to avoid making the habit of using them, since this habit would | 308 | is best to avoid making the habit of using them, since this habit would |
| 305 | encourage you to kill and restart Emacs unnecessarily often. These | 309 | encourage you to kill and restart Emacs unnecessarily often. These |
| 306 | options exist for two reasons: to be compatible with other editors (for | 310 | options exist for two reasons: to be compatible with other editors (for |
| 307 | invocation by other programs) and to enable shell scripts to run | 311 | invocation by other programs) and to enable shell scripts to run |
| 308 | specific Lisp programs. | 312 | specific Lisp programs. |
| 309 | 313 | ||
| 310 | This section describes how Emacs processes command line arguments, | 314 | This section describes how Emacs processes command-line arguments, |
| 311 | and how you can customize them. | 315 | and 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 |
| 315 | you want to edit a file. With this kind of editor, you will probably | 319 | you want to edit a file. With this kind of editor, you will probably |
| 316 | specify the file as a command line argument. The recommended way to | 320 | specify the file as a command-line argument. The recommended way to |
| 317 | use GNU Emacs is to start it only once, just after you log in, and do | 321 | use GNU Emacs is to start it only once, just after you log in, and do |
| 318 | all your editing in the same Emacs process. Each time you want to edit | 322 | all your editing in the same Emacs process. Each time you want to edit |
| 319 | a different file, you visit it with the existing Emacs, which eventually | 323 | a different file, you visit it with the existing Emacs, which eventually |
| @@ -333,19 +337,19 @@ processed. | |||
| 333 | 337 | ||
| 334 | If you redump Emacs by calling @code{dump-emacs}, you may wish to set | 338 | If you redump Emacs by calling @code{dump-emacs}, you may wish to set |
| 335 | this variable to @code{nil} first in order to cause the new dumped Emacs | 339 | this variable to @code{nil} first in order to cause the new dumped Emacs |
| 336 | to process its new command line arguments. | 340 | to 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 |
| 343 | The value of this variable is an alist of user-defined command-line | 347 | The value of this variable is an alist of user-defined command-line |
| 344 | options and associated handler functions. This variable exists so you | 348 | options and associated handler functions. This variable exists so you |
| 345 | can add elements to it. | 349 | can add elements to it. |
| 346 | 350 | ||
| 347 | A @dfn{command line option} is an argument on the command line of the | 351 | A @dfn{command-line option} is an argument on the command line, which |
| 348 | form: | 352 | has 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 | ||
| 360 | The @var{handler-function} is called to handle @var{option} and receives | 364 | The @sc{car}, @var{option}, is a string, the name of a command-line |
| 361 | the option name as its sole argument. | 365 | option (not including the initial hyphen). The @var{handler-function} |
| 366 | is called to handle @var{option}, and receives the option name as its | ||
| 367 | sole argument. | ||
| 362 | 368 | ||
| 363 | In some cases, the option is followed in the command line by an | 369 | In some cases, the option is followed in the command line by an |
| 364 | argument. In these cases, the @var{handler-function} can find all the | 370 | argument. 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 |
| 367 | arguments is in @code{command-line-args}.) | 373 | arguments is in @code{command-line-args}.) |
| 368 | 374 | ||
| 369 | The command line arguments are parsed by the @code{command-line-1} | 375 | The command-line arguments are parsed by the @code{command-line-1} |
| 370 | function in the @file{startup.el} file. See also @ref{Command | 376 | function in the @file{startup.el} file. See also @ref{Command |
| 371 | Switches, , Command Line Switches and Arguments, emacs, The GNU Emacs | 377 | Switches, , Command Line Switches and Arguments, emacs, The GNU Emacs |
| 372 | Manual}. | 378 | Manual}. |
| 373 | @end defvar | 379 | @end defvar |
| 374 | 380 | ||
| 375 | @defvar command-line-args | 381 | @defvar command-line-args |
| 376 | The value of this variable is the list of command line arguments passed | 382 | The value of this variable is the list of command-line arguments passed |
| 377 | to Emacs. | 383 | to 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 |
| 439 | been saved, is lost when the Emacs is killed. Because killing Emacs | 445 | been saved, is lost when the Emacs process is killed. Because killing |
| 440 | inadvertently can lose a lot of work, Emacs queries for confirmation | 446 | Emacs inadvertently can lose a lot of work, Emacs queries for |
| 441 | before actually terminating if you have buffers that need saving or | 447 | confirmation before actually terminating if you have buffers that need |
| 442 | subprocesses that are running. This is done in the function | 448 | saving 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. | |||
| 475 | may not have a parent that can resume it again, and in any case you can | 481 | may not have a parent that can resume it again, and in any case you can |
| 476 | give input to some other job such as a shell merely by moving to a | 482 | give input to some other job such as a shell merely by moving to a |
| 477 | different window. Therefore, suspending is not allowed when Emacs is using | 483 | different window. Therefore, suspending is not allowed when Emacs is using |
| 478 | a window system. | 484 | a window system (X Windows or MS Windows). |
| 479 | 485 | ||
| 480 | @defun suspend-emacs string | 486 | @defun suspend-emacs string |
| 481 | This function stops Emacs and returns control to the superior process. | 487 | This 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 |
| 548 | This variable is a normal hook run before suspending. | 554 | This 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 |
| 552 | This variable is a normal hook run after suspending. | 558 | This variable is a normal hook that Emacs runs on resuming |
| 559 | after 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. | |||
| 598 | Silicon Graphics Irix system. | 605 | Silicon Graphics Irix system. |
| 599 | 606 | ||
| 600 | @item ms-dos | 607 | @item ms-dos |
| 601 | Microsoft MS-DOS ``operating system.'' | 608 | Microsoft MS-DOS ``operating system.'' Emacs compiled with DJGPP for |
| 609 | MS-DOS binds @code{system-type} to @code{ms-dos} even when you run it on | ||
| 610 | MS-Windows. | ||
| 602 | 611 | ||
| 603 | @item next-mach | 612 | @item next-mach |
| 604 | NeXT Mach-based system. | 613 | NeXT Mach-based system. |
| @@ -616,7 +625,8 @@ AT&T System V. | |||
| 616 | VAX VMS. | 625 | VAX VMS. |
| 617 | 626 | ||
| 618 | @item windows-nt | 627 | @item windows-nt |
| 619 | Microsoft windows NT. | 628 | Microsoft windows NT. The same executable supports Windows 9X, but the |
| 629 | value of @code{system-type} is @code{windows-nt} in either case. | ||
| 620 | 630 | ||
| 621 | @item xenix | 631 | @item xenix |
| 622 | SCO Xenix 386. | 632 | SCO Xenix 386. |
| @@ -710,7 +720,7 @@ process-environment | |||
| 710 | This variable holds a string which says which character separates | 720 | This variable holds a string which says which character separates |
| 711 | directories in a search path (as found in an environment variable). Its | 721 | directories in a search path (as found in an environment variable). Its |
| 712 | value is @code{":"} for Unix and GNU systems, and @code{";"} for MS-DOS | 722 | value is @code{":"} for Unix and GNU systems, and @code{";"} for MS-DOS |
| 713 | and Windows NT. | 723 | and 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 |
| 772 | This function sets or resets a VMS privilege. (It does not exist on | 782 | This function sets or resets a VMS privilege. (It does not exist on |
| 773 | Unix.) The first arg is the privilege name, as a string. The second | 783 | other systems.) The first argument is the privilege name, as a string. |
| 774 | argument, @var{setp}, is @code{t} or @code{nil}, indicating whether the | 784 | The second argument, @var{setp}, is @code{t} or @code{nil}, indicating |
| 775 | privilege is to be turned on or off. Its default is @code{nil}. The | 785 | whether the privilege is to be turned on or off. Its default is |
| 776 | function returns @code{t} if successful, @code{nil} otherwise. | 786 | @code{nil}. The function returns @code{t} if successful, @code{nil} |
| 787 | otherwise. | ||
| 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} |
| 779 | does not change the privilege, but returns @code{t} or @code{nil} | 790 | does 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 |
| 787 | This variable says which user's init files should be used by Emacs---or | 798 | This 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 | ||
| 791 | Lisp packages that load files of customizations, or any other sort of | 802 | Lisp 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 |
| 832 | This function returns the full name of the logged-in user---or the value | 843 | This function returns the full name of the logged-in user---or the value |
| 833 | of the environment variables @code{NAME}, if that is set. | 844 | of 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 | |||
| 907 | This function returns the system's time value as a list of three | 919 | This function returns the system's time value as a list of three |
| 908 | integers: @code{(@var{high} @var{low} @var{microsec})}. The integers | 920 | integers: @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 |
| 910 | 0:00 January 1, 1970, which is | 922 | 0: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 | ||
| 918 | The third element, @var{microsec}, gives the microseconds since the | 930 | The third element, @var{microsec}, gives the microseconds since the |
| 919 | start of the current second (or 0 for systems that return time only on | 931 | start of the current second (or 0 for systems that return time with |
| 920 | the resolution of a second). | 932 | the resolution of only one second). |
| 921 | 933 | ||
| 922 | The first two elements can be compared with file time values such as you | 934 | The first two elements can be compared with file time values such as you |
| 923 | get with the function @code{file-attributes}. @xref{File Attributes}. | 935 | get with the function @code{file-attributes}. @xref{File Attributes}. |
| @@ -931,7 +943,7 @@ in. | |||
| 931 | The value has the form @code{(@var{offset} @var{name})}. Here | 943 | The 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 |
| 934 | second element, @var{name} is a string giving the name of the time | 946 | second element, @var{name}, is a string giving the name of the time |
| 935 | zone. Both elements change when daylight savings time begins or ends; | 947 | zone. Both elements change when daylight savings time begins or ends; |
| 936 | if the user has specified a time zone that does not use a seasonal time | 948 | if the user has specified a time zone that does not use a seasonal time |
| 937 | adjustment, then the value is constant through time. | 949 | adjustment, then the value is constant through time. |
| @@ -998,7 +1010,7 @@ This is a synonym for @samp{%b}. | |||
| 998 | @item %H | 1010 | @item %H |
| 999 | This stands for the hour (00-23). | 1011 | This stands for the hour (00-23). |
| 1000 | @item %I | 1012 | @item %I |
| 1001 | This stands for the hour (00-12). | 1013 | This stands for the hour (01-12). |
| 1002 | @item %j | 1014 | @item %j |
| 1003 | This stands for the day of the year (001-366). | 1015 | This 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 |
| 1019 | This is a synonym for @samp{%H:%M}. | 1031 | This is a synonym for @samp{%H:%M}. |
| 1020 | @item %S | 1032 | @item %S |
| 1021 | This stands for the seconds (00-60). | 1033 | This stands for the seconds (00-59). |
| 1022 | @item %t | 1034 | @item %t |
| 1023 | This stands for a tab character. | 1035 | This 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: | |||
| 1068 | Here is what the elements mean: | 1080 | Here is what the elements mean: |
| 1069 | 1081 | ||
| 1070 | @table @var | 1082 | @table @var |
| 1071 | @item sec | 1083 | @item seconds |
| 1072 | The number of seconds past the minute, as an integer between 0 and 59. | 1084 | The number of seconds past the minute, as an integer between 0 and 59. |
| 1073 | @item minute | 1085 | @item minutes |
| 1074 | The number of minutes past the hour, as an integer between 0 and 59. | 1086 | The number of minutes past the hour, as an integer between 0 and 59. |
| 1075 | @item hour | 1087 | @item hour |
| 1076 | The hour of the day, as an integer between 0 and 23. | 1088 | The 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 | |||
| 1099 | items of calendrical data into a time value. For the meanings of the | 1111 | items of calendrical data into a time value. For the meanings of the |
| 1100 | arguments, see the table above under @code{decode-time}. | 1112 | arguments, see the table above under @code{decode-time}. |
| 1101 | 1113 | ||
| 1102 | Year numbers less than 100 are treated just like other year numbers. If | 1114 | Year numbers less than 100 are not treated specially. If you want them |
| 1103 | you want them to stand for years above 1900, you must alter them yourself | 1115 | to stand for years above 1900, you must alter them yourself before you |
| 1104 | before you call @code{encode-time}. | 1116 | call @code{encode-time}. |
| 1105 | 1117 | ||
| 1106 | The optional argument @var{zone} defaults to the current time zone and | 1118 | The optional argument @var{zone} defaults to the current time zone and |
| 1107 | its daylight savings time rules. If specified, it can be either a list | 1119 | its 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 | ||
| 1123 | You can perform simple date arithmetic by using out-of-range values for | 1135 | You can perform simple date arithmetic by using out-of-range values for |
| 1124 | the @var{sec}, @var{minute}, @var{hour}, @var{day}, and @var{month} | 1136 | the @var{seconds}, @var{minutes}, @var{hour}, @var{day}, and @var{month} |
| 1125 | arguments; for example, day 0 means the day preceding the given month. | 1137 | arguments; for example, day 0 means the day preceding the given month. |
| 1126 | 1138 | ||
| 1127 | The operating system puts limits on the range of possible time values; | 1139 | The operating system puts limits on the range of possible time values; |
| @@ -1175,6 +1187,9 @@ denotes 65 seconds from now. | |||
| 1175 | denotes exactly 103 months, 123 days, and 10862 seconds from now. | 1187 | denotes exactly 103 months, 123 days, and 10862 seconds from now. |
| 1176 | @end table | 1188 | @end table |
| 1177 | 1189 | ||
| 1190 | For relative time values, Emacs considers a month to be exactly thirty | ||
| 1191 | days, and a year to be exactly 365.25 days. | ||
| 1192 | |||
| 1178 | If @var{time} is a number (integer or floating point), that specifies a | 1193 | If @var{time} is a number (integer or floating point), that specifies a |
| 1179 | relative time measured in seconds. | 1194 | relative 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 |
| 1237 | remains idle until the user provides some input. If a timer is set for | 1252 | remains idle until the user provides some input. If a timer is set for |
| 1238 | five seconds of idleness, it runs approximately five seconds after Emacs | 1253 | five seconds of idleness, it runs approximately five seconds after Emacs |
| 1239 | first became idle. Even if its @var{repeat} is true, this timer will | 1254 | first becomes idle. Even if @var{repeat} is non-@code{nil}, this timer |
| 1240 | not run again as long as Emacs remains idle, because the duration of | 1255 | will not run again as long as Emacs remains idle, because the duration |
| 1241 | idleness will continue to increase and will not go down to five seconds | 1256 | of idleness will continue to increase and will not go down to five |
| 1242 | again. | 1257 | seconds 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 |
| 1245 | handle data from a subprocess. But these interludes during idleness do | 1260 | handle 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 | |||
| 1247 | idleness to zero. An idle timer set for 600 seconds will run when ten | 1262 | idleness to zero. An idle timer set for 600 seconds will run when ten |
| 1248 | minutes have elapsed since the last user command was finished, even if | 1263 | minutes have elapsed since the last user command was finished, even if |
| 1249 | subprocess output has been accepted thousands of times within those ten | 1264 | subprocess output has been accepted thousands of times within those ten |
| 1250 | minutes, even if there have been garbage collections and autosaves. | 1265 | minutes, 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 |
| 1253 | input. Then it becomes idle again, and all the idle timers that are | 1268 | input. Then it becomes idle again, and all the idle timers that are |
| @@ -1284,7 +1299,7 @@ functions. | |||
| 1284 | This function sets the mode for reading keyboard input. If | 1299 | This 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 |
| 1287 | system dependent. Some systems always use @sc{cbreak} mode regardless | 1302 | system-dependent. Some systems always use @sc{cbreak} mode regardless |
| 1288 | of what is specified. | 1303 | of what is specified. |
| 1289 | 1304 | ||
| 1290 | When Emacs communicates directly with X, it ignores this argument and | 1305 | When 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 |
| 1317 | This function returns current mode for reading keyboard input. It | 1332 | This function returns the current mode for reading keyboard input. It |
| 1318 | returns a list, corresponding to the arguments of @code{set-input-mode}, | 1333 | returns a list, corresponding to the arguments of @code{set-input-mode}, |
| 1319 | of the form @code{(@var{interrupt} @var{flow} @var{meta} @var{quit})} in | 1334 | of the form @code{(@var{interrupt} @var{flow} @var{meta} @var{quit})} in |
| 1320 | which: | 1335 | which: |
| @@ -1379,10 +1394,10 @@ This variable is the translate table for keyboard characters. It lets | |||
| 1379 | you reshuffle the keys on the keyboard without changing any command | 1394 | you reshuffle the keys on the keyboard without changing any command |
| 1380 | bindings. Its value is normally a char-table, or else @code{nil}. | 1395 | bindings. Its value is normally a char-table, or else @code{nil}. |
| 1381 | 1396 | ||
| 1382 | If @code{keyboard-translate-table} is a char-table, then each character | 1397 | If @code{keyboard-translate-table} is a char-table |
| 1383 | read from the keyboard is looked up in this character. If the value | 1398 | (@pxref{Char-Tables}), then each character read from the keyboard is |
| 1384 | found there is non-@code{nil}, then it is used instead of the | 1399 | looked up in this char-table. If the value found there is |
| 1385 | actual input character. | 1400 | non-@code{nil}, then it is used instead of the actual input character. |
| 1386 | 1401 | ||
| 1387 | In the example below, we set @code{keyboard-translate-table} to a | 1402 | In the example below, we set @code{keyboard-translate-table} to a |
| 1388 | char-table. Then we fill it in to swap the characters @kbd{C-s} and | 1403 | char-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 |
| 1577 | track of output sent to the terminal. The variable @code{baud-rate} | 1592 | track of output sent to the terminal. The variable @code{baud-rate} |
| 1578 | tells you what Emacs thinks is the output speed of the terminal. | 1593 | tells 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. | |||
| 1607 | Control characters in @var{string} have terminal-dependent effects. | 1622 | Control characters in @var{string} have terminal-dependent effects. |
| 1608 | 1623 | ||
| 1609 | One use of this function is to define function keys on terminals that | 1624 | One use of this function is to define function keys on terminals that |
| 1610 | have downloadable function key definitions. For example, this is how on | 1625 | have downloadable function key definitions. For example, this is how (on |
| 1611 | certain terminals to define function key 4 to move forward four | 1626 | certain terminals) to define function key 4 to move forward four |
| 1612 | characters (by transmitting the characters @kbd{C-u C-f} to the | 1627 | characters (by transmitting the characters @kbd{C-u C-f} to the |
| 1613 | computer): | 1628 | computer): |
| 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 | ||
| 1664 | certain systems are supported; if you call @code{play-sound} on a system | ||
| 1665 | which cannot really do the job, it gives an error. Emacs version 20 and | ||
| 1666 | earlier did not support sound at all. | ||
| 1667 | |||
| 1668 | The sound must be stored as a file in RIFF-WAVE format (@samp{.wav}) | ||
| 1669 | or Sun Audio format (@samp{.au}). | ||
| 1670 | |||
| 1671 | @tindex play-sound | ||
| 1672 | @defun play-sound sound | ||
| 1673 | This function plays a specified sound. The argument, @var{sound}, has | ||
| 1674 | the form @code{(sound @var{properties}...)}, where the @var{properties} | ||
| 1675 | consist of alternating keywords (particular symbols recognized | ||
| 1676 | specially) and values corresponding to them. | ||
| 1677 | |||
| 1678 | Here 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} | ||
| 1683 | This specifies the file containing the sound to play. | ||
| 1684 | If the file name is not absolute, it is expanded against | ||
| 1685 | the directory @code{data-directory}. | ||
| 1686 | |||
| 1687 | @item :volume @var{volume} | ||
| 1688 | This specifies how loud to play the sound. It should be a number in the | ||
| 1689 | range of 0 to 1. The default is to use whatever volume has been | ||
| 1690 | specified before. | ||
| 1691 | @end table | ||
| 1692 | |||
| 1693 | Before actually playing the sound, @code{play-sound} | ||
| 1694 | calls the functions in the list @code{play-sound-functions}. | ||
| 1695 | Each function is called with one argument, @var{sound}. | ||
| 1696 | @end defun | ||
| 1697 | |||
| 1698 | @tindex play-sound-functions | ||
| 1699 | @defvar play-sound-functions | ||
| 1700 | A list of functions to be called before playing a sound. Each function | ||
| 1701 | is 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 |
| 1651 | This variable's value should be an alist with one element for each | 1711 | This variable's value should be an alist with one element for each |
| 1652 | system-specific keysym. An element has this form: @code{(@var{code} | 1712 | system-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 |
| 1654 | including the ``vendor specific'' bit, | 1714 | including the ``vendor specific'' bit, |
| 1655 | @ifinfo | 1715 | @ifinfo |
| @@ -1660,8 +1720,8 @@ $-2^{28}$), | |||
| 1660 | @end tex | 1720 | @end tex |
| 1661 | and @var{symbol} is the name for the function key. | 1721 | and @var{symbol} is the name for the function key. |
| 1662 | 1722 | ||
| 1663 | For example @code{(168 . mute-acute)} defines a system-specific key used | 1723 | For example @code{(168 . mute-acute)} defines a system-specific key (used |
| 1664 | by HP X servers whose numeric code is | 1724 | by 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 |
| 1696 | was natural and uncontroversial. With so many commands needing key | 1756 | was natural and uncontroversial. With so many commands needing key |
| 1697 | assignments, of course we assigned meanings to nearly all @sc{ASCII} | 1757 | assignments, of course we assigned meanings to nearly all @sc{ascii} |
| 1698 | control characters. | 1758 | control 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 |
| 1773 | noninteractively. In this mode, Emacs does not read commands from the | 1833 | noninteractively. In this mode, Emacs does not read commands from the |
| 1774 | terminal, it does not alter the terminal modes, and it does not expect | 1834 | terminal, it does not alter the terminal modes, and it does not expect |
| 1775 | to be outputting to an erasable screen. The idea is that you specify | 1835 | to 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 | |||
| 1779 | calls @var{function} with no arguments. | 1839 | calls @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, |
| 1782 | either using @code{message} or using @code{prin1}, etc., with @code{t} | 1842 | either using @code{message}, or using @code{prin1}, etc., with @code{t} |
| 1783 | as the stream, goes instead to Emacs's standard error descriptor when | 1843 | as the stream, goes instead to Emacs's standard error descriptor when |
| 1784 | in batch mode. Thus, Emacs behaves much like a noninteractive | 1844 | in batch mode. Thus, Emacs behaves much like a noninteractive |
| 1785 | application program. (The echo area output that Emacs itself normally | 1845 | application 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 | |||
| 42 | the character on which the cursor sits. | 42 | the 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 |
| 46 | If narrowing is in effect (@pxref{Narrowing}), then point is constrained | 46 | buffer size plus 1. If narrowing is in effect (@pxref{Narrowing}), then |
| 47 | to fall within the accessible portion of the buffer (possibly at one end | 47 | point is constrained to fall within the accessible portion of the buffer |
| 48 | of 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 |
| 51 | value of point in other buffers. Each window also has a value of point, | 51 | value 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. | |||
| 81 | This function returns the maximum accessible value of point in the | 81 | This function returns the maximum accessible value of point in the |
| 82 | current buffer. This is @code{(1+ (buffer-size))}, unless narrowing is | 82 | current buffer. This is @code{(1+ (buffer-size))}, unless narrowing is |
| 83 | in effect, in which case it is the position of the end of the region | 83 | in effect, in which case it is the position of the end of the region |
| 84 | that you narrowed to. (@pxref{Narrowing}). | 84 | that 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 |
| 93 | This function returns the total number of characters in the current | 93 | This function returns the total number of characters in the current |
| 94 | buffer. In the absence of any narrowing (@pxref{Narrowing}), | 94 | buffer. 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 | ||
| 97 | If you specify a buffer, @var{buffer}, then the value is the | ||
| 98 | size 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 |
| 191 | at the buffer boundary. | 194 | at the buffer boundary. |
| 192 | 195 | ||
| 196 | In the minibuffer, the end of the prompt always acts as a word boundary, | ||
| 197 | regardless of what characters appear before and after it. | ||
| 198 | |||
| 193 | In an interactive call, @var{count} is set to the numeric prefix | 199 | In an interactive call, @var{count} is set to the numeric prefix |
| 194 | argument. | 200 | argument. |
| 195 | @end deffn | 201 | @end deffn |
| @@ -241,7 +247,8 @@ they set the mark and display messages in the echo area. | |||
| 241 | This function moves point to the beginning of the buffer (or the limits | 247 | This function moves point to the beginning of the buffer (or the limits |
| 242 | of the accessible portion, when narrowing is in effect), setting the | 248 | of the accessible portion, when narrowing is in effect), setting the |
| 243 | mark at the previous position. If @var{n} is non-@code{nil}, then it | 249 | mark at the previous position. If @var{n} is non-@code{nil}, then it |
| 244 | puts point @var{n} tenths of the way from the beginning of the buffer. | 250 | puts point @var{n} tenths of the way from the beginning of the |
| 251 | accessible portion of the buffer. | ||
| 245 | 252 | ||
| 246 | In an interactive call, @var{n} is the numeric prefix argument, | 253 | In an interactive call, @var{n} is the numeric prefix argument, |
| 247 | if provided; otherwise @var{n} defaults to @code{nil}. | 254 | if 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 |
| 253 | This function moves point to the end of the buffer (or the limits of | 260 | This function moves point to the end of the buffer (or the limits of the |
| 254 | the accessible portion, when narrowing is in effect), setting the mark | 261 | accessible portion, when narrowing is in effect), setting the mark at |
| 255 | at the previous position. If @var{n} is non-@code{nil}, then it puts | 262 | the previous position. If @var{n} is non-@code{nil}, then it puts point |
| 256 | point @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 |
| 264 | buffer. | ||
| 257 | 265 | ||
| 258 | In an interactive call, @var{n} is the numeric prefix argument, | 266 | In an interactive call, @var{n} is the numeric prefix argument, |
| 259 | if provided; otherwise @var{n} defaults to @code{nil}. | 267 | if provided; otherwise @var{n} defaults to @code{nil}. |
| @@ -308,6 +316,9 @@ argument @var{count} not @code{nil} or 1, it moves forward | |||
| 308 | If this function reaches the end of the buffer (or of the accessible | 316 | If this function reaches the end of the buffer (or of the accessible |
| 309 | portion, if narrowing is in effect), it positions point there. No error | 317 | portion, if narrowing is in effect), it positions point there. No error |
| 310 | is signaled. | 318 | is signaled. |
| 319 | |||
| 320 | As a special feature, in the minibuffer, this command will not | ||
| 321 | move 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 | |||
| 584 | them in Emacs). The syntax table controls how these functions interpret | 595 | them in Emacs). The syntax table controls how these functions interpret |
| 585 | various characters; see @ref{Syntax Tables}. @xref{Parsing | 596 | various characters; see @ref{Syntax Tables}. @xref{Parsing |
| 586 | Expressions}, for lower-level primitives for scanning sexps or parts of | 597 | Expressions}, for lower-level primitives for scanning sexps or parts of |
| 587 | sexps. For user-level commands, see @ref{Lists Commands,,, emacs, GNU | 598 | sexps. For user-level commands, see @ref{Lists Commands,,, emacs, The GNU |
| 588 | Emacs Manual}. | 599 | Emacs 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 |
| 726 | portion of the program, or to switch buffers temporarily. This is | 737 | portion of the program, or to switch buffers temporarily. This is |
| 727 | called an @dfn{excursion}, and it is done with the @code{save-excursion} | 738 | called an @dfn{excursion}, and it is done with the @code{save-excursion} |
| 728 | special form. This construct saves the current buffer and its values of | 739 | special form. This construct initially remembers the identity of the |
| 729 | point and the mark so they can be restored after the completion of the | 740 | current buffer, and its values of point and the mark, and restores them |
| 730 | excursion. | 741 | after 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 |
| 733 | described elsewhere (see @ref{Window Configurations}, and @pxref{Frame | 744 | described 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}, | |||
| 58 | create a synchronous process and do not return a process object | 58 | create 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 |
| 62 | sections. Since the three functions are all called in a similar | 62 | sections. Since the three functions are all called in a similar |
| 63 | fashion, their common arguments are described here. | 63 | fashion, 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 |
| 111 | The value of this variable is the name of a directory (a string) that | 111 | The value of this variable is a string, the name of a directory that |
| 112 | contains programs that come with GNU Emacs, programs intended for Emacs | 112 | contains programs that come with GNU Emacs, programs intended for Emacs |
| 113 | to invoke. The program @code{movemail} is an example of such a program; | 113 | to invoke. The program @code{movemail} is an example of such a program; |
| 114 | Rmail uses it to fetch new mail from an inbox. | 114 | Rmail 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 |
| 133 | which contains file names that were specified by the user. These | 133 | that contains file names that were specified by the user. These |
| 134 | programs ought to be able to support any valid file name. But the shell | 134 | programs ought to be able to support any valid file name. But the shell |
| 135 | gives special treatment to certain characters, and if these characters | 135 | gives special treatment to certain characters, and if these characters |
| 136 | occur in the file name, they will confuse the shell. To handle these | 136 | occur 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 | |||
| 143 | and then pass it to a shell for execution. | 143 | and then pass it to a shell for execution. |
| 144 | 144 | ||
| 145 | Precisely what this function does depends on your operating system. The | 145 | Precisely what this function does depends on your operating system. The |
| 146 | function is designed to work with the usual shell syntax; if you use an | 146 | function is designed to work with the syntax of your system's standard |
| 147 | unusual shell, you will need to redefine this function. On MS-DOS, the | 147 | shell; if you use an unusual shell, you will need to redefine this |
| 148 | function returns @var{argument} unchanged; while this is not really | 148 | function. |
| 149 | correct, it is the best one can do, since the MS-DOS shell has no | ||
| 150 | quoting 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 | ||
| 158 | Here's an example of using @code{shell-quote-argument} to construct | 160 | Here'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 |
| 174 | process to terminate before continuing. Starting Dired is an example of | 176 | process to terminate before continuing. Starting Dired on GNU or |
| 175 | this: it runs @code{ls} in a synchronous process, then modifies the | 177 | Unix@footnote{On other systems, Emacs uses a Lisp emulation of |
| 176 | output slightly. Because the process is synchronous, the entire | 178 | @code{ls}; see @ref{Contents of Directories}.} is an example of this: it |
| 177 | directory listing arrives in the buffer before Emacs tries to do | 179 | runs @code{ls} in a synchronous process, then modifies the output |
| 178 | anything with it. | 180 | slightly. Because the process is synchronous, the entire directory |
| 181 | listing 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 |
| 181 | user can quit by typing @kbd{C-g}. The first @kbd{C-g} tries to kill | 184 | user can quit by typing @kbd{C-g}. The first @kbd{C-g} tries to kill |
| 182 | the subprocess with a @code{SIGINT} signal; but it waits until the | 185 | the subprocess with a @code{SIGINT} signal; but it waits until the |
| 183 | subprocess actually terminates before quitting. If during that time the | 186 | subprocess actually terminates before quitting. If during that time the |
| 184 | user types another @kbd{C-g}, that kills the subprocess instantly with | 187 | user 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 |
| 189 | other 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 |
| 188 | process terminated. | 192 | process terminated. |
| @@ -197,7 +201,7 @@ This function calls @var{program} in a separate process and waits for | |||
| 197 | it to finish. | 201 | it to finish. |
| 198 | 202 | ||
| 199 | The standard input for the process comes from file @var{infile} if | 203 | The 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. |
| 201 | The argument @var{destination} says where to put the process output. | 205 | The argument @var{destination} says where to put the process output. |
| 202 | Here are the possibilities: | 206 | Here are the possibilities: |
| 203 | 207 | ||
| @@ -216,7 +220,7 @@ Insert the output in the current buffer, before point. | |||
| 216 | Discard the output. | 220 | Discard the output. |
| 217 | 221 | ||
| 218 | @item 0 | 222 | @item 0 |
| 219 | Discard the output, and return immediately without waiting | 223 | Discard the output, and return @code{nil} immediately without waiting |
| 220 | for the subprocess to finish. | 224 | for the subprocess to finish. |
| 221 | 225 | ||
| 222 | In this case, the process is not truly synchronous, since it can run in | 226 | In 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 | |||
| 224 | Emacs is essentially finished with the subprocess as soon as this | 228 | Emacs is essentially finished with the subprocess as soon as this |
| 225 | function returns. | 229 | function returns. |
| 226 | 230 | ||
| 231 | MS-DOS doesn't support asynchronous subprocesses, so this option doesn't | ||
| 232 | work there. | ||
| 233 | |||
| 227 | @item @code{(@var{real-destination} @var{error-destination})} | 234 | @item @code{(@var{real-destination} @var{error-destination})} |
| 228 | Keep the standard output stream separate from the standard error stream; | 235 | Keep the standard output stream separate from the standard error stream; |
| 229 | deal with the ordinary output as specified by @var{real-destination}, | 236 | deal 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 | |||
| 242 | the buffer as output is inserted. (However, if the coding system chosen | 249 | the buffer as output is inserted. (However, if the coding system chosen |
| 243 | for decoding output is @code{undecided}, meaning deduce the encoding | 250 | for decoding output is @code{undecided}, meaning deduce the encoding |
| 244 | from the actual data, then redisplay sometimes cannot continue once | 251 | from the actual data, then redisplay sometimes cannot continue once |
| 245 | non-@sc{ASCII} characters are encountered. There are fundamental | 252 | non-@sc{ascii} characters are encountered. There are fundamental |
| 246 | reasons why it is hard to fix this.) Otherwise the function | 253 | reasons 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 | |
| 248 | the screen only when Emacs redisplays that buffer in the normal course | 255 | Otherwise the function @code{call-process} does no redisplay, and the |
| 249 | of events. | 256 | results become visible on the screen only when Emacs redisplays that |
| 257 | buffer in the normal course of events. | ||
| 250 | 258 | ||
| 251 | The remaining arguments, @var{args}, are strings that specify command | 259 | The remaining arguments, @var{args}, are strings that specify command |
| 252 | line arguments for the program. | 260 | line 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 ---------- |
| 277 | lewis:5LTsHm66CSWKg:398:21:Bil Lewis:/user/lewis:/bin/csh | 285 | lewis: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 |
| 297 | This function sends the text between @var{start} to @var{end} as | 305 | This function sends the text from @var{start} to @var{end} as |
| 298 | standard input to a process running @var{program}. It deletes the text | 306 | standard input to a process running @var{program}. It deletes the text |
| 299 | sent if @var{delete} is non-@code{nil}; this is useful when | 307 | sent 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 | |||
| 305 | as it comes in. For details, see the description of | 313 | as 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} |
| 308 | immediately, without waiting for the subprocess to finish. | 316 | immediately, without waiting for the subprocess to finish (this only |
| 317 | works if asynchronous subprocess are supported). | ||
| 309 | 318 | ||
| 310 | The remaining arguments, @var{args}, are strings that specify command | 319 | The remaining arguments, @var{args}, are strings that specify command |
| 311 | line arguments for the program. | 320 | line 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 ---------- |
| 337 | inputinput@point{} | 346 | inputinput@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 |
| 369 | both continue running immediately. The process thereafter runs | 378 | both continue running immediately. The process thereafter runs |
| 370 | in parallel with Emacs, and the two can communicate with each other | 379 | in parallel with Emacs, and the two can communicate with each other |
| 371 | using the functions described in following sections. However, | 380 | using the functions described in the following sections. However, |
| 372 | communication is only partially asynchronous: Emacs sends data to the | 381 | communication is only partially asynchronous: Emacs sends data to the |
| 373 | process only when certain functions are called, and Emacs accepts data | 382 | process only when certain functions are called, and Emacs accepts data |
| 374 | from the process only when Emacs is waiting for input or for a time | 383 | from the process only when Emacs is waiting for input or for a time |
| @@ -429,10 +438,10 @@ use. | |||
| 429 | The point of running a program through the shell, rather than directly | 438 | The point of running a program through the shell, rather than directly |
| 430 | with @code{start-process}, is so that you can employ shell features such | 439 | with @code{start-process}, is so that you can employ shell features such |
| 431 | as wildcards in the arguments. It follows that if you include an | 440 | as wildcards in the arguments. It follows that if you include an |
| 432 | arbitrary user-specified filename in the command, you should quote it | 441 | arbitrary user-specified arguments in the command, you should quote it |
| 433 | with @code{shell-quote-argument} first, so that any special shell | 442 | with @code{shell-quote-argument} first, so that any special shell |
| 434 | characters in the file name do @emph{not} have their special shell | 443 | characters do @emph{not} have their special shell meanings. @xref{Shell |
| 435 | meanings. @xref{Shell Arguments}. | 444 | Arguments}. |
| 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 | |||
| 450 | addition, the total number of @sc{pty}s is limited on many systems and | 459 | addition, the total number of @sc{pty}s is limited on many systems and |
| 451 | it is good not to waste them. | 460 | it is good not to waste them. |
| 452 | 461 | ||
| 453 | The value @code{process-connection-type} is used when | 462 | The 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 |
| 455 | with one subprocess by binding the variable around the call to | 464 | with 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 |
| 731 | This function sends the text in the region defined by @var{start} and | 740 | This 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 |
| 733 | a process name. (If it is @code{nil}, the current buffer's process is | 742 | a process name. (If it is @code{nil}, the current buffer's process is |
| @@ -736,7 +745,7 @@ used.) | |||
| 736 | An error is signaled unless both @var{start} and @var{end} are | 745 | An error is signaled unless both @var{start} and @var{end} are |
| 737 | integers or markers that indicate positions in the current buffer. (It | 746 | integers or markers that indicate positions in the current buffer. (It |
| 738 | is unimportant which number is larger.) | 747 | is 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 |
| 36 | buffer. They are meant for use in programs, but you may call them | 36 | buffer. They are meant for use in programs, but you may call them |
| 37 | interactively. If you do so, they prompt for the search string; | 37 | interactively. 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} | 38 | arguments @var{limit} and @var{noerror} are @code{nil}, and @var{repeat} |
| 39 | is set to 1. | 39 | is 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 |
| 42 | buffer is multibyte; they convert the search string to unibyte if the | 42 | buffer 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 | |||
| 182 | appearing in a regular expression is ordinary, unless a @samp{\} | 183 | appearing in a regular expression is ordinary, unless a @samp{\} |
| 183 | precedes it. | 184 | precedes it. |
| 184 | 185 | ||
| 185 | For 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 |
| 186 | therefore @samp{f} is a regular expression that matches the string | 187 | therefore @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, |
| 189 | only @samp{o}.@refill | 190 | @samp{o} is a regular expression that matches only @samp{o}.@refill |
| 190 | 191 | ||
| 191 | Any 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 |
| 192 | result is a regular expression that matches a string if @var{a} matches | 193 | result is a regular expression that matches a string if @var{a} matches |
| 193 | some amount of the beginning of that string and @var{b} matches the rest of | 194 | some amount of the beginning of that string and @var{b} matches the rest of |
| 194 | the string.@refill | 195 | the string.@refill |
| 195 | 196 | ||
| 196 | As a simple example, we can concatenate the regular expressions @samp{f} | 197 | As a simple example, we can concatenate the regular expressions @samp{f} |
| 197 | and @samp{o} to get the regular expression @samp{fo}, which matches only | 198 | and @samp{o} to get the regular expression @samp{fo}, which matches only |
| 198 | the string @samp{fo}. Still trivial. To do something more powerful, you | 199 | the string @samp{fo}. Still trivial. To do something more powerful, you |
| 199 | need to use one of the special characters. Here is a list of them: | 200 | need 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 | ||
| 212 | expression. | ||
| 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 | ||
| 267 | You can also include character ranges in a character alternative, by | 280 | You can also include character ranges in a character alternative, by |
| 268 | writing the starting and ending characters with a @samp{-} between them. | 281 | writing the starting and ending characters with a @samp{-} between them. |
| 269 | Thus, @samp{[a-z]} matches any lower-case @sc{ASCII} letter. Ranges may be | 282 | Thus, @samp{[a-z]} matches any lower-case @sc{ascii} letter. Ranges may be |
| 270 | intermixed freely with individual characters, as in @samp{[a-z$%.]}, | 283 | intermixed freely with individual characters, as in @samp{[a-z$%.]}, |
| 271 | which matches any lower case @sc{ASCII} letter or @samp{$}, @samp{%} or | 284 | which matches any lower case @sc{ascii} letter or @samp{$}, @samp{%} or |
| 272 | period. | 285 | period. |
| 273 | |||
| 274 | You cannot always match all non-@sc{ASCII} characters with the regular | ||
| 275 | expression @samp{[\200-\377]}. This works when searching a unibyte | ||
| 276 | buffer or string (@pxref{Text Representations}), but not in a multibyte | ||
| 277 | buffer or string, because many non-@sc{ASCII} characters have codes | ||
| 278 | above octal 0377. However, the regular expression @samp{[^\000-\177]} | ||
| 279 | does match all non-@sc{ASCII} characters, in both multibyte and unibyte | ||
| 280 | representations, because only the @sc{ASCII} characters are excluded. | ||
| 281 | |||
| 282 | The 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 | ||
| 287 | Note that the usual regexp special characters are not special inside a | 287 | Note that the usual regexp special characters are not special inside a |
| 288 | character alternative. A completely different set of characters is | 288 | character alternative. A completely different set of characters is |
| @@ -297,6 +297,27 @@ matches both @samp{]} and @samp{-}. | |||
| 297 | To include @samp{^} in a character alternative, put it anywhere but at | 297 | To include @samp{^} in a character alternative, put it anywhere but at |
| 298 | the beginning. | 298 | the beginning. |
| 299 | 299 | ||
| 300 | The 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 | |||
| 305 | You cannot always match all non-@sc{ascii} characters with the regular | ||
| 306 | expression @samp{[\200-\377]}. This works when searching a unibyte | ||
| 307 | buffer or string (@pxref{Text Representations}), but not in a multibyte | ||
| 308 | buffer or string, because many non-@sc{ascii} characters have codes | ||
| 309 | above octal 0377. However, the regular expression @samp{[^\000-\177]} | ||
| 310 | does match all non-@sc{ascii} characters (see below regarding @samp{^}), | ||
| 311 | in both multibyte and unibyte representations, because only the | ||
| 312 | @sc{ascii} characters are excluded. | ||
| 313 | |||
| 314 | Starting in Emacs 21, a character alternative can also specify named | ||
| 315 | character classes (@pxref{Char Classes}). This is a POSIX feature whose | ||
| 316 | syntax is @samp{[:@var{class}:]}. Using a character class is equivalent | ||
| 317 | to mentioning each of the characters in that class; but the latter is | ||
| 318 | not feasible in practice, since some classes include thousands of | ||
| 319 | different 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. | |||
| 321 | When matching a string instead of a buffer, @samp{^} matches at the | 342 | When matching a string instead of a buffer, @samp{^} matches at the |
| 322 | beginning of the string or after a newline character @samp{\n}. | 343 | beginning of the string or after a newline character @samp{\n}. |
| 323 | 344 | ||
| 345 | For historical compatibility reasons, @samp{^} can be used only at the | ||
| 346 | beginning 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 | ||
| 326 | is similar to @samp{^} but matches only at the end of a line. Thus, | 351 | is 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 | ||
| 329 | When matching a string instead of a buffer, @samp{$} matches at the end | 354 | When matching a string instead of a buffer, @samp{$} matches at the end |
| 330 | of the string or before a newline character @samp{\n}. | 355 | of the string or before a newline character @samp{\n}. |
| 331 | 356 | ||
| 357 | For historical compatibility reasons, @samp{$} can be used only at the | ||
| 358 | end 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 |
| 334 | has two functions: it quotes the special characters (including | 362 | has two functions: it quotes the special characters (including |
| @@ -354,11 +382,66 @@ ordinary since there is no preceding expression on which the @samp{*} | |||
| 354 | can act. It is poor practice to depend on this behavior; quote the | 382 | can act. It is poor practice to depend on this behavior; quote the |
| 355 | special character anyway, regardless of where it appears.@refill | 383 | special character anyway, regardless of where it appears.@refill |
| 356 | 384 | ||
| 357 | For the most part, @samp{\} followed by any character matches only that | 385 | @node Char Classes |
| 358 | character. However, there are several exceptions: two-character | 386 | @subsubsection Character Classes |
| 359 | sequences starting with @samp{\} which have special meanings. (The | 387 | @cindex character classes in regexp |
| 360 | second character in such a sequence is always ordinary when used on its | 388 | |
| 361 | own.) Here is a table of @samp{\} constructs. | 389 | Here is a table of the classes you can use in a character alternative, |
| 390 | in Emacs 21, and what they mean: | ||
| 391 | |||
| 392 | @table @samp | ||
| 393 | @item [:ascii:] | ||
| 394 | This matches any ASCII (unibyte) character. | ||
| 395 | @item [:alnum:] | ||
| 396 | This matches any letter or digit. (At present, for multibyte | ||
| 397 | characters, it matches anything that has word syntax.) | ||
| 398 | @item [:alpha:] | ||
| 399 | This matches any letter. (At present, for multibyte characters, it | ||
| 400 | matches anything that has word syntax.) | ||
| 401 | @item [:blank:] | ||
| 402 | This matches space and tab only. | ||
| 403 | @item [:cntrl:] | ||
| 404 | This matches any ASCII control character. | ||
| 405 | @item [:digit:] | ||
| 406 | This matches @samp{0} through @samp{9}. Thus, @samp{[-+[:digit:]]} | ||
| 407 | matches any digit, as well as @samp{+} and @samp{-}. | ||
| 408 | @item [:graph:] | ||
| 409 | This matches graphic characters---everything except ASCII control characters, | ||
| 410 | space, and DEL. | ||
| 411 | @item [:lower:] | ||
| 412 | This matches any lower-case letter, as determined by | ||
| 413 | the current case table (@pxref{Case Tables}). | ||
| 414 | @item [:nonascii:] | ||
| 415 | This matches any non-ASCII (multibyte) character. | ||
| 416 | @item [:print:] | ||
| 417 | This matches printing characters---everything except ASCII control | ||
| 418 | characters and DEL. | ||
| 419 | @item [:punct:] | ||
| 420 | This matches any punctuation character. (At present, for multibyte | ||
| 421 | characters, it matches anything that has non-word syntax.) | ||
| 422 | @item [:space:] | ||
| 423 | This matches any character that has whitespace syntax | ||
| 424 | (@pxref{Syntax Class Table}). | ||
| 425 | @item [:upper:] | ||
| 426 | This matches any upper-case letter, as determined by | ||
| 427 | the current case table (@pxref{Case Tables}). | ||
| 428 | @item [:word:] | ||
| 429 | This matches any character that has word syntax (@pxref{Syntax Class | ||
| 430 | Table}). | ||
| 431 | @item [:xdigit:] | ||
| 432 | This matches the hexadecimal digits: @samp{0} through @samp{9}, @samp{a} | ||
| 433 | through @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 | ||
| 440 | that character. However, there are several exceptions: certain | ||
| 441 | two-character sequences starting with @samp{\} that have special | ||
| 442 | meanings. (The character after the @samp{\} in such a sequence is | ||
| 443 | always 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 | |||
| 376 | surrounding @samp{\( @dots{} \)} grouping can limit the grouping power of | 459 | surrounding @samp{\( @dots{} \)} grouping can limit the grouping power of |
| 377 | @samp{\|}.@refill | 460 | @samp{\|}.@refill |
| 378 | 461 | ||
| 379 | Full backtracking capability exists to handle multiple uses of @samp{\|}. | 462 | Full 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 | |||
| 505 | an invalid regular expression is passed to any of the search functions, | 590 | an invalid regular expression is passed to any of the search functions, |
| 506 | an @code{invalid-regexp} error is signaled. | 591 | an @code{invalid-regexp} error is signaled. |
| 507 | 592 | ||
| 508 | @defun regexp-quote string | ||
| 509 | This function returns a regular expression string that matches exactly | ||
| 510 | @var{string} and nothing else. This allows you to request an exact | ||
| 511 | string 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 | |||
| 520 | One use of @code{regexp-quote} is to combine an exact string match with | ||
| 521 | context described as a regular expression. For example, this searches | ||
| 522 | for the string that is the value of @var{string}, surrounded by | ||
| 523 | whitespace: | ||
| 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 | ||
| 535 | This function returns an efficient regular expression that will match | ||
| 536 | any of the strings @var{strings}. This is useful when you need to make | ||
| 537 | matching or searching as fast as possible---for example, for Font Lock | ||
| 538 | mode. | ||
| 539 | |||
| 540 | If the optional argument @var{paren} is non-@code{nil}, then the | ||
| 541 | returned regular expression is always enclosed by at least one | ||
| 542 | parentheses-grouping construct. | ||
| 543 | |||
| 544 | This simplified definition of @code{regexp-opt} produces a | ||
| 545 | regular 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 | ||
| 560 | This 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 | |||
| 624 | beyond the minimum needed to end a sentence. | 653 | beyond 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 | ||
| 662 | This function returns a regular expression whose only exact match is | ||
| 663 | @var{string}. Using this regular expression in @code{looking-at} will | ||
| 664 | succeed only if the next characters in the buffer are @var{string}; | ||
| 665 | using it in a search function will succeed if the text being searched | ||
| 666 | contains @var{string}. | ||
| 667 | |||
| 668 | This allows you to request an exact string match or search when calling | ||
| 669 | a 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 | |||
| 678 | One use of @code{regexp-quote} is to combine an exact string match with | ||
| 679 | context described as a regular expression. For example, this searches | ||
| 680 | for the string that is the value of @var{string}, surrounded by | ||
| 681 | whitespace: | ||
| 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 | ||
| 693 | This function returns an efficient regular expression that will match | ||
| 694 | any of the strings @var{strings}. This is useful when you need to make | ||
| 695 | matching or searching as fast as possible---for example, for Font Lock | ||
| 696 | mode. | ||
| 697 | |||
| 698 | If the optional argument @var{paren} is non-@code{nil}, then the | ||
| 699 | returned regular expression is always enclosed by at least one | ||
| 700 | parentheses-grouping construct. | ||
| 701 | |||
| 702 | This simplified definition of @code{regexp-opt} produces a | ||
| 703 | regular 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 | ||
| 718 | This 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 | |||
| 908 | with. If it is a string, that string is used. It can also be a list of | 1003 | with. If it is a string, that string is used. It can also be a list of |
| 909 | strings, to be used in cyclic order. | 1004 | strings, to be used in cyclic order. |
| 910 | 1005 | ||
| 1006 | If @var{replacements} is a cons cell, @var{(@var{function} | ||
| 1007 | . @var{data})}, this means to call @var{function} after each match to | ||
| 1008 | get the replacement text. This function is called with two arguments: | ||
| 1009 | @var{data}, and the number of replacements already made. | ||
| 1010 | |||
| 911 | If @var{repeat-count} is non-@code{nil}, it should be an integer. Then | 1011 | If @var{repeat-count} is non-@code{nil}, it should be an integer. Then |
| 912 | it specifies how many times to use each of the strings in the | 1012 | it 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 | ||
| 1015 | If @var{from-string} contains upper-case letters, then | ||
| 1016 | @code{perform-replace} binds @code{case-fold-search} to @code{nil}, and | ||
| 1017 | it uses the @code{replacements} without altering the case of them. | ||
| 1018 | |||
| 915 | Normally, the keymap @code{query-replace-map} defines the possible user | 1019 | Normally, the keymap @code{query-replace-map} defines the possible user |
| 916 | responses for queries. The argument @var{map}, if non-@code{nil}, is a | 1020 | responses for queries. The argument @var{map}, if non-@code{nil}, is a |
| 917 | keymap to use instead of @code{query-replace-map}. | 1021 | keymap 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 | |||
| 1039 | letter, @code{replace-match} considers this a capitalized first word | 1143 | letter, @code{replace-match} considers this a capitalized first word |
| 1040 | rather than all upper case. | 1144 | rather than all upper case. |
| 1041 | 1145 | ||
| 1042 | If @code{case-replace} is @code{nil}, then case conversion is not done, | ||
| 1043 | regardless of the value of @var{fixed-case}. @xref{Searching and Case}. | ||
| 1044 | |||
| 1045 | If @var{literal} is non-@code{nil}, then @var{replacement} is inserted | 1146 | If @var{literal} is non-@code{nil}, then @var{replacement} is inserted |
| 1046 | exactly as it is, the only alterations being case changes as needed. | 1147 | exactly as it is, the only alterations being case changes as needed. |
| 1047 | If it is @code{nil} (the default), then the character @samp{\} is treated | 1148 | If 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 | |||
| 1361 | replacement text verbatim. A non-@code{nil} value means to convert the | 1462 | replacement text verbatim. A non-@code{nil} value means to convert the |
| 1362 | case of the replacement text according to the text being replaced. | 1463 | case of the replacement text according to the text being replaced. |
| 1363 | 1464 | ||
| 1364 | The function @code{replace-match} is where this variable actually has | 1465 | This variable is used by passing it as an argument to the function |
| 1365 | its 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 |
| 719 | If this variable is non-@code{nil}, then unibyte non-@sc{ASCII} | 719 | If this variable is non-@code{nil}, then unibyte non-@sc{ascii} |
| 720 | characters in strings are unconditionally printed as backslash sequences | 720 | characters in strings are unconditionally printed as backslash sequences |
| 721 | by the print functions @code{prin1} and @code{print} that print with | 721 | by the print functions @code{prin1} and @code{print} that print with |
| 722 | quoting. | 722 | quoting. |
| 723 | 723 | ||
| 724 | Those functions also use backslash sequences for unibyte non-@sc{ASCII} | 724 | Those functions also use backslash sequences for unibyte non-@sc{ascii} |
| 725 | characters, regardless of the value of this variable, when the output | 725 | characters, regardless of the value of this variable, when the output |
| 726 | stream is a multibyte buffer or a marker pointing into one. | 726 | stream 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 |
| 731 | If this variable is non-@code{nil}, then multibyte non-@sc{ASCII} | 731 | If this variable is non-@code{nil}, then multibyte non-@sc{ascii} |
| 732 | characters in strings are unconditionally printed as backslash sequences | 732 | characters in strings are unconditionally printed as backslash sequences |
| 733 | by the print functions @code{prin1} and @code{print} that print with | 733 | by the print functions @code{prin1} and @code{print} that print with |
| 734 | quoting. | 734 | quoting. |
| 735 | 735 | ||
| 736 | Those functions also use backslash sequences for multibyte | 736 | Those functions also use backslash sequences for multibyte |
| 737 | non-@sc{ASCII} characters, regardless of the value of this variable, | 737 | non-@sc{ascii} characters, regardless of the value of this variable, |
| 738 | when the output stream is a unibyte buffer or a marker pointing into | 738 | when the output stream is a unibyte buffer or a marker pointing into |
| 739 | one. | 739 | one. |
| 740 | @end defvar | 740 | @end defvar |
| @@ -766,3 +766,48 @@ parentheses and brackets when printed. Any list or vector at a depth | |||
| 766 | exceeding this limit is abbreviated with an ellipsis. A value of | 766 | exceeding 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 | ||
| 771 | and shared structure---but they are only defined in Emacs 21. | ||
| 772 | |||
| 773 | @tindex print-circle | ||
| 774 | @defvar print-circle | ||
| 775 | If non-@code{nil}, this variable enables detection of circular | ||
| 776 | and shared structure in printing. | ||
| 777 | @end defvar | ||
| 778 | |||
| 779 | @tindex print-gensym | ||
| 780 | @defvar print-gensym | ||
| 781 | If non-@code{nil}, this variable enables detection of uninterned symbols | ||
| 782 | (@pxref{Creating Symbols}) in printing. When this is enabled, | ||
| 783 | uninterned symbols print with the prefix @samp{#:}, which tells the Lisp | ||
| 784 | reader to produce an uninterned symbol. | ||
| 785 | @end defvar | ||
| 786 | |||
| 787 | @tindex print-continuous-numbering | ||
| 788 | @defvar print-continuous-numbering | ||
| 789 | To print several objects with shared structure in common, you should | ||
| 790 | bind @code{print-continuous-numbering} to @code{t} around them all. | ||
| 791 | That tells @code{print} not to reinitialize @code{print-number-table} | ||
| 792 | each time. | ||
| 793 | @end defvar | ||
| 794 | |||
| 795 | @tindex print-number-table | ||
| 796 | @defvar print-number-table | ||
| 797 | This variable holds the table used as the basis of outputting | ||
| 798 | @samp{#@var{n}=} and @samp{#@var{n}#} constructs for circular and shared | ||
| 799 | structure. When you want to print several objects with shared structure | ||
| 800 | in common, you should bind @code{print-number-table} to @code{nil} | ||
| 801 | around them all. | ||
| 802 | @end defvar | ||
| 803 | |||
| 804 | Here is an example of printing two objects with a common | ||
| 805 | set 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 |
| 44 | altered once the string exists. Strings in Lisp are @emph{not} | 44 | altered once the string exists. Strings in Lisp are @emph{not} |
| 45 | terminated by a distinguished character code. (By contrast, strings in | 45 | terminated by a distinguished character code. (By contrast, strings in |
| 46 | C are terminated by a character with @sc{ASCII} code 0.) | 46 | C 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 |
| 49 | operate on them with the general array and sequence functions. | 49 | operate on them with the general array and sequence functions. |
| @@ -51,25 +51,25 @@ operate on them with the general array and sequence functions. | |||
| 51 | change individual characters in a string using the functions @code{aref} | 51 | change individual characters in a string using the functions @code{aref} |
| 52 | and @code{aset} (@pxref{Array Functions}). | 52 | and @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 |
| 55 | Emacs strings (and in buffers): unibyte and multibyte (@pxref{Text | 55 | Emacs strings (and in buffers): unibyte and multibyte (@pxref{Text |
| 56 | Representations}). @sc{ASCII} characters always occupy one byte in a | 56 | Representations}). An @sc{ascii} character always occupies one byte in a |
| 57 | string; in fact, when a string is all @sc{ASCII}, there is no real | 57 | string; in fact, when a string is all @sc{ascii}, there is no real |
| 58 | difference between the unibyte and multibyte representations. | 58 | difference between the unibyte and multibyte representations. |
| 59 | For most Lisp programming, you don't need to be concerned with these two | 59 | For most Lisp programming, you don't need to be concerned with these two |
| 60 | representations. | 60 | representations. |
| 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 |
| 63 | a key sequence, string elements in the range 128 to 255 represent meta | 63 | a key sequence, string elements in the range 128 to 255 represent meta |
| 64 | characters (which are extremely large integers) rather than character | 64 | characters (which are large integers) rather than character |
| 65 | codes in the range 128 to 255. | 65 | codes 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 |
| 68 | modifiers; they can hold @sc{ASCII} control characters, but no other | 68 | modifiers; they can hold @sc{ascii} control characters, but no other |
| 69 | control characters. They do not distinguish case in @sc{ASCII} control | 69 | control characters. They do not distinguish case in @sc{ascii} control |
| 70 | characters. If you want to store such characters in a sequence, such as | 70 | characters. If you want to store such characters in a sequence, such as |
| 71 | a key sequence, you must use a vector instead of a string. | 71 | a 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 |
| 73 | and other modifiers for keyboard input characters. | 73 | and 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}). | |||
| 200 | If the characters copied from @var{string} have text properties, the | 200 | If the characters copied from @var{string} have text properties, the |
| 201 | properties are copied into the new string also. @xref{Text Properties}. | 201 | properties 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. |
| 204 | For example: | 204 | For example: |
| 205 | 205 | ||
| 206 | @example | 206 | @example |
| @@ -250,8 +250,8 @@ When an argument is an integer (not a sequence of integers), it is | |||
| 250 | converted to a string of digits making up the decimal printed | 250 | converted to a string of digits making up the decimal printed |
| 251 | representation of the integer. @strong{Don't use this feature; we plan | 251 | representation of the integer. @strong{Don't use this feature; we plan |
| 252 | to eliminate it. If you already use this feature, change your programs | 252 | to eliminate it. If you already use this feature, change your programs |
| 253 | now!} The proper way to convert an integer to a decimal number in this | 253 | now!} The proper way to convert an integer to its decimal printed form |
| 254 | way is with @code{format} (@pxref{Formatting Strings}) or | 254 | is 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 |
| 274 | Split @var{string} into substrings in between matches for the regular | 274 | This function splits @var{string} into substrings at matches for the regular |
| 275 | expression @var{separators}. Each match for @var{separators} defines a | 275 | expression @var{separators}. Each match for @var{separators} defines a |
| 276 | splitting point; the substrings between the splitting points are made | 276 | splitting point; the substrings between the splitting points are made |
| 277 | into a list, which is the value returned by @code{split-string}. | 277 | into 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 | |||
| 367 | strings. When @code{equal} (@pxref{Equality Predicates}) compares two | 367 | strings. When @code{equal} (@pxref{Equality Predicates}) compares two |
| 368 | strings, it uses @code{string=}. | 368 | strings, it uses @code{string=}. |
| 369 | 369 | ||
| 370 | If the strings contain non-@sc{ASCII} characters, and one is unibyte | 370 | If the strings contain non-@sc{ascii} characters, and one is unibyte |
| 371 | while the other is multibyte, then they cannot be equal. @xref{Text | 371 | while the other is multibyte, then they cannot be equal. @xref{Text |
| 372 | Representations}. | 372 | Representations}. |
| 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!!) |
| 382 | This function compares two strings a character at a time. First it | 382 | This function compares two strings a character at a time. It |
| 383 | scans both the strings at once to find the first pair of corresponding | 383 | scans both the strings at the same time to find the first pair of corresponding |
| 384 | characters that do not match. If the lesser character of those two is | 384 | characters that do not match. If the lesser character of these two is |
| 385 | the character from @var{string1}, then @var{string1} is less, and this | 385 | the character from @var{string1}, then @var{string1} is less, and this |
| 386 | function returns @code{t}. If the lesser character is the one from | 386 | function 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 | ||
| 390 | Pairs of characters are compared according to their character codes. | 390 | Pairs of characters are compared according to their character codes. |
| 391 | Keep in mind that lower case letters have higher numeric values in the | 391 | Keep 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 |
| 393 | many punctuation characters have a lower numeric value than upper case | 393 | many punctuation characters have a lower numeric value than upper case |
| 394 | letters. An @sc{ASCII} character is less than any non-@sc{ASCII} | 394 | letters. An @sc{ascii} character is less than any non-@sc{ascii} |
| 395 | character; a unibyte non-@sc{ASCII} character is always less than any | 395 | character; a unibyte non-@sc{ascii} character is always less than any |
| 396 | multibyte non-@sc{ASCII} character (@pxref{Text Representations}). | 396 | multibyte 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 |
| 436 | This function compares a specified part of @var{string1} with a | 436 | This function compares the specified part of @var{string1} with the |
| 437 | specified part of @var{string2}. The specified part of @var{string1} | 437 | specified part of @var{string2}. The specified part of @var{string1} |
| 438 | runs from index @var{start1} up to index @var{end1} (default, the end of | 438 | runs from index @var{start1} up to index @var{end1} (@code{nil} means |
| 439 | the string). The specified part of @var{string2} runs from index | 439 | the 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). | 440 | index @var{start2} up to index @var{end2} (@code{nil} means the end of |
| 441 | the string). | ||
| 441 | 442 | ||
| 442 | The strings are both converted to multibyte for the comparison | 443 | The 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 |
| 502 | string is empty, the function returns 0. The value is also 0 when the | 503 | string is empty, the function returns 0. The value is also 0 when the |
| 503 | first character of @var{string} is the null character, @sc{ASCII} code | 504 | first character of @var{string} is the null character, @sc{ascii} code |
| 504 | 0. | 505 | 0. |
| 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 | ||
| 517 | This function may be eliminated in the future if it does not seem useful | 520 | This 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 |
| 524 | This function returns a string consisting of the printed base-ten | 527 | This function returns a string consisting of the printed base-ten |
| 525 | representation of @var{number}, which may be an integer or a floating | 528 | representation of @var{number}, which may be an integer or a floating |
| 526 | point number. The value starts with a sign if the argument is | 529 | point number. The returned value starts with a minus sign if the argument is |
| 527 | negative. | 530 | negative. |
| 528 | 531 | ||
| 529 | @example | 532 | @example |
| @@ -553,8 +556,9 @@ more work and does not seem useful. | |||
| 553 | The parsing skips spaces and tabs at the beginning of @var{string}, then | 556 | The parsing skips spaces and tabs at the beginning of @var{string}, then |
| 554 | reads as much of @var{string} as it can interpret as a number. (On some | 557 | reads as much of @var{string} as it can interpret as a number. (On some |
| 555 | systems it ignores other whitespace at the beginning, not just spaces | 558 | systems it ignores other whitespace at the beginning, not just spaces |
| 556 | and tabs.) If the first character after the ignored whitespace is not a | 559 | and tabs.) If the first character after the ignored whitespace is |
| 557 | digit or a plus or minus sign, this function returns 0. | 560 | neither a digit, nor a plus or minus sign, nor the leading dot of a |
| 561 | floating 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 |
| 608 | in the copy with encodings of the corresponding @var{objects}. The | 612 | in the copy with encodings of the corresponding @var{objects}. The |
| 609 | arguments @var{objects} are the computed values to be formatted. | 613 | arguments @var{objects} are the computed values to be formatted. |
| 614 | |||
| 615 | The characters in @var{string}, other than the format specifications, | ||
| 616 | are copied directly into the output; starting in Emacs 21, if they have | ||
| 617 | text 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 | |||
| 646 | by their contents alone, with no @samp{"} characters, and symbols appear | 654 | by their contents alone, with no @samp{"} characters, and symbols appear |
| 647 | without @samp{\} characters. | 655 | without @samp{\} characters. |
| 648 | 656 | ||
| 657 | Starting in Emacs 21, if the object is a string, its text properties are | ||
| 658 | copied into the output. The text properties of the @samp{%s} itself | ||
| 659 | are also copied, but those of the object take priority. | ||
| 660 | |||
| 649 | If there is no corresponding object, the empty string is used. | 661 | If 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 |
| 775 | of the contents of strings. The functions normally convert only | 787 | of the contents of strings. The functions normally convert only |
| 776 | alphabetic characters (the letters @samp{A} through @samp{Z} and | 788 | alphabetic 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 |
| 778 | characters are not altered. (You can specify a different case | 790 | characters are not altered. You can specify a different case |
| 779 | conversion mapping by specifying a case table---@pxref{Case Tables}.) | 791 | conversion 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 |
| 782 | arguments. | 794 | arguments. |
| 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 |
| 788 | This function converts a character or a string to lower case. | 800 | This function converts a character or a string to lower case. |
| @@ -814,7 +826,7 @@ lower case is converted to upper case. | |||
| 814 | When the argument to @code{upcase} is a character, @code{upcase} | 826 | When the argument to @code{upcase} is a character, @code{upcase} |
| 815 | returns the corresponding upper case character. This value is an integer. | 827 | returns the corresponding upper case character. This value is an integer. |
| 816 | If the original character is upper case, or is not a letter, then the | 828 | If the original character is upper case, or is not a letter, then the |
| 817 | value equals the original character. | 829 | value 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 |
| 923 | each equivalence class (of characters with the same canonical | 935 | each equivalence class (of characters with the same canonical |
| 924 | equivalent). (For ordinary @sc{ASCII}, this would map @samp{a} into | 936 | equivalent). (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 |
| 926 | equivalent characters.) | 938 | equivalent 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 |
| 961 | that define non-@sc{ASCII} character sets. They modify the specified | 973 | that define non-@sc{ascii} character sets. They modify the specified |
| 962 | case table @var{case-table}; they also modify the standard syntax table. | 974 | case 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 |
| 964 | the standard case table. | 976 | the 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. | |||
| 57 | When a symbol is used as a function, its function definition is used in | 57 | When a symbol is used as a function, its function definition is used in |
| 58 | its place. This cell is also used to make a symbol stand for a keymap | 58 | its place. This cell is also used to make a symbol stand for a keymap |
| 59 | or a keyboard macro, for editor command execution. Because each symbol | 59 | or a keyboard macro, for editor command execution. Because each symbol |
| 60 | has separate value and function cells, variables and function names do | 60 | has separate value and function cells, variables names and function names do |
| 61 | not conflict. See @code{symbol-function} in @ref{Function Cells}. | 61 | not 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 | |||
| 194 | and go from there. That is a simple version of hashing. Each element | 194 | and go from there. That is a simple version of hashing. Each element |
| 195 | of the obarray is a @dfn{bucket} which holds all the symbols with a | 195 | of the obarray is a @dfn{bucket} which holds all the symbols with a |
| 196 | given hash code; to look for a given name, it is sufficient to look | 196 | given hash code; to look for a given name, it is sufficient to look |
| 197 | through all the symbols in the bucket for that name's hash code. | 197 | through all the symbols in the bucket for that name's hash code. (The |
| 198 | same idea is used for general Emacs hash tables, but they are a | ||
| 199 | different 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 | |||
| 208 | same obarray. Thus, the reader gets the same symbols for the same | 210 | same obarray. Thus, the reader gets the same symbols for the same |
| 209 | names, as long as you keep reading with the same obarray. | 211 | names, as long as you keep reading with the same obarray. |
| 210 | 212 | ||
| 213 | Interning usually happens automatically in the reader, but sometimes | ||
| 214 | other programs need to do it. For example, after the @kbd{M-x} command | ||
| 215 | obtains the command name as a string using the minibuffer, it then | ||
| 216 | interns 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 | |||
| 216 | to gain access to it is by finding it in some other object or as the | 223 | to gain access to it is by finding it in some other object or as the |
| 217 | value of a variable. | 224 | value of a variable. |
| 218 | 225 | ||
| 226 | Creating an uninterned symbol is useful in generating Lisp code, | ||
| 227 | because an uninterned symbol used as a variable in the code you generate | ||
| 228 | cannot 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 |
| 220 | vector is a bucket; its value is either an interned symbol whose name | 231 | vector is a bucket; its value is either an interned symbol whose name |
| 221 | hashes to that bucket, or 0 if the bucket is empty. Each interned | 232 | hashes 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 | |||
| 224 | find all the symbols in an obarray except using @code{mapatoms} (below). | 235 | find all the symbols in an obarray except using @code{mapatoms} (below). |
| 225 | The order of symbols in a bucket is not significant. | 236 | The 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 |
| 228 | with @code{(make-vector @var{length} 0)}. @strong{This is the only | 239 | with @code{(make-vector @var{length} 0)}. @strong{This is the only |
| 229 | valid way to create an obarray.} Prime numbers as lengths tend | 240 | valid way to create an obarray.} Prime numbers as lengths tend |
| 230 | to result in good hashing; lengths one less than a power of two are also | 241 | to 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 | |||
| 71 | standard syntax table, while specifying other characters itself. The | 71 | standard 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 |
| 73 | the standard syntax table.'' Just changing the standard syntax for a | 73 | the standard syntax table.'' Just changing the standard syntax for a |
| 74 | characters affects all syntax tables which inherit from it. | 74 | character affects all syntax tables that inherit from it. |
| 75 | 75 | ||
| 76 | @defun syntax-table-p object | 76 | @defun syntax-table-p object |
| 77 | This function returns @code{t} if @var{object} is a syntax table. | 77 | This 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 |
| 94 | name of the class when you need to specify a class. Usually the | 94 | name of the class when you need to specify a class. Usually the |
| 95 | designator character is one that is frequently in that class; however, | 95 | designator character is one that is often assigned that class; however, |
| 96 | its meaning as a designator is unvarying and independent of what syntax | 96 | its meaning as a designator is unvarying and independent of what syntax |
| 97 | that character currently has. | 97 | that character currently has. Thus, @samp{\} as a designator character |
| 98 | always 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 |
| 108 | mode is @samp{@w{. 23}} (i.e., punctuation, matching character slot | 110 | mode is @samp{@w{. 23}} (i.e., punctuation, matching character slot |
| 109 | unused, second character of a comment-starter, first character of an | 111 | unused, second character of a comment-starter, first character of a |
| 110 | comment-ender), and the entry for @samp{/} is @samp{@w{. 14}} (i.e., | 112 | comment-ender), and the entry for @samp{/} is @samp{@w{. 14}} (i.e., |
| 111 | punctuation, matching character slot unused, first character of a | 113 | punctuation, matching character slot unused, first character of a |
| 112 | comment-starter, second character of a comment-ender). | 114 | comment-starter, second character of a comment-ender). |
| @@ -542,6 +544,10 @@ This function moves point forward across characters having syntax classes | |||
| 542 | mentioned in @var{syntaxes}. It stops when it encounters the end of | 544 | mentioned in @var{syntaxes}. It stops when it encounters the end of |
| 543 | the buffer, or position @var{limit} (if specified), or a character it is | 545 | the buffer, or position @var{limit} (if specified), or a character it is |
| 544 | not supposed to skip. | 546 | not supposed to skip. |
| 547 | |||
| 548 | If @var{syntaxes} starts with @samp{^}, then the function skips | ||
| 549 | characters whose syntax is @emph{not} in @var{syntaxes}. | ||
| 550 | |||
| 545 | The return value is the distance traveled, which is a nonnegative | 551 | The return value is the distance traveled, which is a nonnegative |
| 546 | integer. | 552 | integer. |
| 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 |
| 550 | This function moves point backward across characters whose syntax | 556 | This function moves point backward across characters whose syntax |
| 551 | classes are mentioned in @var{syntaxes}. It stops when it encounters | 557 | classes are mentioned in @var{syntaxes}. It stops when it encounters |
| 552 | the beginning of the buffer, or position @var{limit} (if specified), or a | 558 | the beginning of the buffer, or position @var{limit} (if specified), or |
| 553 | character it is not supposed to skip. | 559 | a character it is not supposed to skip. |
| 560 | |||
| 561 | If @var{syntaxes} starts with @samp{^}, then the function skips | ||
| 562 | characters whose syntax is @emph{not} in @var{syntaxes}. | ||
| 554 | 563 | ||
| 555 | The return value indicates the distance traveled. It is an integer that | 564 | The return value indicates the distance traveled. It is an integer that |
| 556 | is zero or less. | 565 | is zero or less. |
| @@ -856,7 +865,7 @@ category table defines its own categories, but normally these are | |||
| 856 | initialized by copying from the standard categories table, so that the | 865 | initialized by copying from the standard categories table, so that the |
| 857 | standard categories are available in all modes. | 866 | standard 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 |
| 860 | the range @w{@samp{ }} to @samp{~}. You specify the name of a category | 869 | the range @w{@samp{ }} to @samp{~}. You specify the name of a category |
| 861 | when you define it with @code{define-category}. | 870 | when 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 | |||
| 224 | When this function is used in the minibuffer, the value does not include | ||
| 225 | the 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 | |||
| 275 | at the second character. | 278 | at 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} | |||
| 482 | error. Otherwise, it deletes the text without asking for any | 485 | error. Otherwise, it deletes the text without asking for any |
| 483 | confirmation. It returns @code{nil}. | 486 | confirmation. It returns @code{nil}. |
| 484 | 487 | ||
| 488 | In the minibuffer, @code{erase-buffer} does not delete the prompt. | ||
| 489 | |||
| 485 | Normally, deleting a large amount of text from a buffer inhibits further | 490 | Normally, deleting a large amount of text from a buffer inhibits further |
| 486 | auto-saving of that buffer ``because it has shrunk''. However, | 491 | auto-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 | ||
| 1792 | The argument @var{force} also has an effect if the line isn't long | 1797 | The argument @var{force} also has an effect if the line isn't long |
| 1793 | enough to reach column @var{column}; in that case, it says to add | 1798 | enough to reach column @var{column}; if it is @code{t}, that means to |
| 1794 | whitespace at the end of the line to reach that column. | 1799 | add whitespace at the end of the line to reach that column. |
| 1795 | 1800 | ||
| 1796 | If @var{column} is not an integer, an error is signaled. | 1801 | If @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)} |
| 2542 | You can use the property @code{face} to control the font and color of | 2547 | You can use the property @code{face} to control the font and color of |
| 2543 | text. Its value is a face name or a list of face names. @xref{Faces}, | 2548 | text. @xref{Faces}, for more information. |
| 2544 | for more information. | 2549 | |
| 2550 | In the simplest case, the value is a face name. It can also be a list; | ||
| 2551 | then each element can be any of these possibilities; | ||
| 2552 | |||
| 2553 | @itemize @bullet | ||
| 2554 | @item | ||
| 2555 | A face name (a symbol or string). | ||
| 2545 | 2556 | ||
| 2546 | If 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 | 2558 | Starting in Emacs 21, a property list of face attributes. This has the |
| 2548 | . @var{color-name})}. These elements specify just the foreground color | 2559 | form (@var{keyword} @var{value} @dots{}), where each @var{keyword} is a |
| 2549 | or just the background color; therefore, there is no need to create a | 2560 | face attribute name and @var{value} is a meaningful value for that |
| 2550 | face for each color that you want to use. | 2561 | attribute. With this feature, you do not need to create a face each |
| 2562 | time you want to specify a particular attribute for certain text. | ||
| 2563 | @xref{Face Attributes}. | ||
| 2564 | |||
| 2565 | @item | ||
| 2566 | A cons cell of the form @code{(foreground-color . @var{color-name})} or | ||
| 2567 | @code{(background-color . @var{color-name})}. These elements specify | ||
| 2568 | just 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} |
| 2553 | properties automatically based on the contents of the text. | 2575 | properties automatically based on the contents of the text. |
| @@ -2559,6 +2581,26 @@ mouse is on or near the character. For this purpose, ``near'' means | |||
| 2559 | that all text between the character and where the mouse is have the same | 2581 | that 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)} | ||
| 2586 | This property, if non-@code{nil}, says that text in the buffer has | ||
| 2587 | had 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)} | ||
| 2592 | This property activates various features that change the | ||
| 2593 | way text is displayed. For example, it can make text appear taller | ||
| 2594 | or 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)} | ||
| 2599 | If text has a string as its @code{help-echo} property, then when you | ||
| 2600 | move the mouse onto that text, Emacs displays that string in the echo | ||
| 2601 | area, or in the tooltip window. This feature is used in the mode line. | ||
| 2602 | It 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 |
| 3234 | longer sequence of @sc{ASCII} graphic characters. This section | 3276 | longer sequence of @sc{ascii} graphic characters. This section |
| 3235 | describes the functions for converting to and from this code. | 3277 | describes 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: | |||
| 3377 | This variable is a normal hook that is run whenever a buffer is changed | 3419 | This variable is a normal hook that is run whenever a buffer is changed |
| 3378 | that was previously in the unmodified state. | 3420 | that was previously in the unmodified state. |
| 3379 | @end defvar | 3421 | @end defvar |
| 3422 | |||
| 3423 | @defvar inhibit-modification-hooks | ||
| 3424 | @tindex inhibit-modification-hooks | ||
| 3425 | If this variable is non-@code{nil}, all of the change hooks are | ||
| 3426 | disabled; none of them run. This affects all the hook variables | ||
| 3427 | described above in this section, as well as the hooks attached to | ||
| 3428 | certain special text properties (@pxref{Special Properties}) and overlay | ||
| 3429 | properties (@pxref{Overlay Properties}). | ||
| 3430 | |||
| 3431 | This 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 | |||
| 14 | previous chapters, and describes conventions Emacs Lisp programmers | 14 | previous chapters, and describes conventions Emacs Lisp programmers |
| 15 | should follow. | 15 | should follow. |
| 16 | 16 | ||
| 17 | You can automatically check some of the conventions described below by | ||
| 18 | running the command @kbd{M-x checkdoc RET} when visiting a Lisp file. | ||
| 19 | It cannot check all of the conventions, and not all the warnings it | ||
| 20 | gives necessarily correspond to problems, but it is worth examining them | ||
| 21 | all. | ||
| 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. | |||
| 287 | Try to avoid compiler warnings about undefined free variables, by adding | 293 | Try 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 | ||
| 296 | Sometimes adding a @code{require} for another package is useful to avoid | ||
| 297 | compilation warnings for variables and functions defined in that | ||
| 298 | package. If you do this, often it is better if the @cpde{require} acts | ||
| 299 | only 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 | |||
| 290 | If you bind a variable in one function, and use it or set it in another | 307 | If you bind a variable in one function, and use it or set it in another |
| 291 | function, the compiler warns about the latter function unless the | 308 | function, the compiler warns about the latter function unless the |
| 292 | variable has a definition. But often these variables have short names, | 309 | variable 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 | |||
| 421 | that looks good. | 438 | that looks good. |
| 422 | 439 | ||
| 423 | @item | 440 | @item |
| 424 | For consistency, phrase the verb in the first sentence of a | 441 | For consistency, phrase the verb in the first sentence of a function's |
| 425 | function's documentation string as an infinitive with ``to'' omitted. For | 442 | documentation string as an imperative--for instance, use ``Return the |
| 426 | instance, use ``Return the cons of A and B.'' in preference to ``Returns | 443 | cons of A and B.'' in preference to ``Returns the cons of A and B@.'' |
| 427 | the cons of A and B@.'' Usually it looks good to do likewise for the | 444 | Usually it looks good to do likewise for the rest of the first |
| 428 | rest of the first paragraph. Subsequent paragraphs usually look better | 445 | paragraph. Subsequent paragraphs usually look better if each sentence |
| 429 | if they have proper subjects. | 446 | has a proper subject. |
| 430 | 447 | ||
| 431 | @item | 448 | @item |
| 432 | Write documentation strings in the active voice, not the passive, and in | 449 | Write 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 |
| 486 | actual argument name is @code{divisor}. | 503 | actual argument name is @code{divisor}. |
| 487 | 504 | ||
| 488 | Also use all caps for meta-syntactic variables, such as when you show | 505 | Also use all caps for metasyntactic variables, such as when you show |
| 489 | the decomposition of a list or vector into subunits, some of which may | 506 | the decomposition of a list or vector into subunits, some of which may |
| 490 | vary. | 507 | vary. @samp{KEY} and @samp{VALUE} in the following example |
| 508 | illustrate this practice: | ||
| 509 | |||
| 510 | @example | ||
| 511 | The argument TABLE should be an alist whose elements | ||
| 512 | have 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. | |||
| 537 | does not make a hyperlink to the documentation, irrelevant here, of the | 560 | does not make a hyperlink to the documentation, irrelevant here, of the |
| 538 | function @code{list}. | 561 | function @code{list}. |
| 539 | 562 | ||
| 563 | To make a hyperlink to Info documentation, write the name of the Info | ||
| 564 | node in single quotes, preceded by @samp{info node} or @samp{Info | ||
| 565 | node}. The Info file name defaults to @samp{emacs}. For example, | ||
| 566 | |||
| 567 | @smallexample | ||
| 568 | See Info node `Font Lock' and Info node `(elisp)Font Lock Basics'. | ||
| 569 | @end smallexample | ||
| 570 | |||
| 540 | @item | 571 | @item |
| 541 | Don't write key sequences directly in documentation strings. Instead, | 572 | Don't write key sequences directly in documentation strings. Instead, |
| 542 | use the @samp{\\[@dots{}]} construct to stand for them. For example, | 573 | use 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 |
| 661 | to divide them into sections and give information such as who wrote | 692 | to divide them into sections and give information such as who wrote |
| 662 | them. This section explains these conventions. First, an example: | 693 | them. This section explains these conventions. |
| 694 | |||
| 695 | We'll start with an example, a package that is included in the Emacs | ||
| 696 | distribution. | ||
| 697 | |||
| 698 | Parts of this example reflect its status as part of Emacs; for | ||
| 699 | example, the copyright notice lists the Free Software Foundation as the | ||
| 700 | copyright holder, and the copying permission says the file is part of | ||
| 701 | Emacs. When you write a package and post it, the copyright holder would | ||
| 702 | be you (unless your employer claims to own it instead), and you should | ||
| 703 | get the suggested copying permission from the end of the GNU General | ||
| 704 | Public License itself. Don't say your file is part of Emacs | ||
| 705 | if 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 | |||
| 773 | store the change history there). For most of the Lisp | 818 | store the change history there). For most of the Lisp |
| 774 | files distributed with Emacs, the change history is kept in the file | 819 | files 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 |
| 776 | not have a @samp{;;; Change Log:} line. | 821 | not have a @samp{;;; Change Log:} line. @samp{History} is an |
| 822 | alternative to @samp{Change Log}. | ||
| 777 | 823 | ||
| 778 | @item ;;; Code: | 824 | @item ;;; Code: |
| 779 | This begins the actual code of the program. | 825 | This 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 | |||
| 104 | with @samp{:}. These symbols cannot be rebound, nor can their values be | 104 | with @samp{:}. These symbols cannot be rebound, nor can their values be |
| 105 | changed. Any attempt to set or bind @code{nil} or @code{t} signals a | 105 | changed. 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 |
| 107 | starts with @samp{:}, except that you are allowed to set such a symbol to | 107 | starts with @samp{:} (if it is interned in the standard obarray), except |
| 108 | itself. | 108 | that 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, |
| 564 | the @code{set-variable} command uses that value to control reading the | 564 | the @code{set-variable} command uses that value to control reading the |
| 565 | new value for the variable. The property's value is used as if it were | 565 | new value for the variable. The property's value is used as if it were |
| 566 | to @code{interactive} (@pxref{Using Interactive}). However, this feature | 566 | specified in @code{interactive} (@pxref{Using Interactive}). However, |
| 567 | is largely obsoleted by @code{defcustom} (@pxref{Customization}). | 567 | this 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 |
| 570 | forms are used while the variable has a local binding, they set the | 571 | forms 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 |
| 857 | the source code the binding can be accessed. Indefinite scope means | 856 | the source code the binding can be accessed. ``Indefinite scope'' means |
| 858 | that any part of the program can potentially access the variable | 857 | that any part of the program can potentially access the variable |
| 859 | binding. @dfn{Extent} refers to @emph{when}, as the program is | 858 | binding. @dfn{Extent} refers to @emph{when}, as the program is |
| 860 | executing, the binding exists. Dynamic extent means that the binding | 859 | executing, the binding exists. ``Dynamic extent'' means that the binding |
| 861 | lasts as long as the activation of the construct that established it. | 860 | lasts 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} |
| 906 | may or may not refer to the binding of @code{x} established in | 905 | may 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 |
| 1068 | languages in one form or another. Emacs also supports additional, | 1067 | languages in one form or another. Emacs, however, also supports additional, |
| 1069 | unusual kinds of variable binding: @dfn{buffer-local} bindings, which | 1068 | unusual kinds of variable binding: @dfn{buffer-local} bindings, which |
| 1070 | apply only in one buffer, and frame-local bindings, which apply only in | 1069 | apply only in one buffer, and @dfn{frame-local} bindings, which apply only in |
| 1071 | one frame. Having different values for a variable in different buffers | 1070 | one frame. Having different values for a variable in different buffers |
| 1072 | and/or frames is an important customization method. | 1071 | and/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 |
| 1101 | other buffers. The default binding is shared by all the buffers that | 1100 | other buffers. The default binding is shared by all the buffers that |
| 1102 | don't have their own bindings for the variable. (This includes all | 1101 | don't have their own bindings for the variable. (This includes all |
| 1103 | newly created buffers.) If you set the variable in a buffer that does | 1102 | newly-created buffers.) If you set the variable in a buffer that does |
| 1104 | not have a buffer-local binding for it, this sets the default binding | 1103 | not 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), |
| 1106 | so the new value is visible in all the buffers that see the default | 1105 | so 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 | |||
| 1239 | variables cannot have buffer-local bindings as well. @xref{Multiple | 1238 | variables cannot have buffer-local bindings as well. @xref{Multiple |
| 1240 | Displays}. | 1239 | Displays}. |
| 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 |
| 1243 | variable. Instead, use @code{make-local-hook}. @xref{Hooks}. | 1242 | variable. 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 | |||
| 251 | characters; see @ref{Display Tables}. | 252 | characters; 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 |
| 255 | This function splits the selected window into two windows, one above the | 256 | This function splits the selected window into two windows, one above the |
| 256 | other, leaving the upper of the two windows selected, with @var{size} | 257 | other, leaving the upper of the two windows selected, with @var{size} |
| 257 | lines. (If @var{size} is negative, then the lower of the two windows | 258 | lines. (If @var{size} is negative, then the lower of the two windows |
| 258 | gets @minus{} @var{size} lines and the upper window gets the rest, but | 259 | gets @minus{} @var{size} lines and the upper window gets the rest, but |
| 259 | the upper window is still the one selected.) | 260 | the upper window is still the one selected.) |
| 260 | |||
| 261 | This function is simply an interface to @code{split-window}. | ||
| 262 | Here 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 |
| 275 | This function splits the selected window into two windows | 264 | This function splits the selected window into two windows |
| 276 | side-by-side, leaving the selected window with @var{size} columns. | 265 | side-by-side, leaving the selected window with @var{size} columns. |
| 277 | 266 | ||
| 278 | This function is simply an interface to @code{split-window}. Here is | 267 | This function is basically an interface to @code{split-window}. |
| 279 | the complete definition for @code{split-window-horizontally} (except for | 268 | You could define a simplified version of the function like this: |
| 280 | part 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 | |||
| 565 | include in the cycle, as in @code{next-window}. | 558 | include 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 |
| 569 | This function selects the @var{count}th following window in the cyclic | 562 | This function selects the @var{count}th following window in the cyclic |
| 570 | order. If count is negative, then it moves back @minus{}@var{count} | 563 | order. If count is negative, then it moves back @minus{}@var{count} |
| 571 | windows in the cycle, rather than forward. It returns @code{nil}. | 564 | windows in the cycle, rather than forward. It returns @code{nil}. |
| 572 | 565 | ||
| 566 | The argument @var{all-frames} has the same meaning is as in | ||
| 567 | @code{next-window}, but the @var{minibuf} argument of @code{next-window} | ||
| 568 | is always effectively @code{nil}. | ||
| 569 | |||
| 573 | In an interactive call, @var{count} is the numeric prefix argument. | 570 | In 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 |
| 899 | This variable holds an alist specifying frame parameters used when | 896 | This 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 |
| 901 | more information about frame parameters. | 898 | more information about frame parameters. |
| 902 | @end defvar | 899 | @end defopt |
| 903 | 900 | ||
| 904 | @defopt special-display-buffer-names | 901 | @defopt special-display-buffer-names |
| 905 | A list of buffer names for buffers that should be displayed specially. | 902 | A 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 |
| 942 | This function makes @var{buffer} visible in a frame of its own. If | 939 | This 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 |
| 944 | the frame visible and raises it, to use that window. Otherwise, it | 941 | the frame visible and raises it, to use that window. Otherwise, it |
| 945 | creates a frame that will be dedicated to @var{buffer}. | 942 | creates a frame that will be dedicated to @var{buffer}. |
| 946 | 943 | ||
| 947 | This function uses an existing window displaying @var{buffer} whether or | 944 | If @var{args} is an alist, it specifies frame parameters for the new |
| 948 | not it is in a frame of its own; but if you set up the above variables | 945 | frame. |
| 949 | in your init file, before @var{buffer} was created, then presumably the | 946 | |
| 950 | window was previously made by this function. | 947 | If @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 | ||
| 949 | frame; it is called with @var{buffer} as first argument, and @code{(cdr | ||
| 950 | @var{args})} as additional arguments. | ||
| 951 | |||
| 952 | This function always uses an existing window displaying @var{buffer}, | ||
| 953 | whether or not it is in a frame of its own; but if you set up the above | ||
| 954 | variables in your init file, before @var{buffer} was created, then | ||
| 955 | presumably 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. | |||
| 1035 | when the user switches to another buffer, the cursor jumps to the | 1040 | when the user switches to another buffer, the cursor jumps to the |
| 1036 | position of point in that buffer. | 1041 | position of point in that buffer. |
| 1037 | 1042 | ||
| 1038 | @defun window-point window | 1043 | @defun window-point &optional window |
| 1039 | This function returns the current position of point in @var{window}. | 1044 | This function returns the current position of point in @var{window}. |
| 1040 | For a nonselected window, this is the value point would have (in that | 1045 | For a nonselected window, this is the value point would have (in that |
| 1041 | window's buffer) if that window were selected. | 1046 | window's buffer) if that window were selected. If @var{window} is |
| 1047 | @code{nil}, the selected window is used. | ||
| 1042 | 1048 | ||
| 1043 | When @var{window} is the selected window and its buffer is also the | 1049 | When @var{window} is the selected window and its buffer is also the |
| 1044 | current buffer, the value returned is the same as point in that buffer. | 1050 | current 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 | |||
| 1081 | for the same buffer, or 1 if the buffer doesn't have any. | 1087 | for the same buffer, or 1 if the buffer doesn't have any. |
| 1082 | 1088 | ||
| 1083 | Redisplay updates the window-start position (if you have not specified | 1089 | Redisplay updates the window-start position (if you have not specified |
| 1084 | it explicitly since the previous redisplay) so that point appears on the | 1090 | it explicitly since the previous redisplay)---for example, to make sure |
| 1085 | screen. Nothing except redisplay automatically changes the window-start | 1091 | point appears on the screen. Nothing except redisplay automatically |
| 1086 | position; if you move point, do not expect the window-start position to | 1092 | changes the window-start position; if you move point, do not expect the |
| 1087 | change in response until after the next redisplay. | 1093 | window-start position to change in response until after the next |
| 1094 | redisplay. | ||
| 1088 | 1095 | ||
| 1089 | For a realistic example of using @code{window-start}, see the | 1096 | For a realistic example of using @code{window-start}, see the |
| 1090 | description of @code{count-lines} in @ref{Text Lines}. | 1097 | description of @code{count-lines} in @ref{Text Lines}. |
| @@ -1188,18 +1195,22 @@ argument @var{position} defaults to the current position of point; | |||
| 1188 | The @code{pos-visible-in-window-p} function considers only vertical | 1195 | The @code{pos-visible-in-window-p} function considers only vertical |
| 1189 | scrolling. If @var{position} is out of view only because @var{window} | 1196 | scrolling. If @var{position} is out of view only because @var{window} |
| 1190 | has been scrolled horizontally, @code{pos-visible-in-window-p} returns | 1197 | has 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 | ||
| 1207 | window. It works by changing the value of the window's display-start | ||
| 1208 | location. It may also change the value of @code{window-point} to keep | ||
| 1209 | point 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 |
| 1200 | works by changing the value of the window's display-start location. It | 1212 | changed its name to distinguish it from the new vertical fractional |
| 1201 | may also change the value of @code{window-point} to keep it on the | 1213 | scrolling feature (@pxref{Vertical Scrolling}). |
| 1202 | screen. | ||
| 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 | |||
| 1218 | commands clearly move the text up or down on the screen. We have chosen | 1229 | commands clearly move the text up or down on the screen. We have chosen |
| 1219 | names that fit the user's point of view. | 1230 | names 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 |
| 1222 | unpredictable results if the current buffer is different from the buffer | 1233 | @code{scroll-other-window}) have unpredictable results if the current |
| 1223 | that is displayed in the selected window. @xref{Current Buffer}. | 1234 | buffer is different from the buffer that is displayed in the selected |
| 1235 | window. @xref{Current Buffer}. | ||
| 1224 | 1236 | ||
| 1225 | @deffn Command scroll-up &optional count | 1237 | @deffn Command scroll-up &optional count |
| 1226 | This function scrolls the text in the selected window upward | 1238 | This function scrolls the text in the selected window upward |
| @@ -1251,10 +1263,14 @@ This function scrolls the text in another window upward @var{count} | |||
| 1251 | lines. Negative values of @var{count}, or @code{nil}, are handled | 1263 | lines. Negative values of @var{count}, or @code{nil}, are handled |
| 1252 | as in @code{scroll-up}. | 1264 | as in @code{scroll-up}. |
| 1253 | 1265 | ||
| 1254 | You can specify a buffer to scroll with the variable | 1266 | You 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 |
| 1256 | minibuffer, the next window is normally the one at the top left corner. | 1268 | already displayed, @code{scroll-other-window} displays it in some |
| 1257 | You can specify a different window to scroll with the variable | 1269 | window. |
| 1270 | |||
| 1271 | When the selected window is the minibuffer, the next window is normally | ||
| 1272 | the one at the top left corner. You can specify a different window to | ||
| 1273 | scroll, 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 |
| 1259 | other window is selected. @xref{Minibuffer Misc}. | 1275 | other 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 | ||
| 1377 | window up or down by a specified multiple or fraction of a line. | ||
| 1378 | Starting in Emacs 21, each window has a @dfn{vertical scroll position}, | ||
| 1379 | which is a number, never less than zero. It specifies how far to raise | ||
| 1380 | the contents of the window. Raising the window contents generally makes | ||
| 1381 | all or part of some lines disappear off the top, and all or part of some | ||
| 1382 | other lines appear at the bottom. The usual value is zero. | ||
| 1383 | |||
| 1384 | The vertical scroll position is measured in units of the normal line | ||
| 1385 | height, 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 | ||
| 1387 | height. If it is 3.3, that means the window contents are scrolled up | ||
| 1388 | somewhat over three times the normal line height. | ||
| 1389 | |||
| 1390 | What fraction of a line the vertical scrolling covers, or how many | ||
| 1391 | lines, depends on what the lines contain. A value of .5 could scroll a | ||
| 1392 | line whose height is very short off the screen, while a value of 3.3 | ||
| 1393 | could scroll just part of the way through a tall line or an image. | ||
| 1394 | |||
| 1395 | @defun window-vscroll &optional window | ||
| 1396 | This function returns the current vertical scroll position of | ||
| 1397 | @var{window}, If @var{window} is @code{nil}, the selected window is | ||
| 1398 | used. | ||
| 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 | ||
| 1409 | This function sets @var{window}'s vertical scroll position to | ||
| 1410 | @var{lines}. The argument @var{lines} should be zero or positive; if | ||
| 1411 | not, it is taken as zero. | ||
| 1412 | |||
| 1413 | The actual vertical scroll position must always correspond | ||
| 1414 | to an integral number of pixels, so the value you specify | ||
| 1415 | is rounded accordingly. | ||
| 1416 | |||
| 1417 | The 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 |
| 1361 | from top to bottom in the ``outer loop'', horizontal scrolling is not | 1432 | or right by a specified multiple of the normal character width. Each |
| 1362 | like vertical scrolling. Vertical scrolling involves selection of a | 1433 | window has a @dfn{vertical scroll position}, which is a number, never |
| 1363 | contiguous portion of text to display, but horizontal scrolling causes | 1434 | less than zero. It specifies how far to shift the contents left. |
| 1364 | part of each line to go off screen. The amount of horizontal scrolling | 1435 | Shifting the window contents left generally makes all or part of some |
| 1365 | is therefore specified as a number of columns rather than as a position | 1436 | characters disappear off the left, and all or part of some other |
| 1366 | in the buffer. It has nothing to do with the display-start position | 1437 | characters appear at the right. The usual value is zero. |
| 1367 | returned by @code{window-start}. | 1438 | |
| 1439 | The horizontal scroll position is measured in units of the normal | ||
| 1440 | character width, which is the width of space in the default font. Thus, | ||
| 1441 | if the value is 5, that means the window contents are scrolled left by 5 | ||
| 1442 | times the the normal character width. How many characters actually | ||
| 1443 | disappear off to the left depends on their width, and could vary from | ||
| 1444 | line to line. | ||
| 1445 | |||
| 1446 | Because we read from side to side in the ``inner loop'', and from top | ||
| 1447 | to bottom in the ``outer loop'', the effect of horizontal scrolling is | ||
| 1448 | not like that of textual or vertical scrolling. Textual scrolling | ||
| 1449 | involves selection of a portion of text to display, and vertical | ||
| 1450 | scrolling moves the window contents contiguously; but horizontal | ||
| 1451 | scrolling 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 |
| 1370 | column is at the left edge of the window. In this state, scrolling to | 1454 | column is at the left edge of the window. In this state, scrolling to |
| 1371 | the right is meaningless, since there is no data to the left of the | 1455 | the right is meaningless, since there is no data to the left of the edge |
| 1372 | screen to be revealed by it; so this is not allowed. Scrolling to the | 1456 | to be revealed by it; so this is not allowed. Scrolling to the left is |
| 1373 | left is allowed; it scrolls the first columns of text off the edge of | 1457 | allowed; it scrolls the first columns of text off the edge of the window |
| 1374 | the window and can reveal additional columns on the right that were | 1458 | and can reveal additional columns on the right that were truncated |
| 1375 | truncated before. Once a window has a nonzero amount of leftward | 1459 | before. Once a window has a nonzero amount of leftward horizontal |
| 1376 | horizontal scrolling, you can scroll it back to the right, but only so | 1460 | scrolling, you can scroll it back to the right, but only so far as to |
| 1377 | far as to reduce the net horizontal scroll to zero. There is no limit | 1461 | reduce the net horizontal scroll to zero. There is no limit to how far |
| 1378 | to how far left you can scroll, but eventually all the text will | 1462 | left you can scroll, but eventually all the text will disappear off the |
| 1379 | disappear off the left edge. | 1463 | left edge. |
| 1380 | 1464 | ||
| 1381 | @deffn Command scroll-left count | 1465 | In Emacs 21, redisplay automatically alters the horizontal scrolling |
| 1466 | of a window as necessary to ensure that point is always visible. | ||
| 1467 | However, you can still set the horizontal scrolling value explicitly. | ||
| 1468 | The value you specify will be used, provided it leaves point visible. | ||
| 1469 | |||
| 1470 | @deffn Command scroll-left &optional count | ||
| 1382 | This function scrolls the selected window @var{count} columns to the | 1471 | This function scrolls the selected window @var{count} columns to the |
| 1383 | left (or to the right if @var{count} is negative). The return value is | 1472 | left (or to the right if @var{count} is negative). The default |
| 1384 | the total amount of leftward horizontal scrolling in effect after the | 1473 | for @var{count} is the window width, minus 2. |
| 1385 | change---just like the value returned by @code{window-hscroll} (below). | 1474 | |
| 1475 | The return value is the total amount of leftward horizontal scrolling in | ||
| 1476 | effect 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 |
| 1389 | This function scrolls the selected window @var{count} columns to the | 1481 | This function scrolls the selected window @var{count} columns to the |
| 1390 | right (or to the left if @var{count} is negative). The return value is | 1482 | right (or to the left if @var{count} is negative). The default |
| 1391 | the total amount of leftward horizontal scrolling in effect after the | 1483 | for @var{count} is the window width, minus 2. |
| 1392 | change---just like the value returned by @code{window-hscroll} (below). | 1484 | |
| 1485 | The return value is the total amount of leftward horizontal scrolling in | ||
| 1486 | effect after the change---just like the value returned by | ||
| 1487 | @code{window-hscroll} (below). | ||
| 1393 | 1488 | ||
| 1394 | Once you scroll a window as far right as it can go, back to its normal | 1489 | Once you scroll a window as far right as it can go, back to its normal |
| 1395 | position where the total leftward scrolling is zero, attempts to scroll | 1490 | position 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. | |||
| 1426 | This function sets the number of columns from the left margin that | 1521 | This 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. |
| 1524 | Fractional values of @var{columns} are not supported at present. | ||
| 1429 | 1525 | ||
| 1430 | The value returned is @var{columns}. | 1526 | The 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 | |||
| 1516 | rightmost column used by @var{window}, and @var{bottom} is one more than | 1612 | rightmost column used by @var{window}, and @var{bottom} is one more than |
| 1517 | the bottommost row used by @var{window} and its mode-line. | 1613 | the bottommost row used by @var{window} and its mode-line. |
| 1518 | 1614 | ||
| 1519 | When you have side-by-side windows, the right edge value for a window | 1615 | If a window has a scroll bar, the right edge value includes the width of |
| 1520 | with a neighbor on the right includes the width of the separator between | 1616 | the scroll bar. Otherwise, if the window has a neighbor on the right, |
| 1521 | the window and that neighbor. This separator may be a column of | 1617 | its 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 | 1618 | the window and that neighbor. Since the width of the window does not |
| 1523 | window does not include this separator, the width does not equal the | 1619 | include this separator, the width does not usually equal the difference |
| 1524 | difference between the right and left edges in this case. | 1620 | between the right and left edges. |
| 1525 | 1621 | ||
| 1526 | Here is the result obtained on a typical 24-line terminal with just one | 1622 | Here is the result obtained on a typical 24-line terminal with just one |
| 1527 | window: | 1623 | window: |
| @@ -1538,14 +1634,12 @@ The bottom edge is at line 23 because the last line is the echo area. | |||
| 1538 | 1634 | ||
| 1539 | If @var{window} is at the upper left corner of its frame, then | 1635 | If @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 | 1638 | and @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 | 1639 | following 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. | 1640 | more than 8 columns, the last column of the window (column 7) holds a |
| 1545 | For example, the edges of the following window are @w{@samp{0 0 5 8}}. | 1641 | border rather than text. The last row (row 4) holds the mode line, |
| 1546 | Assuming that the frame has more than 8 columns, the last column of the | 1642 | shown here with @samp{xxxxxxxxx}. |
| 1547 | window (column 7) holds a border rather than text. The last row (row 4) | ||
| 1548 | holds 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 | ||
| 1564 | When there are side-by-side windows, any window not at the right edge of | ||
| 1565 | its frame has a separator in its last column or columns. The separator | ||
| 1566 | counts as one or two columns in the width of the window. A window never | ||
| 1567 | includes a separator on its left, since that belongs to the window to | ||
| 1568 | the left. | ||
| 1569 | |||
| 1570 | In the following example, let's suppose that the frame is 7 | 1658 | In the following example, let's suppose that the frame is 7 |
| 1571 | columns wide. Then the edges of the left window are @w{@samp{0 0 4 3}} | 1659 | columns wide. Then the edges of the left window are @w{@samp{0 0 4 3}} |
| 1572 | and the edges of the right window are @w{@samp{4 0 7 3}}. | 1660 | and 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 | |||
| 1610 | function makes the window occupy the entire height (or width) of the | 1698 | function makes the window occupy the entire height (or width) of the |
| 1611 | frame. | 1699 | frame. |
| 1612 | 1700 | ||
| 1701 | If there are various other windows from which lines or columns can be | ||
| 1702 | stolen, and some of them specify fixed size (using | ||
| 1703 | @code{window-size-fixed}, see below), they are left untouched while | ||
| 1704 | other windows are ``robbed.'' If it would be necessary to alter the | ||
| 1705 | size of a fixed-size window, @code{enlarge-window} gets an error | ||
| 1706 | instead. | ||
| 1707 | |||
| 1613 | If @var{size} is negative, this function shrinks the window by | 1708 | If @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 |
| 1615 | than the minimum size (@code{window-min-height} and | 1710 | than 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 |
| 1656 | This command shrinks @var{window} to be as small as possible while still | 1751 | This command shrinks @var{window} to be as small as possible while still |
| 1657 | showing the full contents of its buffer---but not less than | 1752 | showing 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, |
| 1754 | it defaults to the selected window. | ||
| 1659 | 1755 | ||
| 1660 | However, the command does nothing if the window is already too small to | 1756 | However, the command does nothing if the window is already too small to |
| 1661 | display the whole text of the buffer, or if part of the contents are | 1757 | display 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 | |||
| 1663 | its frame, or if the window is the only window in its frame. | 1759 | its 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 | ||
| 1764 | If this variable is non-@code{nil}, in any given buffer, | ||
| 1765 | then the size of any window displaying the buffer remains fixed | ||
| 1766 | unless you explicitly change it or Emacs has no other choice. | ||
| 1767 | (This feature is new in Emacs 21.) | ||
| 1768 | |||
| 1769 | If the value is @code{height}, then only the window's height is fixed; | ||
| 1770 | if the value is @code{width}, then only the window's width is fixed. | ||
| 1771 | Any other non-@code{nil} value fixes both the width and the height. | ||
| 1772 | |||
| 1773 | The usual way to use this variable is to give it a buffer-local value in | ||
| 1774 | a particular buffer. That way, the windows (but usually there is only | ||
| 1775 | one) displaying that buffer have fixed size. | ||
| 1776 | |||
| 1777 | Explicit size-change functions such as @code{enlarge-window} | ||
| 1778 | get an error if they would have to change a window size which is fixed. | ||
| 1779 | Therefore, when you want to change the size of such a window, | ||
| 1780 | you 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 | |||
| 1787 | Note that changing the frame size will change the size of a | ||
| 1788 | fixed-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 |
| 1668 | functions to a minimum height and width. | 1793 | functions to a minimum height and width. |
| @@ -1721,11 +1846,14 @@ window. | |||
| 1721 | @item mode-line | 1846 | @item mode-line |
| 1722 | The coordinates are in the mode line of @var{window}. | 1847 | The coordinates are in the mode line of @var{window}. |
| 1723 | 1848 | ||
| 1724 | @item vertical-split | 1849 | @item header-line |
| 1850 | The coordinates are in the header line of @var{window}. | ||
| 1851 | |||
| 1852 | @item vertical-line | ||
| 1725 | The coordinates are in the vertical line between @var{window} and its | 1853 | The coordinates are in the vertical line between @var{window} and its |
| 1726 | neighbor to the right. This value occurs only if the window doesn't | 1854 | neighbor to the right. This value occurs only if the window doesn't |
| 1727 | have a scroll bar; positions in a scroll bar are considered outside the | 1855 | have a scroll bar; positions in a scroll bar are considered outside the |
| 1728 | window. | 1856 | window for these purposes. |
| 1729 | 1857 | ||
| 1730 | @item nil | 1858 | @item nil |
| 1731 | The coordinates are not in any part of @var{window}. | 1859 | The coordinates are not in any part of @var{window}. |
| @@ -1750,8 +1878,8 @@ configuration previously saved. | |||
| 1750 | configuration instead of a window configuration. @xref{Frame | 1878 | configuration instead of a window configuration. @xref{Frame |
| 1751 | Configurations}. | 1879 | Configurations}. |
| 1752 | 1880 | ||
| 1753 | @defun current-window-configuration | 1881 | @defun current-window-configuration &optional frame |
| 1754 | This function returns a new object representing the selected frame's | 1882 | This function returns a new object representing @var{frame}'s |
| 1755 | current window configuration, including the number of windows, their | 1883 | current window configuration, including the number of windows, their |
| 1756 | sizes and current buffers, which window is the selected window, and for | 1884 | sizes and current buffers, which window is the selected window, and for |
| 1757 | each window the displayed buffer, the display-start position, and the | 1885 | each 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 |
| 1761 | current buffer, whose value is not saved. | 1889 | current buffer, whose value is not saved. |
| 1890 | |||
| 1891 | If @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 |
| 1765 | This function restores the configuration of windows and buffers as | 1895 | This function restores the configuration of windows and buffers as |
| 1766 | specified by @var{configuration}. The argument @var{configuration} must | 1896 | specified by @var{configuration}, for the frame that @var{configuration} |
| 1767 | be a value that was previously returned by | 1897 | was created for. |
| 1768 | @code{current-window-configuration}. This configuration is restored in | 1898 | |
| 1769 | the frame from which @var{configuration} was made, whether that frame is | 1899 | The argument @var{configuration} must be a value that was previously |
| 1770 | selected or not. This always counts as a window size change and | 1900 | returned by @code{current-window-configuration}. This configuration is |
| 1771 | triggers execution of the @code{window-size-change-functions} | 1901 | restored in the frame from which @var{configuration} was made, whether |
| 1902 | that frame is selected or not. This always counts as a window size | ||
| 1903 | change 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 |
| 1773 | know how to tell whether the new configuration actually differs from the | 1905 | know how to tell whether the new configuration actually differs from the |
| 1774 | old one. | 1906 | old 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 |
| 1918 | This function returns @var{window}'s current end trigger position. | 2050 | This function returns @var{window}'s current end trigger position. |
| 1919 | @end defun | 2051 | @end defun |