changeset 4764:0e239209a6db

(rmail-convert-file): If the file is empty, don't convert it after inserting the BABYL header.
author Brian Fox <bfox@gnu.org>
date Tue, 21 Sep 1993 07:34:20 +0000
parents a57b0b715c04
children 5815d7b38e9a
files lisp/mail/rmail.el
diffstat 1 files changed, 9 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/mail/rmail.el	Tue Sep 21 07:32:51 1993 +0000
+++ b/lisp/mail/rmail.el	Tue Sep 21 07:34:20 1993 +0000
@@ -269,7 +269,11 @@
 	   ;; so we don't lose the Labels: file attribute, etc.
 	   (let ((buffer-read-only nil))
 	     (insert "BABYL OPTIONS: -*- rmail -*-\n")))
+	  ((equal (point-min) (point-max))
+	   ;; Empty RMAIL file.  Just insert the header.
+	   (rmail-insert-rmail-file-header))
 	  (t
+	   ;; Non-empty file in non-RMAIL format.  Add header and convert.
 	   (setq convert t)
 	   (rmail-insert-rmail-file-header)))
     ;; If file was not a Babyl file or if there are
@@ -292,8 +296,8 @@
 	  (rmail-convert-to-babyl-format)
 	  (message "Converting to Babyl format...done")))))
 
-; I have checked that adding "-*- rmail -*-" to the BABYL OPTIONS line
-; will not cause emacs 18.55 problems.
+;;; I have checked that adding "-*- rmail -*-" to the BABYL OPTIONS line
+;;; will not cause emacs 18.55 problems.
 
 (defun rmail-insert-rmail-file-header ()
   (let ((buffer-read-only nil))
@@ -1830,7 +1834,9 @@
 			       rmail-current-message)))
 	  (save-excursion
 	    ;; Insert after header separator--before signature if any.
-	    (search-forward-regexp (concat "^" mail-header-separator))
+	    (goto-char (point-min))
+	    (search-forward-regexp
+	     (concat "^" (regexp-quote mail-header-separator)))
 	    (forward-line 1)
 	    (insert-buffer forward-buffer))))))