[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] /srv/bzr/emacs/emacs-23 r100378: Fix setting of buffer-fil
From: |
Kenichi Handa |
Subject: |
[Emacs-diffs] /srv/bzr/emacs/emacs-23 r100378: Fix setting of buffer-file-coding-system of RMAIL buffer. |
Date: |
Fri, 14 Jan 2011 13:08:53 +0900 |
User-agent: |
Bazaar (2.0.3) |
------------------------------------------------------------
revno: 100378 [merge]
committer: Kenichi Handa <address@hidden>
branch nick: emacs-23
timestamp: Fri 2011-01-14 13:08:53 +0900
message:
Fix setting of buffer-file-coding-system of RMAIL buffer.
modified:
lisp/ChangeLog
lisp/mail/rmailmm.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog 2011-01-13 05:12:01 +0000
+++ b/lisp/ChangeLog 2011-01-14 04:08:30 +0000
@@ -1,3 +1,14 @@
+2011-01-14 Kenichi Handa <address@hidden>
+
+ * mail/rmailmm.el (rmail-mime-insert-header): Set
+ rmail-mime-coding-system to a cons whose car is the last coding
+ system used to decode the header.
+ (rmail-mime-find-header-encoding): New function.
+ (rmail-mime-insert-decoded-text): Override
+ rmail-mime-coding-system if it is a cons.
+ (rmail-show-mime): If only a header part was decoded, find the
+ coding system while ignoring mm-charset-override-alist.
+
2011-01-13 Chong Yidong <address@hidden>
* subr.el (event-start, event-end): Doc fix (Bug#7826).
=== modified file 'lisp/mail/rmailmm.el'
--- a/lisp/mail/rmailmm.el 2011-01-12 06:08:55 +0000
+++ b/lisp/mail/rmailmm.el 2011-01-14 04:04:10 +0000
@@ -460,12 +460,27 @@
(rmail-copy-headers (point) (aref header 1)))))
(rfc2047-decode-region pos (point))
(if (and last-coding-system-used (not rmail-mime-coding-system))
- (setq rmail-mime-coding-system last-coding-system-used))
+ (setq rmail-mime-coding-system (cons last-coding-system-used nil)))
(goto-char (point-min))
(rmail-highlight-headers)
(goto-char (point-max))
(insert "\n"))))
+(defun rmail-mime-find-header-encoding (header)
+ "Retun the last coding system used to decode HEADER.
+HEADER is a header component of a MIME-entity object (see
+`rmail-mime-entity')."
+ (with-temp-buffer
+ (let ((last-coding-system-used nil))
+ (with-current-buffer rmail-mime-mbox-buffer
+ (let ((rmail-buffer rmail-mime-mbox-buffer)
+ (rmail-view-buffer rmail-mime-view-buffer))
+ (save-excursion
+ (goto-char (aref header 0))
+ (rmail-copy-headers (point) (aref header 1)))))
+ (rfc2047-decode-region (point-min) (point-max))
+ last-coding-system-used)))
+
(defun rmail-mime-text-handler (content-type
content-disposition
content-transfer-encoding)
@@ -498,7 +513,7 @@
((string= transfer-encoding "quoted-printable")
(quoted-printable-decode-region pos (point))))))
(decode-coding-region pos (point) coding-system)
- (or rmail-mime-coding-system
+ (if (or (not rmail-mime-coding-system) (consp rmail-mime-coding-system))
(setq rmail-mime-coding-system coding-system))
(or (bolp) (insert "\n"))))
@@ -1274,8 +1289,19 @@
(with-current-buffer rmail-mime-view-buffer
(erase-buffer)
(rmail-mime-insert entity)
- (if rmail-mime-coding-system
- (set-buffer-file-coding-system rmail-mime-coding-system t t)))
+ (if (consp rmail-mime-coding-system)
+ ;; Decoding is done by rfc2047-decode-region only for a
+ ;; header. But, as the used coding system may have been
+ ;; overriden by mm-charset-override-alist, we can't
+ ;; trust (car rmail-mime-coding-system). So, here we
+ ;; try the decoding again with mm-charset-override-alist
+ ;; bound to nil.
+ (let ((mm-charset-override-alist nil))
+ (setq rmail-mime-coding-system
+ (rmail-mime-find-header-encoding
+ (rmail-mime-entity-header entity)))))
+ (set-buffer-file-coding-system
+ (coding-system-base rmail-mime-coding-system) t t))
;; Decoding failed. ENTITY is an error message. Insert the
;; original message body as is, and show warning.
(let ((region (with-current-buffer rmail-mime-mbox-buffer
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] /srv/bzr/emacs/emacs-23 r100378: Fix setting of buffer-file-coding-system of RMAIL buffer.,
Kenichi Handa <=