diff options
| author | Stefan Monnier | 2007-10-30 01:39:19 +0000 |
|---|---|---|
| committer | Stefan Monnier | 2007-10-30 01:39:19 +0000 |
| commit | 79415279b3c0b8bc8b5f2a725a92c49cdc9d87bc (patch) | |
| tree | 8bcdf00a7cf66da4ec85d2e9f35154dd9d50b45c /doc | |
| parent | 15f3eb73ae7ee6763c5d39bdeb6588050b9636f2 (diff) | |
| download | emacs-79415279b3c0b8bc8b5f2a725a92c49cdc9d87bc.tar.gz emacs-79415279b3c0b8bc8b5f2a725a92c49cdc9d87bc.zip | |
Rename `count' and `system-flag' to :count and :system. Update all users.
(abbrev-get, abbrev-put): Simplify.
(define-abbrev): Don't store the `force' value in the :system property.
(abbrev--before-point): Obey the :enable-function of the abbrev as well.
Diffstat (limited to 'doc')
| -rw-r--r-- | doc/lispref/abbrevs.texi | 62 |
1 files changed, 27 insertions, 35 deletions
diff --git a/doc/lispref/abbrevs.texi b/doc/lispref/abbrevs.texi index 9ccafe2de24..8415bdca2be 100644 --- a/doc/lispref/abbrevs.texi +++ b/doc/lispref/abbrevs.texi | |||
| @@ -23,13 +23,10 @@ abbrev table. Normally both are used. | |||
| 23 | each abbreviation. The symbol's name is the abbreviation; its value | 23 | each abbreviation. The symbol's name is the abbreviation; its value |
| 24 | is the expansion; its function definition is the hook function to do | 24 | is the expansion; its function definition is the hook function to do |
| 25 | the expansion (@pxref{Defining Abbrevs}); its property list cell | 25 | the expansion (@pxref{Defining Abbrevs}); its property list cell |
| 26 | typically contains the use count, the number of times the abbreviation | 26 | typically contains various additional properties such as the use |
| 27 | has been expanded. Alternatively, the use count is on the | 27 | count, the number of times the abbreviation has been expanded, or |
| 28 | @code{count} property and the system-abbrev flag is on the | 28 | whether the abbrev is a so-called ``system'' abbrev defined by a major |
| 29 | @code{system-type} property. Abbrevs with a non-@code{nil} | 29 | mode rather than by the user (@pxref{Abbrev Properties}). |
| 30 | @code{system-type} property are called ``system'' abbrevs. They are | ||
| 31 | usually defined by modes or packages, instead of by the user, and are | ||
| 32 | treated specially in certain respects. | ||
| 33 | 30 | ||
| 34 | Because the symbols used for abbrevs are not interned in the usual | 31 | Because the symbols used for abbrevs are not interned in the usual |
| 35 | obarray, they will never appear as the result of reading a Lisp | 32 | obarray, they will never appear as the result of reading a Lisp |
| @@ -82,7 +79,8 @@ This is the same as @code{(default-value 'abbrev-mode)}. | |||
| 82 | @defun make-abbrev-table &rest props | 79 | @defun make-abbrev-table &rest props |
| 83 | This function creates and returns a new, empty abbrev table---an obarray | 80 | This function creates and returns a new, empty abbrev table---an obarray |
| 84 | containing no symbols. It is a vector filled with zeros. @var{props} | 81 | containing no symbols. It is a vector filled with zeros. @var{props} |
| 85 | is a property list that is applied to the new table. | 82 | is a property list that is applied to the new table |
| 83 | (@pxref{Abbrev Table Properties}). | ||
| 86 | @end defun | 84 | @end defun |
| 87 | 85 | ||
| 88 | @defun abbrev-table-p table | 86 | @defun abbrev-table-p table |
| @@ -145,7 +143,7 @@ to add these to @var{name} separately.) | |||
| 145 | @code{define-abbrev} is the low-level basic function for defining an | 143 | @code{define-abbrev} is the low-level basic function for defining an |
| 146 | abbrev in a specified abbrev table. When major modes predefine standard | 144 | abbrev in a specified abbrev table. When major modes predefine standard |
| 147 | abbrevs, they should call @code{define-abbrev} and specify a @code{t} for | 145 | abbrevs, they should call @code{define-abbrev} and specify a @code{t} for |
| 148 | the @code{system-flag} property. | 146 | the @code{:system} property. |
| 149 | Be aware that any saved non-``system'' abbrevs are | 147 | Be aware that any saved non-``system'' abbrevs are |
| 150 | restored at startup, i.e. before some major modes are loaded. Major modes | 148 | restored at startup, i.e. before some major modes are loaded. Major modes |
| 151 | should therefore not assume that when they are first loaded their abbrev | 149 | should therefore not assume that when they are first loaded their abbrev |
| @@ -155,6 +153,9 @@ tables are empty. | |||
| 155 | This function defines an abbrev named @var{name}, in @var{table}, to | 153 | This function defines an abbrev named @var{name}, in @var{table}, to |
| 156 | expand to @var{expansion} and call @var{hook}, with properties | 154 | expand to @var{expansion} and call @var{hook}, with properties |
| 157 | @var{props} (@pxref{Abbrev Properties}). The return value is @var{name}. | 155 | @var{props} (@pxref{Abbrev Properties}). The return value is @var{name}. |
| 156 | The @code{:system} property in @var{props} is treated specially here: | ||
| 157 | if it has the value @code{force}, then it will overwrite an existing | ||
| 158 | definition even for a non-``system'' abbrev of the same name. | ||
| 158 | 159 | ||
| 159 | The argument @var{name} should be a string. The argument | 160 | The argument @var{name} should be a string. The argument |
| 160 | @var{expansion} is normally the desired expansion (a string), or | 161 | @var{expansion} is normally the desired expansion (a string), or |
| @@ -413,8 +414,8 @@ This is the local abbrev table used in Lisp mode and Emacs Lisp mode. | |||
| 413 | @section Abbrev Properties | 414 | @section Abbrev Properties |
| 414 | 415 | ||
| 415 | Abbrevs have properties, some of which influence the way they work. | 416 | Abbrevs have properties, some of which influence the way they work. |
| 416 | They are usually set by providing the relevant arguments to | 417 | You can provide them as arguments to @code{define-abbrev} and you can |
| 417 | @code{define-abbrev} and can be manipulated with the functions: | 418 | manipulate them with the functions: |
| 418 | 419 | ||
| 419 | @defun abbrev-put abbrev prop val | 420 | @defun abbrev-put abbrev prop val |
| 420 | Set the property @var{prop} of abbrev @var{abbrev} to value @var{val}. | 421 | Set the property @var{prop} of abbrev @var{abbrev} to value @var{val}. |
| @@ -428,38 +429,34 @@ if the abbrev has no such property. | |||
| 428 | The following properties have special meaning: | 429 | The following properties have special meaning: |
| 429 | 430 | ||
| 430 | @table @code | 431 | @table @code |
| 431 | @item count | 432 | @item :count |
| 432 | This property counts the number of times the abbrev has | 433 | This property counts the number of times the abbrev has |
| 433 | been expanded. If not explicitly set, it is initialized to 0 by | 434 | been expanded. If not explicitly set, it is initialized to 0 by |
| 434 | @code{define-abbrev}. | 435 | @code{define-abbrev}. |
| 435 | 436 | ||
| 436 | @item system-flag | 437 | @item :system |
| 437 | If non-@code{nil}, this property marks the abbrev as a ``system'' | 438 | If non-@code{nil}, this property marks the abbrev as a ``system'' |
| 438 | abbrev. Such abbrevs will not be saved to @var{abbrev-file-name}. | 439 | abbrev. Such abbrevs will not be saved to @var{abbrev-file-name}. |
| 439 | Also, unless @code{system-flag} has the value @code{force}, | ||
| 440 | a ``system'' abbrev will not overwrite an existing definition for | ||
| 441 | a non-``system'' abbrev of the same name. | ||
| 442 | 440 | ||
| 443 | @item :enable-function | 441 | @item :enable-function |
| 444 | If non-@code{nil}, this property should be set to a function of no | 442 | If non-@code{nil}, this property should be a function of no |
| 445 | arguments which returns @code{nil} if the abbrev should not be used | 443 | arguments which returns @code{nil} if the abbrev should not be used |
| 446 | and @code{t} otherwise. | 444 | and @code{t} otherwise. |
| 447 | 445 | ||
| 448 | @item :case-fixed | 446 | @item :case-fixed |
| 449 | If non-@code{nil}, this property indicates that the case of the | 447 | If non-@code{nil}, this property indicates that the case of the |
| 450 | abbrev's name is significant and should only match a text with the | 448 | abbrev's name is significant and should only match a text with the |
| 451 | same capitalization. It also disables the code that modifies the | 449 | same pattern of capitalization. It also disables the code that |
| 452 | capitalization of the expansion. | 450 | modifies the capitalization of the expansion. |
| 453 | |||
| 454 | @end table | 451 | @end table |
| 455 | 452 | ||
| 456 | @node Abbrev Table Properties, , Abbrev Properties, Abbrevs | 453 | @node Abbrev Table Properties, , Abbrev Properties, Abbrevs |
| 457 | @section Abbrev Table Properties | 454 | @section Abbrev Table Properties |
| 458 | 455 | ||
| 459 | Like abbrevs, abble tables have properties, some of which influence | 456 | Like abbrevs, abble tables have properties, some of which influence |
| 460 | the way they work. They are usually set by providing the relevant | 457 | the way they work. You can provide them as arguments to |
| 461 | arguments to @code{define-abbrev-table} and can be manipulated with | 458 | @code{define-abbrev-table} and you can manipulate them with the |
| 462 | the functions: | 459 | functions: |
| 463 | 460 | ||
| 464 | @defun abbrev-table-put table prop val | 461 | @defun abbrev-table-put table prop val |
| 465 | Set the property @var{prop} of abbrev table @var{table} to value @var{val}. | 462 | Set the property @var{prop} of abbrev table @var{table} to value @var{val}. |
| @@ -474,26 +471,21 @@ The following properties have special meaning: | |||
| 474 | 471 | ||
| 475 | @table @code | 472 | @table @code |
| 476 | @item :enable-function | 473 | @item :enable-function |
| 477 | If non-@code{nil}, this property should be set to a function of no | 474 | This is like the @code{:enable-function} abbrev property except that |
| 478 | arguments which returns @code{nil} if the abbrev table should not be | 475 | it applies to all abbrevs in the table and is used even before trying |
| 479 | used and @code{t} otherwise. This is like the @code{:enable-function} | 476 | to find the abbrev before point so it can dynamically modify the |
| 480 | abbrev property except that it applies to all abbrevs in the table and | 477 | abbrev table. |
| 481 | is used even before trying to find the abbrev before point. | ||
| 482 | 478 | ||
| 483 | @item :case-fixed | 479 | @item :case-fixed |
| 484 | If non-@code{nil}, this property indicates that the case of the names | 480 | This is like the @code{:case-fixed} abbrev property except that it |
| 485 | is significant for all abbrevs in the table and should only match | 481 | applies to all abbrevs in the table. |
| 486 | a text with the same capitalization. It also disables the code that | ||
| 487 | modifies the capitalization of the expansion. This is like the | ||
| 488 | @code{:case-fixed} abbrev property except that it applies to all | ||
| 489 | abbrevs in the table. | ||
| 490 | 482 | ||
| 491 | @item :regexp | 483 | @item :regexp |
| 492 | If non-@code{nil}, this property is a regular expression that | 484 | If non-@code{nil}, this property is a regular expression that |
| 493 | indicates how to extract the name of the abbrev before point before | 485 | indicates how to extract the name of the abbrev before point before |
| 494 | looking it up in the table. When the regular expression matches | 486 | looking it up in the table. When the regular expression matches |
| 495 | before point, the abbrev name is expected to be in submatch 1. | 487 | before point, the abbrev name is expected to be in submatch 1. |
| 496 | If this property is nil, @code{expand-function} defaults to | 488 | If this property is @code{nil}, @code{expand-function} defaults to |
| 497 | @code{"\\<\\(\\w+\\)\\W"}. This property allows the use of abbrevs | 489 | @code{"\\<\\(\\w+\\)\\W"}. This property allows the use of abbrevs |
| 498 | whose name contains characters of non-word syntax. | 490 | whose name contains characters of non-word syntax. |
| 499 | 491 | ||