]> git.eshelyaron.com Git - emacs.git/commitdiff
(mail-yank-original): Set buffer-file-coding-system from the one used
authorEli Zaretskii <eliz@gnu.org>
Fri, 7 Aug 2009 17:30:16 +0000 (17:30 +0000)
committerEli Zaretskii <eliz@gnu.org>
Fri, 7 Aug 2009 17:30:16 +0000 (17:30 +0000)
by the message whose text is yanked.

lisp/ChangeLog
lisp/mail/sendmail.el

index d7ef410f837958a3fb699d56cc2dfdd2c5bab493..9e9e83a319d50ba8f814bf252c442601be9ae01e 100644 (file)
@@ -1,5 +1,9 @@
 2009-08-07  Eli Zaretskii  <eliz@gnu.org>
 
+       * mail/sendmail.el (mail-yank-original): Set
+       buffer-file-coding-system from the one used by the message whose
+       text is yanked.
+
        * calc/calc-graph.el (calc-graph-plot): Set calc-graph-last-device
        to "windows" when "pgnuplot" is used.
        (calc-graph-command, calc-gnuplot-command, calc-graph-init): Don't
index b392ddcfac7c805429d1880487134242160fde0b..09028a37628fa54305c2ba205add6f6b9687f508 100644 (file)
@@ -1506,7 +1506,19 @@ and don't delete any header fields."
          (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