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