annotate man/autotype.texi @ 69626:f7d076c76ddc

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