diff options
| author | Luc Teirlinck | 2004-02-24 03:18:45 +0000 |
|---|---|---|
| committer | Luc Teirlinck | 2004-02-24 03:18:45 +0000 |
| commit | 6763a405466811482cdbe78a194e9b4d9bbb2c8c (patch) | |
| tree | c5f53ba79232b0bc8264ab5213ad5a1c5c63b6fc | |
| parent | fb2c91be8ee7de88d5d852d67a1738dc407d076b (diff) | |
| download | emacs-6763a405466811482cdbe78a194e9b4d9bbb2c8c.tar.gz emacs-6763a405466811482cdbe78a194e9b4d9bbb2c8c.zip | |
Various corrections and clarifications in addition to the following:
(Abbrev Tables): Delete add-abbrev (as suggested by RMS).
| -rw-r--r-- | lispref/abbrevs.texi | 113 |
1 files changed, 61 insertions, 52 deletions
diff --git a/lispref/abbrevs.texi b/lispref/abbrevs.texi index f123a3e1411..33ebecd70e5 100644 --- a/lispref/abbrevs.texi +++ b/lispref/abbrevs.texi | |||
| @@ -24,12 +24,17 @@ 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 the use count, the number of times the abbreviation |
| 27 | has been expanded. (Alternatively, the use count is on the | 27 | has been expanded. Alternatively, the use count is on the |
| 28 | @code{count} property and the system-abbrev flag is on the | 28 | @code{count} property and the system-abbrev flag is on the |
| 29 | @code{system-type} property.) Because these symbols are not interned | 29 | @code{system-type} property. Abbrevs with a non-@code{nil} |
| 30 | in the usual obarray, they will never appear as the result of reading | 30 | @code{system-type} property are called ``system'' abbrevs. They are |
| 31 | a Lisp expression; in fact, normally they are never used except by the | 31 | usually defined by modes or packages, instead of by the user, and are |
| 32 | code that handles abbrevs. Therefore, it is safe to use them in an | 32 | treated specially in certain respects. |
| 33 | |||
| 34 | 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 | ||
| 36 | expression; in fact, normally they are never used except by the code | ||
| 37 | that handles abbrevs. Therefore, it is safe to use them in an | ||
| 33 | extremely nonstandard way. @xref{Creating Symbols}. | 38 | extremely nonstandard way. @xref{Creating Symbols}. |
| 34 | 39 | ||
| 35 | For the user-level commands for abbrevs, see @ref{Abbrevs,, Abbrev | 40 | For the user-level commands for abbrevs, see @ref{Abbrevs,, Abbrev |
| @@ -82,7 +87,9 @@ leaving it empty. It always returns @code{nil}. | |||
| 82 | 87 | ||
| 83 | @defun copy-abbrev-table table | 88 | @defun copy-abbrev-table table |
| 84 | This function returns a copy of abbrev table @var{table}---a new | 89 | This function returns a copy of abbrev table @var{table}---a new |
| 85 | abbrev table that contains the same abbrev definitions. | 90 | abbrev table that contains the same abbrev definitions. The only |
| 91 | difference between @var{table} and the returned copy is that this | ||
| 92 | function sets the property lists of all copied abbrevs to 0. | ||
| 86 | @end defun | 93 | @end defun |
| 87 | 94 | ||
| 88 | @defun define-abbrev-table tabname definitions | 95 | @defun define-abbrev-table tabname definitions |
| @@ -90,8 +97,16 @@ This function defines @var{tabname} (a symbol) as an abbrev table | |||
| 90 | name, i.e., as a variable whose value is an abbrev table. It defines | 97 | name, i.e., as a variable whose value is an abbrev table. It defines |
| 91 | abbrevs in the table according to @var{definitions}, a list of | 98 | abbrevs in the table according to @var{definitions}, a list of |
| 92 | elements of the form @code{(@var{abbrevname} @var{expansion} | 99 | elements of the form @code{(@var{abbrevname} @var{expansion} |
| 93 | @var{hook} @var{usecount} @r{[}@var{system-flag}@r{]})}. The return | 100 | @var{hook} @var{usecount} @var{system-flag})}. If an element of |
| 94 | value is always @code{nil}. | 101 | @var{definitions} has length less than five, omitted elements default |
| 102 | to @code{nil}. A value of @code{nil} for @var{usecount} is equivalent | ||
| 103 | to zero. The return value is always @code{nil}. | ||
| 104 | |||
| 105 | If this function is called more than once for the same @var{tabname}, | ||
| 106 | subsequent calls add the definitions in @var{definitions} to | ||
| 107 | @var{tabname}, rather than overriding the entire original contents. | ||
| 108 | (A subsequent call only overrides abbrevs explicitly redefined or | ||
| 109 | undefined in @var{definitions}.) | ||
| 95 | @end defun | 110 | @end defun |
| 96 | 111 | ||
| 97 | @defvar abbrev-table-name-list | 112 | @defvar abbrev-table-name-list |
| @@ -105,38 +120,24 @@ named @var{name}. The argument @var{name} is a symbol whose value is an | |||
| 105 | abbrev table. The return value is always @code{nil}. | 120 | abbrev table. The return value is always @code{nil}. |
| 106 | 121 | ||
| 107 | If @var{human} is non-@code{nil}, the description is human-oriented. | 122 | If @var{human} is non-@code{nil}, the description is human-oriented. |
| 108 | Otherwise the description is a Lisp expression---a call to | 123 | System abbrevs are listed and identified as such. Otherwise the |
| 109 | @code{define-abbrev-table} that would define @var{name} exactly as it | 124 | description is a Lisp expression---a call to @code{define-abbrev-table} |
| 110 | is currently defined. | 125 | that would define @var{name} as it is currently defined, but without |
| 126 | the system abbrevs. (The mode or package using @var{name} is supposed | ||
| 127 | to add these to @var{name} separately.) | ||
| 111 | @end defun | 128 | @end defun |
| 112 | 129 | ||
| 113 | @node Defining Abbrevs, Abbrev Files, Abbrev Tables, Abbrevs | 130 | @node Defining Abbrevs, Abbrev Files, Abbrev Tables, Abbrevs |
| 114 | @comment node-name, next, previous, up | 131 | @comment node-name, next, previous, up |
| 115 | @section Defining Abbrevs | 132 | @section Defining Abbrevs |
| 116 | 133 | @code{define-abbrev} is the low-level basic function for defining an | |
| 117 | These functions define an abbrev in a specified abbrev table. | 134 | abbrev in a specified abbrev table. When major modes predefine |
| 118 | @code{define-abbrev} is the low-level basic function, while | 135 | standard abbrevs, they should call @code{define-abbrev} and specify |
| 119 | @code{add-abbrev} is used by commands that ask for information from | 136 | @code{t} for @var{system-flag}. |
| 120 | the user. When major modes predefine standard abbrevs, they should | ||
| 121 | call @code{define-abbrev} and specify @code{t} for @var{system-flag}. | ||
| 122 | |||
| 123 | @defun add-abbrev table type arg | ||
| 124 | This function adds an abbreviation to abbrev table @var{table} based on | ||
| 125 | information from the user. The argument @var{type} is a string | ||
| 126 | describing in English the kind of abbrev this will be (typically, | ||
| 127 | @code{"global"} or @code{"mode-specific"}); this is used in prompting | ||
| 128 | the user. The argument @var{arg} is the number of words in the | ||
| 129 | expansion. | ||
| 130 | |||
| 131 | The return value is the symbol that internally represents the new | ||
| 132 | abbrev, or @code{nil} if the user declines to confirm redefining an | ||
| 133 | existing abbrev. | ||
| 134 | @end defun | ||
| 135 | 137 | ||
| 136 | @defun define-abbrev table name expansion &optional hook count system-flag | 138 | @defun define-abbrev table name expansion &optional hook count system-flag |
| 137 | This function defines an abbrev named @var{name}, in @var{table}, to | 139 | This function defines an abbrev named @var{name}, in @var{table}, to |
| 138 | expand to @var{expansion} and call @var{hook}. The return value is a | 140 | expand to @var{expansion} and call @var{hook}. The return value is |
| 139 | symbol that represents the abbrev inside Emacs; its name is | ||
| 140 | @var{name}. | 141 | @var{name}. |
| 141 | 142 | ||
| 142 | The value of @var{count}, if specified, initializes the abbrev's | 143 | The value of @var{count}, if specified, initializes the abbrev's |
| @@ -210,9 +211,10 @@ This function does not display any messages. It returns @code{nil}. | |||
| 210 | @end defun | 211 | @end defun |
| 211 | 212 | ||
| 212 | @defopt save-abbrevs | 213 | @defopt save-abbrevs |
| 213 | A non-@code{nil} value for @code{save-abbrev} means that Emacs should | 214 | A non-@code{nil} value for @code{save-abbrevs} means that Emacs should |
| 214 | save abbrevs when files are saved. @code{abbrev-file-name} specifies | 215 | offer the user to save abbrevs when files are saved. If the value is |
| 215 | the file to save the abbrevs in. | 216 | @code{silently}, Emacs saves the abbrevs without asking the user. |
| 217 | @code{abbrev-file-name} specifies the file to save the abbrevs in. | ||
| 216 | @end defopt | 218 | @end defopt |
| 217 | 219 | ||
| 218 | @defvar abbrevs-changed | 220 | @defvar abbrevs-changed |
| @@ -222,11 +224,11 @@ various Emacs commands to offer to save your abbrevs. | |||
| 222 | @end defvar | 224 | @end defvar |
| 223 | 225 | ||
| 224 | @deffn Command write-abbrev-file &optional filename | 226 | @deffn Command write-abbrev-file &optional filename |
| 225 | Save all abbrev definitions (except ``system'' abbrevs), in all abbrev | 227 | Save all abbrev definitions (except ``system'' abbrevs), for all abbrev |
| 226 | tables, in the file @var{filename}, in the form of a Lisp program that | 228 | tables listed in @code{abbrev-table-name-list}, in the file |
| 227 | when loaded will define the same abbrevs. If @var{filename} is | 229 | @var{filename}, in the form of a Lisp program that when loaded will |
| 228 | @code{nil} or omitted, @code{abbrev-file-name} is used. This function | 230 | define the same abbrevs. If @var{filename} is @code{nil} or omitted, |
| 229 | returns @code{nil}. | 231 | @code{abbrev-file-name} is used. This function returns @code{nil}. |
| 230 | @end deffn | 232 | @end deffn |
| 231 | 233 | ||
| 232 | @node Abbrev Expansion, Standard Abbrev Tables, Abbrev Files, Abbrevs | 234 | @node Abbrev Expansion, Standard Abbrev Tables, Abbrev Files, Abbrevs |
| @@ -249,9 +251,10 @@ abbrev table. | |||
| 249 | 251 | ||
| 250 | @defun abbrev-expansion abbrev &optional table | 252 | @defun abbrev-expansion abbrev &optional table |
| 251 | This function returns the string that @var{abbrev} would expand into (as | 253 | This function returns the string that @var{abbrev} would expand into (as |
| 252 | defined by the abbrev tables used for the current buffer). The optional | 254 | defined by the abbrev tables used for the current buffer). If |
| 253 | argument @var{table} specifies the abbrev table to use, as in | 255 | @var{abbrev} is not a valid abbrev, the function returns @code{nil}. |
| 254 | @code{abbrev-symbol}. | 256 | The optional argument @var{table} specifies the abbrev table to use, |
| 257 | as in @code{abbrev-symbol}. | ||
| 255 | @end defun | 258 | @end defun |
| 256 | 259 | ||
| 257 | @deffn Command expand-abbrev | 260 | @deffn Command expand-abbrev |
| @@ -266,10 +269,15 @@ returns @code{nil} even though expansion did occur. | |||
| 266 | @end deffn | 269 | @end deffn |
| 267 | 270 | ||
| 268 | @deffn Command abbrev-prefix-mark &optional arg | 271 | @deffn Command abbrev-prefix-mark &optional arg |
| 269 | Mark current point as the beginning of an abbrev. The next call to | 272 | This command marks current point as the beginning of an abbrev. The |
| 270 | @code{expand-abbrev} will use the text from here to point (where it is | 273 | next call to @code{expand-abbrev} will use the text from here to point |
| 271 | then) as the abbrev to expand, rather than using the previous word as | 274 | (where it is then) as the abbrev to expand, rather than using the |
| 272 | usual. | 275 | previous word as usual. |
| 276 | |||
| 277 | First, this command expands any abbrev before point, unless @var{arg} | ||
| 278 | is non-@code{nil}. (Interactively, @var{arg} is the prefix argument.) | ||
| 279 | Then it inserts a hyphen before point, to indicate the start of the | ||
| 280 | next abbrev to be expanded. The actual expansion removes the hyphen. | ||
| 273 | @end deffn | 281 | @end deffn |
| 274 | 282 | ||
| 275 | @defopt abbrev-all-caps | 283 | @defopt abbrev-all-caps |
| @@ -280,11 +288,12 @@ expansion. | |||
| 280 | @end defopt | 288 | @end defopt |
| 281 | 289 | ||
| 282 | @defvar abbrev-start-location | 290 | @defvar abbrev-start-location |
| 283 | This is the buffer position for @code{expand-abbrev} to use as the start | 291 | This is a marker pointing to the buffer position for |
| 284 | of the next abbrev to be expanded. (@code{nil} means use the word | 292 | @code{expand-abbrev} to use as the start of the next abbrev to be |
| 285 | before point instead.) @code{abbrev-start-location} is set to | 293 | expanded. (@code{nil} means use the word before point instead.) |
| 286 | @code{nil} each time @code{expand-abbrev} is called. This variable is | 294 | @code{abbrev-start-location} is set to @code{nil} each time |
| 287 | also set by @code{abbrev-prefix-mark}. | 295 | @code{expand-abbrev} is called. This variable is also set by |
| 296 | @code{abbrev-prefix-mark}. | ||
| 288 | @end defvar | 297 | @end defvar |
| 289 | 298 | ||
| 290 | @defvar abbrev-start-location-buffer | 299 | @defvar abbrev-start-location-buffer |