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