Function: expand-abbrev-hook

expand-abbrev-hook is an autoloaded and byte-compiled function defined in expand.el.gz.

Signature

(expand-abbrev-hook)

Documentation

Abbrev hook used to do the expansion job of expand abbrevs.

See expand-add-abbrevs. Value is non-nil if expansion was done.

Source Code

;; Defined in /usr/src/emacs/lisp/expand.el.gz
;;;###autoload
(defun expand-abbrev-hook ()
  "Abbrev hook used to do the expansion job of expand abbrevs.
See `expand-add-abbrevs'.  Value is non-nil if expansion was done."
  ;; Expand only at the end of a line if we are near a word that has
  ;; an abbrev built from expand-add-abbrev.
  (if (and (eolp)
	   (not (expand-in-literal)))
      (let ((p (point)))
	(setq expand-point nil)
	;; don't expand if the preceding char isn't a word constituent
	(if (and (eq (char-syntax (preceding-char))
		     ?w)
		 (expand-do-expansion))
	    (progn
	      (if (listp expand-list)
		  (setq expand-index 0
			expand-pos (expand-list-to-markers expand-list)
			expand-list nil))
	      ;; expand-point tells us if we have inserted the text
	      ;; ourself or if it is the hook which has done the job.
	      (if expand-point
		  (indent-region p expand-point nil))
	      (run-hooks 'expand-expand-hook)
	      t)
	  nil))
    nil))