aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEli Zaretskii2009-01-31 14:34:05 +0000
committerEli Zaretskii2009-01-31 14:34:05 +0000
commitde456f3ba152d49f70a2b88d503b641387cf4a52 (patch)
tree8d8f6992120d42f024e25a680d92bc29362ecbdd
parent6e9db169a39601d4997da47e590b492123f5e659 (diff)
downloademacs-de456f3ba152d49f70a2b88d503b641387cf4a52.tar.gz
emacs-de456f3ba152d49f70a2b88d503b641387cf4a52.zip
(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.
-rw-r--r--lisp/ChangeLog5
-rw-r--r--lisp/mail/unrmail.el16
2 files changed, 17 insertions, 4 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index c54e960fb77..362f46616f6 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,5 +1,10 @@
12009-01-31 Eli Zaretskii <eliz@gnu.org> 12009-01-31 Eli Zaretskii <eliz@gnu.org>
2 2
3 * mail/unrmail.el (unrmail): Set coding-system of the old Rmail
4 file to `raw-text-unix'. Bind coding-system-for-write when
5 writing out the converted message, and make sure it uses Unix
6 EOLs.
7
3 * mail/rmail.el (rmail-convert-babyl-to-mbox): Set Rmail's buffer 8 * mail/rmail.el (rmail-convert-babyl-to-mbox): Set Rmail's buffer
4 encoding to `raw-text-unix'. 9 encoding to `raw-text-unix'.
5 (rmail-perm-variables): Set encoding of rmail-view-buffer to 10 (rmail-perm-variables): Set encoding of rmail-view-buffer to
diff --git a/lisp/mail/unrmail.el b/lisp/mail/unrmail.el
index 95ff727f077..9d1717368bd 100644
--- a/lisp/mail/unrmail.el
+++ b/lisp/mail/unrmail.el
@@ -55,6 +55,7 @@ For example, invoke `emacs -batch -f batch-unrmail RMAIL'."
55 (insert-file-contents file)) 55 (insert-file-contents file))
56 ;; But make it multibyte. 56 ;; But make it multibyte.
57 (set-buffer-multibyte t) 57 (set-buffer-multibyte t)
58 (setq buffer-file-coding-system 'raw-text-unix)
58 59
59 (if (not (looking-at "BABYL OPTIONS")) 60 (if (not (looking-at "BABYL OPTIONS"))
60 (error "This file is not in Babyl format")) 61 (error "This file is not in Babyl format"))
@@ -192,7 +193,13 @@ For example, invoke `emacs -batch -f batch-unrmail RMAIL'."
192 ;; If the message specifies a coding system, use it. 193 ;; If the message specifies a coding system, use it.
193 (let ((maybe-coding (mail-fetch-field "X-Coding-System"))) 194 (let ((maybe-coding (mail-fetch-field "X-Coding-System")))
194 (if maybe-coding 195 (if maybe-coding
195 (setq coding (intern maybe-coding)))) 196 (setq coding
197 ;; Force Unix EOLs.
198 (coding-system-change-eol-conversion
199 (intern maybe-coding) 0))
200 ;; If there's no X-Coding-System header, assume the
201 ;; message was never decoded.
202 (setq coding 'raw-text-unix)))
196 203
197 ;; Delete the Mail-From: header field if any. 204 ;; Delete the Mail-From: header field if any.
198 (when (re-search-forward "^Mail-from:" nil t) 205 (when (re-search-forward "^Mail-from:" nil t)
@@ -215,9 +222,10 @@ For example, invoke `emacs -batch -f batch-unrmail RMAIL'."
215 (while (search-forward "\nFrom " nil t) 222 (while (search-forward "\nFrom " nil t)
216 (forward-char -5) 223 (forward-char -5)
217 (insert ?>))) 224 (insert ?>)))
218 ;; Write it to the output file. 225 ;; Write it to the output file, suitably encoded.
219 (write-region (point-min) (point-max) to-file t 226 (let ((coding-system-for-write coding))
220 'nomsg)))) 227 (write-region (point-min) (point-max) to-file t
228 'nomsg)))))
221 (kill-buffer temp-buffer)) 229 (kill-buffer temp-buffer))
222 (message "Writing messages to %s...done" to-file))) 230 (message "Writing messages to %s...done" to-file)))
223 231