Function: mail-abbrev-expand-hook

mail-abbrev-expand-hook is a byte-compiled function defined in mailabbrev.el.gz.

Signature

(mail-abbrev-expand-hook)

Documentation

For use as the fourth arg to define-abbrev.

After expanding a mail-abbrev, if Auto Fill mode is on and we're past the fill-column, break the line at the previous comma, and indent the next line with a space.

Source Code

;; Defined in /usr/src/emacs/lisp/mail/mailabbrev.el.gz
(defun mail-abbrev-expand-hook ()
  "For use as the fourth arg to `define-abbrev'.
After expanding a mail-abbrev, if Auto Fill mode is on and we're past the
`fill-column', break the line at the previous comma, and indent the next line
with a space."
  (when auto-fill-function
    (let (p)
      (save-excursion
	(while (>= (current-column) fill-column)
          (while (and (search-backward "," (line-beginning-position) 'move)
		      (>= (current-column) (1- fill-column))
		      (setq p (point))))
	  (when (or (not (bolp))
		    (and p (goto-char p)))
	    (setq p nil)
	    (forward-char 1)
	    (insert "\n")
	    (when (looking-at "[\t ]+")
	      (delete-region (point) (match-end 0)))
	    (insert " ")
	    (end-of-line)))))))