changeset 102091:dd4853d4b1e2

(mail-mbox-from): Move here from rmailout.el.
author Glenn Morris <rgm@gnu.org>
date Wed, 18 Feb 2009 04:35:02 +0000
parents d5ecb9cfd7cb
children 6beed07a193c
files lisp/mail/mail-utils.el
diffstat 1 files changed, 14 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/mail/mail-utils.el	Wed Feb 18 04:34:43 2009 +0000
+++ b/lisp/mail/mail-utils.el	Wed Feb 18 04:35:02 2009 +0000
@@ -386,6 +386,20 @@
 	    (substring s (match-beginning 3) (match-end 3)) " "
 	    (mail-rfc822-time-zone time))))
 
+(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")
+		  "unknown"))
+	(date (mail-fetch-field "date")))
+    (format "From %s %s\n" (mail-strip-quoted-names from)
+	    (or (and date
+		     (ignore-errors
+		      (current-time-string (date-to-time date))))
+		(current-time-string)))))
+
 (provide 'mail-utils)
 
 ;; arch-tag: b24aec2f-fd65-4ceb-9e39-3cc2827036fd