annotate man/autotype.texi @ 28900:ac620ff5fd5d

*** empty log message ***
author Gerd Moellmann <gerd@gnu.org>
date Sat, 13 May 2000 09:11:42 +0000
parents 2bf82b32f9f8
children 3f09d2029838
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
26151
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
1 \input texinfo
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
2 @c This is an annex of the Emacs manual.
25848
Dave Love <fx@gnu.org>
parents:
diff changeset
3 @c Copyright (C) 1994, 1995 Free Software Foundation, Inc.
Dave Love <fx@gnu.org>
parents:
diff changeset
4 @c Author: Daniel.Pfeiffer@Informatik.START.dbp.de, fax (+49 69) 7588-2389
Dave Love <fx@gnu.org>
parents:
diff changeset
5 @c See file emacs.texi for copying conditions.
26151
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
6 @setfilename ../info/autotype
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
7 @c @node Autotypist, Picture, Abbrevs, Top
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
8 @c @chapter Features for Automatic Typing
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
9 @settitle Features for Automatic Typing
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
10 @c @cindex text
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
11 @c @cindex selfinserting text
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
12 @c @cindex autotypist
25848
Dave Love <fx@gnu.org>
parents:
diff changeset
13
Dave Love <fx@gnu.org>
parents:
diff changeset
14 @dircategory Editors
Dave Love <fx@gnu.org>
parents:
diff changeset
15 @direntry
Dave Love <fx@gnu.org>
parents:
diff changeset
16 * Autotype: (autotype). Convenient features for text that you enter frequently
Dave Love <fx@gnu.org>
parents:
diff changeset
17 in Emacs.
Dave Love <fx@gnu.org>
parents:
diff changeset
18 @end direntry
Dave Love <fx@gnu.org>
parents:
diff changeset
19
26151
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
20 @ifinfo
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
21 Copyright @copyright{} 1994, 1995, 1999 Free Software Foundation, Inc.
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
22 @end ifinfo
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
23
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
24
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
25 @titlepage
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
26 @sp 10
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
27
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
28 @center @titlefont{Autotyping}
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
29 @sp 2
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
30 @center @subtitlefont{Convenient features for text that you enter
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
31 frequently in Emacs}
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
32 @sp 2
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
33 @center Daniel Pfeiffer
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
34 @center additions by Dave Love
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
35
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
36 @page
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
37 @vskip 0pt plus 1filll
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
38 Copyright @copyright{} 1994, 1995, 1999 Free Software Foundation, Inc.
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
39 @end titlepage
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
40
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
41 @node Top
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
42 @top Autotyping
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
43
25848
Dave Love <fx@gnu.org>
parents:
diff changeset
44 Under certain circumstances you will find yourself typing similar things
Dave Love <fx@gnu.org>
parents:
diff changeset
45 over and over again. This is especially true of form letters and programming
Dave Love <fx@gnu.org>
parents:
diff changeset
46 language constructs. Project-specific header comments, flow-control
Dave Love <fx@gnu.org>
parents:
diff changeset
47 constructs or magic numbers are essentially the same every time. Emacs has
26151
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
48 various features for doing tedious and repetitive typing chores for you
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
49 in addition to the Abbrev features (@pxref{(emacs)Abbrevs}).
25848
Dave Love <fx@gnu.org>
parents:
diff changeset
50
Dave Love <fx@gnu.org>
parents:
diff changeset
51 One solution is using skeletons, flexible rules that say what to
Dave Love <fx@gnu.org>
parents:
diff changeset
52 insert, and how to do it. Various programming language modes offer some
Dave Love <fx@gnu.org>
parents:
diff changeset
53 ready-to-use skeletons, and you can adapt them to suit your needs or
Dave Love <fx@gnu.org>
parents:
diff changeset
54 taste, or define new ones.
Dave Love <fx@gnu.org>
parents:
diff changeset
55
Dave Love <fx@gnu.org>
parents:
diff changeset
56 Another feature is automatic insertion of what you want into empty files,
Dave Love <fx@gnu.org>
parents:
diff changeset
57 depending on the file-name or the mode as appropriate. You can have a file or
Dave Love <fx@gnu.org>
parents:
diff changeset
58 a skeleton inserted, or you can call a function. Then there is the
Dave Love <fx@gnu.org>
parents:
diff changeset
59 possibility to have Un*x interpreter scripts automatically take on a magic
Dave Love <fx@gnu.org>
parents:
diff changeset
60 number and be executable as soon as they are saved. Or you can have a
26151
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
61 copyright notice's year updated, if necessary, every time you save a
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
62 file. Similarly for time stamps in the file.
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
63
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
64 URLs can be inserted based on a word at point. Flexible templates can
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
65 be defined for inserting and navigating between text more generally. A
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
66 sort of meta-expansion facility can be used to try a set of alternative
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
67 completions and expansions of text at point.
25848
Dave Love <fx@gnu.org>
parents:
diff changeset
68
Dave Love <fx@gnu.org>
parents:
diff changeset
69 @menu
Dave Love <fx@gnu.org>
parents:
diff changeset
70 * Using Skeletons:: How to insert a skeleton into your text.
Dave Love <fx@gnu.org>
parents:
diff changeset
71 * Wrapping Skeletons:: Putting existing text within a skeleton.
Dave Love <fx@gnu.org>
parents:
diff changeset
72 * Skeletons as Abbrevs:: An alternative for issuing skeleton commands.
Dave Love <fx@gnu.org>
parents:
diff changeset
73 * Skeleton Language:: Making skeleton commands insert what you want.
26151
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
74 * Inserting Pairs:: Typing one character and getting another
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
75 after point.
25848
Dave Love <fx@gnu.org>
parents:
diff changeset
76 * Autoinserting:: Filling up empty files as soon as you visit them.
Dave Love <fx@gnu.org>
parents:
diff changeset
77 * Copyrights:: Inserting and updating copyrights.
Dave Love <fx@gnu.org>
parents:
diff changeset
78 * Executables:: Turning interpreter scripts into executables.
26151
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
79 * Timestamps:: Updating dates and times in modified files.
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
80 * QuickURL:: Inserting URLs based on text at point.
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
81 * Tempo:: Flexible template insertion.
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
82 * Hippie Expand:: Expansion of text trying various methods.
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
83
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
84 * Concept Index::
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
85 * Command Index::
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
86 * Variable Index::
25848
Dave Love <fx@gnu.org>
parents:
diff changeset
87 @end menu
Dave Love <fx@gnu.org>
parents:
diff changeset
88
Dave Love <fx@gnu.org>
parents:
diff changeset
89
Dave Love <fx@gnu.org>
parents:
diff changeset
90
Dave Love <fx@gnu.org>
parents:
diff changeset
91 @node Using Skeletons
26151
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
92 @chapter Using Skeletons
25848
Dave Love <fx@gnu.org>
parents:
diff changeset
93 @cindex skeletons
Dave Love <fx@gnu.org>
parents:
diff changeset
94 @cindex using skeletons
Dave Love <fx@gnu.org>
parents:
diff changeset
95
Dave Love <fx@gnu.org>
parents:
diff changeset
96 When you want Emacs to insert a form letter or a typical construct of the
Dave Love <fx@gnu.org>
parents:
diff changeset
97 programming language you are using, skeletons are a means of accomplishing
Dave Love <fx@gnu.org>
parents:
diff changeset
98 this. Normally skeletons each have a command of their own, that, when called,
Dave Love <fx@gnu.org>
parents:
diff changeset
99 will insert the skeleton. These commands can be issued in the usual ways
26463
2bf82b32f9f8 Fix makeinfo errors.
Dave Love <fx@gnu.org>
parents: 26151
diff changeset
100 (@pxref{(emacs)Commands}). Modes that offer various skeletons will often
26151
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
101 bind these to key-sequences on the @kbd{C-c} prefix, as well as having
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
102 an @cite{Insert} menu and maybe even predefined abbrevs for them
26463
2bf82b32f9f8 Fix makeinfo errors.
Dave Love <fx@gnu.org>
parents: 26151
diff changeset
103 (@pxref{Skeletons as Abbrevs}).
25848
Dave Love <fx@gnu.org>
parents:
diff changeset
104
Dave Love <fx@gnu.org>
parents:
diff changeset
105 The simplest kind of skeleton will simply insert some text indented
Dave Love <fx@gnu.org>
parents:
diff changeset
106 according to the major mode and leave the cursor at a likely place in the
Dave Love <fx@gnu.org>
parents:
diff changeset
107 middle. Interactive skeletons may prompt you for a string that will be part
Dave Love <fx@gnu.org>
parents:
diff changeset
108 of the inserted text.
Dave Love <fx@gnu.org>
parents:
diff changeset
109
Dave Love <fx@gnu.org>
parents:
diff changeset
110 Skeletons may ask for input several times. They even have a looping
Dave Love <fx@gnu.org>
parents:
diff changeset
111 mechanism in which you will be asked for input as long as you are willing to
Dave Love <fx@gnu.org>
parents:
diff changeset
112 furnish it. An example would be multiple ``else if'' conditions. You can
Dave Love <fx@gnu.org>
parents:
diff changeset
113 recognize this situation by a prompt ending in ``RET, C-g or C-h''. This
Dave Love <fx@gnu.org>
parents:
diff changeset
114 means that entering an empty string will simply assume that you are finished.
Dave Love <fx@gnu.org>
parents:
diff changeset
115 Typing quit on the other hand terminates the loop but also the rest of the
Dave Love <fx@gnu.org>
parents:
diff changeset
116 skeleton, e.g. an ``else'' clause is skipped. Only a syntactically necessary
Dave Love <fx@gnu.org>
parents:
diff changeset
117 termination still gets inserted.
Dave Love <fx@gnu.org>
parents:
diff changeset
118
Dave Love <fx@gnu.org>
parents:
diff changeset
119
Dave Love <fx@gnu.org>
parents:
diff changeset
120
Dave Love <fx@gnu.org>
parents:
diff changeset
121 @node Wrapping Skeletons
26151
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
122 @chapter Wrapping Skeletons Around Existing Text
25848
Dave Love <fx@gnu.org>
parents:
diff changeset
123 @cindex wrapping skeletons
Dave Love <fx@gnu.org>
parents:
diff changeset
124
Dave Love <fx@gnu.org>
parents:
diff changeset
125 Often you will find yourself with some code that for whatever reason
Dave Love <fx@gnu.org>
parents:
diff changeset
126 suddenly becomes conditional. Or you have written a bit of text and want to
Dave Love <fx@gnu.org>
parents:
diff changeset
127 put it in the middle of a form letter. Skeletons provide a means for
Dave Love <fx@gnu.org>
parents:
diff changeset
128 accomplishing this, and can even, in the case of programming languages,
Dave Love <fx@gnu.org>
parents:
diff changeset
129 reindent the wrapped code for you.
Dave Love <fx@gnu.org>
parents:
diff changeset
130
Dave Love <fx@gnu.org>
parents:
diff changeset
131 Skeleton commands take an optional numeric prefix argument
26463
2bf82b32f9f8 Fix makeinfo errors.
Dave Love <fx@gnu.org>
parents: 26151
diff changeset
132 (@pxref{(emacs)Arguments}). This is interpreted in two different ways depending
25848
Dave Love <fx@gnu.org>
parents:
diff changeset
133 on whether the prefix is positive, i.e. forwards oriented or negative,
Dave Love <fx@gnu.org>
parents:
diff changeset
134 i.e. backwards oriented.
Dave Love <fx@gnu.org>
parents:
diff changeset
135
26151
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
136 A positive prefix means to wrap the skeleton around that many
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
137 following words. This is accomplished by putting the words there where
26463
2bf82b32f9f8 Fix makeinfo errors.
Dave Love <fx@gnu.org>
parents: 26151
diff changeset
138 the point is normally left after that skeleton is inserted (@pxref{Using
2bf82b32f9f8 Fix makeinfo errors.
Dave Love <fx@gnu.org>
parents: 26151
diff changeset
139 Skeletons}). The point (@pxref{(emacs)Point}) is left at the next
26151
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
140 interesting spot in the skeleton instead.
25848
Dave Love <fx@gnu.org>
parents:
diff changeset
141
Dave Love <fx@gnu.org>
parents:
diff changeset
142 A negative prefix means to do something similar with that many precedingly
26463
2bf82b32f9f8 Fix makeinfo errors.
Dave Love <fx@gnu.org>
parents: 26151
diff changeset
143 marked interregions (@pxref{(emacs)Mark}). In the simplest case, if you type
25848
Dave Love <fx@gnu.org>
parents:
diff changeset
144 @kbd{M--} just before issuing the skeleton command, that will wrap the
Dave Love <fx@gnu.org>
parents:
diff changeset
145 skeleton around the current region, just like a positive argument would have
Dave Love <fx@gnu.org>
parents:
diff changeset
146 wrapped it around a number of words.
Dave Love <fx@gnu.org>
parents:
diff changeset
147
Dave Love <fx@gnu.org>
parents:
diff changeset
148 Smaller negative arguments will wrap that many interregions into successive
Dave Love <fx@gnu.org>
parents:
diff changeset
149 interesting spots within the skeleton, again leaving the point at the next one.
Dave Love <fx@gnu.org>
parents:
diff changeset
150 We speak about interregions rather than regions here, because we treat them in
Dave Love <fx@gnu.org>
parents:
diff changeset
151 the order they appear in the buffer, which coincides with successive regions
Dave Love <fx@gnu.org>
parents:
diff changeset
152 only if they were marked in order.
Dave Love <fx@gnu.org>
parents:
diff changeset
153
Dave Love <fx@gnu.org>
parents:
diff changeset
154 That is, if you marked in alphabetical order the points A B C [] (where []
Dave Love <fx@gnu.org>
parents:
diff changeset
155 represents the point) and call a skeleton command with @kbd{M-- 3}, you will
Dave Love <fx@gnu.org>
parents:
diff changeset
156 wrap the text from A to B into the first interesting spot of the skeleton, the
Dave Love <fx@gnu.org>
parents:
diff changeset
157 text from B to C into the next one, the text from C to the point into the
Dave Love <fx@gnu.org>
parents:
diff changeset
158 third one, and leave the point in the fourth one. If there are less marks in
Dave Love <fx@gnu.org>
parents:
diff changeset
159 the buffer, or if the skeleton defines less interesting points, the surplus is
Dave Love <fx@gnu.org>
parents:
diff changeset
160 ignored.
Dave Love <fx@gnu.org>
parents:
diff changeset
161
Dave Love <fx@gnu.org>
parents:
diff changeset
162 If, on the other hand, you marked in alphabetical order the points [] A C B,
Dave Love <fx@gnu.org>
parents:
diff changeset
163 and call a skeleton command with @kbd{M-- 3}, you will wrap the text from
Dave Love <fx@gnu.org>
parents:
diff changeset
164 point to A, then the text from A to C and finally the text from C to B. This
Dave Love <fx@gnu.org>
parents:
diff changeset
165 is done because the regions overlap and Emacs would be helplessly lost if it
Dave Love <fx@gnu.org>
parents:
diff changeset
166 tried to follow the order in which you marked these points.
Dave Love <fx@gnu.org>
parents:
diff changeset
167
Dave Love <fx@gnu.org>
parents:
diff changeset
168
Dave Love <fx@gnu.org>
parents:
diff changeset
169
Dave Love <fx@gnu.org>
parents:
diff changeset
170 @node Skeletons as Abbrevs
26151
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
171 @chapter Skeletons as Abbrev Expansions
25848
Dave Love <fx@gnu.org>
parents:
diff changeset
172 @cindex skeletons as abbrevs
Dave Love <fx@gnu.org>
parents:
diff changeset
173
26151
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
174 Rather than use a keybinding for every skeleton command, you can also
26463
2bf82b32f9f8 Fix makeinfo errors.
Dave Love <fx@gnu.org>
parents: 26151
diff changeset
175 define an abbreviation (@pxref{(emacs)Defining Abbrevs}) that will expand
2bf82b32f9f8 Fix makeinfo errors.
Dave Love <fx@gnu.org>
parents: 26151
diff changeset
176 (@pxref{(emacs)Expanding Abbrevs}) into the skeleton.
25848
Dave Love <fx@gnu.org>
parents:
diff changeset
177
Dave Love <fx@gnu.org>
parents:
diff changeset
178 Say you want @samp{ifst} to be an abbreviation for the C language if
Dave Love <fx@gnu.org>
parents:
diff changeset
179 statement. You will tell Emacs that @samp{ifst} expands to the empty string
Dave Love <fx@gnu.org>
parents:
diff changeset
180 and then calls the skeleton command. In Emacs-lisp you can say something like
Dave Love <fx@gnu.org>
parents:
diff changeset
181 @code{(define-abbrev c-mode-abbrev-table "ifst" "" 'c-if)}. Or you can edit
Dave Love <fx@gnu.org>
parents:
diff changeset
182 the output from @kbd{M-x list-abbrevs} to make it look like this:
Dave Love <fx@gnu.org>
parents:
diff changeset
183
Dave Love <fx@gnu.org>
parents:
diff changeset
184 @example
Dave Love <fx@gnu.org>
parents:
diff changeset
185 (c-mode-abbrev-table)
Dave Love <fx@gnu.org>
parents:
diff changeset
186 "if" 0 "" c-if
Dave Love <fx@gnu.org>
parents:
diff changeset
187 @end example
Dave Love <fx@gnu.org>
parents:
diff changeset
188
Dave Love <fx@gnu.org>
parents:
diff changeset
189 @noindent
Dave Love <fx@gnu.org>
parents:
diff changeset
190 (Some blank lines of no semantic significance, and other abbrev tables,
Dave Love <fx@gnu.org>
parents:
diff changeset
191 have been omitted.)
Dave Love <fx@gnu.org>
parents:
diff changeset
192
Dave Love <fx@gnu.org>
parents:
diff changeset
193
Dave Love <fx@gnu.org>
parents:
diff changeset
194
Dave Love <fx@gnu.org>
parents:
diff changeset
195 @node Skeleton Language
26151
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
196 @chapter Skeleton Language
25848
Dave Love <fx@gnu.org>
parents:
diff changeset
197 @cindex skeleton language
Dave Love <fx@gnu.org>
parents:
diff changeset
198
Dave Love <fx@gnu.org>
parents:
diff changeset
199 @findex skeleton-insert
Dave Love <fx@gnu.org>
parents:
diff changeset
200 Skeletons are an shorthand extension to the Lisp language, where various
Dave Love <fx@gnu.org>
parents:
diff changeset
201 atoms directly perform either actions on the current buffer or rudimentary
Dave Love <fx@gnu.org>
parents:
diff changeset
202 flow control mechanisms. Skeletons are interpreted by the function
Dave Love <fx@gnu.org>
parents:
diff changeset
203 @code{skeleton-insert}.
Dave Love <fx@gnu.org>
parents:
diff changeset
204
Dave Love <fx@gnu.org>
parents:
diff changeset
205 A skeleton is a list starting with an interactor, which is usually a
Dave Love <fx@gnu.org>
parents:
diff changeset
206 prompt-string, or @code{nil} when not needed, but can also be a Lisp
Dave Love <fx@gnu.org>
parents:
diff changeset
207 expression for complex read functions or for returning some calculated value.
Dave Love <fx@gnu.org>
parents:
diff changeset
208 The rest of the list are any number of elements as described in the following
Dave Love <fx@gnu.org>
parents:
diff changeset
209 table:
Dave Love <fx@gnu.org>
parents:
diff changeset
210
Dave Love <fx@gnu.org>
parents:
diff changeset
211 @table @code
Dave Love <fx@gnu.org>
parents:
diff changeset
212 @item "string", ?c, ?\c
Dave Love <fx@gnu.org>
parents:
diff changeset
213 @vindex skeleton-transformation
Dave Love <fx@gnu.org>
parents:
diff changeset
214 Insert string or character. Literal strings and characters are passed through
Dave Love <fx@gnu.org>
parents:
diff changeset
215 @code{skeleton-transformation} when that is non-@code{nil}.
Dave Love <fx@gnu.org>
parents:
diff changeset
216 @item \n
Dave Love <fx@gnu.org>
parents:
diff changeset
217 Insert a newline and align under current line. Use newline character
Dave Love <fx@gnu.org>
parents:
diff changeset
218 @code{?\n} to prevent alignment.
Dave Love <fx@gnu.org>
parents:
diff changeset
219 @item _
Dave Love <fx@gnu.org>
parents:
diff changeset
220 Interesting point. When wrapping skeletons around successive regions, they are
Dave Love <fx@gnu.org>
parents:
diff changeset
221 put at these places. Point is left at first @code{_} where nothing is wrapped.
Dave Love <fx@gnu.org>
parents:
diff changeset
222 @item >
Dave Love <fx@gnu.org>
parents:
diff changeset
223 Indent line according to major mode. When following element is @code{_}, and
Dave Love <fx@gnu.org>
parents:
diff changeset
224 there is a interregion that will be wrapped here, indent that interregion.
Dave Love <fx@gnu.org>
parents:
diff changeset
225 @item &
Dave Love <fx@gnu.org>
parents:
diff changeset
226 Logical and. Iff preceding element moved point, i.e. usually inserted
Dave Love <fx@gnu.org>
parents:
diff changeset
227 something, do following element.
Dave Love <fx@gnu.org>
parents:
diff changeset
228 @item |
Dave Love <fx@gnu.org>
parents:
diff changeset
229 Logical xor. Iff preceding element didn't move point, i.e. usually inserted
Dave Love <fx@gnu.org>
parents:
diff changeset
230 nothing, do following element.
Dave Love <fx@gnu.org>
parents:
diff changeset
231 @item -number
Dave Love <fx@gnu.org>
parents:
diff changeset
232 Delete preceding number characters. Depends on value of
Dave Love <fx@gnu.org>
parents:
diff changeset
233 @code{skeleton-untabify}.
Dave Love <fx@gnu.org>
parents:
diff changeset
234 @item (), nil
Dave Love <fx@gnu.org>
parents:
diff changeset
235 Ignored.
Dave Love <fx@gnu.org>
parents:
diff changeset
236 @item lisp expression
Dave Love <fx@gnu.org>
parents:
diff changeset
237 Evaluated, and the return value is again interpreted as a skeleton element.
Dave Love <fx@gnu.org>
parents:
diff changeset
238 @item str
Dave Love <fx@gnu.org>
parents:
diff changeset
239 A special variable that, when evaluated the first time, usually prompts
Dave Love <fx@gnu.org>
parents:
diff changeset
240 for input according to the skeleton's interactor. It is then set to the
Dave Love <fx@gnu.org>
parents:
diff changeset
241 return value resulting from the interactor. Each subskeleton has its local
Dave Love <fx@gnu.org>
parents:
diff changeset
242 copy of this variable.
Dave Love <fx@gnu.org>
parents:
diff changeset
243 @item v1, v2
Dave Love <fx@gnu.org>
parents:
diff changeset
244 Skeleton-local user variables.
Dave Love <fx@gnu.org>
parents:
diff changeset
245 @item '
Dave Love <fx@gnu.org>
parents:
diff changeset
246 Evaluate following lisp expression for its side-effect, but prevent it from
Dave Love <fx@gnu.org>
parents:
diff changeset
247 being interpreted as a skeleton element.
Dave Love <fx@gnu.org>
parents:
diff changeset
248 @item skeleton
Dave Love <fx@gnu.org>
parents:
diff changeset
249 Subskeletons are inserted recursively, not once, but as often as the user
Dave Love <fx@gnu.org>
parents:
diff changeset
250 enters something at the subskeletons interactor. Thus there must be a
Dave Love <fx@gnu.org>
parents:
diff changeset
251 @code{str} in the subskeleton. They can also be used non-interactively, when
Dave Love <fx@gnu.org>
parents:
diff changeset
252 prompt is a lisp-expression that returns successive list-elements.
Dave Love <fx@gnu.org>
parents:
diff changeset
253 @item resume:
Dave Love <fx@gnu.org>
parents:
diff changeset
254 Ignored. Execution resumes here when the user quit during skeleton
Dave Love <fx@gnu.org>
parents:
diff changeset
255 interpretation.
Dave Love <fx@gnu.org>
parents:
diff changeset
256 @item quit
Dave Love <fx@gnu.org>
parents:
diff changeset
257 A constant which is non-@code{nil} when the @code{resume:} section was entered
Dave Love <fx@gnu.org>
parents:
diff changeset
258 because the user quit.
Dave Love <fx@gnu.org>
parents:
diff changeset
259 @end table
Dave Love <fx@gnu.org>
parents:
diff changeset
260
Dave Love <fx@gnu.org>
parents:
diff changeset
261 @findex skeleton-further-elements
Dave Love <fx@gnu.org>
parents:
diff changeset
262 Some modes also use other skeleton elements they themselves defined. For
Dave Love <fx@gnu.org>
parents:
diff changeset
263 example in shell script mode's skeletons you will find @code{<} which does a
Dave Love <fx@gnu.org>
parents:
diff changeset
264 rigid indentation backwards, or in cc-mode's skeletons you find the
Dave Love <fx@gnu.org>
parents:
diff changeset
265 self-inserting elements @code{@{} and @code{@}}. These are defined by the
Dave Love <fx@gnu.org>
parents:
diff changeset
266 buffer-local variable @code{skeleton-further-elements} which is a list of
Dave Love <fx@gnu.org>
parents:
diff changeset
267 variables bound while interpreting a skeleton.
Dave Love <fx@gnu.org>
parents:
diff changeset
268
Dave Love <fx@gnu.org>
parents:
diff changeset
269 @findex define-skeleton
Dave Love <fx@gnu.org>
parents:
diff changeset
270 The macro @code{define-skeleton} defines a command for interpreting a
Dave Love <fx@gnu.org>
parents:
diff changeset
271 skeleton. The first argument is the command name, the second is a
Dave Love <fx@gnu.org>
parents:
diff changeset
272 documentation string, and the rest is an interactor and any number of skeleton
Dave Love <fx@gnu.org>
parents:
diff changeset
273 elements together forming a skeleton. This skeleton is assigned to a variable
Dave Love <fx@gnu.org>
parents:
diff changeset
274 of the same name as the command and can thus be overridden from your
26463
2bf82b32f9f8 Fix makeinfo errors.
Dave Love <fx@gnu.org>
parents: 26151
diff changeset
275 @file{~/.emacs} file (@pxref{(emacs)Init File}).
25848
Dave Love <fx@gnu.org>
parents:
diff changeset
276
Dave Love <fx@gnu.org>
parents:
diff changeset
277
Dave Love <fx@gnu.org>
parents:
diff changeset
278
Dave Love <fx@gnu.org>
parents:
diff changeset
279 @node Inserting Pairs
26151
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
280 @chapter Inserting Matching Pairs of Characters
25848
Dave Love <fx@gnu.org>
parents:
diff changeset
281 @cindex inserting pairs
Dave Love <fx@gnu.org>
parents:
diff changeset
282 @cindex pairs
Dave Love <fx@gnu.org>
parents:
diff changeset
283
Dave Love <fx@gnu.org>
parents:
diff changeset
284 Various characters usually appear in pairs. When, for example, you insert
Dave Love <fx@gnu.org>
parents:
diff changeset
285 an open parenthesis, no matter whether you are programming or writing prose,
Dave Love <fx@gnu.org>
parents:
diff changeset
286 you will surely enter a closing one later. By entering both at the same time
Dave Love <fx@gnu.org>
parents:
diff changeset
287 and leaving the cursor inbetween, Emacs can guarantee you that such
Dave Love <fx@gnu.org>
parents:
diff changeset
288 parentheses are always balanced. And if you have a non-qwerty keyboard, where
Dave Love <fx@gnu.org>
parents:
diff changeset
289 typing some of the stranger programming language symbols makes you bend your
Dave Love <fx@gnu.org>
parents:
diff changeset
290 fingers backwards, this can be quite relieving too.
Dave Love <fx@gnu.org>
parents:
diff changeset
291
Dave Love <fx@gnu.org>
parents:
diff changeset
292 @findex pair-insert-maybe
Dave Love <fx@gnu.org>
parents:
diff changeset
293 @vindex pair
26463
2bf82b32f9f8 Fix makeinfo errors.
Dave Love <fx@gnu.org>
parents: 26151
diff changeset
294 This is done by binding the first key (@pxref{(emacs)Rebinding}) of the
26151
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
295 pair to @code{pair-insert-maybe} instead of @code{self-insert-command}.
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
296 The maybe comes from the fact that this at first surprising behaviour is
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
297 initially turned off. To enable it, you must set @code{pair} to some
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
298 non-@code{nil} value. And even then, a positive argument
26463
2bf82b32f9f8 Fix makeinfo errors.
Dave Love <fx@gnu.org>
parents: 26151
diff changeset
299 (@pxref{(emacs)Arguments}) will make this key behave like a self
2bf82b32f9f8 Fix makeinfo errors.
Dave Love <fx@gnu.org>
parents: 26151
diff changeset
300 inserting key (@pxref{(emacs)Inserting Text}).
25848
Dave Love <fx@gnu.org>
parents:
diff changeset
301
Dave Love <fx@gnu.org>
parents:
diff changeset
302 @findex pair-on-word
Dave Love <fx@gnu.org>
parents:
diff changeset
303 While this breaks with the stated intention of always balancing pairs, it
Dave Love <fx@gnu.org>
parents:
diff changeset
304 turns out that one often doesn't want pairing to occur, when the following
Dave Love <fx@gnu.org>
parents:
diff changeset
305 character is part of a word. If you want pairing to occur even then, set
Dave Love <fx@gnu.org>
parents:
diff changeset
306 @code{pair-on-word} to some non-@code{nil} value.
Dave Love <fx@gnu.org>
parents:
diff changeset
307
Dave Love <fx@gnu.org>
parents:
diff changeset
308 @vindex pair-alist
Dave Love <fx@gnu.org>
parents:
diff changeset
309 Pairing is possible for all visible characters. By default the parenthesis
Dave Love <fx@gnu.org>
parents:
diff changeset
310 `(', the square bracket `[', the brace `@{', the pointed bracket `<' and the
Dave Love <fx@gnu.org>
parents:
diff changeset
311 backquote ``' will all pair to the symmetrical character. All other
Dave Love <fx@gnu.org>
parents:
diff changeset
312 characters will pair themselves. This behaviour can be modified by the
Dave Love <fx@gnu.org>
parents:
diff changeset
313 variable @code{pair-alist}. This is in fact an alist of skeletons
26463
2bf82b32f9f8 Fix makeinfo errors.
Dave Love <fx@gnu.org>
parents: 26151
diff changeset
314 (@pxref{Skeleton Language}), with the first part of each sublist matching the
25848
Dave Love <fx@gnu.org>
parents:
diff changeset
315 typed character. This is the position of the interactor, but since pairs
Dave Love <fx@gnu.org>
parents:
diff changeset
316 don't need the @code{str} element, this is ignored.
Dave Love <fx@gnu.org>
parents:
diff changeset
317
Dave Love <fx@gnu.org>
parents:
diff changeset
318 Some modes have bound the command @code{pair-insert-maybe} to relevant keys.
Dave Love <fx@gnu.org>
parents:
diff changeset
319 These modes also configure the pairs as appropriate. For example, when typing
Dave Love <fx@gnu.org>
parents:
diff changeset
320 english prose, you'd expect the backquote (`) to pair to the quote (') while
Dave Love <fx@gnu.org>
parents:
diff changeset
321 in Shell script mode it must pair to itself. They can also inhibit pairing
Dave Love <fx@gnu.org>
parents:
diff changeset
322 in certain contexts. For example an escaped character will stand for itself.
Dave Love <fx@gnu.org>
parents:
diff changeset
323
Dave Love <fx@gnu.org>
parents:
diff changeset
324
Dave Love <fx@gnu.org>
parents:
diff changeset
325
Dave Love <fx@gnu.org>
parents:
diff changeset
326 @node Autoinserting
26151
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
327 @chapter Autoinserting Text in Empty Files
25848
Dave Love <fx@gnu.org>
parents:
diff changeset
328 @cindex autoinserting
Dave Love <fx@gnu.org>
parents:
diff changeset
329
Dave Love <fx@gnu.org>
parents:
diff changeset
330 @findex auto-insert
Dave Love <fx@gnu.org>
parents:
diff changeset
331 @kbd{M-x auto-insert} will put some predefined text at the beginning of
Dave Love <fx@gnu.org>
parents:
diff changeset
332 the buffer. The main application for this function, as its name suggests,
Dave Love <fx@gnu.org>
parents:
diff changeset
333 is to have it be called automatically every time an empty, and only an
Dave Love <fx@gnu.org>
parents:
diff changeset
334 empty file is visited. This is accomplished by putting @code{(add-hook
26151
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
335 'find-file-hooks 'auto-insert)} into your @file{~/.emacs} file
26463
2bf82b32f9f8 Fix makeinfo errors.
Dave Love <fx@gnu.org>
parents: 26151
diff changeset
336 (@pxref{(emacs)Init File}).
25848
Dave Love <fx@gnu.org>
parents:
diff changeset
337
Dave Love <fx@gnu.org>
parents:
diff changeset
338 @vindex auto-insert-alist
Dave Love <fx@gnu.org>
parents:
diff changeset
339 What gets inserted, if anything, is determined by the variable
Dave Love <fx@gnu.org>
parents:
diff changeset
340 @code{auto-insert-alist}. The @code{car}s of this list are each either a mode
Dave Love <fx@gnu.org>
parents:
diff changeset
341 name, making an element applicable when a buffer is in that mode. Or they
Dave Love <fx@gnu.org>
parents:
diff changeset
342 can be a string, which is a regexp matched against the buffer's file name.
Dave Love <fx@gnu.org>
parents:
diff changeset
343 In that way different kinds of files that have the same mode in Emacs can be
Dave Love <fx@gnu.org>
parents:
diff changeset
344 distinguished. The @code{car}s may also be @code{cons}-cells consisting of
Dave Love <fx@gnu.org>
parents:
diff changeset
345 mode name or regexp as above and an additional descriptive string.
Dave Love <fx@gnu.org>
parents:
diff changeset
346
Dave Love <fx@gnu.org>
parents:
diff changeset
347 When a matching element is found, the @code{cdr} says what to do. It may
Dave Love <fx@gnu.org>
parents:
diff changeset
348 be a string, which is a file name, whose contents are to be inserted, if
Dave Love <fx@gnu.org>
parents:
diff changeset
349 that file is found in the directory @code{auto-insert-directory} or under a
26463
2bf82b32f9f8 Fix makeinfo errors.
Dave Love <fx@gnu.org>
parents: 26151
diff changeset
350 absolute file name. Or it can be a skeleton (@pxref{Skeleton Language}) to
25848
Dave Love <fx@gnu.org>
parents:
diff changeset
351 be inserted.
Dave Love <fx@gnu.org>
parents:
diff changeset
352
Dave Love <fx@gnu.org>
parents:
diff changeset
353 It can also be a function, which allows doing various things. The function
26463
2bf82b32f9f8 Fix makeinfo errors.
Dave Love <fx@gnu.org>
parents: 26151
diff changeset
354 can simply insert some text, indeed, it can be skeleton command (@pxref{Using
25848
Dave Love <fx@gnu.org>
parents:
diff changeset
355 Skeletons}). It can be a lambda function which will for example conditionally
Dave Love <fx@gnu.org>
parents:
diff changeset
356 call another function. Or it can even reset the mode for the buffer. If you
Dave Love <fx@gnu.org>
parents:
diff changeset
357 want to perform several such actions in order, you use a vector, i.e. several
Dave Love <fx@gnu.org>
parents:
diff changeset
358 of the above elements between square brackets ([...]).
Dave Love <fx@gnu.org>
parents:
diff changeset
359
Dave Love <fx@gnu.org>
parents:
diff changeset
360 By default C and C++ headers insert a definition of a symbol derived from
Dave Love <fx@gnu.org>
parents:
diff changeset
361 the filename to prevent multiple inclusions. C and C++ sources insert an
Dave Love <fx@gnu.org>
parents:
diff changeset
362 include of the header. Makefiles insert the file makefile.inc if it exists.
Dave Love <fx@gnu.org>
parents:
diff changeset
363
Dave Love <fx@gnu.org>
parents:
diff changeset
364 TeX and bibTeX mode files insert the file tex-insert.tex if it exists, while
Dave Love <fx@gnu.org>
parents:
diff changeset
365 LaTeX mode files insert insert a typical @code{\documentclass} frame. Html
Dave Love <fx@gnu.org>
parents:
diff changeset
366 files insert a skeleton with the usual frame.
Dave Love <fx@gnu.org>
parents:
diff changeset
367
Dave Love <fx@gnu.org>
parents:
diff changeset
368 Ada mode files call the Ada header skeleton command. Emacs lisp source
Dave Love <fx@gnu.org>
parents:
diff changeset
369 files insert the usual header, with a copyright of your environment variable
Dave Love <fx@gnu.org>
parents:
diff changeset
370 @code{$ORGANIZATION} or else the FSF, and prompt for valid keywords describing
Dave Love <fx@gnu.org>
parents:
diff changeset
371 the contents. Files in a @code{bin/} directory for which Emacs could
26463
2bf82b32f9f8 Fix makeinfo errors.
Dave Love <fx@gnu.org>
parents: 26151
diff changeset
372 determine no specialised mode (@pxref{(emacs)Choosing Modes}) are set to Shell script
25848
Dave Love <fx@gnu.org>
parents:
diff changeset
373 mode.
Dave Love <fx@gnu.org>
parents:
diff changeset
374
Dave Love <fx@gnu.org>
parents:
diff changeset
375 @findex define-auto-insert
26463
2bf82b32f9f8 Fix makeinfo errors.
Dave Love <fx@gnu.org>
parents: 26151
diff changeset
376 In Lisp (@pxref{(emacs)Init File}) you can use the function @code{define-auto-insert}
25848
Dave Love <fx@gnu.org>
parents:
diff changeset
377 to add to or modify @code{auto-insert-alist}. See its documentation with
Dave Love <fx@gnu.org>
parents:
diff changeset
378 @kbd{C-h f auto-insert-alist}.
Dave Love <fx@gnu.org>
parents:
diff changeset
379
Dave Love <fx@gnu.org>
parents:
diff changeset
380 @vindex auto-insert
Dave Love <fx@gnu.org>
parents:
diff changeset
381 The variable @code{auto-insert} says what to do when @code{auto-insert} is
Dave Love <fx@gnu.org>
parents:
diff changeset
382 called non-interactively, e.g. when a newly found file is empty (see above):
Dave Love <fx@gnu.org>
parents:
diff changeset
383 @table @code
Dave Love <fx@gnu.org>
parents:
diff changeset
384 @item nil
Dave Love <fx@gnu.org>
parents:
diff changeset
385 Do nothing.
Dave Love <fx@gnu.org>
parents:
diff changeset
386 @item t
Dave Love <fx@gnu.org>
parents:
diff changeset
387 Insert something if possible, i.e. there is a matching entry in
Dave Love <fx@gnu.org>
parents:
diff changeset
388 @code{auto-insert-alist}.
Dave Love <fx@gnu.org>
parents:
diff changeset
389 @item other
Dave Love <fx@gnu.org>
parents:
diff changeset
390 Insert something if possible, but mark as unmodified.
Dave Love <fx@gnu.org>
parents:
diff changeset
391 @end table
Dave Love <fx@gnu.org>
parents:
diff changeset
392
Dave Love <fx@gnu.org>
parents:
diff changeset
393 @vindex auto-insert-query
Dave Love <fx@gnu.org>
parents:
diff changeset
394 The variable @code{auto-insert-query} controls whether to ask about
Dave Love <fx@gnu.org>
parents:
diff changeset
395 inserting something. When this is @code{nil} inserting is only done with
Dave Love <fx@gnu.org>
parents:
diff changeset
396 @kbd{M-x auto-insert}. When this is @code{'function} you are queried
Dave Love <fx@gnu.org>
parents:
diff changeset
397 whenever @code{auto-insert} is called as a function, such as when Emacs
Dave Love <fx@gnu.org>
parents:
diff changeset
398 visits an empty file and you have set the above-mentioned hook. Otherwise
Dave Love <fx@gnu.org>
parents:
diff changeset
399 you are alway queried.
Dave Love <fx@gnu.org>
parents:
diff changeset
400
Dave Love <fx@gnu.org>
parents:
diff changeset
401 @vindex auto-insert-prompt
Dave Love <fx@gnu.org>
parents:
diff changeset
402 When querying, the variable @code{auto-insert-prompt}'s value is used as a
Dave Love <fx@gnu.org>
parents:
diff changeset
403 prompt for a y-or-n-type question. If this includes a @code{%s} construct,
Dave Love <fx@gnu.org>
parents:
diff changeset
404 that is replaced by what caused the insertion rule to be chosen. This is
Dave Love <fx@gnu.org>
parents:
diff changeset
405 either a descriptive text, the mode-name of the buffer or the regular
Dave Love <fx@gnu.org>
parents:
diff changeset
406 expression that matched the filename.
Dave Love <fx@gnu.org>
parents:
diff changeset
407
Dave Love <fx@gnu.org>
parents:
diff changeset
408
Dave Love <fx@gnu.org>
parents:
diff changeset
409
Dave Love <fx@gnu.org>
parents:
diff changeset
410 @node Copyrights
26151
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
411 @chapter Inserting and Updating Copyrights
25848
Dave Love <fx@gnu.org>
parents:
diff changeset
412 @cindex copyrights
Dave Love <fx@gnu.org>
parents:
diff changeset
413
Dave Love <fx@gnu.org>
parents:
diff changeset
414 @findex copyright
Dave Love <fx@gnu.org>
parents:
diff changeset
415 @kbd{M-x copyright} is a skeleton inserting command, that adds a copyright
Dave Love <fx@gnu.org>
parents:
diff changeset
416 notice at the point. The ``by'' part is taken from your environment variable
Dave Love <fx@gnu.org>
parents:
diff changeset
417 @code{$ORGANIZATION} or if that isn't set you are prompted for it. If the
26463
2bf82b32f9f8 Fix makeinfo errors.
Dave Love <fx@gnu.org>
parents: 26151
diff changeset
418 buffer has a comment syntax (@pxref{(emacs)Comments}), this is inserted as a comment.
25848
Dave Love <fx@gnu.org>
parents:
diff changeset
419
Dave Love <fx@gnu.org>
parents:
diff changeset
420 @findex copyright-update
Dave Love <fx@gnu.org>
parents:
diff changeset
421 @vindex copyright-limit
Dave Love <fx@gnu.org>
parents:
diff changeset
422 @vindex copyright-current-year
Dave Love <fx@gnu.org>
parents:
diff changeset
423 @kbd{M-x copyright-update} looks for a copyright notice in the first
Dave Love <fx@gnu.org>
parents:
diff changeset
424 @code{copyright-limit} characters of the buffer and updates it when necessary.
Dave Love <fx@gnu.org>
parents:
diff changeset
425 The current year (variable @code{copyright-current-year}) is added to the
Dave Love <fx@gnu.org>
parents:
diff changeset
426 existing ones, in the same format as the preceding year, i.e. 1994, '94 or 94.
Dave Love <fx@gnu.org>
parents:
diff changeset
427 If a dash-separated year list up to last year is found, that is extended to
Dave Love <fx@gnu.org>
parents:
diff changeset
428 current year, else the year is added separated by a comma. Or it replaces
Dave Love <fx@gnu.org>
parents:
diff changeset
429 them when this is called with a prefix argument. If a header referring to a
26463
2bf82b32f9f8 Fix makeinfo errors.
Dave Love <fx@gnu.org>
parents: 26151
diff changeset
430 wrong version of the GNU General Public License (@pxref{(emacs)Copying}) is found,
25848
Dave Love <fx@gnu.org>
parents:
diff changeset
431 that is updated too.
Dave Love <fx@gnu.org>
parents:
diff changeset
432
Dave Love <fx@gnu.org>
parents:
diff changeset
433 An interesting application for this function is to have it be called
Dave Love <fx@gnu.org>
parents:
diff changeset
434 automatically every time a file is saved. This is accomplished by putting
Dave Love <fx@gnu.org>
parents:
diff changeset
435 @code{(add-hook 'write-file-hooks 'copyright-update)} into your @file{~/.emacs}
26463
2bf82b32f9f8 Fix makeinfo errors.
Dave Love <fx@gnu.org>
parents: 26151
diff changeset
436 file (@pxref{(emacs)Init File}).
25848
Dave Love <fx@gnu.org>
parents:
diff changeset
437
Dave Love <fx@gnu.org>
parents:
diff changeset
438 @vindex copyright-query
Dave Love <fx@gnu.org>
parents:
diff changeset
439 The variable @code{copyright-query} controls whether to update the
Dave Love <fx@gnu.org>
parents:
diff changeset
440 copyright or whether to ask about it. When this is @code{nil} updating is
Dave Love <fx@gnu.org>
parents:
diff changeset
441 only done with @kbd{M-x copyright-update}. When this is @code{'function}
Dave Love <fx@gnu.org>
parents:
diff changeset
442 you are queried whenever @code{copyright-update} is called as a function,
Dave Love <fx@gnu.org>
parents:
diff changeset
443 such as in the @code{write-file-hooks} feature mentioned above. Otherwise
Dave Love <fx@gnu.org>
parents:
diff changeset
444 you are always queried.
Dave Love <fx@gnu.org>
parents:
diff changeset
445
Dave Love <fx@gnu.org>
parents:
diff changeset
446
Dave Love <fx@gnu.org>
parents:
diff changeset
447
Dave Love <fx@gnu.org>
parents:
diff changeset
448 @node Executables
26151
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
449 @chapter Making Interpreter Scripts Executable
25848
Dave Love <fx@gnu.org>
parents:
diff changeset
450 @cindex executables
Dave Love <fx@gnu.org>
parents:
diff changeset
451
Dave Love <fx@gnu.org>
parents:
diff changeset
452 @vindex executable-prefix
Dave Love <fx@gnu.org>
parents:
diff changeset
453 @vindex executable-chmod
Dave Love <fx@gnu.org>
parents:
diff changeset
454 Various Un*x interpreter modes such as Shell script mode or AWK mode
Dave Love <fx@gnu.org>
parents:
diff changeset
455 will automatically insert or update the buffer's magic number, a special
Dave Love <fx@gnu.org>
parents:
diff changeset
456 comment on the first line that makes the @code{exec()} systemcall know how
Dave Love <fx@gnu.org>
parents:
diff changeset
457 to execute the script. To this end the script is automatically made
Dave Love <fx@gnu.org>
parents:
diff changeset
458 executable upon saving, with @code{executable-chmod} as argument to the
Dave Love <fx@gnu.org>
parents:
diff changeset
459 system @code{chmod} command. The magic number is prefixed by the value of
Dave Love <fx@gnu.org>
parents:
diff changeset
460 @code{executable-prefix}.
Dave Love <fx@gnu.org>
parents:
diff changeset
461
Dave Love <fx@gnu.org>
parents:
diff changeset
462 @vindex executable-magicless-file-regexp
26151
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
463 Any file whose name matches @code{executable-magicless-file-regexp} is not
25848
Dave Love <fx@gnu.org>
parents:
diff changeset
464 furnished with a magic number, nor is it made executable. This is mainly
Dave Love <fx@gnu.org>
parents:
diff changeset
465 intended for resource files, which are only meant to be read in.
Dave Love <fx@gnu.org>
parents:
diff changeset
466
Dave Love <fx@gnu.org>
parents:
diff changeset
467 @vindex executable-insert
Dave Love <fx@gnu.org>
parents:
diff changeset
468 The variable @code{executable-insert} says what to do when
Dave Love <fx@gnu.org>
parents:
diff changeset
469 @code{executable-set-magic} is called non-interactively, e.g. when file has no
Dave Love <fx@gnu.org>
parents:
diff changeset
470 or the wrong magic number:
Dave Love <fx@gnu.org>
parents:
diff changeset
471 @table @code
Dave Love <fx@gnu.org>
parents:
diff changeset
472 @item nil
Dave Love <fx@gnu.org>
parents:
diff changeset
473 Do nothing.
Dave Love <fx@gnu.org>
parents:
diff changeset
474 @item t
Dave Love <fx@gnu.org>
parents:
diff changeset
475 Insert or update magic number.
Dave Love <fx@gnu.org>
parents:
diff changeset
476 @item other
Dave Love <fx@gnu.org>
parents:
diff changeset
477 Insert or update magic number, but mark as unmodified.
Dave Love <fx@gnu.org>
parents:
diff changeset
478 @end table
Dave Love <fx@gnu.org>
parents:
diff changeset
479
Dave Love <fx@gnu.org>
parents:
diff changeset
480 @findex executable-set-magic
Dave Love <fx@gnu.org>
parents:
diff changeset
481 @vindex executable-query
Dave Love <fx@gnu.org>
parents:
diff changeset
482 The variable @code{executable-query} controls whether to ask about
Dave Love <fx@gnu.org>
parents:
diff changeset
483 inserting or updating the magic number. When this is @code{nil} updating
Dave Love <fx@gnu.org>
parents:
diff changeset
484 is only done with @kbd{M-x executable-set-magic}. When this is
Dave Love <fx@gnu.org>
parents:
diff changeset
485 @code{'function} you are queried whenever @code{executable-set-magic} is
Dave Love <fx@gnu.org>
parents:
diff changeset
486 called as a function, such as when Emacs puts a buffer in Shell script
Dave Love <fx@gnu.org>
parents:
diff changeset
487 mode. Otherwise you are alway queried.
Dave Love <fx@gnu.org>
parents:
diff changeset
488
Dave Love <fx@gnu.org>
parents:
diff changeset
489 @findex executable-self-display
Dave Love <fx@gnu.org>
parents:
diff changeset
490 @kbd{M-x executable-self-display} adds a magic number to the buffer, which
Dave Love <fx@gnu.org>
parents:
diff changeset
491 will turn it into a self displaying text file, when called as a Un*x command.
Dave Love <fx@gnu.org>
parents:
diff changeset
492 The ``interpreter'' used is @code{executable-self-display} with argument
Dave Love <fx@gnu.org>
parents:
diff changeset
493 @code{+2}.
26151
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
494
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
495 @node Timestamps
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
496 @chapter Maintaining Timestamps in Modified Files
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
497 @cindex timestamps
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
498
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
499 @findex time-stamp
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
500 @vindex write-file-hooks
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
501 The @code{time-stamp} command can be used to update automatically a
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
502 template in a file with a new time stamp every time you save the file.
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
503 Customize the hook @code{write-file-hooks} to add the function
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
504 @code{time-stamp} to arrange this.
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
505
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
506 @vindex time-stamp-active
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
507 @vindex time-stamp-format
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
508 @vindex time-stamp-start
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
509 The time stamp is updated only if the customizable variable
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
510 @code{time-stamp-active} is on, which it is by default; the command
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
511 @code{time-stamp-toggle-active} can be used to toggle it. The format of
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
512 the time stamp is set by the customizable variable
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
513 @code{time-stamp-format}.
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
514
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
515 @vindex time-stamp-line-limit
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
516 @vindex time-stamp-end
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
517 @vindex time-stamp-count
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
518 @vindex time-stamp-inserts-lines
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
519 The variables @code{time-stamp-line-limit}, @code{time-stamp-start},
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
520 @code{time-stamp-end}, @code{time-stamp-count}, and
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
521 @code{time-stamp-inserts-lines} control finding the template. Do not
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
522 change these in your init file or you will be incompatible with other
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
523 people's files. If you must change them, do so only in the local
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
524 variables section of the file itself.
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
525
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
526 Normally the template must appear in the first 8 lines of a file and
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
527 look like one of the following:
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
528
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
529 @example
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
530 Time-stamp: <>
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
531 Time-stamp: " "
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
532 @end example
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
533
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
534 The time stamp is written between the brackets or quotes:
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
535
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
536 @example
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
537 Time-stamp: <1998-02-18 10:20:51 gildea>
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
538 @end example
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
539
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
540 @node QuickURL
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
541 @chapter QuickURL: Inserting URLs Based on Text at Point
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
542
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
543 @vindex quickurl-url-file
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
544 @findex quickurl
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
545 @cindex URLs
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
546 @kbd{M-x quickurl} can be used to insert a URL into a buffer based on
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
547 the text at point. The URLs are stored in an external file defined by
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
548 the variable @code{quickurl-url-file} as a list of either cons cells of
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
549 the form @code{(@var{key} . @var{URL})} or
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
550 lists of the form @code{(@var{key} @var{URL} @var{comment})}. These
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
551 specify that @kbd{M-x quickurl} should insert @var{URL} if the word
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
552 @var{key} is at point, for example:
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
553
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
554 @example
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
555 (("FSF" "http://www.fsf.org/" "The Free Software Foundation")
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
556 ("emacs" . "http://www.emacs.org/")
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
557 ("hagbard" "http://www.hagbard.demon.co.uk" "Hagbard's World"))
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
558 @end example
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
559
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
560 @findex quickurl-add-url
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
561 @findex quickurl-list
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
562 @kbd{M-x quickurl-add-url} can be used to add a new @var{key}/@var{URL}
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
563 pair. @kbd{M-x quickurl-list} provides interactive editing of the URL
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
564 list.
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
565
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
566 @node Tempo
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
567 @chapter Tempo: Flexible Template Insertion
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
568
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
569 @cindex templates
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
570 The Tempo package provides a simple way to define powerful templates, or
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
571 macros, if you wish. It is mainly intended for, but not limited to,
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
572 other programmers to be used for creating shortcuts for editing
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
573 certain kinds of documents.
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
574
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
575 @findex tempo-backward-mark
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
576 @findex tempo-forward-mark
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
577 A template is defined as a list of items to be inserted in the current
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
578 buffer at point. Some can be simple strings, while others can control
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
579 formatting or define special points of interest in the inserted text.
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
580 @kbd{M-x tempo-backward-mark} and @kbd{M-x tempo-forward-mark} can be
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
581 used to jump between such points.
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
582
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
583 More flexible templates can be created by including lisp symbols, which
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
584 will be evaluated as variables, or lists, which will will be evaluated
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
585 as lisp expressions. Automatic completion of specified tags to expanded
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
586 templates can be provided.
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
587
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
588 @findex tempo-define-template
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
589 See the documentation for @code{tempo-define-template} for the different
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
590 items that can be used to define a tempo template with a command for
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
591 inserting it.
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
592
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
593 See the commentary in @file{tempo.el} for more information on using the
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
594 Tempo package.
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
595
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
596 @node Hippie Expand
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
597 @chapter `Hippie' Expansion
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
598
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
599 @findex hippie-expand
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
600 @kindex M-/
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
601 @vindex hippie-expand-try-functions-list
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
602 @kbd{M-x hippie-expand} is a single command providing a variety of
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
603 completions and expansions. Called repeatedly, it tries all possible
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
604 completions in succession.
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
605
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
606 Which ones to try, and in which order, is determined by the contents of
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
607 the customizable option @code{hippie-expand-try-functions-list}. Much
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
608 customization of the expansion behaviour can be made by changing the
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
609 order of, removing, or inserting new functions in this list. Given a
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
610 positive numeric argument, @kbd{M-x hippie-expand} jumps directly that
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
611 number of functions forward in this list. Given some other argument (a
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
612 negative argument or just @kbd{C-u}) it undoes the tried completion.
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
613
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
614 See the commentary in @file{hippie-exp.el} for more information on the
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
615 possibilities.
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
616
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
617 Typically you would bind @code{hippie-expand} to @kbd{M-/} with
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
618 @code{dabbrev-expand}, the standard binding of @kbd{M-/}, providing one
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
619 of the expansion possibilities.
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
620
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
621
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
622 @node Concept Index
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
623 @unnumbered Concept Index
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
624 @printindex cp
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
625
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
626 @node Command Index
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
627 @unnumbered Command Index
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
628 @printindex fn
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
629
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
630 @node Variable Index
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
631 @unnumbered Variable Index
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
632 @printindex vr
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
633
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
634 @contents
983ad33e1d97 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 25848
diff changeset
635 @bye