Mercurial > hg > xemacs-beta
annotate man/xemacs/abbrevs.texi @ 2367:ecf1ebac70d8
[xemacs-hg @ 2004-11-04 23:05:23 by ben]
commit mega-patch
configure.in: Turn off -Winline and -Wchar-subscripts.
Use the right set of cflags when compiling modules.
Rewrite ldap configuration to separate the inclusion of lber
(needed in recent Cygwin) from the basic checks for the
needed libraries.
add a function for MAKE_JUNK_C; initially code was added to
generate xemacs.def using this, but it will need to be rewritten.
add an rm -f for junk.c to avoid weird Cygwin bug with cp -f onto
an existing file.
Sort list of auto-detected functions and eliminate unused checks for
stpcpy, setlocale and getwd.
Add autodetection of Cygwin scanf problems
BETA: Rewrite section on configure to indicate what flags are important
and what not.
digest-doc.c, make-dump-id.c, profile.c, sorted-doc.c: Add proper decls for main().
make-msgfile.c: Document that this is old junk.
Move proposal to text.c.
make-msgfile.lex: Move proposal to text.c.
make-mswin-unicode.pl: Convert error-generating code so that the entire message will
be seen as a single unrecognized token.
mule/mule-ccl.el: Update docs.
lispref/mule.texi: Update CCL docs.
ldap/eldap.c: Mule-ize.
Use EXTERNAL_LIST_LOOP_2 instead of deleted EXTERNAL_LIST_LOOP.
* XEmacs 21.5.18 "chestnut" is released.
---------------------------------------------------------------
MULE-RELATED WORK:
---------------------------------------------------------------
---------------------------
byte-char conversion
---------------------------
buffer.c, buffer.h, insdel.c, text.c: Port FSF algorithm for byte-char conversion, replacing broken
previous version. Track the char position of the gap. Add
functions to do char-byte conversion downwards as well as upwards.
Move comments about algorithm workings to internals manual.
---------------------------
work on types
---------------------------
alloc.c, console-x-impl.h, dump-data.c, dump-data.h, dumper.c, dialog-msw.c, dired-msw.c, doc.c, editfns.c, esd.c, event-gtk.h, event-msw.c, events.c, file-coding.c, file-coding.h, fns.c, glyphs-eimage.c, glyphs-gtk.c, glyphs-msw.c, glyphs-shared.c, glyphs-x.c, glyphs.c, glyphs.h, gui.c, hpplay.c, imgproc.c, intl-win32.c, lrecord.h, lstream.c, keymap.c, lisp.h, libsst.c, linuxplay.c, miscplay.c, miscplay.h, mule-coding.c, nas.c, nt.c, ntheap.c, ntplay.c, objects-msw.c, objects-tty.c, objects-x.c, print.c, process-nt.c, process.c, redisplay.h, select-common.h, select-gtk.c, select-x.c, sgiplay.c, sound.c, sound.h, sunplay.c, sysfile.h, sysdep.c, syswindows.h, text.c, unexnt.c, win32.c, xgccache.c: Further work on types. This creates a full set of types for all
the basic semantics of `char' that I have so far identified, so that
its semantics can always be identified for the purposes of proper
Mule-safe code, and the raw use of `char' always avoided.
(1) More type renaming, for consistency of naming.
Char_ASCII -> Ascbyte
UChar_ASCII -> UAscbyte
Char_Binary -> CBinbyte
UChar_Binary -> Binbyte
SChar_Binary -> SBinbyte
(2) Introduce Rawbyte, CRawbyte, Boolbyte, Chbyte, UChbyte, and
Bitbyte and use them.
(3) New types Itext, Wexttext and Textcount for separating out
the concepts of bytes and textual units (different under UTF-16
and UTF-32, which are potential internal encodings).
(4) qxestr*_c -> qxestr*_ascii.
lisp.h: New; goes with other qxe() functions. #### Maybe goes in a
different section.
lisp.h: Group generic int-type defs together with EMACS_INT defs.
lisp.h: * lisp.h (WEXTTEXT_IS_WIDE)
New defns.
lisp.h: New type to replace places where int occurs as a boolean.
It's signed because occasionally people may want to use -1 as
an error value, and because unsigned ints are viral -- see comments
in the internals manual against using them.
dynarr.c: int -> Bytecount.
---------------------------
Mule-izing
---------------------------
device-x.c: Partially Mule-ize.
dumper.c, dumper.h: Mule-ize. Use Rawbyte. Use stderr_out not printf. Use wext_*().
sysdep.c, syswindows.h, text.c: New Wexttext API for manipulation of external text that may be
Unicode (e.g. startup code under Windows).
emacs.c: Mule-ize. Properly deal with argv in external encoding.
Use wext_*() and Wexttext. Use Rawbyte.
#if 0 some old junk on SCO that is unlikely to be correct.
Rewrite allocation code in run-temacs.
emacs.c, symsinit.h, win32.c: Rename win32 init function and call it even earlier, to
initialize mswindows_9x_p even earlier, for use in startup code
(XEUNICODE_P).
process.c: Use _wenviron not environ under Windows, to get Unicode environment
variables.
event-Xt.c: Mule-ize drag-n-drop related stuff.
dragdrop.c, dragdrop.h, frame-x.c: Mule-ize.
text.h: Add some more stand-in defines for particular kinds of conversion;
use in Mule-ization work in frame-x.c etc.
---------------------------
Freshening
---------------------------
intl-auto-encap-win32.c, intl-auto-encap-win32.h: Regenerate.
---------------------------
Unicode-work
---------------------------
intl-win32.c, syswindows.h: Factor out common options to MultiByteToWideChar and
WideCharToMultiByte. Add convert_unicode_to_multibyte_malloc()
and convert_unicode_to_multibyte_dynarr() and use. Add stuff for
alloca() conversion of multibyte/unicode.
alloc.c: Use dfc_external_data_len() in case of unicode coding system.
alloc.c, mule-charset.c: Don't zero out and reinit charset Unicode tables. This fucks up
dump-time loading. Anyway, either we load them at dump time or
run time, never both.
unicode.c: Dump the blank tables as well.
---------------------------------------------------------------
DOCUMENTATION, MOSTLY MULE-RELATED:
---------------------------------------------------------------
EmacsFrame.c, emodules.c, event-Xt.c, fileio.c, input-method-xlib.c, mule-wnnfns.c, redisplay-gtk.c, redisplay-tty.c, redisplay-x.c, regex.c, sysdep.c: Add comment about Mule work needed.
text.h: Add more documentation describing why DFC routines were not written
to return their value. Add some other DFC documentation.
console-msw.c, console-msw.h: Add pointer to docs in win32.c.
emacs.c: Add comments on sources of doc info.
text.c, charset.h, unicode.c, intl-win32.c, intl-encap-win32.c, text.h, file-coding.c, mule-coding.c: Collect background comments and related to text matters and
internationalization, and proposals for work to be done, in text.c
or Internals manual, stuff related to specific textual API's in
text.h, and stuff related to internal implementation of Unicode
conversion in unicode.c. Put lots of pointers to the comments to
make them easier to find.
s/mingw32.h, s/win32-common.h, s/win32-native.h, s/windowsnt.h, win32.c: Add bunches of new documentation on the different kinds of
builds and environments under Windows and how they work.
Collect this info in win32.c. Add pointers to these docs in
the relevant s/* files.
emacs.c: Document places with long comments.
Remove comment about exiting, move to internals manual, put
in pointer.
event-stream.c: Move docs about event queues and focus to internals manual, put
in pointer.
events.h: Move docs about event stream callbacks to internals manual, put
in pointer.
profile.c, redisplay.c, signal.c: Move documentation to the Internals manual.
process-nt.c: Add pointer to comment in win32-native.el.
lisp.h: Add comments about some comment conventions.
lisp.h: Add comment about the second argument.
device-msw.c, redisplay-msw.c: @@#### comments are out-of-date.
---------------------------------------------------------------
PDUMP WORK (MOTIVATED BY UNICODE CHANGES)
---------------------------------------------------------------
alloc.c, buffer.c, bytecode.c, console-impl.h, console.c, device.c, dumper.c, lrecord.h, elhash.c, emodules.h, events.c, extents.c, frame.c, glyphs.c, glyphs.h, mule-charset.c, mule-coding.c, objects.c, profile.c, rangetab.c, redisplay.c, specifier.c, specifier.h, window.c, lstream.c, file-coding.h, file-coding.c: PDUMP:
Properly implement dump_add_root_block(), which never worked before,
and is necessary for dumping Unicode tables.
Pdump name changes for accuracy:
XD_STRUCT_PTR -> XD_BLOCK_PTR.
XD_STRUCT_ARRAY -> XD_BLOCK_ARRAY.
XD_C_STRING -> XD_ASCII_STRING.
*_structure_* -> *_block_*.
lrecord.h: some comments added about
dump_add_root_block() vs dump_add_root_block_ptr().
extents.c: remove incorrect comment about pdump problems with gap array.
---------------------------------------------------------------
ALLOCATION
---------------------------------------------------------------
abbrev.c, alloc.c, bytecode.c, casefiddle.c, device-msw.c, device-x.c, dired-msw.c, doc.c, doprnt.c, dragdrop.c, editfns.c, emodules.c, file-coding.c, fileio.c, filelock.c, fns.c, glyphs-eimage.c, glyphs-gtk.c, glyphs-msw.c, glyphs-x.c, gui-msw.c, gui-x.c, imgproc.c, intl-win32.c, lread.c, menubar-gtk.c, menubar.c, nt.c, objects-msw.c, objects-x.c, print.c, process-nt.c, process-unix.c, process.c, realpath.c, redisplay.c, search.c, select-common.c, symbols.c, sysdep.c, syswindows.h, text.c, text.h, ui-byhand.c: New macros {alloca,xnew}_{itext,{i,ext,raw,bin,asc}bytes} for
more convenient allocation of these commonly requested items.
Modify functions to use alloca_ibytes, alloca_array, alloca_extbytes,
xnew_ibytes, etc. also XREALLOC_ARRAY, xnew.
alloc.c: Rewrite the allocation functions to factor out repeated code.
Add assertions for freeing dumped data.
lisp.h: Moved down and consolidated with other allocation stuff.
lisp.h, dynarr.c: New functions for allocation that's very efficient when mostly in
LIFO order.
lisp.h, text.c, text.h: Factor out some stuff for general use by alloca()-conversion funs.
text.h, lisp.h: Fill out convenience routines for allocating various kinds of
bytes and put them in lisp.h. Use them in place of xmalloc(),
ALLOCA().
text.h: Fill out the convenience functions so the _MALLOC() kinds match
the alloca() kinds.
---------------------------------------------------------------
ERROR-CHECKING
---------------------------------------------------------------
text.h: Create ASSERT_ASCTEXT_ASCII() and ASSERT_ASCTEXT_ASCII_LEN()
from similar Eistring checkers and change the Eistring checkers to
use them instead.
---------------------------------------------------------------
MACROS IN LISP.H
---------------------------------------------------------------
lisp.h: Redo GCPRO declarations. Create a "base" set of functions that can
be used to generate any kind of gcpro sets -- regular, ngcpro,
nngcpro, private ones used in GC_EXTERNAL_LIST_LOOP_2.
buffer.c, callint.c, chartab.c, console-msw.c, device-x.c, dialog-msw.c, dired.c, extents.c, ui-gtk.c, rangetab.c, nt.c, mule-coding.c, minibuf.c, menubar-msw.c, menubar.c, menubar-gtk.c, lread.c, lisp.h, gutter.c, glyphs.c, glyphs-widget.c, fns.c, fileio.c, file-coding.c, specifier.c: Eliminate EXTERNAL_LIST_LOOP, which does not check for circularities.
Use EXTERNAL_LIST_LOOP_2 instead or EXTERNAL_LIST_LOOP_3
or EXTERNAL_PROPERTY_LIST_LOOP_3 or GC_EXTERNAL_LIST_LOOP_2
(new macro). Removed/redid comments on EXTERNAL_LIST_LOOP.
---------------------------------------------------------------
SPACING FIXES
---------------------------------------------------------------
callint.c, hftctl.c, number-gmp.c, process-unix.c: Spacing fixes.
---------------------------------------------------------------
FIX FOR GEOMETRY PROBLEM IN FIRST FRAME
---------------------------------------------------------------
unicode.c: Add workaround for newlib bug in sscanf() [should be fixed by
release 1.5.12 of Cygwin].
toolbar.c: bug fix for problem of initial frame being 77 chars wide on Windows.
will be overridden by my other ws.
---------------------------------------------------------------
FIX FOR LEAKING PROCESS HANDLES:
---------------------------------------------------------------
process-nt.c: Fixes for leaking handles. Inspired by work done by Adrian Aichner
<adrian@xemacs.org>.
---------------------------------------------------------------
FIX FOR CYGWIN BUG (Unicode-related):
---------------------------------------------------------------
unicode.c: Add workaround for newlib bug in sscanf() [should be fixed by
release 1.5.12 of Cygwin].
---------------------------------------------------------------
WARNING FIXES:
---------------------------------------------------------------
console-stream.c: `reinit' is unused.
compiler.h, event-msw.c, frame-msw.c, intl-encap-win32.c, text.h: Add stuff to deal with ANSI-aliasing warnings I got.
regex.c: Gather includes together to avoid warning.
---------------------------------------------------------------
CHANGES TO INITIALIZATION ROUTINES:
---------------------------------------------------------------
buffer.c, emacs.c, console.c, debug.c, device-x.c, device.c, dragdrop.c, emodules.c, eval.c, event-Xt.c, event-gtk.c, event-msw.c, event-stream.c, event-tty.c, events.c, extents.c, faces.c, file-coding.c, fileio.c, font-lock.c, frame-msw.c, glyphs-widget.c, glyphs.c, gui-x.c, insdel.c, lread.c, lstream.c, menubar-gtk.c, menubar-x.c, minibuf.c, mule-wnnfns.c, objects-msw.c, objects.c, print.c, scrollbar-x.c, search.c, select-x.c, text.c, undo.c, unicode.c, window.c, symsinit.h: Call reinit_*() functions directly from emacs.c, for clarity.
Factor out some redundant init code. Move disallowed stuff
that had crept into vars_of_glyphs() into complex_vars_of_glyphs().
Call init_eval_semi_early() from eval.c not in the middle of
vars_of_() in emacs.c since there should be no order dependency
in the latter calls.
---------------------------------------------------------------
ARMAGEDDON:
---------------------------------------------------------------
alloc.c, emacs.c, lisp.h, print.c: Rename inhibit_non_essential_printing_operations to
inhibit_non_essential_conversion_operations.
text.c: Assert on !inhibit_non_essential_conversion_operations.
console-msw.c, print.c: Don't do conversion in SetConsoleTitle or FindWindow to avoid
problems during armageddon. Put #errors for NON_ASCII_INTERNAL_FORMAT
in places where problems would arise.
---------------------------------------------------------------
CHANGES TO THE BUILD PROCEDURE:
---------------------------------------------------------------
config.h.in, s/cxux.h, s/usg5-4-2.h, m/powerpc.h: Add comment about correct ordering of this file.
Rearrange everything to follow this -- put all #undefs together
and before the s&m files. Add undefs for HAVE_ALLOCA, C_ALLOCA,
BROKEN_ALLOCA_IN_FUNCTION_CALLS, STACK_DIRECTION. Remove unused
HAVE_STPCPY, HAVE_GETWD, HAVE_SETLOCALE.
m/gec63.h: Deleted; totally broken, not used at all, not in FSF.
m/7300.h, m/acorn.h, m/alliant-2800.h, m/alliant.h, m/altos.h, m/amdahl.h, m/apollo.h, m/att3b.h, m/aviion.h, m/celerity.h, m/clipper.h, m/cnvrgnt.h, m/convex.h, m/cydra5.h, m/delta.h, m/delta88k.h, m/dpx2.h, m/elxsi.h, m/ews4800r.h, m/gould.h, m/hp300bsd.h, m/hp800.h, m/hp9000s300.h, m/i860.h, m/ibmps2-aix.h, m/ibmrs6000.h, m/ibmrt-aix.h, m/ibmrt.h, m/intel386.h, m/iris4d.h, m/iris5d.h, m/iris6d.h, m/irist.h, m/isi-ov.h, m/luna88k.h, m/m68k.h, m/masscomp.h, m/mg1.h, m/mips-nec.h, m/mips-siemens.h, m/mips.h, m/news.h, m/nh3000.h, m/nh4000.h, m/ns32000.h, m/orion105.h, m/pfa50.h, m/plexus.h, m/pmax.h, m/powerpc.h, m/pyrmips.h, m/sequent-ptx.h, m/sequent.h, m/sgi-challenge.h, m/symmetry.h, m/tad68k.h, m/tahoe.h, m/targon31.h, m/tekxd88.h, m/template.h, m/tower32.h, m/tower32v3.h, m/ustation.h, m/vax.h, m/wicat.h, m/xps100.h: Delete C_ALLOCA, HAVE_ALLOCA, STACK_DIRECTION,
BROKEN_ALLOCA_IN_FUNCTION_CALLS. All of this is auto-detected.
When in doubt, I followed recent FSF sources, which also have
these things deleted.
author | ben |
---|---|
date | Thu, 04 Nov 2004 23:08:28 +0000 |
parents | 576fb035e263 |
children |
rev | line source |
---|---|
428 | 1 |
444 | 2 @node Abbrevs, Picture, Running, Top |
428 | 3 @chapter Abbrevs |
4 @cindex abbrevs | |
5 @cindex expansion (of abbrevs) | |
6 | |
7 An @dfn{abbrev} is a word which @dfn{expands} into some | |
8 different text. Abbrevs are defined by the user to expand in specific | |
9 ways. For example, you might define @samp{foo} as an abbrev expanding to | |
10 @samp{find outer otter}. With this abbrev defined, you would be able to | |
11 get @samp{find outer otter } into the buffer by typing @kbd{f o o @key{SPC}}. | |
12 | |
13 @findex abbrev-mode | |
14 @vindex abbrev-mode | |
15 Abbrevs expand only when Abbrev mode (a minor mode) is enabled. | |
16 Disabling Abbrev mode does not cause abbrev definitions to be discarded, | |
17 but they do not expand until Abbrev mode is enabled again. The command | |
18 @kbd{M-x abbrev-mode} toggles Abbrev mode; with a numeric argument, it | |
19 turns Abbrev mode on if the argument is positive, off otherwise. | |
20 @xref{Minor Modes}. @code{abbrev-mode} is also a variable; Abbrev mode is | |
21 on when the variable is non-@code{nil}. The variable @code{abbrev-mode} | |
22 automatically becomes local to the current buffer when it is set. | |
23 | |
24 Abbrev definitions can be @dfn{mode-specific}---active only in one major | |
25 mode. Abbrevs can also have @dfn{global} definitions that are active in | |
26 all major modes. The same abbrev can have a global definition and various | |
27 mode-specific definitions for different major modes. A mode-specific | |
28 definition for the current major mode overrides a global definition. | |
29 | |
30 You can define Abbrevs interactively during an editing session. You | |
31 can also save lists of abbrev definitions in files and reload them in later | |
32 sessions. Some users keep extensive lists of abbrevs that they load in | |
33 every session. | |
34 | |
35 A second kind of abbreviation facility is called the @dfn{dynamic | |
36 expansion}. Dynamic abbrev expansion happens only when you give an | |
37 explicit command and the result of the expansion depends only on the | |
38 current contents of the buffer. @xref{Dynamic Abbrevs}. | |
39 | |
40 @menu | |
41 * Defining Abbrevs:: Defining an abbrev, so it will expand when typed. | |
42 * Expanding Abbrevs:: Controlling expansion: prefixes, canceling expansion. | |
43 * Editing Abbrevs:: Viewing or editing the entire list of defined abbrevs. | |
44 * Saving Abbrevs:: Saving the entire list of abbrevs for another session. | |
45 * Dynamic Abbrevs:: Abbreviations for words already in the buffer. | |
46 @end menu | |
47 | |
48 @node Defining Abbrevs, Expanding Abbrevs, Abbrevs, Abbrevs | |
49 @section Defining Abbrevs | |
50 | |
51 @table @kbd | |
52 @item C-x a g | |
53 Define an abbrev to expand into some text before point | |
54 (@code{add-global-abbrev}). | |
55 @item C-x a l | |
56 Similar, but define an abbrev available only in the current major mode | |
57 (@code{add-mode-abbrev}). | |
58 @item C-x a i g | |
59 Define a word in the buffer as an abbrev (@code{inverse-add-global-abbrev}). | |
60 @item C-x a i l | |
61 Define a word in the buffer as a mode-specific abbrev | |
62 (@code{inverse-add-mode-abbrev}). | |
63 @item M-x kill-all-abbrevs | |
64 After this command, no abbrev definitions remain in effect. | |
65 @end table | |
66 | |
67 @kindex C-x a g | |
68 @findex add-global-abbrev | |
69 The usual way to define an abbrev is to enter the text you want the | |
70 abbrev to expand to, position point after it, and type @kbd{C-x a g} | |
71 (@code{add-global-abbrev}). This reads the abbrev itself using the | |
72 minibuffer, and then defines it as an abbrev for one or more words | |
73 before point. Use a numeric argument to say how many words before point | |
74 should be taken as the expansion. For example, to define the abbrev | |
75 @samp{foo} as in the example above, insert the text @samp{find outer | |
76 otter}, then type @*@kbd{C-u 3 C-x a g f o o @key{RET}}. | |
77 | |
78 An argument of zero to @kbd{C-x a g} means to use the contents of the | |
79 region as the expansion of the abbrev being defined. | |
80 | |
81 @kindex C-x a l | |
82 @findex add-mode-abbrev | |
83 The command @kbd{C-x a l} (@code{add-mode-abbrev}) is similar, but | |
84 defines a mode-specific abbrev. Mode-specific abbrevs are active only in a | |
85 particular major mode. @kbd{C-x a l} defines an abbrev for the major mode | |
86 in effect at the time @kbd{C-x a l} is typed. The arguments work the | |
87 same way they do for @kbd{C-x a g}. | |
88 | |
89 @kindex C-x a i g | |
90 @findex inverse-add-global-abbrev | |
91 @kindex C-x a i l | |
92 @findex inverse-add-mode-abbrev | |
93 If the text of an abbrev you want is already in the buffer instead of | |
94 the expansion, use command @kbd{C-x a i g} (@code{inverse-add-global-abbrev}) | |
95 instead of @kbd{C-x a g}, or use @kbd{C-x a i l} | |
96 (@code{inverse-add-mode-abbrev}) instead of @kbd{C-x a l}. These commands | |
97 are called ``inverse'' because they invert the meaning of the argument | |
98 found in the buffer and the argument read using the minibuffer.@refill | |
99 | |
100 To change the definition of an abbrev, just add the new definition. You | |
101 will be asked to confirm if the abbrev has a prior definition. To remove | |
102 an abbrev definition, give a negative argument to @kbd{C-x a g} or @kbd{C-x | |
103 a l}. You must choose the command to specify whether to kill a global | |
104 definition or a mode-specific definition for the current mode, since those | |
105 two definitions are independent for one abbrev. | |
106 | |
107 @findex kill-all-abbrevs | |
108 @kbd{M-x kill-all-abbrevs} removes all existing abbrev definitions. | |
109 | |
110 @node Expanding Abbrevs, Editing Abbrevs, Defining Abbrevs, Abbrevs | |
111 @section Controlling Abbrev Expansion | |
112 | |
113 An abbrev expands whenever it is in a buffer just before point and you | |
114 type a self-inserting punctuation character (@key{SPC}, comma, | |
115 etc.@:). Most often an abbrev is used by inserting the abbrev followed | |
116 by punctuation. | |
117 | |
118 @vindex abbrev-all-caps | |
119 Abbrev expansion preserves case; thus, @samp{foo} expands into @samp{find | |
120 outer otter}, @samp{Foo} into @samp{Find outer otter}, and @samp{FOO} into | |
121 @samp{FIND OUTER OTTER} or @samp{Find Outer Otter} according to the | |
122 variable @code{abbrev-all-caps} (a non-@code{nil} value chooses the first | |
123 of the two expansions).@refill | |
124 | |
125 Two commands are available to control abbrev expansion: | |
126 | |
127 @table @kbd | |
128 @item M-' | |
129 Separate a prefix from a following abbrev to be expanded | |
130 (@code{abbrev-prefix-mark}). | |
131 @item C-x a e | |
132 @findex expand-abbrev | |
133 Expand the abbrev before point (@code{expand-abbrev}). | |
134 This is effective even when Abbrev mode is not enabled. | |
135 @item M-x unexpand-abbrev | |
136 Undo last abbrev expansion. | |
137 @item M-x expand-region-abbrevs | |
138 Expand some or all abbrevs found in the region. | |
139 @end table | |
140 | |
141 @kindex M-' | |
142 @findex abbrev-prefix-mark | |
143 You may wish to expand an abbrev with a prefix attached. For example, | |
144 if @samp{cnst} expands into @samp{construction}, you may want to use it | |
145 to enter @samp{reconstruction}. It does not work to type @kbd{recnst}, | |
146 because that is not necessarily a defined abbrev. Instead, you can use | |
147 the command @kbd{M-'} (@code{abbrev-prefix-mark}) between the prefix | |
148 @samp{re} and the abbrev @samp{cnst}. First, insert @samp{re}. Then | |
149 type @kbd{M-'}; this inserts a minus sign in the buffer to indicate that | |
150 it has done its work. Then insert the abbrev @samp{cnst}. The buffer | |
151 now contains @samp{re-cnst}. Now insert a punctuation character to | |
152 expand the abbrev @samp{cnst} into @samp{construction}. The minus sign | |
153 is deleted at this point by @kbd{M-'}. The resulting text is the | |
154 desired @samp{reconstruction}.@refill | |
155 | |
156 If you actually want the text of the abbrev in the buffer, rather than | |
157 its expansion, insert the following punctuation with @kbd{C-q}. Thus, | |
158 @kbd{foo C-q -} leaves @samp{foo-} in the buffer. | |
159 | |
160 @findex unexpand-abbrev | |
161 If you expand an abbrev by mistake, you can undo the expansion (replace | |
162 the expansion by the original abbrev text) with @kbd{M-x unexpand-abbrev}. | |
163 You can also use @kbd{C-_} (@code{undo}) to undo the expansion; but that | |
164 will first undo the insertion of the punctuation character. | |
165 | |
166 @findex expand-region-abbrevs | |
167 @kbd{M-x expand-region-abbrevs} searches through the region for defined | |
168 abbrevs, and offers to replace each one it finds with its expansion. | |
169 This command is useful if you have typed text using abbrevs but forgot | |
170 to turn on Abbrev mode first. It may also be useful together with a | |
171 special set of abbrev definitions for making several global replacements at | |
172 once. The command is effective even if Abbrev mode is not enabled. | |
173 | |
174 @node Editing Abbrevs, Saving Abbrevs, Expanding Abbrevs, Abbrevs | |
175 @section Examining and Editing Abbrevs | |
176 | |
177 @table @kbd | |
178 @item M-x list-abbrevs | |
179 Print a list of all abbrev definitions. | |
180 @item M-x edit-abbrevs | |
181 Edit a list of abbrevs; you can add, alter, or remove definitions. | |
182 @end table | |
183 | |
184 @findex list-abbrevs | |
185 The output from @kbd{M-x list-abbrevs} looks like this: | |
186 | |
187 @example | |
188 (lisp-mode-abbrev-table) | |
440 | 189 "dk" 0 "define-key" |
428 | 190 (global-abbrev-table) |
440 | 191 "dfn" 0 "definition" |
428 | 192 @end example |
193 | |
194 @noindent | |
195 (Some blank lines of no semantic significance, and some other abbrev | |
196 tables, have been omitted.) | |
197 | |
198 A line containing a name in parentheses is the header for abbrevs in a | |
199 particular abbrev table; @code{global-abbrev-table} contains all the global | |
200 abbrevs, and the other abbrev tables that are named after major modes | |
201 contain the mode-specific abbrevs. | |
202 | |
203 Within each abbrev table, each non-blank line defines one abbrev. The | |
204 word at the beginning is the abbrev. The number that appears is the number | |
205 of times the abbrev has been expanded. Emacs keeps track of this to help | |
206 you see which abbrevs you actually use, in case you want to eliminate | |
207 those that you don't use often. The string at the end of the line is the | |
208 expansion. | |
209 | |
210 @findex edit-abbrevs | |
211 @kindex C-c C-c (Edit Abbrevs) | |
212 @findex edit-abbrevs-redefine | |
213 @kbd{M-x edit-abbrevs} allows you to add, change or kill abbrev | |
214 definitions by editing a list of them in an Emacs buffer. The list has | |
215 the format described above. The buffer of abbrevs is called | |
216 @samp{*Abbrevs*}, and is in Edit-Abbrevs mode. This mode redefines the | |
217 key @kbd{C-c C-c} to install the abbrev definitions as specified in the | |
218 buffer. The @code{edit-abbrevs-redefine} command does this. | |
219 Any abbrevs not described in the buffer are eliminated when this is | |
220 done. | |
221 | |
222 @code{edit-abbrevs} is actually the same as @code{list-abbrevs}, except | |
223 that it selects the buffer @samp{*Abbrevs*} whereas @code{list-abbrevs} | |
224 merely displays it in another window. | |
225 | |
226 @node Saving Abbrevs, Dynamic Abbrevs, Editing Abbrevs, Abbrevs | |
227 @section Saving Abbrevs | |
228 | |
229 These commands allow you to keep abbrev definitions between editing | |
230 sessions. | |
231 | |
232 @table @kbd | |
233 @item M-x write-abbrev-file | |
234 Write a file describing all defined abbrevs. | |
235 @item M-x read-abbrev-file | |
236 Read such an abbrev file and define abbrevs as specified there. | |
237 @item M-x quietly-read-abbrev-file | |
238 Similar, but do not display a message about what is going on. | |
239 @item M-x define-abbrevs | |
240 Define abbrevs from buffer. | |
241 @item M-x insert-abbrevs | |
242 Insert all abbrevs and their expansions into the buffer. | |
243 @end table | |
244 | |
245 @findex write-abbrev-file | |
246 Use @kbd{M-x write-abbrev-file} to save abbrev definitions for use in | |
247 a later session. The command reads a file name using the minibuffer and | |
248 writes a description of all current abbrev definitions into the | |
249 specified file. The text stored in the file looks like the output of | |
250 @kbd{M-x list-abbrevs}. | |
251 | |
252 | |
253 @findex read-abbrev-file | |
254 @findex quietly-read-abbrev-file | |
255 @vindex abbrev-file-name | |
256 @kbd{M-x read-abbrev-file} prompts for a file name using the | |
257 minibuffer and reads the specified file, defining abbrevs according to | |
258 its contents. @kbd{M-x quietly-read-abbrev-file} is the same but does | |
259 not display a message in the echo area; it is actually useful primarily | |
442 | 260 in the init file. @xref{Init File}. If you give an empty argument to |
261 either of these functions, the file name Emacs uses is the value of the | |
262 variable @code{abbrev-file-name}, which is by default | |
263 @code{"~/.abbrev_defs"}. | |
428 | 264 |
265 @vindex save-abbrevs | |
266 Emacs offers to save abbrevs automatically if you have changed any of | |
267 them, whenever it offers to save all files (for @kbd{C-x s} or @kbd{C-x | |
268 C-c}). Set the variable @code{save-abbrevs} to @code{nil} to inhibit | |
269 this feature. | |
270 | |
271 @findex insert-abbrevs | |
272 @findex define-abbrevs | |
273 The commands @kbd{M-x insert-abbrevs} and @kbd{M-x define-abbrevs} are | |
274 similar to the previous commands but work on text in an Emacs buffer. | |
275 @kbd{M-x insert-abbrevs} inserts text into the current buffer before point, | |
276 describing all current abbrev definitions; @kbd{M-x define-abbrevs} parses | |
277 the entire current buffer and defines abbrevs accordingly.@refill | |
278 | |
279 @node Dynamic Abbrevs,, Saving Abbrevs, Abbrevs | |
280 @section Dynamic Abbrev Expansion | |
281 | |
282 The abbrev facility described above operates automatically as you insert | |
283 text, but all abbrevs must be defined explicitly. By contrast, | |
284 @dfn{dynamic abbrevs} allow the meanings of abbrevs to be determined | |
285 automatically from the contents of the buffer, but dynamic abbrev expansion | |
286 happens only when you request it explicitly. | |
287 | |
288 @kindex M-/ | |
289 @findex dabbrev-expand | |
290 @table @kbd | |
291 @item M-/ | |
292 Expand the word in the buffer before point as a @dfn{dynamic abbrev}, | |
293 by searching in the buffer for words starting with that abbreviation | |
294 (@code{dabbrev-expand}). | |
295 @end table | |
296 | |
297 For example, if the buffer contains @samp{does this follow } and you type | |
298 @kbd{f o M-/}, the effect is to insert @samp{follow} because that is the | |
299 last word in the buffer that starts with @samp{fo}. A numeric argument to | |
300 @kbd{M-/} says to take the second, third, etc.@: distinct expansion found | |
301 looking backward from point. Repeating @kbd{M-/} searches for an | |
302 alternative expansion by looking farther back. After the entire buffer | |
303 before point has been considered, the buffer after point is searched. | |
304 | |
305 Dynamic abbrev expansion is completely independent of Abbrev mode; the | |
306 expansion of a word with @kbd{M-/} is completely independent of whether it | |
307 has a definition as an ordinary abbrev. |