aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGlenn Morris2012-03-03 18:45:04 -0800
committerGlenn Morris2012-03-03 18:45:04 -0800
commitea16568d87f736736a532c0684de951bc382e4a9 (patch)
tree5e20fc6f6836ffabf5d3df2c052945b364df7751
parenta1e7225c983f616ed6b43c9861b9c1374bbab2bb (diff)
downloademacs-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-RELEASE2
-rw-r--r--doc/emacs/abbrevs.texi3
-rw-r--r--doc/lispref/ChangeLog9
-rw-r--r--doc/lispref/abbrevs.texi121
-rw-r--r--doc/lispref/elisp.texi1
-rw-r--r--doc/lispref/vol1.texi1
-rw-r--r--doc/lispref/vol2.texi1
-rw-r--r--lisp/ChangeLog6
-rw-r--r--lisp/abbrev.el30
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
183abbrevs.texi 183abbrevs.texi rgm
184advice.texi cyd 184advice.texi cyd
185anti.texi 185anti.texi
186back.texi 186back.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
60mode-specific definitions for different major modes. A mode-specific 60mode-specific definitions for different major modes. A mode-specific
61definition for the current major mode overrides a global definition. 61definition 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,
64irrespective of whether Abbrev mode is enabled. You
64can also save lists of abbrev definitions in files for use in later 65can also save lists of abbrev definitions in files for use in later
65sessions. Some users keep extensive lists of abbrevs that they load 66sessions. Some users keep extensive lists of abbrevs that they load
66in every session. 67in 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 @@
12012-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
12012-03-03 Glenn Morris <rgm@gnu.org> 102012-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
38obarray, they will never appear as the result of reading a Lisp 38obarray, they will never appear as the result of reading a Lisp
39expression; in fact, normally they are never used except by the code 39expression; in fact, normally they are never used except by the code
40that handles abbrevs. Therefore, it is safe to use them in an 40that handles abbrevs. Therefore, it is safe to use them in a
41extremely nonstandard way. 41nonstandard 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
44Mode, emacs, The GNU Emacs Manual}. 44@code{abbrev-mode} is non-@code{nil}, and abbrevs are automatically
45expanded 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
67If this variable is non-@code{nil}, abbrevs are automatically expanded
68in the buffer. If the value is @code{nil}, abbrevs may be defined,
69but they are not expanded automatically.
70
71This 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
92This function undefines all the abbrevs in @var{abbrev-table}, leaving 78This function undefines all the abbrevs in @var{abbrev-table}, leaving
93it empty. It always returns @code{nil}. 79it 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
97This function returns a copy of @var{abbrev-table}---a new abbrev 85This function returns a copy of @var{abbrev-table}---a new abbrev
98table containing the same abbrev definitions. There is one difference 86table containing the same abbrev definitions. It does @emph{not} copy
99between the contents of @var{abbrev-table} and the returned copy: all 87any property lists; only the names, values, and functions.
100abbrevs 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
106abbrevs in the table according to @var{definitions}, a list of 93abbrevs in the table according to @var{definitions}, a list of
107elements of the form @code{(@var{abbrevname} @var{expansion} 94elements 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
109arguments to @code{define-abbrev}. The return value is always 96arguments to @code{define-abbrev}. @c The return value is always @code{nil}.
110@code{nil}.
111 97
112The optional string @var{docstring} is the documentation string of the 98The optional string @var{docstring} is the documentation string of the
113variable @var{tabname}. The property list @var{props} is applied to 99variable @var{tabname}. The property list @var{props} is applied to
@@ -115,7 +101,7 @@ the abbrev table (@pxref{Abbrev Table Properties}).
115 101
116If this function is called more than once for the same @var{tabname}, 102If this function is called more than once for the same @var{tabname},
117subsequent calls add the definitions in @var{definitions} to 103subsequent 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
120undefined in @var{definitions}.) 106undefined 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
129This function inserts before point a description of the abbrev table 115This function inserts before point a description of the abbrev table
130named @var{name}. The argument @var{name} is a symbol whose value is an 116named @var{name}. The argument @var{name} is a symbol whose value is an
131abbrev table. The return value is always @code{nil}. 117abbrev table. @c The return value is always @code{nil}.
132 118
133If @var{human} is non-@code{nil}, the description is human-oriented. 119If @var{human} is non-@code{nil}, the description is human-oriented.
134System abbrevs are listed and identified as such. Otherwise the 120System abbrevs are listed and identified as such. Otherwise the
@@ -146,7 +132,7 @@ to add these to @var{name} separately.)
146abbrev in an abbrev table. 132abbrev 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}
150property. Be aware that any saved non-``system'' abbrevs are restored 136property. Be aware that any saved non-``system'' abbrevs are restored
151at startup, i.e. before some major modes are loaded. Therefore, major 137at startup, i.e. before some major modes are loaded. Therefore, major
152modes should not assume that their abbrev tables are empty when they 138modes 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
177to insert the self-inserting input character that triggered the 163to insert the self-inserting input character that triggered the
178expansion. If @var{hook} returns non-@code{nil} in this case, that 164expansion. If @var{hook} returns non-@code{nil} in this case, that
179inhibits insertion of the character. By contrast, if @var{hook} 165inhibits insertion of the character. By contrast, if @var{hook}
180returns @code{nil}, @code{expand-abbrev} also returns @code{nil}, as 166returns @code{nil}, @code{expand-abbrev} (or @code{abbrev-insert})
181if expansion had not really occurred. 167also returns @code{nil}, as if expansion had not really occurred.
182 168
183Normally, @code{define-abbrev} sets the variable 169Normally, @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 171This is so that some commands will offer to save the abbrevs. It
186does not do this for a system abbrev, since those aren't saved anyway. 172does 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
202abbrev tables with the same contents. Therefore, you can load the file 188abbrev tables with the same contents. Therefore, you can load the file
203with @code{load} (@pxref{How Programs Do Loading}). However, the 189with @code{load} (@pxref{How Programs Do Loading}). However, the
204function @code{quietly-read-abbrev-file} is provided as a more 190function @code{quietly-read-abbrev-file} is provided as a more
205convenient interface. 191convenient interface. Emacs automatically calls this function at
192startup.
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
208abbrevs in a file automatically, under the control of variables 195abbrevs in a file automatically, under the control of variables
@@ -216,17 +203,18 @@ This is the default file name for reading and saving abbrevs.
216This function reads abbrev definitions from a file named @var{filename}, 203This function reads abbrev definitions from a file named @var{filename},
217previously written with @code{write-abbrev-file}. If @var{filename} is 204previously written with @code{write-abbrev-file}. If @var{filename} is
218omitted or @code{nil}, the file specified in @code{abbrev-file-name} is 205omitted or @code{nil}, the file specified in @code{abbrev-file-name} is
219used. @code{save-abbrevs} is set to @code{t} so that changes will be 206used.
220saved.
221 207
222This function does not display any messages. It returns @code{nil}. 208As 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
226A non-@code{nil} value for @code{save-abbrevs} means that Emacs should 213A non-@code{nil} value for @code{save-abbrevs} means that Emacs should
227offer the user to save abbrevs when files are saved. If the value is 214offer to save abbrevs (if any have changed) when files are saved. If
228@code{silently}, Emacs saves the abbrevs without asking the user. 215the value is @code{silently}, Emacs saves the abbrevs without asking
229@code{abbrev-file-name} specifies the file to save the abbrevs in. 216the user. @code{abbrev-file-name} specifies the file to save the
217abbrevs 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
256This function returns the symbol representing the abbrev named 244This 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
258defined. The optional second argument @var{table} is the abbrev table 246defined. The optional second argument @var{table} is the abbrev table
259in which to look it up. If @var{table} is @code{nil}, this function 247in which to look it up. If @var{table} is @code{nil}, this function
260tries first the current buffer's local abbrev table, and second the 248tries 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
265This function returns the string that @var{abbrev} would expand into (as 253This function returns the string that @var{abbrev} would expand into (as
266defined by the abbrev tables used for the current buffer). If 254defined 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.
268The optional argument @var{table} specifies the abbrev table to use, 256The optional argument @var{table} specifies the abbrev table to use,
269as in @code{abbrev-symbol}. 257as 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
274follow an abbrev, this command does nothing. The command returns the 262follow an abbrev, this command does nothing. The command returns the
275abbrev symbol if it did expansion, @code{nil} otherwise. 263abbrev symbol if it did expansion, @code{nil} otherwise.
276 264
277If the abbrev symbol has a hook function which is a symbol whose 265If 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
279function returns @code{nil} as its value, then @code{expand-abbrev} 267function returns @code{nil} as its value, then @code{expand-abbrev}
280returns @code{nil} even though expansion did occur. 268returns @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
349This is a special hook run @emph{around} the @code{expand-abbrev} 337This is a wrapper hook (@pxref{Running Hooks}) run around the
350function. Each function on this hook is called with a single 338@code{expand-abbrev} function. Each function on this hook is called
351argument: a function that performs the normal abbrev expansion. The 339with a single argument: a function that performs the normal abbrev
352hook function can hence do anything it wants before and after 340expansion. The hook function can hence do anything it wants before
353performing the expansion. It can also choose not to call its 341and after performing the expansion. It can also choose not to call
354argument, thus overriding the default behavior; or it may even call it 342its argument, thus overriding the default behavior; or it may even
355several times. The function should return the abbrev symbol if 343call it several times. The function should return the abbrev symbol
356expansion took place. 344if 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.
361mode for editing certain files in which lines that start with @samp{#} 349mode for editing certain files in which lines that start with @samp{#}
362are comments. You want to use Text mode abbrevs for those lines. The 350are comments. You want to use Text mode abbrevs for those lines. The
363regular local abbrev table, @code{foo-mode-abbrev-table} is 351regular local abbrev table, @code{foo-mode-abbrev-table} is
364appropriate for all other lines. Then you can put the following code 352appropriate for all other lines. @xref{Standard Abbrev Tables}, for the
365in your @file{.emacs} file. @xref{Standard Abbrev Tables}, for the
366definitions of @code{local-abbrev-table} and @code{text-mode-abbrev-table}. 353definitions 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
422This is the local abbrev table used in Lisp mode and Emacs Lisp mode. 409This is the local abbrev table used in Lisp mode. It is the parent
410of the local abbrev table used in Emacs Lisp mode. @xref{Abbrev Table
411Properties}.
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
428Abbrevs have properties, some of which influence the way they work. 417Abbrevs have properties, some of which influence the way they work.
429You can provide them as arguments to @code{define-abbrev} and you can 418You can provide them as arguments to @code{define-abbrev}, and
430manipulate them with the following functions: 419manipulate 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
468Like abbrevs, abbrev tables have properties, some of which influence 457Like abbrevs, abbrev tables have properties, some of which influence
469the way they work. You can provide them as arguments to 458the 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:
471functions:
472 460
473@defun abbrev-table-put table prop val 461@defun abbrev-table-put table prop val
474Set the property @var{prop} of abbrev table @var{table} to value @var{val}. 462Set 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
486This is like the @code{:enable-function} abbrev property except that 474This is like the @code{:enable-function} abbrev property except that
487it applies to all abbrevs in the table and is used even before trying 475it applies to all abbrevs in the table. It is used before even trying
488to find the abbrev before point so it can dynamically modify the 476to find the abbrev before point, so it can dynamically modify the
489abbrev table. 477abbrev 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
496If non-@code{nil}, this property is a regular expression that 484If non-@code{nil}, this property is a regular expression that
497indicates how to extract the name of the abbrev before point before 485indicates how to extract the name of the abbrev before point, before
498looking it up in the table. When the regular expression matches 486looking it up in the table. When the regular expression matches
499before point, the abbrev name is expected to be in submatch 1. 487before point, the abbrev name is expected to be in submatch 1.
500If this property is @code{nil}, @code{expand-function} defaults to 488If 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
502whose name contains characters of non-word syntax. 490property allows the use of abbrevs whose name contains characters of
491non-word syntax.
503 492
504@item :parents 493@item :parents
505This property holds the list of tables from which to inherit 494This property holds a list of tables from which to inherit
506other abbrevs. 495other 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
1187Abbrevs and Abbrev Expansion 1187Abbrevs 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
1209Abbrevs and Abbrev Expansion 1209Abbrevs 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
1208Abbrevs and Abbrev Expansion 1208Abbrevs 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 @@
12012-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
12012-03-03 Lars Magne Ingebrigtsen <larsi@gnus.org> 72012-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.
85Does 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.
474Each element looks like (VARIABLE . ABBREV-TABLE); 476Each element looks like (VARIABLE . ABBREV-TABLE);
475ABBREV-TABLE is active whenever VARIABLE's value is non-nil.") 477ABBREV-TABLE is active whenever VARIABLE's value is non-nil.
478ABBREV-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
554If HOOK is a non-nil symbol with a non-nil `no-self-insert' property,
555it can control whether the character that triggered abbrev expansion
556is inserted. If such a HOOK returns non-nil, the character is not
557inserted. If such a HOOK returns nil, then so does `abbrev-insert'
558\(and `expand-abbrev'), as if no abbrev expansion had taken place.
559
551PROPS is a property list. The following properties are special: 560PROPS 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.
746If non-nil, WORDSTART is the place where to insert the abbrev. 755If non-nil, WORDSTART is the place where to insert the abbrev.
747If WORDEND is non-nil, the abbrev replaces the previous text between 756If WORDEND is non-nil, the abbrev replaces the previous text between
748WORDSTART and WORDEND. 757WORDSTART and WORDEND.
749Return ABBREV if the expansion should be considered as having taken place." 758Return ABBREV if the expansion should be considered as having taken place.
759The return value can be influenced by a `no-self-insert' property;
760see `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.
813Effective when explicitly called even when `abbrev-mode' is nil. 824Effective when explicitly called even when `abbrev-mode' is nil.
814Returns the abbrev symbol, if expansion took place." 825Returns the abbrev symbol, if expansion took place. (The actual
826return 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'."