aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKatsumi Yamaoka2012-09-16 23:16:15 +0000
committerKatsumi Yamaoka2012-09-16 23:16:15 +0000
commit48093eb9bca47488b6867e53a12e7cac37d6f5a6 (patch)
tree8214a0b3c9dc2a00a7aa79ce48b71b650d098ae3
parent0caaedb1c3c9c48980144e41d2a95329d39c399a (diff)
downloademacs-48093eb9bca47488b6867e53a12e7cac37d6f5a6.tar.gz
emacs-48093eb9bca47488b6867e53a12e7cac37d6f5a6.zip
mail/mailabbrev.el (mail-abbrev-expand-hook): Work for a mail aliasee that holds many addresses.
-rw-r--r--lisp/ChangeLog5
-rw-r--r--lisp/mail/mailabbrev.el47
2 files changed, 23 insertions, 29 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 9eeba6691c6..7700763cf25 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,8 @@
12012-09-16 Katsumi Yamaoka <yamaoka@jpl.org>
2
3 * mail/mailabbrev.el (mail-abbrev-expand-hook): Work for a mail aliasee
4 that holds many addresses.
5
12012-09-16 Chong Yidong <cyd@gnu.org> 62012-09-16 Chong Yidong <cyd@gnu.org>
2 7
3 * align.el (align-areas): Call the indication function with 8 * align.el (align-areas): Call the indication function with
diff --git a/lisp/mail/mailabbrev.el b/lisp/mail/mailabbrev.el
index 290c57c1c55..2e4ffec1383 100644
--- a/lisp/mail/mailabbrev.el
+++ b/lisp/mail/mailabbrev.el
@@ -391,35 +391,24 @@ double-quotes."
391(defun mail-abbrev-expand-hook () 391(defun mail-abbrev-expand-hook ()
392 "For use as the fourth arg to `define-abbrev'. 392 "For use as the fourth arg to `define-abbrev'.
393After expanding a mail-abbrev, if Auto Fill mode is on and we're past the 393After expanding a mail-abbrev, if Auto Fill mode is on and we're past the
394fill-column, break the line at the previous comma, and indent the next line." 394fill-column, break the line at the previous comma, and indent the next line
395 ;; Disable abbrev mode to avoid recursion in indent-relative expanding 395with a space."
396 ;; part of the abbrev expansion as an abbrev itself. 396 (when auto-fill-function
397 (let ((abbrev-mode nil)) 397 (let (p)
398 (save-excursion 398 (save-excursion
399 (let ((p (point)) 399 (while (>= (current-column) fill-column)
400 bol comma fp) 400 (while (and (search-backward "," (point-at-bol) 'move)
401 (beginning-of-line) 401 (>= (current-column) (1- fill-column))
402 (setq bol (point)) 402 (setq p (point))))
403 (goto-char p) 403 (when (or (not (bolp))
404 (while (and auto-fill-function 404 (and p (goto-char p)))
405 (>= (current-column) fill-column) 405 (setq p nil)
406 (search-backward "," bol t)) 406 (forward-char 1)
407 (setq comma (point)) 407 (insert "\n")
408 (forward-char 1) ; Now we are just past the comma. 408 (when (looking-at "[\t ]+")
409 (insert "\n") 409 (delete-region (point) (match-end 0)))
410 (delete-horizontal-space) 410 (insert " ")
411 (setq p (point)) 411 (end-of-line)))))))
412 (indent-relative)
413 (setq fp (buffer-substring p (point)))
414 ;; Go to the end of the new line.
415 (end-of-line)
416 (if (> (current-column) fill-column)
417 ;; It's still too long; do normal auto-fill.
418 (let ((fill-prefix (or fp "\t")))
419 (do-auto-fill)))
420 ;; Resume the search.
421 (goto-char comma)
422 )))))
423 412
424;;; Syntax tables and abbrev-expansion 413;;; Syntax tables and abbrev-expansion
425 414