aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLuc Teirlinck2004-02-24 03:18:45 +0000
committerLuc Teirlinck2004-02-24 03:18:45 +0000
commit6763a405466811482cdbe78a194e9b4d9bbb2c8c (patch)
treec5f53ba79232b0bc8264ab5213ad5a1c5c63b6fc
parentfb2c91be8ee7de88d5d852d67a1738dc407d076b (diff)
downloademacs-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.texi113
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
24is the expansion; its function definition is the hook function to do 24is the expansion; its function definition is the hook function to do
25the expansion (@pxref{Defining Abbrevs}); its property list cell 25the expansion (@pxref{Defining Abbrevs}); its property list cell
26typically contains the use count, the number of times the abbreviation 26typically contains the use count, the number of times the abbreviation
27has been expanded. (Alternatively, the use count is on the 27has 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}
30in the usual obarray, they will never appear as the result of reading 30@code{system-type} property are called ``system'' abbrevs. They are
31a Lisp expression; in fact, normally they are never used except by the 31usually defined by modes or packages, instead of by the user, and are
32code that handles abbrevs. Therefore, it is safe to use them in an 32treated specially in certain respects.
33
34Because the symbols used for abbrevs are not interned in the usual
35obarray, they will never appear as the result of reading a Lisp
36expression; in fact, normally they are never used except by the code
37that handles abbrevs. Therefore, it is safe to use them in an
33extremely nonstandard way. @xref{Creating Symbols}. 38extremely 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
84This function returns a copy of abbrev table @var{table}---a new 89This function returns a copy of abbrev table @var{table}---a new
85abbrev table that contains the same abbrev definitions. 90abbrev table that contains the same abbrev definitions. The only
91difference between @var{table} and the returned copy is that this
92function 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
90name, i.e., as a variable whose value is an abbrev table. It defines 97name, i.e., as a variable whose value is an abbrev table. It defines
91abbrevs in the table according to @var{definitions}, a list of 98abbrevs in the table according to @var{definitions}, a list of
92elements of the form @code{(@var{abbrevname} @var{expansion} 99elements 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
94value is always @code{nil}. 101@var{definitions} has length less than five, omitted elements default
102to @code{nil}. A value of @code{nil} for @var{usecount} is equivalent
103to zero. The return value is always @code{nil}.
104
105If this function is called more than once for the same @var{tabname},
106subsequent 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
109undefined 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
105abbrev table. The return value is always @code{nil}. 120abbrev table. The return value is always @code{nil}.
106 121
107If @var{human} is non-@code{nil}, the description is human-oriented. 122If @var{human} is non-@code{nil}, the description is human-oriented.
108Otherwise the description is a Lisp expression---a call to 123System abbrevs are listed and identified as such. Otherwise the
109@code{define-abbrev-table} that would define @var{name} exactly as it 124description is a Lisp expression---a call to @code{define-abbrev-table}
110is currently defined. 125that would define @var{name} as it is currently defined, but without
126the system abbrevs. (The mode or package using @var{name} is supposed
127to 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. 134abbrev in a specified abbrev table. When major modes predefine
118@code{define-abbrev} is the low-level basic function, while 135standard 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}.
120the user. When major modes predefine standard abbrevs, they should
121call @code{define-abbrev} and specify @code{t} for @var{system-flag}.
122
123@defun add-abbrev table type arg
124This function adds an abbreviation to abbrev table @var{table} based on
125information from the user. The argument @var{type} is a string
126describing in English the kind of abbrev this will be (typically,
127@code{"global"} or @code{"mode-specific"}); this is used in prompting
128the user. The argument @var{arg} is the number of words in the
129expansion.
130
131The return value is the symbol that internally represents the new
132abbrev, or @code{nil} if the user declines to confirm redefining an
133existing 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
137This function defines an abbrev named @var{name}, in @var{table}, to 139This function defines an abbrev named @var{name}, in @var{table}, to
138expand to @var{expansion} and call @var{hook}. The return value is a 140expand to @var{expansion} and call @var{hook}. The return value is
139symbol that represents the abbrev inside Emacs; its name is
140@var{name}. 141@var{name}.
141 142
142The value of @var{count}, if specified, initializes the abbrev's 143The 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
213A non-@code{nil} value for @code{save-abbrev} means that Emacs should 214A non-@code{nil} value for @code{save-abbrevs} means that Emacs should
214save abbrevs when files are saved. @code{abbrev-file-name} specifies 215offer the user to save abbrevs when files are saved. If the value is
215the 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
225Save all abbrev definitions (except ``system'' abbrevs), in all abbrev 227Save all abbrev definitions (except ``system'' abbrevs), for all abbrev
226tables, in the file @var{filename}, in the form of a Lisp program that 228tables listed in @code{abbrev-table-name-list}, in the file
227when 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 230define the same abbrevs. If @var{filename} is @code{nil} or omitted,
229returns @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
251This function returns the string that @var{abbrev} would expand into (as 253This function returns the string that @var{abbrev} would expand into (as
252defined by the abbrev tables used for the current buffer). The optional 254defined by the abbrev tables used for the current buffer). If
253argument @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}. 256The optional argument @var{table} specifies the abbrev table to use,
257as 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
269Mark current point as the beginning of an abbrev. The next call to 272This 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 273next call to @code{expand-abbrev} will use the text from here to point
271then) 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
272usual. 275previous word as usual.
276
277First, this command expands any abbrev before point, unless @var{arg}
278is non-@code{nil}. (Interactively, @var{arg} is the prefix argument.)
279Then it inserts a hyphen before point, to indicate the start of the
280next 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
283This is the buffer position for @code{expand-abbrev} to use as the start 291This is a marker pointing to the buffer position for
284of 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
285before point instead.) @code{abbrev-start-location} is set to 293expanded. (@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
287also 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