changeset 108505:46cf06863fe1

Synch with Gnus trunk. (message-forward-make-body-mml): Assume original message is multibyte string; error on unibyte. (message-forward-make-body-plain): Ditto; don't add excessive newline in body end.
author Katsumi Yamaoka <yamaoka@jpl.org>
date Wed, 12 May 2010 02:10:56 +0000
parents 9f927f4deab4 (current diff) a3051d2aefe7 (diff)
children 6fcaca6266ae
files
diffstat 2 files changed, 42 insertions(+), 37 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/gnus/ChangeLog	Tue May 11 20:39:46 2010 -0400
+++ b/lisp/gnus/ChangeLog	Wed May 12 02:10:56 2010 +0000
@@ -1,3 +1,10 @@
+2010-05-12  Katsumi Yamaoka  <yamaoka@jpl.org>
+
+	* message.el (message-forward-make-body-mml): Assume original message
+	is multibyte string; error on unibyte.
+	(message-forward-make-body-plain): Ditto; don't add excessive newline
+	in body end.
+
 2010-05-11  Andreas Seltenreich  <seltenreich@gmx.de>
 
 	* gnus-sum.el (gnus-summary-kill-thread): Use gnus-summary-mark-article
--- a/lisp/gnus/message.el	Tue May 11 20:39:46 2010 -0400
+++ b/lisp/gnus/message.el	Wed May 12 02:10:56 2010 +0000
@@ -7162,27 +7162,27 @@
   (insert
    "\n-------------------- Start of forwarded message --------------------\n")
   (let ((b (point))
-	contents multibyte-p e)
-    (with-current-buffer forward-buffer
-      (setq contents (buffer-string)
-	    multibyte-p (mm-multibyte-p)))
-    (insert
-     (with-temp-buffer
-       (if multibyte-p
-	   (progn
-	     (mm-enable-multibyte)
-	     (insert contents))
-	 (mm-disable-multibyte)
-	 (insert contents)
-	 (mm-enable-multibyte))
-       (mime-to-mml)
-       (goto-char (point-min))
-       (when (looking-at "From ")
-	 (replace-match "X-From-Line: "))
-       (buffer-string)))
+	(contents (with-current-buffer forward-buffer (buffer-string)))
+	e)
+    (unless (featurep 'xemacs)
+      (unless (multibyte-string-p contents)
+	(error "Attempt to insert unibyte string from the buffer \"%s\"\
+ to the multibyte buffer \"%s\""
+	       (if (bufferp forward-buffer)
+		   (buffer-name forward-buffer)
+		 forward-buffer)
+	       (buffer-name))))
+    (insert (mm-with-multibyte-buffer
+	      (insert contents)
+	      (mime-to-mml)
+	      (goto-char (point-min))
+	      (when (looking-at "From ")
+		(replace-match "X-From-Line: "))
+	      (buffer-string)))
+    (unless (bolp) (insert "\n"))
     (setq e (point))
     (insert
-     "\n-------------------- End of forwarded message --------------------\n")
+     "-------------------- End of forwarded message --------------------\n")
     (message-remove-ignored-headers b e)))
 
 (defun message-remove-ignored-headers (b e)
@@ -7218,24 +7218,22 @@
   (insert "\n\n<#mml type=message/rfc822 disposition=inline>\n")
   (let ((b (point)) e)
     (if (not message-forward-decoded-p)
-	(let (contents multibyte-p)
-	  (with-current-buffer forward-buffer
-	    (setq contents (buffer-string)
-		  multibyte-p (mm-multibyte-p)))
-	  (insert
-	   (with-temp-buffer
-	     (if multibyte-p
-		 (progn
-		   (mm-enable-multibyte)
-		   (insert contents))
-	       (mm-disable-multibyte)
-	       (insert contents)
-	       (mm-enable-multibyte))
-	     (mime-to-mml)
-	     (goto-char (point-min))
-	     (when (looking-at "From ")
-	       (replace-match "X-From-Line: "))
-	     (buffer-string))))
+	(let ((contents (with-current-buffer forward-buffer (buffer-string))))
+	  (unless (featurep 'xemacs)
+	    (unless (multibyte-string-p contents)
+	      (error "Attempt to insert unibyte string from the buffer \"%s\"\
+ to the multibyte buffer \"%s\""
+		     (if (bufferp forward-buffer)
+			 (buffer-name forward-buffer)
+		       forward-buffer)
+		     (buffer-name))))
+	  (insert (mm-with-multibyte-buffer
+		    (insert contents)
+		    (mime-to-mml)
+		    (goto-char (point-min))
+		    (when (looking-at "From ")
+		      (replace-match "X-From-Line: "))
+		    (buffer-string))))
       (save-restriction
 	(narrow-to-region (point) (point))
 	(mml-insert-buffer forward-buffer)