1. Michael Forbes
  2. emacs-autoabbrev-mode


emacs-autoabbrev-mode /

Filename Size Date modified Message
417 B
3.1 KB
87.5 KB
60.4 KB
82.8 KB
11.2 KB
348 B
820 B

README for autoabbrev mode

This Emacs mode provides a mechanism for automatically expanding abbreviations in a manner similar to that provided by abbrev-mode but with added functionality. Unlike abbrev-mode, which expands an abbreviation when a specific key (usually space) is pressed, autoabbrev-mode expands the sequence as soon as a match is found. Thus, consider having two macros defined (for use with LaTeX): xa -> \alpha and xb -> \beta. In order to get \alpha\beta, with abbrev-mode you would have to type x a <space> <backspace> x b <space> <backspace>, or (if you could somehow avoid inserting the trigger character which you probably can somehow), x a <space> x b <space> whereas with autoabbrev-mode you would just type x a x b.

One of the other features is that the macros expand as you type them, so once you type x a you will see your cursor after \alpha, but if you <backspace> then this will act on the abbreviation, so that x a <backspace> b will expand to \beta.


There is presently a bug whereby the display is not updated properly. Thus x a <backspace> should look like x but actually appears like \alph even though the expansion as described works.

Users Guide

After loading the mode, read an abbreviation file with the interactive command (M-x read-autoabbrev-file) and activate the command (M-x autoabbrev-mode). You may then start typing abbreviations to see them expand. If you need to suspend the expansion, then use the command (M-x aab-toggle-autoabbrevs) ((C-tab) by default). To manually expand the abbreviation under the cursor use (M-x aab-expand-abbrev-at-point) ((C-return) by default). You can define and delete abbreviations ogn the fly by calling (M-x autoabbrev-define) and (M-x autoabbrev-delete) or by looking at and editing the table by moving to an elisp buffer such as *Scratch* and executing the command (M-x insert-autoabbrevs). This will insert a statement to define autoabbrev-table including all of the abbreviations. You may then edit this list and execute the statement to redefine the table.

Finally, you can undo the last by executing (M-x autoabbrev-undo).

Abbreviation Table

The format for the abbreviation table is simply (setq autoabbrev-table '<list>) where <list> is a list of expansion pairs: e.g.:

(setq autoabbrev-table '(
  ("xa"      "\\alpha")
  ("xb"      "\\beta")

Remember to escape backslashes. You can include newlines. A sample list based on the FastTeX set of macros is defined in the file abbrevs.abb.