# HG changeset patch # User Roland McGrath # Date 702683284 0 # Node ID 615cdef1368d1872a7b2b0e34794ca7304155c3c # Parent e0ce539246b8a38c7feb474eeccbdb8bd7ef837b *** empty log message *** diff -r e0ce539246b8 -r 615cdef1368d lisp/mail/mailabbrev.el --- a/lisp/mail/mailabbrev.el Mon Apr 06 16:10:45 1992 +0000 +++ b/lisp/mail/mailabbrev.el Tue Apr 07 21:48:04 1992 +0000 @@ -1,7 +1,7 @@ ;;; Abbrev-expansion of mail aliases. ;;; Copyright (C) 1985, 1986, 1987, 1992 Free Software Foundation, Inc. ;;; Created: 19 oct 90, Jamie Zawinski -;;; Last change 24-mar-92. jwz +;;; Last change 5-apr-92 by roland@gnu.ai.mit.edu. ;;; This file is part of GNU Emacs. @@ -303,32 +303,36 @@ (symbol-value sym)) -(defun mail-abbrev-expand-hook () +(defun mail-abbrev-expand-hook-v19 () "For use as the fourth arg to define-abbrev. - After expanding a mail-abbrev, if fill-mode is on and we're past the +After expanding a mail-abbrev, if fill-mode is on and we're past the fill-column, break the line at the previous comma, and indent the next line." - (let (p bol) + (save-excursion + (let ((p (point)) + bol comma fp) + (beginning-of-line) + (setq bol (point)) + (goto-char p) (while (and auto-fill-function - (>= (current-column) fill-column)) + (>= (current-column) fill-column) + (search-backward "," bol t)) + (setq comma (point)) + (forward-char 1) ; Now we are just past the comma. + (insert "\n") + (delete-horizontal-space) (setq p (point)) - (save-excursion - (let (fp) - (beginning-of-line) - (setq bol (point)) - (goto-char p) - (while (and (>= (current-column) fill-column) - (search-backward "," bol t))) - (save-excursion - (forward-char 1) - (insert "\n") - (delete-horizontal-space) - (setq p (point)) - (indent-relative) - (setq fp (buffer-substring p (point)))) - (if (> (current-column) fill-column) - (let ((fill-prefix (or fp "\t"))) - (do-auto-fill)))))))) + (indent-relative) + (setq fp (buffer-substring p (point))) + ;; Go to the end of the new line. + (end-of-line) + (if (> (current-column) fill-column) + ;; It's still too long; do normal auto-fill. + (let ((fill-prefix (or fp "\t"))) + (do-auto-fill))) + ;; Resume the search. + (goto-char comma) + )))) ;;; Syntax tables and abbrev-expansion