Function: define-abbrevs

define-abbrevs is an interactive and byte-compiled function defined in abbrev.el.gz.

Signature

(define-abbrevs &optional ARG)

Documentation

Define abbrevs according to current visible buffer contents.

See documentation of edit-abbrevs for info on the format of the text you must have in the buffer. If ARG is non-nil (interactively, when invoked with a prefix argument), eliminate all abbrev definitions except the ones defined by the current buffer contents.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/abbrev.el.gz
(defun define-abbrevs (&optional arg)
  "Define abbrevs according to current visible buffer contents.
See documentation of `edit-abbrevs' for info on the format of the
text you must have in the buffer.
If ARG is non-nil (interactively, when invoked with a prefix
argument), eliminate all abbrev definitions except the ones
defined by the current buffer contents."
  (interactive "P")
  (if arg (kill-all-abbrevs))
  (save-excursion
    (goto-char (point-min))
    (while (and (not (eobp)) (re-search-forward "^(" nil t))
      (let* ((buf (current-buffer))
	     (table (read buf))
	     abbrevs name hook exp count sys)
	(forward-line 1)
	(while (and (not (eobp))
                    ;; Advance as long as we're looking at blank lines
                    ;; or we have an abbrev.
                    (looking-at "[ \t\n]\\|\\(\"\\)"))
          (when (match-string 1)
	    (setq name (read buf) count (read buf))
	    (if (equal count '(sys))
                (setq sys t count (read buf))
	      (setq sys nil))
	    (setq exp (read buf))
	    (skip-chars-backward " \t\n\f")
	    (setq hook (if (not (eolp)) (read buf)))
	    (skip-chars-backward " \t\n\f")
	    (setq abbrevs (cons (list name exp hook count sys) abbrevs)))
          (forward-line 1))
	(define-abbrev-table table abbrevs)))))