view 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
line wrap: on
line source


@node Abbrevs, Picture, Running, Top
@chapter Abbrevs
@cindex abbrevs
@cindex expansion (of abbrevs)

  An @dfn{abbrev} is a word which @dfn{expands} into some
different text.  Abbrevs are defined by the user to expand in specific
ways.  For example, you might define @samp{foo} as an abbrev expanding to
@samp{find outer otter}.  With this abbrev defined, you would be able to
get @samp{find outer otter } into the buffer by typing @kbd{f o o @key{SPC}}.

@findex abbrev-mode
@vindex abbrev-mode
  Abbrevs expand only when Abbrev mode (a minor mode) is enabled.
Disabling Abbrev mode does not cause abbrev definitions to be discarded,
but they do not expand until Abbrev mode is enabled again.  The command
@kbd{M-x abbrev-mode} toggles Abbrev mode; with a numeric argument, it
turns Abbrev mode on if the argument is positive, off otherwise.
@xref{Minor Modes}.  @code{abbrev-mode} is also a variable; Abbrev mode is
on when the variable is non-@code{nil}.  The variable @code{abbrev-mode}
automatically becomes local to the current buffer when it is set.

  Abbrev definitions can be @dfn{mode-specific}---active only in one major
mode.  Abbrevs can also have @dfn{global} definitions that are active in
all major modes.  The same abbrev can have a global definition and various
mode-specific definitions for different major modes.  A mode-specific
definition for the current major mode overrides a global definition.

 You can define Abbrevs interactively during an editing session.  You
can also save lists of abbrev definitions in files and reload them in later
sessions.  Some users keep extensive lists of abbrevs that they load in
every session.

  A second kind of abbreviation facility is called the @dfn{dynamic
expansion}.  Dynamic abbrev expansion happens only when you give an
explicit command and the result of the expansion depends only on the
current contents of the buffer.  @xref{Dynamic Abbrevs}.

@menu
* Defining Abbrevs::  Defining an abbrev, so it will expand when typed.
* Expanding Abbrevs:: Controlling expansion: prefixes, canceling expansion.
* Editing Abbrevs::   Viewing or editing the entire list of defined abbrevs.
* Saving Abbrevs::    Saving the entire list of abbrevs for another session.
* Dynamic Abbrevs::   Abbreviations for words already in the buffer.
@end menu

@node Defining Abbrevs, Expanding Abbrevs, Abbrevs, Abbrevs
@section Defining Abbrevs

@table @kbd
@item C-x a g
Define an abbrev to expand into some text before point
(@code{add-global-abbrev}).
@item C-x a l
Similar, but define an abbrev available only in the current major mode
(@code{add-mode-abbrev}).
@item C-x a i g
Define a word in the buffer as an abbrev (@code{inverse-add-global-abbrev}).
@item C-x a i l
Define a word in the buffer as a mode-specific abbrev
(@code{inverse-add-mode-abbrev}).
@item M-x kill-all-abbrevs
After this command, no abbrev definitions remain in effect.
@end table

@kindex C-x a g
@findex add-global-abbrev
  The usual way to define an abbrev is to enter the text you want the
abbrev to expand to, position point after it, and type @kbd{C-x a g}
(@code{add-global-abbrev}).  This reads the abbrev itself using the
minibuffer, and then defines it as an abbrev for one or more words
before point.  Use a numeric argument to say how many words before point
should be taken as the expansion.  For example, to define the abbrev
@samp{foo} as in the example above, insert the text @samp{find outer
otter}, then type @*@kbd{C-u 3 C-x a g f o o @key{RET}}.

  An argument of zero to @kbd{C-x a g} means to use the contents of the
region as the expansion of the abbrev being defined.

@kindex C-x a l
@findex add-mode-abbrev
  The command @kbd{C-x a l} (@code{add-mode-abbrev}) is similar, but
defines a mode-specific abbrev.  Mode-specific abbrevs are active only in a
particular major mode.  @kbd{C-x a l} defines an abbrev for the major mode
in effect at the time @kbd{C-x a l} is typed.  The arguments work the
same way they do for @kbd{C-x a g}.

@kindex C-x a i g
@findex inverse-add-global-abbrev
@kindex C-x a i l
@findex inverse-add-mode-abbrev
  If the text of an abbrev you want is already in the buffer instead of
the expansion, use command @kbd{C-x a i g} (@code{inverse-add-global-abbrev})
instead of @kbd{C-x a g}, or use @kbd{C-x a i l}
(@code{inverse-add-mode-abbrev}) instead of @kbd{C-x a l}.  These commands
are called ``inverse'' because they invert the meaning of the argument
found in the buffer and the argument read using the minibuffer.@refill

  To change the definition of an abbrev, just add the new definition.  You
will be asked to confirm if the abbrev has a prior definition.  To remove
an abbrev definition, give a negative argument to @kbd{C-x a g} or @kbd{C-x
a l}.  You must choose the command to specify whether to kill a global
definition or a mode-specific definition for the current mode, since those
two definitions are independent for one abbrev.

@findex kill-all-abbrevs
  @kbd{M-x kill-all-abbrevs} removes all existing abbrev definitions.

@node Expanding Abbrevs, Editing Abbrevs, Defining Abbrevs, Abbrevs
@section Controlling Abbrev Expansion

  An abbrev expands whenever it is in a buffer just before point and you
type a self-inserting punctuation character (@key{SPC}, comma,
etc.@:).  Most often an abbrev is used by inserting the abbrev followed
by punctuation.

@vindex abbrev-all-caps
  Abbrev expansion preserves case; thus, @samp{foo} expands into @samp{find
outer otter}, @samp{Foo} into @samp{Find outer otter}, and @samp{FOO} into
@samp{FIND OUTER OTTER} or @samp{Find Outer Otter} according to the
variable @code{abbrev-all-caps} (a non-@code{nil} value chooses the first
of the two expansions).@refill

   Two commands are available to control abbrev expansion:

@table @kbd
@item M-'
Separate a prefix from a following abbrev to be expanded
(@code{abbrev-prefix-mark}).
@item C-x a e
@findex expand-abbrev
Expand the abbrev before point (@code{expand-abbrev}).
This is effective even when Abbrev mode is not enabled.
@item M-x unexpand-abbrev
Undo last abbrev expansion.
@item M-x expand-region-abbrevs
Expand some or all abbrevs found in the region.
@end table

@kindex M-'
@findex abbrev-prefix-mark
  You may wish to expand an abbrev with a prefix attached.  For example,
if @samp{cnst} expands into @samp{construction}, you may want to use it
to enter @samp{reconstruction}.  It does not work to type @kbd{recnst},
because that is not necessarily a defined abbrev.  Instead, you can use
the command @kbd{M-'} (@code{abbrev-prefix-mark}) between the prefix
@samp{re} and the abbrev @samp{cnst}.  First, insert @samp{re}.  Then
type @kbd{M-'}; this inserts a minus sign in the buffer to indicate that
it has done its work.  Then insert the abbrev @samp{cnst}.  The buffer
now contains @samp{re-cnst}.  Now insert a punctuation character to
expand the abbrev @samp{cnst} into @samp{construction}.  The minus sign
is deleted at this point by @kbd{M-'}.  The resulting text is the
desired @samp{reconstruction}.@refill

  If you actually want the text of the abbrev in the buffer, rather than
its expansion, insert the following punctuation with @kbd{C-q}.  Thus,
@kbd{foo C-q -} leaves @samp{foo-} in the buffer.

@findex unexpand-abbrev
  If you expand an abbrev by mistake, you can undo the expansion (replace
the expansion by the original abbrev text) with @kbd{M-x unexpand-abbrev}.
You can also use @kbd{C-_} (@code{undo}) to undo the expansion; but that
will first undo the insertion of the punctuation character.

@findex expand-region-abbrevs
  @kbd{M-x expand-region-abbrevs} searches through the region for defined
abbrevs, and  offers to replace each one it finds with its expansion.
This command is useful if you have typed text using abbrevs but forgot
to turn on Abbrev mode first.  It may also be useful together with a
special set of abbrev definitions for making several global replacements at
once.  The command is effective even if Abbrev mode is not enabled.

@node Editing Abbrevs, Saving Abbrevs, Expanding Abbrevs, Abbrevs
@section Examining and Editing Abbrevs

@table @kbd
@item M-x list-abbrevs
Print a list of all abbrev definitions.
@item M-x edit-abbrevs
Edit a list of abbrevs; you can add, alter, or remove definitions.
@end table

@findex list-abbrevs
  The output from @kbd{M-x list-abbrevs} looks like this:

@example
(lisp-mode-abbrev-table)
"dk"           0    "define-key"
(global-abbrev-table)
"dfn"          0    "definition"
@end example

@noindent
(Some blank lines of no semantic significance, and some other abbrev
tables, have been omitted.)

  A line containing a name in parentheses is the header for abbrevs in a
particular abbrev table; @code{global-abbrev-table} contains all the global
abbrevs, and the other abbrev tables that are named after major modes
contain the mode-specific abbrevs.

  Within each abbrev table, each non-blank line defines one abbrev.  The
word at the beginning is the abbrev.  The number that appears is the number
of times the abbrev has been expanded.  Emacs keeps track of this to help
you see which abbrevs you actually use, in case you want to eliminate
those that you don't use often.  The string at the end of the line is the
expansion.

@findex edit-abbrevs
@kindex C-c C-c (Edit Abbrevs)
@findex edit-abbrevs-redefine
  @kbd{M-x edit-abbrevs} allows you to add, change or kill abbrev
definitions by editing a list of them in an Emacs buffer.  The list has
the format described above.  The buffer of abbrevs is called
@samp{*Abbrevs*}, and is in Edit-Abbrevs mode.  This mode redefines the
key @kbd{C-c C-c} to install the abbrev definitions as specified in the
buffer.  The  @code{edit-abbrevs-redefine} command does this.
Any abbrevs not described in the buffer are eliminated when this is
done.

  @code{edit-abbrevs} is actually the same as @code{list-abbrevs}, except
that it selects the buffer @samp{*Abbrevs*} whereas @code{list-abbrevs}
merely displays it in another window.

@node Saving Abbrevs, Dynamic Abbrevs, Editing Abbrevs, Abbrevs
@section Saving Abbrevs

  These commands allow you to keep abbrev definitions between editing
sessions.

@table @kbd
@item M-x write-abbrev-file
Write a file describing all defined abbrevs.
@item M-x read-abbrev-file
Read such an abbrev file and define abbrevs as specified there.
@item M-x quietly-read-abbrev-file
Similar, but do not display a message about what is going on.
@item M-x define-abbrevs
Define abbrevs from buffer.
@item M-x insert-abbrevs
Insert all abbrevs and their expansions into the buffer.
@end table

@findex write-abbrev-file
  Use @kbd{M-x write-abbrev-file} to save abbrev definitions for use in
a later session.  The command reads a file name using the minibuffer and
writes a description of all current abbrev definitions into the
specified file.  The text stored in the file looks like the output of
@kbd{M-x list-abbrevs}.


@findex read-abbrev-file
@findex quietly-read-abbrev-file
@vindex abbrev-file-name
  @kbd{M-x read-abbrev-file} prompts for a file name using the
minibuffer and reads the specified file, defining abbrevs according to
its contents.  @kbd{M-x quietly-read-abbrev-file} is the same but does
not display a message in the echo area; it is actually useful primarily
in the init file.  @xref{Init File}. If you give an empty argument to
either of these functions, the file name Emacs uses is the value of the
variable @code{abbrev-file-name}, which is by default
@code{"~/.abbrev_defs"}.

@vindex save-abbrevs
  Emacs offers to save abbrevs automatically if you have changed any of
them, whenever it offers to save all files (for @kbd{C-x s} or @kbd{C-x
C-c}).  Set the variable @code{save-abbrevs} to @code{nil} to inhibit
this feature.

@findex insert-abbrevs
@findex define-abbrevs
  The commands @kbd{M-x insert-abbrevs} and @kbd{M-x define-abbrevs} are
similar to the previous commands but work on text in an Emacs buffer.
@kbd{M-x insert-abbrevs} inserts text into the current buffer before point,
describing all current abbrev definitions; @kbd{M-x define-abbrevs} parses
the entire current buffer and defines abbrevs accordingly.@refill

@node Dynamic Abbrevs,, Saving Abbrevs, Abbrevs
@section Dynamic Abbrev Expansion

  The abbrev facility described above operates automatically as you insert
text, but all abbrevs must be defined explicitly.  By contrast,
@dfn{dynamic abbrevs} allow the meanings of abbrevs to be determined
automatically from the contents of the buffer, but dynamic abbrev expansion
happens only when you request it explicitly.

@kindex M-/
@findex dabbrev-expand
@table @kbd
@item M-/
Expand the word in the buffer before point as a @dfn{dynamic abbrev},
by searching in the buffer for words starting with that abbreviation
(@code{dabbrev-expand}).
@end table

  For example, if the buffer contains @samp{does this follow } and you type
@kbd{f o M-/}, the effect is to insert @samp{follow} because that is the
last word in the buffer that starts with @samp{fo}.  A numeric argument to
@kbd{M-/} says to take the second, third, etc.@: distinct expansion found
looking backward from point.  Repeating @kbd{M-/} searches for an
alternative expansion by looking farther back.  After the entire buffer
before point has been considered, the buffer after point is searched.

  Dynamic abbrev expansion is completely independent of Abbrev mode; the
expansion of a word with @kbd{M-/} is completely independent of whether it
has a definition as an ordinary abbrev.