changeset 402:14485c6a56aa

*** empty log message ***
author Richard M. Stallman <rms@gnu.org>
date Sun, 18 Aug 1991 23:46:19 +0000
parents 24b63d6679b6
children 87dbe63c61d8
files lisp/mail/rmail.el
diffstat 1 files changed, 16 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/mail/rmail.el	Sun Aug 18 01:37:14 1991 +0000
+++ b/lisp/mail/rmail.el	Sun Aug 18 23:46:19 1991 +0000
@@ -580,20 +580,29 @@
 ;; the  rmail-break-forwarded-messages  feature is not implemented
 (defun rmail-convert-to-babyl-format ()
   (let ((count 0) start
-	(case-fold-search nil))
+	(case-fold-search nil)
+	(invalid-input-resync
+	 (function (lambda ()
+		     (message "Invalid Babyl format in inbox!")
+		     (sit-for 1)
+		     ;; Try to get back in sync with a real message.
+		     (if (re-search-forward
+			  (concat mmdf-delim1 "\\|^From") nil t)
+			 (beginning-of-line)
+		       (goto-char (point-max)))))))
     (goto-char (point-min))
     (save-restriction
       (while (not (eobp))
 	(cond ((looking-at "BABYL OPTIONS:");Babyl header
-	       (search-forward "\n\^_")
-	       (delete-region (point-min) (point)))
+	       (if (search-forward "\n\^_" nil t)
+		   ;; If we find the proper terminator, delete through there.
+		   (delete-region (point-min) (point))
+		 (funcall invalid-input-resync)
+		 (delete-region (point-min) (point)))
 	      ;; Babyl format message
 	      ((looking-at "\^L")
 	       (or (search-forward "\n\^_" nil t)
-		   (progn
-		     (message "Invalid Babyl format in inbox!")
-		     (sit-for 1)
-		     (goto-char (point-max))))
+		   (funcall invalid-input-resync))
 	       (setq count (1+ count))
 	       ;; Make sure there is no extra white space after the ^_
 	       ;; at the end of the message.