changeset 104181:09b0d63f50d1

(mail-yank-original): Set buffer-file-coding-system from the one used by the message whose text is yanked.
author Eli Zaretskii <eliz@gnu.org>
date Fri, 07 Aug 2009 17:29:50 +0000
parents bd1307aab3de
children 5f39500b28a7
files lisp/mail/sendmail.el
diffstat 1 files changed, 13 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/mail/sendmail.el	Fri Aug 07 15:22:29 2009 +0000
+++ b/lisp/mail/sendmail.el	Fri Aug 07 17:29:50 2009 +0000
@@ -1506,7 +1506,19 @@
 	  (delete-windows-on original t)
 	  (with-no-warnings
 	    ;; We really want this to set mark.
-	    (insert-buffer original))
+	    (insert-buffer original)
+	    ;; If they yank the original text, the encoding of the
+	    ;; original message is a better default than
+	    ;; default-buffer-file-coding-system.
+	    (and (coding-system-equal
+		  (default-value 'buffer-file-coding-system)
+		  buffer-file-coding-system)
+		 (setq buffer-file-coding-system
+		       (coding-system-change-text-conversion
+			buffer-file-coding-system
+			(coding-system-base
+			 (with-current-buffer original
+			   buffer-file-coding-system))))))
 	  (set-text-properties (point) (mark t) nil))
 	(if (consp arg)
 	    nil