emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] emacs/lisp/mail unrmail.el


From: Eli Zaretskii
Subject: [Emacs-diffs] emacs/lisp/mail unrmail.el
Date: Sat, 31 Jan 2009 14:32:37 +0000

CVSROOT:        /cvsroot/emacs
Module name:    emacs
Changes by:     Eli Zaretskii <eliz>    09/01/31 14:32:37

Modified files:
        lisp/mail      : unrmail.el 

Log message:
        (unrmail): Set coding-system of the old Rmail file to `raw-text-unix'.
        Bind coding-system-for-write when writing out the converted message, and
        make sure it uses Unix EOLs.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/emacs/lisp/mail/unrmail.el?cvsroot=emacs&r1=1.29&r2=1.30

Patches:
Index: unrmail.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/mail/unrmail.el,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -b -r1.29 -r1.30
--- unrmail.el  30 Jan 2009 18:30:52 -0000      1.29
+++ unrmail.el  31 Jan 2009 14:32:36 -0000      1.30
@@ -55,6 +55,7 @@
       (insert-file-contents file))
     ;; But make it multibyte.
     (set-buffer-multibyte t)
+    (setq buffer-file-coding-system 'raw-text-unix)
 
     (if (not (looking-at "BABYL OPTIONS"))
        (error "This file is not in Babyl format"))
@@ -192,7 +193,13 @@
              ;; If the message specifies a coding system, use it.
              (let ((maybe-coding (mail-fetch-field "X-Coding-System")))
                (if maybe-coding
-                   (setq coding (intern maybe-coding))))
+                   (setq coding
+                         ;; Force Unix EOLs.
+                         (coding-system-change-eol-conversion
+                          (intern maybe-coding) 0))
+                 ;; If there's no X-Coding-System header, assume the
+                 ;; message was never decoded.
+                 (setq coding 'raw-text-unix)))
 
              ;; Delete the Mail-From: header field if any.
              (when (re-search-forward "^Mail-from:" nil t)
@@ -215,9 +222,10 @@
              (while (search-forward "\nFrom " nil t)
                (forward-char -5)
                (insert ?>)))
-           ;; Write it to the output file.
+           ;; Write it to the output file, suitably encoded.
+           (let ((coding-system-for-write coding))
            (write-region (point-min) (point-max) to-file t
-                         'nomsg))))
+                           'nomsg)))))
       (kill-buffer temp-buffer))
     (message "Writing messages to %s...done" to-file)))
 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]