Auto-commit of loaddefs files.
[bpt/emacs.git] / lisp / mail / unrmail.el
index f358968..f6347d1 100644 (file)
@@ -1,7 +1,6 @@
 ;;; unrmail.el --- convert Rmail Babyl files to mailbox files
 
-;; Copyright (C) 1992, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
-;;   2009, 2010, 2011  Free Software Foundation, Inc.
+;; Copyright (C) 1992, 2001-2013 Free Software Foundation, Inc.
 
 ;; Maintainer: FSF
 ;; Keywords: mail
@@ -62,15 +61,15 @@ For example, invoke `emacs -batch -f batch-unrmail RMAIL'."
        (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
@@ -232,10 +231,9 @@ For example, invoke `emacs -batch -f batch-unrmail RMAIL'."
              (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