Mercurial > emacs
annotate doc/lispref/abbrevs.texi @ 103602:c6838f93406e
* play/doctor.el: Remove reference to obsolete website.
(make-doctor-variables): Correct grammar mistake (Bug#2633).
author | Chong Yidong <cyd@stupidchicken.com> |
---|---|
date | Sat, 27 Jun 2009 04:21:14 +0000 |
parents | c32ec20d0ab5 |
children | caa79498564a |
rev | line source |
---|---|
84046 | 1 @c -*-texinfo-*- |
2 @c This is part of the GNU Emacs Lisp Reference Manual. | |
3 @c Copyright (C) 1990, 1991, 1992, 1993, 1994, 1999, 2001, 2002, 2003, | |
100974 | 4 @c 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc. |
84046 | 5 @c See the file elisp.texi for copying conditions. |
84116
0ba80d073e27
(setfilename): Go up one more level to ../../info.
Glenn Morris <rgm@gnu.org>
parents:
84046
diff
changeset
|
6 @setfilename ../../info/abbrevs |
84046 | 7 @node Abbrevs, Processes, Syntax Tables, Top |
8 @chapter Abbrevs and Abbrev Expansion | |
9 @cindex abbrev | |
10 @c @cindex abbrev table Redundant with "abbrev". | |
11 | |
12 An abbreviation or @dfn{abbrev} is a string of characters that may be | |
13 expanded to a longer string. The user can insert the abbrev string and | |
14 find it replaced automatically with the expansion of the abbrev. This | |
15 saves typing. | |
16 | |
17 The set of abbrevs currently in effect is recorded in an @dfn{abbrev | |
18 table}. Each buffer has a local abbrev table, but normally all buffers | |
19 in the same major mode share one abbrev table. There is also a global | |
20 abbrev table. Normally both are used. | |
21 | |
103216
75e91d51c5f2
* abbrevs.texi (Abbrevs): Add xref to Creating Symbols when
Chong Yidong <cyd@stupidchicken.com>
parents:
101456
diff
changeset
|
22 An abbrev table is represented as an obarray. @xref{Creating |
75e91d51c5f2
* abbrevs.texi (Abbrevs): Add xref to Creating Symbols when
Chong Yidong <cyd@stupidchicken.com>
parents:
101456
diff
changeset
|
23 Symbols}, for information about obarrays. Each abbreviation is |
75e91d51c5f2
* abbrevs.texi (Abbrevs): Add xref to Creating Symbols when
Chong Yidong <cyd@stupidchicken.com>
parents:
101456
diff
changeset
|
24 represented by a symbol in the obarray. The symbol's name is the |
75e91d51c5f2
* abbrevs.texi (Abbrevs): Add xref to Creating Symbols when
Chong Yidong <cyd@stupidchicken.com>
parents:
101456
diff
changeset
|
25 abbreviation; its value is the expansion; its function definition is |
75e91d51c5f2
* abbrevs.texi (Abbrevs): Add xref to Creating Symbols when
Chong Yidong <cyd@stupidchicken.com>
parents:
101456
diff
changeset
|
26 the hook function for performing the expansion (@pxref{Defining |
75e91d51c5f2
* abbrevs.texi (Abbrevs): Add xref to Creating Symbols when
Chong Yidong <cyd@stupidchicken.com>
parents:
101456
diff
changeset
|
27 Abbrevs}); and its property list cell contains various additional |
75e91d51c5f2
* abbrevs.texi (Abbrevs): Add xref to Creating Symbols when
Chong Yidong <cyd@stupidchicken.com>
parents:
101456
diff
changeset
|
28 properties, including the use count and the number of times the |
75e91d51c5f2
* abbrevs.texi (Abbrevs): Add xref to Creating Symbols when
Chong Yidong <cyd@stupidchicken.com>
parents:
101456
diff
changeset
|
29 abbreviation has been expanded (@pxref{Abbrev Properties}). |
84046 | 30 |
103216
75e91d51c5f2
* abbrevs.texi (Abbrevs): Add xref to Creating Symbols when
Chong Yidong <cyd@stupidchicken.com>
parents:
101456
diff
changeset
|
31 @cindex system abbrev |
75e91d51c5f2
* abbrevs.texi (Abbrevs): Add xref to Creating Symbols when
Chong Yidong <cyd@stupidchicken.com>
parents:
101456
diff
changeset
|
32 Certain abbrevs, called @dfn{system abbrevs}, are defined by a major |
75e91d51c5f2
* abbrevs.texi (Abbrevs): Add xref to Creating Symbols when
Chong Yidong <cyd@stupidchicken.com>
parents:
101456
diff
changeset
|
33 mode instead of the user. A system abbrev is identified by its |
75e91d51c5f2
* abbrevs.texi (Abbrevs): Add xref to Creating Symbols when
Chong Yidong <cyd@stupidchicken.com>
parents:
101456
diff
changeset
|
34 non-@code{nil} @code{:system} property (@pxref{Abbrev Properties}). |
75e91d51c5f2
* abbrevs.texi (Abbrevs): Add xref to Creating Symbols when
Chong Yidong <cyd@stupidchicken.com>
parents:
101456
diff
changeset
|
35 When abbrevs are saved to an abbrev file, system abbrevs are omitted. |
75e91d51c5f2
* abbrevs.texi (Abbrevs): Add xref to Creating Symbols when
Chong Yidong <cyd@stupidchicken.com>
parents:
101456
diff
changeset
|
36 @xref{Abbrev Files}. |
75e91d51c5f2
* abbrevs.texi (Abbrevs): Add xref to Creating Symbols when
Chong Yidong <cyd@stupidchicken.com>
parents:
101456
diff
changeset
|
37 |
75e91d51c5f2
* abbrevs.texi (Abbrevs): Add xref to Creating Symbols when
Chong Yidong <cyd@stupidchicken.com>
parents:
101456
diff
changeset
|
38 Because the symbols used for abbrevs are not interned in the usual |
84046 | 39 obarray, they will never appear as the result of reading a Lisp |
40 expression; in fact, normally they are never used except by the code | |
41 that handles abbrevs. Therefore, it is safe to use them in an | |
103216
75e91d51c5f2
* abbrevs.texi (Abbrevs): Add xref to Creating Symbols when
Chong Yidong <cyd@stupidchicken.com>
parents:
101456
diff
changeset
|
42 extremely nonstandard way. |
84046 | 43 |
44 For the user-level commands for abbrevs, see @ref{Abbrevs,, Abbrev | |
45 Mode, emacs, The GNU Emacs Manual}. | |
46 | |
47 @menu | |
48 * Abbrev Mode:: Setting up Emacs for abbreviation. | |
49 * Tables: Abbrev Tables. Creating and working with abbrev tables. | |
50 * Defining Abbrevs:: Specifying abbreviations and their expansions. | |
51 * Files: Abbrev Files. Saving abbrevs in files. | |
52 * Expansion: Abbrev Expansion. Controlling expansion; expansion subroutines. | |
53 * Standard Abbrev Tables:: Abbrev tables used by various major modes. | |
85710
beb909dfc54d
Rewrite abbrev.c in Elisp.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84116
diff
changeset
|
54 * Abbrev Properties:: How to read and set abbrev properties. |
beb909dfc54d
Rewrite abbrev.c in Elisp.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84116
diff
changeset
|
55 Which properties have which effect. |
beb909dfc54d
Rewrite abbrev.c in Elisp.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84116
diff
changeset
|
56 * Abbrev Table Properties:: How to read and set abbrev table properties. |
beb909dfc54d
Rewrite abbrev.c in Elisp.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84116
diff
changeset
|
57 Which properties have which effect. |
84046 | 58 @end menu |
59 | |
60 @node Abbrev Mode, Abbrev Tables, Abbrevs, Abbrevs | |
61 @comment node-name, next, previous, up | |
62 @section Setting Up Abbrev Mode | |
63 | |
103216
75e91d51c5f2
* abbrevs.texi (Abbrevs): Add xref to Creating Symbols when
Chong Yidong <cyd@stupidchicken.com>
parents:
101456
diff
changeset
|
64 Abbrev mode is a minor mode controlled by the variable |
84046 | 65 @code{abbrev-mode}. |
66 | |
103273
c32ec20d0ab5
* abbrevs.texi (Abbrev Mode): abbrev-mode is an option.
Martin Rudalics <rudalics@gmx.at>
parents:
103264
diff
changeset
|
67 @defopt abbrev-mode |
103216
75e91d51c5f2
* abbrevs.texi (Abbrevs): Add xref to Creating Symbols when
Chong Yidong <cyd@stupidchicken.com>
parents:
101456
diff
changeset
|
68 If this variable is non-@code{nil}, abbrevs are automatically expanded |
75e91d51c5f2
* abbrevs.texi (Abbrevs): Add xref to Creating Symbols when
Chong Yidong <cyd@stupidchicken.com>
parents:
101456
diff
changeset
|
69 in the buffer. If the value is @code{nil}, abbrevs may be defined, |
75e91d51c5f2
* abbrevs.texi (Abbrevs): Add xref to Creating Symbols when
Chong Yidong <cyd@stupidchicken.com>
parents:
101456
diff
changeset
|
70 but they are not expanded automatically. |
84046 | 71 |
72 This variable automatically becomes buffer-local when set in any fashion. | |
103273
c32ec20d0ab5
* abbrevs.texi (Abbrev Mode): abbrev-mode is an option.
Martin Rudalics <rudalics@gmx.at>
parents:
103264
diff
changeset
|
73 @end defopt |
84046 | 74 |
75 @defvar default-abbrev-mode | |
103216
75e91d51c5f2
* abbrevs.texi (Abbrevs): Add xref to Creating Symbols when
Chong Yidong <cyd@stupidchicken.com>
parents:
101456
diff
changeset
|
76 This is the value of @code{abbrev-mode} for buffers that do not |
75e91d51c5f2
* abbrevs.texi (Abbrevs): Add xref to Creating Symbols when
Chong Yidong <cyd@stupidchicken.com>
parents:
101456
diff
changeset
|
77 override it. It is the same as @code{(default-value 'abbrev-mode)}. |
84046 | 78 @end defvar |
79 | |
80 @node Abbrev Tables, Defining Abbrevs, Abbrev Mode, Abbrevs | |
81 @section Abbrev Tables | |
82 | |
83 This section describes how to create and manipulate abbrev tables. | |
84 | |
103264
b269cabac20c
* syntax.texi (Position Parse): Document rationale for ignored
Chong Yidong <cyd@stupidchicken.com>
parents:
103216
diff
changeset
|
85 @defun make-abbrev-table &optional props |
103216
75e91d51c5f2
* abbrevs.texi (Abbrevs): Add xref to Creating Symbols when
Chong Yidong <cyd@stupidchicken.com>
parents:
101456
diff
changeset
|
86 This function creates and returns a new, empty abbrev table---an |
75e91d51c5f2
* abbrevs.texi (Abbrevs): Add xref to Creating Symbols when
Chong Yidong <cyd@stupidchicken.com>
parents:
101456
diff
changeset
|
87 obarray containing no symbols. It is a vector filled with zeros. |
75e91d51c5f2
* abbrevs.texi (Abbrevs): Add xref to Creating Symbols when
Chong Yidong <cyd@stupidchicken.com>
parents:
101456
diff
changeset
|
88 @var{props} is a property list that is applied to the new table |
85773
13ae285f009a
Rename `count' and `system-flag' to :count and :system. Update all users.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
85710
diff
changeset
|
89 (@pxref{Abbrev Table Properties}). |
85710
beb909dfc54d
Rewrite abbrev.c in Elisp.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84116
diff
changeset
|
90 @end defun |
beb909dfc54d
Rewrite abbrev.c in Elisp.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84116
diff
changeset
|
91 |
103216
75e91d51c5f2
* abbrevs.texi (Abbrevs): Add xref to Creating Symbols when
Chong Yidong <cyd@stupidchicken.com>
parents:
101456
diff
changeset
|
92 @defun abbrev-table-p object |
75e91d51c5f2
* abbrevs.texi (Abbrevs): Add xref to Creating Symbols when
Chong Yidong <cyd@stupidchicken.com>
parents:
101456
diff
changeset
|
93 This function returns a non-@code{nil} value if @var{object} is an |
75e91d51c5f2
* abbrevs.texi (Abbrevs): Add xref to Creating Symbols when
Chong Yidong <cyd@stupidchicken.com>
parents:
101456
diff
changeset
|
94 abbrev table. |
84046 | 95 @end defun |
96 | |
103216
75e91d51c5f2
* abbrevs.texi (Abbrevs): Add xref to Creating Symbols when
Chong Yidong <cyd@stupidchicken.com>
parents:
101456
diff
changeset
|
97 @defun clear-abbrev-table abbrev-table |
75e91d51c5f2
* abbrevs.texi (Abbrevs): Add xref to Creating Symbols when
Chong Yidong <cyd@stupidchicken.com>
parents:
101456
diff
changeset
|
98 This function undefines all the abbrevs in @var{abbrev-table}, leaving |
75e91d51c5f2
* abbrevs.texi (Abbrevs): Add xref to Creating Symbols when
Chong Yidong <cyd@stupidchicken.com>
parents:
101456
diff
changeset
|
99 it empty. It always returns @code{nil}. |
84046 | 100 @end defun |
101 | |
103216
75e91d51c5f2
* abbrevs.texi (Abbrevs): Add xref to Creating Symbols when
Chong Yidong <cyd@stupidchicken.com>
parents:
101456
diff
changeset
|
102 @defun copy-abbrev-table abbrev-table |
75e91d51c5f2
* abbrevs.texi (Abbrevs): Add xref to Creating Symbols when
Chong Yidong <cyd@stupidchicken.com>
parents:
101456
diff
changeset
|
103 This function returns a copy of @var{abbrev-table}---a new abbrev |
75e91d51c5f2
* abbrevs.texi (Abbrevs): Add xref to Creating Symbols when
Chong Yidong <cyd@stupidchicken.com>
parents:
101456
diff
changeset
|
104 table containing the same abbrev definitions. There is one difference |
75e91d51c5f2
* abbrevs.texi (Abbrevs): Add xref to Creating Symbols when
Chong Yidong <cyd@stupidchicken.com>
parents:
101456
diff
changeset
|
105 between the contents of @var{abbrev-table} and the returned copy: all |
75e91d51c5f2
* abbrevs.texi (Abbrevs): Add xref to Creating Symbols when
Chong Yidong <cyd@stupidchicken.com>
parents:
101456
diff
changeset
|
106 abbrevs in the latter have their property lists set to @code{nil}. |
84046 | 107 @end defun |
108 | |
85710
beb909dfc54d
Rewrite abbrev.c in Elisp.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84116
diff
changeset
|
109 @defun define-abbrev-table tabname definitions &optional docstring &rest props |
84046 | 110 This function defines @var{tabname} (a symbol) as an abbrev table |
111 name, i.e., as a variable whose value is an abbrev table. It defines | |
112 abbrevs in the table according to @var{definitions}, a list of | |
113 elements of the form @code{(@var{abbrevname} @var{expansion} | |
85710
beb909dfc54d
Rewrite abbrev.c in Elisp.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84116
diff
changeset
|
114 [@var{hook}] [@var{props}...])}. These elements are passed as |
beb909dfc54d
Rewrite abbrev.c in Elisp.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84116
diff
changeset
|
115 arguments to @code{define-abbrev}. The return value is always |
beb909dfc54d
Rewrite abbrev.c in Elisp.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84116
diff
changeset
|
116 @code{nil}. |
beb909dfc54d
Rewrite abbrev.c in Elisp.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84116
diff
changeset
|
117 |
beb909dfc54d
Rewrite abbrev.c in Elisp.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84116
diff
changeset
|
118 The optional string @var{docstring} is the documentation string of the |
beb909dfc54d
Rewrite abbrev.c in Elisp.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84116
diff
changeset
|
119 variable @var{tabname}. The property list @var{props} is applied to |
beb909dfc54d
Rewrite abbrev.c in Elisp.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84116
diff
changeset
|
120 the abbrev table (@pxref{Abbrev Table Properties}). |
84046 | 121 |
122 If this function is called more than once for the same @var{tabname}, | |
123 subsequent calls add the definitions in @var{definitions} to | |
124 @var{tabname}, rather than overriding the entire original contents. | |
125 (A subsequent call only overrides abbrevs explicitly redefined or | |
126 undefined in @var{definitions}.) | |
127 @end defun | |
128 | |
129 @defvar abbrev-table-name-list | |
130 This is a list of symbols whose values are abbrev tables. | |
131 @code{define-abbrev-table} adds the new abbrev table name to this list. | |
132 @end defvar | |
133 | |
134 @defun insert-abbrev-table-description name &optional human | |
135 This function inserts before point a description of the abbrev table | |
136 named @var{name}. The argument @var{name} is a symbol whose value is an | |
137 abbrev table. The return value is always @code{nil}. | |
138 | |
139 If @var{human} is non-@code{nil}, the description is human-oriented. | |
140 System abbrevs are listed and identified as such. Otherwise the | |
141 description is a Lisp expression---a call to @code{define-abbrev-table} | |
142 that would define @var{name} as it is currently defined, but without | |
143 the system abbrevs. (The mode or package using @var{name} is supposed | |
144 to add these to @var{name} separately.) | |
145 @end defun | |
146 | |
147 @node Defining Abbrevs, Abbrev Files, Abbrev Tables, Abbrevs | |
148 @comment node-name, next, previous, up | |
149 @section Defining Abbrevs | |
103216
75e91d51c5f2
* abbrevs.texi (Abbrevs): Add xref to Creating Symbols when
Chong Yidong <cyd@stupidchicken.com>
parents:
101456
diff
changeset
|
150 |
84046 | 151 @code{define-abbrev} is the low-level basic function for defining an |
103216
75e91d51c5f2
* abbrevs.texi (Abbrevs): Add xref to Creating Symbols when
Chong Yidong <cyd@stupidchicken.com>
parents:
101456
diff
changeset
|
152 abbrev in an abbrev table. |
75e91d51c5f2
* abbrevs.texi (Abbrevs): Add xref to Creating Symbols when
Chong Yidong <cyd@stupidchicken.com>
parents:
101456
diff
changeset
|
153 |
75e91d51c5f2
* abbrevs.texi (Abbrevs): Add xref to Creating Symbols when
Chong Yidong <cyd@stupidchicken.com>
parents:
101456
diff
changeset
|
154 When a major mode defines a system abbrev, it should call |
75e91d51c5f2
* abbrevs.texi (Abbrevs): Add xref to Creating Symbols when
Chong Yidong <cyd@stupidchicken.com>
parents:
101456
diff
changeset
|
155 @code{define-abbrev} and specify a @code{t} for the @code{:system} |
75e91d51c5f2
* abbrevs.texi (Abbrevs): Add xref to Creating Symbols when
Chong Yidong <cyd@stupidchicken.com>
parents:
101456
diff
changeset
|
156 property. Be aware that any saved non-``system'' abbrevs are restored |
75e91d51c5f2
* abbrevs.texi (Abbrevs): Add xref to Creating Symbols when
Chong Yidong <cyd@stupidchicken.com>
parents:
101456
diff
changeset
|
157 at startup, i.e. before some major modes are loaded. Therefore, major |
75e91d51c5f2
* abbrevs.texi (Abbrevs): Add xref to Creating Symbols when
Chong Yidong <cyd@stupidchicken.com>
parents:
101456
diff
changeset
|
158 modes should not assume that their abbrev tables are empty when they |
75e91d51c5f2
* abbrevs.texi (Abbrevs): Add xref to Creating Symbols when
Chong Yidong <cyd@stupidchicken.com>
parents:
101456
diff
changeset
|
159 are first loaded. |
84046 | 160 |
103216
75e91d51c5f2
* abbrevs.texi (Abbrevs): Add xref to Creating Symbols when
Chong Yidong <cyd@stupidchicken.com>
parents:
101456
diff
changeset
|
161 @defun define-abbrev abbrev-table name expansion &optional hook &rest props |
75e91d51c5f2
* abbrevs.texi (Abbrevs): Add xref to Creating Symbols when
Chong Yidong <cyd@stupidchicken.com>
parents:
101456
diff
changeset
|
162 This function defines an abbrev named @var{name}, in |
75e91d51c5f2
* abbrevs.texi (Abbrevs): Add xref to Creating Symbols when
Chong Yidong <cyd@stupidchicken.com>
parents:
101456
diff
changeset
|
163 @var{abbrev-table}, to expand to @var{expansion} and call @var{hook}, |
75e91d51c5f2
* abbrevs.texi (Abbrevs): Add xref to Creating Symbols when
Chong Yidong <cyd@stupidchicken.com>
parents:
101456
diff
changeset
|
164 with properties @var{props} (@pxref{Abbrev Properties}). The return |
75e91d51c5f2
* abbrevs.texi (Abbrevs): Add xref to Creating Symbols when
Chong Yidong <cyd@stupidchicken.com>
parents:
101456
diff
changeset
|
165 value is @var{name}. The @code{:system} property in @var{props} is |
75e91d51c5f2
* abbrevs.texi (Abbrevs): Add xref to Creating Symbols when
Chong Yidong <cyd@stupidchicken.com>
parents:
101456
diff
changeset
|
166 treated specially here: if it has the value @code{force}, then it will |
75e91d51c5f2
* abbrevs.texi (Abbrevs): Add xref to Creating Symbols when
Chong Yidong <cyd@stupidchicken.com>
parents:
101456
diff
changeset
|
167 overwrite an existing definition even for a non-``system'' abbrev of |
75e91d51c5f2
* abbrevs.texi (Abbrevs): Add xref to Creating Symbols when
Chong Yidong <cyd@stupidchicken.com>
parents:
101456
diff
changeset
|
168 the same name. |
84046 | 169 |
103216
75e91d51c5f2
* abbrevs.texi (Abbrevs): Add xref to Creating Symbols when
Chong Yidong <cyd@stupidchicken.com>
parents:
101456
diff
changeset
|
170 @var{name} should be a string. The argument @var{expansion} is |
75e91d51c5f2
* abbrevs.texi (Abbrevs): Add xref to Creating Symbols when
Chong Yidong <cyd@stupidchicken.com>
parents:
101456
diff
changeset
|
171 normally the desired expansion (a string), or @code{nil} to undefine |
75e91d51c5f2
* abbrevs.texi (Abbrevs): Add xref to Creating Symbols when
Chong Yidong <cyd@stupidchicken.com>
parents:
101456
diff
changeset
|
172 the abbrev. If it is anything but a string or @code{nil}, then the |
75e91d51c5f2
* abbrevs.texi (Abbrevs): Add xref to Creating Symbols when
Chong Yidong <cyd@stupidchicken.com>
parents:
101456
diff
changeset
|
173 abbreviation ``expands'' solely by running @var{hook}. |
84046 | 174 |
175 The argument @var{hook} is a function or @code{nil}. If @var{hook} is | |
176 non-@code{nil}, then it is called with no arguments after the abbrev is | |
177 replaced with @var{expansion}; point is located at the end of | |
178 @var{expansion} when @var{hook} is called. | |
179 | |
180 @cindex @code{no-self-insert} property | |
181 If @var{hook} is a non-@code{nil} symbol whose @code{no-self-insert} | |
182 property is non-@code{nil}, @var{hook} can explicitly control whether | |
183 to insert the self-inserting input character that triggered the | |
184 expansion. If @var{hook} returns non-@code{nil} in this case, that | |
185 inhibits insertion of the character. By contrast, if @var{hook} | |
186 returns @code{nil}, @code{expand-abbrev} also returns @code{nil}, as | |
187 if expansion had not really occurred. | |
188 | |
103216
75e91d51c5f2
* abbrevs.texi (Abbrevs): Add xref to Creating Symbols when
Chong Yidong <cyd@stupidchicken.com>
parents:
101456
diff
changeset
|
189 Normally, @code{define-abbrev} sets the variable |
84046 | 190 @code{abbrevs-changed} to @code{t}, if it actually changes the abbrev. |
191 (This is so that some commands will offer to save the abbrevs.) It | |
103216
75e91d51c5f2
* abbrevs.texi (Abbrevs): Add xref to Creating Symbols when
Chong Yidong <cyd@stupidchicken.com>
parents:
101456
diff
changeset
|
192 does not do this for a system abbrev, since those aren't saved anyway. |
84046 | 193 @end defun |
194 | |
195 @defopt only-global-abbrevs | |
196 If this variable is non-@code{nil}, it means that the user plans to use | |
197 global abbrevs only. This tells the commands that define mode-specific | |
198 abbrevs to define global ones instead. This variable does not alter the | |
199 behavior of the functions in this section; it is examined by their | |
200 callers. | |
201 @end defopt | |
202 | |
203 @node Abbrev Files, Abbrev Expansion, Defining Abbrevs, Abbrevs | |
204 @section Saving Abbrevs in Files | |
205 | |
206 A file of saved abbrev definitions is actually a file of Lisp code. | |
207 The abbrevs are saved in the form of a Lisp program to define the same | |
208 abbrev tables with the same contents. Therefore, you can load the file | |
209 with @code{load} (@pxref{How Programs Do Loading}). However, the | |
210 function @code{quietly-read-abbrev-file} is provided as a more | |
211 convenient interface. | |
212 | |
213 User-level facilities such as @code{save-some-buffers} can save | |
214 abbrevs in a file automatically, under the control of variables | |
215 described here. | |
216 | |
217 @defopt abbrev-file-name | |
218 This is the default file name for reading and saving abbrevs. | |
219 @end defopt | |
220 | |
221 @defun quietly-read-abbrev-file &optional filename | |
222 This function reads abbrev definitions from a file named @var{filename}, | |
223 previously written with @code{write-abbrev-file}. If @var{filename} is | |
224 omitted or @code{nil}, the file specified in @code{abbrev-file-name} is | |
225 used. @code{save-abbrevs} is set to @code{t} so that changes will be | |
226 saved. | |
227 | |
228 This function does not display any messages. It returns @code{nil}. | |
229 @end defun | |
230 | |
231 @defopt save-abbrevs | |
232 A non-@code{nil} value for @code{save-abbrevs} means that Emacs should | |
233 offer the user to save abbrevs when files are saved. If the value is | |
234 @code{silently}, Emacs saves the abbrevs without asking the user. | |
235 @code{abbrev-file-name} specifies the file to save the abbrevs in. | |
236 @end defopt | |
237 | |
238 @defvar abbrevs-changed | |
239 This variable is set non-@code{nil} by defining or altering any | |
103216
75e91d51c5f2
* abbrevs.texi (Abbrevs): Add xref to Creating Symbols when
Chong Yidong <cyd@stupidchicken.com>
parents:
101456
diff
changeset
|
240 abbrevs (except system abbrevs). This serves as a flag for various |
75e91d51c5f2
* abbrevs.texi (Abbrevs): Add xref to Creating Symbols when
Chong Yidong <cyd@stupidchicken.com>
parents:
101456
diff
changeset
|
241 Emacs commands to offer to save your abbrevs. |
84046 | 242 @end defvar |
243 | |
244 @deffn Command write-abbrev-file &optional filename | |
103216
75e91d51c5f2
* abbrevs.texi (Abbrevs): Add xref to Creating Symbols when
Chong Yidong <cyd@stupidchicken.com>
parents:
101456
diff
changeset
|
245 Save all abbrev definitions (except system abbrevs), for all abbrev |
84046 | 246 tables listed in @code{abbrev-table-name-list}, in the file |
247 @var{filename}, in the form of a Lisp program that when loaded will | |
248 define the same abbrevs. If @var{filename} is @code{nil} or omitted, | |
249 @code{abbrev-file-name} is used. This function returns @code{nil}. | |
250 @end deffn | |
251 | |
252 @node Abbrev Expansion, Standard Abbrev Tables, Abbrev Files, Abbrevs | |
253 @comment node-name, next, previous, up | |
254 @section Looking Up and Expanding Abbreviations | |
255 | |
256 Abbrevs are usually expanded by certain interactive commands, | |
257 including @code{self-insert-command}. This section describes the | |
258 subroutines used in writing such commands, as well as the variables they | |
259 use for communication. | |
260 | |
261 @defun abbrev-symbol abbrev &optional table | |
262 This function returns the symbol representing the abbrev named | |
263 @var{abbrev}. The value returned is @code{nil} if that abbrev is not | |
264 defined. The optional second argument @var{table} is the abbrev table | |
103216
75e91d51c5f2
* abbrevs.texi (Abbrevs): Add xref to Creating Symbols when
Chong Yidong <cyd@stupidchicken.com>
parents:
101456
diff
changeset
|
265 in which to look it up. If @var{table} is @code{nil}, this function |
75e91d51c5f2
* abbrevs.texi (Abbrevs): Add xref to Creating Symbols when
Chong Yidong <cyd@stupidchicken.com>
parents:
101456
diff
changeset
|
266 tries first the current buffer's local abbrev table, and second the |
75e91d51c5f2
* abbrevs.texi (Abbrevs): Add xref to Creating Symbols when
Chong Yidong <cyd@stupidchicken.com>
parents:
101456
diff
changeset
|
267 global abbrev table. |
84046 | 268 @end defun |
269 | |
270 @defun abbrev-expansion abbrev &optional table | |
271 This function returns the string that @var{abbrev} would expand into (as | |
272 defined by the abbrev tables used for the current buffer). If | |
273 @var{abbrev} is not a valid abbrev, the function returns @code{nil}. | |
274 The optional argument @var{table} specifies the abbrev table to use, | |
275 as in @code{abbrev-symbol}. | |
276 @end defun | |
277 | |
278 @deffn Command expand-abbrev | |
279 This command expands the abbrev before point, if any. If point does not | |
280 follow an abbrev, this command does nothing. The command returns the | |
281 abbrev symbol if it did expansion, @code{nil} otherwise. | |
282 | |
283 If the abbrev symbol has a hook function which is a symbol whose | |
284 @code{no-self-insert} property is non-@code{nil}, and if the hook | |
285 function returns @code{nil} as its value, then @code{expand-abbrev} | |
286 returns @code{nil} even though expansion did occur. | |
287 @end deffn | |
288 | |
103216
75e91d51c5f2
* abbrevs.texi (Abbrevs): Add xref to Creating Symbols when
Chong Yidong <cyd@stupidchicken.com>
parents:
101456
diff
changeset
|
289 @deffn abbrev-insert abbrev &optional name start end |
75e91d51c5f2
* abbrevs.texi (Abbrevs): Add xref to Creating Symbols when
Chong Yidong <cyd@stupidchicken.com>
parents:
101456
diff
changeset
|
290 This function inserts the abbrev expansion of @code{abbrev}, replacing |
75e91d51c5f2
* abbrevs.texi (Abbrevs): Add xref to Creating Symbols when
Chong Yidong <cyd@stupidchicken.com>
parents:
101456
diff
changeset
|
291 the text between @code{start} and @code{end}. If @code{start} is |
75e91d51c5f2
* abbrevs.texi (Abbrevs): Add xref to Creating Symbols when
Chong Yidong <cyd@stupidchicken.com>
parents:
101456
diff
changeset
|
292 omitted, it defaults to point. @code{name}, if non-@code{nil}, should |
75e91d51c5f2
* abbrevs.texi (Abbrevs): Add xref to Creating Symbols when
Chong Yidong <cyd@stupidchicken.com>
parents:
101456
diff
changeset
|
293 be the name by which this abbrev was found (a string); it is used to |
75e91d51c5f2
* abbrevs.texi (Abbrevs): Add xref to Creating Symbols when
Chong Yidong <cyd@stupidchicken.com>
parents:
101456
diff
changeset
|
294 figure out whether to adjust the capitalization of the expansion. The |
75e91d51c5f2
* abbrevs.texi (Abbrevs): Add xref to Creating Symbols when
Chong Yidong <cyd@stupidchicken.com>
parents:
101456
diff
changeset
|
295 function returns @code{abbrev} if the abbrev was successfully |
75e91d51c5f2
* abbrevs.texi (Abbrevs): Add xref to Creating Symbols when
Chong Yidong <cyd@stupidchicken.com>
parents:
101456
diff
changeset
|
296 inserted. |
75e91d51c5f2
* abbrevs.texi (Abbrevs): Add xref to Creating Symbols when
Chong Yidong <cyd@stupidchicken.com>
parents:
101456
diff
changeset
|
297 @end deffn |
75e91d51c5f2
* abbrevs.texi (Abbrevs): Add xref to Creating Symbols when
Chong Yidong <cyd@stupidchicken.com>
parents:
101456
diff
changeset
|
298 |
84046 | 299 @deffn Command abbrev-prefix-mark &optional arg |
300 This command marks the current location of point as the beginning of | |
301 an abbrev. The next call to @code{expand-abbrev} will use the text | |
302 from here to point (where it is then) as the abbrev to expand, rather | |
303 than using the previous word as usual. | |
304 | |
305 First, this command expands any abbrev before point, unless @var{arg} | |
306 is non-@code{nil}. (Interactively, @var{arg} is the prefix argument.) | |
307 Then it inserts a hyphen before point, to indicate the start of the | |
308 next abbrev to be expanded. The actual expansion removes the hyphen. | |
309 @end deffn | |
310 | |
311 @defopt abbrev-all-caps | |
312 When this is set non-@code{nil}, an abbrev entered entirely in upper | |
313 case is expanded using all upper case. Otherwise, an abbrev entered | |
314 entirely in upper case is expanded by capitalizing each word of the | |
315 expansion. | |
316 @end defopt | |
317 | |
318 @defvar abbrev-start-location | |
319 The value of this variable is a buffer position (an integer or a marker) | |
320 for @code{expand-abbrev} to use as the start of the next abbrev to be | |
321 expanded. The value can also be @code{nil}, which means to use the | |
322 word before point instead. @code{abbrev-start-location} is set to | |
323 @code{nil} each time @code{expand-abbrev} is called. This variable is | |
324 also set by @code{abbrev-prefix-mark}. | |
325 @end defvar | |
326 | |
327 @defvar abbrev-start-location-buffer | |
328 The value of this variable is the buffer for which | |
329 @code{abbrev-start-location} has been set. Trying to expand an abbrev | |
330 in any other buffer clears @code{abbrev-start-location}. This variable | |
331 is set by @code{abbrev-prefix-mark}. | |
332 @end defvar | |
333 | |
334 @defvar last-abbrev | |
335 This is the @code{abbrev-symbol} of the most recent abbrev expanded. This | |
336 information is left by @code{expand-abbrev} for the sake of the | |
337 @code{unexpand-abbrev} command (@pxref{Expanding Abbrevs,, Expanding | |
338 Abbrevs, emacs, The GNU Emacs Manual}). | |
339 @end defvar | |
340 | |
341 @defvar last-abbrev-location | |
342 This is the location of the most recent abbrev expanded. This contains | |
343 information left by @code{expand-abbrev} for the sake of the | |
344 @code{unexpand-abbrev} command. | |
345 @end defvar | |
346 | |
347 @defvar last-abbrev-text | |
348 This is the exact expansion text of the most recent abbrev expanded, | |
349 after case conversion (if any). Its value is @code{nil} if the abbrev | |
350 has already been unexpanded. This contains information left by | |
351 @code{expand-abbrev} for the sake of the @code{unexpand-abbrev} command. | |
352 @end defvar | |
353 | |
85710
beb909dfc54d
Rewrite abbrev.c in Elisp.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84116
diff
changeset
|
354 @defvar abbrev-expand-functions |
beb909dfc54d
Rewrite abbrev.c in Elisp.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84116
diff
changeset
|
355 This is a special hook run @emph{around} the @code{expand-abbrev} |
103216
75e91d51c5f2
* abbrevs.texi (Abbrevs): Add xref to Creating Symbols when
Chong Yidong <cyd@stupidchicken.com>
parents:
101456
diff
changeset
|
356 function. Each function on this hook is called with a single |
75e91d51c5f2
* abbrevs.texi (Abbrevs): Add xref to Creating Symbols when
Chong Yidong <cyd@stupidchicken.com>
parents:
101456
diff
changeset
|
357 argument: a function that performs the normal abbrev expansion. The |
75e91d51c5f2
* abbrevs.texi (Abbrevs): Add xref to Creating Symbols when
Chong Yidong <cyd@stupidchicken.com>
parents:
101456
diff
changeset
|
358 hook function can hence do anything it wants before and after |
75e91d51c5f2
* abbrevs.texi (Abbrevs): Add xref to Creating Symbols when
Chong Yidong <cyd@stupidchicken.com>
parents:
101456
diff
changeset
|
359 performing the expansion. It can also choose not to call its |
75e91d51c5f2
* abbrevs.texi (Abbrevs): Add xref to Creating Symbols when
Chong Yidong <cyd@stupidchicken.com>
parents:
101456
diff
changeset
|
360 argument, thus overriding the default behavior; or it may even call it |
85710
beb909dfc54d
Rewrite abbrev.c in Elisp.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84116
diff
changeset
|
361 several times. The function should return the abbrev symbol if |
beb909dfc54d
Rewrite abbrev.c in Elisp.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84116
diff
changeset
|
362 expansion took place. |
84046 | 363 @end defvar |
364 | |
365 The following sample code shows a simple use of | |
85710
beb909dfc54d
Rewrite abbrev.c in Elisp.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84116
diff
changeset
|
366 @code{abbrev-expand-functions}. It assumes that @code{foo-mode} is a |
84046 | 367 mode for editing certain files in which lines that start with @samp{#} |
368 are comments. You want to use Text mode abbrevs for those lines. The | |
369 regular local abbrev table, @code{foo-mode-abbrev-table} is | |
370 appropriate for all other lines. Then you can put the following code | |
371 in your @file{.emacs} file. @xref{Standard Abbrev Tables}, for the | |
372 definitions of @code{local-abbrev-table} and @code{text-mode-abbrev-table}. | |
373 | |
374 @smallexample | |
85710
beb909dfc54d
Rewrite abbrev.c in Elisp.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84116
diff
changeset
|
375 (defun foo-mode-abbrev-expand-function (expand) |
beb909dfc54d
Rewrite abbrev.c in Elisp.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84116
diff
changeset
|
376 (if (not (save-excursion (forward-line 0) (eq (char-after) ?#))) |
beb909dfc54d
Rewrite abbrev.c in Elisp.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84116
diff
changeset
|
377 ;; Performs normal expansion. |
beb909dfc54d
Rewrite abbrev.c in Elisp.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84116
diff
changeset
|
378 (funcall expand) |
beb909dfc54d
Rewrite abbrev.c in Elisp.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84116
diff
changeset
|
379 ;; We're inside a comment: use the text-mode abbrevs. |
beb909dfc54d
Rewrite abbrev.c in Elisp.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84116
diff
changeset
|
380 (let ((local-abbrev-table text-mode-abbrev-table)) |
beb909dfc54d
Rewrite abbrev.c in Elisp.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84116
diff
changeset
|
381 (funcall expand)))) |
84046 | 382 |
383 (add-hook 'foo-mode-hook | |
384 #'(lambda () | |
85710
beb909dfc54d
Rewrite abbrev.c in Elisp.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84116
diff
changeset
|
385 (add-hook 'abbrev-expand-functions |
beb909dfc54d
Rewrite abbrev.c in Elisp.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84116
diff
changeset
|
386 'foo-mode-abbrev-expand-function |
84046 | 387 nil t))) |
388 @end smallexample | |
389 | |
85710
beb909dfc54d
Rewrite abbrev.c in Elisp.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84116
diff
changeset
|
390 @node Standard Abbrev Tables, Abbrev Properties, Abbrev Expansion, Abbrevs |
84046 | 391 @comment node-name, next, previous, up |
392 @section Standard Abbrev Tables | |
393 | |
394 Here we list the variables that hold the abbrev tables for the | |
395 preloaded major modes of Emacs. | |
396 | |
397 @defvar global-abbrev-table | |
398 This is the abbrev table for mode-independent abbrevs. The abbrevs | |
399 defined in it apply to all buffers. Each buffer may also have a local | |
400 abbrev table, whose abbrev definitions take precedence over those in the | |
401 global table. | |
402 @end defvar | |
403 | |
404 @defvar local-abbrev-table | |
405 The value of this buffer-local variable is the (mode-specific) | |
85710
beb909dfc54d
Rewrite abbrev.c in Elisp.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84116
diff
changeset
|
406 abbreviation table of the current buffer. It can also be a list of |
beb909dfc54d
Rewrite abbrev.c in Elisp.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84116
diff
changeset
|
407 such tables. |
beb909dfc54d
Rewrite abbrev.c in Elisp.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84116
diff
changeset
|
408 @end defvar |
beb909dfc54d
Rewrite abbrev.c in Elisp.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84116
diff
changeset
|
409 |
beb909dfc54d
Rewrite abbrev.c in Elisp.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84116
diff
changeset
|
410 @defvar abbrev-minor-mode-table-alist |
beb909dfc54d
Rewrite abbrev.c in Elisp.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84116
diff
changeset
|
411 The value of this variable is a list of elements of the form |
beb909dfc54d
Rewrite abbrev.c in Elisp.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84116
diff
changeset
|
412 @code{(@var{mode} . @var{abbrev-table})} where @var{mode} is the name |
beb909dfc54d
Rewrite abbrev.c in Elisp.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84116
diff
changeset
|
413 of a variable: if the variable is bound to a non-@code{nil} value, |
beb909dfc54d
Rewrite abbrev.c in Elisp.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84116
diff
changeset
|
414 then the @var{abbrev-table} is active, otherwise it is ignored. |
beb909dfc54d
Rewrite abbrev.c in Elisp.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84116
diff
changeset
|
415 @var{abbrev-table} can also be a list of abbrev tables. |
84046 | 416 @end defvar |
417 | |
418 @defvar fundamental-mode-abbrev-table | |
419 This is the local abbrev table used in Fundamental mode; in other words, | |
420 it is the local abbrev table in all buffers in Fundamental mode. | |
421 @end defvar | |
422 | |
423 @defvar text-mode-abbrev-table | |
424 This is the local abbrev table used in Text mode. | |
425 @end defvar | |
426 | |
427 @defvar lisp-mode-abbrev-table | |
428 This is the local abbrev table used in Lisp mode and Emacs Lisp mode. | |
429 @end defvar | |
430 | |
85710
beb909dfc54d
Rewrite abbrev.c in Elisp.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84116
diff
changeset
|
431 @node Abbrev Properties, Abbrev Table Properties, Standard Abbrev Tables, Abbrevs |
beb909dfc54d
Rewrite abbrev.c in Elisp.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84116
diff
changeset
|
432 @section Abbrev Properties |
beb909dfc54d
Rewrite abbrev.c in Elisp.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84116
diff
changeset
|
433 |
beb909dfc54d
Rewrite abbrev.c in Elisp.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84116
diff
changeset
|
434 Abbrevs have properties, some of which influence the way they work. |
85773
13ae285f009a
Rename `count' and `system-flag' to :count and :system. Update all users.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
85710
diff
changeset
|
435 You can provide them as arguments to @code{define-abbrev} and you can |
103216
75e91d51c5f2
* abbrevs.texi (Abbrevs): Add xref to Creating Symbols when
Chong Yidong <cyd@stupidchicken.com>
parents:
101456
diff
changeset
|
436 manipulate them with the following functions: |
85710
beb909dfc54d
Rewrite abbrev.c in Elisp.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84116
diff
changeset
|
437 |
beb909dfc54d
Rewrite abbrev.c in Elisp.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84116
diff
changeset
|
438 @defun abbrev-put abbrev prop val |
103216
75e91d51c5f2
* abbrevs.texi (Abbrevs): Add xref to Creating Symbols when
Chong Yidong <cyd@stupidchicken.com>
parents:
101456
diff
changeset
|
439 Set the property @var{prop} of @var{abbrev} to value @var{val}. |
85710
beb909dfc54d
Rewrite abbrev.c in Elisp.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84116
diff
changeset
|
440 @end defun |
beb909dfc54d
Rewrite abbrev.c in Elisp.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84116
diff
changeset
|
441 |
beb909dfc54d
Rewrite abbrev.c in Elisp.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84116
diff
changeset
|
442 @defun abbrev-get abbrev prop |
103216
75e91d51c5f2
* abbrevs.texi (Abbrevs): Add xref to Creating Symbols when
Chong Yidong <cyd@stupidchicken.com>
parents:
101456
diff
changeset
|
443 Return the property @var{prop} of @var{abbrev}, or @code{nil} if the |
75e91d51c5f2
* abbrevs.texi (Abbrevs): Add xref to Creating Symbols when
Chong Yidong <cyd@stupidchicken.com>
parents:
101456
diff
changeset
|
444 abbrev has no such property. |
85710
beb909dfc54d
Rewrite abbrev.c in Elisp.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84116
diff
changeset
|
445 @end defun |
beb909dfc54d
Rewrite abbrev.c in Elisp.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84116
diff
changeset
|
446 |
103216
75e91d51c5f2
* abbrevs.texi (Abbrevs): Add xref to Creating Symbols when
Chong Yidong <cyd@stupidchicken.com>
parents:
101456
diff
changeset
|
447 The following properties have special meanings: |
85710
beb909dfc54d
Rewrite abbrev.c in Elisp.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84116
diff
changeset
|
448 |
beb909dfc54d
Rewrite abbrev.c in Elisp.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84116
diff
changeset
|
449 @table @code |
85773
13ae285f009a
Rename `count' and `system-flag' to :count and :system. Update all users.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
85710
diff
changeset
|
450 @item :count |
85710
beb909dfc54d
Rewrite abbrev.c in Elisp.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84116
diff
changeset
|
451 This property counts the number of times the abbrev has |
beb909dfc54d
Rewrite abbrev.c in Elisp.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84116
diff
changeset
|
452 been expanded. If not explicitly set, it is initialized to 0 by |
beb909dfc54d
Rewrite abbrev.c in Elisp.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84116
diff
changeset
|
453 @code{define-abbrev}. |
beb909dfc54d
Rewrite abbrev.c in Elisp.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84116
diff
changeset
|
454 |
85773
13ae285f009a
Rename `count' and `system-flag' to :count and :system. Update all users.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
85710
diff
changeset
|
455 @item :system |
103216
75e91d51c5f2
* abbrevs.texi (Abbrevs): Add xref to Creating Symbols when
Chong Yidong <cyd@stupidchicken.com>
parents:
101456
diff
changeset
|
456 If non-@code{nil}, this property marks the abbrev as a system abbrev. |
75e91d51c5f2
* abbrevs.texi (Abbrevs): Add xref to Creating Symbols when
Chong Yidong <cyd@stupidchicken.com>
parents:
101456
diff
changeset
|
457 Such abbrevs are not saved (@pxref{Abbrev Files}). |
85710
beb909dfc54d
Rewrite abbrev.c in Elisp.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84116
diff
changeset
|
458 |
beb909dfc54d
Rewrite abbrev.c in Elisp.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84116
diff
changeset
|
459 @item :enable-function |
85773
13ae285f009a
Rename `count' and `system-flag' to :count and :system. Update all users.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
85710
diff
changeset
|
460 If non-@code{nil}, this property should be a function of no |
85710
beb909dfc54d
Rewrite abbrev.c in Elisp.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84116
diff
changeset
|
461 arguments which returns @code{nil} if the abbrev should not be used |
beb909dfc54d
Rewrite abbrev.c in Elisp.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84116
diff
changeset
|
462 and @code{t} otherwise. |
beb909dfc54d
Rewrite abbrev.c in Elisp.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84116
diff
changeset
|
463 |
beb909dfc54d
Rewrite abbrev.c in Elisp.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84116
diff
changeset
|
464 @item :case-fixed |
beb909dfc54d
Rewrite abbrev.c in Elisp.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84116
diff
changeset
|
465 If non-@code{nil}, this property indicates that the case of the |
beb909dfc54d
Rewrite abbrev.c in Elisp.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84116
diff
changeset
|
466 abbrev's name is significant and should only match a text with the |
85773
13ae285f009a
Rename `count' and `system-flag' to :count and :system. Update all users.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
85710
diff
changeset
|
467 same pattern of capitalization. It also disables the code that |
13ae285f009a
Rename `count' and `system-flag' to :count and :system. Update all users.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
85710
diff
changeset
|
468 modifies the capitalization of the expansion. |
85710
beb909dfc54d
Rewrite abbrev.c in Elisp.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84116
diff
changeset
|
469 @end table |
beb909dfc54d
Rewrite abbrev.c in Elisp.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84116
diff
changeset
|
470 |
beb909dfc54d
Rewrite abbrev.c in Elisp.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84116
diff
changeset
|
471 @node Abbrev Table Properties, , Abbrev Properties, Abbrevs |
beb909dfc54d
Rewrite abbrev.c in Elisp.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84116
diff
changeset
|
472 @section Abbrev Table Properties |
beb909dfc54d
Rewrite abbrev.c in Elisp.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84116
diff
changeset
|
473 |
101456
133f2b03479e
* abbrevs.texi (Abbrev Table Properties): Fix typo.
Juanma Barranquero <lekktu@gmail.com>
parents:
100974
diff
changeset
|
474 Like abbrevs, abbrev tables have properties, some of which influence |
85773
13ae285f009a
Rename `count' and `system-flag' to :count and :system. Update all users.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
85710
diff
changeset
|
475 the way they work. You can provide them as arguments to |
13ae285f009a
Rename `count' and `system-flag' to :count and :system. Update all users.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
85710
diff
changeset
|
476 @code{define-abbrev-table} and you can manipulate them with the |
13ae285f009a
Rename `count' and `system-flag' to :count and :system. Update all users.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
85710
diff
changeset
|
477 functions: |
85710
beb909dfc54d
Rewrite abbrev.c in Elisp.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84116
diff
changeset
|
478 |
beb909dfc54d
Rewrite abbrev.c in Elisp.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84116
diff
changeset
|
479 @defun abbrev-table-put table prop val |
beb909dfc54d
Rewrite abbrev.c in Elisp.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84116
diff
changeset
|
480 Set the property @var{prop} of abbrev table @var{table} to value @var{val}. |
beb909dfc54d
Rewrite abbrev.c in Elisp.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84116
diff
changeset
|
481 @end defun |
beb909dfc54d
Rewrite abbrev.c in Elisp.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84116
diff
changeset
|
482 |
beb909dfc54d
Rewrite abbrev.c in Elisp.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84116
diff
changeset
|
483 @defun abbrev-table-get table prop |
beb909dfc54d
Rewrite abbrev.c in Elisp.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84116
diff
changeset
|
484 Return the property @var{prop} of abbrev table @var{table}, or @code{nil} |
beb909dfc54d
Rewrite abbrev.c in Elisp.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84116
diff
changeset
|
485 if the abbrev has no such property. |
beb909dfc54d
Rewrite abbrev.c in Elisp.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84116
diff
changeset
|
486 @end defun |
beb909dfc54d
Rewrite abbrev.c in Elisp.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84116
diff
changeset
|
487 |
beb909dfc54d
Rewrite abbrev.c in Elisp.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84116
diff
changeset
|
488 The following properties have special meaning: |
beb909dfc54d
Rewrite abbrev.c in Elisp.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84116
diff
changeset
|
489 |
beb909dfc54d
Rewrite abbrev.c in Elisp.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84116
diff
changeset
|
490 @table @code |
beb909dfc54d
Rewrite abbrev.c in Elisp.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84116
diff
changeset
|
491 @item :enable-function |
85773
13ae285f009a
Rename `count' and `system-flag' to :count and :system. Update all users.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
85710
diff
changeset
|
492 This is like the @code{:enable-function} abbrev property except that |
13ae285f009a
Rename `count' and `system-flag' to :count and :system. Update all users.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
85710
diff
changeset
|
493 it applies to all abbrevs in the table and is used even before trying |
13ae285f009a
Rename `count' and `system-flag' to :count and :system. Update all users.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
85710
diff
changeset
|
494 to find the abbrev before point so it can dynamically modify the |
13ae285f009a
Rename `count' and `system-flag' to :count and :system. Update all users.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
85710
diff
changeset
|
495 abbrev table. |
85710
beb909dfc54d
Rewrite abbrev.c in Elisp.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84116
diff
changeset
|
496 |
beb909dfc54d
Rewrite abbrev.c in Elisp.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84116
diff
changeset
|
497 @item :case-fixed |
85773
13ae285f009a
Rename `count' and `system-flag' to :count and :system. Update all users.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
85710
diff
changeset
|
498 This is like the @code{:case-fixed} abbrev property except that it |
13ae285f009a
Rename `count' and `system-flag' to :count and :system. Update all users.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
85710
diff
changeset
|
499 applies to all abbrevs in the table. |
85710
beb909dfc54d
Rewrite abbrev.c in Elisp.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84116
diff
changeset
|
500 |
beb909dfc54d
Rewrite abbrev.c in Elisp.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84116
diff
changeset
|
501 @item :regexp |
beb909dfc54d
Rewrite abbrev.c in Elisp.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84116
diff
changeset
|
502 If non-@code{nil}, this property is a regular expression that |
beb909dfc54d
Rewrite abbrev.c in Elisp.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84116
diff
changeset
|
503 indicates how to extract the name of the abbrev before point before |
beb909dfc54d
Rewrite abbrev.c in Elisp.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84116
diff
changeset
|
504 looking it up in the table. When the regular expression matches |
beb909dfc54d
Rewrite abbrev.c in Elisp.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84116
diff
changeset
|
505 before point, the abbrev name is expected to be in submatch 1. |
85773
13ae285f009a
Rename `count' and `system-flag' to :count and :system. Update all users.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
85710
diff
changeset
|
506 If this property is @code{nil}, @code{expand-function} defaults to |
85710
beb909dfc54d
Rewrite abbrev.c in Elisp.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84116
diff
changeset
|
507 @code{"\\<\\(\\w+\\)\\W"}. This property allows the use of abbrevs |
beb909dfc54d
Rewrite abbrev.c in Elisp.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84116
diff
changeset
|
508 whose name contains characters of non-word syntax. |
beb909dfc54d
Rewrite abbrev.c in Elisp.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84116
diff
changeset
|
509 |
beb909dfc54d
Rewrite abbrev.c in Elisp.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84116
diff
changeset
|
510 @item :parents |
beb909dfc54d
Rewrite abbrev.c in Elisp.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84116
diff
changeset
|
511 This property holds the list of tables from which to inherit |
beb909dfc54d
Rewrite abbrev.c in Elisp.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84116
diff
changeset
|
512 other abbrevs. |
beb909dfc54d
Rewrite abbrev.c in Elisp.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84116
diff
changeset
|
513 |
beb909dfc54d
Rewrite abbrev.c in Elisp.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84116
diff
changeset
|
514 @item :abbrev-table-modiff |
beb909dfc54d
Rewrite abbrev.c in Elisp.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84116
diff
changeset
|
515 This property holds a counter incremented each time a new abbrev is |
beb909dfc54d
Rewrite abbrev.c in Elisp.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84116
diff
changeset
|
516 added to the table. |
beb909dfc54d
Rewrite abbrev.c in Elisp.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84116
diff
changeset
|
517 |
beb909dfc54d
Rewrite abbrev.c in Elisp.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84116
diff
changeset
|
518 @end table |
beb909dfc54d
Rewrite abbrev.c in Elisp.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84116
diff
changeset
|
519 |
beb909dfc54d
Rewrite abbrev.c in Elisp.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84116
diff
changeset
|
520 |
84046 | 521 @ignore |
522 arch-tag: 5ffdbe08-2cd4-48ec-a5a8-080f95756eec | |
523 @end ignore |