]> code.delx.au - gnu-emacs/blobdiff - lispref/abbrevs.texi
(syms_of_coding): Doc fix for inhibit-eol-conversion.
[gnu-emacs] / lispref / abbrevs.texi
index 59e1995a4d58b1504ef2b0560e3d4ee19231d078..674082b6289da966776fdf4983196ce46827d5c9 100644 (file)
@@ -19,15 +19,15 @@ in the same major mode share one abbrev table.  There is also a global
 abbrev table.  Normally both are used.
 
   An abbrev table is represented as an obarray containing a symbol for
-each abbreviation.  The symbol's name is the abbreviation.  Its value is
+each abbreviation.  The symbol's name is the abbreviation; its value is
 the expansion; its function definition is the hook function to do the
-expansion (if any); its property list cell contains the use count, the
-number of times the abbreviation has been expanded.  Because these
-symbols are not interned in the usual obarray, they will never appear as
-the result of reading a Lisp expression; in fact, normally they are
-never used except by the code that handles abbrevs.  Therefore, it is
-safe to use them in an extremely nonstandard way.  @xref{Creating
-Symbols}.
+expansion (@pxref{Defining Abbrevs}); its property list cell contains
+the use count, the number of times the abbreviation has been expanded.
+Because these symbols are not interned in the usual obarray, they will
+never appear as the result of reading a Lisp expression; in fact,
+normally they are never used except by the code that handles abbrevs.
+Therefore, it is safe to use them in an extremely nonstandard way.
+@xref{Creating Symbols}.
 
   For the user-level commands for abbrevs, see @ref{Abbrevs,, Abbrev
 Mode, emacs, The GNU Emacs Manual}.
@@ -54,11 +54,11 @@ of abbrevs when their abbreviations are inserted into a buffer.
 If the value is @code{nil}, abbrevs may be defined, but they are not
 expanded automatically.
 
-This variable automatically becomes local when set in any fashion.
+This variable automatically becomes buffer-local when set in any fashion.
 @end defvar
 
 @defvar default-abbrev-mode
-This is the value @code{abbrev-mode} for buffers that do not override it.
+This is the value of @code{abbrev-mode} for buffers that do not override it.
 This is the same as @code{(default-value 'abbrev-mode)}.
 @end defvar
 
@@ -82,7 +82,7 @@ This function defines @var{tabname} (a symbol) as an abbrev table name,
 i.e., as a variable whose value is an abbrev table.  It defines abbrevs
 in the table according to @var{definitions}, a list of elements of the
 form @code{(@var{abbrevname} @var{expansion} @var{hook}
-@var{usecount})}.  The value is always @code{nil}.
+@var{usecount})}.  The return value is always @code{nil}.
 @end defun
 
 @defvar abbrev-table-name-list
@@ -93,11 +93,11 @@ This is a list of symbols whose values are abbrev tables.
 @defun insert-abbrev-table-description name &optional human
 This function inserts before point a description of the abbrev table
 named @var{name}.  The argument @var{name} is a symbol whose value is an
-abbrev table.  The value is always @code{nil}.
+abbrev table.  The return value is always @code{nil}.
 
 If @var{human} is non-@code{nil}, the description is human-oriented.
 Otherwise the description is a Lisp expression---a call to
-@code{define-abbrev-table} which would define @var{name} exactly as it
+@code{define-abbrev-table} that would define @var{name} exactly as it
 is currently defined.
 @end defun
 
@@ -111,31 +111,33 @@ is currently defined.
 user.
 
 @defun add-abbrev table type arg
-This function adds an abbreviation to abbrev table @var{table}.  The
-argument @var{type} is a string describing in English the kind of abbrev
-this will be (typically, @code{"global"} or @code{"mode-specific"});
-this is used in prompting the user.  The argument @var{arg} is the
-number of words in the expansion.
+This function adds an abbreviation to abbrev table @var{table} based on
+information from the user.  The argument @var{type} is a string
+describing in English the kind of abbrev this will be (typically,
+@code{"global"} or @code{"mode-specific"}); this is used in prompting
+the user.  The argument @var{arg} is the number of words in the
+expansion.
 
-The return value is the symbol which internally represents the new
+The return value is the symbol that internally represents the new
 abbrev, or @code{nil} if the user declines to confirm redefining an
 existing abbrev.
 @end defun
 
 @defun define-abbrev table name expansion hook
-This function defines an abbrev in @var{table} named @var{name}, to
-expand to @var{expansion}, and call @var{hook}.  The return value is an
-uninterned symbol which represents the abbrev inside Emacs; its name is
-@var{name}.
+This function defines an abbrev named @var{name}, in @var{table}, to
+expand to @var{expansion} and call @var{hook}.  The return value is a
+symbol that represents the abbrev inside Emacs; its name is @var{name}.
 
 The argument @var{name} should be a string.  The argument
-@var{expansion} should be a string, or @code{nil}, to undefine the
-abbrev.
+@var{expansion} is normally the desired expansion (a string), or
+@code{nil} to undefine the abbrev.  If it is anything but a string or
+@code{nil}, then the abbreviation ``expands'' solely by running
+@var{hook}.
 
 The argument @var{hook} is a function or @code{nil}.  If @var{hook} is
 non-@code{nil}, then it is called with no arguments after the abbrev is
 replaced with @var{expansion}; point is located at the end of
-@var{expansion}.
+@var{expansion} when @var{hook} is called.
 
 The use count of the abbrev is initialized to zero.
 @end defun
@@ -144,7 +146,7 @@ The use count of the abbrev is initialized to zero.
 If this variable is non-@code{nil}, it means that the user plans to use
 global abbrevs only.  This tells the commands that define mode-specific
 abbrevs to define global ones instead.  This variable does not alter the
-functioning of the functions in this section; it is examined by their
+behavior of the functions in this section; it is examined by their
 callers.
 @end defopt
 
@@ -189,7 +191,7 @@ save your abbrevs.
 
 @deffn Command write-abbrev-file filename
 Save all abbrev definitions, in all abbrev tables, in the file
-@var{filename}, in the form of a Lisp program which when loaded will
+@var{filename}, in the form of a Lisp program that when loaded will
 define the same abbrevs.  This function returns @code{nil}.
 @end deffn
 
@@ -197,10 +199,10 @@ define the same abbrevs.  This function returns @code{nil}.
 @comment  node-name,  next,  previous,  up
 @section Looking Up and Expanding Abbreviations
 
-  Abbrevs are usually expanded by commands for interactive use,
+  Abbrevs are usually expanded by certain interactive commands,
 including @code{self-insert-command}.  This section describes the
-subroutines used in writing such functions, as well as the variables
-they use for communication.
+subroutines used in writing such commands, as well as the variables they
+use for communication.
 
 @defun abbrev-symbol abbrev &optional table
 This function returns the symbol representing the abbrev named
@@ -211,6 +213,26 @@ first the current buffer's local abbrev table, and second the global
 abbrev table.
 @end defun
 
+@defun abbrev-expansion abbrev &optional table
+This function returns the string that @var{abbrev} would expand into (as
+defined by the abbrev tables used for the current buffer).  The optional
+argument @var{table} specifies the abbrev table to use, as in
+@code{abbrev-symbol}.
+@end defun
+
+@deffn Command expand-abbrev
+This command expands the abbrev before point, if any.
+If point does not follow an abbrev, this command does nothing.
+The command returns @code{t} if it did expansion, @code{nil} otherwise.
+@end deffn
+
+@deffn Command abbrev-prefix-mark &optional arg
+Mark current point as the beginning of an abbrev.  The next call to
+@code{expand-abbrev} will use the text from here to point (where it is
+then) as the abbrev to expand, rather than using the previous word as
+usual.
+@end deffn
+
 @defopt abbrev-all-caps
 When this is set non-@code{nil}, an abbrev entered entirely in upper
 case is expanded using all upper case.  Otherwise, an abbrev entered
@@ -218,13 +240,6 @@ entirely in upper case is expanded by capitalizing each word of the
 expansion.
 @end defopt
 
-@defun abbrev-expansion abbrev &optional table
-This function returns the string that @var{abbrev} would expand into (as
-defined by the abbrev tables used for the current buffer).  The optional
-argument @var{table} specifies the abbrev table to use; if it is
-specified, the abbrev is looked up in that table only.
-@end defun
-
 @defvar abbrev-start-location
 This is the buffer position for @code{expand-abbrev} to use as the start
 of the next abbrev to be expanded.  (@code{nil} means use the word
@@ -241,23 +256,23 @@ is set by @code{abbrev-prefix-mark}.
 @end defvar
 
 @defvar last-abbrev
-This is the @code{abbrev-symbol} of the last abbrev expanded.  This
+This is the @code{abbrev-symbol} of the most recent abbrev expanded.  This
 information is left by @code{expand-abbrev} for the sake of the
-@code{unexpand-abbrev} command.
+@code{unexpand-abbrev} command (@pxref{Expanding Abbrevs,, Expanding
+Abbrevs, emacs, The GNU Emacs Manual}).
 @end defvar
 
 @defvar last-abbrev-location
-This is the location of the last abbrev expanded.  This contains
+This is the location of the most recent abbrev expanded.  This contains
 information left by @code{expand-abbrev} for the sake of the
 @code{unexpand-abbrev} command.
 @end defvar
 
 @defvar last-abbrev-text
-This is the exact expansion  text of the last abbrev expanded, as
-results from case conversion.  Its value is
-@code{nil} if the abbrev has already been unexpanded.  This
-contains information left by @code{expand-abbrev} for the sake of the
-@code{unexpand-abbrev} command.
+This is the exact expansion text of the most recent abbrev expanded,
+after case conversion (if any).  Its value is @code{nil} if the abbrev
+has already been unexpanded.  This contains information left by
+@code{expand-abbrev} for the sake of the @code{unexpand-abbrev} command.
 @end defvar
 
 @c Emacs 19 feature
@@ -284,7 +299,7 @@ aborts expansion if it is not confirmed.
 ;; @r{user entered some other character, this function asks whether}
 ;; @r{expansion should continue.}
 
-;; @r{If the user enters the prompt with @kbd{y}, the function returns}
+;; @r{If the user answers the prompt with @kbd{y}, the function returns}
 ;; @r{@code{nil} (because of the @code{not} function), but that is}
 ;; @r{acceptable; the return value has no effect on expansion.}
 
@@ -314,18 +329,14 @@ abbreviation table of the current buffer.
 @end defvar
 
 @defvar fundamental-mode-abbrev-table
-This is the local abbrev table used in Fundamental mode.  It is the
-local abbrev table in all buffers in Fundamental mode.
+This is the local abbrev table used in Fundamental mode; in other words,
+it is the local abbrev table in all buffers in Fundamental mode.
 @end defvar
 
 @defvar text-mode-abbrev-table
 This is the local abbrev table used in Text mode.
 @end defvar
 
-@defvar c-mode-abbrev-table
-This is the local abbrev table used in C mode.
-@end defvar
-
 @defvar lisp-mode-abbrev-table
 This is the local abbrev table used in Lisp mode and Emacs Lisp mode.
 @end defvar