All Manuals > Editor User Guide > 3 Command Reference

3.27 Abbreviations

Abbreviations (abbrevs) can be defined by the user, such that if an abbreviation is typed at the keyboard followed by a word terminating character (such as Space or ,), the expansion is found and used to replace the abbreviation. Typing can thereby be saved for frequently used words or sequences of characters.

There are two kinds of abbreviations: global abbreviations, which are expanded in all major modes; and mode abbreviations, which are expanded only in defined major modes.

Abbreviations (both global and mode) are only expanded automatically when Abbrev mode (a minor mode) is on. The default is for abbrev mode to be off.

All abbreviations that are defined can be saved in a file and reloaded during later editor sessions.

Abbrev Mode Editor Command

Arguments: None
Key sequence: None

Switches abbrev mode on if it is currently off, and off if it is currently on. Only when in abbrev mode are abbreviations automatically expanded.

Add Mode Word Abbrev Editor Command

Arguments: abbrev
Key sequence: Ctrl+X Ctrl+A abbrev

Defines a mode abbreviation for the word before the current point.

A positive prefix argument defines an abbreviation for the appropriate number of words before the current point. A zero prefix argument defines an abbreviation for all the text in the region between the mark and the current point. A negative prefix argument deletes an abbreviation.

Inverse Add Mode Word Abbrev Editor Command

Arguments: expansion
Key sequence: Ctrl+X Ctrl+H expansion

Defines the word before the current point as a mode abbreviation for expansion.

Add Global Word Abbrev Editor Command

Arguments: abbrev
Key sequence: Ctrl+X + abbrev

Defines a global abbreviation for the word before the current point.

A positive prefix argument defines an abbreviation for the appropriate number of words before the current point. A zero prefix argument defines an abbreviation for all the text in the region between the mark and the current point. A negative prefix argument deletes an abbreviation.

Inverse Add Global Word Abbrev Editor Command

Arguments: expansion
Key sequence: Ctrl+X - expansion

Defines the word before the current point as a global abbreviation for expansion.

Make Word Abbrev Editor Command

Arguments: abbrev expansion mode
Key sequence: None

editor:make-word-abbrev-command p &optional abbrev expansion mode 

Defines an abbreviation for expansion without reference to the current point. The default value for mode is global.

Abbrev Expand Only Editor Command

Arguments: None
Key sequence: None

Expands the word before the current point into its abbreviation definition (if it has one). If the buffer is currently in abbrev mode then this is done automatically on meeting a word defining an abbreviation.

Word Abbrev Prefix Point Editor Command

Arguments: None
Key sequence: Meta+'

Allows the prefix before the current point to be attached to the following abbreviation. For example, if the abbreviation valn is bound to valuation, typing re followed by Meta+', followed by valn, results in the expansion revaluation.

Unexpand Last Word Editor Command

Arguments: None
Key sequence: None

Undoes the last abbreviation expansion. If this command is typed twice in succession, the previous abbreviation is restored.

Delete Mode Word Abbrev Editor Command

Arguments: abbrev
Key sequence: None

editor:delete-mode-word-abbrev-command p &optional abbrev mode 

Deletes a mode abbreviation for the current mode. A prefix argument causes all abbreviations defined in the current mode to be deleted.

The argument mode is the name of the mode for which the deletion is to be applied. The default is the current mode.

Delete Global Word Abbrev Editor Command

Arguments: abbrev
Key sequence: None

editor:delete-global-word-abbrev-command p &optional abbrev

Deletes a global abbreviation. A prefix argument causes all global abbreviations currently defined to be deleted.

Delete All Word Abbrevs Editor Command

Arguments: None
Key sequence: None

Deletes all currently defined abbreviations, both global and mode.

List Word Abbrevs Editor Command

Arguments: None
Key sequence: None

Displays a list of all the currently defined abbreviations in an Abbrev window.

Word Abbrev Apropos Editor Command

Arguments: search-string
Key sequence: None

editor:word-abbrev-apropos-command p &optional search-string

Displays a list of all the currently defined abbreviations which contain search-string in their abbreviation definition or mode. The list is displayed in an Abbrev window.

Edit Word Abbrevs Editor Command

Arguments: None
Key sequence: None

Allows recursive editing of currently defined abbreviations. The abbreviation definitions are displayed in an Edit Word Abbrevs buffer, from where they can be can be added to, modified, or removed. This buffer can then either be saved to an abbreviations file, or Define Word Abbrevs can be used to define any added or modified abbreviations in the buffer. When editing is complete, Exit Recursive Edit should be invoked.

Write Word Abbrev File Editor Command

Arguments: filename
Key sequence: None

editor:write-word-abbrev-file-command p &optional filename

Saves the currently defined abbreviations to filename. If no file name is provided, the default file name defined by the editor variable abbrev-pathname-defaults is used.

Append to Word Abbrev File Editor Command

Arguments: filename
Key sequence: None

editor:append-to-word-abbrev-file-command p &optional filename

Appends all abbreviations that have been defined or redefined since the last save to filename. If no file name is provided, the default file name defined by the editor variable abbrev-pathname-defaults is used.

abbrev-pathname-defaults Editor Variable

Default value: abbrev.defns

Defines the default file name for saving the abbreviations that have been defined in the current buffer.

Read Word Abbrev File Editor Command

Arguments: filename
Key sequence: None

editor:read-word-abbrev-file-command p &optional filename

Reads previously defined abbreviations from filename. The format of each abbreviation must be that used by Write Word Abbrev File and Insert Word Abbrevs.

Insert Word Abbrevs Editor Command

Arguments: None
Key sequence: None

Inserts into the current buffer, at the current point, a list of all currently defined abbreviations. This is similar to Write Word Abbrev File, except that the abbreviations are written into the current buffer rather than a file.

Define Word Abbrevs Editor Command

Arguments: None
Key sequence: None

Defines abbreviations from the definition list in the current buffer. The format of each abbreviation must be that used by Write Word Abbrev File and Insert Word Abbrevs.


Editor User Guide (Unix version) - 01 Dec 2021 19:35:18