diff options
author | Chong Yidong <cyd@stupidchicken.com> | 2011-01-02 15:31:19 -0500 |
---|---|---|
committer | Chong Yidong <cyd@stupidchicken.com> | 2011-01-02 15:31:19 -0500 |
commit | 7c420169baa7c50428589cca7f8eda71b462eb15 (patch) | |
tree | b556f9e181818bbaf8b5b425844b4ae26e88f537 /lisp/mail/mail-utils.el | |
parent | bb7f5cbcda931661c8dc3311603ac764fa87a639 (diff) | |
parent | d12f22f52cb7bb18b46f5ea8de5d8e8e04733e3f (diff) | |
download | emacs-7c420169baa7c50428589cca7f8eda71b462eb15.tar.gz emacs-7c420169baa7c50428589cca7f8eda71b462eb15.tar.bz2 emacs-7c420169baa7c50428589cca7f8eda71b462eb15.zip |
Merge changes from emacs-23 branch
Diffstat (limited to 'lisp/mail/mail-utils.el')
-rw-r--r-- | lisp/mail/mail-utils.el | 40 |
1 files changed, 22 insertions, 18 deletions
diff --git a/lisp/mail/mail-utils.el b/lisp/mail/mail-utils.el index a8d845146f6..81a2bd49441 100644 --- a/lisp/mail/mail-utils.el +++ b/lisp/mail/mail-utils.el @@ -1,7 +1,7 @@ ;;; mail-utils.el --- utility functions used both by rmail and rnews ;; Copyright (C) 1985, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, -;; 2009, 2010 Free Software Foundation, Inc. +;; 2009, 2010, 2011 Free Software Foundation, Inc. ;; Maintainer: FSF ;; Keywords: mail, news @@ -185,8 +185,7 @@ Return a modified address list." ;; Detect nested comments. (if (string-match "[ \t]*(\\([^)\\]\\|\\\\.\\|\\\\\n\\)*(" address) ;; Strip nested comments. - (with-current-buffer (get-buffer-create " *temp*") - (erase-buffer) + (with-temp-buffer (insert address) (set-syntax-table lisp-mode-syntax-table) (goto-char 1) @@ -199,8 +198,7 @@ Return a modified address list." (forward-sexp 1) (error (goto-char (point-max)))) (point)))) - (setq address (buffer-string)) - (erase-buffer)) + (setq address (buffer-string))) ;; Strip non-nested comments an easier way. (while (setq pos (string-match ;; This doesn't hack rfc822 nested comments @@ -235,12 +233,12 @@ Return a modified address list." nil 'literal address 2))) address)))) -;;; The following piece of ugliness is legacy code. The name was an -;;; unfortunate choice --- a flagrant violation of the Emacs Lisp -;;; coding conventions. `mail-dont-reply-to' would have been -;;; infinitely better. Also, `rmail-dont-reply-to-names' might have -;;; been better named `mail-dont-reply-to-names' and sourced from this -;;; file instead of in rmail.el. Yuck. -pmr +;; The following piece of ugliness is legacy code. The name was an +;; unfortunate choice --- a flagrant violation of the Emacs Lisp +;; coding conventions. `mail-dont-reply-to' would have been +;; infinitely better. Also, `rmail-dont-reply-to-names' might have +;; been better named `mail-dont-reply-to-names' and sourced from this +;; file instead of in rmail.el. Yuck. -pmr (defun rmail-dont-reply-to (destinations) "Prune addresses from DESTINATIONS, a list of recipient addresses. All addresses matching `rmail-dont-reply-to-names' are removed from @@ -394,13 +392,19 @@ matches may be returned from the message body." (defun mail-mbox-from () "Return an mbox \"From \" line for the current message. The buffer should be narrowed to just the header." - (let ((from (or (mail-fetch-field "from") - (mail-fetch-field "really-from") - (mail-fetch-field "sender") - (mail-fetch-field "return-path") - "unknown")) - (date (mail-fetch-field "date"))) - (format "From %s %s\n" (mail-strip-quoted-names from) + (let* ((from (mail-strip-quoted-names (or (mail-fetch-field "from") + (mail-fetch-field "really-from") + (mail-fetch-field "sender") + (mail-fetch-field "return-path") + "unknown"))) + (date (mail-fetch-field "date")) + ;; A From: header can contain multiple addresses, a "From " + ;; line must contain only one. (Bug#7760) + ;; See eg RFC 5322, 3.6.2. Originator Fields. + (end (string-match "[ \t]*[,\n]" from))) + (format "From %s %s\n" (if end + (substring from 0 end) + from) (or (and date (ignore-errors (current-time-string (date-to-time date)))) |