Template Package for Emacs
When you create a new file with Emacs, package Template supplies an initial buffer content via a template: a file with normal text and expansion forms. There is a menu to easily create such templates. You can also use new commands to decorate comments and update the buffer contents.
The main difference between Template and other similar packages is that you can define very flexible templates without having to learn Lisp or changing your Emacs init file. This package does not help Lisp programmers to define complex macros.
- The template mechanism is hooked into the normal find/open file command. There are also new commands for creating a new file using a template and inserting & expanding a template.
- You do not have to enter the file name of the template file. This package uses a sophisticated search to find the most appropritate template (supporting project- and subproject specific template files). You can change the suggestion, of course.
-
A template file can be easily created. Most of the file usually contains
simple text; only expansion forms which look like
(>>>Key<<<)
will get replaced. - There are various useful predefined expansions: set point (the cursor position), mark and registers to the current position; insert various parts of the filename, the user/system name, the current date/time in various formats, and some text to be entered by the user.
- Template-specific expansions can be defined at the end of the template file. There are commands to create these definitions; only complex expansions would require some knowledge of Lisp.
There is a menu to support the creation of template files. Additionally, this package provides the following features:
- When saving a buffer, some parts of the buffer contents (header and time stamps) are automatically updated if necessary.
- There are commands to decorate comments with dashes and alike. Works for languages with any comment style, even languages having mixed comments like C++ and Java.
Read some notes on related Emacs packages. Check the details for new sub-menus and further explanations. Check the news for the newest version number, recent changes and installation instructions. At SourceForge.net, check the project summary and download the package.
You might want to try some other Emacs packages I have written: ANTLR-Mode, Session, and X-Symbol.