\input texinfo
@c This is an annex of the Emacs manual.
-@c Author: Daniel.Pfeiffer@Informatik.START.dbp.de, fax (+49 69) 7588-2389
-@setfilename ../../info/autotype
+@c Author: Daniel Pfeiffer <Daniel.Pfeiffer@Informatik.START.dbp.de>
+@setfilename ../../info/autotype.info
@c @node Autotypist, Picture, Abbrevs, Top
@c @chapter Features for Automatic Typing
@settitle Features for Automatic Typing
+@documentencoding UTF-8
@c @cindex text
@c @cindex selfinserting text
@c @cindex autotypist
@copying
-Copyright @copyright{} 1994-1995, 1999, 2001-2011 Free Software Foundation, Inc.
+Copyright @copyright{} 1994--1995, 1999, 2001--2014
+Free Software Foundation, Inc.
@quotation
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with no
-Invariant Sections, with the Front-Cover texts being ``A GNU Manual'',
+Invariant Sections, with the Front-Cover Texts being ``A GNU Manual'',
and with the Back-Cover Texts as in (a) below. A copy of the license
is included in the section entitled ``GNU Free Documentation License''.
(a) The FSF's Back-Cover Text is: ``You have the freedom to copy and
-modify this GNU manual. Buying copies from the FSF supports it in
-developing GNU and promoting software freedom.''
+modify this GNU manual.''
@end quotation
@end copying
@dircategory Emacs misc features
@direntry
-* Autotype: (autotype). Convenient features for text that you
- enter frequently in Emacs.
+* Autotype: (autotype). Convenient features for text that you enter
+ frequently in Emacs.
@end direntry
@titlepage
@center @titlefont{Autotyping}
@sp 2
-@center @subtitlefont{Convenient features for text that you enter
-frequently in Emacs}
+@center Convenient features for text that you enter frequently in Emacs
@sp 2
@center Daniel Pfeiffer
@center additions by Dave Love
language constructs. Project-specific header comments, flow-control
constructs or magic numbers are essentially the same every time. Emacs has
various features for doing tedious and repetitive typing chores for you
-in addition to the Abbrev features (@pxref{(emacs)Abbrevs}).
+in addition to the Abbrev features (@pxref{Abbrevs,,, emacs, The GNU Emacs Manual}).
One solution is using skeletons, flexible rules that say what to
insert, and how to do it. Various programming language modes offer some
programming language you are using, skeletons are a means of accomplishing
this. Normally skeletons each have a command of their own, that, when called,
will insert the skeleton. These commands can be issued in the usual ways
-(@pxref{(emacs)Commands}). Modes that offer various skeletons will often
+(@pxref{Commands,,, emacs, The GNU Emacs Manual}). Modes that offer various skeletons will often
bind these to key-sequences on the @kbd{C-c} prefix, as well as having
an @cite{Insert} menu and maybe even predefined abbrevs for them
(@pxref{Skeletons as Abbrevs}).
or @kbd{C-h}. This
means that entering an empty string will simply assume that you are finished.
Typing quit on the other hand terminates the loop but also the rest of the
-skeleton, e.g. an ``else'' clause is skipped. Only a syntactically necessary
+skeleton, e.g., an ``else'' clause is skipped. Only a syntactically necessary
termination still gets inserted.
reindent the wrapped code for you.
Skeleton commands take an optional numeric prefix argument
-(@pxref{(emacs)Arguments}). This is interpreted in two different ways depending
-on whether the prefix is positive, i.e. forwards oriented or negative,
-i.e. backwards oriented.
+(@pxref{Arguments,,, emacs, The GNU Emacs Manual}). This is interpreted in two different ways depending
+on whether the prefix is positive, i.e., forwards oriented, or negative,
+i.e., backwards oriented.
A positive prefix means to wrap the skeleton around that many
following words. This is accomplished by putting the words there where
the point is normally left after that skeleton is inserted (@pxref{Using
-Skeletons}). The point (@pxref{(emacs)Point}) is left at the next
+Skeletons}). The point (@pxref{Point,,, emacs, The GNU Emacs Manual}) is left at the next
interesting spot in the skeleton instead.
- A negative prefix means to do something similar with that many precedingly
-marked interregions (@pxref{(emacs)Mark}). In the simplest case, if you type
+ A negative prefix means to do something similar with that many previously
+marked interregions (@pxref{Mark,,, emacs, The GNU Emacs Manual}). In the simplest case, if you type
@kbd{M--} just before issuing the skeleton command, that will wrap the
skeleton around the current region, just like a positive argument would have
wrapped it around a number of words.
If, on the other hand, you marked in alphabetical order the points [] A C B,
and call a skeleton command with @kbd{M-- 3}, you will wrap the text from
-point to A, then the text from A to C and finally the text from C to B. This
+point to A, then the text from A to C and finally the text from C to B@. This
is done because the regions overlap and Emacs would be helplessly lost if it
tried to follow the order in which you marked these points.
@cindex skeletons as abbrevs
Rather than use a key binding for every skeleton command, you can also
-define an abbreviation (@pxref{(emacs)Defining Abbrevs}) that will expand
-(@pxref{(emacs)Expanding Abbrevs}) into the skeleton.
+define an abbreviation (@pxref{Defining Abbrevs,,, emacs, The GNU Emacs Manual}) that will expand
+(@pxref{Expanding Abbrevs,,, emacs, The GNU Emacs Manual}) into the skeleton.
Say you want @samp{ifst} to be an abbreviation for the C language if
statement. You will tell Emacs that @samp{ifst} expands to the empty string
Indent line according to major mode. When following element is @code{_}, and
there is a interregion that will be wrapped here, indent that interregion.
@item @code{&}
-Logical and. Iff preceding element moved point, i.e. usually inserted
+Logical and. If preceding element moved point, i.e., usually inserted
something, do following element.
@item @code{|}
-Logical xor. Iff preceding element didn't move point, i.e. usually inserted
+Logical xor. If preceding element didn't move point, i.e., usually inserted
nothing, do following element.
@item @code{-@var{number}}
Delete preceding number characters. Depends on value of
documentation string, and the rest is an interactor and any number of skeleton
elements together forming a skeleton. This skeleton is assigned to a variable
of the same name as the command and can thus be overridden from your
-@file{~/.emacs} file (@pxref{(emacs)Init File}).
+@file{~/.emacs} file (@pxref{Init File,,, emacs, The GNU Emacs Manual}).
Various characters usually appear in pairs. When, for example, you insert
an open parenthesis, no matter whether you are programming or writing prose,
you will surely enter a closing one later. By entering both at the same time
-and leaving the cursor inbetween, Emacs can guarantee you that such
+and leaving the cursor in between, Emacs can guarantee you that such
parentheses are always balanced. And if you have a non-qwerty keyboard, where
typing some of the stranger programming language symbols makes you bend your
fingers backwards, this can be quite relieving too.
@findex skeleton-pair-insert-maybe
@vindex skeleton-pair
- This is done by binding the first key (@pxref{(emacs)Rebinding}) of
+ This is done by binding the first key (@pxref{Rebinding,,, emacs, The GNU Emacs Manual}) of
the pair to @code{skeleton-pair-insert-maybe} instead of
@code{self-insert-command}. The ``maybe'' comes from the fact that
this at-first surprising behavior is initially turned off. To enable
it, you must set @code{skeleton-pair} to some non-@code{nil} value.
-And even then, a positive argument (@pxref{(emacs)Arguments}) will
+And even then, a positive argument (@pxref{Arguments,,, emacs, The GNU Emacs Manual}) will
make this key behave like a self-inserting key
-(@pxref{(emacs)Inserting Text}).
+(@pxref{Inserting Text,,, emacs, The GNU Emacs Manual}).
@vindex skeleton-pair-on-word
While this breaks with the stated intention of always balancing pairs, it
is to have it be called automatically every time an empty, and only an
empty file is visited. This is accomplished by putting @code{(add-hook
'find-file-hook 'auto-insert)} into your @file{~/.emacs} file
-(@pxref{(emacs)Init File}).
+(@pxref{Init File,,, emacs, The GNU Emacs Manual}).
@vindex auto-insert-alist
What gets inserted, if anything, is determined by the variable
can simply insert some text, indeed, it can be skeleton command (@pxref{Using
Skeletons}). It can be a lambda function which will for example conditionally
call another function. Or it can even reset the mode for the buffer. If you
-want to perform several such actions in order, you use a vector, i.e. several
+want to perform several such actions in order, you use a vector, i.e., several
of the above elements between square brackets (@samp{[@r{@dots{}}]}).
By default C and C++ headers insert a definition of a symbol derived from
environment variable @env{$ORGANIZATION} or else the FSF, and prompt
for valid keywords describing the contents. Files in a @file{bin}
directory for which Emacs could determine no specialized mode
-(@pxref{(emacs)Choosing Modes}) are set to Shell script mode.
+(@pxref{Choosing Modes,,, emacs, The GNU Emacs Manual}) are set to Shell script mode.
@findex define-auto-insert
- In Lisp (@pxref{(emacs)Init File}) you can use the function
+ In Lisp (@pxref{Init File,,, emacs, The GNU Emacs Manual}) you can use the function
@code{define-auto-insert} to add to or modify
@code{auto-insert-alist}. See its documentation with @kbd{C-h f
define-auto-insert}.
@vindex auto-insert
The variable @code{auto-insert} says what to do when @code{auto-insert} is
-called non-interactively, e.g. when a newly found file is empty (see above):
+called non-interactively, e.g., when a newly found file is empty (see above):
@table @asis
@item @code{nil}
Do nothing.
@item @code{t}
-Insert something if possible, i.e. there is a matching entry in
+Insert something if possible, i.e., there is a matching entry in
@code{auto-insert-alist}.
@item other
Insert something if possible, but mark as unmodified.
@kbd{M-x auto-insert}. When this is @code{function}, you are queried
whenever @code{auto-insert} is called as a function, such as when Emacs
visits an empty file and you have set the above-mentioned hook. Otherwise
-you are alway queried.
+you are always queried.
@vindex auto-insert-prompt
When querying, the variable @code{auto-insert-prompt}'s value is used as a
@kbd{M-x copyright} is a skeleton inserting command, that adds a copyright
notice at the point. The ``by'' part is taken from your environment variable
@env{$ORGANIZATION} or if that isn't set you are prompted for it. If the
-buffer has a comment syntax (@pxref{(emacs)Comments}), this is inserted as a comment.
+buffer has a comment syntax (@pxref{Comments,,, emacs, The GNU Emacs Manual}), this is inserted as a comment.
@findex copyright-update
@vindex copyright-limit
@kbd{M-x copyright-update} looks for a copyright notice in the first
@code{copyright-limit} characters of the buffer and updates it when necessary.
The current year (variable @code{copyright-current-year}) is added to the
-existing ones, in the same format as the preceding year, i.e. 1994, '94 or 94.
+existing ones, in the same format as the preceding year, i.e., 1994, '94 or 94.
If a dash-separated year list up to last year is found, that is extended to
current year, else the year is added separated by a comma. Or it replaces
them when this is called with a prefix argument. If a header referring to a
-wrong version of the GNU General Public License (@pxref{(emacs)Copying}) is found,
+wrong version of the GNU General Public License (@pxref{Copying,,, emacs, The GNU Emacs Manual}) is found,
that is updated too.
An interesting application for this function is to have it be called
automatically every time a file is saved. This is accomplished by
putting @code{(add-hook 'before-save-hook 'copyright-update)} into
-your @file{~/.emacs} file (@pxref{(emacs)Init File}). Alternative,
+your @file{~/.emacs} file (@pxref{Init File,,, emacs, The GNU Emacs Manual}). Alternative,
you can do @kbd{M-x customize-variable @key{RET} before-save-hook
@key{RET}}. @code{copyright-update} is conveniently listed as an
option in the customization buffer.
@vindex executable-insert
The variable @code{executable-insert} says what to do when
-@code{executable-set-magic} is called non-interactively, e.g. when file has no
+@code{executable-set-magic} is called non-interactively, e.g., when file has no
or the wrong magic number:
@table @asis
@item @code{nil}
is only done with @kbd{M-x executable-set-magic}. When this is
@code{function} you are queried whenever @code{executable-set-magic} is
called as a function, such as when Emacs puts a buffer in Shell script
-mode. Otherwise you are alway queried.
+mode. Otherwise you are always queried.
@findex executable-self-display
@kbd{M-x executable-self-display} adds a magic number to the buffer, which