diff options
| author | Richard M. Stallman | 1998-05-19 03:45:57 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1998-05-19 03:45:57 +0000 |
| commit | a9f0a989a17f47f9d25b7a426b4e82a8ff684ee4 (patch) | |
| tree | d62b5592064177c684f1509989b223623db3f24c | |
| parent | c6d6572475603083762cb0155ae966de7710bb9c (diff) | |
| download | emacs-a9f0a989a17f47f9d25b7a426b4e82a8ff684ee4.tar.gz emacs-a9f0a989a17f47f9d25b7a426b4e82a8ff684ee4.zip | |
*** empty log message ***
45 files changed, 2392 insertions, 1180 deletions
diff --git a/lispref/advice.texi b/lispref/advice.texi index ffa6606f874..3d61ae41c38 100644 --- a/lispref/advice.texi +++ b/lispref/advice.texi | |||
| @@ -8,25 +8,96 @@ | |||
| 8 | @cindex advising functions | 8 | @cindex advising functions |
| 9 | 9 | ||
| 10 | The @dfn{advice} feature lets you add to the existing definition of a | 10 | The @dfn{advice} feature lets you add to the existing definition of a |
| 11 | function, by @dfn{advising the function}. This a clean method for a | 11 | function, by @dfn{advising the function}. This is a clean method for a |
| 12 | library to customize functions defined by other parts of Emacs---cleaner | 12 | library to customize functions defined by other parts of Emacs---cleaner |
| 13 | than redefining the function in the usual way. | 13 | than redefining the whole function. |
| 14 | 14 | ||
| 15 | Each piece of advice can be enabled or disabled explicitly. The | 15 | Each piece of advice can be enabled or disabled explicitly. The |
| 16 | enabled pieces of advice for any given function actually take effect | 16 | enabled pieces of advice for any given function actually take effect |
| 17 | when you activate advice for that function, or when that function is | 17 | when you activate advice for that function, or when that function is |
| 18 | subsequently defined or redefined. | 18 | subsequently defined or redefined. |
| 19 | 19 | ||
| 20 | @strong{Usage Note:} Advice is useful for altering the behavior of | ||
| 21 | existing calls to an existing function. If you want the new behavior | ||
| 22 | for new calls, or for key bindings, it is cleaner to define a new | ||
| 23 | function (or a new command) which uses the existing function. | ||
| 24 | |||
| 20 | @menu | 25 | @menu |
| 21 | * Defining Advice:: | 26 | * Simple Advice:: A simple example to explain the basics of advice. |
| 22 | * Computed Advice:: | 27 | * Defining Advice:: Detailed description of @code{defadvice}. |
| 23 | * Activation of Advice:: | 28 | * Computed Advice:: ...is to @code{defadvice} as @code{fset} is to @code{defun}. |
| 24 | * Enabling Advice:: | 29 | * Activation of Advice:: Advice doesn't do anything until you activate it. |
| 25 | * Preactivation:: | 30 | * Enabling Advice:: You can enable or disable each piece of advice. |
| 26 | * Argument Access in Advice:: | 31 | * Preactivation:: Preactivation is a way of speeding up the |
| 27 | * Combined Definition:: | 32 | loading of compiled advice. |
| 33 | * Argument Access:: How advice can access the function's arguments. | ||
| 34 | * Subr Arguments:: Accessing arguments when advising a primitive. | ||
| 35 | * Combined Definition:: How advice is implemented. | ||
| 28 | @end menu | 36 | @end menu |
| 29 | 37 | ||
| 38 | @node Simple Advice | ||
| 39 | @section A Simple Advice Example | ||
| 40 | |||
| 41 | The command @code{next-line} moves point down vertically one or more | ||
| 42 | lines; it is the standard binding of @kbd{C-n}. When used on the last | ||
| 43 | line of the buffer, this command inserts a newline to create a line to | ||
| 44 | move to (if @code{next-line-add-newlines} is non-@code{nil}). | ||
| 45 | |||
| 46 | Suppose you wanted to add a similar feature to @code{previous-line}, | ||
| 47 | which would insert a new line at the beginning of the buffer for the | ||
| 48 | command to move to. How could you do this? | ||
| 49 | |||
| 50 | You could do it by redefining the whole function, but that is not | ||
| 51 | modular. The advice feature provides a cleaner alternative: you can | ||
| 52 | effectively add your code to the existing function definition, without | ||
| 53 | actually changing or even seeing that definition. Here is how to do | ||
| 54 | this: | ||
| 55 | |||
| 56 | @example | ||
| 57 | (defadvice previous-line (before next-line-at-end (arg)) | ||
| 58 | "Insert an empty line when moving up from the top line." | ||
| 59 | (if (and next-line-add-newlines (= arg 1) | ||
| 60 | (save-excursion (beginning-of-line) (bobp))) | ||
| 61 | (progn | ||
| 62 | (beginning-of-line) | ||
| 63 | (newline)))) | ||
| 64 | @end example | ||
| 65 | |||
| 66 | @cindex piece of advice | ||
| 67 | This expression defines a @dfn{piece of advice} for the function | ||
| 68 | @code{previous-line}. This piece of advice is named | ||
| 69 | @code{next-line-at-end}, and the symbol @code{before} says that it is | ||
| 70 | @dfn{before-advice} which should run before the regular definition of | ||
| 71 | @code{previous-line}. @code{(arg)} specifies how the advice code can | ||
| 72 | refer to the function's arguments. | ||
| 73 | |||
| 74 | When this piece of advice runs, it creates an additional line, in the | ||
| 75 | situation where that is appropriate, but does not move point to that | ||
| 76 | line. This is the correct way to write the advice, because the normal | ||
| 77 | definition will run afterward and will move back to the newly inserted | ||
| 78 | line. | ||
| 79 | |||
| 80 | Defining the advice doesn't immediately change the function | ||
| 81 | @code{previous-line}. That happens when you @dfn{activate} the advice, | ||
| 82 | like this: | ||
| 83 | |||
| 84 | @example | ||
| 85 | (ad-activate 'previous-line) | ||
| 86 | @end example | ||
| 87 | |||
| 88 | @noindent | ||
| 89 | This is what actually begins to use the advice that has been defined so | ||
| 90 | far for the function @code{previous-line}. Henceforth, whenever that | ||
| 91 | function is run, whether invoked by the user with @kbd{C-p} or | ||
| 92 | @kbd{M-x}, or called from Lisp, it runs the advice first, and its | ||
| 93 | regular definition second. | ||
| 94 | |||
| 95 | This example illustrates before-advice, which is one @dfn{class} of | ||
| 96 | advice: it runs before the function's base definition. There are two | ||
| 97 | other advice classes: @dfn{after-advice}, which runs after the base | ||
| 98 | definition, and @dfn{around-advice}, which lets you specify an | ||
| 99 | expression to wrap around the invocation of the base definition. | ||
| 100 | |||
| 30 | @node Defining Advice | 101 | @node Defining Advice |
| 31 | @section Defining Advice | 102 | @section Defining Advice |
| 32 | 103 | ||
| @@ -50,16 +121,11 @@ form) to be advised. From now on, we will write just ``function'' when | |||
| 50 | describing the entity being advised, but this always includes macros and | 121 | describing the entity being advised, but this always includes macros and |
| 51 | special forms. | 122 | special forms. |
| 52 | 123 | ||
| 53 | The argument @var{name} is the name of the advice, a non-@code{nil} | 124 | @cindex class of advice |
| 54 | symbol. The advice name uniquely identifies one piece of advice, within all | 125 | @cindex before-advice |
| 55 | the pieces of advice in a particular class for a particular | 126 | @cindex after-advice |
| 56 | @var{function}. The name allows you to refer to the piece of | 127 | @cindex around-advice |
| 57 | advice---to redefine it, or to enable or disable it. | 128 | @var{class} specifies the @dfn{class} of the advice---one of @code{before}, |
| 58 | |||
| 59 | Where an ordinary definition has an argument list, an advice definition | ||
| 60 | needs several kinds of information. | ||
| 61 | |||
| 62 | @var{class} specifies the class of the advice---one of @code{before}, | ||
| 63 | @code{after}, or @code{around}. Before-advice runs before the function | 129 | @code{after}, or @code{around}. Before-advice runs before the function |
| 64 | itself; after-advice runs after the function itself; around-advice is | 130 | itself; after-advice runs after the function itself; around-advice is |
| 65 | wrapped around the execution of the function itself. After-advice and | 131 | wrapped around the execution of the function itself. After-advice and |
| @@ -75,6 +141,15 @@ definition is never run. This provides a way to override the original | |||
| 75 | definition completely. (It also overrides lower-positioned pieces of | 141 | definition completely. (It also overrides lower-positioned pieces of |
| 76 | around-advice). | 142 | around-advice). |
| 77 | 143 | ||
| 144 | The argument @var{name} is the name of the advice, a non-@code{nil} | ||
| 145 | symbol. The advice name uniquely identifies one piece of advice, within all | ||
| 146 | the pieces of advice in a particular class for a particular | ||
| 147 | @var{function}. The name allows you to refer to the piece of | ||
| 148 | advice---to redefine it, or to enable or disable it. | ||
| 149 | |||
| 150 | In place of the argument list in an ordinary definition, an advice | ||
| 151 | definition calls for several different pieces of information. | ||
| 152 | |||
| 78 | The optional @var{position} specifies where, in the current list of | 153 | The optional @var{position} specifies where, in the current list of |
| 79 | advice of the specified @var{class}, this new advice should be placed. | 154 | advice of the specified @var{class}, this new advice should be placed. |
| 80 | It should be either @code{first}, @code{last} or a number that | 155 | It should be either @code{first}, @code{last} or a number that |
| @@ -84,35 +159,49 @@ no position is specified, the default is @code{first}. The | |||
| 84 | advice. | 159 | advice. |
| 85 | 160 | ||
| 86 | The optional @var{arglist} can be used to define the argument list for | 161 | The optional @var{arglist} can be used to define the argument list for |
| 87 | the sake of advice. This argument list should of course be compatible | 162 | the sake of advice. This becomes the argument list of the combined |
| 88 | with the argument list of the original function, otherwise functions | 163 | definition that is generated in order to run the advice (@pxref{Combined |
| 89 | that call the advised function with the original argument list in mind | 164 | Definition}). Therefore, the advice expressions can use the argument |
| 90 | will break. If more than one piece of advice specifies an argument | 165 | variables in this list to access argument values. |
| 166 | |||
| 167 | This argument list must be compatible with the argument list of the | ||
| 168 | original function, so that it can handle the ways the function is | ||
| 169 | actually called. If more than one piece of advice specifies an argument | ||
| 91 | list, then the first one (the one with the smallest position) found in | 170 | list, then the first one (the one with the smallest position) found in |
| 92 | the list of all classes of advice will be used. | 171 | the list of all classes of advice is used. Numbers outside the range |
| 172 | are mapped to the beginning or the end, whichever is closer. | ||
| 93 | 173 | ||
| 94 | @var{flags} is a list of symbols that specify further information about | 174 | The remaining elements, @var{flags}, is a list of symbols that specify |
| 95 | how to use this piece of advice. Here are the valid symbols and their | 175 | further information about how to use this piece of advice. Here are the |
| 96 | meanings: | 176 | valid symbols and their meanings: |
| 97 | 177 | ||
| 98 | @table @code | 178 | @table @code |
| 99 | @item activate | 179 | @item activate |
| 100 | Activate all the advice for @var{function} after making this definition. | 180 | Activate the advice for @var{function} now. Changes in a function's |
| 101 | This is ignored when @var{function} itself is not defined yet (which is | 181 | advice always take effect the next time you activate advice for the |
| 102 | known as @dfn{forward advice}). | 182 | function; this flag says to do so, for @var{function}, immediately after |
| 183 | defining this piece of advice. | ||
| 184 | |||
| 185 | @cindex forward advice | ||
| 186 | This flag has no effect if @var{function} itself is not defined yet (a | ||
| 187 | situation known as @dfn{forward advice}), because it is impossible to | ||
| 188 | activate an undefined function's advice. However, defining | ||
| 189 | @var{function} will automatically activate its advice. | ||
| 103 | 190 | ||
| 104 | @item protect | 191 | @item protect |
| 105 | Protect this piece of advice against non-local exits and errors in | 192 | Protect this piece of advice against non-local exits and errors in |
| 106 | preceding code and advice. | 193 | preceding code and advice. Protecting advice makes it a cleanup in an |
| 194 | @code{unwind-protect} form, so that it will execute even if the | ||
| 195 | previous code gets an error or uses @code{throw}. @xref{Cleanups}. | ||
| 107 | 196 | ||
| 108 | @item compile | 197 | @item compile |
| 109 | Says that the combined definition which implements advice should be | 198 | Compile the combined definition that is used to run the advice. This |
| 110 | byte-compiled. This flag is ignored unless @code{activate} is also | 199 | flag is ignored unless @code{activate} is also specified. |
| 111 | specified. | 200 | @xref{Combined Definition}. |
| 112 | 201 | ||
| 113 | @item disable | 202 | @item disable |
| 114 | Disable this piece of advice, so that it will not be used | 203 | Initially disable this piece of advice, so that it will not be used |
| 115 | unless subsequently explicitly enabled. | 204 | unless subsequently explicitly enabled. @xref{Enabling Advice}. |
| 116 | 205 | ||
| 117 | @item preactivate | 206 | @item preactivate |
| 118 | Activate advice for @var{function} when this @code{defadvice} is | 207 | Activate advice for @var{function} when this @code{defadvice} is |
| @@ -124,10 +213,10 @@ This is useful only if this @code{defadvice} is byte-compiled. | |||
| 124 | @end table | 213 | @end table |
| 125 | 214 | ||
| 126 | The optional @var{documentation-string} serves to document this piece of | 215 | The optional @var{documentation-string} serves to document this piece of |
| 127 | advice. If the @code{documentation} function gets the documentation | 216 | advice. When advice is active for @var{function}, the documentation for |
| 128 | for @var{function} when its advice is active, the result will combine | 217 | @var{function} (as returned by @code{documentation}) combines the |
| 129 | the documentation strings of all the advice with that of the original | 218 | documentation strings of all the advice for @var{function} with the |
| 130 | function. | 219 | documentation string of its original function definition. |
| 131 | 220 | ||
| 132 | The optional @var{interactive-form} form can be supplied to change the | 221 | The optional @var{interactive-form} form can be supplied to change the |
| 133 | interactive behavior of the original function. If more than one piece | 222 | interactive behavior of the original function. If more than one piece |
| @@ -162,7 +251,9 @@ this form: | |||
| 162 | @end example | 251 | @end example |
| 163 | 252 | ||
| 164 | Here @var{protected} and @var{enabled} are flags, and @var{definition} | 253 | Here @var{protected} and @var{enabled} are flags, and @var{definition} |
| 165 | is an expression that says what the advice should do. | 254 | is the expression that says what the advice should do. If @var{enabled} |
| 255 | is @code{nil}, this piece of advice is initially disabled | ||
| 256 | (@pxref{Enabling Advice}). | ||
| 166 | 257 | ||
| 167 | If @var{function} already has one or more pieces of advice in the | 258 | If @var{function} already has one or more pieces of advice in the |
| 168 | specified @var{class}, then @var{position} specifies where in the list | 259 | specified @var{class}, then @var{position} specifies where in the list |
| @@ -194,11 +285,12 @@ redefining the function over and over as each advice is added. More | |||
| 194 | importantly, it permits defining advice for a function before that | 285 | importantly, it permits defining advice for a function before that |
| 195 | function is actually defined. | 286 | function is actually defined. |
| 196 | 287 | ||
| 197 | When a function is first activated, its original definition is saved, | 288 | When a function's advice is first activated, the function's original |
| 198 | and all enabled pieces of advice for that function are combined with the | 289 | definition is saved, and all enabled pieces of advice for that function |
| 199 | original definition to make a new definition. This definition is | 290 | are combined with the original definition to make a new definition. |
| 200 | installed, and optionally byte-compiled as well, depending on conditions | 291 | (Pieces of advice that are currently disabled are not used; see |
| 201 | described below. | 292 | @ref{Enabling Advice}.) This definition is installed, and optionally |
| 293 | byte-compiled as well, depending on conditions described below. | ||
| 202 | 294 | ||
| 203 | In all of the commands to activate advice, if @var{compile} is @code{t}, | 295 | In all of the commands to activate advice, if @var{compile} is @code{t}, |
| 204 | the command also compiles the combined definition which implements the | 296 | the command also compiles the combined definition which implements the |
| @@ -208,9 +300,9 @@ advice. | |||
| 208 | This command activates the advice for @var{function}. | 300 | This command activates the advice for @var{function}. |
| 209 | @end deffn | 301 | @end deffn |
| 210 | 302 | ||
| 211 | To activate a function whose advice is already active is not a no-op. | 303 | To activate advice for a function whose advice is already active is not |
| 212 | It is a useful operation which puts into effect any changes in advice | 304 | a no-op. It is a useful operation which puts into effect any changes in |
| 213 | since the previous activation of the same function. | 305 | advice since the previous activation of that function's advice. |
| 214 | 306 | ||
| 215 | @deffn Command ad-deactivate function | 307 | @deffn Command ad-deactivate function |
| 216 | This command deactivates the advice for @var{function}. | 308 | This command deactivates the advice for @var{function}. |
| @@ -239,15 +331,21 @@ function which has at least one piece of advice that matches | |||
| 239 | 331 | ||
| 240 | @deffn Command ad-update-regexp regexp &optional compile | 332 | @deffn Command ad-update-regexp regexp &optional compile |
| 241 | This command activates pieces of advice whose names match @var{regexp}, | 333 | This command activates pieces of advice whose names match @var{regexp}, |
| 242 | but only those that are already activated. | 334 | but only those for functions whose advice is already activated. |
| 243 | @end deffn | ||
| 244 | 335 | ||
| 245 | @deffn Command ad-stop-advice | 336 | Reactivating a function's advice is useful for putting into effect all |
| 246 | Turn off automatic advice activation when a function is defined or | 337 | the changes that have been made in its advice (including enabling and |
| 247 | redefined. | 338 | disabling specific pieces of advice; @pxref{Enabling Advice}) since the |
| 339 | last time it was activated. | ||
| 248 | @end deffn | 340 | @end deffn |
| 249 | 341 | ||
| 250 | @deffn Command ad-start-advice | 342 | @deffn Command ad-start-advice |
| 343 | Turn on automatic advice activation when a function is defined or | ||
| 344 | redefined. If you turn on this mode, then advice really does | ||
| 345 | take effect immediately when defined. | ||
| 346 | @end deffn | ||
| 347 | |||
| 348 | @deffn Command ad-stop-advice | ||
| 251 | Turn off automatic advice activation when a function is defined or | 349 | Turn off automatic advice activation when a function is defined or |
| 252 | redefined. | 350 | redefined. |
| 253 | @end deffn | 351 | @end deffn |
| @@ -275,8 +373,8 @@ the function @code{foo}: | |||
| 275 | (ad-disable-advice 'foo 'before 'my-advice) | 373 | (ad-disable-advice 'foo 'before 'my-advice) |
| 276 | @end example | 374 | @end example |
| 277 | 375 | ||
| 278 | This call by itself only changes the enable flag for this piece of | 376 | This function by itself only changes the enable flag for a piece of |
| 279 | advice. To make this change take effect in the advised definition, you | 377 | advice. To make the change take effect in the advised definition, you |
| 280 | must activate the advice for @code{foo} again: | 378 | must activate the advice for @code{foo} again: |
| 281 | 379 | ||
| 282 | @example | 380 | @example |
| @@ -293,8 +391,10 @@ This command enables the piece of advice named @var{name} in class | |||
| 293 | @var{class} on @var{function}. | 391 | @var{class} on @var{function}. |
| 294 | @end deffn | 392 | @end deffn |
| 295 | 393 | ||
| 296 | You can also disable many pieces of advice at once using a regular | 394 | You can also disable many pieces of advice at once, for various |
| 297 | expression. | 395 | functions, using a regular expression. As always, the changes take real |
| 396 | effect only when you next reactivate advice for the functions in | ||
| 397 | question. | ||
| 298 | 398 | ||
| 299 | @deffn Command ad-disable-regexp regexp | 399 | @deffn Command ad-disable-regexp regexp |
| 300 | This command disables all pieces of advice whose names match | 400 | This command disables all pieces of advice whose names match |
| @@ -322,12 +422,12 @@ same function, and the function's own definition. If the | |||
| 322 | @code{defadvice} is compiled, that compiles the combined definition | 422 | @code{defadvice} is compiled, that compiles the combined definition |
| 323 | also. | 423 | also. |
| 324 | 424 | ||
| 325 | When the function is subsequently activated, if the enabled advice for | 425 | When the function's advice is subsequently activated, if the enabled |
| 326 | the function matches what was used to make this combined | 426 | advice for the function matches what was used to make this combined |
| 327 | definition. then the existing combined definition is used, and there is | 427 | definition, then the existing combined definition is used, thus avoiding |
| 328 | no need to construct one. Thus, preactivation never causes wrong | 428 | the need to construct one. Thus, preactivation never causes wrong |
| 329 | results---but it may fail to do any good, if the enabled advice at the | 429 | results---but it may fail to do any good, if the enabled advice at the |
| 330 | time of activation doesn't match. | 430 | time of activation doesn't match what was used for preactivation. |
| 331 | 431 | ||
| 332 | Here are some symptoms that can indicate that a preactivation did not | 432 | Here are some symptoms that can indicate that a preactivation did not |
| 333 | work properly, because of a mismatch. | 433 | work properly, because of a mismatch. |
| @@ -351,8 +451,8 @@ when you @emph{compile} the preactivated advice. | |||
| 351 | There is no elegant way to find out why preactivated advice is not being | 451 | There is no elegant way to find out why preactivated advice is not being |
| 352 | used. What you can do is to trace the function | 452 | used. What you can do is to trace the function |
| 353 | @code{ad-cache-id-verification-code} (with the function | 453 | @code{ad-cache-id-verification-code} (with the function |
| 354 | @code{trace-function-background}) before the advised function is | 454 | @code{trace-function-background}) before the advised function's advice |
| 355 | activated. After activation, check the value returned by | 455 | is activated. After activation, check the value returned by |
| 356 | @code{ad-cache-id-verification-code} for that function: @code{verified} | 456 | @code{ad-cache-id-verification-code} for that function: @code{verified} |
| 357 | means that the preactivated advice was used, while other values give | 457 | means that the preactivated advice was used, while other values give |
| 358 | some information about why they were considered inappropriate. | 458 | some information about why they were considered inappropriate. |
| @@ -376,6 +476,13 @@ disadvantage: it is not robust, because it hard-codes the argument names | |||
| 376 | into the advice. If the definition of the original function changes, | 476 | into the advice. If the definition of the original function changes, |
| 377 | the advice might break. | 477 | the advice might break. |
| 378 | 478 | ||
| 479 | Another method is to specify an argument list in the advice itself. | ||
| 480 | This avoids the need to know the original function definition's argument | ||
| 481 | names, but it has a limitation: all the advice on any particular | ||
| 482 | function must use the same argument list, because the argument list | ||
| 483 | actually used for all the advice comes from the first piece of advice | ||
| 484 | for that function. | ||
| 485 | |||
| 379 | A more robust method is to use macros that are translated into the | 486 | A more robust method is to use macros that are translated into the |
| 380 | proper access forms at activation time, i.e., when constructing the | 487 | proper access forms at activation time, i.e., when constructing the |
| 381 | advised definition. Access macros access actual arguments by position | 488 | advised definition. Access macros access actual arguments by position |
| @@ -456,7 +563,8 @@ will be 3, and @var{r} will be @code{(2 1 0)} inside the body of | |||
| 456 | These argument constructs are not really implemented as Lisp macros. | 563 | These argument constructs are not really implemented as Lisp macros. |
| 457 | Instead they are implemented specially by the advice mechanism. | 564 | Instead they are implemented specially by the advice mechanism. |
| 458 | 565 | ||
| 459 | @subsection Definition of Subr Argument Lists | 566 | @node Subr Arguments |
| 567 | @section Definition of Subr Argument Lists | ||
| 460 | 568 | ||
| 461 | When the advice facility constructs the combined definition, it needs | 569 | When the advice facility constructs the combined definition, it needs |
| 462 | to know the argument list of the original function. This is not always | 570 | to know the argument list of the original function. This is not always |
diff --git a/lispref/anti.texi b/lispref/anti.texi index df81194f29d..d93e99cf962 100644 --- a/lispref/anti.texi +++ b/lispref/anti.texi | |||
| @@ -7,7 +7,7 @@ | |||
| 7 | 7 | ||
| 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 19.34. We hope you will enjoy the greater |
| 10 | simplicity that results from the absence of many Emacs 19 features. In | 10 | simplicity that results from the absence of many Emacs 20 features. In |
| 11 | the following section, we carry this information back as far as Emacs | 11 | the following section, we carry this information back as far as Emacs |
| 12 | 19.29, for which the previous printed edition of this manual was made. | 12 | 19.29, for which the previous printed edition of this manual was made. |
| 13 | 13 | ||
| @@ -29,9 +29,10 @@ Within this range, there are no invalid character codes. | |||
| 29 | @item | 29 | @item |
| 30 | The Custom facility has been replaced with a much simpler and more | 30 | The Custom facility has been replaced with a much simpler and more |
| 31 | general method of defining user option variables. Instead of | 31 | general method of defining user option variables. Instead of |
| 32 | @code{defcustom}, which requires you to specify each user option's | 32 | @code{defcustom}, which requires you to specify each user option's data |
| 33 | data type and classify them into groups, all you have to do is write | 33 | type and classify options into groups, all you have to do is write a |
| 34 | a @code{defvar} and start the documentation string with @samp{*}. | 34 | @code{defvar}. You should still start the documentation string with |
| 35 | @samp{*}, though. | ||
| 35 | @end itemize | 36 | @end itemize |
| 36 | 37 | ||
| 37 | Here are changes in the Lisp language itself: | 38 | Here are changes in the Lisp language itself: |
| @@ -138,7 +139,7 @@ directory name from the beginning of the file name---just like | |||
| 138 | We have got rid of the function @code{access-file}. | 139 | We have got rid of the function @code{access-file}. |
| 139 | 140 | ||
| 140 | @item | 141 | @item |
| 141 | Most of the minibuffer input functions, no longer take a default value as | 142 | Most of the minibuffer input functions no longer take a default value as |
| 142 | an argument. Also, they do not discard text properties from the result. | 143 | an argument. Also, they do not discard text properties from the result. |
| 143 | This means that if you insert text with text properties into the minibuffer, | 144 | This means that if you insert text with text properties into the minibuffer, |
| 144 | the minibuffer value really will contain text properties. | 145 | the minibuffer value really will contain text properties. |
diff --git a/lispref/backups.texi b/lispref/backups.texi index 9707ade9eef..3cdd88d5c08 100644 --- a/lispref/backups.texi +++ b/lispref/backups.texi | |||
| @@ -289,7 +289,8 @@ This function returns a string that is the name to use for a | |||
| 289 | non-numbered backup file for file @var{filename}. On Unix, this is just | 289 | non-numbered backup file for file @var{filename}. On Unix, this is just |
| 290 | @var{filename} with a tilde appended. | 290 | @var{filename} with a tilde appended. |
| 291 | 291 | ||
| 292 | The standard definition of this function is as follows: | 292 | The standard definition of this function, on most operating systems, is |
| 293 | as follows: | ||
| 293 | 294 | ||
| 294 | @smallexample | 295 | @smallexample |
| 295 | @group | 296 | @group |
| @@ -306,7 +307,9 @@ to prepend a @samp{.} in addition to appending a tilde: | |||
| 306 | @smallexample | 307 | @smallexample |
| 307 | @group | 308 | @group |
| 308 | (defun make-backup-file-name (filename) | 309 | (defun make-backup-file-name (filename) |
| 309 | (concat "." filename "~")) | 310 | (expand-file-name |
| 311 | (concat "." (file-name-nondirectory filename) "~") | ||
| 312 | (file-name-directory filename))) | ||
| 310 | @end group | 313 | @end group |
| 311 | 314 | ||
| 312 | @group | 315 | @group |
| @@ -314,6 +317,11 @@ to prepend a @samp{.} in addition to appending a tilde: | |||
| 314 | @result{} ".backups.texi~" | 317 | @result{} ".backups.texi~" |
| 315 | @end group | 318 | @end group |
| 316 | @end smallexample | 319 | @end smallexample |
| 320 | |||
| 321 | Some parts of Emacs, including some Dired commands, assume that backup | ||
| 322 | file names end with @samp{~}. If you do not follow that convention, it | ||
| 323 | will not cause serious problems, but these commands may give | ||
| 324 | less-than-desirable results. | ||
| 317 | @end defun | 325 | @end defun |
| 318 | 326 | ||
| 319 | @defun find-backup-file-name filename | 327 | @defun find-backup-file-name filename |
diff --git a/lispref/buffers.texi b/lispref/buffers.texi index 600ff3e54b5..c54f1e6b9b0 100644 --- a/lispref/buffers.texi +++ b/lispref/buffers.texi | |||
| @@ -47,9 +47,9 @@ not be displayed in any windows. | |||
| 47 | 47 | ||
| 48 | Buffers in Emacs editing are objects that have distinct names and hold | 48 | Buffers in Emacs editing are objects that have distinct names and hold |
| 49 | text that can be edited. Buffers appear to Lisp programs as a special | 49 | text that can be edited. Buffers appear to Lisp programs as a special |
| 50 | data type. You can think of the contents of a buffer as an extendable | 50 | data type. You can think of the contents of a buffer as a string that |
| 51 | string; insertions and deletions may occur in any part of the buffer. | 51 | you can extend; insertions and deletions may occur in any part of the |
| 52 | @xref{Text}. | 52 | buffer. @xref{Text}. |
| 53 | 53 | ||
| 54 | A Lisp buffer object contains numerous pieces of information. Some of | 54 | A Lisp buffer object contains numerous pieces of information. Some of |
| 55 | this information is directly accessible to the programmer through | 55 | this information is directly accessible to the programmer through |
| @@ -112,7 +112,7 @@ the subroutine does not change which buffer is current (unless, of | |||
| 112 | course, that is the subroutine's purpose). Therefore, you should | 112 | course, that is the subroutine's purpose). Therefore, you should |
| 113 | normally use @code{set-buffer} within a @code{save-current-buffer} or | 113 | normally use @code{set-buffer} within a @code{save-current-buffer} or |
| 114 | @code{save-excursion} (@pxref{Excursions}) form that will restore the | 114 | @code{save-excursion} (@pxref{Excursions}) form that will restore the |
| 115 | current buffer when your function is done . Here is an example, the | 115 | current buffer when your function is done. Here is an example, the |
| 116 | code for the command @code{append-to-buffer} (with the documentation | 116 | code for the command @code{append-to-buffer} (with the documentation |
| 117 | string abridged): | 117 | string abridged): |
| 118 | 118 | ||
| @@ -201,8 +201,8 @@ An error is signaled if @var{buffer-or-name} does not identify an | |||
| 201 | existing buffer. | 201 | existing buffer. |
| 202 | @end defun | 202 | @end defun |
| 203 | 203 | ||
| 204 | @defspec save-current-buffer body... | ||
| 204 | @tindex save-current-buffer | 205 | @tindex save-current-buffer |
| 205 | @defmac save-current-buffer body... | ||
| 206 | The @code{save-current-buffer} macro saves the identity of the current | 206 | The @code{save-current-buffer} macro saves the identity of the current |
| 207 | buffer, evaluates the @var{body} forms, and finally restores that buffer | 207 | buffer, evaluates the @var{body} forms, and finally restores that buffer |
| 208 | as current. The return value is the value of the last form in | 208 | as current. The return value is the value of the last form in |
| @@ -215,8 +215,8 @@ of course. Instead, whichever buffer was current just before exit | |||
| 215 | remains current. | 215 | remains current. |
| 216 | @end defmac | 216 | @end defmac |
| 217 | 217 | ||
| 218 | @tindex with-current-buffer | ||
| 219 | @defmac with-current-buffer buffer body... | 218 | @defmac with-current-buffer buffer body... |
| 219 | @tindex with-current-buffer | ||
| 220 | The @code{with-current-buffer} macro saves the identity of the current | 220 | The @code{with-current-buffer} macro saves the identity of the current |
| 221 | buffer, makes @var{buffer} current, evaluates the @var{body} forms, and | 221 | buffer, makes @var{buffer} current, evaluates the @var{body} forms, and |
| 222 | finally restores the buffer. The return value is the value of the last | 222 | finally restores the buffer. The return value is the value of the last |
| @@ -224,8 +224,8 @@ form in @var{body}. The current buffer is restored even in case of an | |||
| 224 | abnormal exit via @code{throw} or error (@pxref{Nonlocal Exits}). | 224 | abnormal exit via @code{throw} or error (@pxref{Nonlocal Exits}). |
| 225 | @end defmac | 225 | @end defmac |
| 226 | 226 | ||
| 227 | @tindex with-temp-buffer | ||
| 228 | @defmac with-temp-buffer body... | 227 | @defmac with-temp-buffer body... |
| 228 | @tindex with-temp-buffer | ||
| 229 | The @code{with-temp-buffer} macro evaluates the @var{body} forms | 229 | The @code{with-temp-buffer} macro evaluates the @var{body} forms |
| 230 | with a temporary buffer as the current buffer. It saves the identity of | 230 | with a temporary buffer as the current buffer. It saves the identity of |
| 231 | the current buffer, creates a temporary buffer and makes it current, | 231 | the current buffer, creates a temporary buffer and makes it current, |
diff --git a/lispref/commands.texi b/lispref/commands.texi index 29e43d4dfc7..49c9d3c16e3 100644 --- a/lispref/commands.texi +++ b/lispref/commands.texi | |||
| @@ -332,6 +332,10 @@ Prompt. | |||
| 332 | @item F | 332 | @item F |
| 333 | A file name. The file need not exist. Completion, Default, Prompt. | 333 | A file name. The file need not exist. Completion, Default, Prompt. |
| 334 | 334 | ||
| 335 | @item i | ||
| 336 | An irrelevant argument. This code always supplies @code{nil} as | ||
| 337 | the argument's value. No I/O. | ||
| 338 | |||
| 335 | @item k | 339 | @item k |
| 336 | A key sequence (@pxref{Keymap Terminology}). This keeps reading events | 340 | A key sequence (@pxref{Keymap Terminology}). This keeps reading events |
| 337 | until a command (or undefined command) is found in the current key | 341 | until a command (or undefined command) is found in the current key |
| @@ -408,6 +412,16 @@ Minibuffer}. Prompt. | |||
| 408 | @cindex evaluated expression argument | 412 | @cindex evaluated expression argument |
| 409 | A Lisp form is read as with @kbd{x}, but then evaluated so that its | 413 | A Lisp form is read as with @kbd{x}, but then evaluated so that its |
| 410 | value becomes the argument for the command. Prompt. | 414 | value becomes the argument for the command. Prompt. |
| 415 | |||
| 416 | @item z | ||
| 417 | A coding system name (a symbol). If the user enters null input, the | ||
| 418 | argument value is @code{nil}. @xref{Coding Systems}. Completion, | ||
| 419 | Existing, Prompt. | ||
| 420 | |||
| 421 | @item Z | ||
| 422 | A coding system name (a symbol)---but only if this command has a prefix | ||
| 423 | argument. With no prefix argument, @samp{Z} provides @code{nil} as the | ||
| 424 | argument value. Completion, Existing, Prompt. | ||
| 411 | @end table | 425 | @end table |
| 412 | 426 | ||
| 413 | @node Interactive Examples | 427 | @node Interactive Examples |
| @@ -758,8 +772,15 @@ are characters or symbols; mouse events are always lists. This section | |||
| 758 | describes the representation and meaning of input events in detail. | 772 | describes the representation and meaning of input events in detail. |
| 759 | 773 | ||
| 760 | @defun eventp object | 774 | @defun eventp object |
| 761 | This function returns non-@code{nil} if @var{object} is an input event. | 775 | This function returns non-@code{nil} if @var{object} is an input event |
| 762 | A symbol | 776 | or event type. |
| 777 | |||
| 778 | Note that any symbol might be used as an event or an event type. | ||
| 779 | @code{eventp} cannot distinguish whether a symbol is intended by Lisp | ||
| 780 | code to be used as an event. Instead, it distinguishes whether the | ||
| 781 | symbol has actually been used in an event that has been read as input in | ||
| 782 | the current Emacs session. If a symbol has not yet been so used, | ||
| 783 | @code{eventp} returns @code{nil}. | ||
| 763 | @end defun | 784 | @end defun |
| 764 | 785 | ||
| 765 | @menu | 786 | @menu |
| @@ -1314,6 +1335,36 @@ want to. | |||
| 1314 | This kind of event indicates that the user deiconified @var{frame} using | 1335 | This kind of event indicates that the user deiconified @var{frame} using |
| 1315 | the window manager. Its standard definition is @code{ignore}; since the | 1336 | the window manager. Its standard definition is @code{ignore}; since the |
| 1316 | frame has already been made visible, Emacs has no work to do. | 1337 | frame has already been made visible, Emacs has no work to do. |
| 1338 | |||
| 1339 | @cindex @code{mouse-wheel} event | ||
| 1340 | @item (mouse-wheel @var{position} @var{delta}) | ||
| 1341 | This kind of event is generated by moving a wheel on a mouse (such as | ||
| 1342 | the MS Intellimouse). Its effect is typically a kind of scroll or zoom. | ||
| 1343 | |||
| 1344 | The element @var{delta} describes the amount and direction of the wheel | ||
| 1345 | rotation. Its absolute value is the number of increments by which the | ||
| 1346 | wheel was rotated. A negative @var{delta} indicates that the wheel was | ||
| 1347 | rotated backwards, towards the user, and a positive @var{delta} | ||
| 1348 | indicates that the wheel was rotated forward, away from the user. | ||
| 1349 | |||
| 1350 | The element @var{position} is a list describing the position of the | ||
| 1351 | event, in the same format as used in a mouse-click event. | ||
| 1352 | |||
| 1353 | This kind of event is generated only on some kinds of systems. | ||
| 1354 | |||
| 1355 | @cindex @code{drag-n-drop} event | ||
| 1356 | @item (drag-n-drop @var{position} @var{files}) | ||
| 1357 | This kind of event is generated when a group of files is | ||
| 1358 | selected in an application outside of Emacs, and then dragged and | ||
| 1359 | dropped onto an Emacs frame. | ||
| 1360 | |||
| 1361 | The element @var{position} is a list describing the position of the | ||
| 1362 | event, in the same format as used in a mouse-click event, and | ||
| 1363 | @var{files} is the list of file names that were dragged and dropped. | ||
| 1364 | The usual way to handle this event is by visiting these files. | ||
| 1365 | |||
| 1366 | This kind of event is generated, at present, only on some kinds of | ||
| 1367 | systems. | ||
| 1317 | @end table | 1368 | @end table |
| 1318 | 1369 | ||
| 1319 | If one of these events arrives in the middle of a key sequence---that | 1370 | If one of these events arrives in the middle of a key sequence---that |
| @@ -1559,7 +1610,7 @@ by not storing keyboard events in strings. Here is how to do that: | |||
| 1559 | @itemize @bullet | 1610 | @itemize @bullet |
| 1560 | @item | 1611 | @item |
| 1561 | Use vectors instead of strings for key sequences, when you plan to use | 1612 | Use vectors instead of strings for key sequences, when you plan to use |
| 1562 | them for anything other than as arguments @code{lookup-key} and | 1613 | them for anything other than as arguments to @code{lookup-key} and |
| 1563 | @code{define-key}. For example, you can use | 1614 | @code{define-key}. For example, you can use |
| 1564 | @code{read-key-sequence-vector} instead of @code{read-key-sequence}, and | 1615 | @code{read-key-sequence-vector} instead of @code{read-key-sequence}, and |
| 1565 | @code{this-command-keys-vector} instead of @code{this-command-keys}. | 1616 | @code{this-command-keys-vector} instead of @code{this-command-keys}. |
| @@ -1776,8 +1827,8 @@ this Emacs session. This includes key sequences read from the terminal | |||
| 1776 | and key sequences read from keyboard macros being executed. | 1827 | and key sequences read from keyboard macros being executed. |
| 1777 | @end defvar | 1828 | @end defvar |
| 1778 | 1829 | ||
| 1779 | @tindex num-nonmacro-input-events | ||
| 1780 | @defvar num-nonmacro-input-events | 1830 | @defvar num-nonmacro-input-events |
| 1831 | @tindex num-nonmacro-input-events | ||
| 1781 | This variable holds the total number of input events received so far | 1832 | This variable holds the total number of input events received so far |
| 1782 | from the terminal---not counting those generated by keyboard macros. | 1833 | from the terminal---not counting those generated by keyboard macros. |
| 1783 | @end defvar | 1834 | @end defvar |
| @@ -1803,6 +1854,12 @@ If @code{cursor-in-echo-area} is non-@code{nil}, then @code{read-event} | |||
| 1803 | moves the cursor temporarily to the echo area, to the end of any message | 1854 | moves the cursor temporarily to the echo area, to the end of any message |
| 1804 | displayed there. Otherwise @code{read-event} does not move the cursor. | 1855 | displayed there. Otherwise @code{read-event} does not move the cursor. |
| 1805 | 1856 | ||
| 1857 | If @code{read-event} gets an event is defined as a help character, in | ||
| 1858 | some cases @code{read-event} processes the event directly without | ||
| 1859 | returning. @xref{Help Functions}. Certain other events, called | ||
| 1860 | @dfn{special events}, are also processed directly within | ||
| 1861 | @code{read-event} (@pxref{Special Events}). | ||
| 1862 | |||
| 1806 | Here is what happens if you call @code{read-event} and then press the | 1863 | Here is what happens if you call @code{read-event} and then press the |
| 1807 | right-arrow function key: | 1864 | right-arrow function key: |
| 1808 | 1865 | ||
| @@ -2506,9 +2563,10 @@ the command to be considered complex. | |||
| 2506 | @defvar command-history | 2563 | @defvar command-history |
| 2507 | This variable's value is a list of recent complex commands, each | 2564 | This variable's value is a list of recent complex commands, each |
| 2508 | represented as a form to evaluate. It continues to accumulate all | 2565 | represented as a form to evaluate. It continues to accumulate all |
| 2509 | complex commands for the duration of the editing session, but all but | 2566 | complex commands for the duration of the editing session, but when it |
| 2510 | the first (most recent) thirty elements are deleted when a garbage | 2567 | reaches the maximum size (specified by the variable |
| 2511 | collection takes place (@pxref{Garbage Collection}). | 2568 | @code{history-length}), the oldest elements are deleted as new ones are |
| 2569 | added. | ||
| 2512 | 2570 | ||
| 2513 | @example | 2571 | @example |
| 2514 | @group | 2572 | @group |
diff --git a/lispref/compile.texi b/lispref/compile.texi index 007a4a6b094..001466d500d 100644 --- a/lispref/compile.texi +++ b/lispref/compile.texi | |||
| @@ -3,7 +3,7 @@ | |||
| 3 | @c Copyright (C) 1990, 1991, 1992, 1993, 1994 Free Software Foundation, Inc. | 3 | @c Copyright (C) 1990, 1991, 1992, 1993, 1994 Free Software Foundation, Inc. |
| 4 | @c See the file elisp.texi for copying conditions. | 4 | @c See the file elisp.texi for copying conditions. |
| 5 | @setfilename ../info/compile | 5 | @setfilename ../info/compile |
| 6 | @node Byte Compilation, Advising, Loading, Top | 6 | @node Byte Compilation, Advising Functions, Loading, Top |
| 7 | @chapter Byte Compilation | 7 | @chapter Byte Compilation |
| 8 | @cindex byte-code | 8 | @cindex byte-code |
| 9 | @cindex compilation | 9 | @cindex compilation |
| @@ -20,6 +20,12 @@ hardware (as true compiled code is), byte-code is completely | |||
| 20 | transportable from machine to machine without recompilation. It is not, | 20 | transportable from machine to machine without recompilation. It is not, |
| 21 | however, as fast as true compiled code. | 21 | however, as fast as true compiled code. |
| 22 | 22 | ||
| 23 | Compiling a Lisp file with the Emacs byte compiler always reads the | ||
| 24 | file as multibyte text, even if Emacs was started with @samp{--unibyte}, | ||
| 25 | unless the file specifies otherwise. This is so that compilation gives | ||
| 26 | results compatible with running the same file without compilation. | ||
| 27 | @xref{Loading Non-ASCII}. | ||
| 28 | |||
| 23 | In general, any version of Emacs can run byte-compiled code produced | 29 | In general, any version of Emacs can run byte-compiled code produced |
| 24 | by recent earlier versions of Emacs, but the reverse is not true. A | 30 | by recent earlier versions of Emacs, but the reverse is not true. A |
| 25 | major incompatible change was introduced in Emacs version 19.29, and | 31 | major incompatible change was introduced in Emacs version 19.29, and |
| @@ -164,9 +170,10 @@ function. | |||
| 164 | @end deffn | 170 | @end deffn |
| 165 | 171 | ||
| 166 | @deffn Command byte-compile-file filename | 172 | @deffn Command byte-compile-file filename |
| 167 | This function compiles a file of Lisp code named @var{filename} into | 173 | This function compiles a file of Lisp code named @var{filename} into a |
| 168 | a file of byte-code. The output file's name is made by appending | 174 | file of byte-code. The output file's name is made by changing the |
| 169 | @samp{c} to the end of @var{filename}. | 175 | @samp{.el} suffix into @samp{.elc}; if @var{filename} does not end in |
| 176 | @samp{.el}, it adds @samp{.elc} to the end of @var{filename}. | ||
| 170 | 177 | ||
| 171 | Compilation works by reading the input file one form at a time. If it | 178 | Compilation works by reading the input file one form at a time. If it |
| 172 | is a definition of a function or macro, the compiled function or macro | 179 | is a definition of a function or macro, the compiled function or macro |
diff --git a/lispref/control.texi b/lispref/control.texi index 1fbb668da0f..a824e79f6f2 100644 --- a/lispref/control.texi +++ b/lispref/control.texi | |||
| @@ -172,8 +172,8 @@ never evaluated---it is ignored. Thus, in the example below, | |||
| 172 | @end example | 172 | @end example |
| 173 | @end defspec | 173 | @end defspec |
| 174 | 174 | ||
| 175 | @tindex when | ||
| 176 | @defmac when condition then-forms@dots{} | 175 | @defmac when condition then-forms@dots{} |
| 176 | @tindex when | ||
| 177 | This is a variant of @code{if} where there are no @var{else-forms}, | 177 | This is a variant of @code{if} where there are no @var{else-forms}, |
| 178 | and possibly several @var{then-forms}. In particular, | 178 | and possibly several @var{then-forms}. In particular, |
| 179 | 179 | ||
| @@ -189,8 +189,8 @@ is entirely equivalent to | |||
| 189 | @end example | 189 | @end example |
| 190 | @end defmac | 190 | @end defmac |
| 191 | 191 | ||
| 192 | @tindex condition | ||
| 193 | @defmac unless condition forms@dots{} | 192 | @defmac unless condition forms@dots{} |
| 193 | @tindex condition | ||
| 194 | This is a variant of @code{if} where there is no @var{then-form}: | 194 | This is a variant of @code{if} where there is no @var{then-form}: |
| 195 | 195 | ||
| 196 | @example | 196 | @example |
| @@ -550,10 +550,10 @@ have several ways of transferring control nonsequentially: @code{return}, | |||
| 550 | 550 | ||
| 551 | @defspec catch tag body@dots{} | 551 | @defspec catch tag body@dots{} |
| 552 | @cindex tag on run time stack | 552 | @cindex tag on run time stack |
| 553 | @code{catch} establishes a return point for the @code{throw} function. The | 553 | @code{catch} establishes a return point for the @code{throw} function. |
| 554 | return point is distinguished from other such return points by @var{tag}, | 554 | The return point is distinguished from other such return points by |
| 555 | which may be any Lisp object. The argument @var{tag} is evaluated normally | 555 | @var{tag}, which may be any Lisp object except @code{nil}. The argument |
| 556 | before the return point is established. | 556 | @var{tag} is evaluated normally before the return point is established. |
| 557 | 557 | ||
| 558 | With the return point in effect, @code{catch} evaluates the forms of the | 558 | With the return point in effect, @code{catch} evaluates the forms of the |
| 559 | @var{body} in textual order. If the forms execute normally, without | 559 | @var{body} in textual order. If the forms execute normally, without |
diff --git a/lispref/customize.texi b/lispref/customize.texi index 2b61848d643..dffd3de49a3 100644 --- a/lispref/customize.texi +++ b/lispref/customize.texi | |||
| @@ -31,6 +31,10 @@ The keyword @code{:tag} is an exception because any given item can only | |||
| 31 | display one name. | 31 | display one name. |
| 32 | 32 | ||
| 33 | @table @code | 33 | @table @code |
| 34 | @item :tag @var{name} | ||
| 35 | Use @var{name}, a string, instead of the item's name, to label the item | ||
| 36 | in customization menus and buffers. | ||
| 37 | |||
| 34 | @item :group @var{group} | 38 | @item :group @var{group} |
| 35 | Put this customization item in group @var{group}. When you use | 39 | Put this customization item in group @var{group}. When you use |
| 36 | @code{:group} in a @code{defgroup}, it makes the new group a subgroup of | 40 | @code{:group} in a @code{defgroup}, it makes the new group a subgroup of |
| @@ -48,10 +52,6 @@ other documentation. | |||
| 48 | There are three alternatives you can use for @var{link-data}: | 52 | There are three alternatives you can use for @var{link-data}: |
| 49 | 53 | ||
| 50 | @table @code | 54 | @table @code |
| 51 | @item :tag @var{name} | ||
| 52 | Use @var{name}, a string, instead of the item's name, to label the item | ||
| 53 | in customization menus and buffers. | ||
| 54 | |||
| 55 | @item (custom-manual @var{info-node}) | 55 | @item (custom-manual @var{info-node}) |
| 56 | Link to an Info node; @var{info-node} is a string which specifies the | 56 | Link to an Info node; @var{info-node} is a string which specifies the |
| 57 | node name, as in @code{"(emacs)Top"}. The link appears as | 57 | node name, as in @code{"(emacs)Top"}. The link appears as |
| @@ -109,23 +109,22 @@ keyword. | |||
| 109 | 109 | ||
| 110 | The way to declare new customization groups is with @code{defgroup}. | 110 | The way to declare new customization groups is with @code{defgroup}. |
| 111 | 111 | ||
| 112 | @tindex defgroup | ||
| 113 | @defmac defgroup group members doc [keyword value]... | 112 | @defmac defgroup group members doc [keyword value]... |
| 113 | @tindex defgroup | ||
| 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. |
| 117 | 117 | ||
| 118 | The arguments @var{members} can be an alist whose elements specify | 118 | The argument @var{members} is a list specifying an initial set of |
| 119 | customization items to be members of the group; however, normally | 119 | customization items to be members of the group. However, most often |
| 120 | @var{members} is @code{nil}, and you specify the group's members by | 120 | @var{members} is @code{nil}, and you specify the group's members by |
| 121 | using the @code{:group} keyword when defining those members. | 121 | using the @code{:group} keyword when defining those members. |
| 122 | 122 | ||
| 123 | @ignore | 123 | If you want to specify group members through @var{members}, each element |
| 124 | @code{(@var{name} @var{widget})}. Here @var{name} is a symbol, and | 124 | should have the form @code{(@var{name} @var{widget})}. Here @var{name} |
| 125 | @var{widget} is a widget for editing that symbol. Useful widgets are | 125 | is a symbol, and @var{widget} is a widget type for editing that symbol. |
| 126 | @code{custom-variable} for editing variables, @code{custom-face} for | 126 | Useful widgets are @code{custom-variable} for a variable, |
| 127 | editing faces, and @code{custom-group} for editing groups. | 127 | @code{custom-face} for a face, and @code{custom-group} for a group. |
| 128 | @end ignore | ||
| 129 | 128 | ||
| 130 | In addition to the common keywords (@pxref{Common Keywords}), you can | 129 | In addition to the common keywords (@pxref{Common Keywords}), you can |
| 131 | use this keyword in @code{defgroup}: | 130 | use this keyword in @code{defgroup}: |
| @@ -162,18 +161,18 @@ turn this feature back on, if someone would like to do the work. | |||
| 162 | 161 | ||
| 163 | Use @code{defcustom} to declare user-editable variables. | 162 | Use @code{defcustom} to declare user-editable variables. |
| 164 | 163 | ||
| 165 | @tindex defcustom | ||
| 166 | @defmac defcustom option default doc [keyword value]... | 164 | @defmac defcustom option default doc [keyword value]... |
| 165 | @tindex defcustom | ||
| 167 | Declare @var{option} as a customizable user option variable. Do not | 166 | Declare @var{option} as a customizable user option variable. Do not |
| 168 | quote @var{option}. The argument @var{doc} specifies the documentation | 167 | quote @var{option}. The argument @var{doc} specifies the documentation |
| 169 | string for the variable. | 168 | string for the variable. |
| 170 | 169 | ||
| 171 | If @var{option} is void, @code{defcustom} initializes it to | 170 | If @var{option} is void, @code{defcustom} initializes it to |
| 172 | @var{default}. @var{default} should be an expression to compute the | 171 | @var{default}. @var{default} should be an expression to compute the |
| 173 | value; be careful in writing it, because it can be be evaluated on more | 172 | value; be careful in writing it, because it can be evaluated on more |
| 174 | than one occasion. | 173 | than one occasion. |
| 175 | 174 | ||
| 176 | The following additional keywords are defined: | 175 | The following additional keywords are accepted: |
| 177 | 176 | ||
| 178 | @table @code | 177 | @table @code |
| 179 | @item :type @var{type} | 178 | @item :type @var{type} |
| @@ -191,8 +190,9 @@ elements of the hook value. The user is not restricted to using only | |||
| 191 | these functions, but they are offered as convenient alternatives. | 190 | these functions, but they are offered as convenient alternatives. |
| 192 | 191 | ||
| 193 | @item :version @var{version} | 192 | @item :version @var{version} |
| 194 | This option specifies that the variable's default value was changed in | 193 | This option specifies that the variable was first introduced, or its |
| 195 | Emacs version @var{version}. For example, | 194 | default value was changed, in Emacs version @var{version}. The value |
| 195 | @var{version} must be a string. For example, | ||
| 196 | 196 | ||
| 197 | @example | 197 | @example |
| 198 | (defcustom foo-max 34 | 198 | (defcustom foo-max 34 |
| @@ -260,7 +260,7 @@ Keywords}. Here is an example, from the library @file{paren.el}: | |||
| 260 | (defcustom show-paren-mode nil | 260 | (defcustom show-paren-mode nil |
| 261 | "Toggle Show Paren mode@enddots{}" | 261 | "Toggle Show Paren mode@enddots{}" |
| 262 | :set (lambda (symbol value) | 262 | :set (lambda (symbol value) |
| 263 | (show-paren-mode (or value 0))) | 263 | (show-paren-mode (or value 0))) |
| 264 | :initialize 'custom-initialize-default | 264 | :initialize 'custom-initialize-default |
| 265 | :type 'boolean | 265 | :type 'boolean |
| 266 | :group 'paren-showing | 266 | :group 'paren-showing |
| @@ -369,6 +369,13 @@ completion with @kbd{M-@key{TAB}}. | |||
| 369 | The value must be a directory name, and you can do completion with | 369 | The value must be a directory name, and you can do completion with |
| 370 | @kbd{M-@key{TAB}}. | 370 | @kbd{M-@key{TAB}}. |
| 371 | 371 | ||
| 372 | @item hook | ||
| 373 | The value must be a list of functions (or a single function, but that is | ||
| 374 | obsolete usage). This customization type is used for hook variables. | ||
| 375 | You can use the @code{:option} in the @code{defcustom} for a hook | ||
| 376 | variable to specify functions recommended for use in the hook; | ||
| 377 | see @ref{Variable Definitions}. | ||
| 378 | |||
| 372 | @item symbol | 379 | @item symbol |
| 373 | The value must be a symbol. It appears in the customization buffer as | 380 | The value must be a symbol. It appears in the customization buffer as |
| 374 | the name of the symbol. | 381 | the name of the symbol. |
| @@ -381,6 +388,10 @@ it is a function name, you can do completion with @kbd{M-@key{TAB}}. | |||
| 381 | The value must be a variable name, and you can do completion with | 388 | The value must be a variable name, and you can do completion with |
| 382 | @kbd{M-@key{TAB}}. | 389 | @kbd{M-@key{TAB}}. |
| 383 | 390 | ||
| 391 | @item face | ||
| 392 | The value must be a symbol which is a face name, and you can do | ||
| 393 | completion with @kbd{M-@key{TAB}}. | ||
| 394 | |||
| 384 | @item boolean | 395 | @item boolean |
| 385 | The value is boolean---either @code{nil} or @code{t}. Note that by | 396 | The value is boolean---either @code{nil} or @code{t}. Note that by |
| 386 | using @code{choice} and @code{const} together (see the next section), | 397 | using @code{choice} and @code{const} together (see the next section), |
| @@ -399,24 +410,26 @@ doing that: | |||
| 399 | @table @code | 410 | @table @code |
| 400 | @item (restricted-sexp :match-alternatives @var{criteria}) | 411 | @item (restricted-sexp :match-alternatives @var{criteria}) |
| 401 | The value may be any Lisp object that satisfies one of @var{criteria}. | 412 | The value may be any Lisp object that satisfies one of @var{criteria}. |
| 402 | @var{criteria} should be a list, and each elements should be | 413 | @var{criteria} should be a list, and each element should be |
| 403 | one of these possibilities: | 414 | one of these possibilities: |
| 404 | 415 | ||
| 405 | @itemize @bullet | 416 | @itemize @bullet |
| 406 | @item | 417 | @item |
| 407 | A predicate---that is, a function of one argument that returns non-@code{nil} | 418 | A predicate---that is, a function of one argument that has no side |
| 408 | if the argument fits a certain type. This means that objects of that type | 419 | effects, and returns either @code{nil} or non-@code{nil} according to |
| 409 | are acceptable. | 420 | the argument. Using a predicate in the list says that objects for which |
| 421 | the predicate returns non-@code{nil} are acceptable. | ||
| 410 | 422 | ||
| 411 | @item | 423 | @item |
| 412 | A quoted constant---that is, @code{'@var{object}}. This means that | 424 | A quoted constant---that is, @code{'@var{object}}. This sort of element |
| 413 | @var{object} itself is an acceptable value. | 425 | in the list says that @var{object} itself is an acceptable value. |
| 414 | @end itemize | 426 | @end itemize |
| 415 | 427 | ||
| 416 | For example, | 428 | For example, |
| 417 | 429 | ||
| 418 | @example | 430 | @example |
| 419 | (restricted-sexp :match-alternatives (integerp 't 'nil)) | 431 | (restricted-sexp :match-alternatives |
| 432 | (integerp 't 'nil)) | ||
| 420 | @end example | 433 | @end example |
| 421 | 434 | ||
| 422 | @noindent | 435 | @noindent |
| @@ -427,7 +440,7 @@ syntax, and the user edits them textually. | |||
| 427 | 440 | ||
| 428 | @item (cons @var{car-type} @var{cdr-type}) | 441 | @item (cons @var{car-type} @var{cdr-type}) |
| 429 | The value must be a cons cell, its @sc{car} must fit @var{car-type}, and | 442 | The value must be a cons cell, its @sc{car} must fit @var{car-type}, and |
| 430 | its @sc{cdr} must fit @var{cdr-type}. For example, @code{(const string | 443 | its @sc{cdr} must fit @var{cdr-type}. For example, @code{(cons string |
| 431 | symbol)} is a customization type which matches values such as | 444 | symbol)} is a customization type which matches values such as |
| 432 | @code{("foo" . foo)}. | 445 | @code{("foo" . foo)}. |
| 433 | 446 | ||
| @@ -444,7 +457,7 @@ For example, @code{(list integer string function)} describes a list of | |||
| 444 | three elements; the first element must be an integer, the second a | 457 | three elements; the first element must be an integer, the second a |
| 445 | string, and the third a function. | 458 | string, and the third a function. |
| 446 | 459 | ||
| 447 | In the customization buffer, the each element is displayed and edited | 460 | In the customization buffer, each element is displayed and edited |
| 448 | separately, according to the type specified for it. | 461 | separately, according to the type specified for it. |
| 449 | 462 | ||
| 450 | @item (vector @var{element-types}@dots{}) | 463 | @item (vector @var{element-types}@dots{}) |
| @@ -466,10 +479,10 @@ including the @code{:tag} keyword in the alternatives. For example, if | |||
| 466 | an integer stands for a number of spaces, while a string is text to use | 479 | an integer stands for a number of spaces, while a string is text to use |
| 467 | verbatim, you might write the customization type this way, | 480 | verbatim, you might write the customization type this way, |
| 468 | 481 | ||
| 469 | @smallexample | 482 | @example |
| 470 | (choice (integer :tag "Number of spaces") | 483 | (choice (integer :tag "Number of spaces") |
| 471 | (string :tag "Literal text")) | 484 | (string :tag "Literal text")) |
| 472 | @end smallexample | 485 | @end example |
| 473 | 486 | ||
| 474 | @noindent | 487 | @noindent |
| 475 | so that the menu offers @samp{Number of spaces} and @samp{Literal Text}. | 488 | so that the menu offers @samp{Number of spaces} and @samp{Literal Text}. |
| @@ -488,11 +501,11 @@ The main use of @code{const} is inside of @code{choice}. For example, | |||
| 488 | @code{:tag} is often used with @code{const}, inside of @code{choice}. | 501 | @code{:tag} is often used with @code{const}, inside of @code{choice}. |
| 489 | For example, | 502 | For example, |
| 490 | 503 | ||
| 491 | @smallexample | 504 | @example |
| 492 | (choice (const :tag "Yes" t) | 505 | (choice (const :tag "Yes" t) |
| 493 | (const :tag "No" nil) | 506 | (const :tag "No" nil) |
| 494 | (const :tag "Ask" foo)) | 507 | (const :tag "Ask" foo)) |
| 495 | @end smallexample | 508 | @end example |
| 496 | 509 | ||
| 497 | @item (function-item @var{function}) | 510 | @item (function-item @var{function}) |
| 498 | Like @code{const}, but used for values which are functions. This | 511 | Like @code{const}, but used for values which are functions. This |
| @@ -733,7 +746,7 @@ in the buffer with a positive tabbing order, or @code{nil} | |||
| 733 | @end enumerate | 746 | @end enumerate |
| 734 | 747 | ||
| 735 | @item :parent | 748 | @item :parent |
| 736 | The parent of a nested widget (e.g. a @code{menu-choice} item or an | 749 | The parent of a nested widget (e.g., a @code{menu-choice} item or an |
| 737 | element of a @code{editable-list} widget). | 750 | element of a @code{editable-list} widget). |
| 738 | 751 | ||
| 739 | @item :sibling-args | 752 | @item :sibling-args |
diff --git a/lispref/debugging.texi b/lispref/debugging.texi index 9c7a4fd7be7..8e5ed2834a5 100644 --- a/lispref/debugging.texi +++ b/lispref/debugging.texi | |||
| @@ -3,7 +3,7 @@ | |||
| 3 | @c Copyright (C) 1990, 1991, 1992, 1993, 1994, 1998 Free Software Foundation, Inc. | 3 | @c Copyright (C) 1990, 1991, 1992, 1993, 1994, 1998 Free Software Foundation, Inc. |
| 4 | @c See the file elisp.texi for copying conditions. | 4 | @c See the file elisp.texi for copying conditions. |
| 5 | @setfilename ../info/debugging | 5 | @setfilename ../info/debugging |
| 6 | @node Debugging, Read and Print, Advising, Top | 6 | @node Debugging, Read and Print, Advising Functions, Top |
| 7 | @chapter Debugging Lisp Programs | 7 | @chapter Debugging Lisp Programs |
| 8 | 8 | ||
| 9 | There are three ways to investigate a problem in an Emacs Lisp program, | 9 | There are three ways to investigate a problem in an Emacs Lisp program, |
| @@ -12,8 +12,9 @@ depending on what you are doing with the program when the problem appears. | |||
| 12 | @itemize @bullet | 12 | @itemize @bullet |
| 13 | @item | 13 | @item |
| 14 | If the problem occurs when you run the program, you can use a Lisp | 14 | If the problem occurs when you run the program, you can use a Lisp |
| 15 | debugger (either the default debugger or Edebug) to investigate what is | 15 | debugger to investigate what is happening during execution. In addition |
| 16 | happening during execution. | 16 | to the ordinary debugger, Emacs comes with a source level debugger, |
| 17 | Edebug. This chapter describes both of them. | ||
| 17 | 18 | ||
| 18 | @item | 19 | @item |
| 19 | If the problem is syntactic, so that Lisp cannot even read the program, | 20 | If the problem is syntactic, so that Lisp cannot even read the program, |
| @@ -26,9 +27,9 @@ compiler, you need to know how to examine the compiler's input buffer. | |||
| 26 | 27 | ||
| 27 | @menu | 28 | @menu |
| 28 | * Debugger:: How the Emacs Lisp debugger is implemented. | 29 | * Debugger:: How the Emacs Lisp debugger is implemented. |
| 30 | * Edebug:: A source-level Emacs Lisp debugger. | ||
| 29 | * Syntax Errors:: How to find syntax errors. | 31 | * Syntax Errors:: How to find syntax errors. |
| 30 | * Compilation Errors:: How to find errors that show up in byte compilation. | 32 | * Compilation Errors:: How to find errors that show up in byte compilation. |
| 31 | * Edebug:: A source-level Emacs Lisp debugger. | ||
| 32 | @end menu | 33 | @end menu |
| 33 | 34 | ||
| 34 | Another useful debugging tool is the dribble file. When a dribble | 35 | Another useful debugging tool is the dribble file. When a dribble |
| @@ -45,13 +46,13 @@ Afterward, you can examine the file to find out what input was used. | |||
| 45 | @cindex Lisp debugger | 46 | @cindex Lisp debugger |
| 46 | @cindex break | 47 | @cindex break |
| 47 | 48 | ||
| 48 | The @dfn{Lisp debugger} provides the ability to suspend evaluation of | 49 | The ordinary @dfn{Lisp debugger} provides the ability to suspend |
| 49 | a form. While evaluation is suspended (a state that is commonly known | 50 | evaluation of a form. While evaluation is suspended (a state that is |
| 50 | as a @dfn{break}), you may examine the run time stack, examine the | 51 | commonly known as a @dfn{break}), you may examine the run time stack, |
| 51 | values of local or global variables, or change those values. Since a | 52 | examine the values of local or global variables, or change those values. |
| 52 | break is a recursive edit, all the usual editing facilities of Emacs are | 53 | Since a break is a recursive edit, all the usual editing facilities of |
| 53 | available; you can even run programs that will enter the debugger | 54 | Emacs are available; you can even run programs that will enter the |
| 54 | recursively. @xref{Recursive Editing}. | 55 | debugger recursively. @xref{Recursive Editing}. |
| 55 | 56 | ||
| 56 | @menu | 57 | @menu |
| 57 | * Error Debugging:: Entering the debugger when an error happens. | 58 | * Error Debugging:: Entering the debugger when an error happens. |
| @@ -74,25 +75,28 @@ happens. This allows you to investigate the immediate causes of the | |||
| 74 | error. | 75 | error. |
| 75 | 76 | ||
| 76 | However, entry to the debugger is not a normal consequence of an | 77 | However, entry to the debugger is not a normal consequence of an |
| 77 | error. Many commands frequently get Lisp errors when invoked in | 78 | error. Many commands frequently cause Lisp errors when invoked |
| 78 | inappropriate contexts (such as @kbd{C-f} at the end of the buffer) and | 79 | inappropriately (such as @kbd{C-f} at the end of the buffer), and during |
| 79 | during ordinary editing it would be very unpleasant to enter the | 80 | ordinary editing it would be very inconvenient to enter the debugger |
| 80 | debugger each time this happens. If you want errors to enter the | 81 | each time this happens. So if you want errors to enter the debugger, set |
| 81 | debugger, set the variable @code{debug-on-error} to non-@code{nil}. | 82 | the variable @code{debug-on-error} to non-@code{nil}. (The command |
| 83 | @code{toggle-debug-on-error} provides an easy way to do this.) | ||
| 82 | 84 | ||
| 83 | @defopt debug-on-error | 85 | @defopt debug-on-error |
| 84 | This variable determines whether the debugger is called when an error is | 86 | This variable determines whether the debugger is called when an error is |
| 85 | signaled and not handled. If @code{debug-on-error} is @code{t}, all | 87 | signaled and not handled. If @code{debug-on-error} is @code{t}, all |
| 86 | errors call the debugger. If it is @code{nil}, none call the debugger. | 88 | kinds of errors call the debugger (except those listed in |
| 89 | @code{debug-ignored-errors}). If it is @code{nil}, none call the | ||
| 90 | debugger. | ||
| 87 | 91 | ||
| 88 | The value can also be a list of error conditions that should call the | 92 | The value can also be a list of error conditions that should call the |
| 89 | debugger. For example, if you set it to the list | 93 | debugger. For example, if you set it to the list |
| 90 | @code{(void-variable)}, then only errors about a variable that has no | 94 | @code{(void-variable)}, then only errors about a variable that has no |
| 91 | value invoke the debugger. | 95 | value invoke the debugger. |
| 92 | 96 | ||
| 93 | When this variable is non-@code{nil}, Emacs does not catch errors that | 97 | When this variable is non-@code{nil}, Emacs does not create an error |
| 94 | happen in process filter functions and sentinels. Therefore, these | 98 | handler around process filter functions and sentinels. Therefore, |
| 95 | errors also can invoke the debugger. @xref{Processes}. | 99 | errors in these functions also invoke the debugger. @xref{Processes}. |
| 96 | @end defopt | 100 | @end defopt |
| 97 | 101 | ||
| 98 | @defopt debug-ignored-errors | 102 | @defopt debug-ignored-errors |
| @@ -117,10 +121,10 @@ debugger, even if @code{debug-on-error} is non-@code{nil}. In other | |||
| 117 | words, @code{condition-case} gets a chance to handle the error before | 121 | words, @code{condition-case} gets a chance to handle the error before |
| 118 | the debugger gets a chance. | 122 | the debugger gets a chance. |
| 119 | 123 | ||
| 120 | If you set @code{debug-on-signal} non-@code{nil}, then the debugger gets | 124 | If you set @code{debug-on-signal} to a non-@code{nil} value, then the |
| 121 | first chance at every error; an error will invoke the debugger | 125 | debugger gets the first chance at every error; an error will invoke the |
| 122 | regardless of any @code{condition-case}, if the fits the criterion | 126 | debugger regardless of any @code{condition-case}, if it fits the |
| 123 | specified by the values of @code{debug-on-error} and | 127 | criterion specified by the values of @code{debug-on-error} and |
| 124 | @code{debug-ignored-errors}. | 128 | @code{debug-ignored-errors}. |
| 125 | 129 | ||
| 126 | @strong{Warning:} This variable is strong medicine! Various parts of | 130 | @strong{Warning:} This variable is strong medicine! Various parts of |
| @@ -134,13 +138,14 @@ enter the debugger. | |||
| 134 | @end defopt | 138 | @end defopt |
| 135 | 139 | ||
| 136 | To debug an error that happens during loading of the @file{.emacs} | 140 | To debug an error that happens during loading of the @file{.emacs} |
| 137 | file, use the option @samp{-debug-init}, which binds | 141 | file, use the option @samp{--debug-init}, which binds |
| 138 | @code{debug-on-error} to @code{t} while @file{.emacs} is loaded and | 142 | @code{debug-on-error} to @code{t} while @file{.emacs} is loaded, and |
| 139 | inhibits use of @code{condition-case} to catch init-file errors. | 143 | bypasses the @code{condition-case} which normally catches errors in the |
| 144 | init-file. | ||
| 140 | 145 | ||
| 141 | If your @file{.emacs} file sets @code{debug-on-error}, the effect may | 146 | If your @file{.emacs} file sets @code{debug-on-error}, the effect may |
| 142 | not last past the end of loading @file{.emacs}. (This is an undesirable | 147 | not last past the end of loading @file{.emacs}. (This is an undesirable |
| 143 | byproduct of the code that implements the @samp{-debug-init} command | 148 | byproduct of the code that implements the @samp{--debug-init} command |
| 144 | line option.) The best way to make @file{.emacs} set | 149 | line option.) The best way to make @file{.emacs} set |
| 145 | @code{debug-on-error} permanently is with @code{after-init-hook}, like | 150 | @code{debug-on-error} permanently is with @code{after-init-hook}, like |
| 146 | this: | 151 | this: |
| @@ -269,8 +274,9 @@ not currently set up to break on entry. It always returns | |||
| 269 | You can cause the debugger to be called at a certain point in your | 274 | You can cause the debugger to be called at a certain point in your |
| 270 | program by writing the expression @code{(debug)} at that point. To do | 275 | program by writing the expression @code{(debug)} at that point. To do |
| 271 | this, visit the source file, insert the text @samp{(debug)} at the | 276 | this, visit the source file, insert the text @samp{(debug)} at the |
| 272 | proper place, and type @kbd{C-M-x}. Be sure to undo this insertion | 277 | proper place, and type @kbd{C-M-x}. @strong{Warning:} if you do this |
| 273 | before you save the file! | 278 | for temporary debugging purposes, be sure to undo this insertion before |
| 279 | you save the file! | ||
| 274 | 280 | ||
| 275 | The place where you insert @samp{(debug)} must be a place where an | 281 | The place where you insert @samp{(debug)} must be a place where an |
| 276 | additional form can be evaluated and its value ignored. (If the value | 282 | additional form can be evaluated and its value ignored. (If the value |
| @@ -339,8 +345,8 @@ same function. (To do this, visit the source for the function and type | |||
| 339 | @item c | 345 | @item c |
| 340 | Exit the debugger and continue execution. When continuing is possible, | 346 | Exit the debugger and continue execution. When continuing is possible, |
| 341 | it resumes execution of the program as if the debugger had never been | 347 | it resumes execution of the program as if the debugger had never been |
| 342 | entered (aside from the effect of any variables or data structures you | 348 | entered (aside from any side-effects that you caused by changing |
| 343 | may have changed while inside the debugger). | 349 | variable values or data structures while inside the debugger). |
| 344 | 350 | ||
| 345 | Continuing is possible after entry to the debugger due to function entry | 351 | Continuing is possible after entry to the debugger due to function entry |
| 346 | or exit, explicit invocation, or quitting. You cannot continue if the | 352 | or exit, explicit invocation, or quitting. You cannot continue if the |
| @@ -371,10 +377,10 @@ remove the star from the line in the backtrace buffer. | |||
| 371 | Read a Lisp expression in the minibuffer, evaluate it, and print the | 377 | Read a Lisp expression in the minibuffer, evaluate it, and print the |
| 372 | value in the echo area. The debugger alters certain important | 378 | value in the echo area. The debugger alters certain important |
| 373 | variables, and the current buffer, as part of its operation; @kbd{e} | 379 | variables, and the current buffer, as part of its operation; @kbd{e} |
| 374 | temporarily restores their outside-the-debugger values so you can | 380 | temporarily restores their values from outside the debugger, so you can |
| 375 | examine them. This makes the debugger more transparent. By contrast, | 381 | examine and change them. This makes the debugger more transparent. By |
| 376 | @kbd{M-:} does nothing special in the debugger; it shows you the | 382 | contrast, @kbd{M-:} does nothing special in the debugger; it shows you |
| 377 | variable values within the debugger. | 383 | the variable values within the debugger. |
| 378 | 384 | ||
| 379 | @item R | 385 | @item R |
| 380 | Like @kbd{e}, but also save the result of evaluation in the | 386 | Like @kbd{e}, but also save the result of evaluation in the |
| @@ -404,7 +410,8 @@ You can't use @kbd{r} when the debugger was entered due to an error. | |||
| 404 | @node Invoking the Debugger | 410 | @node Invoking the Debugger |
| 405 | @subsection Invoking the Debugger | 411 | @subsection Invoking the Debugger |
| 406 | 412 | ||
| 407 | Here we describe fully the function used to invoke the debugger. | 413 | Here we describe in full detail the function @code{debug} that is used |
| 414 | to invoke the debugger. | ||
| 408 | 415 | ||
| 409 | @defun debug &rest debugger-args | 416 | @defun debug &rest debugger-args |
| 410 | This function enters the debugger. It switches buffers to a buffer | 417 | This function enters the debugger. It switches buffers to a buffer |
| @@ -418,18 +425,15 @@ then @code{debug} switches back to the previous buffer and returns to | |||
| 418 | whatever called @code{debug}. This is the only way the function | 425 | whatever called @code{debug}. This is the only way the function |
| 419 | @code{debug} can return to its caller. | 426 | @code{debug} can return to its caller. |
| 420 | 427 | ||
| 421 | If the first of the @var{debugger-args} passed to @code{debug} is | 428 | The use of the @var{debugger-args} is that @code{debug} displays the |
| 422 | @code{nil} (or if it is not one of the special values in the table | 429 | rest of its arguments at the top of the @samp{*Backtrace*} buffer, so |
| 423 | below), then @code{debug} displays the rest of its arguments at the | 430 | that the user can see them. Except as described below, this is the |
| 424 | top of the @samp{*Backtrace*} buffer. This mechanism is used to display | 431 | @emph{only} way these arguments are used. |
| 425 | a message to the user. | ||
| 426 | |||
| 427 | However, if the first argument passed to @code{debug} is one of the | ||
| 428 | following special values, then it has special significance. Normally, | ||
| 429 | these values are passed to @code{debug} only by the internals of Emacs | ||
| 430 | and the debugger, and not by programmers calling @code{debug}. | ||
| 431 | 432 | ||
| 432 | The special values are: | 433 | However, certain values for first argument to @code{debug} have a |
| 434 | special significance. (Normally, these values are used only by the | ||
| 435 | internals of Emacs, and not by programmers calling @code{debug}.) Here | ||
| 436 | is a table of these special values: | ||
| 433 | 437 | ||
| 434 | @table @code | 438 | @table @code |
| 435 | @item lambda | 439 | @item lambda |
| @@ -640,6 +644,8 @@ If @var{frame-number} is out of range, @code{backtrace-frame} returns | |||
| 640 | @code{nil}. | 644 | @code{nil}. |
| 641 | @end defun | 645 | @end defun |
| 642 | 646 | ||
| 647 | @include edebug.texi | ||
| 648 | |||
| 643 | @node Syntax Errors | 649 | @node Syntax Errors |
| 644 | @section Debugging Invalid Lisp Syntax | 650 | @section Debugging Invalid Lisp Syntax |
| 645 | 651 | ||
| @@ -658,7 +664,9 @@ if it goes to the place where that defun appears to end. If it does | |||
| 658 | not, there is a problem in that defun. | 664 | not, there is a problem in that defun. |
| 659 | 665 | ||
| 660 | However, unmatched parentheses are the most common syntax errors in | 666 | However, unmatched parentheses are the most common syntax errors in |
| 661 | Lisp, and we can give further advice for those cases. | 667 | Lisp, and we can give further advice for those cases. (In addition, |
| 668 | just moving point through the code with Show Paren mode enabled might | ||
| 669 | find the mismatch.) | ||
| 662 | 670 | ||
| 663 | @menu | 671 | @menu |
| 664 | * Excess Open:: How to find a spurious open paren or missing close. | 672 | * Excess Open:: How to find a spurious open paren or missing close. |
| @@ -753,5 +761,3 @@ the error. | |||
| 753 | successfully, then point is located at the end of the form. In this | 761 | successfully, then point is located at the end of the form. In this |
| 754 | case, this technique can't localize the error precisely, but can still | 762 | case, this technique can't localize the error precisely, but can still |
| 755 | show you which function to check. | 763 | show you which function to check. |
| 756 | |||
| 757 | @include edebug.texi | ||
diff --git a/lispref/display.texi b/lispref/display.texi index 59782034ca6..4b09a8b3372 100644 --- a/lispref/display.texi +++ b/lispref/display.texi | |||
| @@ -167,6 +167,9 @@ If it is non-@code{nil}, these lines are truncated; otherwise, | |||
| 167 | @code{truncate-lines} says what to do with them. | 167 | @code{truncate-lines} says what to do with them. |
| 168 | @end defopt | 168 | @end defopt |
| 169 | 169 | ||
| 170 | When horizontal scrolling (@pxref{Horizontal Scrolling}) is in use in | ||
| 171 | a window, that forces truncation. | ||
| 172 | |||
| 170 | You can override the glyphs that indicate continuation or truncation | 173 | You can override the glyphs that indicate continuation or truncation |
| 171 | using the display table; see @ref{Display Tables}. | 174 | using the display table; see @ref{Display Tables}. |
| 172 | 175 | ||
| @@ -236,8 +239,8 @@ Minibuffer depth is 0. | |||
| 236 | @end example | 239 | @end example |
| 237 | @end defun | 240 | @end defun |
| 238 | 241 | ||
| 239 | @tindex current-message | ||
| 240 | @defun current-message | 242 | @defun current-message |
| 243 | @tindex current-message | ||
| 241 | This function returns the message currently being displayed in the | 244 | This function returns the message currently being displayed in the |
| 242 | echo area, or @code{nil} if there is none. | 245 | echo area, or @code{nil} if there is none. |
| 243 | @end defun | 246 | @end defun |
| @@ -252,8 +255,8 @@ The value is normally @code{nil}; Lisp programs bind it to @code{t} | |||
| 252 | for brief periods of time. | 255 | for brief periods of time. |
| 253 | @end defvar | 256 | @end defvar |
| 254 | 257 | ||
| 255 | @tindex echo-area-clear-hook | ||
| 256 | @defvar echo-area-clear-hook | 258 | @defvar echo-area-clear-hook |
| 259 | @tindex echo-area-clear-hook | ||
| 257 | This normal hook is run whenever the echo area is cleared---either by | 260 | This normal hook is run whenever the echo area is cleared---either by |
| 258 | @code{(message nil)} or for any other reason. | 261 | @code{(message nil)} or for any other reason. |
| 259 | @end defvar | 262 | @end defvar |
| @@ -278,8 +281,9 @@ This variable determines how much time should elapse before command | |||
| 278 | characters echo. Its value must be an integer, which specifies the | 281 | characters echo. Its value must be an integer, which specifies the |
| 279 | number of seconds to wait before echoing. If the user types a prefix | 282 | number of seconds to wait before echoing. If the user types a prefix |
| 280 | key (such as @kbd{C-x}) and then delays this many seconds before | 283 | key (such as @kbd{C-x}) and then delays this many seconds before |
| 281 | continuing, the prefix key is echoed in the echo area. Any subsequent | 284 | continuing, the prefix key is echoed in the echo area. (Once echoing |
| 282 | characters in the same command will be echoed as well. | 285 | begins in a key sequence, all subsequent characters in the same key |
| 286 | sequence are echoed immediately.) | ||
| 283 | 287 | ||
| 284 | If the value is zero, then command input is not echoed. | 288 | If the value is zero, then command input is not echoed. |
| 285 | @end defvar | 289 | @end defvar |
| @@ -290,7 +294,8 @@ If the value is zero, then command input is not echoed. | |||
| 290 | @cindex invisible text | 294 | @cindex invisible text |
| 291 | You can make characters @dfn{invisible}, so that they do not appear on | 295 | You can make characters @dfn{invisible}, so that they do not appear on |
| 292 | the screen, with the @code{invisible} property. This can be either a | 296 | the screen, with the @code{invisible} property. This can be either a |
| 293 | text property or a property of an overlay. | 297 | text property (@pxref{Text Properties}) or a property of an overlay |
| 298 | (@pxref{Overlays}). | ||
| 294 | 299 | ||
| 295 | In the simplest case, any non-@code{nil} @code{invisible} property makes | 300 | In the simplest case, any non-@code{nil} @code{invisible} property makes |
| 296 | a character invisible. This is the default case---if you don't alter | 301 | a character invisible. This is the default case---if you don't alter |
| @@ -342,14 +347,14 @@ by a visible newline, it displays an ellipsis. | |||
| 342 | Two functions are specifically provided for adding elements to | 347 | Two functions are specifically provided for adding elements to |
| 343 | @code{buffer-invisibility-spec} and removing elements from it. | 348 | @code{buffer-invisibility-spec} and removing elements from it. |
| 344 | 349 | ||
| 345 | @tindex add-to-invisibility-spec | ||
| 346 | @defun add-to-invisibility-spec element | 350 | @defun add-to-invisibility-spec element |
| 351 | @tindex add-to-invisibility-spec | ||
| 347 | Add the element @var{element} to @code{buffer-invisibility-spec} | 352 | Add the element @var{element} to @code{buffer-invisibility-spec} |
| 348 | (if it is not already present in that list). | 353 | (if it is not already present in that list). |
| 349 | @end defun | 354 | @end defun |
| 350 | 355 | ||
| 351 | @tindex remove-from-invisibility-spec | ||
| 352 | @defun remove-from-invisibility-spec element | 356 | @defun remove-from-invisibility-spec element |
| 357 | @tindex remove-from-invisibility-spec | ||
| 353 | Remove the element @var{element} from @code{buffer-invisibility-spec}. | 358 | Remove the element @var{element} from @code{buffer-invisibility-spec}. |
| 354 | @end defun | 359 | @end defun |
| 355 | 360 | ||
| @@ -393,8 +398,8 @@ temporarily modifying their invisible and intangible properties. If you | |||
| 393 | want this to be done differently for a certain overlays, give it a | 398 | want this to be done differently for a certain overlays, give it a |
| 394 | @code{isearch-open-invisible-temporary} property which is a function. | 399 | @code{isearch-open-invisible-temporary} property which is a function. |
| 395 | The function is called with two arguments: the first is the overlay, and | 400 | The function is called with two arguments: the first is the overlay, and |
| 396 | the second is @code{nil} to make the overlay visible or @code{t} to make | 401 | the second is @code{t} to make the overlay visible, or @code{nil} to |
| 397 | it invisible again. | 402 | make it invisible again. |
| 398 | 403 | ||
| 399 | @node Selective Display | 404 | @node Selective Display |
| 400 | @section Selective Display | 405 | @section Selective Display |
| @@ -598,6 +603,17 @@ The value of the last form in @var{forms} is returned. | |||
| 598 | If this variable is non-@code{nil}, @code{with-output-to-temp-buffer} | 603 | If this variable is non-@code{nil}, @code{with-output-to-temp-buffer} |
| 599 | calls it as a function to do the job of displaying a help buffer. The | 604 | calls it as a function to do the job of displaying a help buffer. The |
| 600 | function gets one argument, which is the buffer it should display. | 605 | function gets one argument, which is the buffer it should display. |
| 606 | |||
| 607 | It is a good idea for this function to run @code{temp-buffer-show-hook} | ||
| 608 | just as @code{with-output-to-temp-buffer} normally would, inside of | ||
| 609 | @code{save-window-excursion} and with the chosen window and buffer | ||
| 610 | selected. | ||
| 611 | @end defvar | ||
| 612 | |||
| 613 | @defvar temp-buffer-show-hook | ||
| 614 | This normal hook is run by @code{with-output-to-temp-buffer} after | ||
| 615 | displaying the help buffer. When the hook runs, the help buffer is | ||
| 616 | current, and the window it was displayed in is selected. | ||
| 601 | @end defvar | 617 | @end defvar |
| 602 | 618 | ||
| 603 | @defun momentary-string-display string position &optional char message | 619 | @defun momentary-string-display string position &optional char message |
| @@ -675,15 +691,16 @@ these affect the display of the text within the overlay. | |||
| 675 | @node Overlay Properties | 691 | @node Overlay Properties |
| 676 | @subsection Overlay Properties | 692 | @subsection Overlay Properties |
| 677 | 693 | ||
| 678 | Overlay properties are like text properties in some respects, but the | 694 | Overlay properties are like text properties in that the properties that |
| 679 | differences are more important than the similarities. Text properties | 695 | alter how a character is displayed can come from either source. But in |
| 680 | are considered a part of the text; overlays are specifically considered | 696 | most respects they are different. Text properties are considered a part |
| 681 | not to be part of the text. Thus, copying text between various buffers | 697 | of the text; overlays are specifically considered not to be part of the |
| 682 | and strings preserves text properties, but does not try to preserve | 698 | text. Thus, copying text between various buffers and strings preserves |
| 683 | overlays. Changing a buffer's text properties marks the buffer as | 699 | text properties, but does not try to preserve overlays. Changing a |
| 684 | modified, while moving an overlay or changing its properties does not. | 700 | buffer's text properties marks the buffer as modified, while moving an |
| 685 | Unlike text property changes, overlay changes are not recorded in the | 701 | overlay or changing its properties does not. Unlike text property |
| 686 | buffer's undo list. | 702 | changes, overlay changes are not recorded in the buffer's undo list. |
| 703 | @xref{Text Properties}, for comparison. | ||
| 687 | 704 | ||
| 688 | @table @code | 705 | @table @code |
| 689 | @item priority | 706 | @item priority |
| @@ -773,11 +790,14 @@ The @code{intangible} property on an overlay works just like the | |||
| 773 | @code{intangible} text property. @xref{Special Properties}, for details. | 790 | @code{intangible} text property. @xref{Special Properties}, for details. |
| 774 | 791 | ||
| 775 | @item isearch-open-invisible | 792 | @item isearch-open-invisible |
| 776 | @itemx isearch-open-invisible-temporary | 793 | This property tells incremental search how to make an invisible overlay |
| 777 | These properties control how incremental search should make invisible an | 794 | visible, permanently, if the final match overlaps it. @xref{Invisible |
| 778 | overlay visible, either permanently or temporarily. @xref{Invisible | ||
| 779 | Text}. | 795 | Text}. |
| 780 | 796 | ||
| 797 | @item isearch-open-invisible-temporary | ||
| 798 | This property tells incremental search how to make an invisible overlay | ||
| 799 | visible, temporarily, during the search. @xref{Invisible Text}. | ||
| 800 | |||
| 781 | @item before-string | 801 | @item before-string |
| 782 | @kindex before-string @r{(overlay property)} | 802 | @kindex before-string @r{(overlay property)} |
| 783 | This property's value is a string to add to the display at the beginning | 803 | This property's value is a string to add to the display at the beginning |
| @@ -861,8 +881,11 @@ This function returns the buffer that @var{overlay} belongs to. | |||
| 861 | 881 | ||
| 862 | @defun delete-overlay overlay | 882 | @defun delete-overlay overlay |
| 863 | This function deletes @var{overlay}. The overlay continues to exist as | 883 | This function deletes @var{overlay}. The overlay continues to exist as |
| 864 | a Lisp object, but ceases to be part of the buffer it belonged to, and | 884 | a Lisp object, but ceases to be attached to the buffer it belonged to, |
| 865 | ceases to have any effect on display. | 885 | and ceases to have any effect on display. |
| 886 | |||
| 887 | A deleted overlay is not permanently useless. You can give it | ||
| 888 | a new buffer position by calling @code{move-overlay}. | ||
| 866 | @end defun | 889 | @end defun |
| 867 | 890 | ||
| 868 | @defun move-overlay overlay start end &optional buffer | 891 | @defun move-overlay overlay start end &optional buffer |
| @@ -886,8 +909,8 @@ An overlay contains position @var{pos} if it begins at or before | |||
| 886 | @var{pos}, and ends after @var{pos}. | 909 | @var{pos}, and ends after @var{pos}. |
| 887 | @end defun | 910 | @end defun |
| 888 | 911 | ||
| 889 | @tindex overlays-in | ||
| 890 | @defun overlays-in beg end | 912 | @defun overlays-in beg end |
| 913 | @tindex overlays-in | ||
| 891 | This function returns a list of the overlays that overlap the region | 914 | This function returns a list of the overlays that overlap the region |
| 892 | @var{beg} through @var{end}. ``Overlap'' means that at least one | 915 | @var{beg} through @var{end}. ``Overlap'' means that at least one |
| 893 | character is contained within the overlay and also contained within the | 916 | character is contained within the overlay and also contained within the |
| @@ -912,20 +935,20 @@ Since not all characters have the same width, these functions let you | |||
| 912 | check the width of a character. @xref{Primitive Indent}, and | 935 | check the width of a character. @xref{Primitive Indent}, and |
| 913 | @ref{Screen Lines}, for related functions. | 936 | @ref{Screen Lines}, for related functions. |
| 914 | 937 | ||
| 915 | @tindex char-width | ||
| 916 | @defun char-width char | 938 | @defun char-width char |
| 939 | @tindex char-width | ||
| 917 | This function returns the width in columns of the character @var{char}, | 940 | This function returns the width in columns of the character @var{char}, |
| 918 | if it were displayed in the current buffer and the selected window. | 941 | if it were displayed in the current buffer and the selected window. |
| 919 | @end defun | 942 | @end defun |
| 920 | 943 | ||
| 921 | @tindex string-width | ||
| 922 | @defun string-width string | 944 | @defun string-width string |
| 945 | @tindex string-width | ||
| 923 | This function returns the width in columns of the string @var{string}, | 946 | This function returns the width in columns of the string @var{string}, |
| 924 | if it were displayed in the current buffer and the selected window. | 947 | if it were displayed in the current buffer and the selected window. |
| 925 | @end defun | 948 | @end defun |
| 926 | 949 | ||
| 927 | @tindex truncate-string-to-width | ||
| 928 | @defun truncate-string-to-width string width &optional start-column padding | 950 | @defun truncate-string-to-width string width &optional start-column padding |
| 951 | @tindex truncate-string-to-width | ||
| 929 | This function returns the part of @var{string} that fits within | 952 | This function returns the part of @var{string} that fits within |
| 930 | @var{width} columns, as a new string. | 953 | @var{width} columns, as a new string. |
| 931 | 954 | ||
| @@ -1033,22 +1056,22 @@ one. | |||
| 1033 | @end table | 1056 | @end table |
| 1034 | 1057 | ||
| 1035 | @node Defining Faces | 1058 | @node Defining Faces |
| 1036 | @section Defining Faces | 1059 | @subsection Defining Faces |
| 1037 | 1060 | ||
| 1038 | The way to define a new face is with @code{defface}. This creates a | 1061 | The way to define a new face is with @code{defface}. This creates a |
| 1039 | kind of customization item (@pxref{Customization}) which the user can | 1062 | kind of customization item (@pxref{Customization}) which the user can |
| 1040 | customize using the Customization buffer (@pxref{Easy Customization,,, | 1063 | customize using the Customization buffer (@pxref{Easy Customization,,, |
| 1041 | emacs, The GNU Emacs Manual}). | 1064 | emacs, The GNU Emacs Manual}). |
| 1042 | 1065 | ||
| 1043 | @tindex defface | ||
| 1044 | @defmac defface face spec doc [keyword value]... | 1066 | @defmac defface face spec doc [keyword value]... |
| 1067 | @tindex defface | ||
| 1045 | Declare @var{face} as a customizable face that defaults according to | 1068 | Declare @var{face} as a customizable face that defaults according to |
| 1046 | @var{spec}. Do not quote the symbol @var{face}. The argument @var{doc} | 1069 | @var{spec}. Do not quote the symbol @var{face}. The argument @var{doc} |
| 1047 | specifies the face documentation. | 1070 | specifies the face documentation. |
| 1048 | 1071 | ||
| 1049 | When @code{defface} executes, it defines the face according to | 1072 | When @code{defface} executes, it defines the face according to |
| 1050 | @var{spec}, then uses any customizations saved in the @file{.emacs} file | 1073 | @var{spec}, then uses any customizations that were read from the |
| 1051 | to override that specification. | 1074 | @file{.emacs} file to override that specification. |
| 1052 | 1075 | ||
| 1053 | The purpose of @var{spec} is to specify how the face should appear on | 1076 | The purpose of @var{spec} is to specify how the face should appear on |
| 1054 | different kinds of terminals. It should be an alist whose elements have | 1077 | different kinds of terminals. It should be an alist whose elements have |
| @@ -1069,7 +1092,7 @@ This element of @var{spec} matches all frames. Therefore, any | |||
| 1069 | subsequent elements of @var{spec} are never used. Normally | 1092 | subsequent elements of @var{spec} are never used. Normally |
| 1070 | @code{t} is used in the last (or only) element of @var{spec}. | 1093 | @code{t} is used in the last (or only) element of @var{spec}. |
| 1071 | 1094 | ||
| 1072 | @item an list | 1095 | @item a list |
| 1073 | If @var{display} is alist, each elements should have the form | 1096 | If @var{display} is alist, each elements should have the form |
| 1074 | @code{(@var{characteristic} @var{value}@dots{})}. Here | 1097 | @code{(@var{characteristic} @var{value}@dots{})}. Here |
| 1075 | @var{characteristic} specifies a way of classifying frames, and the | 1098 | @var{characteristic} specifies a way of classifying frames, and the |
| @@ -1222,19 +1245,20 @@ they are used automatically to handle certain shades of gray. | |||
| 1222 | 1245 | ||
| 1223 | @defun set-face-font face font &optional frame | 1246 | @defun set-face-font face font &optional frame |
| 1224 | This function sets the font of face @var{face}. The argument @var{font} | 1247 | This function sets the font of face @var{face}. The argument @var{font} |
| 1225 | should be a string. Note that if you set the font explicitly, the bold | 1248 | should be a string, either a valid font name for your system or the name |
| 1226 | and italic attributes cease to have any effect, because the precise font | 1249 | of an Emacs fontset (@pxref{Fontsets}). Note that if you set the font |
| 1227 | that you specified is always used. | 1250 | explicitly, the bold and italic attributes cease to have any effect, |
| 1251 | because the precise font that you specified is always used. | ||
| 1228 | @end defun | 1252 | @end defun |
| 1229 | 1253 | ||
| 1230 | @tindex set-face-bold-p | ||
| 1231 | @defun set-face-bold-p face bold-p &optional frame | 1254 | @defun set-face-bold-p face bold-p &optional frame |
| 1255 | @tindex set-face-bold-p | ||
| 1232 | This function sets the bold attribute of face @var{face}. | 1256 | This function sets the bold attribute of face @var{face}. |
| 1233 | Non-@code{nil} means bold; @code{nil} means non-bold. | 1257 | Non-@code{nil} means bold; @code{nil} means non-bold. |
| 1234 | @end defun | 1258 | @end defun |
| 1235 | 1259 | ||
| 1236 | @tindex set-face-italic-p | ||
| 1237 | @defun set-face-italic-p face italic-p &optional frame | 1260 | @defun set-face-italic-p face italic-p &optional frame |
| 1261 | @tindex set-face-italic-p | ||
| 1238 | This function sets the italic attribute of face @var{face}. | 1262 | This function sets the italic attribute of face @var{face}. |
| 1239 | Non-@code{nil} means italic; @code{nil} means non-italic. | 1263 | Non-@code{nil} means italic; @code{nil} means non-italic. |
| 1240 | @end defun | 1264 | @end defun |
| @@ -1269,13 +1293,13 @@ This function returns the name of the background stipple pattern of face | |||
| 1269 | This function returns the name of the font of face @var{face}. | 1293 | This function returns the name of the font of face @var{face}. |
| 1270 | @end defun | 1294 | @end defun |
| 1271 | 1295 | ||
| 1272 | @tindex face-bold-p | ||
| 1273 | @defun face-bold-p face &optional frame | 1296 | @defun face-bold-p face &optional frame |
| 1297 | @tindex face-bold-p | ||
| 1274 | This function returns the bold attribute of face @var{face}. | 1298 | This function returns the bold attribute of face @var{face}. |
| 1275 | @end defun | 1299 | @end defun |
| 1276 | 1300 | ||
| 1277 | @tindex face-italic-p | ||
| 1278 | @defun face-italic-p face &optional frame | 1301 | @defun face-italic-p face &optional frame |
| 1302 | @tindex face-italic-p | ||
| 1279 | This function returns the italic attribute of face @var{face}. | 1303 | This function returns the italic attribute of face @var{face}. |
| 1280 | @end defun | 1304 | @end defun |
| 1281 | 1305 | ||
| @@ -1287,8 +1311,8 @@ This function returns the underline attribute of face @var{face}. | |||
| 1287 | This function returns the face number of face @var{face}. | 1311 | This function returns the face number of face @var{face}. |
| 1288 | @end defun | 1312 | @end defun |
| 1289 | 1313 | ||
| 1290 | @tindex face-documentation | ||
| 1291 | @defun face-documentation face | 1314 | @defun face-documentation face |
| 1315 | @tindex face-documentation | ||
| 1292 | This function returns the documentation string of face @var{face}, or | 1316 | This function returns the documentation string of face @var{face}, or |
| 1293 | @code{nil} if none was specified for it. | 1317 | @code{nil} if none was specified for it. |
| 1294 | @end defun | 1318 | @end defun |
| @@ -1428,7 +1452,7 @@ just like the codes in the range 128 to 255. | |||
| 1428 | @item | 1452 | @item |
| 1429 | Character codes 128 through 255 map to sequences of four glyphs, where | 1453 | Character codes 128 through 255 map to sequences of four glyphs, where |
| 1430 | the first glyph is the @sc{ASCII} code for @samp{\}, and the others are | 1454 | the first glyph is the @sc{ASCII} code for @samp{\}, and the others are |
| 1431 | digit characters representing the charatcer code in octal. (A display | 1455 | digit characters representing the character code in octal. (A display |
| 1432 | table can specify a glyph to use instead of @samp{\}.) | 1456 | table can specify a glyph to use instead of @samp{\}.) |
| 1433 | 1457 | ||
| 1434 | @item | 1458 | @item |
| @@ -1497,7 +1521,8 @@ force redisplay of the mode line using a new display table, call | |||
| 1497 | @node Display Table Format | 1521 | @node Display Table Format |
| 1498 | @subsection Display Table Format | 1522 | @subsection Display Table Format |
| 1499 | 1523 | ||
| 1500 | A display table is actually char-table with subtype @code{display-table}. | 1524 | A display table is actually a char-table (@pxref{Char-Tables}) with |
| 1525 | @code{display-table} as its subtype. | ||
| 1501 | 1526 | ||
| 1502 | @defun make-display-table | 1527 | @defun make-display-table |
| 1503 | This creates and returns a display table. The table initially has | 1528 | This creates and returns a display table. The table initially has |
| @@ -1550,8 +1575,8 @@ effect of setting @code{ctl-arrow} to a non-@code{nil} value: | |||
| 1550 | (aset disptab 127 (vector ?^ ??))) | 1575 | (aset disptab 127 (vector ?^ ??))) |
| 1551 | @end example | 1576 | @end example |
| 1552 | 1577 | ||
| 1553 | @tindex display-table-slot | ||
| 1554 | @defun display-table-slot display-table slot | 1578 | @defun display-table-slot display-table slot |
| 1579 | @tindex display-table-slot | ||
| 1555 | This function returns the value of the extra slot @var{slot} of | 1580 | This function returns the value of the extra slot @var{slot} of |
| 1556 | @var{display-table}. The argument @var{slot} may be a number from 0 to | 1581 | @var{display-table}. The argument @var{slot} may be a number from 0 to |
| 1557 | 5 inclusive, or a slot name (symbol). Valid symbols are | 1582 | 5 inclusive, or a slot name (symbol). Valid symbols are |
| @@ -1559,8 +1584,8 @@ This function returns the value of the extra slot @var{slot} of | |||
| 1559 | @code{selective-display}, and @code{vertical-border}. | 1584 | @code{selective-display}, and @code{vertical-border}. |
| 1560 | @end defun | 1585 | @end defun |
| 1561 | 1586 | ||
| 1562 | @tindex set-display-table-slot | ||
| 1563 | @defun set-display-table-slot display-table slot value | 1587 | @defun set-display-table-slot display-table slot value |
| 1588 | @tindex set-display-table-slot | ||
| 1564 | This function stores @var{value} in the extra slot @var{slot} of | 1589 | This function stores @var{value} in the extra slot @var{slot} of |
| 1565 | @var{display-table}. The argument @var{slot} may be a number from 0 to | 1590 | @var{display-table}. The argument @var{slot} may be a number from 0 to |
| 1566 | 5 inclusive, or a slot name (symbol). Valid symbols are | 1591 | 5 inclusive, or a slot name (symbol). Valid symbols are |
| @@ -1669,14 +1694,14 @@ often you do this; frequent bells can become irritating. Also be | |||
| 1669 | careful not to use just beeping when signaling an error is more | 1694 | careful not to use just beeping when signaling an error is more |
| 1670 | appropriate. (@xref{Errors}.) | 1695 | appropriate. (@xref{Errors}.) |
| 1671 | 1696 | ||
| 1672 | @defun ding &optional dont-terminate | 1697 | @defun ding &optional do-not-terminate |
| 1673 | @cindex keyboard macro termination | 1698 | @cindex keyboard macro termination |
| 1674 | This function beeps, or flashes the screen (see @code{visible-bell} below). | 1699 | This function beeps, or flashes the screen (see @code{visible-bell} below). |
| 1675 | It also terminates any keyboard macro currently executing unless | 1700 | It also terminates any keyboard macro currently executing unless |
| 1676 | @var{dont-terminate} is non-@code{nil}. | 1701 | @var{do-not-terminate} is non-@code{nil}. |
| 1677 | @end defun | 1702 | @end defun |
| 1678 | 1703 | ||
| 1679 | @defun beep &optional dont-terminate | 1704 | @defun beep &optional do-not-terminate |
| 1680 | This is a synonym for @code{ding}. | 1705 | This is a synonym for @code{ding}. |
| 1681 | @end defun | 1706 | @end defun |
| 1682 | 1707 | ||
| @@ -1688,10 +1713,10 @@ provided the terminal's Termcap entry defines the visible bell | |||
| 1688 | capability (@samp{vb}). | 1713 | capability (@samp{vb}). |
| 1689 | @end defvar | 1714 | @end defvar |
| 1690 | 1715 | ||
| 1691 | @tindex ring-bell-function | ||
| 1692 | @defvar ring-bell-function | 1716 | @defvar ring-bell-function |
| 1717 | @tindex ring-bell-function | ||
| 1693 | If this is non-@code{nil}, it specifies how Emacs should ``ring the | 1718 | If this is non-@code{nil}, it specifies how Emacs should ``ring the |
| 1694 | bell.'' Its value should bea function of no arguments. | 1719 | bell.'' Its value should be a function of no arguments. |
| 1695 | @end defvar | 1720 | @end defvar |
| 1696 | 1721 | ||
| 1697 | @node Window Systems | 1722 | @node Window Systems |
| @@ -1714,7 +1739,7 @@ terminal). | |||
| 1714 | This variable is a normal hook which Emacs runs after handling the | 1739 | This variable is a normal hook which Emacs runs after handling the |
| 1715 | initialization files. Emacs runs this hook after it has completed | 1740 | initialization files. Emacs runs this hook after it has completed |
| 1716 | loading your @file{.emacs} file, the default initialization file (if | 1741 | loading your @file{.emacs} file, the default initialization file (if |
| 1717 | any), and the terminal-specific Lisp code, and runring the hook | 1742 | any), and the terminal-specific Lisp code, and running the hook |
| 1718 | @code{term-setup-hook}. | 1743 | @code{term-setup-hook}. |
| 1719 | 1744 | ||
| 1720 | This hook is used for internal purposes: setting up communication with | 1745 | This hook is used for internal purposes: setting up communication with |
diff --git a/lispref/edebug.texi b/lispref/edebug.texi index d8459d2bcea..c93330e38ae 100644 --- a/lispref/edebug.texi +++ b/lispref/edebug.texi | |||
| @@ -36,7 +36,7 @@ Display expression results and evaluate expressions as if outside of | |||
| 36 | Edebug. | 36 | Edebug. |
| 37 | 37 | ||
| 38 | @item | 38 | @item |
| 39 | Automatically reevaluate a list of expressions and | 39 | Automatically re-evaluate a list of expressions and |
| 40 | display their results each time Edebug updates the display. | 40 | display their results each time Edebug updates the display. |
| 41 | 41 | ||
| 42 | @item | 42 | @item |
| @@ -199,11 +199,11 @@ steps into the call after instrumenting the function. | |||
| 199 | @cindex Common Lisp (Edebug) | 199 | @cindex Common Lisp (Edebug) |
| 200 | @pindex cl.el @r{(Edebug)} | 200 | @pindex cl.el @r{(Edebug)} |
| 201 | @pindex cl-specs.el | 201 | @pindex cl-specs.el |
| 202 | Edebug knows how to instrument all the standard special forms, an | 202 | Edebug knows how to instrument all the standard special forms, |
| 203 | interactive form with an expression argument, anonymous lambda | 203 | @code{interactive} forms with an expression argument, anonymous lambda |
| 204 | expressions, and other defining forms. Edebug cannot know what a | 204 | expressions, and other defining forms. Edebug cannot know what a |
| 205 | user-defined macro will do with the arguments of a macro call, so you | 205 | user-defined macro will do with the arguments of a macro call, so you |
| 206 | must tell it; @xref{Instrumenting Macro Calls}, for details. | 206 | must tell it; see @ref{Instrumenting Macro Calls}, for details. |
| 207 | 207 | ||
| 208 | When Edebug is about to instrument code for the first time in a | 208 | When Edebug is about to instrument code for the first time in a |
| 209 | session, it runs the hook @code{edebug-setup-hook}, then sets it to | 209 | session, it runs the hook @code{edebug-setup-hook}, then sets it to |
| @@ -212,7 +212,7 @@ session, it runs the hook @code{edebug-setup-hook}, then sets it to | |||
| 212 | using, but actually load them only if you use Edebug. | 212 | using, but actually load them only if you use Edebug. |
| 213 | 213 | ||
| 214 | @findex eval-expression @r{(Edebug)} | 214 | @findex eval-expression @r{(Edebug)} |
| 215 | To remove instrumentation from a definition, simply reevaluate its | 215 | To remove instrumentation from a definition, simply re-evaluate its |
| 216 | definition in a way that does not instrument. There are two ways of | 216 | definition in a way that does not instrument. There are two ways of |
| 217 | evaluating forms that never instrument them: from a file with | 217 | evaluating forms that never instrument them: from a file with |
| 218 | @code{load}, and from the minibuffer with @code{eval-expression} | 218 | @code{load}, and from the minibuffer with @code{eval-expression} |
| @@ -335,8 +335,8 @@ Step into the function or macro called by the form after point. | |||
| 335 | @end table | 335 | @end table |
| 336 | 336 | ||
| 337 | The @kbd{h} command proceeds to the stop point near the current location | 337 | The @kbd{h} command proceeds to the stop point near the current location |
| 338 | if point, using a temporary breakpoint. See @ref{Breakpoints}, for more | 338 | of point, using a temporary breakpoint. See @ref{Breakpoints}, for more |
| 339 | about breakpoints. | 339 | information about breakpoints. |
| 340 | 340 | ||
| 341 | The @kbd{f} command runs the program forward over one expression. More | 341 | The @kbd{f} command runs the program forward over one expression. More |
| 342 | precisely, it sets a temporary breakpoint at the position that | 342 | precisely, it sets a temporary breakpoint at the position that |
| @@ -463,7 +463,7 @@ with @kbd{u}. First move point to the Edebug stop point of your choice, | |||
| 463 | then type @kbd{b} or @kbd{u} to set or unset a breakpoint there. | 463 | 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. | 464 | Unsetting a breakpoint where none has been set has no effect. |
| 465 | 465 | ||
| 466 | Reevaluating or reinstrumenting a definition forgets all its breakpoints. | 466 | Re-evaluating or reinstrumenting a definition forgets all its breakpoints. |
| 467 | 467 | ||
| 468 | A @dfn{conditional breakpoint} tests a condition each time the program | 468 | A @dfn{conditional breakpoint} tests a condition each time the program |
| 469 | gets there. Any errors that occur as a result of evaluating the | 469 | gets there. Any errors that occur as a result of evaluating the |
| @@ -568,7 +568,7 @@ are bound to the values they had outside of Edebug. | |||
| 568 | @subsection Edebug Views | 568 | @subsection Edebug Views |
| 569 | 569 | ||
| 570 | These Edebug commands let you view aspects of the buffer and window | 570 | These Edebug commands let you view aspects of the buffer and window |
| 571 | status that obtained before entry to Edebug. The outside window | 571 | status as they were before entry to Edebug. The outside window |
| 572 | configuration is the collection of windows and contents that were in | 572 | configuration is the collection of windows and contents that were in |
| 573 | effect outside of Edebug. | 573 | effect outside of Edebug. |
| 574 | 574 | ||
| @@ -745,7 +745,6 @@ After selecting @samp{*edebug*}, you can return to the source code | |||
| 745 | buffer with @kbd{C-c C-w}. The @samp{*edebug*} buffer is killed when | 745 | buffer with @kbd{C-c C-w}. The @samp{*edebug*} buffer is killed when |
| 746 | you continue execution, and recreated next time it is needed. | 746 | you continue execution, and recreated next time it is needed. |
| 747 | 747 | ||
| 748 | |||
| 749 | @node Printing in Edebug | 748 | @node Printing in Edebug |
| 750 | @subsection Printing in Edebug | 749 | @subsection Printing in Edebug |
| 751 | 750 | ||
| @@ -765,7 +764,6 @@ and @code{edebug-print-level} specify the values to use within Edebug.) | |||
| 765 | @defopt edebug-print-length | 764 | @defopt edebug-print-length |
| 766 | If non-@code{nil}, bind @code{print-length} to this while printing | 765 | If non-@code{nil}, bind @code{print-length} to this while printing |
| 767 | results in Edebug. The default value is @code{50}. | 766 | results in Edebug. The default value is @code{50}. |
| 768 | @xref{Printing in Edebug}. | ||
| 769 | @end defopt | 767 | @end defopt |
| 770 | 768 | ||
| 771 | @defopt edebug-print-level | 769 | @defopt edebug-print-level |
| @@ -785,13 +783,13 @@ edebug-uninstall-custom-print}. | |||
| 785 | 783 | ||
| 786 | @example | 784 | @example |
| 787 | (setq a '(x y)) | 785 | (setq a '(x y)) |
| 788 | (setcar a a)) | 786 | (setcar a a) |
| 789 | @end example | 787 | @end example |
| 790 | 788 | ||
| 791 | @noindent | 789 | @noindent |
| 792 | Custom printing prints this as @samp{Result: #1=(#1# y)}. The | 790 | Custom printing prints this as @samp{Result: #1=(#1# y)}. The |
| 793 | @samp{#1=} notation labels the structure that follows it with the label | 791 | @samp{#1=} notation labels the structure that follows it with the label |
| 794 | @samp{1}, and the @samp{#1#} notation references the previously labelled | 792 | @samp{1}, and the @samp{#1#} notation references the previously labeled |
| 795 | structure. This notation is used for any shared elements of lists or | 793 | structure. This notation is used for any shared elements of lists or |
| 796 | vectors. | 794 | vectors. |
| 797 | 795 | ||
| @@ -857,12 +855,19 @@ last lines inserted. | |||
| 857 | @cindex frequency counts | 855 | @cindex frequency counts |
| 858 | @cindex performance analysis | 856 | @cindex performance analysis |
| 859 | Edebug provides rudimentary coverage testing and display of execution | 857 | Edebug provides rudimentary coverage testing and display of execution |
| 860 | frequency. All execution of an instrumented function accumulates | 858 | frequency. Coverage testing works by comparing the result of each |
| 861 | frequency counts, both before and after evaluation of each instrumented | 859 | expression with the previous result; coverage is considered OK if two |
| 862 | expression, even if the execution mode is Go-nonstop. Coverage testing | 860 | different results are found. Thus, to sufficiently test the coverage of |
| 863 | is more expensive, so it is done only if @code{edebug-test-coverage} is | 861 | your code, try to execute it under conditions that evaluate all |
| 864 | non-@code{nil}. The command @kbd{M-x edebug-display-freq-count} | 862 | expressions more than once, and produce different results for each |
| 865 | displays both the frequency data and the coverage data (if recorded). | 863 | expression. Coverage testing makes execution slower, so it is only done |
| 864 | if @code{edebug-test-coverage} is non-@code{nil}. Whether or not | ||
| 865 | coverage testing is enabled, frequency counting is performed for all | ||
| 866 | execution of an instrumented function, even if the execution mode is | ||
| 867 | Go-nonstop. | ||
| 868 | |||
| 869 | Use @kbd{M-x edebug-display-freq-count} to display both the | ||
| 870 | coverage information and the frequency counts for a definition. | ||
| 866 | 871 | ||
| 867 | @deffn Command edebug-display-freq-count | 872 | @deffn Command edebug-display-freq-count |
| 868 | This command displays the frequency count data for each line of the | 873 | This command displays the frequency count data for each line of the |
| @@ -871,15 +876,16 @@ current definition. | |||
| 871 | The frequency counts appear as comment lines after each line of code, | 876 | The frequency counts appear as comment lines after each line of code, |
| 872 | and you can undo all insertions with one @code{undo} command. The | 877 | and you can undo all insertions with one @code{undo} command. The |
| 873 | counts appear under the @samp{(} before an expression or the @samp{)} | 878 | counts appear under the @samp{(} before an expression or the @samp{)} |
| 874 | after an expression, or on the last character of a symbol. Values do | 879 | after an expression, or on the last character of a variable. To |
| 875 | not appear if they are equal to the previous count on the same line. | 880 | simplify the display, a count is not shown if it is equal to the |
| 881 | count of an earlier expression on the same line. | ||
| 876 | 882 | ||
| 877 | The character @samp{=} following the count for an expression says that | 883 | The character @samp{=} following the count for an expression says that |
| 878 | the expression has returned the same value each time it was evaluated | 884 | the expression has returned the same value each time it was evaluated. |
| 879 | This is the only coverage information that Edebug records. | 885 | This is the only coverage information that Edebug records. |
| 880 | 886 | ||
| 881 | To clear the frequency count and coverage data for a definition, | 887 | To clear the frequency count and coverage data for a definition, |
| 882 | reinstrument it. | 888 | simply reinstrument it with @code{eval-defun}. |
| 883 | @end deffn | 889 | @end deffn |
| 884 | 890 | ||
| 885 | For example, after evaluating @code{(fac 5)} with a source | 891 | For example, after evaluating @code{(fac 5)} with a source |
| @@ -930,8 +936,8 @@ program. | |||
| 930 | @itemize @bullet | 936 | @itemize @bullet |
| 931 | @item | 937 | @item |
| 932 | @code{max-lisp-eval-depth} and @code{max-specpdl-size} are both | 938 | @code{max-lisp-eval-depth} and @code{max-specpdl-size} are both |
| 933 | incremented one time to reduce Edebug's impact on the stack. | 939 | incremented once to reduce Edebug's impact on the stack. You could, |
| 934 | You could, however, still run out of stack space when using Edebug. | 940 | however, still run out of stack space when using Edebug. |
| 935 | 941 | ||
| 936 | @item | 942 | @item |
| 937 | The state of keyboard macro execution is saved and restored. While | 943 | The state of keyboard macro execution is saved and restored. While |
| @@ -1067,8 +1073,8 @@ name. | |||
| 1067 | @end deffn | 1073 | @end deffn |
| 1068 | 1074 | ||
| 1069 | Here is a simple example that defines the specification for the | 1075 | Here is a simple example that defines the specification for the |
| 1070 | @code{for} macro described in the Emacs Lisp Reference Manual, followed | 1076 | @code{for} example macro (@code{Argument Evaluation}), followed by an |
| 1071 | by an alternative, equivalent specification. | 1077 | alternative, equivalent specification. |
| 1072 | 1078 | ||
| 1073 | @example | 1079 | @example |
| 1074 | (def-edebug-spec for | 1080 | (def-edebug-spec for |
| @@ -1091,7 +1097,7 @@ None of the arguments is instrumented. | |||
| 1091 | @item a symbol | 1097 | @item a symbol |
| 1092 | The symbol must have an Edebug specification which is used instead. | 1098 | The symbol must have an Edebug specification which is used instead. |
| 1093 | This indirection is repeated until another kind of specification is | 1099 | This indirection is repeated until another kind of specification is |
| 1094 | found. This allows you to inherit the specification for another macro. | 1100 | found. This allows you to inherit the specification from another macro. |
| 1095 | 1101 | ||
| 1096 | @item a list | 1102 | @item a list |
| 1097 | The elements of the list describe the types of the arguments of a | 1103 | The elements of the list describe the types of the arguments of a |
| @@ -1137,9 +1143,8 @@ their meanings: | |||
| 1137 | 1143 | ||
| 1138 | @table @code | 1144 | @table @code |
| 1139 | @item sexp | 1145 | @item sexp |
| 1140 | A single Lisp object, not unevaluated. | 1146 | A single unevaluated expression, which is not instrumented. |
| 1141 | @c "unevaluated expression" is not meaningful, because | 1147 | @c an "expression" is not necessarily intended for evaluation. |
| 1142 | @c an expression is a Lisp object intended for evaluation. | ||
| 1143 | 1148 | ||
| 1144 | @item form | 1149 | @item form |
| 1145 | A single evaluated expression, which is instrumented. | 1150 | A single evaluated expression, which is instrumented. |
| @@ -1202,7 +1207,7 @@ succeeds. | |||
| 1202 | @item &define | 1207 | @item &define |
| 1203 | @kindex &define @r{(Edebug)} | 1208 | @kindex &define @r{(Edebug)} |
| 1204 | Indicates that the specification is for a defining form. The defining | 1209 | Indicates that the specification is for a defining form. The defining |
| 1205 | form itself is not instrumented (i.e. Edebug does not stop before and | 1210 | form itself is not instrumented (that is, Edebug does not stop before and |
| 1206 | after the defining form), but forms inside it typically will be | 1211 | after the defining form), but forms inside it typically will be |
| 1207 | instrumented. The @code{&define} keyword should be the first element in | 1212 | instrumented. The @code{&define} keyword should be the first element in |
| 1208 | a list specification. | 1213 | a list specification. |
| @@ -1260,7 +1265,7 @@ a list whose elements match the specification @var{elements}. | |||
| 1260 | A sublist specification may be a dotted list and the corresponding list | 1265 | A sublist specification may be a dotted list and the corresponding list |
| 1261 | argument may then be a dotted list. Alternatively, the last @sc{cdr} of a | 1266 | argument may then be a dotted list. Alternatively, the last @sc{cdr} of a |
| 1262 | dotted list specification may be another sublist specification (via a | 1267 | dotted list specification may be another sublist specification (via a |
| 1263 | grouping or an indirect specification, e.g. @code{(spec . [(more | 1268 | grouping or an indirect specification, e.g., @code{(spec . [(more |
| 1264 | specs@dots{})])}) whose elements match the non-dotted list arguments. | 1269 | specs@dots{})])}) whose elements match the non-dotted list arguments. |
| 1265 | This is useful in recursive specifications such as in the backquote | 1270 | This is useful in recursive specifications such as in the backquote |
| 1266 | example below. Also see the description of a @code{nil} specification | 1271 | example below. Also see the description of a @code{nil} specification |
| @@ -1293,7 +1298,7 @@ than once. | |||
| 1293 | 1298 | ||
| 1294 | @item arg | 1299 | @item arg |
| 1295 | The argument, a symbol, is the name of an argument of the defining form. | 1300 | The argument, a symbol, is the name of an argument of the defining form. |
| 1296 | However, lambda list keywords (symbols starting with @samp{@code{&}}) | 1301 | However, lambda-list keywords (symbols starting with @samp{&}) |
| 1297 | are not allowed. | 1302 | are not allowed. |
| 1298 | 1303 | ||
| 1299 | @item lambda-list | 1304 | @item lambda-list |
| @@ -1326,33 +1331,35 @@ necessarily mean a syntax error will be signaled; instead, | |||
| 1326 | exhausted. Eventually every element of the argument list must be | 1331 | exhausted. Eventually every element of the argument list must be |
| 1327 | matched by some element in the specification, and every required element | 1332 | matched by some element in the specification, and every required element |
| 1328 | in the specification must match some argument. | 1333 | in the specification must match some argument. |
| 1329 | 1334 | ||
| 1330 | Backtracking is disabled for the remainder of a sublist or group when | 1335 | When a syntax error is detected, it might not be reported until much |
| 1331 | certain conditions occur, described below. Backtracking is reenabled | 1336 | later after higher-level alternatives have been exhausted, and with the |
| 1332 | when a new alternative is established by @code{&optional}, @code{&rest}, | 1337 | point positioned further from the real error. But if backtracking is |
| 1333 | or @code{&or}. It is also reenabled initially when processing a | 1338 | disabled when an error occurs, it can be reported immediately. Note |
| 1334 | sublist or group specification or an indirect specification. | 1339 | that backtracking is also reenabled automatically in several situations; |
| 1335 | 1340 | it is reenabled when a new alternative is established by | |
| 1336 | You might want to disable backtracking to commit to some alternative so | 1341 | @code{&optional}, @code{&rest}, or @code{&or}, or at the start of |
| 1337 | that Edebug can provide a more specific syntax error message. Normally, | 1342 | processing a sublist, group, or indirect specification. The effect of |
| 1338 | if no alternative matches, Edebug reports that none matched, but if one | 1343 | enabling or disabling backtracking is limited to the remainder of the |
| 1339 | alternative is committed to, Edebug can report how it failed to match. | 1344 | level currently being processed and lower levels. |
| 1340 | 1345 | ||
| 1341 | First, backtracking is disabled while matching any of the form | 1346 | Backtracking is disabled while matching any of the |
| 1342 | specifications (i.e. @code{form}, @code{body}, @code{def-form}, and | 1347 | form specifications (that is, @code{form}, @code{body}, @code{def-form}, and |
| 1343 | @code{def-body}). These specifications will match any form so any error | 1348 | @code{def-body}). These specifications will match any form so any error |
| 1344 | must be in the form itself rather than at a higher level. | 1349 | must be in the form itself rather than at a higher level. |
| 1345 | 1350 | ||
| 1346 | Second, backtracking is disabled after successfully matching a quoted | 1351 | Backtracking is also disabled after successfully matching a quoted |
| 1347 | symbol or string specification, since this usually indicates a | 1352 | symbol or string specification, since this usually indicates a |
| 1348 | recognized construct. If you have a set of alternative constructs that | 1353 | recognized construct. But if you have a set of alternative constructs that |
| 1349 | all begin with the same symbol, you can usually work around this | 1354 | all begin with the same symbol, you can usually work around this |
| 1350 | constraint by factoring the symbol out of the alternatives, e.g., | 1355 | constraint by factoring the symbol out of the alternatives, e.g., |
| 1351 | @code{["foo" &or [first case] [second case] ...]}. | 1356 | @code{["foo" &or [first case] [second case] ...]}. |
| 1352 | 1357 | ||
| 1353 | Third, backtracking may be explicitly disabled by using the | 1358 | Most needs are satisfied by these two ways that bactracking is |
| 1354 | @code{gate} specification. This is useful when you know that | 1359 | automatically disabled, but occasionally it is useful to explicitly |
| 1355 | no higher alternatives may apply. | 1360 | disable backtracking by using the @code{gate} specification. This is |
| 1361 | useful when you know that no higher alternatives could apply. See the | ||
| 1362 | example of the @code{let} specification. | ||
| 1356 | 1363 | ||
| 1357 | @node Specification Examples | 1364 | @node Specification Examples |
| 1358 | @subsubsection Specification Examples | 1365 | @subsubsection Specification Examples |
| @@ -1362,7 +1369,7 @@ the examples provided here. | |||
| 1362 | 1369 | ||
| 1363 | A @code{let} special form has a sequence of bindings and a body. Each | 1370 | A @code{let} special form has a sequence of bindings and a body. Each |
| 1364 | of the bindings is either a symbol or a sublist with a symbol and | 1371 | of the bindings is either a symbol or a sublist with a symbol and |
| 1365 | optional value. In the specification below, notice the @code{gate} | 1372 | optional expression. In the specification below, notice the @code{gate} |
| 1366 | inside of the sublist to prevent backtracking once a sublist is found. | 1373 | inside of the sublist to prevent backtracking once a sublist is found. |
| 1367 | 1374 | ||
| 1368 | @example | 1375 | @example |
| @@ -1491,19 +1498,11 @@ function entry or exit per line, indented by the recursion level. | |||
| 1491 | 1498 | ||
| 1492 | The default value is @code{nil}. | 1499 | The default value is @code{nil}. |
| 1493 | 1500 | ||
| 1494 | Also see @code{edebug-tracing}, in @xref{Trace Buffer}. | 1501 | Also see @code{edebug-tracing}, in @ref{Trace Buffer}. |
| 1495 | @end defopt | 1502 | @end defopt |
| 1496 | 1503 | ||
| 1497 | @defopt edebug-test-coverage | 1504 | @defopt edebug-test-coverage |
| 1498 | If non-@code{nil}, Edebug tests coverage of all expressions debugged. | 1505 | If non-@code{nil}, Edebug tests coverage of all expressions debugged. |
| 1499 | This is done by comparing the result of each expression | ||
| 1500 | with the previous result. Coverage is considered OK if two different | ||
| 1501 | results are found. So to sufficiently test the coverage of your code, | ||
| 1502 | try to execute it under conditions that evaluate all expressions more | ||
| 1503 | than once, and produce different results for each expression. | ||
| 1504 | |||
| 1505 | Use @kbd{M-x edebug-display-freq-count} to display the frequency count | ||
| 1506 | and coverage information for a definition. | ||
| 1507 | @xref{Coverage Testing}. | 1506 | @xref{Coverage Testing}. |
| 1508 | @end defopt | 1507 | @end defopt |
| 1509 | 1508 | ||
diff --git a/lispref/elisp.texi b/lispref/elisp.texi index 6005cff535e..7dbc8093346 100644 --- a/lispref/elisp.texi +++ b/lispref/elisp.texi | |||
| @@ -4,6 +4,8 @@ | |||
| 4 | @settitle GNU Emacs Lisp Reference Manual | 4 | @settitle GNU Emacs Lisp Reference Manual |
| 5 | @c %**end of header | 5 | @c %**end of header |
| 6 | 6 | ||
| 7 | @smallbook | ||
| 8 | |||
| 7 | @ifinfo | 9 | @ifinfo |
| 8 | This version is the edition 2.5 of the GNU Emacs Lisp | 10 | This version is the edition 2.5 of the GNU Emacs Lisp |
| 9 | Reference Manual. It corresponds to Emacs Version 20.3 | 11 | Reference Manual. It corresponds to Emacs Version 20.3 |
| @@ -269,7 +271,7 @@ Editing Types | |||
| 269 | * Process Type:: A process running on the underlying OS. | 271 | * Process Type:: A process running on the underlying OS. |
| 270 | * Stream Type:: Receive or send characters. | 272 | * Stream Type:: Receive or send characters. |
| 271 | * Keymap Type:: What function a keystroke invokes. | 273 | * Keymap Type:: What function a keystroke invokes. |
| 272 | * Syntax Table Type:: What a character means. | 274 | * Overlay Type:: How an overlay is represented. |
| 273 | 275 | ||
| 274 | Numbers | 276 | Numbers |
| 275 | 277 | ||
| @@ -291,7 +293,7 @@ Strings and Characters | |||
| 291 | * Text Comparison:: Comparing characters or strings. | 293 | * Text Comparison:: Comparing characters or strings. |
| 292 | * String Conversion:: Converting characters or strings and vice versa. | 294 | * String Conversion:: Converting characters or strings and vice versa. |
| 293 | * Formatting Strings:: @code{format}: Emacs's analog of @code{printf}. | 295 | * Formatting Strings:: @code{format}: Emacs's analog of @code{printf}. |
| 294 | * Character Case:: Case conversion functions. | 296 | * Case Conversion:: Case conversion functions. |
| 295 | 297 | ||
| 296 | Lists | 298 | Lists |
| 297 | 299 | ||
| @@ -443,6 +445,19 @@ Byte Compilation | |||
| 443 | * Compilation Functions:: Byte compilation functions. | 445 | * Compilation Functions:: Byte compilation functions. |
| 444 | * Disassembly:: Disassembling byte-code; how to read byte-code. | 446 | * Disassembly:: Disassembling byte-code; how to read byte-code. |
| 445 | 447 | ||
| 448 | Advising Functions | ||
| 449 | |||
| 450 | * Simple Advice:: A simple example to explain the basics of advice. | ||
| 451 | * Defining Advice:: Detailed description of @code{defadvice}. | ||
| 452 | * Computed Advice:: ...is to @code{defadvice} as @code{fset} is to @code{defun}. | ||
| 453 | * Activation of Advice:: Advice doesn't do anything until you activate it. | ||
| 454 | * Enabling Advice:: You can enable or disable each piece of advice. | ||
| 455 | * Preactivation:: Preactivation is a way of speeding up the | ||
| 456 | loading of compiled advice. | ||
| 457 | * Argument Access:: How advice can access the function's arguments. | ||
| 458 | * Subr Arguments:: Accessing arguments when advising a primitive. | ||
| 459 | * Combined Definition:: How advice is implemented. | ||
| 460 | |||
| 446 | Debugging Lisp Programs | 461 | Debugging Lisp Programs |
| 447 | 462 | ||
| 448 | * Debugger:: How the Emacs Lisp debugger is implemented. | 463 | * Debugger:: How the Emacs Lisp debugger is implemented. |
| @@ -684,7 +699,7 @@ Frames | |||
| 684 | * Pop-Up Menus:: Displaying a menu for the user to select from. | 699 | * Pop-Up Menus:: Displaying a menu for the user to select from. |
| 685 | * Dialog Boxes:: Displaying a box to ask yes or no. | 700 | * Dialog Boxes:: Displaying a box to ask yes or no. |
| 686 | * Pointer Shapes:: Specifying the shape of the mouse pointer. | 701 | * Pointer Shapes:: Specifying the shape of the mouse pointer. |
| 687 | * X Selections:: Transferring text to and from other X clients. | 702 | * Window System Selections::Transferring text to and from other X clients. |
| 688 | * Color Names:: Getting the definitions of color names. | 703 | * Color Names:: Getting the definitions of color names. |
| 689 | * Resources:: Getting resource values from the server. | 704 | * Resources:: Getting resource values from the server. |
| 690 | * Server Data:: Getting info about the X server. | 705 | * Server Data:: Getting info about the X server. |
| @@ -951,7 +966,7 @@ Object Internals | |||
| 951 | @include index.texi | 966 | @include index.texi |
| 952 | 967 | ||
| 953 | @node New Symbols, , Index, Top | 968 | @node New Symbols, , Index, Top |
| 954 | @chapter New Symbols Since the Previous Edition | 969 | @unnumbered New Symbols Since the Previous Edition |
| 955 | 970 | ||
| 956 | @printindex tp | 971 | @printindex tp |
| 957 | 972 | ||
diff --git a/lispref/errors.texi b/lispref/errors.texi index 809db995ed0..823eadddeac 100644 --- a/lispref/errors.texi +++ b/lispref/errors.texi | |||
| @@ -104,7 +104,7 @@ This is a @code{file-error}.@* | |||
| 104 | @xref{Regular Expressions}. | 104 | @xref{Regular Expressions}. |
| 105 | 105 | ||
| 106 | @item mark-inactive | 106 | @item mark-inactive |
| 107 | @code{Mark inactive"}@* | 107 | @code{"Mark inactive"}@* |
| 108 | @xref{The Mark}. | 108 | @xref{The Mark}. |
| 109 | 109 | ||
| 110 | @item no-catch | 110 | @item no-catch |
diff --git a/lispref/eval.texi b/lispref/eval.texi index 512e6d927b2..d49aba1cc16 100644 --- a/lispref/eval.texi +++ b/lispref/eval.texi | |||
| @@ -464,6 +464,9 @@ Emacs Lisp with a reference to where each is described. | |||
| 464 | @item quote | 464 | @item quote |
| 465 | @pxref{Quoting} | 465 | @pxref{Quoting} |
| 466 | 466 | ||
| 467 | @item save-current-buffer | ||
| 468 | @pxref{Current Buffer} | ||
| 469 | |||
| 467 | @item save-excursion | 470 | @item save-excursion |
| 468 | @pxref{Excursions} | 471 | @pxref{Excursions} |
| 469 | 472 | ||
| @@ -657,8 +660,10 @@ The depth limit counts internal uses of @code{eval}, @code{apply}, and | |||
| 657 | expressions, and recursive evaluation of function call arguments and | 660 | expressions, and recursive evaluation of function call arguments and |
| 658 | function body forms, as well as explicit calls in Lisp code. | 661 | function body forms, as well as explicit calls in Lisp code. |
| 659 | 662 | ||
| 660 | The default value of this variable is 200. If you set it to a value | 663 | The default value of this variable is 300. If you set it to a value |
| 661 | less than 100, Lisp will reset it to 100 if the given value is reached. | 664 | less than 100, Lisp will reset it to 100 if the given value is reached. |
| 665 | Entry to the Lisp debugger increases the value, if there is little room | ||
| 666 | left, to make sure the debugger itself has room to execute. | ||
| 662 | 667 | ||
| 663 | @code{max-specpdl-size} provides another limit on nesting. | 668 | @code{max-specpdl-size} provides another limit on nesting. |
| 664 | @xref{Local Variables}. | 669 | @xref{Local Variables}. |
diff --git a/lispref/files.texi b/lispref/files.texi index 45f8097fecd..940ac549210 100644 --- a/lispref/files.texi +++ b/lispref/files.texi | |||
| @@ -15,7 +15,7 @@ described in @ref{Backups and Auto-Saving}. | |||
| 15 | 15 | ||
| 16 | Many of the file functions take one or more arguments that are file | 16 | Many of the file functions take one or more arguments that are file |
| 17 | names. A file name is actually a string. Most of these functions | 17 | names. A file name is actually a string. Most of these functions |
| 18 | expand file name arguments using @code{expand-file-name}, so that | 18 | expand file name arguments by calling @code{expand-file-name}, so that |
| 19 | @file{~} is handled correctly, as are relative file names (including | 19 | @file{~} is handled correctly, as are relative file names (including |
| 20 | @samp{../}). These functions don't recognize environment variable | 20 | @samp{../}). These functions don't recognize environment variable |
| 21 | substitutions such as @samp{$HOME}. @xref{File Name Expansion}. | 21 | substitutions such as @samp{$HOME}. @xref{File Name Expansion}. |
| @@ -201,9 +201,9 @@ used, and in many cases only some of the functions are called. | |||
| 201 | @comment node-name, next, previous, up | 201 | @comment node-name, next, previous, up |
| 202 | @subsection Subroutines of Visiting | 202 | @subsection Subroutines of Visiting |
| 203 | 203 | ||
| 204 | The @code{find-file-noselect} function uses the | 204 | The @code{find-file-noselect} function uses two important subroutines |
| 205 | @code{create-file-buffer} and @code{after-find-file} functions as | 205 | which are sometimes useful in user Lisp code: @code{create-file-buffer} |
| 206 | subroutines. Sometimes it is useful to call them directly. | 206 | and @code{after-find-file}. This section explains how to use them. |
| 207 | 207 | ||
| 208 | @defun create-file-buffer filename | 208 | @defun create-file-buffer filename |
| 209 | This function creates a suitably named buffer for visiting | 209 | This function creates a suitably named buffer for visiting |
| @@ -251,7 +251,7 @@ If @var{warn} is non-@code{nil}, then this function issues a warning | |||
| 251 | if an auto-save file exists and is more recent than the visited file. | 251 | if an auto-save file exists and is more recent than the visited file. |
| 252 | 252 | ||
| 253 | The last thing @code{after-find-file} does is call all the functions | 253 | The last thing @code{after-find-file} does is call all the functions |
| 254 | in @code{find-file-hooks}. | 254 | in the list @code{find-file-hooks}. |
| 255 | @end defun | 255 | @end defun |
| 256 | 256 | ||
| 257 | @node Saving Buffers | 257 | @node Saving Buffers |
| @@ -334,6 +334,12 @@ You might wish to save the file modes value returned by | |||
| 334 | @code{backup-buffer} and use that to set the mode bits of the file that | 334 | @code{backup-buffer} and use that to set the mode bits of the file that |
| 335 | you write. This is what @code{save-buffer} normally does. | 335 | you write. This is what @code{save-buffer} normally does. |
| 336 | 336 | ||
| 337 | The hook functions in @code{write-file-hooks} are also responsible for | ||
| 338 | encoding the data (if desired): they must choose a suitable coding | ||
| 339 | system (@pxref{Lisp and Coding Systems}), perform the encoding | ||
| 340 | (@pxref{Explicit Encoding}), and set @code{last-coding-system-used} to | ||
| 341 | the coding system that was used (@pxref{Specifying Coding Systems}). | ||
| 342 | |||
| 337 | Do not make this variable buffer-local. To set up buffer-specific hook | 343 | Do not make this variable buffer-local. To set up buffer-specific hook |
| 338 | functions, use @code{write-contents-hooks} instead. | 344 | functions, use @code{write-contents-hooks} instead. |
| 339 | 345 | ||
| @@ -448,12 +454,13 @@ contents of the file. This is better than simply deleting the buffer | |||
| 448 | contents and inserting the whole file, because (1) it preserves some | 454 | contents and inserting the whole file, because (1) it preserves some |
| 449 | marker positions and (2) it puts less data in the undo list. | 455 | marker positions and (2) it puts less data in the undo list. |
| 450 | 456 | ||
| 451 | It works to read a special file with @code{insert-file-contents} | 457 | It is possible to read a special file (such as a FIFO or an I/O device) |
| 452 | as long as @var{replace} and @var{visit} are @code{nil}. | 458 | with @code{insert-file-contents}, as long as @var{replace} and |
| 459 | @var{visit} are @code{nil}. | ||
| 453 | @end defun | 460 | @end defun |
| 454 | 461 | ||
| 455 | @tindex insert-file-contents-literally | ||
| 456 | @defun insert-file-contents-literally filename &optional visit beg end replace | 462 | @defun insert-file-contents-literally filename &optional visit beg end replace |
| 463 | @tindex insert-file-contents-literally | ||
| 457 | This function works like @code{insert-file-contents} except that it does | 464 | This function works like @code{insert-file-contents} except that it does |
| 458 | not do format decoding (@pxref{Format Conversion}), does not do | 465 | not do format decoding (@pxref{Format Conversion}), does not do |
| 459 | character code conversion (@pxref{Coding Systems}), does not run | 466 | character code conversion (@pxref{Coding Systems}), does not run |
| @@ -485,7 +492,7 @@ An error is signaled if @var{filename} specifies a nonwritable file, | |||
| 485 | or a nonexistent file in a directory where files cannot be created. | 492 | or a nonexistent file in a directory where files cannot be created. |
| 486 | @end deffn | 493 | @end deffn |
| 487 | 494 | ||
| 488 | @deffn Command write-region start end filename &optional append visit | 495 | @deffn Command write-region start end filename &optional append visit confirm |
| 489 | This function writes the region delimited by @var{start} and @var{end} | 496 | This function writes the region delimited by @var{start} and @var{end} |
| 490 | in the current buffer into the file specified by @var{filename}. | 497 | in the current buffer into the file specified by @var{filename}. |
| 491 | 498 | ||
| @@ -496,6 +503,9 @@ that string, rather than text from the buffer. | |||
| 496 | If @var{append} is non-@code{nil}, then the specified text is appended | 503 | If @var{append} is non-@code{nil}, then the specified text is appended |
| 497 | to the existing file contents (if any). | 504 | to the existing file contents (if any). |
| 498 | 505 | ||
| 506 | If @var{confirm} is non-@code{nil}, then @code{write-region} asks | ||
| 507 | for confirmation if @var{filename} names an existing file. | ||
| 508 | |||
| 499 | If @var{visit} is @code{t}, then Emacs establishes an association | 509 | If @var{visit} is @code{t}, then Emacs establishes an association |
| 500 | between the buffer and the file: the buffer is then visiting that file. | 510 | between the buffer and the file: the buffer is then visiting that file. |
| 501 | It also sets the last file modification time for the current buffer to | 511 | It also sets the last file modification time for the current buffer to |
| @@ -524,8 +534,8 @@ feature is useful for programs that use files for internal purposes, | |||
| 524 | files that the user does not need to know about. | 534 | files that the user does not need to know about. |
| 525 | @end deffn | 535 | @end deffn |
| 526 | 536 | ||
| 527 | @tindex with-temp-file | ||
| 528 | @defmac with-temp-file file body... | 537 | @defmac with-temp-file file body... |
| 538 | @tindex with-temp-file | ||
| 529 | The @code{with-temp-file} macro evaluates the @var{body} forms with a | 539 | The @code{with-temp-file} macro evaluates the @var{body} forms with a |
| 530 | temporary buffer as the current buffer; then, at the end, it writes the | 540 | temporary buffer as the current buffer; then, at the end, it writes the |
| 531 | buffer contents into file @var{file}. It kills the temporary buffer | 541 | buffer contents into file @var{file}. It kills the temporary buffer |
| @@ -732,8 +742,8 @@ we can deduce that any attempt to read a file in @file{/foo/} will | |||
| 732 | give an error. | 742 | give an error. |
| 733 | @end defun | 743 | @end defun |
| 734 | 744 | ||
| 735 | @tindex access-file | ||
| 736 | @defun access-file filename string | 745 | @defun access-file filename string |
| 746 | @tindex access-file | ||
| 737 | This function opens file @var{filename} for reading, then closes it and | 747 | This function opens file @var{filename} for reading, then closes it and |
| 738 | returns @code{nil}. However, if the open fails, it signals an error | 748 | returns @code{nil}. However, if the open fails, it signals an error |
| 739 | using @var{string} as the error message text. | 749 | using @var{string} as the error message text. |
| @@ -1103,9 +1113,9 @@ In the first part of the following example, we list two files, | |||
| 1103 | 1113 | ||
| 1104 | @example | 1114 | @example |
| 1105 | @group | 1115 | @group |
| 1106 | % ls -l fo* | 1116 | % ls -li fo* |
| 1107 | -rw-rw-rw- 1 rms 29 Aug 18 20:32 foo | 1117 | 81908 -rw-rw-rw- 1 rms 29 Aug 18 20:32 foo |
| 1108 | -rw-rw-rw- 1 rms 24 Aug 18 20:31 foo3 | 1118 | 84302 -rw-rw-rw- 1 rms 24 Aug 18 20:31 foo3 |
| 1109 | @end group | 1119 | @end group |
| 1110 | @end example | 1120 | @end example |
| 1111 | 1121 | ||
| @@ -1115,23 +1125,22 @@ the files again. This shows two names for one file, @file{foo} and | |||
| 1115 | 1125 | ||
| 1116 | @example | 1126 | @example |
| 1117 | @group | 1127 | @group |
| 1118 | (add-name-to-file "~/lewis/foo" "~/lewis/foo2") | 1128 | (add-name-to-file "foo" "foo2") |
| 1119 | @result{} nil | 1129 | @result{} nil |
| 1120 | @end group | 1130 | @end group |
| 1121 | 1131 | ||
| 1122 | @group | 1132 | @group |
| 1123 | % ls -l fo* | 1133 | % ls -li fo* |
| 1124 | -rw-rw-rw- 2 rms 29 Aug 18 20:32 foo | 1134 | 81908 -rw-rw-rw- 2 rms 29 Aug 18 20:32 foo |
| 1125 | -rw-rw-rw- 2 rms 29 Aug 18 20:32 foo2 | 1135 | 81908 -rw-rw-rw- 2 rms 29 Aug 18 20:32 foo2 |
| 1126 | -rw-rw-rw- 1 rms 24 Aug 18 20:31 foo3 | 1136 | 84302 -rw-rw-rw- 1 rms 24 Aug 18 20:31 foo3 |
| 1127 | @end group | 1137 | @end group |
| 1128 | @end example | 1138 | @end example |
| 1129 | 1139 | ||
| 1130 | @c !!! Check whether this set of examples is consistent. --rjc 15mar92 | 1140 | Finally, we evaluate the following: |
| 1131 | Finally, we evaluate the following: | ||
| 1132 | 1141 | ||
| 1133 | @example | 1142 | @example |
| 1134 | (add-name-to-file "~/lewis/foo" "~/lewis/foo3" t) | 1143 | (add-name-to-file "foo" "foo3" t) |
| 1135 | @end example | 1144 | @end example |
| 1136 | 1145 | ||
| 1137 | @noindent | 1146 | @noindent |
| @@ -1141,22 +1150,22 @@ contents of @file{foo3} are lost. | |||
| 1141 | 1150 | ||
| 1142 | @example | 1151 | @example |
| 1143 | @group | 1152 | @group |
| 1144 | (add-name-to-file "~/lewis/foo1" "~/lewis/foo3") | 1153 | (add-name-to-file "foo1" "foo3") |
| 1145 | @result{} nil | 1154 | @result{} nil |
| 1146 | @end group | 1155 | @end group |
| 1147 | 1156 | ||
| 1148 | @group | 1157 | @group |
| 1149 | % ls -l fo* | 1158 | % ls -li fo* |
| 1150 | -rw-rw-rw- 3 rms 29 Aug 18 20:32 foo | 1159 | 81908 -rw-rw-rw- 3 rms 29 Aug 18 20:32 foo |
| 1151 | -rw-rw-rw- 3 rms 29 Aug 18 20:32 foo2 | 1160 | 81908 -rw-rw-rw- 3 rms 29 Aug 18 20:32 foo2 |
| 1152 | -rw-rw-rw- 3 rms 29 Aug 18 20:32 foo3 | 1161 | 81908 -rw-rw-rw- 3 rms 29 Aug 18 20:32 foo3 |
| 1153 | @end group | 1162 | @end group |
| 1154 | @end example | 1163 | @end example |
| 1155 | 1164 | ||
| 1156 | This function is meaningless on VMS, where multiple names for one file | 1165 | This function is meaningless on operating systems where multiple names |
| 1157 | are not allowed. | 1166 | for one file are not allowed. |
| 1158 | 1167 | ||
| 1159 | See also @code{file-nlinks} in @ref{File Attributes}. | 1168 | See also @code{file-nlinks} in @ref{File Attributes}. |
| 1160 | @end defun | 1169 | @end defun |
| 1161 | 1170 | ||
| 1162 | @deffn Command rename-file filename newname &optional ok-if-already-exists | 1171 | @deffn Command rename-file filename newname &optional ok-if-already-exists |
| @@ -1176,7 +1185,7 @@ In an interactive call, this function prompts for @var{filename} and | |||
| 1176 | This command copies the file @var{oldname} to @var{newname}. An | 1185 | This command copies the file @var{oldname} to @var{newname}. An |
| 1177 | error is signaled if @var{oldname} does not exist. | 1186 | error is signaled if @var{oldname} does not exist. |
| 1178 | 1187 | ||
| 1179 | If @var{time} is non-@code{nil}, then this functions gives the new file | 1188 | If @var{time} is non-@code{nil}, then this function gives the new file |
| 1180 | the same last-modified time that the old one has. (This works on only | 1189 | the same last-modified time that the old one has. (This works on only |
| 1181 | some operating systems.) If setting the time gets an error, | 1190 | some operating systems.) If setting the time gets an error, |
| 1182 | @code{copy-file} signals a @code{file-date-error} error. | 1191 | @code{copy-file} signals a @code{file-date-error} error. |
| @@ -1579,9 +1588,9 @@ form. | |||
| 1579 | 1588 | ||
| 1580 | @example | 1589 | @example |
| 1581 | (file-relative-name "/foo/bar" "/foo/") | 1590 | (file-relative-name "/foo/bar" "/foo/") |
| 1582 | @result{} "bar") | 1591 | @result{} "bar" |
| 1583 | (file-relative-name "/foo/bar" "/hack/") | 1592 | (file-relative-name "/foo/bar" "/hack/") |
| 1584 | @result{} "/foo/bar") | 1593 | @result{} "/foo/bar" |
| 1585 | @end example | 1594 | @end example |
| 1586 | @end defun | 1595 | @end defun |
| 1587 | 1596 | ||
| @@ -1653,38 +1662,55 @@ construct a name for such a file: | |||
| 1653 | @example | 1662 | @example |
| 1654 | (make-temp-name | 1663 | (make-temp-name |
| 1655 | (expand-file-name @var{name-of-application} | 1664 | (expand-file-name @var{name-of-application} |
| 1656 | (or (getenv "TMPDIR") | 1665 | temporary-file-directory)) |
| 1657 | "/tmp/"))) | ||
| 1658 | @end example | 1666 | @end example |
| 1659 | 1667 | ||
| 1660 | @cindex @code{TMPDIR} environment variable. | ||
| 1661 | @noindent | 1668 | @noindent |
| 1662 | The job of @code{make-temp-name} is to prevent two different users or | 1669 | The job of @code{make-temp-name} is to prevent two different users or |
| 1663 | two different jobs from trying to use the same name. | 1670 | two different jobs from trying to use the exact same file name. This |
| 1664 | 1671 | example uses the variable @code{temporary-file-directory} to decide | |
| 1665 | This example uses the environment variable @code{TMPDIR} to specify the | 1672 | where to put the temporary file. All Emacs Lisp programs should |
| 1666 | directory, and if that is not specified, we use the directory | 1673 | use @code{temporary-file-directory} for this purpose, to give the user |
| 1667 | @file{/tmp/}. This is the standard way to choose the directory, and all | 1674 | a uniform way to specify the directory for all temporary files. |
| 1668 | Emacs Lisp programs should use it. | ||
| 1669 | 1675 | ||
| 1670 | @defun make-temp-name string | 1676 | @defun make-temp-name string |
| 1671 | This function generates string that can be used as a unique name. The | 1677 | This function generates string that can be used as a unique file name. |
| 1672 | name starts with @var{string}, and ends with a number that is different | 1678 | The name starts with @var{string}, and contains a number that is |
| 1673 | in each Emacs job. | 1679 | different in each Emacs job. |
| 1674 | 1680 | ||
| 1675 | @example | 1681 | @example |
| 1676 | @group | 1682 | @group |
| 1677 | (make-temp-name "/tmp/foo") | 1683 | (make-temp-name "/tmp/foo") |
| 1678 | @result{} "/tmp/foo021304" | 1684 | @result{} "/tmp/foo232J6v" |
| 1679 | @end group | 1685 | @end group |
| 1680 | @end example | 1686 | @end example |
| 1681 | 1687 | ||
| 1682 | To prevent conflicts among different libraries running in the same | 1688 | To prevent conflicts among different libraries running in the same |
| 1683 | Emacs, each Lisp program that uses @code{make-temp-name} should have its | 1689 | Emacs, each Lisp program that uses @code{make-temp-name} should have its |
| 1684 | own @var{string}. The number added to the end of the name distinguishes | 1690 | own @var{string}. The number added to the end of @var{string} |
| 1685 | between the same application running in different Emacs jobs. | 1691 | distinguishes between the same application running in different Emacs |
| 1692 | jobs. Additional added characters permit a large number of distinct | ||
| 1693 | names even in one Emacs job. | ||
| 1686 | @end defun | 1694 | @end defun |
| 1687 | 1695 | ||
| 1696 | @defvar temporary-file-directory | ||
| 1697 | @cindex @code{TMPDIR} environment variable. | ||
| 1698 | @cindex @code{TMP} environment variable. | ||
| 1699 | This variable specifies the directory name for creating temporary files. | ||
| 1700 | Its value should be a directory name (@pxref{Directory Names}), but it | ||
| 1701 | is good for Lisp programs to cope if the value is a file name instead. | ||
| 1702 | (Using the value as the second argument to @code{expand-file-name} is a | ||
| 1703 | good way to achieve that.) | ||
| 1704 | |||
| 1705 | The default value is determined in a reasonable way for your operating | ||
| 1706 | system; on GNU and Unix systems it is based on the @code{TMP} and | ||
| 1707 | @code{TMPDIR} environment variables. | ||
| 1708 | |||
| 1709 | Even if you do not use @code{make-temp-name} to choose the temporary | ||
| 1710 | file's name, you should still use this variable to decide which | ||
| 1711 | directory to put the file in. | ||
| 1712 | @end defvar | ||
| 1713 | |||
| 1688 | @node File Name Completion | 1714 | @node File Name Completion |
| 1689 | @subsection File Name Completion | 1715 | @subsection File Name Completion |
| 1690 | @cindex file name completion subroutines | 1716 | @cindex file name completion subroutines |
| @@ -1813,7 +1839,7 @@ is an example from the @code{completion} package: | |||
| 1813 | 1839 | ||
| 1814 | On GNU and Unix systems, and on some other systems as well, | 1840 | On GNU and Unix systems, and on some other systems as well, |
| 1815 | @code{convert-standard-filename} returns its argument unchanged. On | 1841 | @code{convert-standard-filename} returns its argument unchanged. On |
| 1816 | some other systems, it alters the name to fit the systems's conventions. | 1842 | some other systems, it alters the name to fit the system's conventions. |
| 1817 | 1843 | ||
| 1818 | For example, on MS-DOS the alterations made by this function include | 1844 | For example, on MS-DOS the alterations made by this function include |
| 1819 | converting a leading @samp{.} to @samp{_}, converting a @samp{_} in the | 1845 | converting a leading @samp{.} to @samp{_}, converting a @samp{_} in the |
| @@ -1883,11 +1909,12 @@ specification including wildcard characters. If @var{wildcard} is | |||
| 1883 | non-@code{nil}, that means treat @var{file} as a file specification with | 1909 | non-@code{nil}, that means treat @var{file} as a file specification with |
| 1884 | wildcards. | 1910 | wildcards. |
| 1885 | 1911 | ||
| 1886 | If @var{full-directory-p} is non-@code{nil}, that the directory listing | 1912 | If @var{full-directory-p} is non-@code{nil}, that means the directory |
| 1887 | is expected to show a complete directory. You should specify @code{t} | 1913 | listing is expected to show the full contents of a directory. You |
| 1888 | when @var{file} is a directory and switches do not contain @samp{-d}. | 1914 | should specify @code{t} when @var{file} is a directory and switches do |
| 1889 | (The @samp{-d} option to @code{ls} says to describe a directory itself | 1915 | not contain @samp{-d}. (The @samp{-d} option to @code{ls} says to |
| 1890 | as a file, rather than showing its contents.) | 1916 | describe a directory itself as a file, rather than showing its |
| 1917 | contents.) | ||
| 1891 | 1918 | ||
| 1892 | This function works by running a directory listing program whose name is | 1919 | This function works by running a directory listing program whose name is |
| 1893 | in the variable @code{insert-directory-program}. If @var{wildcard} is | 1920 | in the variable @code{insert-directory-program}. If @var{wildcard} is |
| @@ -2230,7 +2257,7 @@ The argument @var{format} is a list of format names. If @var{format} is | |||
| 2230 | @defvar auto-save-file-format | 2257 | @defvar auto-save-file-format |
| 2231 | This variable specifies the format to use for auto-saving. Its value is | 2258 | This variable specifies the format to use for auto-saving. Its value is |
| 2232 | a list of format names, just like the value of | 2259 | a list of format names, just like the value of |
| 2233 | @code{buffer-file-format}; but it is used instead of | 2260 | @code{buffer-file-format}; however, it is used instead of |
| 2234 | @code{buffer-file-format} for writing auto-save files. This variable | 2261 | @code{buffer-file-format} for writing auto-save files. This variable is |
| 2235 | is always buffer-local in all buffers. | 2262 | always buffer-local in all buffers. |
| 2236 | @end defvar | 2263 | @end defvar |
diff --git a/lispref/frames.texi b/lispref/frames.texi index b5c641d891e..612a1a3ff64 100644 --- a/lispref/frames.texi +++ b/lispref/frames.texi | |||
| @@ -13,11 +13,11 @@ perhaps a minibuffer window), which you can subdivide vertically or | |||
| 13 | horizontally into smaller windows. | 13 | horizontally into smaller windows. |
| 14 | 14 | ||
| 15 | @cindex terminal frame | 15 | @cindex terminal frame |
| 16 | @cindex X window frame | ||
| 17 | When Emacs runs on a text-only terminal, it starts with one | 16 | When Emacs runs on a text-only terminal, it starts with one |
| 18 | @dfn{terminal frame}. If you create additional ones, Emacs displays | 17 | @dfn{terminal frame}. If you create additional ones, Emacs displays |
| 19 | one and only one at any given time---on the terminal screen, of course. | 18 | one and only one at any given time---on the terminal screen, of course. |
| 20 | 19 | ||
| 20 | @cindex window frame | ||
| 21 | When Emacs communicates directly with a supported window system, such | 21 | When Emacs communicates directly with a supported window system, such |
| 22 | as X Windows, it does not have a terminal frame; instead, it starts with | 22 | as X Windows, it does not have a terminal frame; instead, it starts with |
| 23 | a single @dfn{window frame}, but you can create more, and Emacs can | 23 | a single @dfn{window frame}, but you can create more, and Emacs can |
| @@ -77,14 +77,14 @@ window system Emacs uses to display its frames. @xref{Window Frame | |||
| 77 | Parameters}, for documentation of individual parameters you can specify. | 77 | Parameters}, for documentation of individual parameters you can specify. |
| 78 | @end defun | 78 | @end defun |
| 79 | 79 | ||
| 80 | @tindex before-make-frame-hook | ||
| 81 | @defvar before-make-frame-hook | 80 | @defvar before-make-frame-hook |
| 81 | @tindex before-make-frame-hook | ||
| 82 | A normal hook run by @code{make-frame} before it actually creates the | 82 | A normal hook run by @code{make-frame} before it actually creates the |
| 83 | frame. | 83 | frame. |
| 84 | @end defvar | 84 | @end defvar |
| 85 | 85 | ||
| 86 | @tindex after-make-frame-hook | ||
| 87 | @defvar after-make-frame-hook | 86 | @defvar after-make-frame-hook |
| 87 | @tindex after-make-frame-hook | ||
| 88 | An abnormal hook run by @code{make-frame} after it creates the frame. | 88 | An abnormal hook run by @code{make-frame} after it creates the frame. |
| 89 | Each function in @code{after-make-frame-hook} receives one argument, the | 89 | Each function in @code{after-make-frame-hook} receives one argument, the |
| 90 | frame just created. | 90 | frame just created. |
| @@ -265,6 +265,11 @@ window frame; of these, @code{name}, @code{title}, @code{height}, | |||
| 265 | meaningful information in terminal frames. | 265 | meaningful information in terminal frames. |
| 266 | 266 | ||
| 267 | @table @code | 267 | @table @code |
| 268 | @item display | ||
| 269 | The display on which to open this frame. It should be a string of the | ||
| 270 | form @code{"@var{host}:@var{dpy}.@var{screen}"}, just like the | ||
| 271 | @code{DISPLAY} environment variable. | ||
| 272 | |||
| 268 | @item title | 273 | @item title |
| 269 | If a frame has a non-@code{nil} title, it appears in the window system's | 274 | If a frame has a non-@code{nil} title, it appears in the window system's |
| 270 | border for the frame, and also in the mode line of windows in that frame | 275 | border for the frame, and also in the mode line of windows in that frame |
| @@ -283,11 +288,6 @@ If you specify the frame name explicitly when you create the frame, the | |||
| 283 | name is also used (instead of the name of the Emacs executable) when | 288 | name is also used (instead of the name of the Emacs executable) when |
| 284 | looking up X resources for the frame. | 289 | looking up X resources for the frame. |
| 285 | 290 | ||
| 286 | @item display | ||
| 287 | The display on which to open this frame. It should be a string of the | ||
| 288 | form @code{"@var{host}:@var{dpy}.@var{screen}"}, just like the | ||
| 289 | @code{DISPLAY} environment variable. | ||
| 290 | |||
| 291 | @item left | 291 | @item left |
| 292 | The screen position of the left edge, in pixels, with respect to the | 292 | The screen position of the left edge, in pixels, with respect to the |
| 293 | left edge of the screen. The value may be a positive number @var{pos}, | 293 | left edge of the screen. The value may be a positive number @var{pos}, |
| @@ -382,7 +382,8 @@ ordered most-recently-selected first. | |||
| 382 | 382 | ||
| 383 | @item font | 383 | @item font |
| 384 | The name of the font for displaying text in the frame. This is a | 384 | The name of the font for displaying text in the frame. This is a |
| 385 | string. | 385 | string, either a valid font name for your system or the name of an Emacs |
| 386 | fontset (@pxref{Fontsets}). | ||
| 386 | 387 | ||
| 387 | @item auto-raise | 388 | @item auto-raise |
| 388 | Whether selecting the frame raises it (non-@code{nil} means yes). | 389 | Whether selecting the frame raises it (non-@code{nil} means yes). |
| @@ -457,12 +458,14 @@ The default is 1. @xref{Menu Bar}. (In Emacs versions that use the X | |||
| 457 | toolkit, there is only one menu bar line; all that matters about the | 458 | toolkit, there is only one menu bar line; all that matters about the |
| 458 | number you specify is whether it is greater than zero.) | 459 | number you specify is whether it is greater than zero.) |
| 459 | 460 | ||
| 461 | @ignore | ||
| 460 | @item parent-id | 462 | @item parent-id |
| 461 | @c ??? Not yet working. | 463 | @c ??? Not yet working. |
| 462 | The X window number of the window that should be the parent of this one. | 464 | The X window number of the window that should be the parent of this one. |
| 463 | Specifying this lets you create an Emacs window inside some other | 465 | Specifying this lets you create an Emacs window inside some other |
| 464 | application's window. (It is not certain this will be implemented; try | 466 | application's window. (It is not certain this will be implemented; try |
| 465 | it and see if it works.) | 467 | it and see if it works.) |
| 468 | @end ignore | ||
| 466 | @end table | 469 | @end table |
| 467 | 470 | ||
| 468 | @node Size and Position | 471 | @node Size and Position |
| @@ -820,8 +823,8 @@ The redirection lasts until @code{redirect-frame-focus} is called to | |||
| 820 | change it. | 823 | change it. |
| 821 | @end defun | 824 | @end defun |
| 822 | 825 | ||
| 823 | @tindex focus-follows-mouse | ||
| 824 | @defopt focus-follows-mouse | 826 | @defopt focus-follows-mouse |
| 827 | @tindex focus-follows-mouse | ||
| 825 | This option is how you inform Emacs whether the window manager transfers | 828 | This option is how you inform Emacs whether the window manager transfers |
| 826 | focus when the user moves the mouse. Non-@code{nil} says that it does. | 829 | focus when the user moves the mouse. Non-@code{nil} says that it does. |
| 827 | When this is so, the command @code{other-frame} moves the mouse to a | 830 | When this is so, the command @code{other-frame} moves the mouse to a |
| @@ -895,12 +898,12 @@ on the screen. | |||
| 895 | 898 | ||
| 896 | You can raise and lower Emacs frame Windows with these functions: | 899 | You can raise and lower Emacs frame Windows with these functions: |
| 897 | 900 | ||
| 898 | @deffn Command raise-frame frame | 901 | @deffn Command raise-frame &optional frame |
| 899 | This function raises frame @var{frame}. | 902 | This function raises frame @var{frame} (default, the selected frame). |
| 900 | @end deffn | 903 | @end deffn |
| 901 | 904 | ||
| 902 | @deffn Command lower-frame frame | 905 | @deffn Command lower-frame &optional frame |
| 903 | This function lowers frame @var{frame}. | 906 | This function lowers frame @var{frame} (default, the selected frame). |
| 904 | @end deffn | 907 | @end deffn |
| 905 | 908 | ||
| 906 | @defopt minibuffer-auto-raise | 909 | @defopt minibuffer-auto-raise |
| @@ -1022,7 +1025,8 @@ the top left corner of the inside of @var{frame}. | |||
| 1022 | This function @dfn{warps the mouse} to position @var{x}, @var{y} in | 1025 | This function @dfn{warps the mouse} to position @var{x}, @var{y} in |
| 1023 | frame @var{frame}. The arguments @var{x} and @var{y} are integers, | 1026 | frame @var{frame}. The arguments @var{x} and @var{y} are integers, |
| 1024 | giving the position in characters relative to the top left corner of the | 1027 | giving the position in characters relative to the top left corner of the |
| 1025 | inside of @var{frame}. | 1028 | inside of @var{frame}. If @var{frame} is not visible, this function |
| 1029 | does nothing. The return value is not significant. | ||
| 1026 | @end defun | 1030 | @end defun |
| 1027 | 1031 | ||
| 1028 | @defun mouse-pixel-position | 1032 | @defun mouse-pixel-position |
| @@ -1034,6 +1038,9 @@ coordinates in units of pixels rather than units of characters. | |||
| 1034 | This function warps the mouse like @code{set-mouse-position} except that | 1038 | This function warps the mouse like @code{set-mouse-position} except that |
| 1035 | @var{x} and @var{y} are in units of pixels rather than units of | 1039 | @var{x} and @var{y} are in units of pixels rather than units of |
| 1036 | characters. These coordinates are not required to be within the frame. | 1040 | characters. These coordinates are not required to be within the frame. |
| 1041 | |||
| 1042 | If @var{frame} is not visible, this function does nothing. The return | ||
| 1043 | value is not significant. | ||
| 1037 | @end defun | 1044 | @end defun |
| 1038 | 1045 | ||
| 1039 | @need 3000 | 1046 | @need 3000 |
| @@ -1266,6 +1273,101 @@ for @var{maximum} can make this function much faster, in cases where | |||
| 1266 | many fonts match the pattern. | 1273 | many fonts match the pattern. |
| 1267 | @end defun | 1274 | @end defun |
| 1268 | 1275 | ||
| 1276 | @node Fontsets | ||
| 1277 | @section Fontsets | ||
| 1278 | |||
| 1279 | A @dfn{fontset} is a list of fonts, each assigned to a range of | ||
| 1280 | character codes. An individual font cannot display the whole range of | ||
| 1281 | characters that Emacs supports, but a fontset can. Fontsets have names, | ||
| 1282 | just as fonts do, and you can use a fontset name in place of a font name | ||
| 1283 | when you specify the ``font'' for a frame or a face. Here is | ||
| 1284 | information about defining a fontset under Lisp program control. | ||
| 1285 | |||
| 1286 | @defun create-fontset-from-fontset-spec fontset-spec &optional style noerror | ||
| 1287 | This function defines a new fontset according to the specification | ||
| 1288 | string @var{fontset-spec}. The string should have this format: | ||
| 1289 | |||
| 1290 | @smallexample | ||
| 1291 | @var{fontpattern}, @r{[}@var{charsetname}:@var{fontname}@r{]@dots{}} | ||
| 1292 | @end smallexample | ||
| 1293 | |||
| 1294 | @noindent | ||
| 1295 | Whitespace characters before and after the commas are ignored. | ||
| 1296 | |||
| 1297 | The first part of the string, @var{fontpattern}, should have the form of | ||
| 1298 | a standard X font name, except that the last two fields should be | ||
| 1299 | @samp{fontset-@var{alias}}. | ||
| 1300 | |||
| 1301 | Each fontset has two names, one long and one short. The long name is | ||
| 1302 | @var{fontpattern} in its entirety. The short name is | ||
| 1303 | @samp{fontset-@var{alias}}. You can refer to the fontset by either | ||
| 1304 | name. If a fontset with the same name already exists, an error is | ||
| 1305 | signaled, unless @var{noerror} is non-@code{nil}, in which case this | ||
| 1306 | function does nothing. | ||
| 1307 | |||
| 1308 | The specification string also says which fonts to use in the fontset. | ||
| 1309 | See below for the details. | ||
| 1310 | @end defun | ||
| 1311 | |||
| 1312 | If optional argument @var{style} is specified, it specifies a way to | ||
| 1313 | modify the fontset. It should be one of @code{bold}, @code{italic}, and | ||
| 1314 | @code{bold-italic}, and it says to find the bold, italic or bold-italic | ||
| 1315 | version of each font if possible. | ||
| 1316 | |||
| 1317 | The construct @samp{@var{charset}:@var{font}} specifies which font to | ||
| 1318 | use (in this fontset) for one particular character set. Here, | ||
| 1319 | @var{charset} is the name of a character set, and @var{font} is the font | ||
| 1320 | to use for that character set. You can use this construct any number of | ||
| 1321 | times in the specification string. | ||
| 1322 | |||
| 1323 | For the remaining character sets, those that you don't specify | ||
| 1324 | explicitly, Emacs chooses a font based on @var{fontpattern}: it replaces | ||
| 1325 | @samp{fontset-@var{alias}} with a value that names one character set. | ||
| 1326 | For the @sc{ASCII} character set, @samp{fontset-@var{alias}} is replaced | ||
| 1327 | with @samp{ISO8859-1}. | ||
| 1328 | |||
| 1329 | In addition, when several consecutive fields are wildcards, Emacs | ||
| 1330 | collapses them into a single wildcard. This is to prevent use of | ||
| 1331 | auto-scaled fonts. Fonts made by scaling larger fonts are not usable | ||
| 1332 | for editing, and scaling a smaller font is not useful because it is | ||
| 1333 | better to use the smaller font in its own size, which Emacs does. | ||
| 1334 | |||
| 1335 | Thus if @var{fontpattern} is this, | ||
| 1336 | |||
| 1337 | @example | ||
| 1338 | -*-fixed-medium-r-normal-*-24-*-*-*-*-*-fontset-24 | ||
| 1339 | @end example | ||
| 1340 | |||
| 1341 | @noindent | ||
| 1342 | the font specification for ASCII characters would be this: | ||
| 1343 | |||
| 1344 | @example | ||
| 1345 | -*-fixed-medium-r-normal-*-24-*-ISO8859-1 | ||
| 1346 | @end example | ||
| 1347 | |||
| 1348 | @noindent | ||
| 1349 | and the font specification for Chinese GB2312 characters would be this: | ||
| 1350 | |||
| 1351 | @example | ||
| 1352 | -*-fixed-medium-r-normal-*-24-*-gb2312*-* | ||
| 1353 | @end example | ||
| 1354 | |||
| 1355 | You may not have any Chinese font matching the above font | ||
| 1356 | specification. Most X distributions include only Chinese fonts that | ||
| 1357 | have @samp{song ti} or @samp{fangsong ti} in @var{family} field. In | ||
| 1358 | such a case, @samp{Fontset-@var{n}} can be specified as below: | ||
| 1359 | |||
| 1360 | @smallexample | ||
| 1361 | Emacs.Fontset-0: -*-fixed-medium-r-normal-*-24-*-*-*-*-*-fontset-24,\ | ||
| 1362 | chinese-gb2312:-*-*-medium-r-normal-*-24-*-gb2312*-* | ||
| 1363 | @end smallexample | ||
| 1364 | |||
| 1365 | @noindent | ||
| 1366 | Then, the font specifications for all but Chinese GB2312 characters have | ||
| 1367 | @samp{fixed} in the @var{family} field, and the font specification for | ||
| 1368 | Chinese GB2312 characters has a wild card @samp{*} in the @var{family} | ||
| 1369 | field. | ||
| 1370 | |||
| 1269 | @node Color Names | 1371 | @node Color Names |
| 1270 | @section Color Names | 1372 | @section Color Names |
| 1271 | 1373 | ||
| @@ -1422,7 +1524,7 @@ This function returns the number of color cells the screen supports. | |||
| 1422 | 1524 | ||
| 1423 | @ignore | 1525 | @ignore |
| 1424 | @defvar x-no-window-manager | 1526 | @defvar x-no-window-manager |
| 1425 | This variable's value is is @code{t} if no X window manager is in use. | 1527 | This variable's value is @code{t} if no X window manager is in use. |
| 1426 | @end defvar | 1528 | @end defvar |
| 1427 | @end ignore | 1529 | @end ignore |
| 1428 | 1530 | ||
diff --git a/lispref/functions.texi b/lispref/functions.texi index b770ac39f7c..510b3e1766d 100644 --- a/lispref/functions.texi +++ b/lispref/functions.texi | |||
| @@ -54,11 +54,11 @@ such as @code{car} or @code{append}. These functions are also called | |||
| 54 | @dfn{built-in} functions or @dfn{subrs}. (Special forms are also | 54 | @dfn{built-in} functions or @dfn{subrs}. (Special forms are also |
| 55 | considered primitives.) | 55 | considered primitives.) |
| 56 | 56 | ||
| 57 | Usually the reason we implement a function as a primitive is because it | 57 | Usually the reason we implement a function as a primitive is either |
| 58 | is fundamental, because it provides a low-level interface to operating | 58 | because it is fundamental, because it provides a low-level interface to |
| 59 | system services, or because it needs to run fast. Primitives can be | 59 | operating system services, or because it needs to run fast. Primitives |
| 60 | modified or added only by changing the C sources and recompiling the | 60 | can be modified or added only by changing the C sources and recompiling |
| 61 | editor. See @ref{Writing Emacs Primitives}. | 61 | the editor. See @ref{Writing Emacs Primitives}. |
| 62 | 62 | ||
| 63 | @item lambda expression | 63 | @item lambda expression |
| 64 | A @dfn{lambda expression} is a function written in Lisp. | 64 | A @dfn{lambda expression} is a function written in Lisp. |
| @@ -110,8 +110,8 @@ A @dfn{byte-code function} is a function that has been compiled by the | |||
| 110 | byte compiler. @xref{Byte-Code Type}. | 110 | byte compiler. @xref{Byte-Code Type}. |
| 111 | @end table | 111 | @end table |
| 112 | 112 | ||
| 113 | @tindex functionp | ||
| 114 | @defun functionp object | 113 | @defun functionp object |
| 114 | @tindex functionp | ||
| 115 | This function returns @code{t} if @var{object} is any kind of function, | 115 | This function returns @code{t} if @var{object} is any kind of function, |
| 116 | or a special form or macro. | 116 | or a special form or macro. |
| 117 | @end defun | 117 | @end defun |
| @@ -458,11 +458,13 @@ one symbol, this is just a matter of convenience. It is easy to store | |||
| 458 | it in several symbols using @code{fset}; then each of the symbols is | 458 | it in several symbols using @code{fset}; then each of the symbols is |
| 459 | equally well a name for the same function. | 459 | equally well a name for the same function. |
| 460 | 460 | ||
| 461 | A symbol used as a function name may also be used as a variable; | 461 | A symbol used as a function name may also be used as a variable; these |
| 462 | these two uses of a symbol are independent and do not conflict. | 462 | two uses of a symbol are independent and do not conflict. (Some Lisp |
| 463 | (Some Lisp dialects, such as Scheme, do not distinguish between a | 463 | dialects, such as Scheme, do not distinguish between a symbol's value |
| 464 | symbol's value and its function definition; a symbol's value as a variable | 464 | and its function definition; a symbol's value as a variable is also its |
| 465 | is also its function definition.) | 465 | function definition.) If you have not given a symbol a function |
| 466 | definition, you cannot use it as a function; whether the symbol has a | ||
| 467 | value as a variable makes no difference to this. | ||
| 466 | 468 | ||
| 467 | @node Defining Functions | 469 | @node Defining Functions |
| 468 | @section Defining Functions | 470 | @section Defining Functions |
| @@ -581,7 +583,7 @@ which function to call, and how many arguments to give it, when you | |||
| 581 | write the program. Usually that's just what you want. Occasionally you | 583 | write the program. Usually that's just what you want. Occasionally you |
| 582 | need to compute at run time which function to call. To do that, use the | 584 | need to compute at run time which function to call. To do that, use the |
| 583 | function @code{funcall}. When you also need to determine at run time | 585 | function @code{funcall}. When you also need to determine at run time |
| 584 | how may arguments to pass, use @code{apply}. | 586 | how many arguments to pass, use @code{apply}. |
| 585 | 587 | ||
| 586 | @defun funcall function &rest arguments | 588 | @defun funcall function &rest arguments |
| 587 | @code{funcall} calls @var{function} with @var{arguments}, and returns | 589 | @code{funcall} calls @var{function} with @var{arguments}, and returns |
| @@ -846,7 +848,8 @@ of simple quotation to quote the anonymous function, like this: | |||
| 846 | @example | 848 | @example |
| 847 | @group | 849 | @group |
| 848 | (defun double-property (symbol prop) | 850 | (defun double-property (symbol prop) |
| 849 | (change-property symbol prop (function (lambda (x) (* 2 x))))) | 851 | (change-property symbol prop |
| 852 | (function (lambda (x) (* 2 x))))) | ||
| 850 | @end group | 853 | @end group |
| 851 | @end example | 854 | @end example |
| 852 | 855 | ||
| @@ -864,7 +867,7 @@ definition which uses ordinary @code{quote}, the argument passed to | |||
| 864 | @noindent | 867 | @noindent |
| 865 | The Lisp compiler cannot assume this list is a function, even though it | 868 | The Lisp compiler cannot assume this list is a function, even though it |
| 866 | looks like one, since it does not know what @code{change-property} will | 869 | looks like one, since it does not know what @code{change-property} will |
| 867 | do with the list. Perhaps will check whether the @sc{car} of the third | 870 | do with the list. Perhaps it will check whether the @sc{car} of the third |
| 868 | element is the symbol @code{*}! Using @code{function} tells the | 871 | element is the symbol @code{*}! Using @code{function} tells the |
| 869 | compiler it is safe to go ahead and compile the constant function. | 872 | compiler it is safe to go ahead and compile the constant function. |
| 870 | 873 | ||
| @@ -876,6 +879,20 @@ comment: | |||
| 876 | (function @var{symbol}) @equiv{} (quote @var{symbol}) @equiv{} '@var{symbol} | 879 | (function @var{symbol}) @equiv{} (quote @var{symbol}) @equiv{} '@var{symbol} |
| 877 | @end example | 880 | @end example |
| 878 | 881 | ||
| 882 | The read syntax @code{#'} is a short-hand for using @code{function}. | ||
| 883 | For example, | ||
| 884 | |||
| 885 | @example | ||
| 886 | #'(lambda (x) (* x x)) | ||
| 887 | @end example | ||
| 888 | |||
| 889 | @noindent | ||
| 890 | is equivalent to | ||
| 891 | |||
| 892 | @example | ||
| 893 | (function (lambda (x) (* x x))) | ||
| 894 | @end example | ||
| 895 | |||
| 879 | @defspec function function-object | 896 | @defspec function function-object |
| 880 | @cindex function quoting | 897 | @cindex function quoting |
| 881 | This special form returns @var{function-object} without evaluating it. | 898 | This special form returns @var{function-object} without evaluating it. |
| @@ -952,7 +969,7 @@ is a legitimate function. | |||
| 952 | @defun fmakunbound symbol | 969 | @defun fmakunbound symbol |
| 953 | This function makes @var{symbol}'s function cell void, so that a | 970 | This function makes @var{symbol}'s function cell void, so that a |
| 954 | subsequent attempt to access this cell will cause a @code{void-function} | 971 | subsequent attempt to access this cell will cause a @code{void-function} |
| 955 | error. (See also @code{makunbound}, in @ref{Local Variables}.) | 972 | error. (See also @code{makunbound}, in @ref{Void Variables}.) |
| 956 | 973 | ||
| 957 | @example | 974 | @example |
| 958 | @group | 975 | @group |
diff --git a/lispref/help.texi b/lispref/help.texi index d31315c0ef1..cde0956b5be 100644 --- a/lispref/help.texi +++ b/lispref/help.texi | |||
| @@ -415,6 +415,15 @@ Emacs buffers are usually displayed). | |||
| 415 | @end smallexample | 415 | @end smallexample |
| 416 | @end defun | 416 | @end defun |
| 417 | 417 | ||
| 418 | @defun read-kbd-macro string | ||
| 419 | This function is used mainly for operating on keyboard macros, but it | ||
| 420 | can also be used as a rough inverse for @code{key-description}. You | ||
| 421 | call it with a string containing key descriptions, separated by spaces; | ||
| 422 | it returns a string or vector containing the corresponding events. | ||
| 423 | (This may or may not be a single valid key sequence, depending on what | ||
| 424 | events you use; @pxref{Keymap Terminology}.) | ||
| 425 | @end defun | ||
| 426 | |||
| 418 | @node Help Functions | 427 | @node Help Functions |
| 419 | @section Help Functions | 428 | @section Help Functions |
| 420 | 429 | ||
| @@ -431,8 +440,9 @@ named @samp{*Help*}, each with a one-line description taken from the | |||
| 431 | beginning of its documentation string. | 440 | beginning of its documentation string. |
| 432 | 441 | ||
| 433 | @c Emacs 19 feature | 442 | @c Emacs 19 feature |
| 434 | If @var{do-all} is non-@code{nil}, then @code{apropos} also shows | 443 | If @var{do-all} is non-@code{nil}, then @code{apropos} also shows key |
| 435 | key bindings for the functions that are found. | 444 | bindings for the functions that are found; it also shows all symbols, |
| 445 | even those that are neither functions nor variables. | ||
| 436 | 446 | ||
| 437 | In the first of the following examples, @code{apropos} finds all the | 447 | In the first of the following examples, @code{apropos} finds all the |
| 438 | symbols with names containing @samp{exec}. (We don't show here the | 448 | symbols with names containing @samp{exec}. (We don't show here the |
| @@ -481,10 +491,10 @@ Documentation}. | |||
| 481 | 491 | ||
| 482 | @defvar help-char | 492 | @defvar help-char |
| 483 | The value of this variable is the help character---the character that | 493 | The value of this variable is the help character---the character that |
| 484 | Emacs recognizes as meaning Help. By default, it stands for 8, which is | 494 | Emacs recognizes as meaning Help. By default, its value is 8, which |
| 485 | @kbd{C-h}. When Emacs reads this character, if @code{help-form} is | 495 | stands for @kbd{C-h}. When Emacs reads this character, if |
| 486 | non-@code{nil} Lisp expression, it evaluates that expression, and | 496 | @code{help-form} is a non-@code{nil} Lisp expression, it evaluates that |
| 487 | displays the result in a window if it is a string. | 497 | expression, and displays the result in a window if it is a string. |
| 488 | 498 | ||
| 489 | Usually the value of @code{help-form}'s value is @code{nil}. Then the | 499 | Usually the value of @code{help-form}'s value is @code{nil}. Then the |
| 490 | help character has no special meaning at the level of command input, and | 500 | help character has no special meaning at the level of command input, and |
| @@ -498,8 +508,8 @@ binding as a subcommand of the prefix key, it runs | |||
| 498 | subcommands of the prefix key. | 508 | subcommands of the prefix key. |
| 499 | @end defvar | 509 | @end defvar |
| 500 | 510 | ||
| 501 | @tindex help-event-list | ||
| 502 | @defvar help-event-list | 511 | @defvar help-event-list |
| 512 | @tindex help-event-list | ||
| 503 | The value of this variable is a list of event types that serve as | 513 | The value of this variable is a list of event types that serve as |
| 504 | alternative ``help characters.'' These events are handled just like the | 514 | alternative ``help characters.'' These events are handled just like the |
| 505 | event specified by @code{help-char}. | 515 | event specified by @code{help-char}. |
| @@ -534,11 +544,10 @@ prefix described consists of all but the last event of that key | |||
| 534 | sequence. (The last event is, presumably, the help character.) | 544 | sequence. (The last event is, presumably, the help character.) |
| 535 | @end defun | 545 | @end defun |
| 536 | 546 | ||
| 537 | The following two functions are found in the library @file{helper}. | 547 | The following two functions are meant for modes that want to provide |
| 538 | They are for modes that want to provide help without relinquishing | 548 | help without relinquishing control, such as the ``electric'' modes. |
| 539 | control, such as the ``electric'' modes. You must load that library | 549 | Their names begin with @samp{Helper} to distinguish them from the |
| 540 | with @code{(require 'helper)} in order to use them. Their names begin | 550 | ordinary help functions. |
| 541 | with @samp{Helper} to distinguish them from the ordinary help functions. | ||
| 542 | 551 | ||
| 543 | @deffn Command Helper-describe-bindings | 552 | @deffn Command Helper-describe-bindings |
| 544 | This command pops up a window displaying a help buffer containing a | 553 | This command pops up a window displaying a help buffer containing a |
diff --git a/lispref/hooks.texi b/lispref/hooks.texi index 6b0019146d6..b6904d2b7f7 100644 --- a/lispref/hooks.texi +++ b/lispref/hooks.texi | |||
| @@ -30,7 +30,7 @@ however, we have renamed all of those.) | |||
| 30 | 30 | ||
| 31 | @c !!! need xref to where each hook is documented or else document it | 31 | @c !!! need xref to where each hook is documented or else document it |
| 32 | @c by specifying what is expected, and when it is called relative to | 32 | @c by specifying what is expected, and when it is called relative to |
| 33 | @c mode initialization.) | 33 | @c mode initialization. |
| 34 | 34 | ||
| 35 | @table @code | 35 | @table @code |
| 36 | @item activate-mark-hook | 36 | @item activate-mark-hook |
diff --git a/lispref/internals.texi b/lispref/internals.texi index 74d019d2039..33f5cb26dbd 100644 --- a/lispref/internals.texi +++ b/lispref/internals.texi | |||
| @@ -302,6 +302,14 @@ The number of floats in use. | |||
| 302 | @c Emacs 19 feature | 302 | @c Emacs 19 feature |
| 303 | The number of floats for which space has been obtained from the | 303 | The number of floats for which space has been obtained from the |
| 304 | operating system, but that are not currently being used. | 304 | operating system, but that are not currently being used. |
| 305 | |||
| 306 | @item used-intervals | ||
| 307 | The number of intervals in use. Intervals are an internal | ||
| 308 | data structure used for representing text properties. | ||
| 309 | |||
| 310 | @item free-intervals | ||
| 311 | The number of intervals for which space has been obtained | ||
| 312 | from the operating system, but that are not currently being used. | ||
| 305 | @end table | 313 | @end table |
| 306 | @end deffn | 314 | @end deffn |
| 307 | 315 | ||
| @@ -778,7 +786,7 @@ This field is non-@code{nil} if the buffer's mark is active. | |||
| 778 | @item local_var_alist | 786 | @item local_var_alist |
| 779 | This field contains the association list describing the buffer-local | 787 | This field contains the association list describing the buffer-local |
| 780 | variable bindings of this buffer, not including the built-in | 788 | variable bindings of this buffer, not including the built-in |
| 781 | buffer-local bindings that that have special slots in the buffer object. | 789 | buffer-local bindings that have special slots in the buffer object. |
| 782 | (Those slots are omitted from this table.) @xref{Buffer-Local | 790 | (Those slots are omitted from this table.) @xref{Buffer-Local |
| 783 | Variables}. | 791 | Variables}. |
| 784 | 792 | ||
diff --git a/lispref/intro.texi b/lispref/intro.texi index 6d2d63981eb..d6471a4ced1 100644 --- a/lispref/intro.texi +++ b/lispref/intro.texi | |||
| @@ -418,12 +418,17 @@ closely integrated with the editing facilities; thus, editing commands | |||
| 418 | are functions that can also conveniently be called from Lisp programs, | 418 | are functions that can also conveniently be called from Lisp programs, |
| 419 | and parameters for customization are ordinary Lisp variables. | 419 | and parameters for customization are ordinary Lisp variables. |
| 420 | 420 | ||
| 421 | This manual describes Emacs Lisp, presuming considerable familiarity | 421 | This manual attempts to be a full description of Emacs Lisp. For a |
| 422 | with the use of Emacs for editing. (See @cite{The GNU Emacs Manual} | 422 | beginner's introduction to Emacs Lisp, see @cite{An Introduction to |
| 423 | for this basic information.) Generally speaking, the earlier chapters | 423 | Emacs Lisp Programming}, by Bob Chassell, also published by the Free |
| 424 | describe features of Emacs Lisp that have counterparts in many | 424 | Software Foundation. This manual presumes considerable familiarity with |
| 425 | programming languages, and later chapters describe features that are | 425 | the use of Emacs for editing; see @cite{The GNU Emacs Manual} for this |
| 426 | peculiar to Emacs Lisp or relate specifically to editing. | 426 | basic information. |
| 427 | |||
| 428 | Generally speaking, the earlier chapters describe features of Emacs | ||
| 429 | Lisp that have counterparts in many programming languages, and later | ||
| 430 | chapters describe features that are peculiar to Emacs Lisp or relate | ||
| 431 | specifically to editing. | ||
| 427 | 432 | ||
| 428 | This is edition 2.5. | 433 | This is edition 2.5. |
| 429 | 434 | ||
| @@ -431,6 +436,7 @@ peculiar to Emacs Lisp or relate specifically to editing. | |||
| 431 | * Caveats:: Flaws and a request for help. | 436 | * Caveats:: Flaws and a request for help. |
| 432 | * Lisp History:: Emacs Lisp is descended from Maclisp. | 437 | * Lisp History:: Emacs Lisp is descended from Maclisp. |
| 433 | * Conventions:: How the manual is formatted. | 438 | * Conventions:: How the manual is formatted. |
| 439 | * Version Info:: Which Emacs version is running? | ||
| 434 | * Acknowledgements:: The authors, editors, and sponsors of this manual. | 440 | * Acknowledgements:: The authors, editors, and sponsors of this manual. |
| 435 | @end menu | 441 | @end menu |
| 436 | 442 | ||
| @@ -474,7 +480,7 @@ which you are criticizing. | |||
| 474 | Please mail comments and corrections to | 480 | Please mail comments and corrections to |
| 475 | 481 | ||
| 476 | @example | 482 | @example |
| 477 | bug-lisp-manual@@prep.ai.mit.edu | 483 | bug-lisp-manual@@gnu.org |
| 478 | @end example | 484 | @end example |
| 479 | 485 | ||
| 480 | @noindent | 486 | @noindent |
| @@ -483,7 +489,7 @@ apply the corrections. Months, and sometimes years, go by between | |||
| 483 | updates. So please attach no significance to the lack of a reply---your | 489 | updates. So please attach no significance to the lack of a reply---your |
| 484 | mail @emph{will} be acted on in due time. If you want to contact the | 490 | mail @emph{will} be acted on in due time. If you want to contact the |
| 485 | Emacs maintainers more quickly, send mail to | 491 | Emacs maintainers more quickly, send mail to |
| 486 | @code{bug-gnu-emacs@@prep.ai.mit.edu}. | 492 | @code{bug-gnu-emacs@@gnu.org}. |
| 487 | 493 | ||
| 488 | @display | 494 | @display |
| 489 | --Bil Lewis, Dan LaLiberte, Richard Stallman | 495 | --Bil Lewis, Dan LaLiberte, Richard Stallman |
| @@ -493,33 +499,38 @@ Emacs maintainers more quickly, send mail to | |||
| 493 | @section Lisp History | 499 | @section Lisp History |
| 494 | @cindex Lisp history | 500 | @cindex Lisp history |
| 495 | 501 | ||
| 496 | Lisp (LISt Processing language) was first developed in the late 1950's | 502 | Lisp (LISt Processing language) was first developed in the late 1950s |
| 497 | at the Massachusetts Institute of Technology for research in artificial | 503 | at the Massachusetts Institute of Technology for research in artificial |
| 498 | intelligence. The great power of the Lisp language makes it superior | 504 | intelligence. The great power of the Lisp language makes it ideal |
| 499 | for other purposes as well, such as writing editing commands. | 505 | for other purposes as well, such as writing editing commands. |
| 500 | 506 | ||
| 501 | @cindex Maclisp | 507 | @cindex Maclisp |
| 502 | @cindex Common Lisp | 508 | @cindex Common Lisp |
| 503 | Dozens of Lisp implementations have been built over the years, each | 509 | Dozens of Lisp implementations have been built over the years, each |
| 504 | with its own idiosyncrasies. Many of them were inspired by Maclisp, | 510 | with its own idiosyncrasies. Many of them were inspired by Maclisp, |
| 505 | which was written in the 1960's at MIT's Project MAC. Eventually the | 511 | which was written in the 1960s at MIT's Project MAC. Eventually the |
| 506 | implementors of the descendants of Maclisp came together and developed a | 512 | implementors of the descendants of Maclisp came together and developed a |
| 507 | standard for Lisp systems, called Common Lisp. In the mean time, Gerry | 513 | standard for Lisp systems, called Common Lisp. In the meantime, Gerry |
| 508 | Sussman and Guy Steele at MIT developed a simplified but very powerful | 514 | Sussman and Guy Steele at MIT developed a simplified but very powerful |
| 509 | dialect of Lisp, called Scheme. | 515 | dialect of Lisp, called Scheme. |
| 510 | 516 | ||
| 511 | GNU Emacs Lisp is largely inspired by Maclisp, and a little by Common | 517 | GNU Emacs Lisp is largely inspired by Maclisp, and a little by Common |
| 512 | Lisp. If you know Common Lisp, you will notice many similarities. | 518 | Lisp. If you know Common Lisp, you will notice many similarities. |
| 513 | However, many of the features of Common Lisp have been omitted or | 519 | However, many features of Common Lisp have been omitted or |
| 514 | simplified in order to reduce the memory requirements of GNU Emacs. | 520 | simplified in order to reduce the memory requirements of GNU Emacs. |
| 515 | Sometimes the simplifications are so drastic that a Common Lisp user | 521 | Sometimes the simplifications are so drastic that a Common Lisp user |
| 516 | might be very confused. We will occasionally point out how GNU Emacs | 522 | might be very confused. We will occasionally point out how GNU Emacs |
| 517 | Lisp differs from Common Lisp. If you don't know Common Lisp, don't | 523 | Lisp differs from Common Lisp. If you don't know Common Lisp, don't |
| 518 | worry about it; this manual is self-contained. | 524 | worry about it; this manual is self-contained. |
| 519 | 525 | ||
| 526 | @pindex cl | ||
| 527 | A certain amount of Common Lisp emulation is available via the | ||
| 528 | @file{cl} library @xref{Top,, Common Lisp Extension, cl, Common Lisp | ||
| 529 | Extensions}. | ||
| 530 | |||
| 520 | Emacs Lisp is not at all influenced by Scheme; but the GNU project has | 531 | Emacs Lisp is not at all influenced by Scheme; but the GNU project has |
| 521 | an implementation of Scheme, called Guile. We use Guile for | 532 | an implementation of Scheme, called Guile. We use Guile in all new GNU |
| 522 | extensibility in all new GNU software that calls for extensibility. | 533 | software that calls for extensibility. |
| 523 | 534 | ||
| 524 | @node Conventions | 535 | @node Conventions |
| 525 | @section Conventions | 536 | @section Conventions |
| @@ -531,23 +542,22 @@ manual. You may want to skip this section and refer back to it later. | |||
| 531 | * Some Terms:: Explanation of terms we use in this manual. | 542 | * Some Terms:: Explanation of terms we use in this manual. |
| 532 | * nil and t:: How the symbols @code{nil} and @code{t} are used. | 543 | * nil and t:: How the symbols @code{nil} and @code{t} are used. |
| 533 | * Evaluation Notation:: The format we use for examples of evaluation. | 544 | * Evaluation Notation:: The format we use for examples of evaluation. |
| 534 | * Printing Notation:: The format we use for examples that print output. | 545 | * Printing Notation:: The format we use when examples print text. |
| 535 | * Error Messages:: The format we use for examples of errors. | 546 | * Error Messages:: The format we use for examples of errors. |
| 536 | * Buffer Text Notation:: The format we use for buffer contents in examples. | 547 | * Buffer Text Notation:: The format we use for buffer contents in examples. |
| 537 | * Format of Descriptions:: Notation for describing functions, variables, etc. | 548 | * Format of Descriptions:: Notation for describing functions, variables, etc. |
| 538 | * Version Info:: Which Emacs version is running? | ||
| 539 | @end menu | 549 | @end menu |
| 540 | 550 | ||
| 541 | @node Some Terms | 551 | @node Some Terms |
| 542 | @subsection Some Terms | 552 | @subsection Some Terms |
| 543 | 553 | ||
| 544 | Throughout this manual, the phrases ``the Lisp reader'' and ``the Lisp | 554 | Throughout this manual, the phrases ``the Lisp reader'' and ``the Lisp |
| 545 | printer'' are used to refer to those routines in Lisp that convert | 555 | printer'' refer to those routines in Lisp that convert textual |
| 546 | textual representations of Lisp objects into actual Lisp objects, and vice | 556 | representations of Lisp objects into actual Lisp objects, and vice |
| 547 | versa. @xref{Printed Representation}, for more details. You, the | 557 | versa. @xref{Printed Representation}, for more details. You, the |
| 548 | person reading this manual, are thought of as ``the programmer'' and are | 558 | person reading this manual, are thought of as ``the programmer'' and are |
| 549 | addressed as ``you''. ``The user'' is the person who uses Lisp programs, | 559 | addressed as ``you''. ``The user'' is the person who uses Lisp |
| 550 | including those you write. | 560 | programs, including those you write. |
| 551 | 561 | ||
| 552 | @cindex fonts | 562 | @cindex fonts |
| 553 | Examples of Lisp code appear in this font or form: @code{(list 1 2 | 563 | Examples of Lisp code appear in this font or form: @code{(list 1 2 |
| @@ -590,7 +600,8 @@ in Lisp programs also. | |||
| 590 | is considered to be @var{true}. However, @code{t} is the preferred way | 600 | is considered to be @var{true}. However, @code{t} is the preferred way |
| 591 | to represent the truth value @var{true}. When you need to choose a | 601 | to represent the truth value @var{true}. When you need to choose a |
| 592 | value which represents @var{true}, and there is no other basis for | 602 | value which represents @var{true}, and there is no other basis for |
| 593 | choosing, use @code{t}. The symbol @code{t} always has value @code{t}. | 603 | choosing, use @code{t}. The symbol @code{t} always has the value |
| 604 | @code{t}. | ||
| 594 | 605 | ||
| 595 | In Emacs Lisp, @code{nil} and @code{t} are special symbols that always | 606 | In Emacs Lisp, @code{nil} and @code{t} are special symbols that always |
| 596 | evaluate to themselves. This is so that you do not need to quote them | 607 | evaluate to themselves. This is so that you do not need to quote them |
| @@ -618,7 +629,7 @@ You can read this as ``@code{(car '(1 2))} evaluates to 1''. | |||
| 618 | 629 | ||
| 619 | When a form is a macro call, it expands into a new form for Lisp to | 630 | When a form is a macro call, it expands into a new form for Lisp to |
| 620 | evaluate. We show the result of the expansion with | 631 | evaluate. We show the result of the expansion with |
| 621 | @samp{@expansion{}}. We may or may not show the actual result of the | 632 | @samp{@expansion{}}. We may or may not show the result of the |
| 622 | evaluation of the expanded form. | 633 | evaluation of the expanded form. |
| 623 | 634 | ||
| 624 | @example | 635 | @example |
| @@ -741,10 +752,11 @@ indicates that the subsequent arguments may be omitted (omitted | |||
| 741 | arguments default to @code{nil}). Do not write @code{&optional} when | 752 | arguments default to @code{nil}). Do not write @code{&optional} when |
| 742 | you call the function. | 753 | you call the function. |
| 743 | 754 | ||
| 744 | The keyword @code{&rest} (which will always be followed by a single | 755 | The keyword @code{&rest} (which must be followed by a single argument |
| 745 | argument name) indicates that any number of arguments can follow. The value | 756 | name) indicates that any number of arguments can follow. The single |
| 746 | of the single following arguments name will be a list of all these arguments. | 757 | following argument name will have a value, as a variable, which is a |
| 747 | Do not write @code{&rest} when you call the function. | 758 | list of all these remaining arguments. Do not write @code{&rest} when |
| 759 | you call the function. | ||
| 748 | 760 | ||
| 749 | Here is a description of an imaginary function @code{foo}: | 761 | Here is a description of an imaginary function @code{foo}: |
| 750 | 762 | ||
| @@ -791,7 +803,7 @@ interactively; macros process their arguments differently from functions | |||
| 791 | Special form descriptions use a more complex notation to specify | 803 | Special form descriptions use a more complex notation to specify |
| 792 | optional and repeated arguments because they can break the argument | 804 | optional and repeated arguments because they can break the argument |
| 793 | list down into separate arguments in more complicated ways. | 805 | list down into separate arguments in more complicated ways. |
| 794 | @samp{@code{@r{[}@var{optional-arg}@r{]}}} means that @var{optional-arg} is | 806 | @samp{@r{[}@var{optional-arg}@r{]}} means that @var{optional-arg} is |
| 795 | optional and @samp{@var{repeated-args}@dots{}} stands for zero or more | 807 | optional and @samp{@var{repeated-args}@dots{}} stands for zero or more |
| 796 | arguments. Parentheses are used when several arguments are grouped into | 808 | arguments. Parentheses are used when several arguments are grouped into |
| 797 | additional levels of list structure. Here is an example: | 809 | additional levels of list structure. Here is an example: |
| @@ -800,7 +812,7 @@ additional levels of list structure. Here is an example: | |||
| 800 | This imaginary special form implements a loop that executes the | 812 | This imaginary special form implements a loop that executes the |
| 801 | @var{body} forms and then increments the variable @var{var} on each | 813 | @var{body} forms and then increments the variable @var{var} on each |
| 802 | iteration. On the first iteration, the variable has the value | 814 | iteration. On the first iteration, the variable has the value |
| 803 | @var{from}; on subsequent iterations, it is incremented by 1 (or by | 815 | @var{from}; on subsequent iterations, it is incremented by one (or by |
| 804 | @var{inc} if that is given). The loop exits before executing @var{body} | 816 | @var{inc} if that is given). The loop exits before executing @var{body} |
| 805 | if @var{var} equals @var{to}. Here is an example: | 817 | if @var{var} equals @var{to}. Here is an example: |
| 806 | 818 | ||
| @@ -811,7 +823,7 @@ if @var{var} equals @var{to}. Here is an example: | |||
| 811 | (terpri)) | 823 | (terpri)) |
| 812 | @end example | 824 | @end example |
| 813 | 825 | ||
| 814 | If @var{from} and @var{to} are omitted, then @var{var} is bound to | 826 | If @var{from} and @var{to} are omitted, @var{var} is bound to |
| 815 | @code{nil} before the loop begins, and the loop exits if @var{var} is | 827 | @code{nil} before the loop begins, and the loop exits if @var{var} is |
| 816 | non-@code{nil} at the beginning of an iteration. Here is an example: | 828 | non-@code{nil} at the beginning of an iteration. Here is an example: |
| 817 | 829 | ||
| @@ -855,33 +867,34 @@ replaced by `User Option'. | |||
| 855 | @node Version Info | 867 | @node Version Info |
| 856 | @section Version Information | 868 | @section Version Information |
| 857 | 869 | ||
| 858 | These functions and variables provide information about which | 870 | These facilities provide information about which version of Emacs is |
| 859 | version of Emacs is in use. | 871 | in use. |
| 860 | 872 | ||
| 861 | @deffn Command emacs-version | 873 | @deffn Command emacs-version |
| 862 | This function returns a string describing the version of Emacs that is | 874 | This function returns a string describing the version of Emacs that is |
| 863 | running. It is useful to include this string in bug reports. | 875 | running. It is useful to include this string in bug reports. |
| 864 | 876 | ||
| 865 | @example | 877 | @smallexample |
| 866 | @group | 878 | @group |
| 867 | (emacs-version) | 879 | (emacs-version) |
| 868 | @result{} "GNU Emacs 20.3.5 (i486-pc-linux-gnulibc1, X toolkit) | 880 | @result{} "GNU Emacs 20.3.5 (i486-pc-linux-gnulibc1, X toolkit) |
| 869 | of Sat Feb 14 1998 on psilocin.gnu.org" | 881 | of Sat Feb 14 1998 on psilocin.gnu.org" |
| 870 | @end group | 882 | @end group |
| 871 | @end example | 883 | @end smallexample |
| 872 | 884 | ||
| 873 | Called interactively, the function prints the same information in the | 885 | Called interactively, the function prints the same information in the |
| 874 | echo area. | 886 | echo area. |
| 875 | @end deffn | 887 | @end deffn |
| 876 | 888 | ||
| 877 | @defvar emacs-build-time | 889 | @defvar emacs-build-time |
| 878 | The value of this variable is the time at which Emacs was built at the | 890 | The value of this variable indicates the time at which Emacs was built |
| 879 | local site. | 891 | at the local site. It is a list of three integers, like the value |
| 892 | of @code{current-time} (@pxref{Time of Day}). | ||
| 880 | 893 | ||
| 881 | @example | 894 | @example |
| 882 | @group | 895 | @group |
| 883 | emacs-build-time | 896 | emacs-build-time |
| 884 | @result{} "Tue Jun 6 14:55:57 1995" | 897 | @result{} (13623 62065 344633) |
| 885 | @end group | 898 | @end group |
| 886 | @end example | 899 | @end example |
| 887 | @end defvar | 900 | @end defvar |
| @@ -893,7 +906,7 @@ really part of the Emacs release version number; it is incremented each | |||
| 893 | time you build Emacs in any given directory. | 906 | time you build Emacs in any given directory. |
| 894 | @end defvar | 907 | @end defvar |
| 895 | 908 | ||
| 896 | The following two variables have existed since Emacs version 19.23, | 909 | The following two variables have existed since Emacs version 19.23: |
| 897 | 910 | ||
| 898 | @defvar emacs-major-version | 911 | @defvar emacs-major-version |
| 899 | The major version number of Emacs, as an integer. For Emacs version | 912 | The major version number of Emacs, as an integer. For Emacs version |
diff --git a/lispref/keymaps.texi b/lispref/keymaps.texi index 7e6cc59cecc..d29878d3288 100644 --- a/lispref/keymaps.texi +++ b/lispref/keymaps.texi | |||
| @@ -133,11 +133,11 @@ keymaps}. | |||
| 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. However, default bindings are still meaningful | 136 | binding in the keymap, for @sc{ASCII} characters. However, default |
| 137 | for events that are not @sc{ASCII} characters. A binding of @code{nil} | 137 | bindings are still meaningful for events other than @sc{ASCII} |
| 138 | does @emph{not} override lower-precedence keymaps; thus, if the local | 138 | characters. A binding of @code{nil} does @emph{not} override |
| 139 | map gives a binding of @code{nil}, Emacs uses the binding from the | 139 | lower-precedence keymaps; thus, if the local map gives a binding of |
| 140 | global map. | 140 | @code{nil}, Emacs uses the binding from the global map. |
| 141 | 141 | ||
| 142 | @item @var{string} | 142 | @item @var{string} |
| 143 | @cindex keymap prompt string | 143 | @cindex keymap prompt string |
| @@ -350,7 +350,7 @@ This map is also the function definition of @code{ESC-prefix}. | |||
| 350 | 350 | ||
| 351 | @item | 351 | @item |
| 352 | @cindex @kbd{C-h} | 352 | @cindex @kbd{C-h} |
| 353 | @code{help-map} is the global definitions for the @kbd{C-h} prefix key. | 353 | @code{help-map} is the global keymap for the @kbd{C-h} prefix key. |
| 354 | 354 | ||
| 355 | @item | 355 | @item |
| 356 | @cindex @kbd{C-c} | 356 | @cindex @kbd{C-c} |
| @@ -365,8 +365,8 @@ mode-specific bindings. | |||
| 365 | @cindex @kbd{C-x} | 365 | @cindex @kbd{C-x} |
| 366 | @vindex ctl-x-map | 366 | @vindex ctl-x-map |
| 367 | @findex Control-X-prefix | 367 | @findex Control-X-prefix |
| 368 | @code{ctl-x-map} is the global key map used for the @kbd{C-x} prefix | 368 | @code{ctl-x-map} is the global keymap used for the @kbd{C-x} prefix key. |
| 369 | key. This map is found via the function definition of the symbol | 369 | This map is found via the function cell of the symbol |
| 370 | @code{Control-X-prefix}. | 370 | @code{Control-X-prefix}. |
| 371 | 371 | ||
| 372 | @item | 372 | @item |
| @@ -395,7 +395,7 @@ that have no special names. | |||
| 395 | that follows the prefix key. (It may instead be a symbol whose function | 395 | that follows the prefix key. (It may instead be a symbol whose function |
| 396 | definition is a keymap. The effect is the same, but the symbol serves | 396 | definition is a keymap. The effect is the same, but the symbol serves |
| 397 | as a name for the prefix key.) Thus, the binding of @kbd{C-x} is the | 397 | as a name for the prefix key.) Thus, the binding of @kbd{C-x} is the |
| 398 | symbol @code{Control-X-prefix}, whose function definition is the keymap | 398 | symbol @code{Control-X-prefix}, whose function cell holds the keymap |
| 399 | for @kbd{C-x} commands. (The same keymap is also the value of | 399 | for @kbd{C-x} commands. (The same keymap is also the value of |
| 400 | @code{ctl-x-map}.) | 400 | @code{ctl-x-map}.) |
| 401 | 401 | ||
| @@ -472,7 +472,7 @@ local keymap is always active except when @code{overriding-local-map} | |||
| 472 | overrides it. Text properties can specify an alternative local map for | 472 | overrides it. Text properties can specify an alternative local map for |
| 473 | certain parts of the buffer; see @ref{Special Properties}. | 473 | certain parts of the buffer; see @ref{Special Properties}. |
| 474 | 474 | ||
| 475 | Each minor mode may have a keymap; if it does, the keymap is active | 475 | Each minor mode can have a keymap; if it does, the keymap is active |
| 476 | when the minor mode is enabled. | 476 | when the minor mode is enabled. |
| 477 | 477 | ||
| 478 | The variable @code{overriding-local-map}, if non-@code{nil}, specifies | 478 | The variable @code{overriding-local-map}, if non-@code{nil}, specifies |
| @@ -485,11 +485,12 @@ order of decreasing precedence, until it finds a binding in one of the | |||
| 485 | maps. The procedure for searching a single keymap is called @dfn{key | 485 | maps. The procedure for searching a single keymap is called @dfn{key |
| 486 | lookup}; see @ref{Key Lookup}. | 486 | lookup}; see @ref{Key Lookup}. |
| 487 | 487 | ||
| 488 | Normally, Emacs first searches for the key in the minor mode | 488 | Normally, Emacs first searches for the key in the minor mode maps, in |
| 489 | maps (one map at a time); if they do not supply a binding for the key, | 489 | the order specified by @code{minor-mode-map-alist}; if they do not |
| 490 | Emacs searches the local map; if that too has no binding, Emacs then | 490 | supply a binding for the key, Emacs searches the local map; if that too |
| 491 | searches the global map. However, if @code{overriding-local-map} is | 491 | has no binding, Emacs then searches the global map. However, if |
| 492 | non-@code{nil}, Emacs searches that map first, before the global map. | 492 | @code{overriding-local-map} is non-@code{nil}, Emacs searches that map |
| 493 | first, before the global map. | ||
| 493 | 494 | ||
| 494 | @cindex major mode keymap | 495 | @cindex major mode keymap |
| 495 | Since every buffer that uses the same major mode normally uses the | 496 | Since every buffer that uses the same major mode normally uses the |
| @@ -506,6 +507,9 @@ only when the mode is used for the first time in a session. | |||
| 506 | The minibuffer has local keymaps, too; they contain various completion | 507 | The minibuffer has local keymaps, too; they contain various completion |
| 507 | and exit commands. @xref{Intro to Minibuffers}. | 508 | and exit commands. @xref{Intro to Minibuffers}. |
| 508 | 509 | ||
| 510 | Emacs has other keymaps that are used in a different way---translating | ||
| 511 | events within @code{read-key-sequence}. @xref{Translating Input}. | ||
| 512 | |||
| 509 | @xref{Standard Keymaps}, for a list of standard keymaps. | 513 | @xref{Standard Keymaps}, for a list of standard keymaps. |
| 510 | 514 | ||
| 511 | @defvar global-map | 515 | @defvar global-map |
| @@ -604,14 +608,17 @@ modes. See also @code{minor-mode-key-binding} (@pxref{Functions for Key | |||
| 604 | Lookup}). | 608 | Lookup}). |
| 605 | @end defvar | 609 | @end defvar |
| 606 | 610 | ||
| 607 | @tindex minor-mode-overriding-map-alist | ||
| 608 | @defvar minor-mode-overriding-map-alist | 611 | @defvar minor-mode-overriding-map-alist |
| 612 | @tindex minor-mode-overriding-map-alist | ||
| 609 | This variable allows major modes to override the key bindings for | 613 | This variable allows major modes to override the key bindings for |
| 610 | particular minor modes. The elements of this alist look like the | 614 | particular minor modes. The elements of this alist look like the |
| 611 | elements of @code{minor-mode-map-alist}: @code{(@var{variable} | 615 | elements of @code{minor-mode-map-alist}: @code{(@var{variable} |
| 612 | . @var{keymap})}. If a variable appears an element | 616 | . @var{keymap})}. |
| 613 | @code{minor-mode-overriding-map-alist}, that element overrides any | 617 | |
| 614 | element for the same variable in @code{minor-mode-map-alist}. | 618 | If a variable appears an element of |
| 619 | @code{minor-mode-overriding-map-alist}, the map specified by that | ||
| 620 | element totally replaces any map specified for the same variable in | ||
| 621 | @code{minor-mode-map-alist}. | ||
| 615 | 622 | ||
| 616 | @code{minor-mode-overriding-map-alist} is automatically buffer-local in | 623 | @code{minor-mode-overriding-map-alist} is automatically buffer-local in |
| 617 | all buffers. | 624 | all buffers. |
| @@ -1414,7 +1421,7 @@ an indirect definition itself. | |||
| 1414 | @end smallexample | 1421 | @end smallexample |
| 1415 | @end defun | 1422 | @end defun |
| 1416 | 1423 | ||
| 1417 | @deffn Command describe-bindings prefix | 1424 | @deffn Command describe-bindings &optional prefix |
| 1418 | This function creates a listing of all current key bindings, and | 1425 | This function creates a listing of all current key bindings, and |
| 1419 | displays it in a buffer named @samp{*Help*}. The text is grouped by | 1426 | displays it in a buffer named @samp{*Help*}. The text is grouped by |
| 1420 | modes---minor modes first, then the major mode, then global bindings. | 1427 | modes---minor modes first, then the major mode, then global bindings. |
| @@ -1475,8 +1482,12 @@ an existing menu, you can specify its position in the menu using | |||
| 1475 | @code{define-key-after} (@pxref{Modifying Menus}). | 1482 | @code{define-key-after} (@pxref{Modifying Menus}). |
| 1476 | 1483 | ||
| 1477 | @menu | 1484 | @menu |
| 1478 | * Simple Menu Items:: | 1485 | * Simple Menu Items:: A simple kind of menu key binding, |
| 1479 | * Extended Menu Items:: | 1486 | limited in capabilities. |
| 1487 | * Alias Menu Items:: Using command aliases in menu items. | ||
| 1488 | * Extended Menu Items:: More powerful menu item definitions | ||
| 1489 | let you specify keywords to enable | ||
| 1490 | various features. | ||
| 1480 | @end menu | 1491 | @end menu |
| 1481 | 1492 | ||
| 1482 | @node Simple Menu Items | 1493 | @node Simple Menu Items |
| @@ -1489,6 +1500,7 @@ looks like this: | |||
| 1489 | (@var{item-string} . @var{real-binding}) | 1500 | (@var{item-string} . @var{real-binding}) |
| 1490 | @end example | 1501 | @end example |
| 1491 | 1502 | ||
| 1503 | @noindent | ||
| 1492 | The @sc{car}, @var{item-string}, is the string to be displayed in the | 1504 | The @sc{car}, @var{item-string}, is the string to be displayed in the |
| 1493 | menu. It should be short---preferably one to three words. It should | 1505 | menu. It should be short---preferably one to three words. It should |
| 1494 | describe the action of the command it corresponds to. | 1506 | describe the action of the command it corresponds to. |
| @@ -1540,35 +1552,9 @@ Don't put these sublists in the menu item yourself; menu display | |||
| 1540 | calculates them automatically. Don't mention keyboard equivalents in | 1552 | calculates them automatically. Don't mention keyboard equivalents in |
| 1541 | the item strings themselves, since that is redundant. | 1553 | the item strings themselves, since that is redundant. |
| 1542 | 1554 | ||
| 1543 | Sometimes it is useful to make menu items that use the ``same'' command | ||
| 1544 | but with different enable conditions. You can do this by defining alias | ||
| 1545 | commands. Here's an example that makes two aliases for | ||
| 1546 | @code{toggle-read-only} and gives them different enable conditions: | ||
| 1547 | |||
| 1548 | @example | ||
| 1549 | (defalias 'make-read-only 'toggle-read-only) | ||
| 1550 | (put 'make-read-only 'menu-enable '(not buffer-read-only)) | ||
| 1551 | (defalias 'make-writable 'toggle-read-only) | ||
| 1552 | (put 'make-writable 'menu-enable 'buffer-read-only) | ||
| 1553 | @end example | ||
| 1554 | |||
| 1555 | When using aliases in menus, often it is useful to display the | ||
| 1556 | equivalent key bindings for the ``real'' command name, not the aliases | ||
| 1557 | (which typically don't have any key bindings except for the menu | ||
| 1558 | itself). To request this, give the alias symbol a non-@code{nil} | ||
| 1559 | @code{menu-alias} property. Thus, | ||
| 1560 | |||
| 1561 | @example | ||
| 1562 | (put 'make-read-only 'menu-alias t) | ||
| 1563 | (put 'make-writable 'menu-alias t) | ||
| 1564 | @end example | ||
| 1565 | |||
| 1566 | @noindent | ||
| 1567 | causes menu items for @code{make-read-only} and @code{make-writable} to | ||
| 1568 | show the keyboard bindings for @code{toggle-read-only}. | ||
| 1569 | |||
| 1570 | @node Extended Menu Items | 1555 | @node Extended Menu Items |
| 1571 | @subsubsection Extended Menu Items | 1556 | @subsubsection Extended Menu Items |
| 1557 | @kindex menu-item | ||
| 1572 | 1558 | ||
| 1573 | An extended-format menu item is a more flexible and also cleaner | 1559 | An extended-format menu item is a more flexible and also cleaner |
| 1574 | alternative to the simple format. It consists of a list that starts | 1560 | alternative to the simple format. It consists of a list that starts |
| @@ -1610,7 +1596,7 @@ not defined at all. | |||
| 1610 | 1596 | ||
| 1611 | @item :help @var{help} | 1597 | @item :help @var{help} |
| 1612 | The value of this property, @var{help}, is the extra help string (not | 1598 | The value of this property, @var{help}, is the extra help string (not |
| 1613 | currently used). | 1599 | currently used by Emacs). |
| 1614 | 1600 | ||
| 1615 | @item :button (@var{type} . @var{selected}) | 1601 | @item :button (@var{type} . @var{selected}) |
| 1616 | This property provides a way to define radio buttons and toggle buttons. | 1602 | This property provides a way to define radio buttons and toggle buttons. |
| @@ -1618,6 +1604,54 @@ The @sc{car}, @var{type}, says which: is should be @code{:toggle} or | |||
| 1618 | @code{:radio}. The @sc{cdr}, @var{selected}, should be a form; the | 1604 | @code{:radio}. The @sc{cdr}, @var{selected}, should be a form; the |
| 1619 | result of evaluating it says whether this button is currently selected. | 1605 | result of evaluating it says whether this button is currently selected. |
| 1620 | 1606 | ||
| 1607 | A @dfn{toggle} is a menu item which is labeled as either ``on'' or ``off'' | ||
| 1608 | according to the value of @var{selected}. The command itself should | ||
| 1609 | toggle @var{selected}, setting it to @code{t} if it is @code{nil}, | ||
| 1610 | and to @code{nil} if it is @code{t}. Here is how the menu item | ||
| 1611 | to toggle the @code{debug-on-error} flag is defined: | ||
| 1612 | |||
| 1613 | @example | ||
| 1614 | (menu-item "Debug on Error" toggle-debug-on-error | ||
| 1615 | :button (:toggle | ||
| 1616 | . (and (boundp 'debug-on-error) | ||
| 1617 | debug-on-error)) | ||
| 1618 | @end example | ||
| 1619 | |||
| 1620 | @noindent | ||
| 1621 | This works because @code{toggle-debug-on-error} is defined as a command | ||
| 1622 | which toggles the variable @code{debug-on-error}. | ||
| 1623 | |||
| 1624 | @dfn{Radio buttons} are a group of menu items, in which at any time one | ||
| 1625 | and only one is ``selected.'' There should be a variable whose value | ||
| 1626 | says which one is selected at any time. The @var{selected} form for | ||
| 1627 | each radio button in the group should check whether the variable has the | ||
| 1628 | right value for selecting that button. Clicking on the button should | ||
| 1629 | set the variable so that the button you clicked on becomes selected. | ||
| 1630 | |||
| 1631 | @item :key-sequence @var{key-sequence} | ||
| 1632 | This property specifies which key sequence is likely to be bound to the | ||
| 1633 | same command invoked by this menu item. If you specify the right key | ||
| 1634 | sequence, that makes preparing the menu for display run much faster. | ||
| 1635 | |||
| 1636 | If you specify the wrong key sequence, it has no effect; before Emacs | ||
| 1637 | displays @var{key-sequence} in the menu, it verifies that | ||
| 1638 | @var{key-sequence} is really equivalent to this menu item. | ||
| 1639 | |||
| 1640 | @item :key-sequence nil | ||
| 1641 | This property indicates that there is normally no key binding which is | ||
| 1642 | equivalent to this menu item. Using this property saves time in | ||
| 1643 | preparing the menu for display, because Emacs does not need to search | ||
| 1644 | the keymaps for a keyboard equivalent for this menu item. | ||
| 1645 | |||
| 1646 | However, if the user has rebound this item's definition to a key | ||
| 1647 | sequence, Emacs ignores the @code{:keys} property and finds the keyboard | ||
| 1648 | equivalent anyway. | ||
| 1649 | |||
| 1650 | @item :keys @var{string} | ||
| 1651 | This property specifies that @var{string} is the string to display | ||
| 1652 | as the keyboard equivalent for this menu item. You can use | ||
| 1653 | the @samp{\\[...]} documentation construct in @var{string}. | ||
| 1654 | |||
| 1621 | @item :filter @var{filter-fn} | 1655 | @item :filter @var{filter-fn} |
| 1622 | This property provides a way to compute the menu item dynamically. | 1656 | This property provides a way to compute the menu item dynamically. |
| 1623 | The property value @var{filter-fn} should be a function of one argument; | 1657 | The property value @var{filter-fn} should be a function of one argument; |
| @@ -1625,6 +1659,38 @@ when it is called, its argument will be @var{real-binding}. The | |||
| 1625 | function should return the binding to use instead. | 1659 | function should return the binding to use instead. |
| 1626 | @end table | 1660 | @end table |
| 1627 | 1661 | ||
| 1662 | @node Alias Menu Items | ||
| 1663 | @subsubsection Alias Menu Items | ||
| 1664 | |||
| 1665 | Sometimes it is useful to make menu items that use the ``same'' | ||
| 1666 | command but with different enable conditions. The best way to do this | ||
| 1667 | in Emacs now is with extended menu items; before that feature existed, | ||
| 1668 | it could be done by defining alias commands and using them in menu | ||
| 1669 | items. Here's an example that makes two aliases for | ||
| 1670 | @code{toggle-read-only} and gives them different enable conditions: | ||
| 1671 | |||
| 1672 | @example | ||
| 1673 | (defalias 'make-read-only 'toggle-read-only) | ||
| 1674 | (put 'make-read-only 'menu-enable '(not buffer-read-only)) | ||
| 1675 | (defalias 'make-writable 'toggle-read-only) | ||
| 1676 | (put 'make-writable 'menu-enable 'buffer-read-only) | ||
| 1677 | @end example | ||
| 1678 | |||
| 1679 | When using aliases in menus, often it is useful to display the | ||
| 1680 | equivalent key bindings for the ``real'' command name, not the aliases | ||
| 1681 | (which typically don't have any key bindings except for the menu | ||
| 1682 | itself). To request this, give the alias symbol a non-@code{nil} | ||
| 1683 | @code{menu-alias} property. Thus, | ||
| 1684 | |||
| 1685 | @example | ||
| 1686 | (put 'make-read-only 'menu-alias t) | ||
| 1687 | (put 'make-writable 'menu-alias t) | ||
| 1688 | @end example | ||
| 1689 | |||
| 1690 | @noindent | ||
| 1691 | causes menu items for @code{make-read-only} and @code{make-writable} to | ||
| 1692 | show the keyboard bindings for @code{toggle-read-only}. | ||
| 1693 | |||
| 1628 | @node Mouse Menus | 1694 | @node Mouse Menus |
| 1629 | @subsection Menus and the Mouse | 1695 | @subsection Menus and the Mouse |
| 1630 | 1696 | ||
| @@ -1708,7 +1774,8 @@ for @key{SPC}. | |||
| 1708 | 1774 | ||
| 1709 | Here is a complete example of defining a menu keymap. It is the | 1775 | Here is a complete example of defining a menu keymap. It is the |
| 1710 | definition of the @samp{Print} submenu in the @samp{Tools} menu in the | 1776 | definition of the @samp{Print} submenu in the @samp{Tools} menu in the |
| 1711 | menu bar. First we create the keymap, and give it a name: | 1777 | menu bar, and it uses the simple menu item format (@pxref{Simple Menu |
| 1778 | Items}). First we create the keymap, and give it a name: | ||
| 1712 | 1779 | ||
| 1713 | @example | 1780 | @example |
| 1714 | (defvar menu-bar-print-menu (make-sparse-keymap "Print")) | 1781 | (defvar menu-bar-print-menu (make-sparse-keymap "Print")) |
| @@ -1771,7 +1838,29 @@ command. | |||
| 1771 | can do it this way: | 1838 | can do it this way: |
| 1772 | 1839 | ||
| 1773 | @example | 1840 | @example |
| 1774 | (define-key global-map [C-S-down-mouse-1] menu-bar-print-menu) | 1841 | (define-key global-map [C-S-down-mouse-1] |
| 1842 | menu-bar-print-menu) | ||
| 1843 | @end example | ||
| 1844 | |||
| 1845 | We could equally well use an extended menu item (@pxref{Extended Menu | ||
| 1846 | Items}) for @code{print-region}, like this: | ||
| 1847 | |||
| 1848 | @example | ||
| 1849 | (define-key menu-bar-print-menu [print-region] | ||
| 1850 | '(menu-item "Print Region" print-region | ||
| 1851 | :enable (mark-active))) | ||
| 1852 | @end example | ||
| 1853 | |||
| 1854 | @noindent | ||
| 1855 | With the extended menu item, the enable condition is specified | ||
| 1856 | inside the menu item itself. If we wanted to make this | ||
| 1857 | item disappear from the menu entirely when the mark is inactive, | ||
| 1858 | we could do it this way: | ||
| 1859 | |||
| 1860 | @example | ||
| 1861 | (define-key menu-bar-print-menu [print-region] | ||
| 1862 | '(menu-item "Print Region" print-region | ||
| 1863 | :visible (mark-active))) | ||
| 1775 | @end example | 1864 | @end example |
| 1776 | 1865 | ||
| 1777 | @node Menu Bar | 1866 | @node Menu Bar |
diff --git a/lispref/lists.texi b/lispref/lists.texi index 3f269dc9093..bdc94dc015a 100644 --- a/lispref/lists.texi +++ b/lispref/lists.texi | |||
| @@ -357,8 +357,8 @@ If @var{n} is zero or negative, @code{nthcdr} returns all of | |||
| 357 | @end example | 357 | @end example |
| 358 | @end defun | 358 | @end defun |
| 359 | 359 | ||
| 360 | @tindex safe-length | ||
| 361 | @defun safe-length list | 360 | @defun safe-length list |
| 361 | @tindex safe-length | ||
| 362 | This function returns the length of @var{list}, with no risk | 362 | This function returns the length of @var{list}, with no risk |
| 363 | of either an error or an infinite loop. | 363 | of either an error or an infinite loop. |
| 364 | 364 | ||
| @@ -371,24 +371,24 @@ number of distinct elements. | |||
| 371 | worried that it may be circular, is with @code{length}. @xref{Sequence | 371 | worried that it may be circular, is with @code{length}. @xref{Sequence |
| 372 | Functions}. | 372 | Functions}. |
| 373 | 373 | ||
| 374 | @tindex caar | ||
| 375 | @defun caar cons-cell | 374 | @defun caar cons-cell |
| 375 | @tindex caar | ||
| 376 | This is the same as @code{(car (car @var{cons-cell}))}. | 376 | This is the same as @code{(car (car @var{cons-cell}))}. |
| 377 | @end defun | 377 | @end defun |
| 378 | 378 | ||
| 379 | @tindex cadr | ||
| 380 | @defun cadr cons-cell | 379 | @defun cadr cons-cell |
| 380 | @tindex cadr | ||
| 381 | This is the same as @code{(car (cdr @var{cons-cell}))} | 381 | This is the same as @code{(car (cdr @var{cons-cell}))} |
| 382 | or @code{(nth 1 @var{cons-cell})}. | 382 | or @code{(nth 1 @var{cons-cell})}. |
| 383 | @end defun | 383 | @end defun |
| 384 | 384 | ||
| 385 | @tindex cdar | ||
| 386 | @defun cdar cons-cell | 385 | @defun cdar cons-cell |
| 386 | @tindex cdar | ||
| 387 | This is the same as @code{(cdr (car @var{cons-cell}))}. | 387 | This is the same as @code{(cdr (car @var{cons-cell}))}. |
| 388 | @end defun | 388 | @end defun |
| 389 | 389 | ||
| 390 | @tindex cddr | ||
| 391 | @defun cddr cons-cell | 390 | @defun cddr cons-cell |
| 391 | @tindex cddr | ||
| 392 | This is the same as @code{(cdr (cdr @var{cons-cell}))} | 392 | This is the same as @code{(cdr (cdr @var{cons-cell}))} |
| 393 | or @code{(nthcdr 2 @var{cons-cell})}. | 393 | or @code{(nthcdr 2 @var{cons-cell})}. |
| 394 | @end defun | 394 | @end defun |
| @@ -572,8 +572,8 @@ Here we show the use of vectors and strings as arguments to @code{append}: | |||
| 572 | @end group | 572 | @end group |
| 573 | @end example | 573 | @end example |
| 574 | 574 | ||
| 575 | With the help of @code{apply}, we can append all the lists in a list of | 575 | With the help of @code{apply} (@pxref{Calling Functions}), we can append |
| 576 | lists: | 576 | all the lists in a list of lists: |
| 577 | 577 | ||
| 578 | @example | 578 | @example |
| 579 | @group | 579 | @group |
| @@ -1030,6 +1030,15 @@ arguments. It is called with two elements of @var{list}. To get an | |||
| 1030 | increasing order sort, the @var{predicate} should return @code{t} if the | 1030 | increasing order sort, the @var{predicate} should return @code{t} if the |
| 1031 | first element is ``less than'' the second, or @code{nil} if not. | 1031 | first element is ``less than'' the second, or @code{nil} if not. |
| 1032 | 1032 | ||
| 1033 | The comparison function @var{predicate} must give reliable results for | ||
| 1034 | any given pair of arguments, at least within a single call to | ||
| 1035 | @code{sort}. It must be @dfn{antisymmetric}; that is, if @var{a} is | ||
| 1036 | less than @var{b}, @var{b} must not be less than @var{a}. It must be | ||
| 1037 | @dfn{transitive}---that is, if @var{a} is less than @var{b}, and @var{b} | ||
| 1038 | is less than @var{c}, then @var{a} must be less than @var{c}. If you | ||
| 1039 | use a comparison function which does not meet these requirements, the | ||
| 1040 | result of @code{sort} is unpredictable. | ||
| 1041 | |||
| 1033 | The destructive aspect of @code{sort} is that it rearranges the cons | 1042 | The destructive aspect of @code{sort} is that it rearranges the cons |
| 1034 | cells forming @var{list} by changing @sc{cdr}s. A nondestructive sort | 1043 | cells forming @var{list} by changing @sc{cdr}s. A nondestructive sort |
| 1035 | function would create new cons cells to store the elements in their | 1044 | function would create new cons cells to store the elements in their |
| @@ -1338,6 +1347,10 @@ Here is another example, in which the keys and values are not symbols: | |||
| 1338 | @end smallexample | 1347 | @end smallexample |
| 1339 | @end defun | 1348 | @end defun |
| 1340 | 1349 | ||
| 1350 | The functions @code{assoc-ignore-representation} and | ||
| 1351 | @code{assoc-ignore-case} are much like @code{assoc} except using | ||
| 1352 | @code{compare-strings} to do the comparison. @xref{Text Comparison}. | ||
| 1353 | |||
| 1341 | @defun rassoc value alist | 1354 | @defun rassoc value alist |
| 1342 | This function returns the first association with value @var{value} in | 1355 | This function returns the first association with value @var{value} in |
| 1343 | @var{alist}. It returns @code{nil} if no association in @var{alist} has | 1356 | @var{alist}. It returns @code{nil} if no association in @var{alist} has |
diff --git a/lispref/loading.texi b/lispref/loading.texi index 44eac1cbe44..6dda4a437ed 100644 --- a/lispref/loading.texi +++ b/lispref/loading.texi | |||
| @@ -35,6 +35,8 @@ containing Lisp code. | |||
| 35 | 35 | ||
| 36 | @menu | 36 | @menu |
| 37 | * How Programs Do Loading:: The @code{load} function and others. | 37 | * How Programs Do Loading:: The @code{load} function and others. |
| 38 | * Library Search:: Finding a library to load. | ||
| 39 | * Loading Non-ASCII:: Non-@sc{ASCII} characters in Emacs Lisp files. | ||
| 38 | * Autoload:: Setting up a function to autoload. | 40 | * Autoload:: Setting up a function to autoload. |
| 39 | * Repeated Loading:: Precautions about loading a file twice. | 41 | * Repeated Loading:: Precautions about loading a file twice. |
| 40 | * Named Features:: Loading a library if it isn't already loaded. | 42 | * Named Features:: Loading a library if it isn't already loaded. |
| @@ -53,7 +55,7 @@ function's real definition (@pxref{Autoload}). @code{require} loads a | |||
| 53 | file if it isn't already loaded (@pxref{Named Features}). Ultimately, | 55 | file if it isn't already loaded (@pxref{Named Features}). Ultimately, |
| 54 | all these facilities call the @code{load} function to do the work. | 56 | all these facilities call the @code{load} function to do the work. |
| 55 | 57 | ||
| 56 | @defun load filename &optional missing-ok nomessage nosuffix | 58 | @defun load filename &optional missing-ok nomessage nosuffix must-suffix |
| 57 | This function finds and opens a file of Lisp code, evaluates all the | 59 | This function finds and opens a file of Lisp code, evaluates all the |
| 58 | forms in it, and closes the file. | 60 | forms in it, and closes the file. |
| 59 | 61 | ||
| @@ -74,6 +76,12 @@ must specify the precise file name you want. By specifying the precise | |||
| 74 | file name and using @code{t} for @var{nosuffix}, you can prevent | 76 | file name and using @code{t} for @var{nosuffix}, you can prevent |
| 75 | perverse file names such as @file{foo.el.el} from being tried. | 77 | perverse file names such as @file{foo.el.el} from being tried. |
| 76 | 78 | ||
| 79 | If the optional argument @var{must-suffix} is non-@code{nil}, then | ||
| 80 | @code{load} insists that the file name used must end in either | ||
| 81 | @samp{.el} or @samp{.elc}, unless it contains an explicit directory | ||
| 82 | name. If @var{filename} does not contain an explicit directory name, | ||
| 83 | and does not end in a suffix, then @code{load} insists on adding one. | ||
| 84 | |||
| 77 | If @var{filename} is a relative file name, such as @file{foo} or | 85 | If @var{filename} is a relative file name, such as @file{foo} or |
| 78 | @file{baz/foo.bar}, @code{load} searches for the file using the variable | 86 | @file{baz/foo.bar}, @code{load} searches for the file using the variable |
| 79 | @code{load-path}. It appends @var{filename} to each of the directories | 87 | @code{load-path}. It appends @var{filename} to each of the directories |
| @@ -82,7 +90,7 @@ matches. The current default directory is tried only if it is specified | |||
| 82 | in @code{load-path}, where @code{nil} stands for the default directory. | 90 | in @code{load-path}, where @code{nil} stands for the default directory. |
| 83 | @code{load} tries all three possible suffixes in the first directory in | 91 | @code{load} tries all three possible suffixes in the first directory in |
| 84 | @code{load-path}, then all three suffixes in the second directory, and | 92 | @code{load-path}, then all three suffixes in the second directory, and |
| 85 | so on. | 93 | so on. @xref{Library Search}. |
| 86 | 94 | ||
| 87 | If you get a warning that @file{foo.elc} is older than @file{foo.el}, it | 95 | If you get a warning that @file{foo.elc} is older than @file{foo.el}, it |
| 88 | means you should consider recompiling @file{foo.el}. @xref{Byte | 96 | means you should consider recompiling @file{foo.el}. @xref{Byte |
| @@ -118,7 +126,7 @@ See below. | |||
| 118 | This command loads the file @var{filename}. If @var{filename} is a | 126 | This command loads the file @var{filename}. If @var{filename} is a |
| 119 | relative file name, then the current default directory is assumed. | 127 | relative file name, then the current default directory is assumed. |
| 120 | @code{load-path} is not used, and suffixes are not appended. Use this | 128 | @code{load-path} is not used, and suffixes are not appended. Use this |
| 121 | command if you wish to specify the file to be loaded exactly. | 129 | command if you wish to specify precisely the file name to load. |
| 122 | @end deffn | 130 | @end deffn |
| 123 | 131 | ||
| 124 | @deffn Command load-library library | 132 | @deffn Command load-library library |
| @@ -126,17 +134,43 @@ This command loads the library named @var{library}. It is equivalent to | |||
| 126 | @code{load}, except in how it reads its argument interactively. | 134 | @code{load}, except in how it reads its argument interactively. |
| 127 | @end deffn | 135 | @end deffn |
| 128 | 136 | ||
| 137 | @defvar load-in-progress | ||
| 138 | This variable is non-@code{nil} if Emacs is in the process of loading a | ||
| 139 | file, and it is @code{nil} otherwise. | ||
| 140 | @end defvar | ||
| 141 | |||
| 142 | @defvar load-read-function | ||
| 143 | This variable specifies an alternate expression-reading function for | ||
| 144 | @code{load} and @code{eval-region} to use instead of @code{read}. | ||
| 145 | The function should accept one argument, just as @code{read} does. | ||
| 146 | |||
| 147 | Normally, the variable's value is @code{nil}, which means those | ||
| 148 | functions should use @code{read}. | ||
| 149 | @end defvar | ||
| 150 | |||
| 151 | For how @code{load} is used to build Emacs, see @ref{Building Emacs}. | ||
| 152 | |||
| 153 | @node Library Search | ||
| 154 | @section Library Search | ||
| 155 | |||
| 156 | When Emacs loads a Lisp library, it searches for the library | ||
| 157 | in a list of directories specified by the variable @code{load-path}. | ||
| 158 | |||
| 129 | @defopt load-path | 159 | @defopt load-path |
| 130 | @cindex @code{EMACSLOADPATH} environment variable | 160 | @cindex @code{EMACSLOADPATH} environment variable |
| 131 | The value of this variable is a list of directories to search when | 161 | The value of this variable is a list of directories to search when |
| 132 | loading files with @code{load}. Each element is a string (which must be | 162 | loading files with @code{load}. Each element is a string (which must be |
| 133 | a directory name) or @code{nil} (which stands for the current working | 163 | a directory name) or @code{nil} (which stands for the current working |
| 134 | directory). The value of @code{load-path} is initialized from the | 164 | directory). |
| 135 | environment variable @code{EMACSLOADPATH}, if that exists; otherwise its | 165 | @end defopt |
| 136 | default value is specified in @file{emacs/src/paths.h} when Emacs is | 166 | |
| 137 | built. | 167 | The value of @code{load-path} is initialized from the environment |
| 168 | variable @code{EMACSLOADPATH}, if that exists; otherwise its default | ||
| 169 | value is specified in @file{emacs/src/paths.h} when Emacs is built. | ||
| 170 | Then the list is expanded by adding subdirectories of the directories | ||
| 171 | in the list. | ||
| 138 | 172 | ||
| 139 | The syntax of @code{EMACSLOADPATH} is the same as used for @code{PATH}; | 173 | The syntax of @code{EMACSLOADPATH} is the same as used for @code{PATH}; |
| 140 | @samp{:} (or @samp{;}, according to the operating system) separates | 174 | @samp{:} (or @samp{;}, according to the operating system) separates |
| 141 | directory names, and @samp{.} is used for the current default directory. | 175 | directory names, and @samp{.} is used for the current default directory. |
| 142 | Here is an example of how to set your @code{EMACSLOADPATH} variable from | 176 | Here is an example of how to set your @code{EMACSLOADPATH} variable from |
| @@ -144,17 +178,17 @@ a @code{csh} @file{.login} file: | |||
| 144 | 178 | ||
| 145 | @c This overfull hbox is OK. --rjc 16mar92 | 179 | @c This overfull hbox is OK. --rjc 16mar92 |
| 146 | @smallexample | 180 | @smallexample |
| 147 | setenv EMACSLOADPATH .:/user/bil/emacs:/usr/lib/emacs/lisp | 181 | setenv EMACSLOADPATH .:/user/bil/emacs:/usr/local/lib/emacs/lisp |
| 148 | @end smallexample | 182 | @end smallexample |
| 149 | 183 | ||
| 150 | Here is how to set it using @code{sh}: | 184 | Here is how to set it using @code{sh}: |
| 151 | 185 | ||
| 152 | @smallexample | 186 | @smallexample |
| 153 | export EMACSLOADPATH | 187 | export EMACSLOADPATH |
| 154 | EMACSLOADPATH=.:/user/bil/emacs:/usr/local/lib/emacs/lisp | 188 | EMACSLOADPATH=.:/user/bil/emacs:/usr/local/lib/emacs/lisp |
| 155 | @end smallexample | 189 | @end smallexample |
| 156 | 190 | ||
| 157 | Here is an example of code you can place in a @file{.emacs} file to add | 191 | Here is an example of code you can place in a @file{.emacs} file to add |
| 158 | several directories to the front of your default @code{load-path}: | 192 | several directories to the front of your default @code{load-path}: |
| 159 | 193 | ||
| 160 | @smallexample | 194 | @smallexample |
| @@ -174,34 +208,37 @@ followed then by the @file{/user/bil/emacs} directory, the | |||
| 174 | @file{/usr/local/lisplib} directory, and the @file{~/emacs} directory, | 208 | @file{/usr/local/lisplib} directory, and the @file{~/emacs} directory, |
| 175 | which are then followed by the standard directories for Lisp code. | 209 | which are then followed by the standard directories for Lisp code. |
| 176 | 210 | ||
| 177 | Dumping Emacs uses a special value of @code{load-path}. If the value of | 211 | Dumping Emacs uses a special value of @code{load-path}. If the value of |
| 178 | @code{load-path} at the end of dumping is unchanged (that is, still the | 212 | @code{load-path} at the end of dumping is unchanged (that is, still the |
| 179 | same special value), the dumped Emacs switches to the ordinary | 213 | same special value), the dumped Emacs switches to the ordinary |
| 180 | @code{load-path} value when it starts up, as described above. But if | 214 | @code{load-path} value when it starts up, as described above. But if |
| 181 | @code{load-path} has any other value at the end of dumping, that value | 215 | @code{load-path} has any other value at the end of dumping, that value |
| 182 | is used for execution of the dumped Emacs also. | 216 | is used for execution of the dumped Emacs also. |
| 183 | 217 | ||
| 184 | Therefore, if you want to change @code{load-path} temporarily for | 218 | Therefore, if you want to change @code{load-path} temporarily for |
| 185 | loading a few libraries in @file{site-init.el} or @file{site-load.el}, | 219 | loading a few libraries in @file{site-init.el} or @file{site-load.el}, |
| 186 | you should bind @code{load-path} locally with @code{let} around the | 220 | you should bind @code{load-path} locally with @code{let} around the |
| 187 | calls to @code{load}. | 221 | calls to @code{load}. |
| 188 | @end defopt | ||
| 189 | 222 | ||
| 190 | The default value of @code{load-path}, when running an Emacs which has | 223 | The default value of @code{load-path}, when running an Emacs which has |
| 191 | been installed on the system, looks like this: | 224 | been installed on the system, includes two special directories (and |
| 225 | their subdirectories as well): | ||
| 192 | 226 | ||
| 193 | @smallexample | 227 | @smallexample |
| 194 | ("/usr/local/share/emacs/@var{version}/site-lisp" | 228 | "/usr/local/share/emacs/@var{version}/site-lisp" |
| 195 | "/usr/local/share/emacs/site-lisp" | ||
| 196 | "/usr/local/share/emacs/@var{version}/lisp") | ||
| 197 | @end smallexample | 229 | @end smallexample |
| 198 | 230 | ||
| 199 | The last of these three directories is where the Lisp files of Emacs | 231 | @noindent |
| 200 | itself are installed; the first two are for additional Lisp packages | 232 | and |
| 201 | installed at your site. The first directory is for locally installed | 233 | |
| 202 | packages that belong with a particular Emacs version; the second is for | 234 | @smallexample |
| 203 | locally installed packages that can be used with any installed Emacs | 235 | "/usr/local/share/emacs/site-lisp" |
| 204 | version. | 236 | @end smallexample |
| 237 | |||
| 238 | @noindent | ||
| 239 | The first one is for locally installed packages for a particular Emacs | ||
| 240 | version; the second is for locally installed packages meant for use with | ||
| 241 | all installed Emacs versions. | ||
| 205 | 242 | ||
| 206 | There are several reasons why a Lisp package that works well in one | 243 | There are several reasons why a Lisp package that works well in one |
| 207 | Emacs version can cause trouble in another. Sometimes packages need | 244 | Emacs version can cause trouble in another. Sometimes packages need |
| @@ -210,28 +247,23 @@ undocumented internal Emacs data that can change without notice; | |||
| 210 | sometimes a newer Emacs version incorporates a version of the package, | 247 | sometimes a newer Emacs version incorporates a version of the package, |
| 211 | and should be used only with that version. | 248 | and should be used only with that version. |
| 212 | 249 | ||
| 250 | Emacs finds these directories' subdirectories and adds them to | ||
| 251 | @code{load-path} when it starts up. Both immediate subdirectories and | ||
| 252 | subdirectories multiple levels down are added to @code{load-path}. | ||
| 253 | |||
| 254 | Not all subdirectories are included, though. Subdirectories whose | ||
| 255 | names do not start with a letter or digit are excluded. Subdirectories | ||
| 256 | named @file{RCS} are excluded. Also, a subdirectory which contains a | ||
| 257 | file named @file{.nosearch} is excluded. You can use these methods to | ||
| 258 | prevent certain subdirectories of the @file{site-lisp} directories from | ||
| 259 | being searched. | ||
| 260 | |||
| 213 | If you run Emacs from the directory where it was built---that is, an | 261 | If you run Emacs from the directory where it was built---that is, an |
| 214 | executable that has not been formally installed---then @code{load-path} | 262 | executable that has not been formally installed---then @code{load-path} |
| 215 | normally contains two additional directories. These are the @code{lisp} | 263 | normally contains two additional directories. These are the @code{lisp} |
| 216 | and @code{site-lisp} subdirectories of the main build directory. (Both | 264 | and @code{site-lisp} subdirectories of the main build directory. (Both |
| 217 | are represented as absolute file names.) | 265 | are represented as absolute file names.) |
| 218 | 266 | ||
| 219 | @defvar load-in-progress | ||
| 220 | This variable is non-@code{nil} if Emacs is in the process of loading a | ||
| 221 | file, and it is @code{nil} otherwise. | ||
| 222 | @end defvar | ||
| 223 | |||
| 224 | @defvar load-read-function | ||
| 225 | This variable specifies an alternate expression-reading function for | ||
| 226 | @code{load} and @code{eval-region} to use instead of @code{read}. | ||
| 227 | The function should accept one argument, just as @code{read} does. | ||
| 228 | |||
| 229 | Normally, the variable's value is @code{nil}, which means those | ||
| 230 | functions should use @code{read}. | ||
| 231 | @end defvar | ||
| 232 | |||
| 233 | For how @code{load} is used to build Emacs, see @ref{Building Emacs}. | ||
| 234 | |||
| 235 | @deffn Command locate-library library &optional nosuffix path interactive-call | 267 | @deffn Command locate-library library &optional nosuffix path interactive-call |
| 236 | This command finds the precise file name for library @var{library}. It | 268 | This command finds the precise file name for library @var{library}. It |
| 237 | searches for the library in the same way @code{load} does, and the | 269 | searches for the library in the same way @code{load} does, and the |
| @@ -248,6 +280,44 @@ interactively, the argument @var{interactive-call} is @code{t}, and this | |||
| 248 | tells @code{locate-library} to display the file name in the echo area. | 280 | tells @code{locate-library} to display the file name in the echo area. |
| 249 | @end deffn | 281 | @end deffn |
| 250 | 282 | ||
| 283 | @node Loading Non-ASCII | ||
| 284 | @section Loading Non-ASCII Characters | ||
| 285 | |||
| 286 | When Emacs Lisp programs contain string constants with non-@sc{ASCII} | ||
| 287 | characters, these can be represented within Emacs either as unibyte | ||
| 288 | strings or as multibyte strings (@pxref{Text Representations}). Which | ||
| 289 | representation is used depends on how the file is read into Emacs. If | ||
| 290 | it is read with decoding into multibyte representation, the text of the | ||
| 291 | Lisp program will be multibyte text, and its string constants will be | ||
| 292 | multibyte strings. If a file containing Latin-1 characters (for | ||
| 293 | example) is read without decoding, the text of the program will be | ||
| 294 | unibyte text, and its string constants will be unibyte strings. | ||
| 295 | @xref{Coding Systems}. | ||
| 296 | |||
| 297 | To make the results more predictable, Emacs always performs decoding | ||
| 298 | into the multibyte representation when loading Lisp files, even if it | ||
| 299 | was started with the @samp{--unibyte} option. This means that string | ||
| 300 | constants with non-@sc{ASCII} characters translate into multibyte | ||
| 301 | strings. The only exception is when a particular file specifies no | ||
| 302 | decoding. | ||
| 303 | |||
| 304 | The reason Emacs is designed this way is so that Lisp programs give | ||
| 305 | predictable results, regardless of how Emacs was started. In addition, | ||
| 306 | this enables programs that depend on using multibyte text to work even | ||
| 307 | in a unibyte Emacs. Of course, such programs should be designed to | ||
| 308 | notice whether the user prefers unibyte or multibyte text, by checking | ||
| 309 | @code{default-enable-multibyte-characters}, and convert representations | ||
| 310 | appropriately. | ||
| 311 | |||
| 312 | In most Emacs Lisp programs, the fact that non-@sc{ASCII} strings are | ||
| 313 | multibyte strings should not be noticeable, since inserting them in | ||
| 314 | unibyte buffers converts them to unibyte automatically. However, if | ||
| 315 | this does make a difference, you can force a particular Lisp file to be | ||
| 316 | interpreted as unibyte by writing @samp{-*-coding: raw-text;-*-} in a | ||
| 317 | comment on the file's first line. With that designator, the file will | ||
| 318 | be unconditionally be interpreted as unibyte, even in an ordinary | ||
| 319 | multibyte Emacs session. | ||
| 320 | |||
| 251 | @node Autoload | 321 | @node Autoload |
| 252 | @section Autoload | 322 | @section Autoload |
| 253 | @cindex autoload | 323 | @cindex autoload |
| @@ -263,8 +333,8 @@ as if it had been loaded all along. | |||
| 263 | source before the real definition. @code{autoload} is the low-level | 333 | source before the real definition. @code{autoload} is the low-level |
| 264 | primitive for autoloading; any Lisp program can call @code{autoload} at | 334 | primitive for autoloading; any Lisp program can call @code{autoload} at |
| 265 | any time. Magic comments are the most convenient way to make a function | 335 | any time. Magic comments are the most convenient way to make a function |
| 266 | autoload, for packages installed along with Emacs. They do nothing on | 336 | autoload, for packages installed along with Emacs. These comments do |
| 267 | their own, but they serve as a guide for the command | 337 | nothing on their own, but they serve as a guide for the command |
| 268 | @code{update-file-autoloads}, which constructs calls to @code{autoload} | 338 | @code{update-file-autoloads}, which constructs calls to @code{autoload} |
| 269 | and arranges to execute them when Emacs is built. | 339 | and arranges to execute them when Emacs is built. |
| 270 | 340 | ||
| @@ -286,10 +356,10 @@ documentation without loading the function's real definition. | |||
| 286 | 356 | ||
| 287 | If @var{interactive} is non-@code{nil}, that says @var{function} can be | 357 | If @var{interactive} is non-@code{nil}, that says @var{function} can be |
| 288 | called interactively. This lets completion in @kbd{M-x} work without | 358 | called interactively. This lets completion in @kbd{M-x} work without |
| 289 | loading its real definition. The complete interactive specification is | 359 | loading @var{function}'s real definition. The complete interactive |
| 290 | not given here; it's not needed unless the user actually calls | 360 | specification is not given here; it's not needed unless the user |
| 291 | @var{function}, and when that happens, it's time to load the real | 361 | actually calls @var{function}, and when that happens, it's time to load |
| 292 | definition. | 362 | the real definition. |
| 293 | 363 | ||
| 294 | You can autoload macros and keymaps as well as ordinary functions. | 364 | You can autoload macros and keymaps as well as ordinary functions. |
| 295 | Specify @var{type} as @code{macro} if @var{function} is really a macro. | 365 | Specify @var{type} as @code{macro} if @var{function} is really a macro. |
| @@ -338,9 +408,9 @@ or provide one or more features. If the file is not completely loaded | |||
| 338 | definitions or @code{provide} calls that occurred during the load are | 408 | definitions or @code{provide} calls that occurred during the load are |
| 339 | undone. This is to ensure that the next attempt to call any function | 409 | undone. This is to ensure that the next attempt to call any function |
| 340 | autoloading from this file will try again to load the file. If not for | 410 | autoloading from this file will try again to load the file. If not for |
| 341 | this, then some of the functions in the file might appear defined, but | 411 | this, then some of the functions in the file might be defined by the |
| 342 | they might fail to work properly for the lack of certain subroutines | 412 | aborted load, but fail to work properly for the lack of certain |
| 343 | defined later in the file and not loaded successfully. | 413 | subroutines not loaded successfully because they come later in the file. |
| 344 | 414 | ||
| 345 | If the autoloaded file fails to define the desired Lisp function or | 415 | If the autoloaded file fails to define the desired Lisp function or |
| 346 | macro, then an error is signaled with data @code{"Autoloading failed to | 416 | macro, then an error is signaled with data @code{"Autoloading failed to |
| @@ -348,7 +418,7 @@ define function @var{function-name}"}. | |||
| 348 | 418 | ||
| 349 | @findex update-file-autoloads | 419 | @findex update-file-autoloads |
| 350 | @findex update-directory-autoloads | 420 | @findex update-directory-autoloads |
| 351 | A magic autoload comment looks like @samp{;;;###autoload}, on a line | 421 | A magic autoload comment consists of @samp{;;;###autoload}, on a line |
| 352 | by itself, just before the real definition of the function in its | 422 | by itself, just before the real definition of the function in its |
| 353 | autoloadable source file. The command @kbd{M-x update-file-autoloads} | 423 | autoloadable source file. The command @kbd{M-x update-file-autoloads} |
| 354 | writes a corresponding @code{autoload} call into @file{loaddefs.el}. | 424 | writes a corresponding @code{autoload} call into @file{loaddefs.el}. |
| @@ -398,7 +468,7 @@ documentation string in the @file{etc/DOC} file. @xref{Building Emacs}. | |||
| 398 | @section Repeated Loading | 468 | @section Repeated Loading |
| 399 | @cindex repeated loading | 469 | @cindex repeated loading |
| 400 | 470 | ||
| 401 | You can load one file more than once in an Emacs session. For | 471 | You can load a given file more than once in an Emacs session. For |
| 402 | example, after you have rewritten and reinstalled a function definition | 472 | example, after you have rewritten and reinstalled a function definition |
| 403 | by editing it in a buffer, you may wish to return to the original | 473 | by editing it in a buffer, you may wish to return to the original |
| 404 | version; you can do this by reloading the file it came from. | 474 | version; you can do this by reloading the file it came from. |
| @@ -409,7 +479,7 @@ rather than a non-compiled file of similar name. If you rewrite a file | |||
| 409 | that you intend to save and reinstall, you need to byte-compile the new | 479 | that you intend to save and reinstall, you need to byte-compile the new |
| 410 | version; otherwise Emacs will load the older, byte-compiled file instead | 480 | version; otherwise Emacs will load the older, byte-compiled file instead |
| 411 | of your newer, non-compiled file! If that happens, the message | 481 | of your newer, non-compiled file! If that happens, the message |
| 412 | displayed when loading the file includes, @samp{(compiled; source is | 482 | displayed when loading the file includes, @samp{(compiled; note, source is |
| 413 | newer)}, to remind you to recompile it. | 483 | newer)}, to remind you to recompile it. |
| 414 | 484 | ||
| 415 | When writing the forms in a Lisp library file, keep in mind that the | 485 | When writing the forms in a Lisp library file, keep in mind that the |
| @@ -435,7 +505,7 @@ To avoid the problem, write this: | |||
| 435 | (cons '(leif-mode " Leif") minor-mode-alist))) | 505 | (cons '(leif-mode " Leif") minor-mode-alist))) |
| 436 | @end example | 506 | @end example |
| 437 | 507 | ||
| 438 | To add an element to a list just once, use @code{add-to-list} | 508 | To add an element to a list just once, you can also use @code{add-to-list} |
| 439 | (@pxref{Setting Variables}). | 509 | (@pxref{Setting Variables}). |
| 440 | 510 | ||
| 441 | Occasionally you will want to test explicitly whether a library has | 511 | Occasionally you will want to test explicitly whether a library has |
diff --git a/lispref/macros.texi b/lispref/macros.texi index b9e93bcf6d4..0a739bc3ba5 100644 --- a/lispref/macros.texi +++ b/lispref/macros.texi | |||
| @@ -503,7 +503,7 @@ in expressions ordinarily. | |||
| 503 | @node Eval During Expansion | 503 | @node Eval During Expansion |
| 504 | @subsection Evaluating Macro Arguments in Expansion | 504 | @subsection Evaluating Macro Arguments in Expansion |
| 505 | 505 | ||
| 506 | Another problem can happen if you the macro definition itself | 506 | Another problem can happen if the macro definition itself |
| 507 | evaluates any of the macro argument expressions, such as by calling | 507 | evaluates any of the macro argument expressions, such as by calling |
| 508 | @code{eval} (@pxref{Eval}). If the argument is supposed to refer to the | 508 | @code{eval} (@pxref{Eval}). If the argument is supposed to refer to the |
| 509 | user's variables, you may have trouble if the user happens to use a | 509 | user's variables, you may have trouble if the user happens to use a |
| @@ -542,7 +542,7 @@ with @code{eval}) don't occur and its local variable bindings don't | |||
| 542 | exist. | 542 | exist. |
| 543 | 543 | ||
| 544 | To avoid these problems, @strong{don't evaluate an argument expression | 544 | To avoid these problems, @strong{don't evaluate an argument expression |
| 545 | while computing the macro expansion.} Instead, substitute the | 545 | while computing the macro expansion}. Instead, substitute the |
| 546 | expression into the macro expansion, so that its value will be computed | 546 | expression into the macro expansion, so that its value will be computed |
| 547 | as part of executing the expansion. This is how the other examples in | 547 | as part of executing the expansion. This is how the other examples in |
| 548 | this chapter work. | 548 | this chapter work. |
diff --git a/lispref/maps.texi b/lispref/maps.texi index 78b5ceae979..96f8d0921ee 100644 --- a/lispref/maps.texi +++ b/lispref/maps.texi | |||
| @@ -150,8 +150,8 @@ The keymap which displays the Files menu in the menu bar. | |||
| 150 | @vindex menu-bar-help-menu | 150 | @vindex menu-bar-help-menu |
| 151 | The keymap which displays the Help menu in the menu bar. | 151 | The keymap which displays the Help menu in the menu bar. |
| 152 | 152 | ||
| 153 | @tindex menu-bar-mule-menu | ||
| 154 | @item menu-bar-mule-menu | 153 | @item menu-bar-mule-menu |
| 154 | @tindex menu-bar-mule-menu | ||
| 155 | @vindex menu-bar-mule-menu | 155 | @vindex menu-bar-mule-menu |
| 156 | The keymap which displays the Mule menu in the menu bar. | 156 | The keymap which displays the Mule menu in the menu bar. |
| 157 | 157 | ||
diff --git a/lispref/markers.texi b/lispref/markers.texi index 6a475b7a01e..0fa549bdd16 100644 --- a/lispref/markers.texi +++ b/lispref/markers.texi | |||
| @@ -131,8 +131,8 @@ This function returns @code{t} if @var{object} is an integer or a marker, | |||
| 131 | @end defun | 131 | @end defun |
| 132 | 132 | ||
| 133 | @defun number-or-marker-p object | 133 | @defun number-or-marker-p object |
| 134 | This function returns @code{t} if @var{object} is a number (either kind) | 134 | This function returns @code{t} if @var{object} is a number (either |
| 135 | or a marker, @code{nil} otherwise. | 135 | 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 |
| @@ -144,7 +144,7 @@ accessible portion of the buffer, or to the same place as another given | |||
| 144 | marker. | 144 | marker. |
| 145 | 145 | ||
| 146 | @defun make-marker | 146 | @defun make-marker |
| 147 | This functions returns a newly created marker that does not point | 147 | This function returns a newly created marker that does not point |
| 148 | anywhere. | 148 | anywhere. |
| 149 | 149 | ||
| 150 | @example | 150 | @example |
| @@ -216,8 +216,25 @@ passed an integer argument greater than the length of the buffer, | |||
| 216 | @code{copy-marker} returns a new marker that points to the end of the | 216 | @code{copy-marker} returns a new marker that points to the end of the |
| 217 | buffer. | 217 | buffer. |
| 218 | 218 | ||
| 219 | @example | ||
| 220 | @group | ||
| 221 | (copy-marker 0) | ||
| 222 | @result{} #<marker at 1 in markers.texi> | ||
| 223 | @end group | ||
| 224 | |||
| 225 | @group | ||
| 226 | (copy-marker 20000) | ||
| 227 | @result{} #<marker at 7572 in markers.texi> | ||
| 228 | @end group | ||
| 229 | @end example | ||
| 230 | |||
| 219 | An error is signaled if @var{marker} is neither a marker nor an | 231 | An error is signaled if @var{marker} is neither a marker nor an |
| 220 | integer. | 232 | integer. |
| 233 | @end defun | ||
| 234 | |||
| 235 | Two distinct markers are considered @code{equal} (even though not | ||
| 236 | @code{eq}) to each other if they have the same position and buffer, or | ||
| 237 | if they both point nowhere. | ||
| 221 | 238 | ||
| 222 | @example | 239 | @example |
| 223 | @group | 240 | @group |
| @@ -239,18 +256,7 @@ integer. | |||
| 239 | (equal p q) | 256 | (equal p q) |
| 240 | @result{} t | 257 | @result{} t |
| 241 | @end group | 258 | @end group |
| 242 | |||
| 243 | @group | ||
| 244 | (copy-marker 0) | ||
| 245 | @result{} #<marker at 1 in markers.texi> | ||
| 246 | @end group | ||
| 247 | |||
| 248 | @group | ||
| 249 | (copy-marker 20000) | ||
| 250 | @result{} #<marker at 7572 in markers.texi> | ||
| 251 | @end group | ||
| 252 | @end example | 259 | @end example |
| 253 | @end defun | ||
| 254 | 260 | ||
| 255 | @node Information from Markers | 261 | @node Information from Markers |
| 256 | @section Information from Markers | 262 | @section Information from Markers |
| @@ -296,10 +302,6 @@ This function returns the buffer that @var{marker} points into, or | |||
| 296 | @end example | 302 | @end example |
| 297 | @end defun | 303 | @end defun |
| 298 | 304 | ||
| 299 | Two distinct markers are considered @code{equal} (even though not | ||
| 300 | @code{eq}) to each other if they have the same position and buffer, or | ||
| 301 | if they both point nowhere. | ||
| 302 | |||
| 303 | @node Marker Insertion Types | 305 | @node Marker Insertion Types |
| 304 | @section Marker Insertion Types | 306 | @section Marker Insertion Types |
| 305 | 307 | ||
| @@ -311,16 +313,16 @@ marker should do by setting its @dfn{insertion type}. Note that use of | |||
| 311 | @code{insert-before-markers} ignores markers' insertion types, always | 313 | @code{insert-before-markers} ignores markers' insertion types, always |
| 312 | relocating a marker to point after the inserted text. | 314 | relocating a marker to point after the inserted text. |
| 313 | 315 | ||
| 314 | @tindex set-marker-insertion-type | ||
| 315 | @defun set-marker-insertion-type marker type | 316 | @defun set-marker-insertion-type marker type |
| 317 | @tindex set-marker-insertion-type | ||
| 316 | This function sets the insertion type of marker @var{marker} to | 318 | This function sets the insertion type of marker @var{marker} to |
| 317 | @var{type}. If @var{type} is @code{t}, @var{marker} will advances when | 319 | @var{type}. If @var{type} is @code{t}, @var{marker} will advances when |
| 318 | text is inserted at it. If @var{type} is @code{nil}, @var{marker} does | 320 | text is inserted at it. If @var{type} is @code{nil}, @var{marker} does |
| 319 | not advance when text is inserted there. | 321 | not advance when text is inserted there. |
| 320 | @end defun | 322 | @end defun |
| 321 | 323 | ||
| 322 | @tindex marker-insertion-type | ||
| 323 | @defun marker-insertion-type marker | 324 | @defun marker-insertion-type marker |
| 325 | @tindex marker-insertion-type | ||
| 324 | This function reports the current insertion type of @var{marker}. | 326 | This function reports the current insertion type of @var{marker}. |
| 325 | @end defun | 327 | @end defun |
| 326 | 328 | ||
| @@ -377,9 +379,9 @@ This is another name for @code{set-marker}. | |||
| 377 | 379 | ||
| 378 | One special marker in each buffer is designated @dfn{the mark}. It | 380 | One special marker in each buffer is designated @dfn{the mark}. It |
| 379 | records a position for the user for the sake of commands such as | 381 | records a position for the user for the sake of commands such as |
| 380 | @kbd{C-w} and @kbd{C-x @key{TAB}}. Lisp programs should set the mark | 382 | @code{kill-region} and @code{indent-rigidly}. Lisp programs should set |
| 381 | only to values that have a potential use to the user, and never for | 383 | the mark only to values that have a potential use to the user, and never |
| 382 | their own internal purposes. For example, the @code{replace-regexp} | 384 | for their own internal purposes. For example, the @code{replace-regexp} |
| 383 | command sets the mark to the value of point before doing any | 385 | command sets the mark to the value of point before doing any |
| 384 | replacements, because this enables the user to move back there | 386 | replacements, because this enables the user to move back there |
| 385 | conveniently after the replace is finished. | 387 | conveniently after the replace is finished. |
diff --git a/lispref/minibuf.texi b/lispref/minibuf.texi index 0ff8e79c1ca..8ddb5d72350 100644 --- a/lispref/minibuf.texi +++ b/lispref/minibuf.texi | |||
| @@ -90,8 +90,8 @@ either one. | |||
| 90 | 90 | ||
| 91 | In most cases, you should not call minibuffer input functions in the | 91 | In most cases, you should not call minibuffer input functions in the |
| 92 | middle of a Lisp function. Instead, do all minibuffer input as part of | 92 | middle of a Lisp function. Instead, do all minibuffer input as part of |
| 93 | reading the arguments for a command, in the @code{interactive} spec. | 93 | reading the arguments for a command, in the @code{interactive} |
| 94 | @xref{Defining Commands}. | 94 | specification. @xref{Defining Commands}. |
| 95 | 95 | ||
| 96 | @defun read-from-minibuffer prompt-string &optional initial-contents keymap read hist default inherit-input-method | 96 | @defun read-from-minibuffer prompt-string &optional initial-contents keymap read hist default inherit-input-method |
| 97 | This function is the most general way to get input through the | 97 | This function is the most general way to get input through the |
| @@ -115,7 +115,7 @@ The argument @var{default} specifies a default value to make available | |||
| 115 | through the history commands. It should be a string, or @code{nil}. If | 115 | through the history commands. It should be a string, or @code{nil}. If |
| 116 | @var{read} is non-@code{nil}, then @var{default} is also used as the | 116 | @var{read} is non-@code{nil}, then @var{default} is also used as the |
| 117 | input to @code{read}, if the user enters empty input. However, in the | 117 | input to @code{read}, if the user enters empty input. However, in the |
| 118 | usual case (where @var{read} is @code{nil}, @code{read-from-minibuffer} | 118 | usual case (where @var{read} is @code{nil}), @code{read-from-minibuffer} |
| 119 | does not return @var{default} when the user enters empty input; it | 119 | does not return @var{default} when the user enters empty input; it |
| 120 | returns an empty string, @code{""}. In this respect, it is different | 120 | returns an empty string, @code{""}. In this respect, it is different |
| 121 | from all the other minibuffer input functions in this chapter. | 121 | from all the other minibuffer input functions in this chapter. |
| @@ -136,9 +136,10 @@ properties were present in the minibuffer. Otherwise all the text | |||
| 136 | properties are stripped when the value is returned. | 136 | properties are stripped when the value is returned. |
| 137 | 137 | ||
| 138 | If the argument @var{inherit-input-method} is non-@code{nil}, then the | 138 | If the argument @var{inherit-input-method} is non-@code{nil}, then the |
| 139 | minibuffer inherits the current input method and the setting of | 139 | minibuffer inherits the current buffer's input method (@pxref{Input |
| 140 | @code{enable-multibyte-characters} from whichever buffer was current | 140 | Methods}) and the setting of @code{enable-multibyte-characters} |
| 141 | before entering the minibuffer. | 141 | (@pxref{Text Representations}) from whichever buffer was current before |
| 142 | entering the minibuffer. | ||
| 142 | 143 | ||
| 143 | If @var{initial-contents} is a string, @code{read-from-minibuffer} | 144 | If @var{initial-contents} is a string, @code{read-from-minibuffer} |
| 144 | inserts it into the minibuffer, leaving point at the end, before the | 145 | inserts it into the minibuffer, leaving point at the end, before the |
| @@ -425,7 +426,12 @@ arguments to other commands). | |||
| 425 | @end defvar | 426 | @end defvar |
| 426 | 427 | ||
| 427 | @defvar file-name-history | 428 | @defvar file-name-history |
| 428 | A history list for file name arguments. | 429 | A history list for file-name arguments. |
| 430 | @end defvar | ||
| 431 | |||
| 432 | @defvar buffer-name-history | ||
| 433 | @tindex buffer-name-history | ||
| 434 | A history list for buffer-name arguments. | ||
| 429 | @end defvar | 435 | @end defvar |
| 430 | 436 | ||
| 431 | @defvar regexp-history | 437 | @defvar regexp-history |
| @@ -673,10 +679,10 @@ edit the input, providing several commands to attempt completion. | |||
| 673 | In most cases, we recommend using @var{default}, and not @var{initial}. | 679 | In most cases, we recommend using @var{default}, and not @var{initial}. |
| 674 | 680 | ||
| 675 | If the argument @var{inherit-input-method} is non-@code{nil}, then the | 681 | If the argument @var{inherit-input-method} is non-@code{nil}, then the |
| 676 | minibuffer inherits the current input method and the setting of | 682 | minibuffer inherits the current buffer's input method (@pxref{Input |
| 677 | @code{enable-multibyte-characters} from whichever buffer was current | 683 | Methods}) and the setting of @code{enable-multibyte-characters} |
| 678 | before entering the minibuffer. @xref{Input Methods,,, emacs, The GNU | 684 | (@pxref{Text Representations}) from whichever buffer was current before |
| 679 | Emacs Manual}. | 685 | entering the minibuffer. |
| 680 | 686 | ||
| 681 | Completion ignores case when comparing the input against the possible | 687 | Completion ignores case when comparing the input against the possible |
| 682 | matches, if the built-in variable @code{completion-ignore-case} is | 688 | matches, if the built-in variable @code{completion-ignore-case} is |
| @@ -853,8 +859,8 @@ reading certain sorts of names with completion. | |||
| 853 | 859 | ||
| 854 | In most cases, you should not call these functions in the middle of a | 860 | In most cases, you should not call these functions in the middle of a |
| 855 | Lisp function. When possible, do all minibuffer input as part of | 861 | Lisp function. When possible, do all minibuffer input as part of |
| 856 | reading the arguments for a command, in the @code{interactive} spec. | 862 | reading the arguments for a command, in the @code{interactive} |
| 857 | @xref{Defining Commands}. | 863 | specification. @xref{Defining Commands}. |
| 858 | 864 | ||
| 859 | @defun read-buffer prompt &optional default existing | 865 | @defun read-buffer prompt &optional default existing |
| 860 | This function reads the name of a buffer and returns it as a string. | 866 | This function reads the name of a buffer and returns it as a string. |
| @@ -1412,8 +1418,8 @@ The return value of @code{map-y-or-n-p} is the number of objects acted on. | |||
| 1412 | 1418 | ||
| 1413 | This function is useful for reading passwords. | 1419 | This function is useful for reading passwords. |
| 1414 | 1420 | ||
| 1415 | @tindex read-password | ||
| 1416 | @defun read-password prompt default | 1421 | @defun read-password prompt default |
| 1422 | @tindex read-password | ||
| 1417 | This function reads a password, echoing @samp{.} in the echo area | 1423 | This function reads a password, echoing @samp{.} in the echo area |
| 1418 | for each character entered, and returns it as a string. It prompts | 1424 | for each character entered, and returns it as a string. It prompts |
| 1419 | with @var{prompt}, and returns @var{default} if the user enters the | 1425 | with @var{prompt}, and returns @var{default} if the user enters the |
diff --git a/lispref/modes.texi b/lispref/modes.texi index dbdefb5a2d3..dfbdfee00c6 100644 --- a/lispref/modes.texi +++ b/lispref/modes.texi | |||
| @@ -305,7 +305,7 @@ the conventions listed above: | |||
| 305 | (if text-mode-map | 305 | (if text-mode-map |
| 306 | () ; @r{Do not change the keymap if it is already set up.} | 306 | () ; @r{Do not change the keymap if it is already set up.} |
| 307 | (setq text-mode-map (make-sparse-keymap)) | 307 | (setq text-mode-map (make-sparse-keymap)) |
| 308 | (define-key text-mode-map "\t" 'tab-to-tab-stop) | 308 | (define-key text-mode-map "\t" 'indent-relative) |
| 309 | (define-key text-mode-map "\es" 'center-line) | 309 | (define-key text-mode-map "\es" 'center-line) |
| 310 | (define-key text-mode-map "\eS" 'center-paragraph)) | 310 | (define-key text-mode-map "\eS" 'center-paragraph)) |
| 311 | @end group | 311 | @end group |
| @@ -399,7 +399,7 @@ mode functions: | |||
| 399 | (cond (lisp-syntax | 399 | (cond (lisp-syntax |
| 400 | (set-syntax-table lisp-mode-syntax-table))) | 400 | (set-syntax-table lisp-mode-syntax-table))) |
| 401 | (setq local-abbrev-table lisp-mode-abbrev-table) | 401 | (setq local-abbrev-table lisp-mode-abbrev-table) |
| 402 | @dots{}) | 402 | @dots{} |
| 403 | @end group | 403 | @end group |
| 404 | @end smallexample | 404 | @end smallexample |
| 405 | 405 | ||
| @@ -915,8 +915,8 @@ characters are reserved for major modes.) | |||
| 915 | minor mode; with it, you can specify all about a simple minor mode in | 915 | minor mode; with it, you can specify all about a simple minor mode in |
| 916 | one self-contained definition. | 916 | one self-contained definition. |
| 917 | 917 | ||
| 918 | @tindex easy-mmode-define-minor-mode | ||
| 919 | @defmac easy-mmode-define-minor-mode mode doc &optional init-value mode-indicator keymap | 918 | @defmac easy-mmode-define-minor-mode mode doc &optional init-value mode-indicator keymap |
| 919 | @tindex easy-mmode-define-minor-mode | ||
| 920 | This macro defines a new minor mode whose name is @var{mode} (a symbol). | 920 | This macro defines a new minor mode whose name is @var{mode} (a symbol). |
| 921 | 921 | ||
| 922 | This macro defines a command named @var{mode} which toggles the minor | 922 | This macro defines a command named @var{mode} which toggles the minor |
| @@ -1144,12 +1144,11 @@ line. There is nothing inherently special about these variables; any | |||
| 1144 | other variables could have the same effects on the mode line if | 1144 | other variables could have the same effects on the mode line if |
| 1145 | @code{mode-line-format} were changed to use them. | 1145 | @code{mode-line-format} were changed to use them. |
| 1146 | 1146 | ||
| 1147 | @tindex mode-line-mule-info | ||
| 1148 | @defvar mode-line-mule-info | 1147 | @defvar mode-line-mule-info |
| 1148 | @tindex mode-line-mule-info | ||
| 1149 | This variable holds the value of the mode-line construct that displays | 1149 | This variable holds the value of the mode-line construct that displays |
| 1150 | information about the language environment, buffer coding system, and | 1150 | information about the language environment, buffer coding system, and |
| 1151 | current input method. @xref{International,,, emacs, The GNU Emacs | 1151 | current input method. @xref{Non-ASCII Characters}. |
| 1152 | Manual}. | ||
| 1153 | @end defvar | 1152 | @end defvar |
| 1154 | 1153 | ||
| 1155 | @defvar mode-line-modified | 1154 | @defvar mode-line-modified |
| @@ -1165,8 +1164,8 @@ modified. | |||
| 1165 | Changing this variable does not force an update of the mode line. | 1164 | Changing this variable does not force an update of the mode line. |
| 1166 | @end defvar | 1165 | @end defvar |
| 1167 | 1166 | ||
| 1168 | @tindex mode-line-frame-identification | ||
| 1169 | @defvar mode-line-frame-identification | 1167 | @defvar mode-line-frame-identification |
| 1168 | @tindex mode-line-frame-identification | ||
| 1170 | This variable identifies the current frame. The default value is | 1169 | This variable identifies the current frame. The default value is |
| 1171 | @code{" "} if you are using a window system which can show multiple | 1170 | @code{" "} if you are using a window system which can show multiple |
| 1172 | frames, or @code{"-%F "} on an ordinary terminal which shows only one | 1171 | frames, or @code{"-%F "} on an ordinary terminal which shows only one |
| @@ -1426,6 +1425,7 @@ selected by the user, calls @var{function} with arguments | |||
| 1426 | 1425 | ||
| 1427 | For Emacs Lisp mode, @var{pattern} could look like this: | 1426 | For Emacs Lisp mode, @var{pattern} could look like this: |
| 1428 | 1427 | ||
| 1428 | @c should probably use imenu-syntax-alist and \\sw rather than [-A-Za-z0-9+] | ||
| 1429 | @example | 1429 | @example |
| 1430 | @group | 1430 | @group |
| 1431 | ((nil "^\\s-*(def\\(un\\|subst\\|macro\\|advice\\)\ | 1431 | ((nil "^\\s-*(def\\(un\\|subst\\|macro\\|advice\\)\ |
| @@ -1437,7 +1437,8 @@ For Emacs Lisp mode, @var{pattern} could look like this: | |||
| 1437 | @end group | 1437 | @end group |
| 1438 | @group | 1438 | @group |
| 1439 | ("*Types*" | 1439 | ("*Types*" |
| 1440 | "^\\s-*(def\\(type\\|struct\\|class\\|ine-condition\\)\ | 1440 | "^\\s-*\ |
| 1441 | (def\\(type\\|struct\\|class\\|ine-condition\\)\ | ||
| 1441 | \\s-+\\([-A-Za-z0-9+]+\\)" 2)) | 1442 | \\s-+\\([-A-Za-z0-9+]+\\)" 2)) |
| 1442 | @end group | 1443 | @end group |
| 1443 | @end example | 1444 | @end example |
| @@ -1446,9 +1447,40 @@ Setting this variable makes it buffer-local in the current buffer. | |||
| 1446 | @end defvar | 1447 | @end defvar |
| 1447 | 1448 | ||
| 1448 | @defvar imenu-case-fold-search | 1449 | @defvar imenu-case-fold-search |
| 1449 | This variable controls whether the regular expression matching for Imenu | 1450 | This variable controls whether matching against |
| 1450 | is case-sensitive: @code{t}, the default, means matching should ignore | 1451 | @var{imenu-generic-expression} is case-sensitive: @code{t}, the default, |
| 1451 | case. | 1452 | means matching should ignore case. |
| 1453 | |||
| 1454 | Setting this variable makes it buffer-local in the current buffer. | ||
| 1455 | @end defvar | ||
| 1456 | |||
| 1457 | @defvar imenu-syntax-alist | ||
| 1458 | This variable is an alist of syntax table modifiers to use while | ||
| 1459 | executing @code{imenu--generic-function} to override the syntax table of | ||
| 1460 | the current buffer. Each element should have this form: | ||
| 1461 | |||
| 1462 | @example | ||
| 1463 | (@var{characters} . @var{syntax-description}) | ||
| 1464 | @end example | ||
| 1465 | |||
| 1466 | The @sc{car}, @var{characters}, can be either a character or a string. | ||
| 1467 | The element says to give that character or characters the syntax | ||
| 1468 | specified by @var{syntax-description}, which is passed to | ||
| 1469 | @code{modify-syntax-entry} (@pxref{Syntax Table Functions}). | ||
| 1470 | |||
| 1471 | This feature is typically used to give word syntax to characters which | ||
| 1472 | normally have symbol syntax, and thus to simplify | ||
| 1473 | @code{imenu-generic-expression} and speed up matching. | ||
| 1474 | For example, Fortran mode uses it this way: | ||
| 1475 | |||
| 1476 | @example | ||
| 1477 | (setq imenu-syntax-alist '(("_$" . "w"))) | ||
| 1478 | @end example | ||
| 1479 | |||
| 1480 | The @code{imenu-generic-expression} patterns can then use @samp{\\sw+} | ||
| 1481 | instead of @samp{\\(\\sw\\|\\s_\\)\\}. Note that this technique may be | ||
| 1482 | inconvenient to use when the mode needs to limit the initial character | ||
| 1483 | of a name to a smaller set of characters | ||
| 1452 | 1484 | ||
| 1453 | Setting this variable makes it buffer-local in the current buffer. | 1485 | Setting this variable makes it buffer-local in the current buffer. |
| 1454 | @end defvar | 1486 | @end defvar |
| @@ -1568,7 +1600,7 @@ first symbol specifies how to do level 1 fontification, the second | |||
| 1568 | symbol how to do level 2, and so on. | 1600 | symbol how to do level 2, and so on. |
| 1569 | 1601 | ||
| 1570 | The second element, @var{keywords-only}, specifies the value of the | 1602 | The second element, @var{keywords-only}, specifies the value of the |
| 1571 | variable @code{font-lock-keywords-only}. If this is is non-@code{nil}, | 1603 | variable @code{font-lock-keywords-only}. If this is non-@code{nil}, |
| 1572 | syntactic fontification (of strings and comments) is not performed. | 1604 | syntactic fontification (of strings and comments) is not performed. |
| 1573 | 1605 | ||
| 1574 | The third element, @var{case-fold}, specifies the value of | 1606 | The third element, @var{case-fold}, specifies the value of |
| @@ -1731,7 +1763,7 @@ where @var{submatcher} is much like @var{matcher}, with one | |||
| 1731 | exception---see below. @var{pre-match-form} and @var{post-match-form} | 1763 | exception---see below. @var{pre-match-form} and @var{post-match-form} |
| 1732 | are evaluated before the first, and after the last, instance | 1764 | are evaluated before the first, and after the last, instance |
| 1733 | @var{anchored}'s @var{submatcher} is used. Therefore they can be used | 1765 | @var{anchored}'s @var{submatcher} is used. Therefore they can be used |
| 1734 | to initialise before, and cleanup after, @var{submatcher} is used. | 1766 | to initialize before, and cleanup after, @var{submatcher} is used. |
| 1735 | Typically, @var{pre-match-form} is used to move to some position | 1767 | Typically, @var{pre-match-form} is used to move to some position |
| 1736 | relative to the original @var{submatcher}, before starting with | 1768 | relative to the original @var{submatcher}, before starting with |
| 1737 | @var{anchored}'s @var{submatcher}. @var{post-match-form} might be used | 1769 | @var{anchored}'s @var{submatcher}. @var{post-match-form} might be used |
| @@ -1787,7 +1819,7 @@ syntactically; it should only fontify based on | |||
| 1787 | @end defvar | 1819 | @end defvar |
| 1788 | 1820 | ||
| 1789 | @ignore | 1821 | @ignore |
| 1790 | Other variables include those for buffer-specialised fontification functions, | 1822 | Other variables include those for buffer-specialized fontification functions, |
| 1791 | `font-lock-fontify-buffer-function', `font-lock-unfontify-buffer-function', | 1823 | `font-lock-fontify-buffer-function', `font-lock-unfontify-buffer-function', |
| 1792 | `font-lock-fontify-region-function', `font-lock-unfontify-region-function', | 1824 | `font-lock-fontify-region-function', `font-lock-unfontify-region-function', |
| 1793 | `font-lock-inhibit-thing-lock' and `font-lock-maximum-size'. | 1825 | `font-lock-inhibit-thing-lock' and `font-lock-maximum-size'. |
| @@ -2039,6 +2071,27 @@ For example, here's how @code{emacs-lisp-mode} runs its mode hook: | |||
| 2039 | @end example | 2071 | @end example |
| 2040 | @end defun | 2072 | @end defun |
| 2041 | 2073 | ||
| 2074 | @defun run-hook-with-args hook &rest args | ||
| 2075 | This function is the way to run an abnormal hook which passes arguments | ||
| 2076 | to the hook functions. It calls each of the hook functions, passing | ||
| 2077 | each of them the arguments @var{args}. | ||
| 2078 | @end defun | ||
| 2079 | |||
| 2080 | @defun run-hook-with-args-until-failure hook &rest args | ||
| 2081 | This function is the way to run an abnormal hook which passes arguments | ||
| 2082 | to the hook functions, and stops as soon as any hook function fails. It | ||
| 2083 | calls each of the hook functions, passing each of them the arguments | ||
| 2084 | @var{args}, until some hook function returns @code{nil}. Then it stops. | ||
| 2085 | @end defun | ||
| 2086 | |||
| 2087 | @defun run-hook-with-args-until-success hook &rest args | ||
| 2088 | This function is the way to run an abnormal hook which passes arguments | ||
| 2089 | to the hook functions, and stops as soon as any hook function succeeds. | ||
| 2090 | It calls each of the hook functions, passing each of them the arguments | ||
| 2091 | @var{args}, until some hook function returns non-@code{nil}. Then it | ||
| 2092 | stops. | ||
| 2093 | @end defun | ||
| 2094 | |||
| 2042 | @defun add-hook hook function &optional append local | 2095 | @defun add-hook hook function &optional append local |
| 2043 | This function is the handy way to add function @var{function} to hook | 2096 | This function is the handy way to add function @var{function} to hook |
| 2044 | variable @var{hook}. The argument @var{function} may be any valid Lisp | 2097 | variable @var{hook}. The argument @var{function} may be any valid Lisp |
diff --git a/lispref/nonascii.texi b/lispref/nonascii.texi index f75900d6818..ac7c9ed9c43 100644 --- a/lispref/nonascii.texi +++ b/lispref/nonascii.texi | |||
| @@ -17,15 +17,12 @@ characters and how they are stored in strings and buffers. | |||
| 17 | * Selecting a Representation:: | 17 | * Selecting a Representation:: |
| 18 | * Character Codes:: | 18 | * Character Codes:: |
| 19 | * Character Sets:: | 19 | * Character Sets:: |
| 20 | * Scanning Charsets:: | ||
| 21 | * Chars and Bytes:: | 20 | * Chars and Bytes:: |
| 21 | * Splitting Characters:: | ||
| 22 | * Scanning Charsets:: | ||
| 23 | * Translation of Characters:: | ||
| 22 | * Coding Systems:: | 24 | * Coding Systems:: |
| 23 | * Lisp and Coding System:: | 25 | * Input Methods:: |
| 24 | * Default Coding Systems:: | ||
| 25 | * Specifying Coding Systems:: | ||
| 26 | * Explicit Encoding:: | ||
| 27 | * MS-DOS File Types:: | ||
| 28 | * MS-DOS Subprocesses:: | ||
| 29 | @end menu | 26 | @end menu |
| 30 | 27 | ||
| 31 | @node Text Representations | 28 | @node Text Representations |
| @@ -53,19 +50,17 @@ character set by setting the variable @code{nonascii-insert-offset}). | |||
| 53 | byte, and as a result, the full range of Emacs character codes can be | 50 | byte, and as a result, the full range of Emacs character codes can be |
| 54 | stored. The first byte of a multibyte character is always in the range | 51 | stored. The first byte of a multibyte character is always in the range |
| 55 | 128 through 159 (octal 0200 through 0237). These values are called | 52 | 128 through 159 (octal 0200 through 0237). These values are called |
| 56 | @dfn{leading codes}. The first byte determines which character set the | 53 | @dfn{leading codes}. The second and subsequent bytes of a multibyte |
| 57 | character belongs to (@pxref{Character Sets}); in particular, it | 54 | character are always in the range 160 through 255 (octal 0240 through |
| 58 | determines how many bytes long the sequence is. The second and | 55 | 0377). |
| 59 | subsequent bytes of a multibyte character are always in the range 160 | ||
| 60 | through 255 (octal 0240 through 0377). | ||
| 61 | 56 | ||
| 62 | In a buffer, the buffer-local value of the variable | 57 | In a buffer, the buffer-local value of the variable |
| 63 | @code{enable-multibyte-characters} specifies the representation used. | 58 | @code{enable-multibyte-characters} specifies the representation used. |
| 64 | The representation for a string is determined based on the string | 59 | The representation for a string is determined based on the string |
| 65 | contents when the string is constructed. | 60 | contents when the string is constructed. |
| 66 | 61 | ||
| 67 | @tindex enable-multibyte-characters | ||
| 68 | @defvar enable-multibyte-characters | 62 | @defvar enable-multibyte-characters |
| 63 | @tindex enable-multibyte-characters | ||
| 69 | This variable specifies the current buffer's text representation. | 64 | This variable specifies the current buffer's text representation. |
| 70 | If it is non-@code{nil}, the buffer contains multibyte text; otherwise, | 65 | If it is non-@code{nil}, the buffer contains multibyte text; otherwise, |
| 71 | it contains unibyte text. | 66 | it contains unibyte text. |
| @@ -74,20 +69,21 @@ You cannot set this variable directly; instead, use the function | |||
| 74 | @code{set-buffer-multibyte} to change a buffer's representation. | 69 | @code{set-buffer-multibyte} to change a buffer's representation. |
| 75 | @end defvar | 70 | @end defvar |
| 76 | 71 | ||
| 77 | @tindex default-enable-multibyte-characters | ||
| 78 | @defvar default-enable-multibyte-characters | 72 | @defvar default-enable-multibyte-characters |
| 79 | This variable`s value is entirely equivalent to @code{(default-value | 73 | @tindex default-enable-multibyte-characters |
| 74 | This variable's value is entirely equivalent to @code{(default-value | ||
| 80 | 'enable-multibyte-characters)}, and setting this variable changes that | 75 | 'enable-multibyte-characters)}, and setting this variable changes that |
| 81 | default value. Although setting the local binding of | 76 | default value. Setting the local binding of |
| 82 | @code{enable-multibyte-characters} in a specific buffer is dangerous, | 77 | @code{enable-multibyte-characters} in a specific buffer is not allowed, |
| 83 | changing the default value is safe, and it is a reasonable thing to do. | 78 | but changing the default value is supported, and it is a reasonable |
| 79 | thing to do, because it has no effect on existing buffers. | ||
| 84 | 80 | ||
| 85 | The @samp{--unibyte} command line option does its job by setting the | 81 | The @samp{--unibyte} command line option does its job by setting the |
| 86 | default value to @code{nil} early in startup. | 82 | default value to @code{nil} early in startup. |
| 87 | @end defvar | 83 | @end defvar |
| 88 | 84 | ||
| 89 | @tindex multibyte-string-p | ||
| 90 | @defun multibyte-string-p string | 85 | @defun multibyte-string-p string |
| 86 | @tindex multibyte-string-p | ||
| 91 | Return @code{t} if @var{string} contains multibyte characters. | 87 | Return @code{t} if @var{string} contains multibyte characters. |
| 92 | @end defun | 88 | @end defun |
| 93 | 89 | ||
| @@ -120,11 +116,12 @@ user that cannot be overridden automatically. | |||
| 120 | unchanged, and likewise 128 through 159. It converts the non-@sc{ASCII} | 116 | unchanged, and likewise 128 through 159. It converts the non-@sc{ASCII} |
| 121 | codes 160 through 255 by adding the value @code{nonascii-insert-offset} | 117 | codes 160 through 255 by adding the value @code{nonascii-insert-offset} |
| 122 | to each character code. By setting this variable, you specify which | 118 | to each character code. By setting this variable, you specify which |
| 123 | character set the unibyte characters correspond to. For example, if | 119 | character set the unibyte characters correspond to (@pxref{Character |
| 124 | @code{nonascii-insert-offset} is 2048, which is @code{(- (make-char | 120 | Sets}). For example, if @code{nonascii-insert-offset} is 2048, which is |
| 125 | 'latin-iso8859-1 0) 128)}, then the unibyte non-@sc{ASCII} characters | 121 | @code{(- (make-char 'latin-iso8859-1) 128)}, then the unibyte |
| 126 | correspond to Latin 1. If it is 2688, which is @code{(- (make-char | 122 | non-@sc{ASCII} characters correspond to Latin 1. If it is 2688, which |
| 127 | 'greek-iso8859-7 0) 128)}, then they correspond to Greek letters. | 123 | is @code{(- (make-char 'greek-iso8859-7) 128)}, then they correspond to |
| 124 | Greek letters. | ||
| 128 | 125 | ||
| 129 | Converting multibyte text to unibyte is simpler: it performs | 126 | Converting multibyte text to unibyte is simpler: it performs |
| 130 | logical-and of each character code with 255. If | 127 | logical-and of each character code with 255. If |
| @@ -133,21 +130,22 @@ the beginning of some character set, this conversion is the inverse of | |||
| 133 | the other: converting unibyte text to multibyte and back to unibyte | 130 | the other: converting unibyte text to multibyte and back to unibyte |
| 134 | reproduces the original unibyte text. | 131 | reproduces the original unibyte text. |
| 135 | 132 | ||
| 136 | @tindex nonascii-insert-offset | ||
| 137 | @defvar nonascii-insert-offset | 133 | @defvar nonascii-insert-offset |
| 134 | @tindex nonascii-insert-offset | ||
| 138 | This variable specifies the amount to add to a non-@sc{ASCII} character | 135 | This variable specifies the amount to add to a non-@sc{ASCII} character |
| 139 | when converting unibyte text to multibyte. It also applies when | 136 | when converting unibyte text to multibyte. It also applies when |
| 140 | @code{insert-char} or @code{self-insert-command} inserts a character in | 137 | @code{self-insert-command} inserts a character in the unibyte |
| 141 | the unibyte non-@sc{ASCII} range, 128 through 255. | 138 | non-@sc{ASCII} range, 128 through 255. However, the function |
| 139 | @code{insert-char} does not perform this conversion. | ||
| 142 | 140 | ||
| 143 | The right value to use to select character set @var{cs} is @code{(- | 141 | The right value to use to select character set @var{cs} is @code{(- |
| 144 | (make-char @var{cs} 0) 128)}. If the value of | 142 | (make-char @var{cs}) 128)}. If the value of |
| 145 | @code{nonascii-insert-offset} is zero, then conversion actually uses the | 143 | @code{nonascii-insert-offset} is zero, then conversion actually uses the |
| 146 | value for the Latin 1 character set, rather than zero. | 144 | value for the Latin 1 character set, rather than zero. |
| 147 | @end defvar | 145 | @end defvar |
| 148 | 146 | ||
| 149 | @tindex nonascii-translate-table | 147 | @defvar nonascii-translation-table |
| 150 | @defvar nonascii-translate-table | 148 | @tindex nonascii-translation-table |
| 151 | This variable provides a more general alternative to | 149 | This variable provides a more general alternative to |
| 152 | @code{nonascii-insert-offset}. You can use it to specify independently | 150 | @code{nonascii-insert-offset}. You can use it to specify independently |
| 153 | how to translate each code in the range of 128 through 255 into a | 151 | how to translate each code in the range of 128 through 255 into a |
| @@ -155,15 +153,15 @@ multibyte character. The value should be a vector, or @code{nil}. | |||
| 155 | If this is non-@code{nil}, it overrides @code{nonascii-insert-offset}. | 153 | If this is non-@code{nil}, it overrides @code{nonascii-insert-offset}. |
| 156 | @end defvar | 154 | @end defvar |
| 157 | 155 | ||
| 158 | @tindex string-make-unibyte | ||
| 159 | @defun string-make-unibyte string | 156 | @defun string-make-unibyte string |
| 157 | @tindex string-make-unibyte | ||
| 160 | This function converts the text of @var{string} to unibyte | 158 | This function converts the text of @var{string} to unibyte |
| 161 | representation, if it isn't already, and return the result. If | 159 | representation, if it isn't already, and return the result. If |
| 162 | @var{string} is a unibyte string, it is returned unchanged. | 160 | @var{string} is a unibyte string, it is returned unchanged. |
| 163 | @end defun | 161 | @end defun |
| 164 | 162 | ||
| 165 | @tindex string-make-multibyte | ||
| 166 | @defun string-make-multibyte string | 163 | @defun string-make-multibyte string |
| 164 | @tindex string-make-multibyte | ||
| 167 | This function converts the text of @var{string} to multibyte | 165 | This function converts the text of @var{string} to multibyte |
| 168 | representation, if it isn't already, and return the result. If | 166 | representation, if it isn't already, and return the result. If |
| 169 | @var{string} is a multibyte string, it is returned unchanged. | 167 | @var{string} is a multibyte string, it is returned unchanged. |
| @@ -175,8 +173,8 @@ representation, if it isn't already, and return the result. If | |||
| 175 | Sometimes it is useful to examine an existing buffer or string as | 173 | Sometimes it is useful to examine an existing buffer or string as |
| 176 | multibyte when it was unibyte, or vice versa. | 174 | multibyte when it was unibyte, or vice versa. |
| 177 | 175 | ||
| 178 | @tindex set-buffer-multibyte | ||
| 179 | @defun set-buffer-multibyte multibyte | 176 | @defun set-buffer-multibyte multibyte |
| 177 | @tindex set-buffer-multibyte | ||
| 180 | Set the representation type of the current buffer. If @var{multibyte} | 178 | Set the representation type of the current buffer. If @var{multibyte} |
| 181 | is non-@code{nil}, the buffer becomes multibyte. If @var{multibyte} | 179 | is non-@code{nil}, the buffer becomes multibyte. If @var{multibyte} |
| 182 | is @code{nil}, the buffer becomes unibyte. | 180 | is @code{nil}, the buffer becomes unibyte. |
| @@ -193,8 +191,8 @@ representation is in use. It also adjusts various data in the buffer | |||
| 193 | same text as they did before. | 191 | same text as they did before. |
| 194 | @end defun | 192 | @end defun |
| 195 | 193 | ||
| 196 | @tindex string-as-unibyte | ||
| 197 | @defun string-as-unibyte string | 194 | @defun string-as-unibyte string |
| 195 | @tindex string-as-unibyte | ||
| 198 | This function returns a string with the same bytes as @var{string} but | 196 | This function returns a string with the same bytes as @var{string} but |
| 199 | treating each byte as a character. This means that the value may have | 197 | treating each byte as a character. This means that the value may have |
| 200 | more characters than @var{string} has. | 198 | more characters than @var{string} has. |
| @@ -203,8 +201,8 @@ If @var{string} is unibyte already, then the value is @var{string} | |||
| 203 | itself. | 201 | itself. |
| 204 | @end defun | 202 | @end defun |
| 205 | 203 | ||
| 206 | @tindex string-as-multibyte | ||
| 207 | @defun string-as-multibyte string | 204 | @defun string-as-multibyte string |
| 205 | @tindex string-as-multibyte | ||
| 208 | This function returns a string with the same bytes as @var{string} but | 206 | This function returns a string with the same bytes as @var{string} but |
| 209 | treating each multibyte sequence as one character. This means that the | 207 | treating each multibyte sequence as one character. This means that the |
| 210 | value may have fewer characters than @var{string} has. | 208 | value may have fewer characters than @var{string} has. |
| @@ -253,88 +251,93 @@ example, @code{latin-iso8859-1} is one character set, | |||
| 253 | @code{greek-iso8859-7} is another, and @code{ascii} is another. An | 251 | @code{greek-iso8859-7} is another, and @code{ascii} is another. An |
| 254 | Emacs character set can hold at most 9025 characters; therefore, in some | 252 | Emacs character set can hold at most 9025 characters; therefore, in some |
| 255 | cases, characters that would logically be grouped together are split | 253 | cases, characters that would logically be grouped together are split |
| 256 | into several character sets. For example, one set of Chinese characters | 254 | into several character sets. For example, one set of Chinese |
| 257 | is divided into eight Emacs character sets, @code{chinese-cns11643-1} | 255 | characters, generally known as Big 5, is divided into two Emacs |
| 258 | through @code{chinese-cns11643-7}. | 256 | character sets, @code{chinese-big5-1} and @code{chinese-big5-2}. |
| 259 | 257 | ||
| 260 | @tindex charsetp | ||
| 261 | @defun charsetp object | 258 | @defun charsetp object |
| 259 | @tindex charsetp | ||
| 262 | Return @code{t} if @var{object} is a character set name symbol, | 260 | Return @code{t} if @var{object} is a character set name symbol, |
| 263 | @code{nil} otherwise. | 261 | @code{nil} otherwise. |
| 264 | @end defun | 262 | @end defun |
| 265 | 263 | ||
| 266 | @tindex charset-list | ||
| 267 | @defun charset-list | 264 | @defun charset-list |
| 265 | @tindex charset-list | ||
| 268 | This function returns a list of all defined character set names. | 266 | This function returns a list of all defined character set names. |
| 269 | @end defun | 267 | @end defun |
| 270 | 268 | ||
| 271 | @tindex char-charset | ||
| 272 | @defun char-charset character | 269 | @defun char-charset character |
| 273 | This function returns the the name of the character | 270 | @tindex char-charset |
| 271 | This function returns the name of the character | ||
| 274 | set that @var{character} belongs to. | 272 | set that @var{character} belongs to. |
| 275 | @end defun | 273 | @end defun |
| 276 | 274 | ||
| 277 | @node Scanning Charsets | ||
| 278 | @section Scanning for Character Sets | ||
| 279 | |||
| 280 | Sometimes it is useful to find out which character sets appear in a | ||
| 281 | part of a buffer or a string. One use for this is in determining which | ||
| 282 | coding systems (@pxref{Coding Systems}) are capable of representing all | ||
| 283 | of the text in question. | ||
| 284 | |||
| 285 | @tindex find-charset-region | ||
| 286 | @defun find-charset-region beg end &optional unification | ||
| 287 | This function returns a list of the character sets | ||
| 288 | that appear in the current buffer between positions @var{beg} | ||
| 289 | and @var{end}. | ||
| 290 | @end defun | ||
| 291 | |||
| 292 | @tindex find-charset-string | ||
| 293 | @defun find-charset-string string &optional unification | ||
| 294 | This function returns a list of the character sets | ||
| 295 | that appear in the string @var{string}. | ||
| 296 | @end defun | ||
| 297 | |||
| 298 | @node Chars and Bytes | 275 | @node Chars and Bytes |
| 299 | @section Characters and Bytes | 276 | @section Characters and Bytes |
| 300 | @cindex bytes and characters | 277 | @cindex bytes and characters |
| 301 | 278 | ||
| 279 | @cindex introduction sequence | ||
| 280 | @cindex dimension (of character set) | ||
| 302 | In multibyte representation, each character occupies one or more | 281 | In multibyte representation, each character occupies one or more |
| 303 | bytes. The functions in this section convert between characters and the | 282 | bytes. Each character set has an @dfn{introduction sequence}, which is |
| 304 | byte values used to represent them. For most purposes, there is no need | 283 | one or two bytes long. The introduction sequence is the beginning of |
| 305 | to be concerned with the number of bytes used to represent a character | 284 | the byte sequence for any character in the character set. (The |
| 285 | @sc{ASCII} character set has a zero-length introduction sequence.) The | ||
| 286 | rest of the character's bytes distinguish it from the other characters | ||
| 287 | in the same character set. Depending on the character set, there are | ||
| 288 | either one or two distinguishing bytes; the number of such bytes is | ||
| 289 | called the @dfn{dimension} of the character set. | ||
| 290 | |||
| 291 | @defun charset-dimension charset | ||
| 292 | @tindex charset-dimension | ||
| 293 | This function returns the dimension of @var{charset}; | ||
| 294 | At present, the dimension is always 1 or 2. | ||
| 295 | @end defun | ||
| 296 | |||
| 297 | This is the simplest way to determine the byte length of a character | ||
| 298 | set's introduction sequence: | ||
| 299 | |||
| 300 | @example | ||
| 301 | (- (char-bytes (make-char @var{charset})) | ||
| 302 | (charset-dimension @var{charset})) | ||
| 303 | @end example | ||
| 304 | |||
| 305 | @node Splitting Characters | ||
| 306 | @section Splitting Characters | ||
| 307 | |||
| 308 | The functions in this section convert between characters and the byte | ||
| 309 | values used to represent them. For most purposes, there is no need to | ||
| 310 | be concerned with the sequence of bytes used to represent a character, | ||
| 306 | because Emacs translates automatically when necessary. | 311 | because Emacs translates automatically when necessary. |
| 307 | 312 | ||
| 308 | @tindex char-bytes | ||
| 309 | @defun char-bytes character | 313 | @defun char-bytes character |
| 314 | @tindex char-bytes | ||
| 310 | This function returns the number of bytes used to represent the | 315 | This function returns the number of bytes used to represent the |
| 311 | character @var{character}. In most cases, this is the same as | 316 | character @var{character}. This depends only on the character set that |
| 312 | @code{(length (split-char @var{character}))}; the only exception is for | 317 | @var{character} belongs to; it equals the dimension of that character |
| 313 | ASCII characters and the codes used in unibyte text, which use just one | 318 | set (@pxref{Character Sets}), plus the length of its introduction |
| 314 | byte. | 319 | sequence. |
| 315 | 320 | ||
| 316 | @example | 321 | @example |
| 317 | (char-bytes 2248) | 322 | (char-bytes 2248) |
| 318 | @result{} 2 | 323 | @result{} 2 |
| 319 | (char-bytes 65) | 324 | (char-bytes 65) |
| 320 | @result{} 1 | 325 | @result{} 1 |
| 321 | @end example | ||
| 322 | |||
| 323 | This function's values are correct for both multibyte and unibyte | ||
| 324 | representations, because the non-@sc{ASCII} character codes used in | ||
| 325 | those two representations do not overlap. | ||
| 326 | |||
| 327 | @example | ||
| 328 | (char-bytes 192) | 326 | (char-bytes 192) |
| 329 | @result{} 1 | 327 | @result{} 1 |
| 330 | @end example | 328 | @end example |
| 329 | |||
| 330 | The reason this function can give correct results for both multibyte and | ||
| 331 | unibyte representations is that the non-@sc{ASCII} character codes used | ||
| 332 | in those two representations do not overlap. | ||
| 331 | @end defun | 333 | @end defun |
| 332 | 334 | ||
| 333 | @tindex split-char | ||
| 334 | @defun split-char character | 335 | @defun split-char character |
| 336 | @tindex split-char | ||
| 335 | Return a list containing the name of the character set of | 337 | Return a list containing the name of the character set of |
| 336 | @var{character}, followed by one or two byte-values which identify | 338 | @var{character}, followed by one or two byte values (integers) which |
| 337 | @var{character} within that character set. | 339 | identify @var{character} within that character set. The number of byte |
| 340 | values is the character set's dimension. | ||
| 338 | 341 | ||
| 339 | @example | 342 | @example |
| 340 | (split-char 2248) | 343 | (split-char 2248) |
| @@ -352,11 +355,13 @@ the @code{ascii} character set: | |||
| 352 | @end example | 355 | @end example |
| 353 | @end defun | 356 | @end defun |
| 354 | 357 | ||
| 355 | @tindex make-char | ||
| 356 | @defun make-char charset &rest byte-values | 358 | @defun make-char charset &rest byte-values |
| 357 | Thus function returns the character in character set @var{charset} | 359 | @tindex make-char |
| 358 | identified by @var{byte-values}. This is roughly the opposite of | 360 | This function returns the character in character set @var{charset} |
| 359 | split-char. | 361 | identified by @var{byte-values}. This is roughly the inverse of |
| 362 | @code{split-char}. Normally, you should specify either one or two | ||
| 363 | @var{byte-values}, according to the dimension of @var{charset}. For | ||
| 364 | example, | ||
| 360 | 365 | ||
| 361 | @example | 366 | @example |
| 362 | (make-char 'latin-iso8859-1 72) | 367 | (make-char 'latin-iso8859-1 72) |
| @@ -364,6 +369,105 @@ split-char. | |||
| 364 | @end example | 369 | @end example |
| 365 | @end defun | 370 | @end defun |
| 366 | 371 | ||
| 372 | @cindex generic characters | ||
| 373 | If you call @code{make-char} with no @var{byte-values}, the result is | ||
| 374 | a @dfn{generic character} which stands for @var{charset}. A generic | ||
| 375 | character is an integer, but it is @emph{not} valid for insertion in the | ||
| 376 | buffer as a character. It can be used in @code{char-table-range} to | ||
| 377 | refer to the whole character set (@pxref{Char-Tables}). | ||
| 378 | @code{char-valid-p} returns @code{nil} for generic characters. | ||
| 379 | For example: | ||
| 380 | |||
| 381 | @example | ||
| 382 | (make-char 'latin-iso8859-1) | ||
| 383 | @result{} 2176 | ||
| 384 | (char-valid-p 2176) | ||
| 385 | @result{} nil | ||
| 386 | (split-char 2176) | ||
| 387 | @result{} (latin-iso8859-1 0) | ||
| 388 | @end example | ||
| 389 | |||
| 390 | @node Scanning Charsets | ||
| 391 | @section Scanning for Character Sets | ||
| 392 | |||
| 393 | Sometimes it is useful to find out which character sets appear in a | ||
| 394 | part of a buffer or a string. One use for this is in determining which | ||
| 395 | coding systems (@pxref{Coding Systems}) are capable of representing all | ||
| 396 | of the text in question. | ||
| 397 | |||
| 398 | @defun find-charset-region beg end &optional translation | ||
| 399 | @tindex find-charset-region | ||
| 400 | This function returns a list of the character sets that appear in the | ||
| 401 | current buffer between positions @var{beg} and @var{end}. | ||
| 402 | |||
| 403 | The optional argument @var{translation} specifies a translation table to | ||
| 404 | be used in scanning the text (@pxref{Translation of Characters}). If it | ||
| 405 | is non-@code{nil}, then each character in the region is translated | ||
| 406 | through this table, and the value returned describes the translated | ||
| 407 | characters instead of the characters actually in the buffer. | ||
| 408 | @end defun | ||
| 409 | |||
| 410 | @defun find-charset-string string &optional translation | ||
| 411 | @tindex find-charset-string | ||
| 412 | This function returns a list of the character sets | ||
| 413 | that appear in the string @var{string}. | ||
| 414 | |||
| 415 | The optional argument @var{translation} specifies a | ||
| 416 | translation table; see @code{find-charset-region}, above. | ||
| 417 | @end defun | ||
| 418 | |||
| 419 | @node Translation of Characters | ||
| 420 | @section Translation of Characters | ||
| 421 | @cindex character translation tables | ||
| 422 | @cindex translation tables | ||
| 423 | |||
| 424 | A @dfn{translation table} specifies a mapping of characters | ||
| 425 | into characters. These tables are used in encoding and decoding, and | ||
| 426 | for other purposes. Some coding systems specify their own particular | ||
| 427 | translation tables; there are also default translation tables which | ||
| 428 | apply to all other coding systems. | ||
| 429 | |||
| 430 | @defun make-translation-table translations | ||
| 431 | This function returns a translation table based on the arguments | ||
| 432 | @var{translations}. Each argument---each element of | ||
| 433 | @var{translations}---should be a list of the form @code{(@var{from} | ||
| 434 | . @var{to})}; this says to translate the character @var{from} into | ||
| 435 | @var{to}. | ||
| 436 | |||
| 437 | You can also map one whole character set into another character set with | ||
| 438 | the same dimension. To do this, you specify a generic character (which | ||
| 439 | designates a character set) for @var{from} (@pxref{Splitting Characters}). | ||
| 440 | In this case, @var{to} should also be a generic character, for another | ||
| 441 | character set of the same dimension. Then the translation table | ||
| 442 | translates each character of @var{from}'s character set into the | ||
| 443 | corresponding character of @var{to}'s character set. | ||
| 444 | @end defun | ||
| 445 | |||
| 446 | In decoding, the translation table's translations are applied to the | ||
| 447 | characters that result from ordinary decoding. If a coding system has | ||
| 448 | property @code{character-translation-table-for-decode}, that specifies | ||
| 449 | the translation table to use. Otherwise, if | ||
| 450 | @code{standard-character-translation-table-for-decode} is | ||
| 451 | non-@code{nil}, decoding uses that table. | ||
| 452 | |||
| 453 | In encoding, the translation table's translations are applied to the | ||
| 454 | characters in the buffer, and the result of translation is actually | ||
| 455 | encoded. If a coding system has property | ||
| 456 | @code{character-translation-table-for-encode}, that specifies the | ||
| 457 | translation table to use. Otherwise the variable | ||
| 458 | @code{standard-character-translation-table-for-encode} specifies the | ||
| 459 | translation table. | ||
| 460 | |||
| 461 | @defvar standard-character-translation-table-for-decode | ||
| 462 | This is the default translation table for decoding, for | ||
| 463 | coding systems that don't specify any other translation table. | ||
| 464 | @end defvar | ||
| 465 | |||
| 466 | @defvar standard-character-translation-table-for-encode | ||
| 467 | This is the default translation table for encoding, for | ||
| 468 | coding systems that don't specify any other translation table. | ||
| 469 | @end defvar | ||
| 470 | |||
| 367 | @node Coding Systems | 471 | @node Coding Systems |
| 368 | @section Coding Systems | 472 | @section Coding Systems |
| 369 | 473 | ||
| @@ -373,6 +477,20 @@ subprocess or receives text from a subprocess, it normally performs | |||
| 373 | character code conversion and end-of-line conversion as specified | 477 | character code conversion and end-of-line conversion as specified |
| 374 | by a particular @dfn{coding system}. | 478 | by a particular @dfn{coding system}. |
| 375 | 479 | ||
| 480 | @menu | ||
| 481 | * Coding System Basics:: | ||
| 482 | * Encoding and I/O:: | ||
| 483 | * Lisp and Coding Systems:: | ||
| 484 | * Default Coding Systems:: | ||
| 485 | * Specifying Coding Systems:: | ||
| 486 | * Explicit Encoding:: | ||
| 487 | * Terminal I/O Encoding:: | ||
| 488 | * MS-DOS File Types:: | ||
| 489 | @end menu | ||
| 490 | |||
| 491 | @node Coding System Basics | ||
| 492 | @subsection Basic Concepts of Coding Systems | ||
| 493 | |||
| 376 | @cindex character code conversion | 494 | @cindex character code conversion |
| 377 | @dfn{Character code conversion} involves conversion between the encoding | 495 | @dfn{Character code conversion} involves conversion between the encoding |
| 378 | used inside Emacs and some other encoding. Emacs supports many | 496 | used inside Emacs and some other encoding. Emacs supports many |
| @@ -401,129 +519,219 @@ carriage-return. | |||
| 401 | conversion unspecified, to be chosen based on the data. @dfn{Variant | 519 | conversion unspecified, to be chosen based on the data. @dfn{Variant |
| 402 | coding systems} such as @code{latin-1-unix}, @code{latin-1-dos} and | 520 | coding systems} such as @code{latin-1-unix}, @code{latin-1-dos} and |
| 403 | @code{latin-1-mac} specify the end-of-line conversion explicitly as | 521 | @code{latin-1-mac} specify the end-of-line conversion explicitly as |
| 404 | well. Each base coding system has three corresponding variants whose | 522 | well. Most base coding systems have three corresponding variants whose |
| 405 | names are formed by adding @samp{-unix}, @samp{-dos} and @samp{-mac}. | 523 | names are formed by adding @samp{-unix}, @samp{-dos} and @samp{-mac}. |
| 406 | 524 | ||
| 525 | The coding system @code{raw-text} is special in that it prevents | ||
| 526 | character code conversion, and causes the buffer visited with that | ||
| 527 | coding system to be a unibyte buffer. It does not specify the | ||
| 528 | end-of-line conversion, allowing that to be determined as usual by the | ||
| 529 | data, and has the usual three variants which specify the end-of-line | ||
| 530 | conversion. @code{no-conversion} is equivalent to @code{raw-text-unix}: | ||
| 531 | it specifies no conversion of either character codes or end-of-line. | ||
| 532 | |||
| 533 | The coding system @code{emacs-mule} specifies that the data is | ||
| 534 | represented in the internal Emacs encoding. This is like | ||
| 535 | @code{raw-text} in that no code conversion happens, but different in | ||
| 536 | that the result is multibyte data. | ||
| 537 | |||
| 538 | @defun coding-system-get coding-system property | ||
| 539 | @tindex coding-system-get | ||
| 540 | This function returns the specified property of the coding system | ||
| 541 | @var{coding-system}. Most coding system properties exist for internal | ||
| 542 | purposes, but one that you might find useful is @code{mime-charset}. | ||
| 543 | That property's value is the name used in MIME for the character coding | ||
| 544 | which this coding system can read and write. Examples: | ||
| 545 | |||
| 546 | @example | ||
| 547 | (coding-system-get 'iso-latin-1 'mime-charset) | ||
| 548 | @result{} iso-8859-1 | ||
| 549 | (coding-system-get 'iso-2022-cn 'mime-charset) | ||
| 550 | @result{} iso-2022-cn | ||
| 551 | (coding-system-get 'cyrillic-koi8 'mime-charset) | ||
| 552 | @result{} koi8-r | ||
| 553 | @end example | ||
| 554 | |||
| 555 | The value of the @code{mime-charset} property is also defined | ||
| 556 | as an alias for the coding system. | ||
| 557 | @end defun | ||
| 558 | |||
| 559 | @node Encoding and I/O | ||
| 560 | @subsection Encoding and I/O | ||
| 561 | |||
| 562 | The principal purpose coding systems is for use in reading and | ||
| 563 | writing files. The function @code{insert-file-contents} uses | ||
| 564 | a coding system for decoding the file data, and @code{write-region} | ||
| 565 | uses one to encode the buffer contents. | ||
| 566 | |||
| 567 | You can specify the coding system to use either explicitly | ||
| 568 | (@pxref{Specifying Coding Systems}), or implicitly using the defaulting | ||
| 569 | mechanism (@pxref{Default Coding Systems}). But these methods may not | ||
| 570 | completely specify what to do. For example, they may choose a coding | ||
| 571 | system such as @code{undefined} which leaves the character code | ||
| 572 | conversion to be determined from the data. In these cases, the I/O | ||
| 573 | operation finishes the job of choosing a coding system. Very often | ||
| 574 | you will want to find out afterwards which coding system was chosen. | ||
| 575 | |||
| 576 | @defvar buffer-file-coding-system | ||
| 577 | @tindex buffer-file-coding-system | ||
| 578 | This variable records the coding system that was used for visiting the | ||
| 579 | current buffer. It is used for saving the buffer, and for writing part | ||
| 580 | of the buffer with @code{write-region}. When those operations ask the | ||
| 581 | user to specify a different coding system, | ||
| 582 | @code{buffer-file-coding-system} is updated to the coding system | ||
| 583 | specified. | ||
| 584 | @end defvar | ||
| 585 | |||
| 586 | @defvar save-buffer-coding-system | ||
| 587 | @tindex save-buffer-coding-system | ||
| 588 | This variable specifies the coding system for saving the buffer---but it | ||
| 589 | is not used for @code{write-region}. When saving the buffer asks the | ||
| 590 | user to specify a different coding system, and | ||
| 591 | @code{save-buffer-coding-system} was used, then it is updated to the | ||
| 592 | coding system that was specified. | ||
| 593 | @end defvar | ||
| 594 | |||
| 595 | @defvar last-coding-system-used | ||
| 596 | @tindex last-coding-system-used | ||
| 597 | I/O operations for files and subprocesses set this variable to the | ||
| 598 | coding system name that was used. The explicit encoding and decoding | ||
| 599 | functions (@pxref{Explicit Encoding}) set it too. | ||
| 600 | |||
| 601 | @strong{Warning:} Since receiving subprocess output sets this variable, | ||
| 602 | it can change whenever Emacs waits; therefore, you should use copy the | ||
| 603 | value shortly after the function call which stores the value you are | ||
| 604 | interested in. | ||
| 605 | @end defvar | ||
| 606 | |||
| 407 | @node Lisp and Coding Systems | 607 | @node Lisp and Coding Systems |
| 408 | @subsection Coding Systems in Lisp | 608 | @subsection Coding Systems in Lisp |
| 409 | 609 | ||
| 410 | Here are Lisp facilities for working with coding systems; | 610 | Here are Lisp facilities for working with coding systems; |
| 411 | 611 | ||
| 412 | @tindex coding-system-list | ||
| 413 | @defun coding-system-list &optional base-only | 612 | @defun coding-system-list &optional base-only |
| 613 | @tindex coding-system-list | ||
| 414 | This function returns a list of all coding system names (symbols). If | 614 | This function returns a list of all coding system names (symbols). If |
| 415 | @var{base-only} is non-@code{nil}, the value includes only the | 615 | @var{base-only} is non-@code{nil}, the value includes only the |
| 416 | base coding systems. Otherwise, it includes variant coding systems as well. | 616 | base coding systems. Otherwise, it includes variant coding systems as well. |
| 417 | @end defun | 617 | @end defun |
| 418 | 618 | ||
| 419 | @tindex coding-system-p | ||
| 420 | @defun coding-system-p object | 619 | @defun coding-system-p object |
| 620 | @tindex coding-system-p | ||
| 421 | This function returns @code{t} if @var{object} is a coding system | 621 | This function returns @code{t} if @var{object} is a coding system |
| 422 | name. | 622 | name. |
| 423 | @end defun | 623 | @end defun |
| 424 | 624 | ||
| 425 | @tindex check-coding-system | ||
| 426 | @defun check-coding-system coding-system | 625 | @defun check-coding-system coding-system |
| 626 | @tindex check-coding-system | ||
| 427 | This function checks the validity of @var{coding-system}. | 627 | This function checks the validity of @var{coding-system}. |
| 428 | If that is valid, it returns @var{coding-system}. | 628 | If that is valid, it returns @var{coding-system}. |
| 429 | Otherwise it signals an error with condition @code{coding-system-error}. | 629 | Otherwise it signals an error with condition @code{coding-system-error}. |
| 430 | @end defun | 630 | @end defun |
| 431 | 631 | ||
| 432 | @tindex find-safe-coding-system | 632 | @defun coding-system-change-eol-conversion coding-system eol-type |
| 433 | @defun find-safe-coding-system from to | 633 | @tindex coding-system-change-eol-conversion |
| 434 | Return a list of proper coding systems to encode a text between | 634 | This function returns a coding system which is like @var{coding-system} |
| 435 | @var{from} and @var{to}. All coding systems in the list can safely | 635 | except for its in eol conversion, which is specified by @code{eol-type}. |
| 436 | encode any multibyte characters in the text. | 636 | @var{eol-type} should be @code{unix}, @code{dos}, @code{mac}, or |
| 637 | @code{nil}. If it is @code{nil}, the returned coding system determines | ||
| 638 | the end-of-line conversion from the data. | ||
| 639 | @end defun | ||
| 437 | 640 | ||
| 438 | If the text contains no multibyte characters, return a list of a single | 641 | @defun coding-system-change-text-conversion eol-coding text-coding |
| 439 | element @code{undecided}. | 642 | @tindex coding-system-change-text-conversion |
| 643 | This function returns a coding system which uses the end-of-line | ||
| 644 | conversion of @var{eol-coding}, and the text conversion of | ||
| 645 | @var{text-coding}. If @var{text-coding} is @code{nil}, it returns | ||
| 646 | @code{undecided}, or one of its variants according to @var{eol-coding}. | ||
| 440 | @end defun | 647 | @end defun |
| 441 | 648 | ||
| 649 | @defun find-coding-systems-region from to | ||
| 650 | @tindex find-coding-systems-region | ||
| 651 | This function returns a list of coding systems that could be used to | ||
| 652 | encode a text between @var{from} and @var{to}. All coding systems in | ||
| 653 | the list can safely encode any multibyte characters in that portion of | ||
| 654 | the text. | ||
| 655 | |||
| 656 | If the text contains no multibyte characters, the function returns the | ||
| 657 | list @code{(undecided)}. | ||
| 658 | @end defun | ||
| 659 | |||
| 660 | @defun find-coding-systems-string string | ||
| 661 | @tindex find-coding-systems-string | ||
| 662 | This function returns a list of coding systems that could be used to | ||
| 663 | encode the text of @var{string}. All coding systems in the list can | ||
| 664 | safely encode any multibyte characters in @var{string}. If the text | ||
| 665 | contains no multibyte characters, this returns the list | ||
| 666 | @code{(undecided)}. | ||
| 667 | @end defun | ||
| 668 | |||
| 669 | @defun find-coding-systems-for-charsets charsets | ||
| 670 | @tindex find-coding-systems-for-charsets | ||
| 671 | This function returns a list of coding systems that could be used to | ||
| 672 | encode all the character sets in the list @var{charsets}. | ||
| 673 | @end defun | ||
| 674 | |||
| 675 | @defun detect-coding-region start end &optional highest | ||
| 442 | @tindex detect-coding-region | 676 | @tindex detect-coding-region |
| 443 | @defun detect-coding-region start end highest | ||
| 444 | This function chooses a plausible coding system for decoding the text | 677 | This function chooses a plausible coding system for decoding the text |
| 445 | from @var{start} to @var{end}. This text should be ``raw bytes'' | 678 | from @var{start} to @var{end}. This text should be ``raw bytes'' |
| 446 | (@pxref{Explicit Encoding}). | 679 | (@pxref{Explicit Encoding}). |
| 447 | 680 | ||
| 448 | Normally this function returns is a list of coding systems that could | 681 | Normally this function returns a list of coding systems that could |
| 449 | handle decoding the text that was scanned. They are listed in order of | 682 | handle decoding the text that was scanned. They are listed in order of |
| 450 | decreasing priority, based on the priority specified by the user with | 683 | decreasing priority. But if @var{highest} is non-@code{nil}, then the |
| 451 | @code{prefer-coding-system}. But if @var{highest} is non-@code{nil}, | 684 | return value is just one coding system, the one that is highest in |
| 452 | then the return value is just one coding system, the one that is highest | 685 | priority. |
| 453 | in priority. | 686 | |
| 687 | If the region contains only @sc{ASCII} characters, the value | ||
| 688 | is @code{undecided} or @code{(undecided)}. | ||
| 454 | @end defun | 689 | @end defun |
| 455 | 690 | ||
| 456 | @tindex detect-coding-string string highest | 691 | @defun detect-coding-string string highest |
| 457 | @defun detect-coding-string | 692 | @tindex detect-coding-string |
| 458 | This function is like @code{detect-coding-region} except that it | 693 | This function is like @code{detect-coding-region} except that it |
| 459 | operates on the contents of @var{string} instead of bytes in the buffer. | 694 | operates on the contents of @var{string} instead of bytes in the buffer. |
| 460 | @end defun | 695 | @end defun |
| 461 | 696 | ||
| 462 | @defun find-operation-coding-system operation &rest arguments | ||
| 463 | This function returns the coding system to use (by default) for | ||
| 464 | performing @var{operation} with @var{arguments}. The value has this | ||
| 465 | form: | ||
| 466 | |||
| 467 | @example | ||
| 468 | (@var{decoding-system} @var{encoding-system}) | ||
| 469 | @end example | ||
| 470 | |||
| 471 | The first element, @var{decoding-system}, is the coding system to use | ||
| 472 | for decoding (in case @var{operation} does decoding), and | ||
| 473 | @var{encoding-system} is the coding system for encoding (in case | ||
| 474 | @var{operation} does encoding). | ||
| 475 | |||
| 476 | The argument @var{operation} should be an Emacs I/O primitive: | ||
| 477 | @code{insert-file-contents}, @code{write-region}, @code{call-process}, | ||
| 478 | @code{call-process-region}, @code{start-process}, or | ||
| 479 | @code{open-network-stream}. | ||
| 480 | |||
| 481 | The remaining arguments should be the same arguments that might be given | ||
| 482 | to that I/O primitive. Depending on which primitive, one of those | ||
| 483 | arguments is selected as the @dfn{target}. For example, if | ||
| 484 | @var{operation} does file I/O, whichever argument specifies the file | ||
| 485 | name is the target. For subprocess primitives, the process name is the | ||
| 486 | target. For @code{open-network-stream}, the target is the service name | ||
| 487 | or port number. | ||
| 488 | |||
| 489 | This function looks up the target in @code{file-coding-system-alist}, | ||
| 490 | @code{process-coding-system-alist}, or | ||
| 491 | @code{network-coding-system-alist}, depending on @var{operation}. | ||
| 492 | @xref{Default Coding Systems}. | ||
| 493 | @end defun | ||
| 494 | |||
| 495 | Here are two functions you can use to let the user specify a coding | 697 | Here are two functions you can use to let the user specify a coding |
| 496 | system, with completion. @xref{Completion}. | 698 | system, with completion. @xref{Completion}. |
| 497 | 699 | ||
| 700 | @defun read-coding-system prompt &optional default | ||
| 498 | @tindex read-coding-system | 701 | @tindex read-coding-system |
| 499 | @defun read-coding-system prompt default | ||
| 500 | This function reads a coding system using the minibuffer, prompting with | 702 | This function reads a coding system using the minibuffer, prompting with |
| 501 | string @var{prompt}, and returns the coding system name as a symbol. If | 703 | string @var{prompt}, and returns the coding system name as a symbol. If |
| 502 | the user enters null input, @var{default} specifies which coding system | 704 | the user enters null input, @var{default} specifies which coding system |
| 503 | to return. It should be a symbol or a string. | 705 | to return. It should be a symbol or a string. |
| 504 | @end defun | 706 | @end defun |
| 505 | 707 | ||
| 506 | @tindex read-non-nil-coding-system | ||
| 507 | @defun read-non-nil-coding-system prompt | 708 | @defun read-non-nil-coding-system prompt |
| 709 | @tindex read-non-nil-coding-system | ||
| 508 | This function reads a coding system using the minibuffer, prompting with | 710 | This function reads a coding system using the minibuffer, prompting with |
| 509 | string @var{prompt},and returns the coding system name as a symbol. If | 711 | string @var{prompt}, and returns the coding system name as a symbol. If |
| 510 | the user tries to enter null input, it asks the user to try again. | 712 | the user tries to enter null input, it asks the user to try again. |
| 511 | @xref{Coding Systems}. | 713 | @xref{Coding Systems}. |
| 512 | @end defun | 714 | @end defun |
| 513 | 715 | ||
| 716 | @xref{Process Information}, for how to examine or set the coding | ||
| 717 | systems used for I/O to a subprocess. | ||
| 718 | |||
| 514 | @node Default Coding Systems | 719 | @node Default Coding Systems |
| 515 | @section Default Coding Systems | 720 | @subsection Default Coding Systems |
| 516 | 721 | ||
| 517 | These variable specify which coding system to use by default for | 722 | This section describes variables that specify the default coding |
| 518 | certain files or when running certain subprograms. The idea of these | 723 | system for certain files or when running certain subprograms, and the |
| 519 | variables is that you set them once and for all to the defaults you | 724 | function which which I/O operations use to access them. |
| 520 | want, and then do not change them again. To specify a particular coding | 725 | |
| 521 | system for a particular operation in a Lisp program, don't change these | 726 | The idea of these variables is that you set them once and for all to the |
| 522 | variables; instead, override them using @code{coding-system-for-read} | 727 | defaults you want, and then do not change them again. To specify a |
| 523 | and @code{coding-system-for-write} (@pxref{Specifying Coding Systems}). | 728 | particular coding system for a particular operation in a Lisp program, |
| 729 | don't change these variables; instead, override them using | ||
| 730 | @code{coding-system-for-read} and @code{coding-system-for-write} | ||
| 731 | (@pxref{Specifying Coding Systems}). | ||
| 524 | 732 | ||
| 525 | @tindex file-coding-system-alist | ||
| 526 | @defvar file-coding-system-alist | 733 | @defvar file-coding-system-alist |
| 734 | @tindex file-coding-system-alist | ||
| 527 | This variable is an alist that specifies the coding systems to use for | 735 | This variable is an alist that specifies the coding systems to use for |
| 528 | reading and writing particular files. Each element has the form | 736 | reading and writing particular files. Each element has the form |
| 529 | @code{(@var{pattern} . @var{coding})}, where @var{pattern} is a regular | 737 | @code{(@var{pattern} . @var{coding})}, where @var{pattern} is a regular |
| @@ -542,8 +750,8 @@ system or a cons cell containing two coding systems. This value is used | |||
| 542 | as described above. | 750 | as described above. |
| 543 | @end defvar | 751 | @end defvar |
| 544 | 752 | ||
| 545 | @tindex process-coding-system-alist | ||
| 546 | @defvar process-coding-system-alist | 753 | @defvar process-coding-system-alist |
| 754 | @tindex process-coding-system-alist | ||
| 547 | This variable is an alist specifying which coding systems to use for a | 755 | This variable is an alist specifying which coding systems to use for a |
| 548 | subprocess, depending on which program is running in the subprocess. It | 756 | subprocess, depending on which program is running in the subprocess. It |
| 549 | works like @code{file-coding-system-alist}, except that @var{pattern} is | 757 | works like @code{file-coding-system-alist}, except that @var{pattern} is |
| @@ -553,8 +761,21 @@ coding systems used for I/O to the subprocess, but you can specify | |||
| 553 | other coding systems later using @code{set-process-coding-system}. | 761 | other coding systems later using @code{set-process-coding-system}. |
| 554 | @end defvar | 762 | @end defvar |
| 555 | 763 | ||
| 556 | @tindex network-coding-system-alist | 764 | @strong{Warning:} Coding systems such as @code{undecided} which |
| 765 | determine the coding system from the data do not work entirely reliably | ||
| 766 | with asynchronous subprocess output. This is because Emacs processes | ||
| 767 | asynchronous subprocess output in batches, as it arrives. If the coding | ||
| 768 | system leaves the character code conversion unspecified, or leaves the | ||
| 769 | end-of-line conversion unspecified, Emacs must try to detect the proper | ||
| 770 | conversion from one batch at a time, and this does not always work. | ||
| 771 | |||
| 772 | Therefore, with an asynchronous subprocess, if at all possible, use a | ||
| 773 | coding system which determines both the character code conversion and | ||
| 774 | the end of line conversion---that is, one like @code{latin-1-unix}, | ||
| 775 | rather than @code{undecided} or @code{latin-1}. | ||
| 776 | |||
| 557 | @defvar network-coding-system-alist | 777 | @defvar network-coding-system-alist |
| 778 | @tindex network-coding-system-alist | ||
| 558 | This variable is an alist that specifies the coding system to use for | 779 | This variable is an alist that specifies the coding system to use for |
| 559 | network streams. It works much like @code{file-coding-system-alist}, | 780 | network streams. It works much like @code{file-coding-system-alist}, |
| 560 | with the difference that the @var{pattern} in an element may be either a | 781 | with the difference that the @var{pattern} in an element may be either a |
| @@ -563,26 +784,60 @@ is matched against the network service name used to open the network | |||
| 563 | stream. | 784 | stream. |
| 564 | @end defvar | 785 | @end defvar |
| 565 | 786 | ||
| 566 | @tindex default-process-coding-system | ||
| 567 | @defvar default-process-coding-system | 787 | @defvar default-process-coding-system |
| 788 | @tindex default-process-coding-system | ||
| 568 | This variable specifies the coding systems to use for subprocess (and | 789 | This variable specifies the coding systems to use for subprocess (and |
| 569 | network stream) input and output, when nothing else specifies what to | 790 | network stream) input and output, when nothing else specifies what to |
| 570 | do. | 791 | do. |
| 571 | 792 | ||
| 572 | The value should be a cons cell of the form @code{(@var{output-coding} | 793 | The value should be a cons cell of the form @code{(@var{input-coding} |
| 573 | . @var{input-coding})}. Here @var{output-coding} applies to output to | 794 | . @var{output-coding})}. Here @var{input-coding} applies to input from |
| 574 | the subprocess, and @var{input-coding} applies to input from it. | 795 | the subprocess, and @var{output-coding} applies to output to it. |
| 575 | @end defvar | 796 | @end defvar |
| 576 | 797 | ||
| 798 | @defun find-operation-coding-system operation &rest arguments | ||
| 799 | @tindex find-operation-coding-system | ||
| 800 | This function returns the coding system to use (by default) for | ||
| 801 | performing @var{operation} with @var{arguments}. The value has this | ||
| 802 | form: | ||
| 803 | |||
| 804 | @example | ||
| 805 | (@var{decoding-system} @var{encoding-system}) | ||
| 806 | @end example | ||
| 807 | |||
| 808 | The first element, @var{decoding-system}, is the coding system to use | ||
| 809 | for decoding (in case @var{operation} does decoding), and | ||
| 810 | @var{encoding-system} is the coding system for encoding (in case | ||
| 811 | @var{operation} does encoding). | ||
| 812 | |||
| 813 | The argument @var{operation} should be an Emacs I/O primitive: | ||
| 814 | @code{insert-file-contents}, @code{write-region}, @code{call-process}, | ||
| 815 | @code{call-process-region}, @code{start-process}, or | ||
| 816 | @code{open-network-stream}. | ||
| 817 | |||
| 818 | The remaining arguments should be the same arguments that might be given | ||
| 819 | to that I/O primitive. Depending on which primitive, one of those | ||
| 820 | arguments is selected as the @dfn{target}. For example, if | ||
| 821 | @var{operation} does file I/O, whichever argument specifies the file | ||
| 822 | name is the target. For subprocess primitives, the process name is the | ||
| 823 | target. For @code{open-network-stream}, the target is the service name | ||
| 824 | or port number. | ||
| 825 | |||
| 826 | This function looks up the target in @code{file-coding-system-alist}, | ||
| 827 | @code{process-coding-system-alist}, or | ||
| 828 | @code{network-coding-system-alist}, depending on @var{operation}. | ||
| 829 | @xref{Default Coding Systems}. | ||
| 830 | @end defun | ||
| 831 | |||
| 577 | @node Specifying Coding Systems | 832 | @node Specifying Coding Systems |
| 578 | @section Specifying a Coding System for One Operation | 833 | @subsection Specifying a Coding System for One Operation |
| 579 | 834 | ||
| 580 | You can specify the coding system for a specific operation by binding | 835 | You can specify the coding system for a specific operation by binding |
| 581 | the variables @code{coding-system-for-read} and/or | 836 | the variables @code{coding-system-for-read} and/or |
| 582 | @code{coding-system-for-write}. | 837 | @code{coding-system-for-write}. |
| 583 | 838 | ||
| 584 | @tindex coding-system-for-read | ||
| 585 | @defvar coding-system-for-read | 839 | @defvar coding-system-for-read |
| 840 | @tindex coding-system-for-read | ||
| 586 | If this variable is non-@code{nil}, it specifies the coding system to | 841 | If this variable is non-@code{nil}, it specifies the coding system to |
| 587 | use for reading a file, or for input from a synchronous subprocess. | 842 | use for reading a file, or for input from a synchronous subprocess. |
| 588 | 843 | ||
| @@ -605,14 +860,14 @@ of the right way to use the variable: | |||
| 605 | @end example | 860 | @end example |
| 606 | 861 | ||
| 607 | When its value is non-@code{nil}, @code{coding-system-for-read} takes | 862 | When its value is non-@code{nil}, @code{coding-system-for-read} takes |
| 608 | precedence all other methods of specifying a coding system to use for | 863 | precedence over all other methods of specifying a coding system to use for |
| 609 | input, including @code{file-coding-system-alist}, | 864 | input, including @code{file-coding-system-alist}, |
| 610 | @code{process-coding-system-alist} and | 865 | @code{process-coding-system-alist} and |
| 611 | @code{network-coding-system-alist}. | 866 | @code{network-coding-system-alist}. |
| 612 | @end defvar | 867 | @end defvar |
| 613 | 868 | ||
| 614 | @tindex coding-system-for-write | ||
| 615 | @defvar coding-system-for-write | 869 | @defvar coding-system-for-write |
| 870 | @tindex coding-system-for-write | ||
| 616 | This works much like @code{coding-system-for-read}, except that it | 871 | This works much like @code{coding-system-for-read}, except that it |
| 617 | applies to output rather than input. It affects writing to files, | 872 | applies to output rather than input. It affects writing to files, |
| 618 | subprocesses, and net connections. | 873 | subprocesses, and net connections. |
| @@ -623,53 +878,16 @@ When a single operation does both input and output, as do | |||
| 623 | affect it. | 878 | affect it. |
| 624 | @end defvar | 879 | @end defvar |
| 625 | 880 | ||
| 626 | @tindex last-coding-system-used | ||
| 627 | @defvar last-coding-system-used | ||
| 628 | All I/O operations that use a coding system set this variable | ||
| 629 | to the coding system name that was used. | ||
| 630 | @end defvar | ||
| 631 | |||
| 632 | @tindex inhibit-eol-conversion | ||
| 633 | @defvar inhibit-eol-conversion | 881 | @defvar inhibit-eol-conversion |
| 882 | @tindex inhibit-eol-conversion | ||
| 634 | When this variable is non-@code{nil}, no end-of-line conversion is done, | 883 | When this variable is non-@code{nil}, no end-of-line conversion is done, |
| 635 | no matter which coding system is specified. This applies to all the | 884 | no matter which coding system is specified. This applies to all the |
| 636 | Emacs I/O and subprocess primitives, and to the explicit encoding and | 885 | Emacs I/O and subprocess primitives, and to the explicit encoding and |
| 637 | decoding functions (@pxref{Explicit Encoding}). | 886 | decoding functions (@pxref{Explicit Encoding}). |
| 638 | @end defvar | 887 | @end defvar |
| 639 | 888 | ||
| 640 | @tindex keyboard-coding-system | ||
| 641 | @defun keyboard-coding-system | ||
| 642 | This function returns the coding system that is in use for decoding | ||
| 643 | keyboard input---or @code{nil} if no coding system is to be used. | ||
| 644 | @end defun | ||
| 645 | |||
| 646 | @tindex set-keyboard-coding-system | ||
| 647 | @defun set-keyboard-coding-system coding-system | ||
| 648 | This function specifies @var{coding-system} as the coding system to | ||
| 649 | use for decoding keyboard input. If @var{coding-system} is @code{nil}, | ||
| 650 | that means do not decode keyboard input. | ||
| 651 | @end defun | ||
| 652 | |||
| 653 | @tindex terminal-coding-system | ||
| 654 | @defun terminal-coding-system | ||
| 655 | This function returns the coding system that is in use for encoding | ||
| 656 | terminal output---or @code{nil} for no encoding. | ||
| 657 | @end defun | ||
| 658 | |||
| 659 | @tindex set-terminal-coding-system | ||
| 660 | @defun set-terminal-coding-system coding-system | ||
| 661 | This function specifies @var{coding-system} as the coding system to use | ||
| 662 | for encoding terminal output. If @var{coding-system} is @code{nil}, | ||
| 663 | that means do not encode terminal output. | ||
| 664 | @end defun | ||
| 665 | |||
| 666 | See also the functions @code{process-coding-system} and | ||
| 667 | @code{set-process-coding-system}. @xref{Process Information}. | ||
| 668 | |||
| 669 | See also @code{read-coding-system} in @ref{High-Level Completion}. | ||
| 670 | |||
| 671 | @node Explicit Encoding | 889 | @node Explicit Encoding |
| 672 | @section Explicit Encoding and Decoding | 890 | @subsection Explicit Encoding and Decoding |
| 673 | @cindex encoding text | 891 | @cindex encoding text |
| 674 | @cindex decoding text | 892 | @cindex decoding text |
| 675 | 893 | ||
| @@ -699,39 +917,72 @@ write them with @code{write-region} (@pxref{Writing to Files}), and | |||
| 699 | suppress encoding for that @code{write-region} call by binding | 917 | suppress encoding for that @code{write-region} call by binding |
| 700 | @code{coding-system-for-write} to @code{no-conversion}. | 918 | @code{coding-system-for-write} to @code{no-conversion}. |
| 701 | 919 | ||
| 702 | @tindex encode-coding-region | ||
| 703 | @defun encode-coding-region start end coding-system | 920 | @defun encode-coding-region start end coding-system |
| 921 | @tindex encode-coding-region | ||
| 704 | This function encodes the text from @var{start} to @var{end} according | 922 | This function encodes the text from @var{start} to @var{end} according |
| 705 | to coding system @var{coding-system}. The encoded text replaces the | 923 | to coding system @var{coding-system}. The encoded text replaces the |
| 706 | original text in the buffer. The result of encoding is ``raw bytes,'' | 924 | original text in the buffer. The result of encoding is ``raw bytes,'' |
| 707 | but the buffer remains multibyte if it was multibyte before. | 925 | but the buffer remains multibyte if it was multibyte before. |
| 708 | @end defun | 926 | @end defun |
| 709 | 927 | ||
| 710 | @tindex encode-coding-string | ||
| 711 | @defun encode-coding-string string coding-system | 928 | @defun encode-coding-string string coding-system |
| 929 | @tindex encode-coding-string | ||
| 712 | This function encodes the text in @var{string} according to coding | 930 | This function encodes the text in @var{string} according to coding |
| 713 | system @var{coding-system}. It returns a new string containing the | 931 | system @var{coding-system}. It returns a new string containing the |
| 714 | encoded text. The result of encoding is a unibyte string of ``raw bytes.'' | 932 | encoded text. The result of encoding is a unibyte string of ``raw bytes.'' |
| 715 | @end defun | 933 | @end defun |
| 716 | 934 | ||
| 717 | @tindex decode-coding-region | ||
| 718 | @defun decode-coding-region start end coding-system | 935 | @defun decode-coding-region start end coding-system |
| 936 | @tindex decode-coding-region | ||
| 719 | This function decodes the text from @var{start} to @var{end} according | 937 | This function decodes the text from @var{start} to @var{end} according |
| 720 | to coding system @var{coding-system}. The decoded text replaces the | 938 | to coding system @var{coding-system}. The decoded text replaces the |
| 721 | original text in the buffer. To make explicit decoding useful, the text | 939 | original text in the buffer. To make explicit decoding useful, the text |
| 722 | before decoding ought to be ``raw bytes.'' | 940 | before decoding ought to be ``raw bytes.'' |
| 723 | @end defun | 941 | @end defun |
| 724 | 942 | ||
| 725 | @tindex decode-coding-string | ||
| 726 | @defun decode-coding-string string coding-system | 943 | @defun decode-coding-string string coding-system |
| 944 | @tindex decode-coding-string | ||
| 727 | This function decodes the text in @var{string} according to coding | 945 | This function decodes the text in @var{string} according to coding |
| 728 | system @var{coding-system}. It returns a new string containing the | 946 | system @var{coding-system}. It returns a new string containing the |
| 729 | decoded text. To make explicit decoding useful, the contents of | 947 | decoded text. To make explicit decoding useful, the contents of |
| 730 | @var{string} ought to be ``raw bytes.'' | 948 | @var{string} ought to be ``raw bytes.'' |
| 731 | @end defun | 949 | @end defun |
| 732 | 950 | ||
| 951 | @node Terminal I/O Encoding | ||
| 952 | @subsection Terminal I/O Encoding | ||
| 953 | |||
| 954 | Emacs can decode keyboard input using a coding system, and encode | ||
| 955 | terminal output. This kind of decoding and encoding does not set | ||
| 956 | @code{last-coding-system-used}. | ||
| 957 | |||
| 958 | @defun keyboard-coding-system | ||
| 959 | @tindex keyboard-coding-system | ||
| 960 | This function returns the coding system that is in use for decoding | ||
| 961 | keyboard input---or @code{nil} if no coding system is to be used. | ||
| 962 | @end defun | ||
| 963 | |||
| 964 | @defun set-keyboard-coding-system coding-system | ||
| 965 | @tindex set-keyboard-coding-system | ||
| 966 | This function specifies @var{coding-system} as the coding system to | ||
| 967 | use for decoding keyboard input. If @var{coding-system} is @code{nil}, | ||
| 968 | that means do not decode keyboard input. | ||
| 969 | @end defun | ||
| 970 | |||
| 971 | @defun terminal-coding-system | ||
| 972 | @tindex terminal-coding-system | ||
| 973 | This function returns the coding system that is in use for encoding | ||
| 974 | terminal output---or @code{nil} for no encoding. | ||
| 975 | @end defun | ||
| 976 | |||
| 977 | @defun set-terminal-coding-system coding-system | ||
| 978 | @tindex set-terminal-coding-system | ||
| 979 | This function specifies @var{coding-system} as the coding system to use | ||
| 980 | for encoding terminal output. If @var{coding-system} is @code{nil}, | ||
| 981 | that means do not encode terminal output. | ||
| 982 | @end defun | ||
| 983 | |||
| 733 | @node MS-DOS File Types | 984 | @node MS-DOS File Types |
| 734 | @section MS-DOS File Types | 985 | @subsection MS-DOS File Types |
| 735 | @cindex DOS file types | 986 | @cindex DOS file types |
| 736 | @cindex MS-DOS file types | 987 | @cindex MS-DOS file types |
| 737 | @cindex Windows file types | 988 | @cindex Windows file types |
| @@ -740,17 +991,24 @@ decoded text. To make explicit decoding useful, the contents of | |||
| 740 | @cindex binary files and text files | 991 | @cindex binary files and text files |
| 741 | 992 | ||
| 742 | Emacs on MS-DOS and on MS-Windows recognizes certain file names as | 993 | Emacs on MS-DOS and on MS-Windows recognizes certain file names as |
| 743 | text files or binary files. For a text file, Emacs always uses DOS | 994 | text files or binary files. By ``binary file'' we mean a file of |
| 744 | end-of-line conversion. For a binary file, Emacs does no end-of-line | 995 | literal byte values that are not necessary meant to be characters. |
| 745 | conversion and no character code conversion. | 996 | Emacs does no end-of-line conversion and no character code conversion |
| 997 | for a binary file. Meanwhile, when you create a new file which is | ||
| 998 | marked by its name as a ``text file'', Emacs uses DOS end-of-line | ||
| 999 | conversion. | ||
| 746 | 1000 | ||
| 747 | @defvar buffer-file-type | 1001 | @defvar buffer-file-type |
| 748 | This variable, automatically buffer-local in each buffer, records the | 1002 | This variable, automatically buffer-local in each buffer, records the |
| 749 | file type of the buffer's visited file. The value is @code{nil} for | 1003 | file type of the buffer's visited file. When a buffer does not specify |
| 750 | text, @code{t} for binary. When a buffer does not specify a coding | 1004 | a coding system with @code{buffer-file-coding-system}, this variable is |
| 751 | system with @code{buffer-file-coding-system}, this variable is used by | 1005 | used to determine which coding system to use when writing the contents |
| 752 | the function @code{find-buffer-file-type-coding-system} to determine | 1006 | of the buffer. It should be @code{nil} for text, @code{t} for binary. |
| 753 | which coding system to use when writing the contents of the buffer. | 1007 | If it is @code{t}, the coding system is @code{no-conversion}. |
| 1008 | Otherwise, @code{undecided-dos} is used. | ||
| 1009 | |||
| 1010 | Normally this variable is set by visiting a file; it is set to | ||
| 1011 | @code{nil} if the file was visited without any actual conversion. | ||
| 754 | @end defvar | 1012 | @end defvar |
| 755 | 1013 | ||
| 756 | @defopt file-name-buffer-file-type-alist | 1014 | @defopt file-name-buffer-file-type-alist |
| @@ -775,26 +1033,80 @@ This variable says how to handle files for which | |||
| 775 | @code{file-name-buffer-file-type-alist} says nothing about the type. | 1033 | @code{file-name-buffer-file-type-alist} says nothing about the type. |
| 776 | 1034 | ||
| 777 | If this variable is non-@code{nil}, then these files are treated as | 1035 | If this variable is non-@code{nil}, then these files are treated as |
| 778 | binary. Otherwise, nothing special is done for them---the coding system | 1036 | binary: the coding system @code{no-conversion} is used. Otherwise, |
| 779 | is deduced solely from the file contents, in the usual Emacs fashion. | 1037 | nothing special is done for them---the coding system is deduced solely |
| 1038 | from the file contents, in the usual Emacs fashion. | ||
| 780 | @end defopt | 1039 | @end defopt |
| 781 | 1040 | ||
| 782 | @node MS-DOS Subprocesses | 1041 | @node Input Methods |
| 783 | @section MS-DOS Subprocesses | 1042 | @section Input Methods |
| 784 | 1043 | @cindex input methods | |
| 785 | On Microsoft operating systems, these variables provide an alternative | 1044 | |
| 786 | way to specify the kind of end-of-line conversion to use for input and | 1045 | @dfn{Input methods} provide convenient ways of entering non-@sc{ASCII} |
| 787 | output. The variable @code{binary-process-input} applies to input sent | 1046 | characters from the keyboard. Unlike coding systems, which translate |
| 788 | to the subprocess, and @code{binary-process-output} applies to output | 1047 | non-@sc{ASCII} characters to and from encodings meant to be read by |
| 789 | received from it. A non-@code{nil} value means the data is ``binary,'' | 1048 | programs, input methods provide human-friendly commands. (@xref{Input |
| 790 | and @code{nil} means the data is text. | 1049 | Methods,,, emacs, The GNU Emacs Manual}, for information on how users |
| 791 | 1050 | use input methods to enter text.) How to define input methods is not | |
| 792 | @defvar binary-process-input | 1051 | yet documented in this manual, but here we describe how to use them. |
| 793 | If this variable is @code{nil}, convert newlines to @sc{crlf} sequences in | 1052 | |
| 794 | the input to a synchronous subprocess. | 1053 | Each input method has a name, which is currently a string; |
| 1054 | in the future, symbols may also be usable as input method names. | ||
| 1055 | |||
| 1056 | @tindex current-input-method | ||
| 1057 | @defvar current-input-method | ||
| 1058 | This variable holds the name of the input method now active in the | ||
| 1059 | current buffer. (It automatically becomes local in each buffer when set | ||
| 1060 | in any fashion.) It is @code{nil} if no input method is active in the | ||
| 1061 | buffer now. | ||
| 795 | @end defvar | 1062 | @end defvar |
| 796 | 1063 | ||
| 797 | @defvar binary-process-output | 1064 | @tindex default-input-method |
| 798 | If this variable is @code{nil}, convert @sc{crlf} sequences to newlines in | 1065 | @defvar default-input-method |
| 799 | the output from a synchronous subprocess. | 1066 | This variable holds the default input method for commands that choose an |
| 1067 | input method. Unlike @code{current-input-method}, this variable is | ||
| 1068 | normally global. | ||
| 800 | @end defvar | 1069 | @end defvar |
| 1070 | |||
| 1071 | @tindex set-input-method | ||
| 1072 | @defun set-input-method input-method | ||
| 1073 | This function activates input method @var{input-method} for the current | ||
| 1074 | buffer. It also sets @code{default-input-method} to @var{input-method}. | ||
| 1075 | If @var{input-method} is @code{nil}, this function deactivates any input | ||
| 1076 | method for the current buffer. | ||
| 1077 | @end defun | ||
| 1078 | |||
| 1079 | @tindex read-input-method-name | ||
| 1080 | @defun read-input-method-name prompt &optional default inhibit-null | ||
| 1081 | This function reads an input method name with the minibuffer, prompting | ||
| 1082 | with @var{prompt}. If @var{default} is non-@code{nil}, that is returned | ||
| 1083 | by default, if the user enters empty input. However, if | ||
| 1084 | @var{inhibit-null} is non-@code{nil}, empty input signals an error. | ||
| 1085 | |||
| 1086 | The returned value is a string. | ||
| 1087 | @end defun | ||
| 1088 | |||
| 1089 | @tindex input-method-alist | ||
| 1090 | @defvar input-method-alist | ||
| 1091 | This variable defines all the supported input methods. | ||
| 1092 | Each element defines one input method, and should have the form: | ||
| 1093 | |||
| 1094 | @example | ||
| 1095 | (@var{input-method} @var{language-env} @var{activate-func} @var{title} @var{description} @var{args}...) | ||
| 1096 | @end example | ||
| 1097 | |||
| 1098 | Here @var{input-method} is the input method name, a string; @var{env} is | ||
| 1099 | another string, the name of the language environment this input method | ||
| 1100 | is recommended for. (That serves only for documentation purposes.) | ||
| 1101 | |||
| 1102 | @var{title} is a string to display in the mode line while this method is | ||
| 1103 | active. @var{description} is a string describing this method and what | ||
| 1104 | it is good for. | ||
| 1105 | |||
| 1106 | @var{activate-func} is a function to call to activate this method. The | ||
| 1107 | @var{args}, if any, are passed as arguments to @var{activate-func}. All | ||
| 1108 | told, the arguments to @var{activate-func} are @var{input-method} and | ||
| 1109 | the @var{args}. | ||
| 1110 | @end defun | ||
| 1111 | |||
| 1112 | |||
diff --git a/lispref/numbers.texi b/lispref/numbers.texi index daee3890e77..fbbdc83871e 100644 --- a/lispref/numbers.texi +++ b/lispref/numbers.texi | |||
| @@ -249,6 +249,11 @@ numbers or markers. However, it is a good idea to use @code{=} if you | |||
| 249 | can, even for comparing integers, just in case we change the | 249 | can, even for comparing integers, just in case we change the |
| 250 | representation of integers in a future Emacs version. | 250 | representation of integers in a future Emacs version. |
| 251 | 251 | ||
| 252 | Sometimes it is useful to compare numbers with @code{equal}; it treats | ||
| 253 | two numbers as equal if they have the same data type (both integers, or | ||
| 254 | both floating point) and the same value. By contrast, @code{=} can | ||
| 255 | treat an integer and a floating point number as equal. | ||
| 256 | |||
| 252 | There is another wrinkle: because floating point arithmetic is not | 257 | There is another wrinkle: because floating point arithmetic is not |
| 253 | exact, it is often a bad idea to check for equality of two floating | 258 | exact, it is often a bad idea to check for equality of two floating |
| 254 | point values. Usually it is better to test for approximate equality. | 259 | point values. Usually it is better to test for approximate equality. |
| @@ -328,7 +333,7 @@ This function returns the smallest of its arguments. | |||
| 328 | @end defun | 333 | @end defun |
| 329 | 334 | ||
| 330 | @defun abs number | 335 | @defun abs number |
| 331 | This returns the absolute value of @var{number}. | 336 | This function returns the absolute value of @var{number}. |
| 332 | @end defun | 337 | @end defun |
| 333 | 338 | ||
| 334 | @node Numeric Conversions | 339 | @node Numeric Conversions |
| @@ -357,9 +362,9 @@ This returns @var{number}, converted to an integer by rounding downward | |||
| 357 | (towards negative infinity). | 362 | (towards negative infinity). |
| 358 | 363 | ||
| 359 | If @var{divisor} is specified, @var{number} is divided by @var{divisor} | 364 | If @var{divisor} is specified, @var{number} is divided by @var{divisor} |
| 360 | before the floor is taken; this is the division operation that | 365 | before the floor is taken; this uses the kind of division operation that |
| 361 | corresponds to @code{mod}. An @code{arith-error} results if | 366 | corresponds to @code{mod}, rounding downward. An @code{arith-error} |
| 362 | @var{divisor} is 0. | 367 | results if @var{divisor} is 0. |
| 363 | @end defun | 368 | @end defun |
| 364 | 369 | ||
| 365 | @defun ceiling number | 370 | @defun ceiling number |
| @@ -600,7 +605,7 @@ Conversions}. | |||
| 600 | @section Rounding Operations | 605 | @section Rounding Operations |
| 601 | @cindex rounding without conversion | 606 | @cindex rounding without conversion |
| 602 | 607 | ||
| 603 | The functions @code{ffloor}, @code{fceiling}, @code{fround} and | 608 | The functions @code{ffloor}, @code{fceiling}, @code{fround}, and |
| 604 | @code{ftruncate} take a floating point argument and return a floating | 609 | @code{ftruncate} take a floating point argument and return a floating |
| 605 | point result whose value is a nearby integer. @code{ffloor} returns the | 610 | point result whose value is a nearby integer. @code{ffloor} returns the |
| 606 | nearest integer below; @code{fceiling}, the nearest integer above; | 611 | nearest integer below; @code{fceiling}, the nearest integer above; |
| @@ -965,14 +970,34 @@ and pi/2 (exclusive) whose tangent is @var{arg}. | |||
| 965 | @end defun | 970 | @end defun |
| 966 | 971 | ||
| 967 | @defun exp arg | 972 | @defun exp arg |
| 968 | This is the exponential function; it returns @i{e} to the power | 973 | This is the exponential function; it returns |
| 969 | @var{arg}. @i{e} is a fundamental mathematical constant also called the | 974 | @tex |
| 970 | base of natural logarithms. | 975 | $e$ |
| 976 | @end tex | ||
| 977 | @ifinfo | ||
| 978 | @i{e} | ||
| 979 | @end ifinfo | ||
| 980 | to the power @var{arg}. | ||
| 981 | @tex | ||
| 982 | $e$ | ||
| 983 | @end tex | ||
| 984 | @ifinfo | ||
| 985 | @i{e} | ||
| 986 | @end ifinfo | ||
| 987 | is a fundamental mathematical constant also called the base of natural | ||
| 988 | logarithms. | ||
| 971 | @end defun | 989 | @end defun |
| 972 | 990 | ||
| 973 | @defun log arg &optional base | 991 | @defun log arg &optional base |
| 974 | This function returns the logarithm of @var{arg}, with base @var{base}. | 992 | This function returns the logarithm of @var{arg}, with base @var{base}. |
| 975 | If you don't specify @var{base}, the base @var{e} is used. If @var{arg} | 993 | If you don't specify @var{base}, the base |
| 994 | @tex | ||
| 995 | $e$ | ||
| 996 | @end tex | ||
| 997 | @ifinfo | ||
| 998 | @i{e} | ||
| 999 | @end ifinfo | ||
| 1000 | is used. If @var{arg} | ||
| 976 | is negative, the result is a NaN. | 1001 | is negative, the result is a NaN. |
| 977 | @end defun | 1002 | @end defun |
| 978 | 1003 | ||
diff --git a/lispref/objects.texi b/lispref/objects.texi index ea1e8fb1632..f2c082b56bc 100644 --- a/lispref/objects.texi +++ b/lispref/objects.texi | |||
| @@ -396,8 +396,9 @@ distinction to the computer in any way. | |||
| 396 | @cindex alt characters | 396 | @cindex alt characters |
| 397 | The X Window System defines three other modifier bits that can be set | 397 | The X Window System defines three other modifier bits that can be set |
| 398 | in a character: @dfn{hyper}, @dfn{super} and @dfn{alt}. The syntaxes | 398 | in a character: @dfn{hyper}, @dfn{super} and @dfn{alt}. The syntaxes |
| 399 | for these bits are @samp{\H-}, @samp{\s-} and @samp{\A-}. Thus, | 399 | for these bits are @samp{\H-}, @samp{\s-} and @samp{\A-}. (Case is |
| 400 | @samp{?\H-\M-\A-x} represents @kbd{Alt-Hyper-Meta-x}. | 400 | significant in these prefixes.) Thus, @samp{?\H-\M-\A-x} represents |
| 401 | @kbd{Alt-Hyper-Meta-x}. | ||
| 401 | @tex | 402 | @tex |
| 402 | Numerically, the | 403 | Numerically, the |
| 403 | bit values are $2^{22}$ for alt, $2^{23}$ for super and $2^{24}$ for hyper. | 404 | bit values are $2^{22}$ for alt, $2^{23}$ for super and $2^{24}$ for hyper. |
| @@ -882,9 +883,9 @@ character code, using a hex escape, @samp{\x@var{nnnnnnn}}, with as many | |||
| 882 | digits as necessary. (Multibyte non-@sc{ASCII} character codes are all | 883 | digits as necessary. (Multibyte non-@sc{ASCII} character codes are all |
| 883 | greater than 256.) Any character which is not a valid hex digit | 884 | greater than 256.) Any character which is not a valid hex digit |
| 884 | terminates this construct. If the character that would follow is a hex | 885 | terminates this construct. If the character that would follow is a hex |
| 885 | digit, write @samp{\ } to terminate the hex escape---for example, | 886 | digit, write @w{@samp{\ }} to terminate the hex escape---for example, |
| 886 | @samp{\x8c0\ } represents one character, @samp{a} with grave accent. | 887 | @w{@samp{\x8c0\ }} represents one character, @samp{a} with grave accent. |
| 887 | @samp{\ } in a string constant is just like backslash-newline; it does | 888 | @w{@samp{\ }} in a string constant is just like backslash-newline; it does |
| 888 | not contribute any character to the string, but it does terminate the | 889 | not contribute any character to the string, but it does terminate the |
| 889 | preceding hex escape. | 890 | preceding hex escape. |
| 890 | 891 | ||
| @@ -899,30 +900,35 @@ text representations. | |||
| 899 | @node Nonprinting Characters | 900 | @node Nonprinting Characters |
| 900 | @subsubsection Nonprinting Characters in Strings | 901 | @subsubsection Nonprinting Characters in Strings |
| 901 | 902 | ||
| 902 | Strings cannot hold characters that have the hyper, super, or alt | ||
| 903 | modifiers; the only control or meta characters they can hold are the | ||
| 904 | @sc{ASCII} control characters. Strings do not distinguish case in | ||
| 905 | @sc{ASCII} control characters. | ||
| 906 | |||
| 907 | You can use the same backslash escape-sequences in a string constant | 903 | You can use the same backslash escape-sequences in a string constant |
| 908 | as in character literals (but do not use the question mark that begins a | 904 | as in character literals (but do not use the question mark that begins a |
| 909 | character constant). For example, you can write a string containing the | 905 | character constant). For example, you can write a string containing the |
| 910 | nonprinting characters tab, @kbd{C-a} and @kbd{M-C-a}, with commas and | 906 | nonprinting characters tab and @kbd{C-a}, with commas and spaces between |
| 911 | spaces between them, like this: @code{"\t, \C-a, \M-\C-a"}. | 907 | them, like this: @code{"\t, \C-a"}. @xref{Character Type}, for a |
| 912 | @xref{Character Type}, for a description of the read syntax for | 908 | description of the read syntax for characters. |
| 913 | characters. | 909 | |
| 914 | 910 | However, not all of the characters you can write with backslash | |
| 915 | If you use the @samp{\M-} syntax to indicate a meta character in a | 911 | escape-sequences are valid in strings. The only control characters that |
| 916 | string constant, this sets the | 912 | a string can hold are the @sc{ASCII} control characters. Strings do not |
| 913 | distinguish case in @sc{ASCII} control characters. | ||
| 914 | |||
| 915 | Properly speaking, strings cannot hold meta characters; but when a | ||
| 916 | string is to be used as a key sequence, there is a special convention | ||
| 917 | that allows the meta versions of @sc{ASCII} characters to be put in a | ||
| 918 | string. If you use the @samp{\M-} syntax to indicate a meta character | ||
| 919 | in a string constant, this sets the | ||
| 917 | @tex | 920 | @tex |
| 918 | $2^{7}$ | 921 | $2^{7}$ |
| 919 | @end tex | 922 | @end tex |
| 920 | @ifinfo | 923 | @ifinfo |
| 921 | 2**7 | 924 | 2**7 |
| 922 | @end ifinfo | 925 | @end ifinfo |
| 923 | bit of the character in the string. This construct works only with | 926 | bit of the character in the string. If the string is used in |
| 924 | ASCII characters. Note that the same meta characters have a different | 927 | @code{define-key} or @code{lookup-key}, this numeric code is translated |
| 925 | representation when not in a string. @xref{Character Type}. | 928 | into the equivalent meta character. @xref{Character Type}. |
| 929 | |||
| 930 | Strings cannot hold characters that have the hyper, super, or alt | ||
| 931 | modifiers. | ||
| 926 | 932 | ||
| 927 | @node Text Props and Strings | 933 | @node Text Props and Strings |
| 928 | @subsubsection Text Properties in Strings | 934 | @subsubsection Text Properties in Strings |
| @@ -960,7 +966,9 @@ represents a string whose textual contents are @samp{foo bar}, in which | |||
| 960 | the first three characters have a @code{face} property with value | 966 | the first three characters have a @code{face} property with value |
| 961 | @code{bold}, and the last three have a @code{face} property with value | 967 | @code{bold}, and the last three have a @code{face} property with value |
| 962 | @code{italic}. (The fourth character has no text properties so its | 968 | @code{italic}. (The fourth character has no text properties so its |
| 963 | property list is @code{nil}.) | 969 | property list is @code{nil}. It is not actually necessary to mention |
| 970 | ranges with @code{nil} as the property list, since any characters not | ||
| 971 | mentioned in any range will default to having no properties.) | ||
| 964 | 972 | ||
| 965 | @node Vector Type | 973 | @node Vector Type |
| 966 | @subsection Vector Type | 974 | @subsection Vector Type |
| @@ -1024,17 +1032,18 @@ that it begins with @samp{#&} followed by the length. The string | |||
| 1024 | constant that follows actually specifies the contents of the bool-vector | 1032 | constant that follows actually specifies the contents of the bool-vector |
| 1025 | as a bitmap---each ``character'' in the string contains 8 bits, which | 1033 | as a bitmap---each ``character'' in the string contains 8 bits, which |
| 1026 | specify the next 8 elements of the bool-vector (1 stands for @code{t}, | 1034 | specify the next 8 elements of the bool-vector (1 stands for @code{t}, |
| 1027 | and 0 for @code{nil}). If the length is not a multiple of 8, the | 1035 | and 0 for @code{nil}). The least significant bits of the character are |
| 1028 | printed representation describes extra elements, but these really | 1036 | the lowest-numbered elements of the bool-vector. If the length is not a |
| 1029 | make no difference. | 1037 | multiple of 8, the printed representation shows extra elements, but |
| 1038 | these extras really make no difference. | ||
| 1030 | 1039 | ||
| 1031 | @example | 1040 | @example |
| 1032 | (make-bool-vector 3 t) | 1041 | (make-bool-vector 3 t) |
| 1033 | @result{} #&3"\377" | 1042 | @result{} #&3"\007" |
| 1034 | (make-bool-vector 3 nil) | 1043 | (make-bool-vector 3 nil) |
| 1035 | @result{} #&3"\0"" | 1044 | @result{} #&3"\0" |
| 1036 | ;; @r{These are equal since only the first 3 bits are used.} | 1045 | ;; @r{These are equal since only the first 3 bits are used.} |
| 1037 | (equal #&3"\377" #&3"\340") | 1046 | (equal #&3"\377" #&3"\007") |
| 1038 | @result{} t | 1047 | @result{} t |
| 1039 | @end example | 1048 | @end example |
| 1040 | 1049 | ||
| @@ -1151,7 +1160,7 @@ symbol. @xref{Autoload}, for more details. | |||
| 1151 | @section Editing Types | 1160 | @section Editing Types |
| 1152 | @cindex editing types | 1161 | @cindex editing types |
| 1153 | 1162 | ||
| 1154 | The types in the previous section used for general programming | 1163 | The types in the previous section are used for general programming |
| 1155 | purposes, and most of them are common to most Lisp dialects. Emacs Lisp | 1164 | purposes, and most of them are common to most Lisp dialects. Emacs Lisp |
| 1156 | provides several additional data types for purposes connected with | 1165 | provides several additional data types for purposes connected with |
| 1157 | editing. | 1166 | editing. |
| @@ -1288,7 +1297,7 @@ in any given window can change frequently. | |||
| 1288 | @node Frame Type | 1297 | @node Frame Type |
| 1289 | @subsection Frame Type | 1298 | @subsection Frame Type |
| 1290 | 1299 | ||
| 1291 | A @var{frame} is a rectangle on the screen that contains one or more | 1300 | A @dfn{frame} is a rectangle on the screen that contains one or more |
| 1292 | Emacs windows. A frame initially contains a single main window (plus | 1301 | Emacs windows. A frame initially contains a single main window (plus |
| 1293 | perhaps a minibuffer window) which you can subdivide vertically or | 1302 | perhaps a minibuffer window) which you can subdivide vertically or |
| 1294 | horizontally into smaller windows. | 1303 | horizontally into smaller windows. |
| @@ -1300,7 +1309,7 @@ uniquely). | |||
| 1300 | @example | 1309 | @example |
| 1301 | @group | 1310 | @group |
| 1302 | (selected-frame) | 1311 | (selected-frame) |
| 1303 | @result{} #<frame emacs@@mole.gnu.ai.mit.edu 0xdac80> | 1312 | @result{} #<frame emacs@@psilocin.gnu.org 0xdac80> |
| 1304 | @end group | 1313 | @end group |
| 1305 | @end example | 1314 | @end example |
| 1306 | 1315 | ||
| @@ -1668,10 +1677,10 @@ object. | |||
| 1668 | @end group | 1677 | @end group |
| 1669 | @end example | 1678 | @end example |
| 1670 | 1679 | ||
| 1671 | (The @code{make-symbol} function returns an uninterned symbol that is | 1680 | The @code{make-symbol} function returns an uninterned symbol, distinct |
| 1672 | not interned in the standard @code{obarray}. When uninterned symbols | 1681 | from the symbol that is used if you write the name in a Lisp expression. |
| 1673 | are in use, symbol names are no longer unique. Distinct symbols with | 1682 | Distinct symbols with the same name are not @code{eq}. @xref{Creating |
| 1674 | the same name are not @code{eq}. @xref{Creating Symbols}.) | 1683 | Symbols}. |
| 1675 | 1684 | ||
| 1676 | @example | 1685 | @example |
| 1677 | @group | 1686 | @group |
diff --git a/lispref/os.texi b/lispref/os.texi index a9d58c55aef..b3764422dff 100644 --- a/lispref/os.texi +++ b/lispref/os.texi | |||
| @@ -55,6 +55,14 @@ it is started up is as follows: | |||
| 55 | 55 | ||
| 56 | @enumerate | 56 | @enumerate |
| 57 | @item | 57 | @item |
| 58 | It adds subdirectories to @code{load-path}, by running the file | ||
| 59 | named @file{subdirs.el} in each directory that is listed. | ||
| 60 | |||
| 61 | @item | ||
| 62 | It sets the language environment and the terminal coding system, | ||
| 63 | if requested by environment variables such as @code{LANG}. | ||
| 64 | |||
| 65 | @item | ||
| 58 | It loads the initialization library for the window system, if you are | 66 | It loads the initialization library for the window system, if you are |
| 59 | using a window system. This library's name is | 67 | using a window system. This library's name is |
| 60 | @file{term/@var{windowsystem}-win.el}. | 68 | @file{term/@var{windowsystem}-win.el}. |
| @@ -76,10 +84,9 @@ It loads the library @file{site-start}, unless the option | |||
| 76 | @cindex @file{site-start.el} | 84 | @cindex @file{site-start.el} |
| 77 | 85 | ||
| 78 | @item | 86 | @item |
| 79 | It loads the file @file{~/.emacs}, unless @samp{-q} was specified on the | 87 | It loads the file @file{~/.emacs}, unless @samp{-q} or @samp{-batch} was |
| 80 | command line. (This is not done in @samp{-batch} mode.) The @samp{-u} | 88 | specified on the command line. The @samp{-u} option can specify another |
| 81 | option can specify another user name whose home directory should be used | 89 | user name whose home directory should be used instead of @file{~}. |
| 82 | instead of @file{~}. | ||
| 83 | 90 | ||
| 84 | @item | 91 | @item |
| 85 | It loads the library @file{default}, unless @code{inhibit-default-init} | 92 | It loads the library @file{default}, unless @code{inhibit-default-init} |
| @@ -146,10 +153,11 @@ form to your @file{.emacs} file: | |||
| 146 | "@var{your-login-name}") | 153 | "@var{your-login-name}") |
| 147 | @end example | 154 | @end example |
| 148 | 155 | ||
| 149 | Simply setting @code{inhibit-startup-echo-area-message} to your login | 156 | Emacs explicitly checks for an expression as shown above in your |
| 150 | name is not sufficient to inhibit the message; Emacs explicitly checks | 157 | @file{.emacs} file; your login name must appear in the expression as a |
| 151 | whether @file{.emacs} contains an expression as shown above. Your login | 158 | Lisp string constant. Other methods of setting |
| 152 | name must appear in the expression as a Lisp string constant. | 159 | @code{inhibit-startup-echo-area-message} to the same value do not |
| 160 | inhibit the startup message. | ||
| 153 | 161 | ||
| 154 | This way, you can easily inhibit the message for yourself if you wish, | 162 | This way, you can easily inhibit the message for yourself if you wish, |
| 155 | but thoughtless copying of your @file{.emacs} file will not inhibit the | 163 | but thoughtless copying of your @file{.emacs} file will not inhibit the |
| @@ -206,9 +214,14 @@ then the default library is not loaded. The default value is | |||
| 206 | @end defopt | 214 | @end defopt |
| 207 | 215 | ||
| 208 | @defvar before-init-hook | 216 | @defvar before-init-hook |
| 209 | @defvarx after-init-hook | 217 | This normal hook is run, once, just before loading of all the init files |
| 210 | These two normal hooks are run just before, and just after, loading of | 218 | (the user's init file, @file{default.el}, and/or @file{site-start.el}). |
| 211 | the user's init file, @file{default.el}, and/or @file{site-start.el}. | 219 | @end defvar |
| 220 | |||
| 221 | @defvar after-init-hook | ||
| 222 | This normal hook is run, once, just after loading of all the init files | ||
| 223 | (the user's init file, @file{default.el}, and/or @file{site-start.el}), | ||
| 224 | before the terminal-specific initialization. | ||
| 212 | @end defvar | 225 | @end defvar |
| 213 | 226 | ||
| 214 | @node Terminal-Specific | 227 | @node Terminal-Specific |
| @@ -216,18 +229,12 @@ the user's init file, @file{default.el}, and/or @file{site-start.el}. | |||
| 216 | @cindex terminal-specific initialization | 229 | @cindex terminal-specific initialization |
| 217 | 230 | ||
| 218 | Each terminal type can have its own Lisp library that Emacs loads when | 231 | Each terminal type can have its own Lisp library that Emacs loads when |
| 219 | run on that type of terminal. For a terminal type named @var{termtype}, | 232 | run on that type of terminal. The library's name is constructed by |
| 220 | the library is called @file{term/@var{termtype}}. Emacs finds the file | 233 | concatenating the value of the variable @code{term-file-prefix} and the |
| 221 | by searching the @code{load-path} directories as it does for other | 234 | terminal type. Normally, @code{term-file-prefix} has the value |
| 222 | files, and trying the @samp{.elc} and @samp{.el} suffixes. Normally, | 235 | @code{"term/"}; changing this is not recommended. Emacs finds the file |
| 223 | terminal-specific Lisp library is located in @file{emacs/lisp/term}, a | 236 | in the normal manner, by searching the @code{load-path} directories, and |
| 224 | subdirectory of the @file{emacs/lisp} directory in which most Emacs Lisp | 237 | trying the @samp{.elc} and @samp{.el} suffixes. |
| 225 | libraries are kept.@refill | ||
| 226 | |||
| 227 | The library's name is constructed by concatenating the value of the | ||
| 228 | variable @code{term-file-prefix} and the terminal type. Normally, | ||
| 229 | @code{term-file-prefix} has the value @code{"term/"}; changing this | ||
| 230 | is not recommended. | ||
| 231 | 238 | ||
| 232 | The usual function of a terminal-specific library is to enable special | 239 | The usual function of a terminal-specific library is to enable special |
| 233 | keys to send sequences that Emacs can recognize. It may also need to | 240 | keys to send sequences that Emacs can recognize. It may also need to |
| @@ -620,7 +627,7 @@ systems. | |||
| 620 | This function returns the name of the machine you are running on. | 627 | This function returns the name of the machine you are running on. |
| 621 | @example | 628 | @example |
| 622 | (system-name) | 629 | (system-name) |
| 623 | @result{} "prep.ai.mit.edu" | 630 | @result{} "www.gnu.org" |
| 624 | @end example | 631 | @end example |
| 625 | @end defun | 632 | @end defun |
| 626 | 633 | ||
| @@ -719,19 +726,24 @@ locations, but can find them in a directory related somehow to the one | |||
| 719 | containing the Emacs executable. | 726 | containing the Emacs executable. |
| 720 | @end defvar | 727 | @end defvar |
| 721 | 728 | ||
| 722 | @defun load-average | 729 | @defun load-average &optional use-float |
| 723 | This function returns the current 1-minute, 5-minute and 15-minute load | 730 | This function returns the current 1-minute, 5-minute and 15-minute load |
| 724 | averages in a list. The values are integers that are 100 times the | 731 | averages in a list. |
| 725 | system load averages, which indicate the average number of processes | 732 | |
| 726 | trying to run. It would be more logical to use floating point numbers, | 733 | By default, the values are integers that are 100 times the system load |
| 727 | but this function was introduced before Emacs supported floating point | 734 | averages, which indicate the average number of processes trying to run. |
| 728 | numbers, and it is not worth changing it now. | 735 | If @var{use-float} is non-@code{nil}, then they are returned |
| 736 | as floating point numbers instead. | ||
| 729 | 737 | ||
| 730 | @example | 738 | @example |
| 731 | @group | 739 | @group |
| 732 | (load-average) | 740 | (load-average) |
| 733 | @result{} (169 48 36) | 741 | @result{} (169 48 36) |
| 734 | @end group | 742 | @end group |
| 743 | @group | ||
| 744 | (load-average t) | ||
| 745 | @result{} (1.69 0.48 0.36) | ||
| 746 | @end group | ||
| 735 | 747 | ||
| 736 | @group | 748 | @group |
| 737 | lewis@@rocky[5] % uptime | 749 | lewis@@rocky[5] % uptime |
| @@ -745,8 +757,8 @@ lewis@@rocky[5] % uptime | |||
| 745 | This function returns the process @sc{id} of the Emacs process. | 757 | This function returns the process @sc{id} of the Emacs process. |
| 746 | @end defun | 758 | @end defun |
| 747 | 759 | ||
| 748 | @tindex tty-erase-char | ||
| 749 | @defvar tty-erase-char | 760 | @defvar tty-erase-char |
| 761 | @tindex tty-erase-char | ||
| 750 | This variable holds the erase character that was selected | 762 | This variable holds the erase character that was selected |
| 751 | in the system's terminal driver, before Emacs was started. | 763 | in the system's terminal driver, before Emacs was started. |
| 752 | @end defvar | 764 | @end defvar |
| @@ -859,7 +871,7 @@ This function returns the effective @sc{uid} of the user. | |||
| 859 | zone. | 871 | zone. |
| 860 | 872 | ||
| 861 | @defun current-time-string &optional time-value | 873 | @defun current-time-string &optional time-value |
| 862 | This function returns the current time and date as a humanly-readable | 874 | This function returns the current time and date as a human-readable |
| 863 | string. The format of the string is unvarying; the number of characters | 875 | string. The format of the string is unvarying; the number of characters |
| 864 | used for each part is always the same, so you can reliably use | 876 | used for each part is always the same, so you can reliably use |
| 865 | @code{substring} to extract pieces of it. It is wise to count the | 877 | @code{substring} to extract pieces of it. It is wise to count the |
| @@ -1027,7 +1039,8 @@ This stands for the time zone abbreviation. | |||
| 1027 | You can also specify the field width and type of padding for any of | 1039 | You can also specify the field width and type of padding for any of |
| 1028 | these @samp{%}-sequences. This works as in @code{printf}: you write | 1040 | these @samp{%}-sequences. This works as in @code{printf}: you write |
| 1029 | the field width as digits in the middle of a @samp{%}-sequences. If you | 1041 | the field width as digits in the middle of a @samp{%}-sequences. If you |
| 1030 | start the field width with 0, it means to pad with zeros. | 1042 | start the field width with @samp{0}, it means to pad with zeros. If you |
| 1043 | start the field width with @samp{_}, it means to pad with spaces. | ||
| 1031 | 1044 | ||
| 1032 | For example, @samp{%S} specifies the number of seconds since the minute; | 1045 | For example, @samp{%S} specifies the number of seconds since the minute; |
| 1033 | @samp{%03S} means to pad this with zeros to 3 positions, @samp{%_3S} to | 1046 | @samp{%03S} means to pad this with zeros to 3 positions, @samp{%_3S} to |
| @@ -1101,6 +1114,9 @@ feature makes it possible to use the elements of a list returned by | |||
| 1101 | You can perform simple date arithmetic by using out-of-range values for | 1114 | You can perform simple date arithmetic by using out-of-range values for |
| 1102 | the @var{sec}, @var{minute}, @var{hour}, @var{day}, and @var{month} | 1115 | the @var{sec}, @var{minute}, @var{hour}, @var{day}, and @var{month} |
| 1103 | arguments; for example, day 0 means the day preceding the given month. | 1116 | arguments; for example, day 0 means the day preceding the given month. |
| 1117 | |||
| 1118 | The operating system puts limits on the range of possible time values; | ||
| 1119 | if you try to encode a time that is out of range, an error results. | ||
| 1104 | @end defun | 1120 | @end defun |
| 1105 | 1121 | ||
| 1106 | @node Timers | 1122 | @node Timers |
| @@ -1124,10 +1140,18 @@ later, and @var{args} are the arguments to give it when it is called. | |||
| 1124 | The time @var{time} is specified as a string. | 1140 | The time @var{time} is specified as a string. |
| 1125 | 1141 | ||
| 1126 | Absolute times may be specified in a wide variety of formats, and tries | 1142 | Absolute times may be specified in a wide variety of formats, and tries |
| 1127 | to accept all common date formats. One valid format is | 1143 | to accept all common date formats. Valid formats include these two, |
| 1128 | @samp{@var{hour}:@var{min}:@var{sec} @var{timezone} | 1144 | |
| 1129 | @var{month}/@var{day}/@var{year}}, where all fields are numbers; the | 1145 | @example |
| 1130 | format that @code{current-time-string} returns is also allowed. | 1146 | @var{year}-@var{month}-@var{day} @var{hour}:@var{min}:@var{sec} @var{timezone} |
| 1147 | |||
| 1148 | @var{hour}:@var{min}:@var{sec} @var{timezone} @var{month}/@var{day}/@var{year} | ||
| 1149 | @end example | ||
| 1150 | |||
| 1151 | @noindent | ||
| 1152 | where in both examples all fields are numbers; the format that | ||
| 1153 | @code{current-time-string} returns is also allowed, and many others | ||
| 1154 | as well. | ||
| 1131 | 1155 | ||
| 1132 | To specify a relative time, use numbers followed by units. | 1156 | To specify a relative time, use numbers followed by units. |
| 1133 | For example: | 1157 | For example: |
| @@ -1168,7 +1192,7 @@ the value of the last form in @var{body}. If, however, the execution of | |||
| 1168 | executes all the @var{timeout-forms} and returns the value of the last | 1192 | executes all the @var{timeout-forms} and returns the value of the last |
| 1169 | of them. | 1193 | of them. |
| 1170 | 1194 | ||
| 1171 | This macro works by set a timer to run after @var{seconds} seconds. If | 1195 | This macro works by setting a timer to run after @var{seconds} seconds. If |
| 1172 | @var{body} finishes before that time, it cancels the timer. If the | 1196 | @var{body} finishes before that time, it cancels the timer. If the |
| 1173 | timer actually runs, it terminates execution of @var{body}, then | 1197 | timer actually runs, it terminates execution of @var{body}, then |
| 1174 | executes @var{timeout-forms}. | 1198 | executes @var{timeout-forms}. |
| @@ -1290,8 +1314,8 @@ is non-@code{nil} when Emacs is using interrupt-driven input. If | |||
| 1290 | @code{nil}, Emacs is using @sc{cbreak} mode. | 1314 | @code{nil}, Emacs is using @sc{cbreak} mode. |
| 1291 | @item flow | 1315 | @item flow |
| 1292 | is non-@code{nil} if Emacs uses @sc{xon/xoff} (@kbd{C-q}, @kbd{C-s}) | 1316 | is non-@code{nil} if Emacs uses @sc{xon/xoff} (@kbd{C-q}, @kbd{C-s}) |
| 1293 | flow control for output to the terminal. This value has effect when | 1317 | flow control for output to the terminal. This value is meaningful only |
| 1294 | unless @var{interrupt} is @code{nil}. | 1318 | when @var{interrupt} is @code{nil}. |
| 1295 | @item meta | 1319 | @item meta |
| 1296 | is @code{t} if Emacs treats the eighth bit of input characters as | 1320 | is @code{t} if Emacs treats the eighth bit of input characters as |
| 1297 | the meta bit; @code{nil} means Emacs clears the eighth bit of every | 1321 | the meta bit; @code{nil} means Emacs clears the eighth bit of every |
| @@ -1365,7 +1389,7 @@ versa. (@xref{Flow Control} for more information on this subject.) | |||
| 1365 | @end group | 1389 | @end group |
| 1366 | @group | 1390 | @group |
| 1367 | (setq keyboard-translate-table | 1391 | (setq keyboard-translate-table |
| 1368 | (make-char-table 'keyboard-translate-table nil))) | 1392 | (make-char-table 'keyboard-translate-table nil)) |
| 1369 | @end group | 1393 | @end group |
| 1370 | @group | 1394 | @group |
| 1371 | ;; @r{Swap @kbd{C-s} and @kbd{C-\}.} | 1395 | ;; @r{Swap @kbd{C-s} and @kbd{C-\}.} |
diff --git a/lispref/positions.texi b/lispref/positions.texi index a414abb5dc7..e4f9a4cc7b8 100644 --- a/lispref/positions.texi +++ b/lispref/positions.texi | |||
| @@ -180,10 +180,13 @@ whether a given character is part of a word. @xref{Syntax Tables}. | |||
| 180 | 180 | ||
| 181 | @deffn Command forward-word count | 181 | @deffn Command forward-word count |
| 182 | This function moves point forward @var{count} words (or backward if | 182 | This function moves point forward @var{count} words (or backward if |
| 183 | @var{count} is negative). Normally it returns @code{t}. If this motion | 183 | @var{count} is negative). More precisely, it keeps moving until it |
| 184 | encounters the beginning or end of the buffer, or the limits of the | 184 | moves across a word-constituent character and encounters a |
| 185 | accessible portion when narrowing is in effect, point stops there | 185 | word-separator character, then returns @code{t}. |
| 186 | and the value is @code{nil}. | 186 | |
| 187 | If this motion encounters the beginning or end of the buffer, or the | ||
| 188 | limits of the accessible portion when narrowing is in effect, point | ||
| 189 | stops there and the value is @code{nil}. | ||
| 187 | 190 | ||
| 188 | In an interactive call, @var{count} is set to the numeric prefix | 191 | In an interactive call, @var{count} is set to the numeric prefix |
| 189 | argument. | 192 | argument. |
| @@ -450,7 +453,7 @@ Display}. | |||
| 450 | These functions scan text to determine where screen lines break, and | 453 | These functions scan text to determine where screen lines break, and |
| 451 | thus take time proportional to the distance scanned. If you intend to | 454 | thus take time proportional to the distance scanned. If you intend to |
| 452 | use them heavily, Emacs provides caches which may improve the | 455 | use them heavily, Emacs provides caches which may improve the |
| 453 | performance of your code. @xref{Text Lines, cache-long-line-scans}. | 456 | performance of your code. @xref{Truncation, cache-long-line-scans}. |
| 454 | 457 | ||
| 455 | 458 | ||
| 456 | @defun vertical-motion count &optional window | 459 | @defun vertical-motion count &optional window |
| @@ -507,7 +510,7 @@ normally, use @code{(window-width @var{window})}. | |||
| 507 | The argument @var{offsets} is either @code{nil} or a cons cell of the | 510 | The argument @var{offsets} is either @code{nil} or a cons cell of the |
| 508 | form @code{(@var{hscroll} . @var{tab-offset})}. Here @var{hscroll} is | 511 | form @code{(@var{hscroll} . @var{tab-offset})}. Here @var{hscroll} is |
| 509 | the number of columns not being displayed at the left margin; most | 512 | the number of columns not being displayed at the left margin; most |
| 510 | callers get this from @code{window-hscroll}. Meanwhile, | 513 | callers get this by calling @code{window-hscroll}. Meanwhile, |
| 511 | @var{tab-offset} is the offset between column numbers on the screen and | 514 | @var{tab-offset} is the offset between column numbers on the screen and |
| 512 | column numbers in the buffer. This can be nonzero in a continuation | 515 | column numbers in the buffer. This can be nonzero in a continuation |
| 513 | line, when the previous screen lines' widths do not add up to a multiple | 516 | line, when the previous screen lines' widths do not add up to a multiple |
| @@ -725,7 +728,7 @@ an abnormal exit via @code{throw} or error (@pxref{Nonlocal Exits}). | |||
| 725 | 728 | ||
| 726 | The @code{save-excursion} special form is the standard way to switch | 729 | The @code{save-excursion} special form is the standard way to switch |
| 727 | buffers or move point within one part of a program and avoid affecting | 730 | buffers or move point within one part of a program and avoid affecting |
| 728 | the rest of the program. It is used more than 500 times in the Lisp | 731 | the rest of the program. It is used more than 4000 times in the Lisp |
| 729 | sources of Emacs. | 732 | sources of Emacs. |
| 730 | 733 | ||
| 731 | @code{save-excursion} does not save the values of point and the mark for | 734 | @code{save-excursion} does not save the values of point and the mark for |
| @@ -759,6 +762,11 @@ The value returned by @code{save-excursion} is the result of the last of | |||
| 759 | @end example | 762 | @end example |
| 760 | @end defspec | 763 | @end defspec |
| 761 | 764 | ||
| 765 | @strong{Warning:} Ordinary insertion of text adjacent to the saved | ||
| 766 | point value relocates the saved value, just as it relocates all markers. | ||
| 767 | Therefore, when the saved point value is restored, it normally comes | ||
| 768 | after the inserted text. | ||
| 769 | |||
| 762 | Although @code{save-excursion} saves the location of the mark, it does | 770 | Although @code{save-excursion} saves the location of the mark, it does |
| 763 | not prevent functions which modify the buffer from setting | 771 | not prevent functions which modify the buffer from setting |
| 764 | @code{deactivate-mark}, and thus causing the deactivation of the mark | 772 | @code{deactivate-mark}, and thus causing the deactivation of the mark |
| @@ -857,7 +865,7 @@ of inaccessible text before and after the accessible portion. | |||
| 857 | 865 | ||
| 858 | This method yields correct results if @var{body} does further narrowing. | 866 | This method yields correct results if @var{body} does further narrowing. |
| 859 | However, @code{save-restriction} can become confused if the body widens | 867 | However, @code{save-restriction} can become confused if the body widens |
| 860 | and then make changes outside the range of the saved narrowing. When | 868 | and then makes changes outside the range of the saved narrowing. When |
| 861 | this is what you want to do, @code{save-restriction} is not the right | 869 | this is what you want to do, @code{save-restriction} is not the right |
| 862 | tool for the job. Here is what you must use instead: | 870 | tool for the job. Here is what you must use instead: |
| 863 | 871 | ||
diff --git a/lispref/processes.texi b/lispref/processes.texi index 94b8e61bdf3..8589348b282 100644 --- a/lispref/processes.texi +++ b/lispref/processes.texi | |||
| @@ -34,6 +34,7 @@ This function returns @code{t} if @var{object} is a process, | |||
| 34 | 34 | ||
| 35 | @menu | 35 | @menu |
| 36 | * Subprocess Creation:: Functions that start subprocesses. | 36 | * Subprocess Creation:: Functions that start subprocesses. |
| 37 | * Shell Arguments:: Quoting an argument to pass it to a shell. | ||
| 37 | * Synchronous Processes:: Details of using synchronous subprocesses. | 38 | * Synchronous Processes:: Details of using synchronous subprocesses. |
| 38 | * Asynchronous Processes:: Starting up an asynchronous subprocess. | 39 | * Asynchronous Processes:: Starting up an asynchronous subprocess. |
| 39 | * Deleting Processes:: Eliminating an asynchronous subprocess. | 40 | * Deleting Processes:: Eliminating an asynchronous subprocess. |
| @@ -190,8 +191,6 @@ process terminated. | |||
| 190 | coding system, much like text read from a file. The input sent to a | 191 | coding system, much like text read from a file. The input sent to a |
| 191 | subprocess by @code{call-process-region} is encoded using a coding | 192 | subprocess by @code{call-process-region} is encoded using a coding |
| 192 | system, much like text written into a file. @xref{Coding Systems}. | 193 | system, much like text written into a file. @xref{Coding Systems}. |
| 193 | On Microsoft operating systems, additional variables control | ||
| 194 | the conversion for end-of-line (@pxref{MS-DOS Subprocesses}). | ||
| 195 | 194 | ||
| 196 | @defun call-process program &optional infile destination display &rest args | 195 | @defun call-process program &optional infile destination display &rest args |
| 197 | This function calls @var{program} in a separate process and waits for | 196 | This function calls @var{program} in a separate process and waits for |
| @@ -240,9 +239,14 @@ buffer. | |||
| 240 | @end table | 239 | @end table |
| 241 | 240 | ||
| 242 | If @var{display} is non-@code{nil}, then @code{call-process} redisplays | 241 | If @var{display} is non-@code{nil}, then @code{call-process} redisplays |
| 243 | the buffer as output is inserted. Otherwise the function does no | 242 | the buffer as output is inserted. (However, if the coding system chosen |
| 244 | redisplay, and the results become visible on the screen only when Emacs | 243 | for decoding output is @code{undecided}, meaning deduce the encoding |
| 245 | redisplays that buffer in the normal course of events. | 244 | from the actual data, then redisplay sometimes cannot continue once |
| 245 | non-@sc{ASCII} characters are encountered. There are fundamental | ||
| 246 | reasons why it is hard to fix this.) Otherwise the function | ||
| 247 | @code{call-process} does no redisplay, and the results become visible on | ||
| 248 | the screen only when Emacs redisplays that buffer in the normal course | ||
| 249 | of events. | ||
| 246 | 250 | ||
| 247 | The remaining arguments, @var{args}, are strings that specify command | 251 | The remaining arguments, @var{args}, are strings that specify command |
| 248 | line arguments for the program. | 252 | line arguments for the program. |
| @@ -351,8 +355,8 @@ inputinput@point{} | |||
| 351 | @end smallexample | 355 | @end smallexample |
| 352 | @end defun | 356 | @end defun |
| 353 | 357 | ||
| 354 | @tindex shell-command-to-string | ||
| 355 | @defun shell-command-to-string command | 358 | @defun shell-command-to-string command |
| 359 | @tindex shell-command-to-string | ||
| 356 | This function executes @var{command} (a string) as a shell command, | 360 | This function executes @var{command} (a string) as a shell command, |
| 357 | then returns the command's output as a string. | 361 | then returns the command's output as a string. |
| 358 | @end defun | 362 | @end defun |
| @@ -362,10 +366,15 @@ then returns the command's output as a string. | |||
| 362 | @cindex asynchronous subprocess | 366 | @cindex asynchronous subprocess |
| 363 | 367 | ||
| 364 | After an @dfn{asynchronous process} is created, Emacs and the Lisp | 368 | After an @dfn{asynchronous process} is created, Emacs and the Lisp |
| 365 | program both continue running immediately. The process may thereafter | 369 | program both continue running immediately. The process thereafter runs |
| 366 | run in parallel with Emacs, and the two may communicate with each other | 370 | in parallel with Emacs, and the two can communicate with each other |
| 367 | using the functions described in following sections. Here we describe | 371 | using the functions described in following sections. However, |
| 368 | how to create an asynchronous process with @code{start-process}. | 372 | communication is only partially asynchronous: Emacs sends data to the |
| 373 | 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 | ||
| 375 | delay. | ||
| 376 | |||
| 377 | Here we describe how to create an asynchronous process. | ||
| 369 | 378 | ||
| 370 | @defun start-process name buffer-or-name program &rest args | 379 | @defun start-process name buffer-or-name program &rest args |
| 371 | This function creates a new asynchronous subprocess and starts the | 380 | This function creates a new asynchronous subprocess and starts the |
| @@ -570,8 +579,8 @@ process is started and remains constant as long as the process exists. | |||
| 570 | This function returns the name of @var{process}. | 579 | This function returns the name of @var{process}. |
| 571 | @end defun | 580 | @end defun |
| 572 | 581 | ||
| 573 | @tindex process-contact | ||
| 574 | @defun process-contact process | 582 | @defun process-contact process |
| 583 | @tindex process-contact | ||
| 575 | This function returns @code{t} for an ordinary child process, and | 584 | This function returns @code{t} for an ordinary child process, and |
| 576 | @code{(@var{hostname} @var{service})} for a net connection | 585 | @code{(@var{hostname} @var{service})} for a net connection |
| 577 | (@pxref{Network}). | 586 | (@pxref{Network}). |
| @@ -639,8 +648,8 @@ instead of a terminal (see @code{process-connection-type} in | |||
| 639 | @ref{Asynchronous Processes}). | 648 | @ref{Asynchronous Processes}). |
| 640 | @end defun | 649 | @end defun |
| 641 | 650 | ||
| 642 | @tindex process-coding-system | ||
| 643 | @defun process-coding-system process | 651 | @defun process-coding-system process |
| 652 | @tindex process-coding-system | ||
| 644 | This function returns a cons cell describing the coding systems in use | 653 | This function returns a cons cell describing the coding systems in use |
| 645 | for decoding output from @var{process} and for encoding input to | 654 | for decoding output from @var{process} and for encoding input to |
| 646 | @var{process} (@pxref{Coding Systems}). The value has this form: | 655 | @var{process} (@pxref{Coding Systems}). The value has this form: |
| @@ -650,8 +659,8 @@ for decoding output from @var{process} and for encoding input to | |||
| 650 | @end example | 659 | @end example |
| 651 | @end defun | 660 | @end defun |
| 652 | 661 | ||
| 653 | @tindex set-process-coding-system | ||
| 654 | @defun set-process-coding-system process decoding-system encoding-system | 662 | @defun set-process-coding-system process decoding-system encoding-system |
| 663 | @tindex set-process-coding-system | ||
| 655 | This function specifies the coding systems to use for subsequent output | 664 | This function specifies the coding systems to use for subsequent output |
| 656 | from and input to @var{process}. It will use @var{decoding-system} to | 665 | from and input to @var{process}. It will use @var{decoding-system} to |
| 657 | decode subprocess output, and @var{encoding-system} to encode subprocess | 666 | decode subprocess output, and @var{encoding-system} to encode subprocess |
| @@ -673,8 +682,11 @@ the other characters, to force them through. For most programs, | |||
| 673 | these @sc{eof}s do no harm. | 682 | these @sc{eof}s do no harm. |
| 674 | 683 | ||
| 675 | Subprocess input is normally encoded using a coding system before the | 684 | Subprocess input is normally encoded using a coding system before the |
| 676 | subprocess receives it, much like text written into a file. | 685 | subprocess receives it, much like text written into a file. You can use |
| 677 | @xref{Coding Systems}. | 686 | @code{set-process-coding-system} to specify which coding system to use |
| 687 | (@pxref{Process Information}). Otherwise, the coding system comes from | ||
| 688 | @code{coding-system-for-write}, if that is non-@code{nil}; or else from | ||
| 689 | the defaulting mechanism (@pxref{Default Coding Systems}). | ||
| 678 | 690 | ||
| 679 | @defun process-send-string process-name string | 691 | @defun process-send-string process-name string |
| 680 | This function sends @var{process-name} the contents of @var{string} as | 692 | This function sends @var{process-name} the contents of @var{string} as |
| @@ -838,9 +850,32 @@ called the @dfn{filter function} can be called to act on the output. If | |||
| 838 | the process has no buffer and no filter function, its output is | 850 | the process has no buffer and no filter function, its output is |
| 839 | discarded. | 851 | discarded. |
| 840 | 852 | ||
| 853 | Output from a subprocess can arrive only while Emacs is waiting: when | ||
| 854 | reading terminal input, in @code{sit-for} and @code{sleep-for} | ||
| 855 | (@pxref{Waiting}), and in @code{accept-process-output} (@pxref{Accepting | ||
| 856 | Output}). This minimizes the problem of timing errors that usually | ||
| 857 | plague parallel programming. For example, you can safely create a | ||
| 858 | process and only then specify its buffer or filter function; no output | ||
| 859 | can arrive before you finish, if the code in between does not call any | ||
| 860 | primitive that waits. | ||
| 861 | |||
| 841 | Subprocess output is normally decoded using a coding system before the | 862 | Subprocess output is normally decoded using a coding system before the |
| 842 | buffer or filter function receives it, much like text read from a file. | 863 | buffer or filter function receives it, much like text read from a file. |
| 843 | @xref{Coding Systems}. | 864 | You can use @code{set-process-coding-system} to specify which coding |
| 865 | system to use (@pxref{Process Information}). Otherwise, the coding | ||
| 866 | system comes from @code{coding-system-for-read}, if that is | ||
| 867 | non-@code{nil}; or else from the defaulting mechanism (@pxref{Default | ||
| 868 | Coding Systems}). | ||
| 869 | |||
| 870 | @strong{Warning:} Coding systems such as @code{undecided} which | ||
| 871 | determine the coding system from the data do not work entirely reliably | ||
| 872 | with asynchronous subprocess output. This is because Emacs has to | ||
| 873 | process asynchronous subprocess output in batches, as it arrives. Emacs | ||
| 874 | must try to detect the proper coding system from one batch at a time, | ||
| 875 | and this does not always work. Therefore, if at all possible, use a | ||
| 876 | coding system which determines both the character code conversion and | ||
| 877 | the end of line conversion---that is, one like @code{latin-1-unix}, | ||
| 878 | rather than @code{undecided} or @code{latin-1}. | ||
| 844 | 879 | ||
| 845 | @menu | 880 | @menu |
| 846 | * Process Buffers:: If no filter, output is put in a buffer. | 881 | * Process Buffers:: If no filter, output is put in a buffer. |
| @@ -934,19 +969,16 @@ then @emph{all} output from that process is passed to the filter. The | |||
| 934 | process buffer is used directly for output from the process only when | 969 | process buffer is used directly for output from the process only when |
| 935 | there is no filter. | 970 | there is no filter. |
| 936 | 971 | ||
| 972 | The filter function can only be called when Emacs is waiting for | ||
| 973 | something, because process output arrives only at such times. Emacs | ||
| 974 | waits when reading terminal input, in @code{sit-for} and | ||
| 975 | @code{sleep-for} (@pxref{Waiting}), and in @code{accept-process-output} | ||
| 976 | (@pxref{Accepting Output}). | ||
| 977 | |||
| 937 | A filter function must accept two arguments: the associated process | 978 | A filter function must accept two arguments: the associated process |
| 938 | and a string, which is output just received from it. The function is | 979 | and a string, which is output just received from it. The function is |
| 939 | then free to do whatever it chooses with the output. | 980 | then free to do whatever it chooses with the output. |
| 940 | 981 | ||
| 941 | A filter function runs only while Emacs is waiting (e.g., for terminal | ||
| 942 | input, or for time to elapse, or for process output). This avoids the | ||
| 943 | timing errors that could result from running filters at random places in | ||
| 944 | the middle of other Lisp programs. You may explicitly cause Emacs to | ||
| 945 | wait, so that filter functions will run, by calling @code{sit-for} or | ||
| 946 | @code{sleep-for} (@pxref{Waiting}), or @code{accept-process-output} | ||
| 947 | (@pxref{Accepting Output}). Emacs is also waiting when the command loop | ||
| 948 | is reading input. | ||
| 949 | |||
| 950 | Quitting is normally inhibited within a filter function---otherwise, | 982 | Quitting is normally inhibited within a filter function---otherwise, |
| 951 | the effect of typing @kbd{C-g} at command level or to quit a user | 983 | the effect of typing @kbd{C-g} at command level or to quit a user |
| 952 | command would be unpredictable. If you want to permit quitting inside a | 984 | command would be unpredictable. If you want to permit quitting inside a |
| @@ -1161,7 +1193,8 @@ errors that could result from running them at random places in the | |||
| 1161 | middle of other Lisp programs. A program can wait, so that sentinels | 1193 | middle of other Lisp programs. A program can wait, so that sentinels |
| 1162 | will run, by calling @code{sit-for} or @code{sleep-for} | 1194 | will run, by calling @code{sit-for} or @code{sleep-for} |
| 1163 | (@pxref{Waiting}), or @code{accept-process-output} (@pxref{Accepting | 1195 | (@pxref{Waiting}), or @code{accept-process-output} (@pxref{Accepting |
| 1164 | Output}). Emacs is also waiting when the command loop is reading input. | 1196 | Output}). Emacs also allows sentinels to run when the command loop is |
| 1197 | reading input. | ||
| 1165 | 1198 | ||
| 1166 | Quitting is normally inhibited within a sentinel---otherwise, the | 1199 | Quitting is normally inhibited within a sentinel---otherwise, the |
| 1167 | effect of typing @kbd{C-g} at command level or to quit a user command | 1200 | effect of typing @kbd{C-g} at command level or to quit a user command |
diff --git a/lispref/searching.texi b/lispref/searching.texi index 336865c5642..7ba8a9fe666 100644 --- a/lispref/searching.texi +++ b/lispref/searching.texi | |||
| @@ -231,11 +231,12 @@ this choice, the rest of the regexp matches successfully.@refill | |||
| 231 | 231 | ||
| 232 | Nested repetition operators can be extremely slow if they specify | 232 | Nested repetition operators can be extremely slow if they specify |
| 233 | backtracking loops. For example, it could take hours for the regular | 233 | backtracking loops. For example, it could take hours for the regular |
| 234 | expression @samp{\(x+y*\)*a} to match the sequence | 234 | expression @samp{\(x+y*\)*a} to try to match the sequence |
| 235 | @samp{xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxz}. The slowness is because | 235 | @samp{xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxz}, before it ultimately fails. |
| 236 | Emacs must try each imaginable way of grouping the 35 @samp{x}'s before | 236 | The slowness is because Emacs must try each imaginable way of grouping |
| 237 | concluding that none of them can work. To make sure your regular | 237 | the 35 @samp{x}'s before concluding that none of them can work. To make |
| 238 | expressions run fast, check nested repetitions carefully. | 238 | sure your regular expressions run fast, check nested repetitions |
| 239 | carefully. | ||
| 239 | 240 | ||
| 240 | @item @samp{+} | 241 | @item @samp{+} |
| 241 | @cindex @samp{+} in regexp | 242 | @cindex @samp{+} in regexp |
| @@ -281,7 +282,7 @@ representations, because only the @sc{ASCII} characters are excluded. | |||
| 281 | The beginning and end of a range must be in the same character set | 282 | The beginning and end of a range must be in the same character set |
| 282 | (@pxref{Character Sets}). Thus, @samp{[a-\x8c0]} is invalid because | 283 | (@pxref{Character Sets}). Thus, @samp{[a-\x8c0]} is invalid because |
| 283 | @samp{a} is in the @sc{ASCII} character set but the character 0x8c0 | 284 | @samp{a} is in the @sc{ASCII} character set but the character 0x8c0 |
| 284 | (@samp{a} with grave accent) is in the Latin-1 character set. | 285 | (@samp{A} with grave accent) is in the Emacs character set for Latin-1. |
| 285 | 286 | ||
| 286 | 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 |
| 287 | character alternative. A completely different set of characters are | 288 | character alternative. A completely different set of characters are |
| @@ -354,11 +355,11 @@ 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 | 355 | can act. It is poor practice to depend on this behavior; quote the |
| 355 | special character anyway, regardless of where it appears.@refill | 356 | special character anyway, regardless of where it appears.@refill |
| 356 | 357 | ||
| 357 | For the most part, @samp{\} followed by any character matches only | 358 | For the most part, @samp{\} followed by any character matches only that |
| 358 | that character. However, there are several exceptions: two-character | 359 | character. However, there are several exceptions: two-character |
| 359 | sequences starting with @samp{\} which have special meanings. The | 360 | sequences starting with @samp{\} which have special meanings. (The |
| 360 | second character in the sequence is always an ordinary character on | 361 | second character in such a sequence is always ordinary when used on its |
| 361 | their own. Here is a table of @samp{\} constructs. | 362 | own.) Here is a table of @samp{\} constructs. |
| 362 | 363 | ||
| 363 | @table @samp | 364 | @table @samp |
| 364 | @item \| | 365 | @item \| |
| @@ -393,8 +394,8 @@ or @samp{barx}. | |||
| 393 | @item | 394 | @item |
| 394 | To enclose a complicated expression for the postfix operators @samp{*}, | 395 | To enclose a complicated expression for the postfix operators @samp{*}, |
| 395 | @samp{+} and @samp{?} to operate on. Thus, @samp{ba\(na\)*} matches | 396 | @samp{+} and @samp{?} to operate on. Thus, @samp{ba\(na\)*} matches |
| 396 | @samp{bananana}, etc., with any (zero or more) number of @samp{na} | 397 | @samp{ba}, @samp{bana}, @samp{banana}, @samp{bananana}, etc., with any |
| 397 | strings.@refill | 398 | number (zero or more) of @samp{na} strings. |
| 398 | 399 | ||
| 399 | @item | 400 | @item |
| 400 | To record a matched substring for future reference. | 401 | To record a matched substring for future reference. |
| @@ -530,8 +531,8 @@ whitespace: | |||
| 530 | @end example | 531 | @end example |
| 531 | @end defun | 532 | @end defun |
| 532 | 533 | ||
| 533 | @tindex regexp-opt | ||
| 534 | @defun regexp-opt strings &optional paren | 534 | @defun regexp-opt strings &optional paren |
| 535 | @tindex regexp-opt | ||
| 535 | This function returns an efficient regular expression that will match | 536 | 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 | 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 | matching or searching as fast as possible---for example, for Font Lock |
| @@ -555,8 +556,8 @@ regular expression which is equivalent to the actual value | |||
| 555 | @end example | 556 | @end example |
| 556 | @end defun | 557 | @end defun |
| 557 | 558 | ||
| 558 | @tindex regexp-opt-depth | ||
| 559 | @defun regexp-opt-depth regexp | 559 | @defun regexp-opt-depth regexp |
| 560 | @tindex regexp-opt-depth | ||
| 560 | This function returns the total number of grouping constructs | 561 | This function returns the total number of grouping constructs |
| 561 | (parenthesized expressions) in @var{regexp}. | 562 | (parenthesized expressions) in @var{regexp}. |
| 562 | @end defun | 563 | @end defun |
| @@ -1091,6 +1092,10 @@ subexpression is numbered 1, the second 2, and so on. Only regular | |||
| 1091 | expressions can have subexpressions---after a simple string search, the | 1092 | expressions can have subexpressions---after a simple string search, the |
| 1092 | only information available is about the entire match. | 1093 | only information available is about the entire match. |
| 1093 | 1094 | ||
| 1095 | A search which fails may or may not alter the match data. In the | ||
| 1096 | past, a failing search did not do this, but we may change it in the | ||
| 1097 | future. | ||
| 1098 | |||
| 1094 | @defun match-string count &optional in-string | 1099 | @defun match-string count &optional in-string |
| 1095 | This function returns, as a string, the text matched in the last search | 1100 | This function returns, as a string, the text matched in the last search |
| 1096 | or match operation. It returns the entire text if @var{count} is zero, | 1101 | or match operation. It returns the entire text if @var{count} is zero, |
diff --git a/lispref/sequences.texi b/lispref/sequences.texi index 8f19d6f9a1b..26263831d1c 100644 --- a/lispref/sequences.texi +++ b/lispref/sequences.texi | |||
| @@ -82,7 +82,7 @@ This function returns the number of elements in @var{sequence}. If | |||
| 82 | @sc{cdr} is not @code{nil}), a @code{wrong-type-argument} error is | 82 | @sc{cdr} is not @code{nil}), a @code{wrong-type-argument} error is |
| 83 | signaled. | 83 | signaled. |
| 84 | 84 | ||
| 85 | @xref{List Elements}, for the related function @code{safe-list}. | 85 | @xref{List Elements}, for the related function @code{safe-length}. |
| 86 | 86 | ||
| 87 | @example | 87 | @example |
| 88 | @group | 88 | @group |
| @@ -132,11 +132,11 @@ otherwise, they trigger an @code{args-out-of-range} error. | |||
| 132 | @end group | 132 | @end group |
| 133 | @group | 133 | @group |
| 134 | (elt [1 2 3 4] 4) | 134 | (elt [1 2 3 4] 4) |
| 135 | @error{}Args out of range: [1 2 3 4], 4 | 135 | @error{} Args out of range: [1 2 3 4], 4 |
| 136 | @end group | 136 | @end group |
| 137 | @group | 137 | @group |
| 138 | (elt [1 2 3 4] -1) | 138 | (elt [1 2 3 4] -1) |
| 139 | @error{}Args out of range: [1 2 3 4], -1 | 139 | @error{} Args out of range: [1 2 3 4], -1 |
| 140 | @end group | 140 | @end group |
| 141 | @end example | 141 | @end example |
| 142 | 142 | ||
| @@ -218,12 +218,12 @@ be accessed in constant time. In contrast, an element of a list | |||
| 218 | requires access time that is proportional to the position of the element | 218 | requires access time that is proportional to the position of the element |
| 219 | in the list. | 219 | in the list. |
| 220 | 220 | ||
| 221 | Emacs defines four types of array, both of which are one-dimensional: | 221 | Emacs defines four types of array, all one-dimensional: @dfn{strings}, |
| 222 | @dfn{strings}, @dfn{vectors}, @dfn{bool-vectors} and @dfn{char-tables}. | 222 | @dfn{vectors}, @dfn{bool-vectors} and @dfn{char-tables}. A vector is a |
| 223 | A vector is a general array; its elements can be any Lisp objects. A | 223 | general array; its elements can be any Lisp objects. A string is a |
| 224 | string is a specialized array; its elements must be characters (i.e., | 224 | specialized array; its elements must be characters (i.e., integers |
| 225 | integers between 0 and 255). Each type of array has its own read | 225 | between 0 and 255). Each type of array has its own read syntax. |
| 226 | syntax. @xref{String Type}, and @ref{Vector Type}. | 226 | @xref{String Type}, and @ref{Vector Type}. |
| 227 | 227 | ||
| 228 | All four kinds of array share these characteristics: | 228 | All four kinds of array share these characteristics: |
| 229 | 229 | ||
| @@ -347,8 +347,8 @@ If @var{array} is a string and @var{object} is not a character, a | |||
| 347 | @code{wrong-type-argument} error results. If @var{array} is a string | 347 | @code{wrong-type-argument} error results. If @var{array} is a string |
| 348 | and @var{object} is character, but @var{object} does not use the same | 348 | and @var{object} is character, but @var{object} does not use the same |
| 349 | number of bytes as the character currently stored in @code{(aref | 349 | number of bytes as the character currently stored in @code{(aref |
| 350 | @var{object} @var{index})}, that is also an error. @xref{Chars and | 350 | @var{object} @var{index})}, that is also an error. @xref{Splitting |
| 351 | Bytes}. | 351 | Characters}. |
| 352 | @end defun | 352 | @end defun |
| 353 | 353 | ||
| 354 | @defun fillarray array object | 354 | @defun fillarray array object |
| @@ -520,19 +520,25 @@ list with the same elements (@pxref{Building Lists}): | |||
| 520 | @node Char-Tables | 520 | @node Char-Tables |
| 521 | @section Char-Tables | 521 | @section Char-Tables |
| 522 | @cindex char-tables | 522 | @cindex char-tables |
| 523 | @cindex extra slots of char-table | ||
| 523 | 524 | ||
| 524 | A char-table is much like a vector, except that it is indexed by | 525 | A char-table is much like a vector, except that it is indexed by |
| 525 | character codes. Any valid character code, without modifiers, can be | 526 | character codes. Any valid character code, without modifiers, can be |
| 526 | used as an index in a char-table. You can access a char-table's | 527 | used as an index in a char-table. You can access a char-table's |
| 527 | elements with @code{aref} and @code{aset}, as with any array. | 528 | elements with @code{aref} and @code{aset}, as with any array. In |
| 528 | Char-tables are constants when evaluated. | 529 | addition, a char-table can have @dfn{extra slots} to hold additional |
| 530 | data not associated with particular character codes. Char-tables are | ||
| 531 | constants when evaluated. | ||
| 529 | 532 | ||
| 530 | @cindex extra slots of char-table | ||
| 531 | @cindex subtype of char-table | 533 | @cindex subtype of char-table |
| 532 | Each char-table has a @dfn{subtype} which is a symbol. In order to be | 534 | Each char-table has a @dfn{subtype} which is a symbol. The subtype |
| 533 | a valid subtype, a symbol must have a @code{char-table-extra-slots} | 535 | has two purposes: to distinguish char-tables meant for different uses, |
| 534 | property which is an integer between 0 and 10. This integer specifies | 536 | and to control the number of extra slots. For example, display tables |
| 535 | the number of @dfn{extra slots} in the char-table. | 537 | are char-tables with @code{display-table} as the subtype, and syntax |
| 538 | tables are char-tables with @code{syntax-table} as the subtype. A valid | ||
| 539 | subtype must have a @code{char-table-extra-slots} property which is an | ||
| 540 | integer between 0 and 10. This integer specifies the number of | ||
| 541 | @dfn{extra slots} in the char-table. | ||
| 536 | 542 | ||
| 537 | @cindex parent of char-table | 543 | @cindex parent of char-table |
| 538 | A char-table can have a @dfn{parent}. which is another char-table. If | 544 | A char-table can have a @dfn{parent}. which is another char-table. If |
| @@ -547,8 +553,8 @@ specifies @code{nil}. | |||
| 547 | @code{(aref @var{char-table} @var{c})} returns the default value | 553 | @code{(aref @var{char-table} @var{c})} returns the default value |
| 548 | whenever the char-table does not specify any other non-@code{nil} value. | 554 | whenever the char-table does not specify any other non-@code{nil} value. |
| 549 | 555 | ||
| 550 | @tindex make-char-table | ||
| 551 | @defun make-char-table subtype &optional init | 556 | @defun make-char-table subtype &optional init |
| 557 | @tindex make-char-table | ||
| 552 | Return a newly created char-table, with subtype @var{subtype}. Each | 558 | Return a newly created char-table, with subtype @var{subtype}. Each |
| 553 | element is initialized to @var{init}, which defaults to @code{nil}. You | 559 | element is initialized to @var{init}, which defaults to @code{nil}. You |
| 554 | cannot alter the subtype of a char-table after the char-table is | 560 | cannot alter the subtype of a char-table after the char-table is |
| @@ -558,19 +564,19 @@ There is no argument to specify the length of the char-table, because | |||
| 558 | all char-tables have room for any valid character code as an index. | 564 | all char-tables have room for any valid character code as an index. |
| 559 | @end defun | 565 | @end defun |
| 560 | 566 | ||
| 561 | @tindex char-table-p | ||
| 562 | @defun char-table-p object | 567 | @defun char-table-p object |
| 568 | @tindex char-table-p | ||
| 563 | This function returns @code{t} if @var{object} is a char-table, | 569 | This function returns @code{t} if @var{object} is a char-table, |
| 564 | otherwise @code{nil}. | 570 | otherwise @code{nil}. |
| 565 | @end defun | 571 | @end defun |
| 566 | 572 | ||
| 567 | @tindex char-table-subtype | ||
| 568 | @defun char-table-subtype char-table | 573 | @defun char-table-subtype char-table |
| 574 | @tindex char-table-subtype | ||
| 569 | This function returns the subtype symbol of @var{char-table}. | 575 | This function returns the subtype symbol of @var{char-table}. |
| 570 | @end defun | 576 | @end defun |
| 571 | 577 | ||
| 572 | @tindex set-char-table-default | ||
| 573 | @defun set-char-table-default char-table new-default | 578 | @defun set-char-table-default char-table new-default |
| 579 | @tindex set-char-table-default | ||
| 574 | This function sets the default value of @var{char-table} to | 580 | This function sets the default value of @var{char-table} to |
| 575 | @var{new-default}. | 581 | @var{new-default}. |
| 576 | 582 | ||
| @@ -578,26 +584,26 @@ There is no special function to access the default value of a char-table. | |||
| 578 | To do that, use @code{(char-table-range @var{char-table} nil)}. | 584 | To do that, use @code{(char-table-range @var{char-table} nil)}. |
| 579 | @end defun | 585 | @end defun |
| 580 | 586 | ||
| 581 | @tindex char-table-parent | ||
| 582 | @defun char-table-parent char-table | 587 | @defun char-table-parent char-table |
| 588 | @tindex char-table-parent | ||
| 583 | This function returns the parent of @var{char-table}. The parent is | 589 | This function returns the parent of @var{char-table}. The parent is |
| 584 | always either @code{nil} or another char-table. | 590 | always either @code{nil} or another char-table. |
| 585 | @end defun | 591 | @end defun |
| 586 | 592 | ||
| 587 | @tindex set-char-table-parent | ||
| 588 | @defun set-char-table-parent char-table new-parent | 593 | @defun set-char-table-parent char-table new-parent |
| 594 | @tindex set-char-table-parent | ||
| 589 | This function sets the parent of @var{char-table} to @var{new-parent}. | 595 | This function sets the parent of @var{char-table} to @var{new-parent}. |
| 590 | @end defun | 596 | @end defun |
| 591 | 597 | ||
| 592 | @tindex char-table-extra-slot | ||
| 593 | @defun char-table-extra-slot char-table n | 598 | @defun char-table-extra-slot char-table n |
| 599 | @tindex char-table-extra-slot | ||
| 594 | This function returns the contents of extra slot @var{n} of | 600 | This function returns the contents of extra slot @var{n} of |
| 595 | @var{char-table}. The number of extra slots in a char-table is | 601 | @var{char-table}. The number of extra slots in a char-table is |
| 596 | determined by its subtype. | 602 | determined by its subtype. |
| 597 | @end defun | 603 | @end defun |
| 598 | 604 | ||
| 599 | @tindex set-char-table-extra-slot | ||
| 600 | @defun set-char-table-extra-slot char-table n value | 605 | @defun set-char-table-extra-slot char-table n value |
| 606 | @tindex set-char-table-extra-slot | ||
| 601 | This function stores @var{value} in extra slot @var{n} of | 607 | This function stores @var{value} in extra slot @var{n} of |
| 602 | @var{char-table}. | 608 | @var{char-table}. |
| 603 | @end defun | 609 | @end defun |
| @@ -605,28 +611,34 @@ This function stores @var{value} in extra slot @var{n} of | |||
| 605 | A char-table can specify an element value for a single character code; | 611 | A char-table can specify an element value for a single character code; |
| 606 | it can also specify a value for an entire character set. | 612 | it can also specify a value for an entire character set. |
| 607 | 613 | ||
| 608 | @tindex char-table-range | ||
| 609 | @defun char-table-range char-table range | 614 | @defun char-table-range char-table range |
| 615 | @tindex char-table-range | ||
| 610 | This returns the value specified in @var{char-table} for a range of | 616 | This returns the value specified in @var{char-table} for a range of |
| 611 | characters @var{range}. Here @var{range} may be | 617 | characters @var{range}. Here are the possibilities for @var{range}: |
| 612 | 618 | ||
| 613 | @table @asis | 619 | @table @asis |
| 614 | @item @code{nil} | 620 | @item @code{nil} |
| 615 | Refers to the default value. | 621 | Refers to the default value. |
| 616 | 622 | ||
| 617 | @item @var{char} | 623 | @item @var{char} |
| 618 | Refers to the element for character @var{char}. | 624 | Refers to the element for character @var{char} |
| 625 | (supposing @var{char} is a valid character code). | ||
| 619 | 626 | ||
| 620 | @item @var{charset} | 627 | @item @var{charset} |
| 621 | Refers to the value specified for the whole character set | 628 | Refers to the value specified for the whole character set |
| 622 | @var{charset} (@pxref{Character Sets}). | 629 | @var{charset} (@pxref{Character Sets}). |
| 630 | |||
| 631 | @item @var{generic-char} | ||
| 632 | A generic character stands for a character set; specifying the generic | ||
| 633 | character as argument is equivalent to specifying the character set | ||
| 634 | name. @xref{Splitting Characters}, for a description of generic characters. | ||
| 623 | @end table | 635 | @end table |
| 624 | @end defun | 636 | @end defun |
| 625 | 637 | ||
| 626 | @tindex set-char-table-range | ||
| 627 | @defun set-char-table-range char-table range value | 638 | @defun set-char-table-range char-table range value |
| 639 | @tindex set-char-table-range | ||
| 628 | This function set the value in @var{char-table} for a range of | 640 | This function set the value in @var{char-table} for a range of |
| 629 | characters @var{range}. Here @var{range} may be | 641 | characters @var{range}. Here are the possibilities for @var{range}: |
| 630 | 642 | ||
| 631 | @table @asis | 643 | @table @asis |
| 632 | @item @code{nil} | 644 | @item @code{nil} |
| @@ -636,24 +648,45 @@ Refers to the default value. | |||
| 636 | Refers to the whole range of character codes. | 648 | Refers to the whole range of character codes. |
| 637 | 649 | ||
| 638 | @item @var{char} | 650 | @item @var{char} |
| 639 | Refers to the element for character @var{char}. | 651 | Refers to the element for character @var{char} |
| 652 | (supposing @var{char} is a valid character code). | ||
| 640 | 653 | ||
| 641 | @item @var{charset} | 654 | @item @var{charset} |
| 642 | Refers to the value specified for the whole character set | 655 | Refers to the value specified for the whole character set |
| 643 | @var{charset} (@pxref{Character Sets}). | 656 | @var{charset} (@pxref{Character Sets}). |
| 657 | |||
| 658 | @item @var{generic-char} | ||
| 659 | A generic character stands for a character set; specifying the generic | ||
| 660 | character as argument is equivalent to specifying the character set | ||
| 661 | name. @xref{Splitting Characters}, for a description of generic characters. | ||
| 644 | @end table | 662 | @end table |
| 645 | @end defun | 663 | @end defun |
| 646 | 664 | ||
| 647 | @tindex map-char-table | ||
| 648 | @defun map-char-table function char-table | 665 | @defun map-char-table function char-table |
| 666 | @tindex map-char-table | ||
| 649 | This function calls @var{function} for each element of @var{char-table}. | 667 | This function calls @var{function} for each element of @var{char-table}. |
| 650 | @var{function} is called with two arguments, a key and a value. The key | 668 | @var{function} is called with two arguments, a key and a value. The key |
| 651 | is a possible @var{range} argument for @code{char-table-range}, and the | 669 | is a possible @var{range} argument for @code{char-table-range}---either |
| 652 | value is @code{(char-table-range @var{char-table} @var{key})}. Invalid | 670 | a valid character or a generic character---and the value is |
| 653 | character codes are never used as @var{key}. | 671 | @code{(char-table-range @var{char-table} @var{key})}. |
| 654 | 672 | ||
| 655 | Overall, the key-value pairs passed to @var{function} describe all the | 673 | Overall, the key-value pairs passed to @var{function} describe all the |
| 656 | values stored in @var{char-table}. | 674 | values stored in @var{char-table}. |
| 675 | |||
| 676 | The return value is always @code{nil}; to make this function useful, | ||
| 677 | @var{function} should have side effects. For example, | ||
| 678 | here is how to examine each element of the syntax table: | ||
| 679 | |||
| 680 | @example | ||
| 681 | (map-char-table | ||
| 682 | #'(lambda (key value) | ||
| 683 | (setq accumulator | ||
| 684 | (cons (list key value) accumulator))) | ||
| 685 | (syntax-table)) | ||
| 686 | @result{} | ||
| 687 | ((475008 nil) (474880 nil) (474752 nil) (474624 nil) | ||
| 688 | ... (5 (3)) (4 (3)) (3 (3)) (2 (3)) (1 (3)) (0 (3))) | ||
| 689 | @end example | ||
| 657 | @end defun | 690 | @end defun |
| 658 | 691 | ||
| 659 | @node Bool-Vectors | 692 | @node Bool-Vectors |
| @@ -671,13 +704,14 @@ Bool-vectors are constants when evaluated. | |||
| 671 | from that, you manipulate them with same functions used for other kinds | 704 | from that, you manipulate them with same functions used for other kinds |
| 672 | of arrays. | 705 | of arrays. |
| 673 | 706 | ||
| 674 | @tindex make-bool-vector | ||
| 675 | @defun make-bool-vector length initial | 707 | @defun make-bool-vector length initial |
| 708 | @tindex make-bool-vector | ||
| 676 | Return a new book-vector of @var{length} elements, | 709 | Return a new book-vector of @var{length} elements, |
| 677 | each one initialized to @var{initial}. | 710 | each one initialized to @var{initial}. |
| 678 | @end defun | 711 | @end defun |
| 679 | 712 | ||
| 680 | @defun bool-vector-p object | 713 | @defun bool-vector-p object |
| 714 | @tindex bool-vector-p | ||
| 681 | This returns @code{t} if @var{object} is a bool-vector, | 715 | This returns @code{t} if @var{object} is a bool-vector, |
| 682 | and @code{nil} otherwise. | 716 | and @code{nil} otherwise. |
| 683 | @end defun | 717 | @end defun |
diff --git a/lispref/streams.texi b/lispref/streams.texi index 945e550fc0a..cf3f14a095f 100644 --- a/lispref/streams.texi +++ b/lispref/streams.texi | |||
| @@ -255,7 +255,7 @@ useless-list | |||
| 255 | @end example | 255 | @end example |
| 256 | 256 | ||
| 257 | @noindent | 257 | @noindent |
| 258 | Note that the open and close parentheses remains in the list. The Lisp | 258 | Note that the open and close parentheses remain in the list. The Lisp |
| 259 | reader encountered the open parenthesis, decided that it ended the | 259 | reader encountered the open parenthesis, decided that it ended the |
| 260 | input, and unread it. Another attempt to read from the stream at this | 260 | input, and unread it. Another attempt to read from the stream at this |
| 261 | point would read @samp{()} and return @code{nil}. | 261 | point would read @samp{()} and return @code{nil}. |
| @@ -353,14 +353,15 @@ Point advances as characters are inserted. | |||
| 353 | The output characters are inserted into the buffer that @var{marker} | 353 | The output characters are inserted into the buffer that @var{marker} |
| 354 | points into, at the marker position. The marker position advances as | 354 | points into, at the marker position. The marker position advances as |
| 355 | characters are inserted. The value of point in the buffer has no effect | 355 | characters are inserted. The value of point in the buffer has no effect |
| 356 | on printing when the stream is a marker. | 356 | on printing when the stream is a marker, and this kind of printing |
| 357 | does not move point. | ||
| 357 | 358 | ||
| 358 | @item @var{function} | 359 | @item @var{function} |
| 359 | @cindex function output stream | 360 | @cindex function output stream |
| 360 | The output characters are passed to @var{function}, which is responsible | 361 | The output characters are passed to @var{function}, which is responsible |
| 361 | for storing them away. It is called with a single character as | 362 | for storing them away. It is called with a single character as |
| 362 | argument, as many times as there are characters to be output, and is | 363 | argument, as many times as there are characters to be output, and |
| 363 | free to do anything at all with the characters it receives. | 364 | is responsible for storing the characters wherever you want to put them. |
| 364 | 365 | ||
| 365 | @item @code{t} | 366 | @item @code{t} |
| 366 | @cindex @code{t} output stream | 367 | @cindex @code{t} output stream |
| @@ -368,9 +369,9 @@ The output characters are displayed in the echo area. | |||
| 368 | 369 | ||
| 369 | @item @code{nil} | 370 | @item @code{nil} |
| 370 | @cindex @code{nil} output stream | 371 | @cindex @code{nil} output stream |
| 371 | @code{nil} specified as an output stream means to the value of | 372 | @code{nil} specified as an output stream means to use the value of |
| 372 | @code{standard-output} instead; that value is the @dfn{default output | 373 | @code{standard-output} instead; that value is the @dfn{default output |
| 373 | stream}, and must be a non-@code{nil} output stream. | 374 | stream}, and must not be @code{nil}. |
| 374 | 375 | ||
| 375 | @item @var{symbol} | 376 | @item @var{symbol} |
| 376 | A symbol as output stream is equivalent to the symbol's function | 377 | A symbol as output stream is equivalent to the symbol's function |
| @@ -425,7 +426,7 @@ effect. | |||
| 425 | @example | 426 | @example |
| 426 | @group | 427 | @group |
| 427 | ---------- Buffer: foo ---------- | 428 | ---------- Buffer: foo ---------- |
| 428 | "This is the @point{}output" | 429 | This is the @point{}output |
| 429 | ---------- Buffer: foo ---------- | 430 | ---------- Buffer: foo ---------- |
| 430 | @end group | 431 | @end group |
| 431 | 432 | ||
| @@ -441,9 +442,9 @@ m | |||
| 441 | 442 | ||
| 442 | @group | 443 | @group |
| 443 | ---------- Buffer: foo ---------- | 444 | ---------- Buffer: foo ---------- |
| 444 | "This is t | 445 | This is t |
| 445 | "More output for foo." | 446 | "More output for foo." |
| 446 | he @point{}output" | 447 | he @point{}output |
| 447 | ---------- Buffer: foo ---------- | 448 | ---------- Buffer: foo ---------- |
| 448 | @end group | 449 | @end group |
| 449 | 450 | ||
| @@ -535,12 +536,13 @@ describe a Lisp object clearly for a Lisp programmer. However, if the | |||
| 535 | purpose of the output is to look nice for humans, then it is usually | 536 | purpose of the output is to look nice for humans, then it is usually |
| 536 | better to print without quoting. | 537 | better to print without quoting. |
| 537 | 538 | ||
| 538 | Printing a self-referent Lisp object in the normal way would require | 539 | Lisp objects can refer to themselves. Printing a self-referential |
| 539 | an infinite amount of text, and could even result in stack overflow. | 540 | object in the normal way would require an infinite amount of text, and |
| 540 | Emacs detects such recursion and prints @samp{#@var{level}} instead of | 541 | the attempt could cause infinite recursion. Emacs detects such |
| 541 | recursively printing an object already being printed. For example, here | 542 | recursion and prints @samp{#@var{level}} instead of recursively printing |
| 542 | @samp{#0} indicates a recursive reference to the object at level 0 of | 543 | an object already being printed. For example, here @samp{#0} indicates |
| 543 | the current print operation: | 544 | a recursive reference to the object at level 0 of the current print |
| 545 | operation: | ||
| 544 | 546 | ||
| 545 | @example | 547 | @example |
| 546 | (setq foo (list nil)) | 548 | (setq foo (list nil)) |
| @@ -661,10 +663,10 @@ See @code{format}, in @ref{String Conversion}, for other ways to obtain | |||
| 661 | the printed representation of a Lisp object as a string. | 663 | the printed representation of a Lisp object as a string. |
| 662 | @end defun | 664 | @end defun |
| 663 | 665 | ||
| 664 | @tindex with-output-to-string | ||
| 665 | @defmac with-output-to-string body... | 666 | @defmac with-output-to-string body... |
| 666 | This macro executes the @var{body} forms with standard-output set up so | 667 | @tindex with-output-to-string |
| 667 | that all output feeds into a string. Then it returns that string. | 668 | This macro executes the @var{body} forms with @code{standard-output} set |
| 669 | up to feed output into a string. Then it returns that string. | ||
| 668 | 670 | ||
| 669 | For example, if the current buffer name is @samp{foo}, | 671 | For example, if the current buffer name is @samp{foo}, |
| 670 | 672 | ||
diff --git a/lispref/strings.texi b/lispref/strings.texi index 71300010f37..5e511a5d331 100644 --- a/lispref/strings.texi +++ b/lispref/strings.texi | |||
| @@ -28,7 +28,7 @@ keyboard character events. | |||
| 28 | * Modifying Strings:: Altering the contents of an existing string. | 28 | * Modifying Strings:: Altering the contents of an existing string. |
| 29 | * Text Comparison:: Comparing characters or strings. | 29 | * Text Comparison:: Comparing characters or strings. |
| 30 | * String Conversion:: Converting characters or strings and vice versa. | 30 | * String Conversion:: Converting characters or strings and vice versa. |
| 31 | * Formatting Strings:: @code{format}: Emacs's analog of @code{printf}. | 31 | * Formatting Strings:: @code{format}: Emacs's analogue of @code{printf}. |
| 32 | * Case Conversion:: Case conversion functions. | 32 | * Case Conversion:: Case conversion functions. |
| 33 | * Case Tables:: Customizing case conversion. | 33 | * Case Tables:: Customizing case conversion. |
| 34 | @end menu | 34 | @end menu |
| @@ -97,12 +97,12 @@ For more information about general sequence and array predicates, | |||
| 97 | see @ref{Sequences Arrays Vectors}, and @ref{Arrays}. | 97 | see @ref{Sequences Arrays Vectors}, and @ref{Arrays}. |
| 98 | 98 | ||
| 99 | @defun stringp object | 99 | @defun stringp object |
| 100 | This function returns @code{t} if @var{object} is a string, @code{nil} | 100 | This function returns @code{t} if @var{object} is a string, @code{nil} |
| 101 | otherwise. | 101 | otherwise. |
| 102 | @end defun | 102 | @end defun |
| 103 | 103 | ||
| 104 | @defun char-or-string-p object | 104 | @defun char-or-string-p object |
| 105 | This function returns @code{t} if @var{object} is a string or a | 105 | This function returns @code{t} if @var{object} is a string or a |
| 106 | character (i.e., an integer), @code{nil} otherwise. | 106 | character (i.e., an integer), @code{nil} otherwise. |
| 107 | @end defun | 107 | @end defun |
| 108 | 108 | ||
| @@ -113,7 +113,7 @@ character (i.e., an integer), @code{nil} otherwise. | |||
| 113 | putting strings together, or by taking them apart. | 113 | putting strings together, or by taking them apart. |
| 114 | 114 | ||
| 115 | @defun make-string count character | 115 | @defun make-string count character |
| 116 | This function returns a string made up of @var{count} repetitions of | 116 | This function returns a string made up of @var{count} repetitions of |
| 117 | @var{character}. If @var{count} is negative, an error is signaled. | 117 | @var{character}. If @var{count} is negative, an error is signaled. |
| 118 | 118 | ||
| 119 | @example | 119 | @example |
| @@ -128,8 +128,8 @@ putting strings together, or by taking them apart. | |||
| 128 | @code{make-list} (@pxref{Building Lists}). | 128 | @code{make-list} (@pxref{Building Lists}). |
| 129 | @end defun | 129 | @end defun |
| 130 | 130 | ||
| 131 | @tindex string | ||
| 132 | @defun string &rest characters | 131 | @defun string &rest characters |
| 132 | @tindex string | ||
| 133 | This returns a string containing the characters @var{characters}. | 133 | This returns a string containing the characters @var{characters}. |
| 134 | 134 | ||
| 135 | @example | 135 | @example |
| @@ -232,7 +232,7 @@ returns an empty string. | |||
| 232 | @example | 232 | @example |
| 233 | (concat "abc" "-def") | 233 | (concat "abc" "-def") |
| 234 | @result{} "abc-def" | 234 | @result{} "abc-def" |
| 235 | (concat "abc" (list 120 (+ 256 121)) [122]) | 235 | (concat "abc" (list 120 121) [122]) |
| 236 | @result{} "abcxyz" | 236 | @result{} "abcxyz" |
| 237 | ;; @r{@code{nil} is an empty sequence.} | 237 | ;; @r{@code{nil} is an empty sequence.} |
| 238 | (concat "abc" nil "-def") | 238 | (concat "abc" nil "-def") |
| @@ -244,10 +244,6 @@ returns an empty string. | |||
| 244 | @end example | 244 | @end example |
| 245 | 245 | ||
| 246 | @noindent | 246 | @noindent |
| 247 | The second example above shows how characters stored in strings are | ||
| 248 | taken modulo 256. In other words, each character in the string is | ||
| 249 | stored in one byte. | ||
| 250 | |||
| 251 | The @code{concat} function always constructs a new string that is | 247 | The @code{concat} function always constructs a new string that is |
| 252 | not @code{eq} to any existing string. | 248 | not @code{eq} to any existing string. |
| 253 | 249 | ||
| @@ -274,8 +270,8 @@ description of @code{mapconcat} in @ref{Mapping Functions}, | |||
| 274 | Lists}. | 270 | Lists}. |
| 275 | @end defun | 271 | @end defun |
| 276 | 272 | ||
| 277 | @tindex split-string | ||
| 278 | @defun split-string string separators | 273 | @defun split-string string separators |
| 274 | @tindex split-string | ||
| 279 | Split @var{string} into substrings in between matches for the regular | 275 | Split @var{string} into substrings in between matches for the regular |
| 280 | expression @var{separators}. Each match for @var{separators} defines a | 276 | expression @var{separators}. Each match for @var{separators} defines a |
| 281 | splitting point; the substrings between the splitting points are made | 277 | splitting point; the substrings between the splitting points are made |
| @@ -322,8 +318,8 @@ that index, @code{aset} signals an error. | |||
| 322 | 318 | ||
| 323 | A more powerful function is @code{store-substring}: | 319 | A more powerful function is @code{store-substring}: |
| 324 | 320 | ||
| 325 | @tindex store-substring | ||
| 326 | @defun store-substring string idx obj | 321 | @defun store-substring string idx obj |
| 322 | @tindex store-substring | ||
| 327 | This function alters part of the contents of the string @var{string}, by | 323 | This function alters part of the contents of the string @var{string}, by |
| 328 | storing @var{obj} starting at index @var{idx}. The argument @var{obj} | 324 | storing @var{obj} starting at index @var{idx}. The argument @var{obj} |
| 329 | may be either a character or a (smaller) string. | 325 | may be either a character or a (smaller) string. |
| @@ -434,6 +430,41 @@ no characters is less than any other string. | |||
| 434 | @code{string-lessp} is another name for @code{string<}. | 430 | @code{string-lessp} is another name for @code{string<}. |
| 435 | @end defun | 431 | @end defun |
| 436 | 432 | ||
| 433 | @defun compare-strings string1 start1 end1 string2 start2 end2 &optional ignore-case | ||
| 434 | @tindex compare-strings | ||
| 435 | This function compares a specified part of @var{string1} with a | ||
| 436 | specified part of @var{string2}. The specified part of @var{string1} | ||
| 437 | runs from index @var{start1} up to index @var{end1} (default, the end of | ||
| 438 | the string). The specified part of @var{string2} runs from index | ||
| 439 | @var{start2} up to index @var{end2} (default, the end of the string). | ||
| 440 | |||
| 441 | The strings are both converted to multibyte for the comparison | ||
| 442 | (@pxref{Text Representations}) so that a unibyte string can be usefully | ||
| 443 | compared with a multibyte string. If @var{ignore-case} is | ||
| 444 | non-@code{nil}, then case is ignored as well. | ||
| 445 | |||
| 446 | If the specified portions of the two strings match, the value is | ||
| 447 | @code{t}. Otherwise, the value is an integer which indicates how many | ||
| 448 | leading characters agree, and which string is less. Its absolute value | ||
| 449 | is one plus the number of characters that agree at the beginning of the | ||
| 450 | two strings. The sign is negative if @var{string1} (or its specified | ||
| 451 | portion) is less. | ||
| 452 | @end defun | ||
| 453 | |||
| 454 | @defun assoc-ignore-case key alist | ||
| 455 | @tindex assoc-ignore-case | ||
| 456 | This function works like @code{assoc}, except that @var{key} must be a | ||
| 457 | string, and comparison is done using @code{compare-strings}. | ||
| 458 | Case differences are ignored in this comparison. | ||
| 459 | @end defun | ||
| 460 | |||
| 461 | @defun assoc-ignore-representation key alist | ||
| 462 | @tindex assoc-ignore-representation | ||
| 463 | This function works like @code{assoc}, except that @var{key} must be a | ||
| 464 | string, and comparison is done using @code{compare-strings}. | ||
| 465 | Case differences are significant. | ||
| 466 | @end defun | ||
| 467 | |||
| 437 | See also @code{compare-buffer-substrings} in @ref{Comparing Text}, for | 468 | See also @code{compare-buffer-substrings} in @ref{Comparing Text}, for |
| 438 | a way to compare text in buffers. The function @code{string-match}, | 469 | a way to compare text in buffers. The function @code{string-match}, |
| 439 | which matches a regular expression against a string, can be used | 470 | which matches a regular expression against a string, can be used |
| @@ -509,7 +540,7 @@ negative. | |||
| 509 | See also the function @code{format} in @ref{Formatting Strings}. | 540 | See also the function @code{format} in @ref{Formatting Strings}. |
| 510 | @end defun | 541 | @end defun |
| 511 | 542 | ||
| 512 | @defun string-to-number string base | 543 | @defun string-to-number string &optional base |
| 513 | @cindex string to number | 544 | @cindex string to number |
| 514 | This function returns the numeric value of the characters in | 545 | This function returns the numeric value of the characters in |
| 515 | @var{string}. If @var{base} is non-@code{nil}, integers are converted | 546 | @var{string}. If @var{base} is non-@code{nil}, integers are converted |
| @@ -522,7 +553,7 @@ The parsing skips spaces and tabs at the beginning of @var{string}, then | |||
| 522 | reads as much of @var{string} as it can interpret as a number. (On some | 553 | reads as much of @var{string} as it can interpret as a number. (On some |
| 523 | systems it ignores other whitespace at the beginning, not just spaces | 554 | systems it ignores other whitespace at the beginning, not just spaces |
| 524 | and tabs.) If the first character after the ignored whitespace is not a | 555 | and tabs.) If the first character after the ignored whitespace is not a |
| 525 | digit or a minus sign, this function returns 0. | 556 | digit or a plus or minus sign, this function returns 0. |
| 526 | 557 | ||
| 527 | @example | 558 | @example |
| 528 | (string-to-number "256") | 559 | (string-to-number "256") |
| @@ -600,10 +631,9 @@ second such value, and so on. Any extra format specifications (those | |||
| 600 | for which there are no corresponding values) cause unpredictable | 631 | for which there are no corresponding values) cause unpredictable |
| 601 | behavior. Any extra values to be formatted are ignored. | 632 | behavior. Any extra values to be formatted are ignored. |
| 602 | 633 | ||
| 603 | Certain format specifications require values of particular types. | 634 | Certain format specifications require values of particular types. If |
| 604 | However, no error is signaled if the value actually supplied fails to | 635 | you supply a value that doesn't fit the requirements, an error is |
| 605 | have the expected type. Instead, the output is likely to be | 636 | signaled. |
| 606 | meaningless. | ||
| 607 | 637 | ||
| 608 | Here is a table of valid format specifications: | 638 | Here is a table of valid format specifications: |
| 609 | 639 | ||
| @@ -652,7 +682,7 @@ point number. | |||
| 652 | 682 | ||
| 653 | @item %g | 683 | @item %g |
| 654 | Replace the specification with notation for a floating point number, | 684 | Replace the specification with notation for a floating point number, |
| 655 | using either exponential notation or decimal-point notation whichever | 685 | using either exponential notation or decimal-point notation, whichever |
| 656 | is shorter. | 686 | is shorter. |
| 657 | 687 | ||
| 658 | @item %% | 688 | @item %% |
| @@ -741,10 +771,14 @@ not truncated. In the third case, the padding is on the right. | |||
| 741 | @cindex case conversion in Lisp | 771 | @cindex case conversion in Lisp |
| 742 | 772 | ||
| 743 | The character case functions change the case of single characters or | 773 | The character case functions change the case of single characters or |
| 744 | of the contents of strings. The functions convert only alphabetic | 774 | of the contents of strings. The functions normally convert only |
| 745 | characters (the letters @samp{A} through @samp{Z} and @samp{a} through | 775 | alphabetic characters (the letters @samp{A} through @samp{Z} and |
| 746 | @samp{z}); other characters are not altered. The functions do not | 776 | @samp{a} through @samp{z}, as well as non-ASCII letters); other |
| 747 | modify the strings that are passed to them as arguments. | 777 | characters are not altered. (You can specify a different case |
| 778 | conversion mapping by specifying a case table---@pxref{Case Tables}.) | ||
| 779 | |||
| 780 | These functions do not modify the strings that are passed to them as | ||
| 781 | arguments. | ||
| 748 | 782 | ||
| 749 | The examples below use the characters @samp{X} and @samp{x} which have | 783 | The examples below use the characters @samp{X} and @samp{x} which have |
| 750 | @sc{ASCII} codes 88 and 120 respectively. | 784 | @sc{ASCII} codes 88 and 120 respectively. |
| @@ -823,8 +857,8 @@ has the same result as @code{upcase}. | |||
| 823 | @defun upcase-initials string | 857 | @defun upcase-initials string |
| 824 | This function capitalizes the initials of the words in @var{string}. | 858 | This function capitalizes the initials of the words in @var{string}. |
| 825 | without altering any letters other than the initials. It returns a new | 859 | without altering any letters other than the initials. It returns a new |
| 826 | string whose contents are a copy of @var{string-or-char}, in which each | 860 | string whose contents are a copy of @var{string}, in which each word has |
| 827 | word has been converted to upper case. | 861 | been converted to upper case. |
| 828 | 862 | ||
| 829 | The definition of a word is any sequence of consecutive characters that | 863 | The definition of a word is any sequence of consecutive characters that |
| 830 | are assigned to the word constituent syntax class in the current syntax | 864 | are assigned to the word constituent syntax class in the current syntax |
| @@ -838,6 +872,9 @@ table (@xref{Syntax Class Table}). | |||
| 838 | @end example | 872 | @end example |
| 839 | @end defun | 873 | @end defun |
| 840 | 874 | ||
| 875 | @xref{Text Comparison}, for functions that compare strings; some of | ||
| 876 | them ignore case differences, or can optionally ignore case differences. | ||
| 877 | |||
| 841 | @node Case Tables | 878 | @node Case Tables |
| 842 | @section The Case Table | 879 | @section The Case Table |
| 843 | 880 | ||
| @@ -860,10 +897,10 @@ The upcase table maps each character into the corresponding upper | |||
| 860 | case character. | 897 | case character. |
| 861 | @item canonicalize | 898 | @item canonicalize |
| 862 | The canonicalize table maps all of a set of case-related characters | 899 | The canonicalize table maps all of a set of case-related characters |
| 863 | into some one of them. | 900 | into a particular member of that set. |
| 864 | @item equivalences | 901 | @item equivalences |
| 865 | The equivalences table maps each of a set of case-related characters | 902 | The equivalences table maps each one of a set of case-related characters |
| 866 | into the next one in that set. | 903 | into the next character in that set. |
| 867 | @end table | 904 | @end table |
| 868 | 905 | ||
| 869 | In simple cases, all you need to specify is the mapping to lower-case; | 906 | In simple cases, all you need to specify is the mapping to lower-case; |
diff --git a/lispref/symbols.texi b/lispref/symbols.texi index 9f52fc0e5be..7e9c6a4a9a6 100644 --- a/lispref/symbols.texi +++ b/lispref/symbols.texi | |||
| @@ -121,12 +121,12 @@ The property list cell contains the list @code{(variable-documentation | |||
| 121 | documentation string for the variable @code{buffer-file-name} in the | 121 | documentation string for the variable @code{buffer-file-name} in the |
| 122 | @file{DOC-@var{version}} file. (29529 is the offset from the beginning | 122 | @file{DOC-@var{version}} file. (29529 is the offset from the beginning |
| 123 | of the @file{DOC-@var{version}} file to where that documentation string | 123 | of the @file{DOC-@var{version}} file to where that documentation string |
| 124 | begins---@pxref{Documentation Basics}) The function cell contains the | 124 | begins---see @ref{Documentation Basics}.) The function cell contains |
| 125 | function for returning the name of the file. @code{buffer-file-name} | 125 | the function for returning the name of the file. |
| 126 | names a primitive function, which has no read syntax and prints in hash | 126 | @code{buffer-file-name} names a primitive function, which has no read |
| 127 | notation (@pxref{Primitive Function Type}). A symbol naming a function | 127 | syntax and prints in hash notation (@pxref{Primitive Function Type}). A |
| 128 | written in Lisp would have a lambda expression (or a byte-code object) | 128 | symbol naming a function written in Lisp would have a lambda expression |
| 129 | in this cell. | 129 | (or a byte-code object) in this cell. |
| 130 | 130 | ||
| 131 | @node Definitions, Creating Symbols, Symbol Components, Symbols | 131 | @node Definitions, Creating Symbols, Symbol Components, Symbols |
| 132 | @section Defining Symbols | 132 | @section Defining Symbols |
diff --git a/lispref/syntax.texi b/lispref/syntax.texi index 3200c40ac83..b6a5ea9a132 100644 --- a/lispref/syntax.texi +++ b/lispref/syntax.texi | |||
| @@ -10,7 +10,7 @@ | |||
| 10 | @cindex text parsing | 10 | @cindex text parsing |
| 11 | 11 | ||
| 12 | A @dfn{syntax table} specifies the syntactic textual function of each | 12 | A @dfn{syntax table} specifies the syntactic textual function of each |
| 13 | character. This information is used by the parsing commands, the | 13 | character. This information is used by the @dfn{parsing functions}, the |
| 14 | complex movement commands, and others to determine where words, symbols, | 14 | complex movement commands, and others to determine where words, symbols, |
| 15 | and other syntactic constructs begin and end. The current syntax table | 15 | and other syntactic constructs begin and end. The current syntax table |
| 16 | controls the meaning of the word motion functions (@pxref{Word Motion}) | 16 | controls the meaning of the word motion functions (@pxref{Word Motion}) |
| @@ -524,8 +524,8 @@ If the property is @code{nil}, the character's syntax is determined from | |||
| 524 | the current syntax table in the usual way. | 524 | the current syntax table in the usual way. |
| 525 | @end table | 525 | @end table |
| 526 | 526 | ||
| 527 | @tindex parse-sexp-lookup-properties | ||
| 528 | @defvar parse-sexp-lookup-properties | 527 | @defvar parse-sexp-lookup-properties |
| 528 | @tindex parse-sexp-lookup-properties | ||
| 529 | If this is non-@code{nil}, the syntax scanning functions pay attention | 529 | If this is non-@code{nil}, the syntax scanning functions pay attention |
| 530 | to syntax text properties. Otherwise they use only the current syntax | 530 | to syntax text properties. Otherwise they use only the current syntax |
| 531 | table. | 531 | table. |
| @@ -765,43 +765,50 @@ a character to match was specified. | |||
| 765 | to each syntactic type. | 765 | to each syntactic type. |
| 766 | 766 | ||
| 767 | @multitable @columnfractions .05 .3 .3 .3 | 767 | @multitable @columnfractions .05 .3 .3 .3 |
| 768 | @item@tab | 768 | @item |
| 769 | @tab | ||
| 769 | @i{Integer} @i{Class} | 770 | @i{Integer} @i{Class} |
| 770 | @tab | 771 | @tab |
| 771 | @i{Integer} @i{Class} | 772 | @i{Integer} @i{Class} |
| 772 | @tab | 773 | @tab |
| 773 | @i{Integer} @i{Class} | 774 | @i{Integer} @i{Class} |
| 774 | @item@tab | 775 | @item |
| 776 | @tab | ||
| 775 | 0 @ @ whitespace | 777 | 0 @ @ whitespace |
| 776 | @tab | 778 | @tab |
| 777 | 5 @ @ close parenthesis | 779 | 5 @ @ close parenthesis |
| 778 | @tab | 780 | @tab |
| 779 | 10 @ @ character quote | 781 | 10 @ @ character quote |
| 780 | @item@tab | 782 | @item |
| 783 | @tab | ||
| 781 | 1 @ @ punctuation | 784 | 1 @ @ punctuation |
| 782 | @tab | 785 | @tab |
| 783 | 6 @ @ expression prefix | 786 | 6 @ @ expression prefix |
| 784 | @tab | 787 | @tab |
| 785 | 11 @ @ comment-start | 788 | 11 @ @ comment-start |
| 786 | @item@tab | 789 | @item |
| 790 | @tab | ||
| 787 | 2 @ @ word | 791 | 2 @ @ word |
| 788 | @tab | 792 | @tab |
| 789 | 7 @ @ string quote | 793 | 7 @ @ string quote |
| 790 | @tab | 794 | @tab |
| 791 | 12 @ @ comment-end | 795 | 12 @ @ comment-end |
| 792 | @item@tab | 796 | @item |
| 797 | @tab | ||
| 793 | 3 @ @ symbol | 798 | 3 @ @ symbol |
| 794 | @tab | 799 | @tab |
| 795 | 8 @ @ paired delimiter | 800 | 8 @ @ paired delimiter |
| 796 | @tab | 801 | @tab |
| 797 | 13 @ @ inherit | 802 | 13 @ @ inherit |
| 798 | @item@tab | 803 | @item |
| 804 | @tab | ||
| 799 | 4 @ @ open parenthesis | 805 | 4 @ @ open parenthesis |
| 800 | @tab | 806 | @tab |
| 801 | 9 @ @ escape | 807 | 9 @ @ escape |
| 802 | @tab | 808 | @tab |
| 803 | 14 @ @ comment-fence | 809 | 14 @ @ comment-fence |
| 804 | @item@tab | 810 | @item |
| 811 | @tab | ||
| 805 | 15 @ string-fence | 812 | 15 @ string-fence |
| 806 | @end multitable | 813 | @end multitable |
| 807 | 814 | ||
| @@ -813,19 +820,22 @@ least significant bit. This table gives the power of two which | |||
| 813 | corresponds to each syntax flag. | 820 | corresponds to each syntax flag. |
| 814 | 821 | ||
| 815 | @multitable @columnfractions .05 .3 .3 .3 | 822 | @multitable @columnfractions .05 .3 .3 .3 |
| 816 | @item@tab | 823 | @item |
| 824 | @tab | ||
| 817 | @i{Prefix} @i{Flag} | 825 | @i{Prefix} @i{Flag} |
| 818 | @tab | 826 | @tab |
| 819 | @i{Prefix} @i{Flag} | 827 | @i{Prefix} @i{Flag} |
| 820 | @tab | 828 | @tab |
| 821 | @i{Prefix} @i{Flag} | 829 | @i{Prefix} @i{Flag} |
| 822 | @item@tab | 830 | @item |
| 831 | @tab | ||
| 823 | @samp{1} @ @ @code{(lsh 1 16)} | 832 | @samp{1} @ @ @code{(lsh 1 16)} |
| 824 | @tab | 833 | @tab |
| 825 | @samp{3} @ @ @code{(lsh 1 18)} | 834 | @samp{3} @ @ @code{(lsh 1 18)} |
| 826 | @tab | 835 | @tab |
| 827 | @samp{p} @ @ @code{(lsh 1 20)} | 836 | @samp{p} @ @ @code{(lsh 1 20)} |
| 828 | @item@tab | 837 | @item |
| 838 | @tab | ||
| 829 | @samp{2} @ @ @code{(lsh 1 17)} | 839 | @samp{2} @ @ @code{(lsh 1 17)} |
| 830 | @tab | 840 | @tab |
| 831 | @samp{4} @ @ @code{(lsh 1 19)} | 841 | @samp{4} @ @ @code{(lsh 1 19)} |
diff --git a/lispref/text.texi b/lispref/text.texi index 96b527d23fa..69f0c002293 100644 --- a/lispref/text.texi +++ b/lispref/text.texi | |||
| @@ -196,8 +196,11 @@ properties, just the characters themselves. @xref{Text Properties}. | |||
| 196 | 196 | ||
| 197 | @defun buffer-string | 197 | @defun buffer-string |
| 198 | This function returns the contents of the entire accessible portion of | 198 | This function returns the contents of the entire accessible portion of |
| 199 | the current buffer as a string. This is the portion between | 199 | the current buffer as a string. It is equivalent to |
| 200 | @code{(point-min)} and @code{(point-max)} (@pxref{Narrowing}). | 200 | |
| 201 | @example | ||
| 202 | (buffer-substring (point-min) (point-max)) | ||
| 203 | @end example | ||
| 201 | 204 | ||
| 202 | @example | 205 | @example |
| 203 | @group | 206 | @group |
| @@ -302,6 +305,13 @@ properties as the characters they were copied from. By contrast, | |||
| 302 | characters specified as separate arguments, not part of a string or | 305 | characters specified as separate arguments, not part of a string or |
| 303 | buffer, inherit their text properties from the neighboring text. | 306 | buffer, inherit their text properties from the neighboring text. |
| 304 | 307 | ||
| 308 | The insertion functions convert text from unibyte to multibyte in | ||
| 309 | order to insert in a multibyte buffer, and vice versa---if the text | ||
| 310 | comes from a string or from a buffer. However, they do not convert | ||
| 311 | unibyte character codes 128 through 255 to multibyte characters, not | ||
| 312 | even if the current buffer is a multibyte buffer. @xref{Converting | ||
| 313 | Representations}. | ||
| 314 | |||
| 305 | @defun insert &rest args | 315 | @defun insert &rest args |
| 306 | This function inserts the strings and/or characters @var{args} into the | 316 | This function inserts the strings and/or characters @var{args} into the |
| 307 | current buffer, at point, moving point forward. In other words, it | 317 | current buffer, at point, moving point forward. In other words, it |
| @@ -328,6 +338,10 @@ current buffer before point. The argument @var{count} should be a | |||
| 328 | number (@code{nil} means 1), and @var{character} must be a character. | 338 | number (@code{nil} means 1), and @var{character} must be a character. |
| 329 | The value is @code{nil}. | 339 | The value is @code{nil}. |
| 330 | 340 | ||
| 341 | This function does not convert unibyte character codes 128 through 255 | ||
| 342 | to multibyte characters, not even if the current buffer is a multibyte | ||
| 343 | buffer. @xref{Converting Representations}. | ||
| 344 | |||
| 331 | If @var{inherit} is non-@code{nil}, then the inserted characters inherit | 345 | If @var{inherit} is non-@code{nil}, then the inserted characters inherit |
| 332 | sticky text properties from the two characters before and after the | 346 | sticky text properties from the two characters before and after the |
| 333 | insertion point. @xref{Sticky Properties}. | 347 | insertion point. @xref{Sticky Properties}. |
| @@ -524,8 +538,8 @@ the kill ring. | |||
| 524 | The value returned is always @code{nil}. | 538 | The value returned is always @code{nil}. |
| 525 | @end deffn | 539 | @end deffn |
| 526 | 540 | ||
| 527 | @tindex backward-delete-char-untabify-method | ||
| 528 | @defopt backward-delete-char-untabify-method | 541 | @defopt backward-delete-char-untabify-method |
| 542 | @tindex backward-delete-char-untabify-method | ||
| 529 | This option specifies how @code{backward-delete-char-untabify} should | 543 | This option specifies how @code{backward-delete-char-untabify} should |
| 530 | deal with whitespace. Possible values include @code{untabify}, the | 544 | deal with whitespace. Possible values include @code{untabify}, the |
| 531 | default, meaning convert a tab to many spaces and delete one; | 545 | default, meaning convert a tab to many spaces and delete one; |
| @@ -579,7 +593,7 @@ This function joins the line point is on to the previous line, deleting | |||
| 579 | any whitespace at the join and in some cases replacing it with one | 593 | any whitespace at the join and in some cases replacing it with one |
| 580 | space. If @var{join-following-p} is non-@code{nil}, | 594 | space. If @var{join-following-p} is non-@code{nil}, |
| 581 | @code{delete-indentation} joins this line to the following line | 595 | @code{delete-indentation} joins this line to the following line |
| 582 | instead. The value is @code{nil}. | 596 | instead. The function returns @code{nil}. |
| 583 | 597 | ||
| 584 | If there is a fill prefix, and the second of the lines being joined | 598 | If there is a fill prefix, and the second of the lines being joined |
| 585 | starts with the prefix, then @code{delete-indentation} deletes the | 599 | starts with the prefix, then @code{delete-indentation} deletes the |
| @@ -612,7 +626,7 @@ responsible for deciding whether to leave a space at the junction. | |||
| 612 | @end deffn | 626 | @end deffn |
| 613 | 627 | ||
| 614 | @defun fixup-whitespace | 628 | @defun fixup-whitespace |
| 615 | This function replaces all the white space surrounding point with either | 629 | This function replaces all the whitespace surrounding point with either |
| 616 | one space or no space, according to the context. It returns @code{nil}. | 630 | one space or no space, according to the context. It returns @code{nil}. |
| 617 | 631 | ||
| 618 | At the beginning or end of a line, the appropriate amount of space is | 632 | At the beginning or end of a line, the appropriate amount of space is |
| @@ -728,9 +742,9 @@ new entry automatically deletes the last entry. | |||
| 728 | 742 | ||
| 729 | When kill commands are interwoven with other commands, each kill | 743 | When kill commands are interwoven with other commands, each kill |
| 730 | command makes a new entry in the kill ring. Multiple kill commands in | 744 | command makes a new entry in the kill ring. Multiple kill commands in |
| 731 | succession build up a single entry in the kill ring, which would be | 745 | succession build up a single kill-ring entry, which would be yanked as a |
| 732 | yanked as a unit; the second and subsequent consecutive kill commands | 746 | unit; the second and subsequent consecutive kill commands add text to |
| 733 | add text to the entry made by the first one. | 747 | the entry made by the first one. |
| 734 | 748 | ||
| 735 | For yanking, one entry in the kill ring is designated the ``front'' of | 749 | For yanking, one entry in the kill ring is designated the ``front'' of |
| 736 | the ring. Some yank commands ``rotate'' the ring by designating a | 750 | the ring. Some yank commands ``rotate'' the ring by designating a |
| @@ -825,7 +839,7 @@ The sequence of kills in the kill ring wraps around, so that after the | |||
| 825 | oldest one comes the newest one, and before the newest one goes the | 839 | oldest one comes the newest one, and before the newest one goes the |
| 826 | oldest. | 840 | oldest. |
| 827 | 841 | ||
| 828 | The value is always @code{nil}. | 842 | The return value is always @code{nil}. |
| 829 | @end deffn | 843 | @end deffn |
| 830 | 844 | ||
| 831 | @node Low-Level Kill Ring | 845 | @node Low-Level Kill Ring |
| @@ -837,8 +851,8 @@ take care of interaction with window system selections | |||
| 837 | (@pxref{Window System Selections}). | 851 | (@pxref{Window System Selections}). |
| 838 | 852 | ||
| 839 | @defun current-kill n &optional do-not-move | 853 | @defun current-kill n &optional do-not-move |
| 840 | The function @code{current-kill} rotates the yanking pointer which | 854 | The function @code{current-kill} rotates the yanking pointer, which |
| 841 | designates the ``front'' of the kill ring by @var{n} places (from newer | 855 | designates the ``front'' of the kill ring, by @var{n} places (from newer |
| 842 | kills to older ones), and returns the text at that place in the ring. | 856 | kills to older ones), and returns the text at that place in the ring. |
| 843 | 857 | ||
| 844 | If the optional second argument @var{do-not-move} is non-@code{nil}, | 858 | If the optional second argument @var{do-not-move} is non-@code{nil}, |
| @@ -1049,8 +1063,8 @@ not make boundaries, and then the 20th does, and so on as long as | |||
| 1049 | self-inserting characters continue. | 1063 | self-inserting characters continue. |
| 1050 | 1064 | ||
| 1051 | All buffer modifications add a boundary whenever the previous undoable | 1065 | All buffer modifications add a boundary whenever the previous undoable |
| 1052 | change was made in some other buffer. This way, a command that modifies | 1066 | change was made in some other buffer. This is to ensure that |
| 1053 | several buffers makes a boundary in each buffer it changes. | 1067 | each command makes a boundary in each buffer where it makes changes. |
| 1054 | 1068 | ||
| 1055 | Calling this function explicitly is useful for splitting the effects of | 1069 | Calling this function explicitly is useful for splitting the effects of |
| 1056 | a command into more than one unit. For example, @code{query-replace} | 1070 | a command into more than one unit. For example, @code{query-replace} |
| @@ -1096,8 +1110,8 @@ In an interactive call, @var{buffer-or-name} is the current buffer. | |||
| 1096 | You cannot specify any other buffer. | 1110 | You cannot specify any other buffer. |
| 1097 | @end deffn | 1111 | @end deffn |
| 1098 | 1112 | ||
| 1099 | @defun buffer-disable-undo &optional buffer | 1113 | @deffn Command buffer-disable-undo &optional buffer |
| 1100 | @defunx buffer-flush-undo &optional buffer | 1114 | @deffnx Command buffer-flush-undo &optional buffer |
| 1101 | @cindex disable undo | 1115 | @cindex disable undo |
| 1102 | This function discards the undo list of @var{buffer}, and disables | 1116 | This function discards the undo list of @var{buffer}, and disables |
| 1103 | further recording of undo information. As a result, it is no longer | 1117 | further recording of undo information. As a result, it is no longer |
| @@ -1105,11 +1119,11 @@ possible to undo either previous changes or any subsequent changes. If | |||
| 1105 | the undo list of @var{buffer} is already disabled, this function | 1119 | the undo list of @var{buffer} is already disabled, this function |
| 1106 | has no effect. | 1120 | has no effect. |
| 1107 | 1121 | ||
| 1108 | This function returns @code{nil}. It cannot be called interactively. | 1122 | This function returns @code{nil}. |
| 1109 | 1123 | ||
| 1110 | The name @code{buffer-flush-undo} is not considered obsolete, but the | 1124 | The name @code{buffer-flush-undo} is not considered obsolete, but the |
| 1111 | preferred name is @code{buffer-disable-undo}. | 1125 | preferred name is @code{buffer-disable-undo}. |
| 1112 | @end defun | 1126 | @end deffn |
| 1113 | 1127 | ||
| 1114 | As editing continues, undo lists get longer and longer. To prevent | 1128 | As editing continues, undo lists get longer and longer. To prevent |
| 1115 | them from using up all available memory space, garbage collection trims | 1129 | them from using up all available memory space, garbage collection trims |
| @@ -1214,6 +1228,7 @@ filling when @var{justify} is non-@code{nil}. | |||
| 1214 | 1228 | ||
| 1215 | In an interactive call, any prefix argument requests justification. | 1229 | In an interactive call, any prefix argument requests justification. |
| 1216 | 1230 | ||
| 1231 | @cindex Adaptive Fill mode | ||
| 1217 | In Adaptive Fill mode, which is enabled by default, calling the function | 1232 | In Adaptive Fill mode, which is enabled by default, calling the function |
| 1218 | @code{fill-region-as-paragraph} on an indented paragraph when there is | 1233 | @code{fill-region-as-paragraph} on an indented paragraph when there is |
| 1219 | no fill prefix uses the indentation of the second line of the paragraph | 1234 | no fill prefix uses the indentation of the second line of the paragraph |
| @@ -1279,7 +1294,8 @@ newlines'' act as paragraph separators. | |||
| 1279 | @section Margins for Filling | 1294 | @section Margins for Filling |
| 1280 | 1295 | ||
| 1281 | @defopt fill-prefix | 1296 | @defopt fill-prefix |
| 1282 | This variable specifies a string of text that appears at the beginning | 1297 | This buffer-local variable specifies a string of text that appears at |
| 1298 | the beginning | ||
| 1283 | of normal text lines and should be disregarded when filling them. Any | 1299 | of normal text lines and should be disregarded when filling them. Any |
| 1284 | line that fails to start with the fill prefix is considered the start of | 1300 | line that fails to start with the fill prefix is considered the start of |
| 1285 | a paragraph; so is any line that starts with the fill prefix followed by | 1301 | a paragraph; so is any line that starts with the fill prefix followed by |
| @@ -1290,7 +1306,7 @@ together. The resulting filled lines also start with the fill prefix. | |||
| 1290 | The fill prefix follows the left margin whitespace, if any. | 1306 | The fill prefix follows the left margin whitespace, if any. |
| 1291 | @end defopt | 1307 | @end defopt |
| 1292 | 1308 | ||
| 1293 | @defopt fill-column | 1309 | @defvar fill-column |
| 1294 | This buffer-local variable specifies the maximum width of filled lines. | 1310 | This buffer-local variable specifies the maximum width of filled lines. |
| 1295 | Its value should be an integer, which is a number of columns. All the | 1311 | Its value should be an integer, which is a number of columns. All the |
| 1296 | filling, justification, and centering commands are affected by this | 1312 | filling, justification, and centering commands are affected by this |
| @@ -1300,7 +1316,7 @@ As a practical matter, if you are writing text for other people to | |||
| 1300 | read, you should set @code{fill-column} to no more than 70. Otherwise | 1316 | read, you should set @code{fill-column} to no more than 70. Otherwise |
| 1301 | the line will be too long for people to read comfortably, and this can | 1317 | the line will be too long for people to read comfortably, and this can |
| 1302 | make the text seem clumsy. | 1318 | make the text seem clumsy. |
| 1303 | @end defopt | 1319 | @end defvar |
| 1304 | 1320 | ||
| 1305 | @defvar default-fill-column | 1321 | @defvar default-fill-column |
| 1306 | The value of this variable is the default value for @code{fill-column} in | 1322 | The value of this variable is the default value for @code{fill-column} in |
| @@ -1367,8 +1383,8 @@ mode, @kbd{C-j} indents to this column. This variable automatically | |||
| 1367 | becomes buffer-local when set in any fashion. | 1383 | becomes buffer-local when set in any fashion. |
| 1368 | @end defvar | 1384 | @end defvar |
| 1369 | 1385 | ||
| 1370 | @tindex fill-nobreak-predicate | ||
| 1371 | @defvar fill-nobreak-predicate | 1386 | @defvar fill-nobreak-predicate |
| 1387 | @tindex fill-nobreak-predicate | ||
| 1372 | This variable gives major modes a way to specify not to break a line at | 1388 | This variable gives major modes a way to specify not to break a line at |
| 1373 | certain places. Its value should be a function. This function is | 1389 | certain places. Its value should be a function. This function is |
| 1374 | called during filling, with no arguments and with point located at the | 1390 | called during filling, with no arguments and with point located at the |
| @@ -1787,8 +1803,8 @@ indent the current line in a way appropriate for the current major mode. | |||
| 1787 | 1803 | ||
| 1788 | @deffn Command indent-for-tab-command | 1804 | @deffn Command indent-for-tab-command |
| 1789 | This command calls the function in @code{indent-line-function} to indent | 1805 | This command calls the function in @code{indent-line-function} to indent |
| 1790 | the current line; except that if that function is | 1806 | the current line; however, if that function is |
| 1791 | @code{indent-to-left-margin}, it calls @code{insert-tab} instead. (That | 1807 | @code{indent-to-left-margin}, @code{insert-tab} is called instead. (That |
| 1792 | is a trivial command that inserts a tab character.) | 1808 | is a trivial command that inserts a tab character.) |
| 1793 | @end deffn | 1809 | @end deffn |
| 1794 | 1810 | ||
| @@ -1842,7 +1858,8 @@ by making it start with the fill prefix. | |||
| 1842 | 1858 | ||
| 1843 | @defvar indent-region-function | 1859 | @defvar indent-region-function |
| 1844 | The value of this variable is a function that can be used by | 1860 | The value of this variable is a function that can be used by |
| 1845 | @code{indent-region} as a short cut. You should design the function so | 1861 | @code{indent-region} as a short cut. It should take two arguments, the |
| 1862 | start and end of the region. You should design the function so | ||
| 1846 | that it will produce the same results as indenting the lines of the | 1863 | that it will produce the same results as indenting the lines of the |
| 1847 | region one by one, but presumably faster. | 1864 | region one by one, but presumably faster. |
| 1848 | 1865 | ||
| @@ -2389,16 +2406,16 @@ position less than or equal to @var{pos}; it equals @var{pos} only if | |||
| 2389 | @var{limit} equals @var{pos}. | 2406 | @var{limit} equals @var{pos}. |
| 2390 | @end defun | 2407 | @end defun |
| 2391 | 2408 | ||
| 2392 | @tindex next-char-property-change | ||
| 2393 | @defun next-char-property-change position &optional limit | 2409 | @defun next-char-property-change position &optional limit |
| 2410 | @tindex next-char-property-change | ||
| 2394 | This is like @code{next-property-change} except that it considers | 2411 | This is like @code{next-property-change} except that it considers |
| 2395 | overlay properties as well as text properties. There is no @var{object} | 2412 | overlay properties as well as text properties. There is no @var{object} |
| 2396 | operand because this function operates only on the current buffer. It | 2413 | operand because this function operates only on the current buffer. It |
| 2397 | returns the next address at which either kind of property changes. | 2414 | returns the next address at which either kind of property changes. |
| 2398 | @end defun | 2415 | @end defun |
| 2399 | 2416 | ||
| 2400 | @tindex previous-char-property-change | ||
| 2401 | @defun previous-char-property-change position &optional limit | 2417 | @defun previous-char-property-change position &optional limit |
| 2418 | @tindex previous-char-property-change | ||
| 2402 | This is like @code{next-char-property-change}, but scans back from | 2419 | This is like @code{next-char-property-change}, but scans back from |
| 2403 | @var{position} instead of forward. | 2420 | @var{position} instead of forward. |
| 2404 | @end defun | 2421 | @end defun |
| @@ -3160,17 +3177,14 @@ end of the region just changed, and the length of the text that existed | |||
| 3160 | before the change. All three arguments are integers. The buffer that's | 3177 | before the change. All three arguments are integers. The buffer that's |
| 3161 | about to change is always the current buffer. | 3178 | about to change is always the current buffer. |
| 3162 | 3179 | ||
| 3163 | The length of the old text is measured in bytes; it is the difference | 3180 | The length of the old text the difference between the buffer positions |
| 3164 | between the buffer positions before and after that text, before the | 3181 | before and after that text as it was before the change. As for the |
| 3165 | change. As for the changed text, its length in bytes is simply the | 3182 | changed text, its length is simply the difference between the first two |
| 3166 | difference between the first two arguments. If you want the length | 3183 | arguments. |
| 3167 | in @emph{characters} of the text before the change, you should use | ||
| 3168 | a @code{before-change-functions} function that calls @code{chars-in-region} | ||
| 3169 | (@pxref{Chars and Bytes}). | ||
| 3170 | @end defvar | 3184 | @end defvar |
| 3171 | 3185 | ||
| 3172 | @tindex combine-after-change-calls | ||
| 3173 | @defmac combine-after-change-calls body... | 3186 | @defmac combine-after-change-calls body... |
| 3187 | @tindex combine-after-change-calls | ||
| 3174 | The macro executes @var{body} normally, but arranges to call the | 3188 | The macro executes @var{body} normally, but arranges to call the |
| 3175 | after-change functions just once for a series of several changes---if | 3189 | after-change functions just once for a series of several changes---if |
| 3176 | that seems safe. | 3190 | that seems safe. |
diff --git a/lispref/tips.texi b/lispref/tips.texi index 11522391a3f..264875768b9 100644 --- a/lispref/tips.texi +++ b/lispref/tips.texi | |||
| @@ -46,7 +46,7 @@ instead. | |||
| 46 | If you write a function that you think ought to be added to Emacs under | 46 | If you write a function that you think ought to be added to Emacs under |
| 47 | a certain name, such as @code{twiddle-files}, don't call it by that name | 47 | a certain name, such as @code{twiddle-files}, don't call it by that name |
| 48 | in your program. Call it @code{mylib-twiddle-files} in your program, | 48 | in your program. Call it @code{mylib-twiddle-files} in your program, |
| 49 | and send mail to @samp{bug-gnu-emacs@@prep.ai.mit.edu} suggesting we add | 49 | and send mail to @samp{bug-gnu-emacs@@gnu.org} suggesting we add |
| 50 | it to Emacs. If and when we do, we can change the name easily enough. | 50 | it to Emacs. If and when we do, we can change the name easily enough. |
| 51 | 51 | ||
| 52 | If one prefix is insufficient, your package may use two or three | 52 | If one prefix is insufficient, your package may use two or three |
| @@ -104,6 +104,8 @@ If a user option variable records a true-or-false condition, give it a | |||
| 104 | name that ends in @samp{-flag}. | 104 | name that ends in @samp{-flag}. |
| 105 | 105 | ||
| 106 | @item | 106 | @item |
| 107 | @cindex reserved keys | ||
| 108 | @cindex keys, reserved | ||
| 107 | Please do not define @kbd{C-c @var{letter}} as a key in your major | 109 | Please do not define @kbd{C-c @var{letter}} as a key in your major |
| 108 | modes. These sequences are reserved for users; they are the | 110 | modes. These sequences are reserved for users; they are the |
| 109 | @strong{only} sequences reserved for users, so do not block them. | 111 | @strong{only} sequences reserved for users, so do not block them. |
| @@ -262,7 +264,7 @@ Try to avoid compiler warnings about undefined free variables, by adding | |||
| 262 | If you bind a variable in one function, and use it or set it in another | 264 | If you bind a variable in one function, and use it or set it in another |
| 263 | function, the compiler warns about the latter function unless the | 265 | function, the compiler warns about the latter function unless the |
| 264 | variable has a definition. But often these variables have short names, | 266 | variable has a definition. But often these variables have short names, |
| 265 | and it is not clean for Lisp packages to define such variables names. | 267 | and it is not clean for Lisp packages to define such variable names. |
| 266 | Therefore, you should rename the variable to start with the name prefix | 268 | Therefore, you should rename the variable to start with the name prefix |
| 267 | used for the other functions and variables in your package. | 269 | used for the other functions and variables in your package. |
| 268 | 270 | ||
| @@ -317,8 +319,10 @@ Lisp programs. | |||
| 317 | @cindex profiling | 319 | @cindex profiling |
| 318 | @cindex timing programs | 320 | @cindex timing programs |
| 319 | @cindex @file{profile.el} | 321 | @cindex @file{profile.el} |
| 320 | Use the @file{profile} library to profile your program. See the file | 322 | @cindex @file{elp.el} |
| 321 | @file{profile.el} for instructions. | 323 | Profile your program with the @file{profile} library or the @file{elp} |
| 324 | library. See the files @file{profile.el} and @file{elp.el} for | ||
| 325 | instructions. | ||
| 322 | 326 | ||
| 323 | @item | 327 | @item |
| 324 | Use iteration rather than recursion whenever possible. | 328 | Use iteration rather than recursion whenever possible. |
| @@ -340,19 +344,13 @@ property. If the property is non-@code{nil}, then the function is | |||
| 340 | handled specially. | 344 | handled specially. |
| 341 | 345 | ||
| 342 | For example, the following input will show you that @code{aref} is | 346 | For example, the following input will show you that @code{aref} is |
| 343 | compiled specially (@pxref{Array Functions}) while @code{elt} is not | 347 | compiled specially (@pxref{Array Functions}): |
| 344 | (@pxref{Sequence Functions}): | ||
| 345 | 348 | ||
| 346 | @example | 349 | @example |
| 347 | @group | 350 | @group |
| 348 | (get 'aref 'byte-compile) | 351 | (get 'aref 'byte-compile) |
| 349 | @result{} byte-compile-two-args | 352 | @result{} byte-compile-two-args |
| 350 | @end group | 353 | @end group |
| 351 | |||
| 352 | @group | ||
| 353 | (get 'elt 'byte-compile) | ||
| 354 | @result{} nil | ||
| 355 | @end group | ||
| 356 | @end example | 354 | @end example |
| 357 | 355 | ||
| 358 | @item | 356 | @item |
| @@ -480,14 +478,39 @@ t and nil without single-quotes. (In this manual, we use a different | |||
| 480 | convention, with single-quotes for all symbols.) | 478 | convention, with single-quotes for all symbols.) |
| 481 | @end ifinfo | 479 | @end ifinfo |
| 482 | 480 | ||
| 483 | For example: | 481 | Help mode automatically creates hyperlinks when documentation strings |
| 482 | use symbol names inside single quotes, when the symbol has either a | ||
| 483 | function or a variable definition. You do not need to do anything | ||
| 484 | special to make use of this feature. However, when a symbol has both a | ||
| 485 | function definition and a variable definition, and you want to refer to | ||
| 486 | just one of them, you can specify which one by writing one of the words | ||
| 487 | @samp{variable}, @samp{option}, @samp{function}, or @samp{command}, | ||
| 488 | immediately before the symbol name. (Case makes no difference in | ||
| 489 | recognizing these indicator words.) For example, if you write | ||
| 490 | |||
| 491 | @example | ||
| 492 | This function sets the variable `buffer-file-name'. | ||
| 493 | @end example | ||
| 494 | |||
| 495 | @noindent | ||
| 496 | then the hyperlink will refer only to the variable documentation of | ||
| 497 | @code{buffer-file-name}, and not to its function documentation. | ||
| 498 | |||
| 499 | If a symbol has a function definition and/or a variable definition, but | ||
| 500 | those are irrelevant to the use of the symbol that you are documenting, | ||
| 501 | you can write the word @samp{symbol} before the symbol name to prevent | ||
| 502 | making any hyperlink. For example, | ||
| 484 | 503 | ||
| 485 | @example | 504 | @example |
| 486 | The value of `swim-speed' specifies how fast to swim. | 505 | If the argument KIND-OF-RESULT is the symbol `list', |
| 487 | Possible values are t for high speed, nil for low speed, | 506 | this function returns a list of all the objects |
| 488 | and `medium' for medium speed. | 507 | that satisfy the criterion. |
| 489 | @end example | 508 | @end example |
| 490 | 509 | ||
| 510 | @noindent | ||
| 511 | does not make a hyperlink to the documentation, irrelevant here, of the | ||
| 512 | function @code{list}. | ||
| 513 | |||
| 491 | @item | 514 | @item |
| 492 | Don't write key sequences directly in documentation strings. Instead, | 515 | Don't write key sequences directly in documentation strings. Instead, |
| 493 | use the @samp{\\[@dots{}]} construct to stand for them. For example, | 516 | use the @samp{\\[@dots{}]} construct to stand for them. For example, |
| @@ -692,6 +715,8 @@ example). | |||
| 692 | 715 | ||
| 693 | @item Keywords | 716 | @item Keywords |
| 694 | This line lists keywords for the @code{finder-by-keyword} help command. | 717 | This line lists keywords for the @code{finder-by-keyword} help command. |
| 718 | Please use that command to see a list of the meaningful keywords. | ||
| 719 | |||
| 695 | This field is important; it's how people will find your package when | 720 | This field is important; it's how people will find your package when |
| 696 | they're looking for things by topic area. To separate the keywords, you | 721 | they're looking for things by topic area. To separate the keywords, you |
| 697 | can use spaces, commas, or both. | 722 | can use spaces, commas, or both. |
| @@ -708,14 +733,21 @@ library file. Here is a table of them: | |||
| 708 | @table @samp | 733 | @table @samp |
| 709 | @item ;;; Commentary: | 734 | @item ;;; Commentary: |
| 710 | This begins introductory comments that explain how the library works. | 735 | This begins introductory comments that explain how the library works. |
| 711 | It should come right after the copying permissions. | 736 | It should come right after the copying permissions, terminated by a |
| 737 | @samp{Change Log}, @samp{History} or @samp{Code} comment line. This | ||
| 738 | text is used by the Finder package, so it should make sense in that | ||
| 739 | context. | ||
| 740 | |||
| 741 | @item ;;; Documentation | ||
| 742 | This has been used in some files in place of @samp{;;; Commentary:}, | ||
| 743 | but @samp{;;; Commentary:} is preferred. | ||
| 712 | 744 | ||
| 713 | @item ;;; Change log: | 745 | @item ;;; Change Log: |
| 714 | This begins change log information stored in the library file (if you | 746 | This begins change log information stored in the library file (if you |
| 715 | store the change history there). For most of the Lisp | 747 | store the change history there). For most of the Lisp |
| 716 | files distributed with Emacs, the change history is kept in the file | 748 | files distributed with Emacs, the change history is kept in the file |
| 717 | @file{ChangeLog} and not in the source file at all; these files do | 749 | @file{ChangeLog} and not in the source file at all; these files do |
| 718 | not have a @samp{;;; Change log:} line. | 750 | not have a @samp{;;; Change Log:} line. |
| 719 | 751 | ||
| 720 | @item ;;; Code: | 752 | @item ;;; Code: |
| 721 | This begins the actual code of the program. | 753 | This begins the actual code of the program. |
diff --git a/lispref/variables.texi b/lispref/variables.texi index 4517d6bb02f..1451db07d06 100644 --- a/lispref/variables.texi +++ b/lispref/variables.texi | |||
| @@ -104,7 +104,7 @@ include @code{nil} and @code{t}, as well as any symbol whose name starts | |||
| 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 symbol to | 107 | starts with @samp{:}, except that you are allowed to set such a symbol to |
| 108 | itself. | 108 | itself. |
| 109 | 109 | ||
| 110 | @example | 110 | @example |
| @@ -118,8 +118,8 @@ nil @equiv{} 'nil | |||
| 118 | @end group | 118 | @end group |
| 119 | @end example | 119 | @end example |
| 120 | 120 | ||
| 121 | @tindex keyword-symbols-constant-flag | ||
| 122 | @defvar keyword-symbols-constant-flag | 121 | @defvar keyword-symbols-constant-flag |
| 122 | @tindex keyword-symbols-constant-flag | ||
| 123 | If this variable is @code{nil}, you are allowed to set and bind symbols | 123 | If this variable is @code{nil}, you are allowed to set and bind symbols |
| 124 | whose names start with @samp{:} as you wish. This is to make it | 124 | whose names start with @samp{:} as you wish. This is to make it |
| 125 | possible to run old Lisp programs which do that. | 125 | possible to run old Lisp programs which do that. |
| @@ -247,27 +247,29 @@ Macro calls (@pxref{Macros}). | |||
| 247 | @end itemize | 247 | @end itemize |
| 248 | 248 | ||
| 249 | Variables can also have buffer-local bindings (@pxref{Buffer-Local | 249 | Variables can also have buffer-local bindings (@pxref{Buffer-Local |
| 250 | Variables}); a few variables have terminal-local bindings | 250 | Variables}) and frame-local bindings (@pxref{Frame-Local Variables}); a |
| 251 | (@pxref{Multiple Displays}). These kinds of bindings work somewhat like | 251 | few variables have terminal-local bindings (@pxref{Multiple Displays}). |
| 252 | ordinary local bindings, but they are localized depending on ``where'' | 252 | These kinds of bindings work somewhat like ordinary local bindings, but |
| 253 | you are in Emacs, rather than localized in time. | 253 | they are localized depending on ``where'' you are in Emacs, rather than |
| 254 | localized in time. | ||
| 254 | 255 | ||
| 255 | @defvar max-specpdl-size | 256 | @defvar max-specpdl-size |
| 256 | @cindex variable limit error | 257 | @cindex variable limit error |
| 257 | @cindex evaluation error | 258 | @cindex evaluation error |
| 258 | @cindex infinite recursion | 259 | @cindex infinite recursion |
| 259 | This variable defines the limit on the total number of local variable | 260 | This variable defines the limit on the total number of local variable |
| 260 | bindings and @code{unwind-protect} cleanups (@pxref{Nonlocal Exits}) | 261 | bindings and @code{unwind-protect} cleanups (@pxref{Nonlocal Exits}) |
| 261 | that are allowed before signaling an error (with data @code{"Variable | 262 | that are allowed before signaling an error (with data @code{"Variable |
| 262 | binding depth exceeds max-specpdl-size"}). | 263 | binding depth exceeds max-specpdl-size"}). |
| 263 | 264 | ||
| 264 | This limit, with the associated error when it is exceeded, is one way | 265 | This limit, with the associated error when it is exceeded, is one way |
| 265 | that Lisp avoids infinite recursion on an ill-defined function. | 266 | that Lisp avoids infinite recursion on an ill-defined function. |
| 266 | 267 | @code{max-lisp-eval-depth} provides another limit on depth of nesting. | |
| 267 | The default value is 600. | ||
| 268 | |||
| 269 | @code{max-lisp-eval-depth} provides another limit on depth of nesting. | ||
| 270 | @xref{Eval}. | 268 | @xref{Eval}. |
| 269 | |||
| 270 | The default value is 600. Entry to the Lisp debugger increases the | ||
| 271 | value, if there is little room left, to make sure the debugger itself | ||
| 272 | has room to execute. | ||
| 271 | @end defvar | 273 | @end defvar |
| 272 | 274 | ||
| 273 | @node Void Variables | 275 | @node Void Variables |
| @@ -430,14 +432,15 @@ already has a value (i.e., it is not void), @var{value} is not even | |||
| 430 | evaluated, and @var{symbol}'s value remains unchanged. If @var{value} | 432 | evaluated, and @var{symbol}'s value remains unchanged. If @var{value} |
| 431 | is omitted, the value of @var{symbol} is not changed in any case. | 433 | is omitted, the value of @var{symbol} is not changed in any case. |
| 432 | 434 | ||
| 435 | If @var{symbol} has a buffer-local binding in the current buffer, | ||
| 436 | @code{defvar} operates on the default value, which is buffer-independent, | ||
| 437 | not the current (buffer-local) binding. It sets the default value if | ||
| 438 | the default value is void. @xref{Buffer-Local Variables}. | ||
| 439 | |||
| 433 | When you evaluate a top-level @code{defvar} form with @kbd{C-M-x} in | 440 | When you evaluate a top-level @code{defvar} form with @kbd{C-M-x} in |
| 434 | Emacs Lisp mode (@code{eval-defun}), a special feature of | 441 | Emacs Lisp mode (@code{eval-defun}), a special feature of |
| 435 | @code{eval-defun} arranges to set the variable unconditionally even if | 442 | @code{eval-defun} arranges to set the variable unconditionally, without |
| 436 | the variable already has a value. | 443 | testing whether its value is void. |
| 437 | |||
| 438 | If @var{symbol} has a buffer-local binding in the current buffer, | ||
| 439 | @code{defvar} sets the default (buffer-independent) value, not the | ||
| 440 | buffer-local value. @xref{Buffer-Local Variables}. | ||
| 441 | 444 | ||
| 442 | If the @var{doc-string} argument appears, it specifies the documentation | 445 | If the @var{doc-string} argument appears, it specifies the documentation |
| 443 | for the variable. (This opportunity to specify documentation is one of | 446 | for the variable. (This opportunity to specify documentation is one of |
| @@ -518,9 +521,10 @@ symbol to be defined must appear explicitly in the @code{defconst}. | |||
| 518 | 521 | ||
| 519 | @code{defconst} always evaluates @var{value}, and sets the value of | 522 | @code{defconst} always evaluates @var{value}, and sets the value of |
| 520 | @var{symbol} to the result if @var{value} is given. If @var{symbol} | 523 | @var{symbol} to the result if @var{value} is given. If @var{symbol} |
| 521 | does has a buffer-local binding in the current buffer, @code{defconst} | 524 | does have a buffer-local binding in the current buffer, @code{defconst} |
| 522 | sets the default value, not the buffer-local value. But you should not | 525 | sets the default value, not the buffer-local value. (But you should not |
| 523 | be making the symbol buffer-local if it is defined with @code{defconst}. | 526 | be making buffer-local bindings for a symbol that is defined with |
| 527 | @code{defconst}.) | ||
| 524 | 528 | ||
| 525 | Here, @code{pi} is a constant that presumably ought not to be changed | 529 | Here, @code{pi} is a constant that presumably ought not to be changed |
| 526 | by anyone (attempts by the Indiana State Legislature notwithstanding). | 530 | by anyone (attempts by the Indiana State Legislature notwithstanding). |
| @@ -560,7 +564,7 @@ then the variable is a user option. | |||
| 560 | 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 |
| 561 | 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 |
| 562 | to @code{interactive} (@pxref{Using Interactive}). However, this feature | 566 | to @code{interactive} (@pxref{Using Interactive}). However, this feature |
| 563 | is largely obsoleted by the @code{defcustom} (@pxref{Customization}). | 567 | is largely obsoleted by @code{defcustom} (@pxref{Customization}). |
| 564 | 568 | ||
| 565 | @strong{Warning:} If the @code{defconst} and @code{defvar} special | 569 | @strong{Warning:} If the @code{defconst} and @code{defvar} special |
| 566 | forms are used while the variable has a local binding, they set the | 570 | forms are used while the variable has a local binding, they set the |
| @@ -1069,7 +1073,7 @@ and/or frames is an important customization method. | |||
| 1069 | 1073 | ||
| 1070 | This section describes buffer-local bindings; for frame-local | 1074 | This section describes buffer-local bindings; for frame-local |
| 1071 | bindings, see the following section, @ref{Frame-Local Variables}. (A few | 1075 | bindings, see the following section, @ref{Frame-Local Variables}. (A few |
| 1072 | variables have bindings that are local to a X terminal; see | 1076 | variables have bindings that are local to each X terminal; see |
| 1073 | @ref{Multiple Displays}.) | 1077 | @ref{Multiple Displays}.) |
| 1074 | 1078 | ||
| 1075 | @menu | 1079 | @menu |
| @@ -1137,8 +1141,8 @@ can scramble the values of the buffer-local and default bindings. | |||
| 1137 | 1141 | ||
| 1138 | To preserve your sanity, avoid using a variable in that way. If you | 1142 | To preserve your sanity, avoid using a variable in that way. If you |
| 1139 | use @code{save-excursion} around each piece of code that changes to a | 1143 | use @code{save-excursion} around each piece of code that changes to a |
| 1140 | different current buffer, you will not have this problem. Here is an | 1144 | different current buffer, you will not have this problem |
| 1141 | example of what to avoid: | 1145 | (@pxref{Excursions}). Here is an example of what to avoid: |
| 1142 | 1146 | ||
| 1143 | @example | 1147 | @example |
| 1144 | @group | 1148 | @group |
| @@ -1288,7 +1292,7 @@ then the variable appears directly in the resulting list. | |||
| 1288 | (setq lcl (buffer-local-variables)) | 1292 | (setq lcl (buffer-local-variables)) |
| 1289 | ;; @r{First, built-in variables local in all buffers:} | 1293 | ;; @r{First, built-in variables local in all buffers:} |
| 1290 | @result{} ((mark-active . nil) | 1294 | @result{} ((mark-active . nil) |
| 1291 | (buffer-undo-list nil) | 1295 | (buffer-undo-list . nil) |
| 1292 | (mode-name . "Fundamental") | 1296 | (mode-name . "Fundamental") |
| 1293 | @dots{} | 1297 | @dots{} |
| 1294 | @group | 1298 | @group |
| @@ -1331,8 +1335,9 @@ result, the buffer will see the default values of most variables. | |||
| 1331 | 1335 | ||
| 1332 | This function also resets certain other information pertaining to the | 1336 | This function also resets certain other information pertaining to the |
| 1333 | buffer: it sets the local keymap to @code{nil}, the syntax table to the | 1337 | buffer: it sets the local keymap to @code{nil}, the syntax table to the |
| 1334 | value of @code{standard-syntax-table}, and the abbrev table to the value | 1338 | value of @code{(standard-syntax-table)}, the case table to |
| 1335 | of @code{fundamental-mode-abbrev-table}. | 1339 | @code{(standard-case-table)}, and the abbrev table to the value of |
| 1340 | @code{fundamental-mode-abbrev-table}. | ||
| 1336 | 1341 | ||
| 1337 | The very first thing this function does is run the normal hook | 1342 | The very first thing this function does is run the normal hook |
| 1338 | @code{change-major-mode-hook} (see below). | 1343 | @code{change-major-mode-hook} (see below). |
| @@ -1400,10 +1405,11 @@ default value is nonvoid. If @code{(default-boundp 'foo)} returns | |||
| 1400 | @code{symbol-value}. | 1405 | @code{symbol-value}. |
| 1401 | @end defun | 1406 | @end defun |
| 1402 | 1407 | ||
| 1403 | @defspec setq-default symbol value | 1408 | @defspec setq-default [symbol form]@dots{} |
| 1404 | This sets the default value of @var{symbol} to @var{value}. It does not | 1409 | This special form gives each @var{symbol} a new default value, which is |
| 1405 | evaluate @var{symbol}, but does evaluate @var{value}. The value of the | 1410 | the result of evaluating the corresponding @var{form}. It does not |
| 1406 | @code{setq-default} form is @var{value}. | 1411 | evaluate @var{symbol}, but does evaluate @var{form}. The value of the |
| 1412 | @code{setq-default} form is the value of the last @var{form}. | ||
| 1407 | 1413 | ||
| 1408 | If a @var{symbol} is not buffer-local for the current buffer, and is not | 1414 | If a @var{symbol} is not buffer-local for the current buffer, and is not |
| 1409 | marked automatically buffer-local, @code{setq-default} has the same | 1415 | marked automatically buffer-local, @code{setq-default} has the same |
| @@ -1492,17 +1498,18 @@ name as the parameter name. | |||
| 1492 | To enable frame-local bindings for a certain variable, call the function | 1498 | To enable frame-local bindings for a certain variable, call the function |
| 1493 | @code{make-variable-frame-local}. | 1499 | @code{make-variable-frame-local}. |
| 1494 | 1500 | ||
| 1495 | @defun make-variable-frame-local variable | 1501 | @deffn Command make-variable-frame-local variable |
| 1496 | Enable the use of frame-local bindings for @var{variable}. This does | 1502 | Enable the use of frame-local bindings for @var{variable}. This does |
| 1497 | not in itself create any frame-local bindings for the variable; however, | 1503 | not in itself create any frame-local bindings for the variable; however, |
| 1498 | if some frame already has a value for @var{variable} as a frame | 1504 | if some frame already has a value for @var{variable} as a frame |
| 1499 | parameter, that value automatically becomes a frame-local binding. | 1505 | parameter, that value automatically becomes a frame-local binding. |
| 1500 | 1506 | ||
| 1501 | If the variable is terminal-local, this function signals an error. Such | 1507 | If the variable is terminal-local, this function signals an error, |
| 1502 | variables cannot have buffer-local bindings as well. @xref{Multiple | 1508 | because such variables cannot have frame-local bindings as well. |
| 1503 | Displays}. A few variables that are implemented specially in Emacs | 1509 | @xref{Multiple Displays}. A few variables that are implemented |
| 1504 | can be (and usually are) buffer-local, but can never be frame-local. | 1510 | specially in Emacs can be (and usually are) buffer-local, but can never |
| 1505 | @end defun | 1511 | be frame-local. |
| 1512 | @end deffn | ||
| 1506 | 1513 | ||
| 1507 | Buffer-local bindings take precedence over frame-local bindings. Thus, | 1514 | Buffer-local bindings take precedence over frame-local bindings. Thus, |
| 1508 | consider a variable @code{foo}: if the current buffer has a buffer-local | 1515 | consider a variable @code{foo}: if the current buffer has a buffer-local |
diff --git a/lispref/windows.texi b/lispref/windows.texi index 9199ff0f8d2..bd4bad02137 100644 --- a/lispref/windows.texi +++ b/lispref/windows.texi | |||
| @@ -597,7 +597,9 @@ when you need complete control. | |||
| 597 | 597 | ||
| 598 | @defun set-window-buffer window buffer-or-name | 598 | @defun set-window-buffer window buffer-or-name |
| 599 | This function makes @var{window} display @var{buffer-or-name} as its | 599 | This function makes @var{window} display @var{buffer-or-name} as its |
| 600 | contents. It returns @code{nil}. | 600 | contents. It returns @code{nil}. This is the fundamental primitive |
| 601 | for changing which buffer is displayed in a window, and all ways | ||
| 602 | of doing that call this function. | ||
| 601 | 603 | ||
| 602 | @example | 604 | @example |
| 603 | @group | 605 | @group |
| @@ -669,6 +671,16 @@ If it is a frame, consider windows on that frame. | |||
| 669 | @end itemize | 671 | @end itemize |
| 670 | @end defun | 672 | @end defun |
| 671 | 673 | ||
| 674 | @defvar buffer-display-time | ||
| 675 | @tindex buffer-display-time | ||
| 676 | This variable records the time at which a buffer was last made visible | ||
| 677 | in a window. It is always local in each buffer; each time | ||
| 678 | @code{set-window-buffer} is called, it sets this variable to | ||
| 679 | @code{(current-time)} in the specified buffer (@pxref{Time of Day}). | ||
| 680 | When a buffer is first created, @code{buffer-display-count} starts out | ||
| 681 | with the value @code{nil}. | ||
| 682 | @end defvar | ||
| 683 | |||
| 672 | @node Displaying Buffers | 684 | @node Displaying Buffers |
| 673 | @section Displaying Buffers in Windows | 685 | @section Displaying Buffers in Windows |
| 674 | @cindex switching to a buffer | 686 | @cindex switching to a buffer |
| @@ -685,7 +697,8 @@ See the preceding section for | |||
| 685 | @ifinfo | 697 | @ifinfo |
| 686 | @xref{Buffers and Windows}, for | 698 | @xref{Buffers and Windows}, for |
| 687 | @end ifinfo | 699 | @end ifinfo |
| 688 | low-level functions that give you more precise control. | 700 | low-level functions that give you more precise control. All of these |
| 701 | functions work by calling @code{set-window-buffer}. | ||
| 689 | 702 | ||
| 690 | Do not use the functions in this section in order to make a buffer | 703 | Do not use the functions in this section in order to make a buffer |
| 691 | current so that a Lisp program can access or modify it; they are too | 704 | current so that a Lisp program can access or modify it; they are too |
| @@ -786,14 +799,6 @@ don't care which other buffer is used; you just want to make sure that | |||
| 786 | This function returns @code{nil}. | 799 | This function returns @code{nil}. |
| 787 | @end deffn | 800 | @end deffn |
| 788 | 801 | ||
| 789 | @tindex buffer-display-count | ||
| 790 | @defvar buffer-display-count | ||
| 791 | This variable is always buffer-local in each buffer. When the buffer is | ||
| 792 | created, @code{buffer-display-count} has value 0. Each time the buffer | ||
| 793 | is displayed in a window, that increments the value of | ||
| 794 | @code{buffer-display-count}. | ||
| 795 | @end defvar | ||
| 796 | |||
| 797 | @node Choosing Window | 802 | @node Choosing Window |
| 798 | @section Choosing a Window for Display | 803 | @section Choosing a Window for Display |
| 799 | 804 | ||
| @@ -1308,13 +1313,14 @@ Replaces three keystroke sequence C-u 0 C-l." | |||
| 1308 | @section Horizontal Scrolling | 1313 | @section Horizontal Scrolling |
| 1309 | @cindex horizontal scrolling | 1314 | @cindex horizontal scrolling |
| 1310 | 1315 | ||
| 1311 | Because we read English first from top to bottom and second from left | 1316 | Because we read English from left to right in the ``inner loop'', and |
| 1312 | to right, horizontal scrolling is not like vertical scrolling. Vertical | 1317 | from top to bottom in the ``outer loop'', horizontal scrolling is not |
| 1313 | scrolling involves selection of a contiguous portion of text to display. | 1318 | like vertical scrolling. Vertical scrolling involves selection of a |
| 1314 | Horizontal scrolling causes part of each line to go off screen. The | 1319 | contiguous portion of text to display, but horizontal scrolling causes |
| 1315 | amount of horizontal scrolling is therefore specified as a number of | 1320 | part of each line to go off screen. The amount of horizontal scrolling |
| 1316 | columns rather than as a position in the buffer. It has nothing to do | 1321 | is therefore specified as a number of columns rather than as a position |
| 1317 | with the display-start position returned by @code{window-start}. | 1322 | in the buffer. It has nothing to do with the display-start position |
| 1323 | returned by @code{window-start}. | ||
| 1318 | 1324 | ||
| 1319 | Usually, no horizontal scrolling is in effect; then the leftmost | 1325 | Usually, no horizontal scrolling is in effect; then the leftmost |
| 1320 | column is at the left edge of the window. In this state, scrolling to | 1326 | column is at the left edge of the window. In this state, scrolling to |
| @@ -1838,8 +1844,8 @@ over. In most cases, @code{save-selected-window} (@pxref{Selecting | |||
| 1838 | Windows}) is what you need here. | 1844 | Windows}) is what you need here. |
| 1839 | @end defvar | 1845 | @end defvar |
| 1840 | 1846 | ||
| 1841 | @tindex redisplay-end-trigger-functions | ||
| 1842 | @defvar redisplay-end-trigger-functions | 1847 | @defvar redisplay-end-trigger-functions |
| 1848 | @tindex redisplay-end-trigger-functions | ||
| 1843 | This abnormal hook is run whenever redisplay in window uses text that | 1849 | This abnormal hook is run whenever redisplay in window uses text that |
| 1844 | extends past a specified end trigger position. You set the end trigger | 1850 | extends past a specified end trigger position. You set the end trigger |
| 1845 | position with the function @code{set-window-redisplay-end-trigger}. The | 1851 | position with the function @code{set-window-redisplay-end-trigger}. The |
| @@ -1849,19 +1855,19 @@ feature, and the trigger value is automatically reset to @code{nil} just | |||
| 1849 | after the hook is run. | 1855 | after the hook is run. |
| 1850 | @end defvar | 1856 | @end defvar |
| 1851 | 1857 | ||
| 1852 | @tindex set-window-redisplay-end-trigger | ||
| 1853 | @defun set-window-redisplay-end-trigger window position | 1858 | @defun set-window-redisplay-end-trigger window position |
| 1859 | @tindex set-window-redisplay-end-trigger | ||
| 1854 | This function sets @var{window}'s end trigger position at | 1860 | This function sets @var{window}'s end trigger position at |
| 1855 | @var{position}. | 1861 | @var{position}. |
| 1856 | @end defun | 1862 | @end defun |
| 1857 | 1863 | ||
| 1858 | @tindex window-redisplay-end-trigger | ||
| 1859 | @defun window-redisplay-end-trigger window | 1864 | @defun window-redisplay-end-trigger window |
| 1865 | @tindex window-redisplay-end-trigger | ||
| 1860 | This function returns @var{window}'s current end trigger position. | 1866 | This function returns @var{window}'s current end trigger position. |
| 1861 | @end defun | 1867 | @end defun |
| 1862 | 1868 | ||
| 1863 | @tindex window-configuration-change-hook | ||
| 1864 | @defvar window-configuration-change-hook | 1869 | @defvar window-configuration-change-hook |
| 1870 | @tindex window-configuration-change-hook | ||
| 1865 | A normal hook that is run every time you change the window configuration | 1871 | A normal hook that is run every time you change the window configuration |
| 1866 | of an existing frame. This includes splitting or deleting windows, | 1872 | of an existing frame. This includes splitting or deleting windows, |
| 1867 | changing the sizes of windows, or displaying a different buffer in a | 1873 | changing the sizes of windows, or displaying a different buffer in a |