Function: add-mode-abbrev

add-mode-abbrev is an interactive and byte-compiled function defined in abbrev.el.gz.

Signature

(add-mode-abbrev ARG)

Documentation

Define a mode-specific abbrev whose expansion is the last word before point.

If there's an active region, use that as the expansion.

Prefix argument ARG says how many words before point to use for the expansion; zero means the entire region is the expansion.

A negative ARG means to undefine the specified abbrev.

This command reads the abbreviation from the minibuffer.

See also inverse-add-mode-abbrev, which performs the opposite task: if the abbreviation is already in the buffer, use that command to define a mode-specific abbrev by specifying its expansion in the minibuffer.

Don't use this function in a Lisp program; use define-abbrev instead.

View in manual

Probably introduced at or before Emacs version 19.1.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/abbrev.el.gz
(defun add-mode-abbrev (arg)
  "Define a mode-specific abbrev whose expansion is the last word before point.
If there's an active region, use that as the expansion.

Prefix argument ARG says how many words before point to use for the expansion;
zero means the entire region is the expansion.

A negative ARG means to undefine the specified abbrev.

This command reads the abbreviation from the minibuffer.

See also `inverse-add-mode-abbrev', which performs the opposite task:
if the abbreviation is already in the buffer, use that command to define
a mode-specific abbrev by specifying its expansion in the minibuffer.

Don't use this function in a Lisp program; use `define-abbrev' instead."
  (interactive "P")
  (add-abbrev
   (if only-global-abbrevs
       global-abbrev-table
     (or local-abbrev-table
	 (error "No per-mode abbrev table")))
   "Mode" arg))