diff options
| author | Glenn Morris | 2012-03-03 18:45:04 -0800 |
|---|---|---|
| committer | Glenn Morris | 2012-03-03 18:45:04 -0800 |
| commit | ea16568d87f736736a532c0684de951bc382e4a9 (patch) | |
| tree | 5e20fc6f6836ffabf5d3df2c052945b364df7751 | |
| parent | a1e7225c983f616ed6b43c9861b9c1374bbab2bb (diff) | |
| download | emacs-ea16568d87f736736a532c0684de951bc382e4a9.tar.gz emacs-ea16568d87f736736a532c0684de951bc382e4a9.zip | |
Checked lispref/abbrevs.texi
* doc/lispref/abbrevs.texi: Small copyedits throughout.
(Abbrev Mode): Remove this section, folding it into the top-level.
(Abbrev Tables): Don't mention irrelevant return values.
(Abbrev Expansion): Add cross-ref for wrapper hooks.
(Standard Abbrev Tables): Emacs Lisp mode now has its own table.
(Abbrev Table Properties): Update nil :regexp description.
* lisp/abbrev.el (copy-abbrev-table, abbrev-table-p)
(abbrev-minor-mode-table-alist, define-abbrev, abbrev-insert)
(expand-abbrev, define-abbrev-table): Doc fixes.
* admin/FOR-RELEASE: Related markup.
| -rw-r--r-- | admin/FOR-RELEASE | 2 | ||||
| -rw-r--r-- | doc/emacs/abbrevs.texi | 3 | ||||
| -rw-r--r-- | doc/lispref/ChangeLog | 9 | ||||
| -rw-r--r-- | doc/lispref/abbrevs.texi | 121 | ||||
| -rw-r--r-- | doc/lispref/elisp.texi | 1 | ||||
| -rw-r--r-- | doc/lispref/vol1.texi | 1 | ||||
| -rw-r--r-- | doc/lispref/vol2.texi | 1 | ||||
| -rw-r--r-- | lisp/ChangeLog | 6 | ||||
| -rw-r--r-- | lisp/abbrev.el | 30 |
9 files changed, 95 insertions, 79 deletions
diff --git a/admin/FOR-RELEASE b/admin/FOR-RELEASE index 85c25286750..9daade6367c 100644 --- a/admin/FOR-RELEASE +++ b/admin/FOR-RELEASE | |||
| @@ -180,7 +180,7 @@ xresources.texi cyd | |||
| 180 | 180 | ||
| 181 | ** Check the Lisp manual. | 181 | ** Check the Lisp manual. |
| 182 | 182 | ||
| 183 | abbrevs.texi | 183 | abbrevs.texi rgm |
| 184 | advice.texi cyd | 184 | advice.texi cyd |
| 185 | anti.texi | 185 | anti.texi |
| 186 | back.texi | 186 | back.texi |
diff --git a/doc/emacs/abbrevs.texi b/doc/emacs/abbrevs.texi index 2df1a6b8d5a..f3b272c359d 100644 --- a/doc/emacs/abbrevs.texi +++ b/doc/emacs/abbrevs.texi | |||
| @@ -60,7 +60,8 @@ all major modes. The same abbrev can have a global definition and various | |||
| 60 | mode-specific definitions for different major modes. A mode-specific | 60 | mode-specific definitions for different major modes. A mode-specific |
| 61 | definition for the current major mode overrides a global definition. | 61 | definition for the current major mode overrides a global definition. |
| 62 | 62 | ||
| 63 | You can define abbrevs interactively during the editing session. You | 63 | You can define abbrevs interactively during the editing session, |
| 64 | irrespective of whether Abbrev mode is enabled. You | ||
| 64 | can also save lists of abbrev definitions in files for use in later | 65 | can also save lists of abbrev definitions in files for use in later |
| 65 | sessions. Some users keep extensive lists of abbrevs that they load | 66 | sessions. Some users keep extensive lists of abbrevs that they load |
| 66 | in every session. | 67 | in every session. |
diff --git a/doc/lispref/ChangeLog b/doc/lispref/ChangeLog index de2528a730a..1cbee05d4d4 100644 --- a/doc/lispref/ChangeLog +++ b/doc/lispref/ChangeLog | |||
| @@ -1,3 +1,12 @@ | |||
| 1 | 2012-03-04 Glenn Morris <rgm@gnu.org> | ||
| 2 | |||
| 3 | * abbrevs.texi: Small copyedits throughout. | ||
| 4 | (Abbrev Mode): Remove this section, folding it into the top-level. | ||
| 5 | (Abbrev Tables): Don't mention irrelevant return values. | ||
| 6 | (Abbrev Expansion): Add cross-ref for wrapper hooks. | ||
| 7 | (Standard Abbrev Tables): Emacs Lisp mode now has its own table. | ||
| 8 | (Abbrev Table Properties): Update nil :regexp description. | ||
| 9 | |||
| 1 | 2012-03-03 Glenn Morris <rgm@gnu.org> | 10 | 2012-03-03 Glenn Morris <rgm@gnu.org> |
| 2 | 11 | ||
| 3 | * internals.texi: Change @appendix section commands to @section. | 12 | * internals.texi: Change @appendix section commands to @section. |
diff --git a/doc/lispref/abbrevs.texi b/doc/lispref/abbrevs.texi index f7fd8b541ed..a64e8a0bd51 100644 --- a/doc/lispref/abbrevs.texi +++ b/doc/lispref/abbrevs.texi | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | @c -*-texinfo-*- | 1 | @c -*-texinfo-*- |
| 2 | @c This is part of the GNU Emacs Lisp Reference Manual. | 2 | @c This is part of the GNU Emacs Lisp Reference Manual. |
| 3 | @c Copyright (C) 1990-1994, 1999, 2001-2012 Free Software Foundation, Inc. | 3 | @c Copyright (C) 1990-1994, 1999, 2001-2012 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/abbrevs | 5 | @setfilename ../../info/abbrevs |
| 6 | @node Abbrevs, Processes, Syntax Tables, Top | 6 | @node Abbrevs, Processes, Syntax Tables, Top |
| @@ -37,14 +37,15 @@ When abbrevs are saved to an abbrev file, system abbrevs are omitted. | |||
| 37 | Because the symbols used for abbrevs are not interned in the usual | 37 | Because the symbols used for abbrevs are not interned in the usual |
| 38 | obarray, they will never appear as the result of reading a Lisp | 38 | obarray, they will never appear as the result of reading a Lisp |
| 39 | expression; in fact, normally they are never used except by the code | 39 | expression; in fact, normally they are never used except by the code |
| 40 | that handles abbrevs. Therefore, it is safe to use them in an | 40 | that handles abbrevs. Therefore, it is safe to use them in a |
| 41 | extremely nonstandard way. | 41 | nonstandard way. |
| 42 | 42 | ||
| 43 | For the user-level commands for abbrevs, see @ref{Abbrevs,, Abbrev | 43 | If the minor mode Abbrev mode is enabled, the buffer-local variable |
| 44 | Mode, emacs, The GNU Emacs Manual}. | 44 | @code{abbrev-mode} is non-@code{nil}, and abbrevs are automatically |
| 45 | expanded in the buffer. For the user-level commands for abbrevs, see | ||
| 46 | @ref{Abbrevs,, Abbrev Mode, emacs, The GNU Emacs Manual}. | ||
| 45 | 47 | ||
| 46 | @menu | 48 | @menu |
| 47 | * Abbrev Mode:: Setting up Emacs for abbreviation. | ||
| 48 | * Tables: Abbrev Tables. Creating and working with abbrev tables. | 49 | * Tables: Abbrev Tables. Creating and working with abbrev tables. |
| 49 | * Defining Abbrevs:: Specifying abbreviations and their expansions. | 50 | * Defining Abbrevs:: Specifying abbreviations and their expansions. |
| 50 | * Files: Abbrev Files. Saving abbrevs in files. | 51 | * Files: Abbrev Files. Saving abbrevs in files. |
| @@ -56,22 +57,7 @@ Mode, emacs, The GNU Emacs Manual}. | |||
| 56 | Which properties have which effect. | 57 | Which properties have which effect. |
| 57 | @end menu | 58 | @end menu |
| 58 | 59 | ||
| 59 | @node Abbrev Mode, Abbrev Tables, Abbrevs, Abbrevs | 60 | @node Abbrev Tables, Defining Abbrevs, Abbrevs, Abbrevs |
| 60 | @comment node-name, next, previous, up | ||
| 61 | @section Setting Up Abbrev Mode | ||
| 62 | |||
| 63 | Abbrev mode is a minor mode controlled by the variable | ||
| 64 | @code{abbrev-mode}. | ||
| 65 | |||
| 66 | @defopt abbrev-mode | ||
| 67 | If this variable is non-@code{nil}, abbrevs are automatically expanded | ||
| 68 | in the buffer. If the value is @code{nil}, abbrevs may be defined, | ||
| 69 | but they are not expanded automatically. | ||
| 70 | |||
| 71 | This variable automatically becomes buffer-local when set in any fashion. | ||
| 72 | @end defopt | ||
| 73 | |||
| 74 | @node Abbrev Tables, Defining Abbrevs, Abbrev Mode, Abbrevs | ||
| 75 | @section Abbrev Tables | 61 | @section Abbrev Tables |
| 76 | 62 | ||
| 77 | This section describes how to create and manipulate abbrev tables. | 63 | This section describes how to create and manipulate abbrev tables. |
| @@ -90,14 +76,15 @@ abbrev table. | |||
| 90 | 76 | ||
| 91 | @defun clear-abbrev-table abbrev-table | 77 | @defun clear-abbrev-table abbrev-table |
| 92 | This function undefines all the abbrevs in @var{abbrev-table}, leaving | 78 | This function undefines all the abbrevs in @var{abbrev-table}, leaving |
| 93 | it empty. It always returns @code{nil}. | 79 | it empty. |
| 80 | @c Don't see why this needs saying. | ||
| 81 | @c It always returns @code{nil}. | ||
| 94 | @end defun | 82 | @end defun |
| 95 | 83 | ||
| 96 | @defun copy-abbrev-table abbrev-table | 84 | @defun copy-abbrev-table abbrev-table |
| 97 | This function returns a copy of @var{abbrev-table}---a new abbrev | 85 | This function returns a copy of @var{abbrev-table}---a new abbrev |
| 98 | table containing the same abbrev definitions. There is one difference | 86 | table containing the same abbrev definitions. It does @emph{not} copy |
| 99 | between the contents of @var{abbrev-table} and the returned copy: all | 87 | any property lists; only the names, values, and functions. |
| 100 | abbrevs in the latter have their property lists set to @code{nil}. | ||
| 101 | @end defun | 88 | @end defun |
| 102 | 89 | ||
| 103 | @defun define-abbrev-table tabname definitions &optional docstring &rest props | 90 | @defun define-abbrev-table tabname definitions &optional docstring &rest props |
| @@ -106,8 +93,7 @@ name, i.e., as a variable whose value is an abbrev table. It defines | |||
| 106 | abbrevs in the table according to @var{definitions}, a list of | 93 | abbrevs in the table according to @var{definitions}, a list of |
| 107 | elements of the form @code{(@var{abbrevname} @var{expansion} | 94 | elements of the form @code{(@var{abbrevname} @var{expansion} |
| 108 | [@var{hook}] [@var{props}...])}. These elements are passed as | 95 | [@var{hook}] [@var{props}...])}. These elements are passed as |
| 109 | arguments to @code{define-abbrev}. The return value is always | 96 | arguments to @code{define-abbrev}. @c The return value is always @code{nil}. |
| 110 | @code{nil}. | ||
| 111 | 97 | ||
| 112 | The optional string @var{docstring} is the documentation string of the | 98 | The optional string @var{docstring} is the documentation string of the |
| 113 | variable @var{tabname}. The property list @var{props} is applied to | 99 | variable @var{tabname}. The property list @var{props} is applied to |
| @@ -115,7 +101,7 @@ the abbrev table (@pxref{Abbrev Table Properties}). | |||
| 115 | 101 | ||
| 116 | If this function is called more than once for the same @var{tabname}, | 102 | If this function is called more than once for the same @var{tabname}, |
| 117 | subsequent calls add the definitions in @var{definitions} to | 103 | subsequent calls add the definitions in @var{definitions} to |
| 118 | @var{tabname}, rather than overriding the entire original contents. | 104 | @var{tabname}, rather than overwriting the entire original contents. |
| 119 | (A subsequent call only overrides abbrevs explicitly redefined or | 105 | (A subsequent call only overrides abbrevs explicitly redefined or |
| 120 | undefined in @var{definitions}.) | 106 | undefined in @var{definitions}.) |
| 121 | @end defun | 107 | @end defun |
| @@ -128,7 +114,7 @@ This is a list of symbols whose values are abbrev tables. | |||
| 128 | @defun insert-abbrev-table-description name &optional human | 114 | @defun insert-abbrev-table-description name &optional human |
| 129 | This function inserts before point a description of the abbrev table | 115 | This function inserts before point a description of the abbrev table |
| 130 | named @var{name}. The argument @var{name} is a symbol whose value is an | 116 | named @var{name}. The argument @var{name} is a symbol whose value is an |
| 131 | abbrev table. The return value is always @code{nil}. | 117 | abbrev table. @c The return value is always @code{nil}. |
| 132 | 118 | ||
| 133 | If @var{human} is non-@code{nil}, the description is human-oriented. | 119 | If @var{human} is non-@code{nil}, the description is human-oriented. |
| 134 | System abbrevs are listed and identified as such. Otherwise the | 120 | System abbrevs are listed and identified as such. Otherwise the |
| @@ -146,7 +132,7 @@ to add these to @var{name} separately.) | |||
| 146 | abbrev in an abbrev table. | 132 | abbrev in an abbrev table. |
| 147 | 133 | ||
| 148 | When a major mode defines a system abbrev, it should call | 134 | When a major mode defines a system abbrev, it should call |
| 149 | @code{define-abbrev} and specify a @code{t} for the @code{:system} | 135 | @code{define-abbrev} and specify @code{t} for the @code{:system} |
| 150 | property. Be aware that any saved non-``system'' abbrevs are restored | 136 | property. Be aware that any saved non-``system'' abbrevs are restored |
| 151 | at startup, i.e. before some major modes are loaded. Therefore, major | 137 | at startup, i.e. before some major modes are loaded. Therefore, major |
| 152 | modes should not assume that their abbrev tables are empty when they | 138 | modes should not assume that their abbrev tables are empty when they |
| @@ -177,12 +163,12 @@ property is non-@code{nil}, @var{hook} can explicitly control whether | |||
| 177 | to insert the self-inserting input character that triggered the | 163 | to insert the self-inserting input character that triggered the |
| 178 | expansion. If @var{hook} returns non-@code{nil} in this case, that | 164 | expansion. If @var{hook} returns non-@code{nil} in this case, that |
| 179 | inhibits insertion of the character. By contrast, if @var{hook} | 165 | inhibits insertion of the character. By contrast, if @var{hook} |
| 180 | returns @code{nil}, @code{expand-abbrev} also returns @code{nil}, as | 166 | returns @code{nil}, @code{expand-abbrev} (or @code{abbrev-insert}) |
| 181 | if expansion had not really occurred. | 167 | also returns @code{nil}, as if expansion had not really occurred. |
| 182 | 168 | ||
| 183 | Normally, @code{define-abbrev} sets the variable | 169 | Normally, @code{define-abbrev} sets the variable |
| 184 | @code{abbrevs-changed} to @code{t}, if it actually changes the abbrev. | 170 | @code{abbrevs-changed} to @code{t}, if it actually changes the abbrev. |
| 185 | (This is so that some commands will offer to save the abbrevs.) It | 171 | This is so that some commands will offer to save the abbrevs. It |
| 186 | does not do this for a system abbrev, since those aren't saved anyway. | 172 | does not do this for a system abbrev, since those aren't saved anyway. |
| 187 | @end defun | 173 | @end defun |
| 188 | 174 | ||
| @@ -202,7 +188,8 @@ The abbrevs are saved in the form of a Lisp program to define the same | |||
| 202 | abbrev tables with the same contents. Therefore, you can load the file | 188 | abbrev tables with the same contents. Therefore, you can load the file |
| 203 | with @code{load} (@pxref{How Programs Do Loading}). However, the | 189 | with @code{load} (@pxref{How Programs Do Loading}). However, the |
| 204 | function @code{quietly-read-abbrev-file} is provided as a more | 190 | function @code{quietly-read-abbrev-file} is provided as a more |
| 205 | convenient interface. | 191 | convenient interface. Emacs automatically calls this function at |
| 192 | startup. | ||
| 206 | 193 | ||
| 207 | User-level facilities such as @code{save-some-buffers} can save | 194 | User-level facilities such as @code{save-some-buffers} can save |
| 208 | abbrevs in a file automatically, under the control of variables | 195 | abbrevs in a file automatically, under the control of variables |
| @@ -216,17 +203,18 @@ This is the default file name for reading and saving abbrevs. | |||
| 216 | This function reads abbrev definitions from a file named @var{filename}, | 203 | This function reads abbrev definitions from a file named @var{filename}, |
| 217 | previously written with @code{write-abbrev-file}. If @var{filename} is | 204 | previously written with @code{write-abbrev-file}. If @var{filename} is |
| 218 | omitted or @code{nil}, the file specified in @code{abbrev-file-name} is | 205 | omitted or @code{nil}, the file specified in @code{abbrev-file-name} is |
| 219 | used. @code{save-abbrevs} is set to @code{t} so that changes will be | 206 | used. |
| 220 | saved. | ||
| 221 | 207 | ||
| 222 | This function does not display any messages. It returns @code{nil}. | 208 | As the name implies, this function does not display any messages. |
| 209 | @c It returns @code{nil}. | ||
| 223 | @end defun | 210 | @end defun |
| 224 | 211 | ||
| 225 | @defopt save-abbrevs | 212 | @defopt save-abbrevs |
| 226 | A non-@code{nil} value for @code{save-abbrevs} means that Emacs should | 213 | A non-@code{nil} value for @code{save-abbrevs} means that Emacs should |
| 227 | offer the user to save abbrevs when files are saved. If the value is | 214 | offer to save abbrevs (if any have changed) when files are saved. If |
| 228 | @code{silently}, Emacs saves the abbrevs without asking the user. | 215 | the value is @code{silently}, Emacs saves the abbrevs without asking |
| 229 | @code{abbrev-file-name} specifies the file to save the abbrevs in. | 216 | the user. @code{abbrev-file-name} specifies the file to save the |
| 217 | abbrevs in. | ||
| 230 | @end defopt | 218 | @end defopt |
| 231 | 219 | ||
| 232 | @defvar abbrevs-changed | 220 | @defvar abbrevs-changed |
| @@ -254,7 +242,7 @@ use for communication. | |||
| 254 | 242 | ||
| 255 | @defun abbrev-symbol abbrev &optional table | 243 | @defun abbrev-symbol abbrev &optional table |
| 256 | This function returns the symbol representing the abbrev named | 244 | This function returns the symbol representing the abbrev named |
| 257 | @var{abbrev}. The value returned is @code{nil} if that abbrev is not | 245 | @var{abbrev}. It returns @code{nil} if that abbrev is not |
| 258 | defined. The optional second argument @var{table} is the abbrev table | 246 | defined. The optional second argument @var{table} is the abbrev table |
| 259 | in which to look it up. If @var{table} is @code{nil}, this function | 247 | in which to look it up. If @var{table} is @code{nil}, this function |
| 260 | tries first the current buffer's local abbrev table, and second the | 248 | tries first the current buffer's local abbrev table, and second the |
| @@ -263,8 +251,8 @@ global abbrev table. | |||
| 263 | 251 | ||
| 264 | @defun abbrev-expansion abbrev &optional table | 252 | @defun abbrev-expansion abbrev &optional table |
| 265 | 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 |
| 266 | defined by the abbrev tables used for the current buffer). If | 254 | defined by the abbrev tables used for the current buffer). It returns |
| 267 | @var{abbrev} is not a valid abbrev, the function returns @code{nil}. | 255 | @code{nil} if @var{abbrev} is not a valid abbrev. |
| 268 | The optional argument @var{table} specifies the abbrev table to use, | 256 | The optional argument @var{table} specifies the abbrev table to use, |
| 269 | as in @code{abbrev-symbol}. | 257 | as in @code{abbrev-symbol}. |
| 270 | @end defun | 258 | @end defun |
| @@ -274,7 +262,7 @@ This command expands the abbrev before point, if any. If point does not | |||
| 274 | follow an abbrev, this command does nothing. The command returns the | 262 | follow an abbrev, this command does nothing. The command returns the |
| 275 | abbrev symbol if it did expansion, @code{nil} otherwise. | 263 | abbrev symbol if it did expansion, @code{nil} otherwise. |
| 276 | 264 | ||
| 277 | If the abbrev symbol has a hook function which is a symbol whose | 265 | If the abbrev symbol has a hook function that is a symbol whose |
| 278 | @code{no-self-insert} property is non-@code{nil}, and if the hook | 266 | @code{no-self-insert} property is non-@code{nil}, and if the hook |
| 279 | function returns @code{nil} as its value, then @code{expand-abbrev} | 267 | function returns @code{nil} as its value, then @code{expand-abbrev} |
| 280 | returns @code{nil} even though expansion did occur. | 268 | returns @code{nil} even though expansion did occur. |
| @@ -346,14 +334,14 @@ has already been unexpanded. This contains information left by | |||
| 346 | @end defvar | 334 | @end defvar |
| 347 | 335 | ||
| 348 | @defvar abbrev-expand-functions | 336 | @defvar abbrev-expand-functions |
| 349 | This is a special hook run @emph{around} the @code{expand-abbrev} | 337 | This is a wrapper hook (@pxref{Running Hooks}) run around the |
| 350 | function. Each function on this hook is called with a single | 338 | @code{expand-abbrev} function. Each function on this hook is called |
| 351 | argument: a function that performs the normal abbrev expansion. The | 339 | with a single argument: a function that performs the normal abbrev |
| 352 | hook function can hence do anything it wants before and after | 340 | expansion. The hook function can hence do anything it wants before |
| 353 | performing the expansion. It can also choose not to call its | 341 | and after performing the expansion. It can also choose not to call |
| 354 | argument, thus overriding the default behavior; or it may even call it | 342 | its argument, thus overriding the default behavior; or it may even |
| 355 | several times. The function should return the abbrev symbol if | 343 | call it several times. The function should return the abbrev symbol |
| 356 | expansion took place. | 344 | if expansion took place. |
| 357 | @end defvar | 345 | @end defvar |
| 358 | 346 | ||
| 359 | The following sample code shows a simple use of | 347 | The following sample code shows a simple use of |
| @@ -361,8 +349,7 @@ expansion took place. | |||
| 361 | mode for editing certain files in which lines that start with @samp{#} | 349 | mode for editing certain files in which lines that start with @samp{#} |
| 362 | are comments. You want to use Text mode abbrevs for those lines. The | 350 | are comments. You want to use Text mode abbrevs for those lines. The |
| 363 | regular local abbrev table, @code{foo-mode-abbrev-table} is | 351 | regular local abbrev table, @code{foo-mode-abbrev-table} is |
| 364 | appropriate for all other lines. Then you can put the following code | 352 | appropriate for all other lines. @xref{Standard Abbrev Tables}, for the |
| 365 | in your @file{.emacs} file. @xref{Standard Abbrev Tables}, for the | ||
| 366 | definitions of @code{local-abbrev-table} and @code{text-mode-abbrev-table}. | 353 | definitions of @code{local-abbrev-table} and @code{text-mode-abbrev-table}. |
| 367 | 354 | ||
| 368 | @smallexample | 355 | @smallexample |
| @@ -419,14 +406,16 @@ This is the local abbrev table used in Text mode. | |||
| 419 | @end defvar | 406 | @end defvar |
| 420 | 407 | ||
| 421 | @defvar lisp-mode-abbrev-table | 408 | @defvar lisp-mode-abbrev-table |
| 422 | This is the local abbrev table used in Lisp mode and Emacs Lisp mode. | 409 | This is the local abbrev table used in Lisp mode. It is the parent |
| 410 | of the local abbrev table used in Emacs Lisp mode. @xref{Abbrev Table | ||
| 411 | Properties}. | ||
| 423 | @end defvar | 412 | @end defvar |
| 424 | 413 | ||
| 425 | @node Abbrev Properties, Abbrev Table Properties, Standard Abbrev Tables, Abbrevs | 414 | @node Abbrev Properties, Abbrev Table Properties, Standard Abbrev Tables, Abbrevs |
| 426 | @section Abbrev Properties | 415 | @section Abbrev Properties |
| 427 | 416 | ||
| 428 | Abbrevs have properties, some of which influence the way they work. | 417 | Abbrevs have properties, some of which influence the way they work. |
| 429 | You can provide them as arguments to @code{define-abbrev} and you can | 418 | You can provide them as arguments to @code{define-abbrev}, and |
| 430 | manipulate them with the following functions: | 419 | manipulate them with the following functions: |
| 431 | 420 | ||
| 432 | @defun abbrev-put abbrev prop val | 421 | @defun abbrev-put abbrev prop val |
| @@ -467,8 +456,7 @@ modifies the capitalization of the expansion. | |||
| 467 | 456 | ||
| 468 | Like abbrevs, abbrev tables have properties, some of which influence | 457 | Like abbrevs, abbrev tables have properties, some of which influence |
| 469 | the way they work. You can provide them as arguments to | 458 | the way they work. You can provide them as arguments to |
| 470 | @code{define-abbrev-table} and you can manipulate them with the | 459 | @code{define-abbrev-table}, and manipulate them with the functions: |
| 471 | functions: | ||
| 472 | 460 | ||
| 473 | @defun abbrev-table-put table prop val | 461 | @defun abbrev-table-put table prop val |
| 474 | 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}. |
| @@ -484,8 +472,8 @@ The following properties have special meaning: | |||
| 484 | @table @code | 472 | @table @code |
| 485 | @item :enable-function | 473 | @item :enable-function |
| 486 | This is like the @code{:enable-function} abbrev property except that | 474 | This is like the @code{:enable-function} abbrev property except that |
| 487 | it applies to all abbrevs in the table and is used even before trying | 475 | it applies to all abbrevs in the table. It is used before even trying |
| 488 | to find the abbrev before point so it can dynamically modify the | 476 | to find the abbrev before point, so it can dynamically modify the |
| 489 | abbrev table. | 477 | abbrev table. |
| 490 | 478 | ||
| 491 | @item :case-fixed | 479 | @item :case-fixed |
| @@ -494,15 +482,16 @@ applies to all abbrevs in the table. | |||
| 494 | 482 | ||
| 495 | @item :regexp | 483 | @item :regexp |
| 496 | If non-@code{nil}, this property is a regular expression that | 484 | If non-@code{nil}, this property is a regular expression that |
| 497 | 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 |
| 498 | looking it up in the table. When the regular expression matches | 486 | looking it up in the table. When the regular expression matches |
| 499 | 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. |
| 500 | If this property is @code{nil}, @code{expand-function} defaults to | 488 | If this property is @code{nil}, the default is to use |
| 501 | @code{"\\<\\(\\w+\\)\\W"}. This property allows the use of abbrevs | 489 | @code{backward-word} and @code{forward-word} to find the name. This |
| 502 | whose name contains characters of non-word syntax. | 490 | property allows the use of abbrevs whose name contains characters of |
| 491 | non-word syntax. | ||
| 503 | 492 | ||
| 504 | @item :parents | 493 | @item :parents |
| 505 | This property holds the list of tables from which to inherit | 494 | This property holds a list of tables from which to inherit |
| 506 | other abbrevs. | 495 | other abbrevs. |
| 507 | 496 | ||
| 508 | @item :abbrev-table-modiff | 497 | @item :abbrev-table-modiff |
diff --git a/doc/lispref/elisp.texi b/doc/lispref/elisp.texi index 3f7ce582b9a..8e2e02a2ec0 100644 --- a/doc/lispref/elisp.texi +++ b/doc/lispref/elisp.texi | |||
| @@ -1186,7 +1186,6 @@ Parsing Expressions | |||
| 1186 | 1186 | ||
| 1187 | Abbrevs and Abbrev Expansion | 1187 | Abbrevs and Abbrev Expansion |
| 1188 | 1188 | ||
| 1189 | * Abbrev Mode:: Setting up Emacs for abbreviation. | ||
| 1190 | * Abbrev Tables:: Creating and working with abbrev tables. | 1189 | * Abbrev Tables:: Creating and working with abbrev tables. |
| 1191 | * Defining Abbrevs:: Specifying abbreviations and their expansions. | 1190 | * Defining Abbrevs:: Specifying abbreviations and their expansions. |
| 1192 | * Abbrev Files:: Saving abbrevs in files. | 1191 | * Abbrev Files:: Saving abbrevs in files. |
diff --git a/doc/lispref/vol1.texi b/doc/lispref/vol1.texi index 05158fbebb7..1dac75107fb 100644 --- a/doc/lispref/vol1.texi +++ b/doc/lispref/vol1.texi | |||
| @@ -1208,7 +1208,6 @@ Parsing Expressions | |||
| 1208 | 1208 | ||
| 1209 | Abbrevs and Abbrev Expansion | 1209 | Abbrevs and Abbrev Expansion |
| 1210 | 1210 | ||
| 1211 | * Abbrev Mode:: Setting up Emacs for abbreviation. | ||
| 1212 | * Abbrev Tables:: Creating and working with abbrev tables. | 1211 | * Abbrev Tables:: Creating and working with abbrev tables. |
| 1213 | * Defining Abbrevs:: Specifying abbreviations and their expansions. | 1212 | * Defining Abbrevs:: Specifying abbreviations and their expansions. |
| 1214 | * Abbrev Files:: Saving abbrevs in files. | 1213 | * Abbrev Files:: Saving abbrevs in files. |
diff --git a/doc/lispref/vol2.texi b/doc/lispref/vol2.texi index 27597d07d3e..d5c14fc7150 100644 --- a/doc/lispref/vol2.texi +++ b/doc/lispref/vol2.texi | |||
| @@ -1207,7 +1207,6 @@ Parsing Expressions | |||
| 1207 | 1207 | ||
| 1208 | Abbrevs and Abbrev Expansion | 1208 | Abbrevs and Abbrev Expansion |
| 1209 | 1209 | ||
| 1210 | * Abbrev Mode:: Setting up Emacs for abbreviation. | ||
| 1211 | * Abbrev Tables:: Creating and working with abbrev tables. | 1210 | * Abbrev Tables:: Creating and working with abbrev tables. |
| 1212 | * Defining Abbrevs:: Specifying abbreviations and their expansions. | 1211 | * Defining Abbrevs:: Specifying abbreviations and their expansions. |
| 1213 | * Abbrev Files:: Saving abbrevs in files. | 1212 | * Abbrev Files:: Saving abbrevs in files. |
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index e4b07c53373..735357439ab 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,9 @@ | |||
| 1 | 2012-03-04 Glenn Morris <rgm@gnu.org> | ||
| 2 | |||
| 3 | * abbrev.el (copy-abbrev-table, abbrev-table-p) | ||
| 4 | (abbrev-minor-mode-table-alist, define-abbrev, abbrev-insert) | ||
| 5 | (expand-abbrev, define-abbrev-table): Doc fixes. | ||
| 6 | |||
| 1 | 2012-03-03 Lars Magne Ingebrigtsen <larsi@gnus.org> | 7 | 2012-03-03 Lars Magne Ingebrigtsen <larsi@gnus.org> |
| 2 | 8 | ||
| 3 | * mail/emacsbug.el (report-emacs-bug-hook): Look at the value of | 9 | * mail/emacsbug.el (report-emacs-bug-hook): Look at the value of |
diff --git a/lisp/abbrev.el b/lisp/abbrev.el index 7beee0a1752..3845c4ce4e6 100644 --- a/lisp/abbrev.el +++ b/lisp/abbrev.el | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | ;;; abbrev.el --- abbrev mode commands for Emacs -*- lexical-binding: t -*- | 1 | ;;; abbrev.el --- abbrev mode commands for Emacs -*- lexical-binding: t -*- |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 1985-1987, 1992, 2001-2012 Free Software Foundation, Inc. | 3 | ;; Copyright (C) 1985-1987, 1992, 2001-2012 Free Software Foundation, Inc. |
| 4 | 4 | ||
| 5 | ;; Maintainer: FSF | 5 | ;; Maintainer: FSF |
| 6 | ;; Keywords: abbrev convenience | 6 | ;; Keywords: abbrev convenience |
| @@ -81,7 +81,8 @@ be replaced by its expansion." | |||
| 81 | (clear-abbrev-table (symbol-value tablesym)))) | 81 | (clear-abbrev-table (symbol-value tablesym)))) |
| 82 | 82 | ||
| 83 | (defun copy-abbrev-table (table) | 83 | (defun copy-abbrev-table (table) |
| 84 | "Make a new abbrev-table with the same abbrevs as TABLE." | 84 | "Make a new abbrev-table with the same abbrevs as TABLE. |
| 85 | Does not copy property lists." | ||
| 85 | (let ((new-table (make-abbrev-table))) | 86 | (let ((new-table (make-abbrev-table))) |
| 86 | (mapatoms | 87 | (mapatoms |
| 87 | (lambda (symbol) | 88 | (lambda (symbol) |
| @@ -447,6 +448,7 @@ PROPS is a list of properties." | |||
| 447 | table)) | 448 | table)) |
| 448 | 449 | ||
| 449 | (defun abbrev-table-p (object) | 450 | (defun abbrev-table-p (object) |
| 451 | "Return non-nil if OBJECT is an abbrev table." | ||
| 450 | (and (vectorp object) | 452 | (and (vectorp object) |
| 451 | (numberp (abbrev-table-get object :abbrev-table-modiff)))) | 453 | (numberp (abbrev-table-get object :abbrev-table-modiff)))) |
| 452 | 454 | ||
| @@ -472,7 +474,8 @@ for any particular abbrev defined in both.") | |||
| 472 | (defvar abbrev-minor-mode-table-alist nil | 474 | (defvar abbrev-minor-mode-table-alist nil |
| 473 | "Alist of abbrev tables to use for minor modes. | 475 | "Alist of abbrev tables to use for minor modes. |
| 474 | Each element looks like (VARIABLE . ABBREV-TABLE); | 476 | Each element looks like (VARIABLE . ABBREV-TABLE); |
| 475 | ABBREV-TABLE is active whenever VARIABLE's value is non-nil.") | 477 | ABBREV-TABLE is active whenever VARIABLE's value is non-nil. |
| 478 | ABBREV-TABLE can also be a list of abbrev tables.") | ||
| 476 | 479 | ||
| 477 | (defvar fundamental-mode-abbrev-table | 480 | (defvar fundamental-mode-abbrev-table |
| 478 | (let ((table (make-abbrev-table))) | 481 | (let ((table (make-abbrev-table))) |
| @@ -548,6 +551,12 @@ If EXPANSION is not a string (and not nil), the abbrev is a | |||
| 548 | special one, which does not expand in the usual way but only | 551 | special one, which does not expand in the usual way but only |
| 549 | runs HOOK. | 552 | runs HOOK. |
| 550 | 553 | ||
| 554 | If HOOK is a non-nil symbol with a non-nil `no-self-insert' property, | ||
| 555 | it can control whether the character that triggered abbrev expansion | ||
| 556 | is inserted. If such a HOOK returns non-nil, the character is not | ||
| 557 | inserted. If such a HOOK returns nil, then so does `abbrev-insert' | ||
| 558 | \(and `expand-abbrev'), as if no abbrev expansion had taken place. | ||
| 559 | |||
| 551 | PROPS is a property list. The following properties are special: | 560 | PROPS is a property list. The following properties are special: |
| 552 | - `:count': the value for the abbrev's usage-count, which is incremented each | 561 | - `:count': the value for the abbrev's usage-count, which is incremented each |
| 553 | time the abbrev is used (the default is zero). | 562 | time the abbrev is used (the default is zero). |
| @@ -746,7 +755,9 @@ If non-nil, NAME is the name by which this abbrev was found. | |||
| 746 | If non-nil, WORDSTART is the place where to insert the abbrev. | 755 | If non-nil, WORDSTART is the place where to insert the abbrev. |
| 747 | If WORDEND is non-nil, the abbrev replaces the previous text between | 756 | If WORDEND is non-nil, the abbrev replaces the previous text between |
| 748 | WORDSTART and WORDEND. | 757 | WORDSTART and WORDEND. |
| 749 | Return ABBREV if the expansion should be considered as having taken place." | 758 | Return ABBREV if the expansion should be considered as having taken place. |
| 759 | The return value can be influenced by a `no-self-insert' property; | ||
| 760 | see `define-abbrev' for details." | ||
| 750 | (unless name (setq name (symbol-name abbrev))) | 761 | (unless name (setq name (symbol-name abbrev))) |
| 751 | (unless wordstart (setq wordstart (point))) | 762 | (unless wordstart (setq wordstart (point))) |
| 752 | (unless wordend (setq wordend wordstart)) | 763 | (unless wordend (setq wordend wordstart)) |
| @@ -811,7 +822,8 @@ the abbrev symbol if expansion took place.") | |||
| 811 | (defun expand-abbrev () | 822 | (defun expand-abbrev () |
| 812 | "Expand the abbrev before point, if there is an abbrev there. | 823 | "Expand the abbrev before point, if there is an abbrev there. |
| 813 | Effective when explicitly called even when `abbrev-mode' is nil. | 824 | Effective when explicitly called even when `abbrev-mode' is nil. |
| 814 | Returns the abbrev symbol, if expansion took place." | 825 | Returns the abbrev symbol, if expansion took place. (The actual |
| 826 | return value is that of `abbrev-insert'.)" | ||
| 815 | (interactive) | 827 | (interactive) |
| 816 | (run-hooks 'pre-abbrev-expand-hook) | 828 | (run-hooks 'pre-abbrev-expand-hook) |
| 817 | (with-wrapper-hook abbrev-expand-functions () | 829 | (with-wrapper-hook abbrev-expand-functions () |
| @@ -934,9 +946,11 @@ Properties with special meaning: | |||
| 934 | abbreviations. | 946 | abbreviations. |
| 935 | - `:case-fixed' non-nil means that abbreviations are looked up without | 947 | - `:case-fixed' non-nil means that abbreviations are looked up without |
| 936 | case-folding, and the expansion is not capitalized/upcased. | 948 | case-folding, and the expansion is not capitalized/upcased. |
| 937 | - `:regexp' describes the form of abbrevs. It defaults to \\=\\<\\(\\w+\\)\\W* which | 949 | - `:regexp' is a regular expression that specifies how to extract the |
| 938 | means that an abbrev can only be a single word. The submatch 1 is treated | 950 | name of the abbrev before point. The submatch 1 is treated |
| 939 | as the potential name of an abbrev. | 951 | as the potential name of an abbrev. If :regexp is nil, the default |
| 952 | behavior uses `backward-word' and `forward-word' to extract the name | ||
| 953 | of the abbrev, which can therefore only be a single word. | ||
| 940 | - `:enable-function' can be set to a function of no argument which returns | 954 | - `:enable-function' can be set to a function of no argument which returns |
| 941 | non-nil if and only if the abbrevs in this table should be used for this | 955 | non-nil if and only if the abbrevs in this table should be used for this |
| 942 | instance of `expand-abbrev'." | 956 | instance of `expand-abbrev'." |