diff options
| author | Richard M. Stallman | 2001-12-30 20:07:27 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 2001-12-30 20:07:27 +0000 |
| commit | d9cc1d0ed374d1d432919d249985d80a1de0e80c (patch) | |
| tree | 21776ec3c95eed2d4ecd59e58a36110a6fcfb7b8 | |
| parent | 1b8c66fec815e707a148955f7cdd4c7dac517686 (diff) | |
| download | emacs-d9cc1d0ed374d1d432919d249985d80a1de0e80c.tar.gz emacs-d9cc1d0ed374d1d432919d249985d80a1de0e80c.zip | |
Explain about ``system'' abbrevs.
| -rw-r--r-- | lispref/abbrevs.texi | 67 |
1 files changed, 40 insertions, 27 deletions
diff --git a/lispref/abbrevs.texi b/lispref/abbrevs.texi index 58e1ffaf646..332e4878c28 100644 --- a/lispref/abbrevs.texi +++ b/lispref/abbrevs.texi | |||
| @@ -20,15 +20,17 @@ in the same major mode share one abbrev table. There is also a global | |||
| 20 | abbrev table. Normally both are used. | 20 | abbrev table. Normally both are used. |
| 21 | 21 | ||
| 22 | An abbrev table is represented as an obarray containing a symbol for | 22 | An abbrev table is represented as an obarray containing a symbol for |
| 23 | each abbreviation. The symbol's name is the abbreviation; its value is | 23 | each abbreviation. The symbol's name is the abbreviation; its value |
| 24 | the expansion; its function definition is the hook function to do the | 24 | is the expansion; its function definition is the hook function to do |
| 25 | expansion (@pxref{Defining Abbrevs}); its property list cell contains | 25 | the expansion (@pxref{Defining Abbrevs}); its property list cell |
| 26 | the use count, the number of times the abbreviation has been expanded. | 26 | typically contains the use count, the number of times the abbreviation |
| 27 | Because these symbols are not interned in the usual obarray, they will | 27 | has been expanded. (Alternatively, the use count is on the |
| 28 | never appear as the result of reading a Lisp expression; in fact, | 28 | @code{count} property and the system-abbrev flag is on the |
| 29 | normally they are never used except by the code that handles abbrevs. | 29 | @code{system-type} property.) Because these symbols are not interned |
| 30 | Therefore, it is safe to use them in an extremely nonstandard way. | 30 | in the usual obarray, they will never appear as the result of reading |
| 31 | @xref{Creating Symbols}. | 31 | a Lisp expression; in fact, normally they are never used except by the |
| 32 | code that handles abbrevs. Therefore, it is safe to use them in an | ||
| 33 | extremely nonstandard way. @xref{Creating Symbols}. | ||
| 32 | 34 | ||
| 33 | For the user-level commands for abbrevs, see @ref{Abbrevs,, Abbrev | 35 | For the user-level commands for abbrevs, see @ref{Abbrevs,, Abbrev |
| 34 | Mode, emacs, The GNU Emacs Manual}. | 36 | Mode, emacs, The GNU Emacs Manual}. |
| @@ -79,11 +81,12 @@ leaving it empty. It always returns @code{nil}. | |||
| 79 | @end defun | 81 | @end defun |
| 80 | 82 | ||
| 81 | @defun define-abbrev-table tabname definitions | 83 | @defun define-abbrev-table tabname definitions |
| 82 | This function defines @var{tabname} (a symbol) as an abbrev table name, | 84 | This function defines @var{tabname} (a symbol) as an abbrev table |
| 83 | i.e., as a variable whose value is an abbrev table. It defines abbrevs | 85 | name, i.e., as a variable whose value is an abbrev table. It defines |
| 84 | in the table according to @var{definitions}, a list of elements of the | 86 | abbrevs in the table according to @var{definitions}, a list of |
| 85 | form @code{(@var{abbrevname} @var{expansion} @var{hook} | 87 | elements of the form @code{(@var{abbrevname} @var{expansion} |
| 86 | @var{usecount})}. The return value is always @code{nil}. | 88 | @var{hook} @var{usecount} @r{[}@var{system-flag}@r{]})}. The return |
| 89 | value is always @code{nil}. | ||
| 87 | @end defun | 90 | @end defun |
| 88 | 91 | ||
| 89 | @defvar abbrev-table-name-list | 92 | @defvar abbrev-table-name-list |
| @@ -124,13 +127,15 @@ abbrev, or @code{nil} if the user declines to confirm redefining an | |||
| 124 | existing abbrev. | 127 | existing abbrev. |
| 125 | @end defun | 128 | @end defun |
| 126 | 129 | ||
| 127 | @defun define-abbrev table name expansion &optional hook count | 130 | @defun define-abbrev table name expansion &optional hook count system-flag |
| 128 | This function defines an abbrev named @var{name}, in @var{table}, to | 131 | This function defines an abbrev named @var{name}, in @var{table}, to |
| 129 | expand to @var{expansion} and call @var{hook}. The value of | 132 | expand to @var{expansion} and call @var{hook}. The return value is a |
| 130 | @var{count}, if specified, initializes the abbrev's usage-count. If | 133 | symbol that represents the abbrev inside Emacs; its name is |
| 131 | @var{count} is not specified or @code{nil}, the use count is initialized | 134 | @var{name}. |
| 132 | to zero. The return value is a symbol that represents the abbrev inside | 135 | |
| 133 | Emacs; its name is @var{name}. | 136 | The value of @var{count}, if specified, initializes the abbrev's |
| 137 | usage-count. If @var{count} is not specified or @code{nil}, the use | ||
| 138 | count is initialized to zero. | ||
| 134 | 139 | ||
| 135 | The argument @var{name} should be a string. The argument | 140 | The argument @var{name} should be a string. The argument |
| 136 | @var{expansion} is normally the desired expansion (a string), or | 141 | @var{expansion} is normally the desired expansion (a string), or |
| @@ -150,6 +155,13 @@ the self-inserting input character that triggered the expansion. If | |||
| 150 | of the character. By contrast, if @var{hook} returns @code{nil}, | 155 | of the character. By contrast, if @var{hook} returns @code{nil}, |
| 151 | @code{expand-abbrev} also returns @code{nil}, as if expansion had not | 156 | @code{expand-abbrev} also returns @code{nil}, as if expansion had not |
| 152 | really occurred. | 157 | really occurred. |
| 158 | |||
| 159 | Normally the function @code{define-abbrev} sets the variable | ||
| 160 | @code{abbrevs-changed} to @code{t}. But if @var{system-flag} is | ||
| 161 | non-@code{nil}, that says the abbrev is a ``system'' abbrev. In that | ||
| 162 | case, @code{define-abbrev} does not alter @code{abbrevs-changed}. | ||
| 163 | Instead it marks the abbrev as a ``system'' abbrev with the | ||
| 164 | @code{system-type} property. | ||
| 153 | @end defun | 165 | @end defun |
| 154 | 166 | ||
| 155 | @defopt only-global-abbrevs | 167 | @defopt only-global-abbrevs |
| @@ -195,16 +207,17 @@ the file to save the abbrevs in. | |||
| 195 | @end defopt | 207 | @end defopt |
| 196 | 208 | ||
| 197 | @defvar abbrevs-changed | 209 | @defvar abbrevs-changed |
| 198 | This variable is set non-@code{nil} by defining or altering any | 210 | This variable is set non-@code{nil} by defining or altering any |
| 199 | abbrevs. This serves as a flag for various Emacs commands to offer to | 211 | abbrevs (except ``system'' abbrevs). This serves as a flag for |
| 200 | save your abbrevs. | 212 | various Emacs commands to offer to save your abbrevs. |
| 201 | @end defvar | 213 | @end defvar |
| 202 | 214 | ||
| 203 | @deffn Command write-abbrev-file &optional filename | 215 | @deffn Command write-abbrev-file &optional filename |
| 204 | Save all abbrev definitions, in all abbrev tables, in the file | 216 | Save all abbrev definitions (except ``system'' abbrevs), in all abbrev |
| 205 | @var{filename}, in the form of a Lisp program that when loaded will | 217 | tables, in the file @var{filename}, in the form of a Lisp program that |
| 206 | define the same abbrevs. If @var{filename} is @code{nil} or omitted, | 218 | when loaded will define the same abbrevs. If @var{filename} is |
| 207 | @code{abbrev-file-name} is used. This function returns @code{nil}. | 219 | @code{nil} or omitted, @code{abbrev-file-name} is used. This function |
| 220 | returns @code{nil}. | ||
| 208 | @end deffn | 221 | @end deffn |
| 209 | 222 | ||
| 210 | @node Abbrev Expansion, Standard Abbrev Tables, Abbrev Files, Abbrevs | 223 | @node Abbrev Expansion, Standard Abbrev Tables, Abbrev Files, Abbrevs |