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