Under certain circumstances you will find yourself typing similar things over and over again. This is especially true of form letters and programming language constructs. Project-specific header comments, flow-control constructs or magic numbers are essentially the same every time. Emacs has various features for doing tedious and repetitive typing chores for you in addition to the Abbrev features (see Abbrevs in The GNU Emacs Manual).

One solution is using skeletons, flexible rules that say what to insert, and how to do it. Various programming language modes offer some ready-to-use skeletons, and you can adapt them to suit your needs or taste, or define new ones.

Another feature is automatic insertion of what you want into empty files, depending on the file-name or the mode as appropriate. You can have a file or a skeleton inserted, or you can call a function. Then there is the possibility to have Un*x interpreter scripts automatically take on a magic number and be executable as soon as they are saved. Or you can have a copyright notice’s year updated, if necessary, every time you save a file. Similarly for time stamps in the file.

URLs can be inserted based on a word at point. Flexible templates can be defined for inserting and navigating between text more generally. A sort of meta-expansion facility can be used to try a set of alternative completions and expansions of text at point.

Copyright © 1994–1995, 1999, 2001–2024 Free Software Foundation, Inc.

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or any later version published by the Free Software Foundation; with no Invariant Sections, with the Front-Cover Texts being “A GNU Manual”, and with the Back-Cover Texts as in (a) below. A copy of the license is included in the section entitled “GNU Free Documentation License”.

(a) The FSF’s Back-Cover Text is: “You have the freedom to copy and modify this GNU manual.”

Table of Contents

Next:   [Contents][Index]