File: tempo.el.html
This file provides a simple way to define powerful templates, or macros, if you wish. It is mainly intended for, but not limited to, other programmers to be used for creating shortcuts for editing certain kind of documents. It was originally written to be used by a HTML editing mode written by Nelson Minar <nelson@santafe.edu>, and his html-helper-mode.el is probably the best example of how to use this program.
A template is defined as a list of items to be inserted in the current buffer at point. Some of the items can be simple strings, while other can control formatting or define special points of interest in the inserted text.
If a template defines a "point of interest" that point is inserted
in a buffer-local list of "points of interest" that the user can
jump between with the commands tempo-backward-mark and
tempo-forward-mark. If the template definer provides a prompt for
the point, and the variable tempo-interactive is non-nil, the
user will be prompted for a string to be inserted in the buffer,
using the minibuffer.
The template can also define one point to be replaced with the current region if the template command is called with a prefix (or a non-nil argument).
More flexible templates can be created by including Lisp symbols, which will be evaluated as variables, or lists, which will be evaluated as Lisp expressions.
See the documentation for tempo-define-template for the different items that can be used to define a tempo template.
One of the more powerful features of tempo templates are automatic
completion. With every template can be assigned a special tag that
should be recognized by tempo-complete-tag and expanded to the
complete template. By default the tags are added to a global list
of template tags, and are matched against the last word before
point. But if you assign your tags to a specific list, you can also
specify another method for matching text in the buffer against the
tags. In the HTML mode, for instance, the tags are matched against
the text between the last < and point.
When defining a template named foo, a symbol named
tempo-template-foo will be created whose value as a variable will
be the template definition, and its function value will be an
interactive function that inserts the template at the point.
The latest tempo.el distribution can be fetched from ftp.lysator.liu.se in the directory /pub/emacs
There is also a WWW page at https://www.lysator.liu.se/~davidk/elisp/ which has some information
Defined variables (16)
tempo-collection | A collection of all the tags defined for the current buffer. |
tempo-dirty-collection | Indicates if the tag collection needs to be rebuilt. |
tempo-insert-region | Automatically insert current region when there is a ‘r’ in the template. |
tempo-insert-string-functions | List of functions to run when inserting a string. |
tempo-interactive | Prompt user for strings in templates. |
tempo-leave-completion-buffer | If nil, a completion buffer generated by M-x tempo-complete-tag |
tempo-local-tags | A list of locally installed tag completion lists. |
tempo-marks | A list of marks to jump to with M-x tempo-forward-mark and M-x tempo-backward-mark. |
tempo-match-finder | The regexp or function used to find the string to match against tags. |
tempo-named-insertions | Temporary storage for named insertions. |
tempo-region-start | Region start when inserting around the region. |
tempo-region-stop | Region stop when inserting around the region. |
tempo-show-completion-buffer | If non-nil, show a buffer with possible completions, when only |
tempo-tags | An association list with tags and corresponding templates. |
tempo-user-element-functions | Element handlers for user-defined elements. |
tempo-user-elements | Element handlers for user-defined elements. |
Defined functions (22)
tempo-add-tag | (TAG TEMPLATE &optional TAG-LIST) |
tempo-backward-mark | () |
tempo-build-collection | () |
tempo-complete-tag | (&optional SILENT) |
tempo-define-template | (NAME ELEMENTS &optional TAG DOCUMENTATION TAGLIST) |
tempo-display-completions | (STRING TAG-LIST) |
tempo-expand-if-complete | () |
tempo-find-match-string | (FINDER) |
tempo-forget-insertions | () |
tempo-forward-mark | () |
tempo-insert | (ELEMENT ON-REGION) |
tempo-insert-mark | (MARK) |
tempo-insert-named | (NAME) |
tempo-insert-prompt | (PROMPT &optional SAVE-NAME NO-INSERT) |
tempo-insert-prompt-compat | (PROMPT) |
tempo-insert-template | (TEMPLATE ON-REGION) |
tempo-invalidate-collection | (&optional GLOBAL) |
tempo-is-user-element | (ELEMENT) |
tempo-lookup-named | (NAME) |
tempo-process-and-insert-string | (STRING) |
tempo-save-named | (NAME DATA) |
tempo-use-tag-list | (TAG-LIST &optional COMPLETION-FUNCTION) |