changeset 111092:c8d6ec9d7037

mml.el (mml-preview): Work properly when editing article.
author Katsumi Yamaoka <yamaoka@jpl.org>
date Fri, 22 Oct 2010 04:15:14 +0000
parents a5d92e87313c
children d80a6f7f8b4a
files lisp/gnus/ChangeLog lisp/gnus/mml.el
diffstat 2 files changed, 14 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/gnus/ChangeLog	Thu Oct 21 21:03:55 2010 -0700
+++ b/lisp/gnus/ChangeLog	Fri Oct 22 04:15:14 2010 +0000
@@ -1,5 +1,7 @@
 2010-10-22  Katsumi Yamaoka  <yamaoka@jpl.org>
 
+	* mml.el (mml-preview): Work properly when editing article.
+
 	* gnus-start.el (gnus-read-active-file-1): Don't add method to
 	gnus-have-read-active-file if it's already been in.
 
--- a/lisp/gnus/mml.el	Thu Oct 21 21:03:55 2010 -0700
+++ b/lisp/gnus/mml.el	Fri Oct 22 04:15:14 2010 +0000
@@ -1466,6 +1466,7 @@
   (require 'gnus-msg)		      ; for gnus-setup-posting-charset
   (save-excursion
     (let* ((buf (current-buffer))
+	   (article-editing (eq major-mode 'gnus-article-edit-mode))
 	   (message-options message-options)
 	   (message-this-is-mail (message-mail-p))
 	   (message-this-is-news (message-news-p))
@@ -1485,15 +1486,20 @@
       (mml-preview-insert-mail-followup-to)
       (let ((message-deletable-headers (if (message-news-p)
 					   nil
-					 message-deletable-headers)))
+					 message-deletable-headers))
+	    (mail-header-separator (if article-editing
+				       ""
+				     mail-header-separator)))
 	(message-generate-headers
 	 (copy-sequence (if (message-news-p)
 			    message-required-news-headers
-			  message-required-mail-headers))))
-      (if (re-search-forward
-	   (concat "^" (regexp-quote mail-header-separator) "\n") nil t)
-	  (replace-match "\n"))
-      (let ((mail-header-separator ""));; mail-header-separator is removed.
+			  message-required-mail-headers)))
+	(if (and (not article-editing)
+		 (re-search-forward
+		  (concat "^" (regexp-quote mail-header-separator) "\n")
+		  nil t))
+	    (replace-match "\n"))
+	(setq mail-header-separator "")
 	(message-sort-headers)
 	(mml-to-mime))
       (if raw