changeset 102913:497d7a904c67

* mail/rmailout.el (rmail-output): If file is visited, check the buffer's format.
author Richard M. Stallman <rms@gnu.org>
date Thu, 09 Apr 2009 16:48:25 +0000
parents 45cc1409f5e2
children 8b13a9b37672
files lisp/ChangeLog lisp/mail/rmailout.el
diffstat 2 files changed, 17 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ChangeLog	Thu Apr 09 16:46:02 2009 +0000
+++ b/lisp/ChangeLog	Thu Apr 09 16:48:25 2009 +0000
@@ -1,5 +1,8 @@
 2009-04-09  Richard M Stallman  <rms@gnu.org>
 
+	* mail/rmailout.el (rmail-output): If file is visited,
+	check the buffer's format.
+
 	* mail/rmailout.el (rmail-convert-to-babyl-format): Don't set "unseen".
 
 	* mail/rmailout.el (rmail-output-to-rmail-buffer):
--- a/lisp/mail/rmailout.el	Thu Apr 09 16:46:02 2009 +0000
+++ b/lisp/mail/rmailout.el	Thu Apr 09 16:48:25 2009 +0000
@@ -434,7 +434,20 @@
   (if noattribute (setq noattribute 'nomsg))
   (let ((babyl-format (and (file-readable-p file-name)
 			   (mail-file-babyl-p file-name)))
-	(cur (current-buffer)))
+	(cur (current-buffer))
+	(buf (find-buffer-visiting file-name)))
+
+    ;; If a babyl file is visited in a buffer, is it visited as babyl
+    ;; or as mbox?
+    (and babyl-format buf
+	 (with-current-buffer buf
+	   (save-restriction
+	     (widen)
+	     (save-excursion
+	       (goto-char (point-min))
+	       (setq babyl-format
+		     (looking-at "BABYL OPTIONS:"))))))
+
     (if not-rmail		 ; eg via message-fcc-handler-function
 	(with-temp-buffer
 	  (insert-buffer-substring cur)