;;; unrmail.el --- convert Rmail Babyl files to mailbox files
-;; Copyright (C) 1992, 2001-2011 Free Software Foundation, Inc.
+;; Copyright (C) 1992, 2001-2013 Free Software Foundation, Inc.
;; Maintainer: FSF
;; Keywords: mail
(error "This file is not in Babyl format"))
;; Decode the file contents just as Rmail did.
- (let ((modifiedp (buffer-modified-p))
- (coding-system rmail-file-coding-system)
+ (let ((coding-system rmail-file-coding-system)
from to)
(goto-char (point-min))
(search-forward "\n\^_" nil t) ; Skip BABYL header.
(setq from (point))
(goto-char (point-max))
(search-backward "\n\^_" from 'mv)
- (setq to (point))
+ (if (= from (setq to (point)))
+ (error "The input file contains no messages"))
(unless (and coding-system
(coding-system-p coding-system))
(setq coding-system
(while (search-forward "\nFrom " nil t)
(forward-char -5)
(insert ?>)))
- ;; Make sure the message ends with two newlines
(goto-char (point-max))
- (unless (looking-back "\n\n")
- (insert "\n"))
+ ;; Add terminator blank line to message.
+ (insert "\n")
;; Write it to the output file, suitably encoded.
(let ((coding-system-for-write coding))
(write-region (point-min) (point-max) to-file t