comparison lispref/abbrevs.texi @ 26192:01d4feb7e1e4

*** empty log message ***
author Gerd Moellmann <gerd@gnu.org>
date Tue, 26 Oct 1999 13:08:02 +0000
parents 467b88fab665
children d2e5f1b7d8e2
comparison
equal deleted inserted replaced
26191:a1a3ade8b6ea 26192:01d4feb7e1e4
72 containing no symbols. It is a vector filled with zeros. 72 containing no symbols. It is a vector filled with zeros.
73 @end defun 73 @end defun
74 74
75 @defun clear-abbrev-table table 75 @defun clear-abbrev-table table
76 This function undefines all the abbrevs in abbrev table @var{table}, 76 This function undefines all the abbrevs in abbrev table @var{table},
77 leaving it empty. The function returns @code{nil}. 77 leaving it empty. The function returns @code{nil}.
78 @end defun 78 @end defun
79 79
80 @defun define-abbrev-table tabname definitions 80 @defun define-abbrev-table tabname definitions
81 This function defines @var{tabname} (a symbol) as an abbrev table name, 81 This function defines @var{tabname} (a symbol) as an abbrev table name,
82 i.e., as a variable whose value is an abbrev table. It defines abbrevs 82 i.e., as a variable whose value is an abbrev table. It defines abbrevs
116 describing in English the kind of abbrev this will be (typically, 116 describing in English the kind of abbrev this will be (typically,
117 @code{"global"} or @code{"mode-specific"}); this is used in prompting 117 @code{"global"} or @code{"mode-specific"}); this is used in prompting
118 the user. The argument @var{arg} is the number of words in the 118 the user. The argument @var{arg} is the number of words in the
119 expansion. 119 expansion.
120 120
121
121 The return value is the symbol that internally represents the new 122 The return value is the symbol that internally represents the new
122 abbrev, or @code{nil} if the user declines to confirm redefining an 123 abbrev, or @code{nil} if the user declines to confirm redefining an
123 existing abbrev. 124 existing abbrev.
124 @end defun 125 @end defun
125 126
126 @defun define-abbrev table name expansion hook 127 @defun define-abbrev table name expansion &optional hook count
127 This function defines an abbrev named @var{name}, in @var{table}, to 128 This function defines an abbrev named @var{name}, in @var{table}, to
128 expand to @var{expansion} and call @var{hook}. The return value is a 129 expand to @var{expansion} and call @var{hook}. The value of
129 symbol that represents the abbrev inside Emacs; its name is @var{name}. 130 @var{count}, if specified, initializes the abbrev's usage-count. If
131 @var{count} is not specified or @code{nil}, the use count is initialized
132 to zero. The return value is a symbol that represents the abbrev inside
133 Emacs; its name is @var{name}.
130 134
131 The argument @var{name} should be a string. The argument 135 The argument @var{name} should be a string. The argument
132 @var{expansion} is normally the desired expansion (a string), or 136 @var{expansion} is normally the desired expansion (a string), or
133 @code{nil} to undefine the abbrev. If it is anything but a string or 137 @code{nil} to undefine the abbrev. If it is anything but a string or
134 @code{nil}, then the abbreviation ``expands'' solely by running 138 @code{nil}, then the abbreviation ``expands'' solely by running
135 @var{hook}. 139 @var{hook}.
136 140
141
137 The argument @var{hook} is a function or @code{nil}. If @var{hook} is 142 The argument @var{hook} is a function or @code{nil}. If @var{hook} is
138 non-@code{nil}, then it is called with no arguments after the abbrev is 143 non-@code{nil}, then it is called with no arguments after the abbrev is
139 replaced with @var{expansion}; point is located at the end of 144 replaced with @var{expansion}; point is located at the end of
140 @var{expansion} when @var{hook} is called. 145 @var{expansion} when @var{hook} is called.
141
142 The use count of the abbrev is initialized to zero.
143 @end defun 146 @end defun
144 147
145 @defopt only-global-abbrevs 148 @defopt only-global-abbrevs
146 If this variable is non-@code{nil}, it means that the user plans to use 149 If this variable is non-@code{nil}, it means that the user plans to use
147 global abbrevs only. This tells the commands that define mode-specific 150 global abbrevs only. This tells the commands that define mode-specific
166 169
167 @defopt abbrev-file-name 170 @defopt abbrev-file-name
168 This is the default file name for reading and saving abbrevs. 171 This is the default file name for reading and saving abbrevs.
169 @end defopt 172 @end defopt
170 173
171 @defun quietly-read-abbrev-file filename 174 @defun quietly-read-abbrev-file &optional filename
172 This function reads abbrev definitions from a file named @var{filename}, 175 This function reads abbrev definitions from a file named @var{filename},
173 previously written with @code{write-abbrev-file}. If @var{filename} is 176 previously written with @code{write-abbrev-file}. If @var{filename} is
174 @code{nil}, the file specified in @code{abbrev-file-name} is used. 177 omitted or @code{nil}, the file specified in @code{abbrev-file-name} is
175 @code{save-abbrevs} is set to @code{t} so that changes will be saved. 178 used. @code{save-abbrevs} is set to @code{t} so that changes will be
179 saved.
176 180
177 This function does not display any messages. It returns @code{nil}. 181 This function does not display any messages. It returns @code{nil}.
178 @end defun 182 @end defun
179 183
180 @defopt save-abbrevs 184 @defopt save-abbrevs
187 This variable is set non-@code{nil} by defining or altering any 191 This variable is set non-@code{nil} by defining or altering any
188 abbrevs. This serves as a flag for various Emacs commands to offer to 192 abbrevs. This serves as a flag for various Emacs commands to offer to
189 save your abbrevs. 193 save your abbrevs.
190 @end defvar 194 @end defvar
191 195
192 @deffn Command write-abbrev-file filename 196 @deffn Command write-abbrev-file &optional filename
193 Save all abbrev definitions, in all abbrev tables, in the file 197 Save all abbrev definitions, in all abbrev tables, in the file
194 @var{filename}, in the form of a Lisp program that when loaded will 198 @var{filename}, in the form of a Lisp program that when loaded will
195 define the same abbrevs. This function returns @code{nil}. 199 define the same abbrevs. If @var{filename} is @code{nil} or omitted,
200 @code{abbrev-file-name} is used. This function returns @code{nil}.
196 @end deffn 201 @end deffn
197 202
198 @node Abbrev Expansion, Standard Abbrev Tables, Abbrev Files, Abbrevs 203 @node Abbrev Expansion, Standard Abbrev Tables, Abbrev Files, Abbrevs
199 @comment node-name, next, previous, up 204 @comment node-name, next, previous, up
200 @section Looking Up and Expanding Abbreviations 205 @section Looking Up and Expanding Abbreviations
219 argument @var{table} specifies the abbrev table to use, as in 224 argument @var{table} specifies the abbrev table to use, as in
220 @code{abbrev-symbol}. 225 @code{abbrev-symbol}.
221 @end defun 226 @end defun
222 227
223 @deffn Command expand-abbrev 228 @deffn Command expand-abbrev
224 This command expands the abbrev before point, if any. 229 This command expands the abbrev before point, if any. If point does not
225 If point does not follow an abbrev, this command does nothing. 230 follow an abbrev, this command does nothing. The command returns the
226 The command returns @code{t} if it did expansion, @code{nil} otherwise. 231 abbrev symbol if it did expansion, @code{nil} otherwise.
227 @end deffn 232 @end deffn
233
228 234
229 @deffn Command abbrev-prefix-mark &optional arg 235 @deffn Command abbrev-prefix-mark &optional arg
230 Mark current point as the beginning of an abbrev. The next call to 236 Mark current point as the beginning of an abbrev. The next call to
231 @code{expand-abbrev} will use the text from here to point (where it is 237 @code{expand-abbrev} will use the text from here to point (where it is
232 then) as the abbrev to expand, rather than using the previous word as 238 then) as the abbrev to expand, rather than using the previous word as
279 @defvar pre-abbrev-expand-hook 285 @defvar pre-abbrev-expand-hook
280 This is a normal hook whose functions are executed, in sequence, just 286 This is a normal hook whose functions are executed, in sequence, just
281 before any expansion of an abbrev. @xref{Hooks}. Since it is a normal 287 before any expansion of an abbrev. @xref{Hooks}. Since it is a normal
282 hook, the hook functions receive no arguments. However, they can find 288 hook, the hook functions receive no arguments. However, they can find
283 the abbrev to be expanded by looking in the buffer before point. 289 the abbrev to be expanded by looking in the buffer before point.
290 Running the hook is the first thing that @code{expand-abbrev} does, and
291 so a hook function can be used to change the current abbrev table before
292 abbrev lookup happens.
284 @end defvar 293 @end defvar
285 294
286 The following sample code shows a simple use of 295 The following sample code shows a simple use of
287 @code{pre-abbrev-expand-hook}. If the user terminates an abbrev with a 296 @code{pre-abbrev-expand-hook}. If the user terminates an abbrev with a
288 punctuation character, the hook function asks for confirmation. Thus, 297 punctuation character, the hook function asks for confirmation. Thus,
338 @end defvar 347 @end defvar
339 348
340 @defvar lisp-mode-abbrev-table 349 @defvar lisp-mode-abbrev-table
341 This is the local abbrev table used in Lisp mode and Emacs Lisp mode. 350 This is the local abbrev table used in Lisp mode and Emacs Lisp mode.
342 @end defvar 351 @end defvar
352