diff options
| author | Kenichi Handa | 2012-05-04 18:26:36 +0800 |
|---|---|---|
| committer | Chong Yidong | 2012-05-04 18:26:36 +0800 |
| commit | e59fb960ee3bacf937cab11b1b23e6c7389de3ed (patch) | |
| tree | ea7410da4c94286716a8afda64c4c8ef79dfd44b | |
| parent | f16e53860f281bc6677c2835d5b0225831a41739 (diff) | |
| download | emacs-e59fb960ee3bacf937cab11b1b23e6c7389de3ed.tar.gz emacs-e59fb960ee3bacf937cab11b1b23e6c7389de3ed.zip | |
Backport fix for Bug#11282 from trunk
| -rw-r--r-- | lisp/ChangeLog | 6 | ||||
| -rw-r--r-- | lisp/mail/rmailmm.el | 48 |
2 files changed, 37 insertions, 17 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index dbbb2fb4c76..ff08f0681aa 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -3,6 +3,12 @@ | |||
| 3 | * select.el (xselect--encode-string): Always use utf-8 for TEXT on | 3 | * select.el (xselect--encode-string): Always use utf-8 for TEXT on |
| 4 | Nextstep. | 4 | Nextstep. |
| 5 | 5 | ||
| 6 | 2012-05-03 Kenichi Handa <handa@m17n.org> | ||
| 7 | |||
| 8 | * mail/rmailmm.el (rmail-show-mime): Catch an error caused by text | ||
| 9 | decoding, and show a warning message without signalling an error | ||
| 10 | (Bug#11282). | ||
| 11 | |||
| 6 | 2012-04-30 Eli Zaretskii <eliz@gnu.org> | 12 | 2012-04-30 Eli Zaretskii <eliz@gnu.org> |
| 7 | 13 | ||
| 8 | * mail/rmail.el (rmail-yank-current-message): Use the encoding of | 14 | * mail/rmail.el (rmail-yank-current-message): Use the encoding of |
diff --git a/lisp/mail/rmailmm.el b/lisp/mail/rmailmm.el index 9adc5eb9a06..67b2e62275f 100644 --- a/lisp/mail/rmailmm.el +++ b/lisp/mail/rmailmm.el | |||
| @@ -1300,26 +1300,40 @@ The arguments ARG and STATE have no effect in this case." | |||
| 1300 | (rmail-mime-mbox-buffer rmail-buffer) | 1300 | (rmail-mime-mbox-buffer rmail-buffer) |
| 1301 | (rmail-mime-view-buffer rmail-view-buffer) | 1301 | (rmail-mime-view-buffer rmail-view-buffer) |
| 1302 | (rmail-mime-coding-system nil)) | 1302 | (rmail-mime-coding-system nil)) |
| 1303 | ;; If ENTITY is not a vector, it is a string describing an error. | ||
| 1303 | (if (vectorp entity) | 1304 | (if (vectorp entity) |
| 1304 | (with-current-buffer rmail-mime-view-buffer | 1305 | (with-current-buffer rmail-mime-view-buffer |
| 1305 | (erase-buffer) | 1306 | (erase-buffer) |
| 1306 | (rmail-mime-insert entity) | 1307 | ;; This condition-case is for catching an error in the |
| 1307 | (if (consp rmail-mime-coding-system) | 1308 | ;; internal MIME decoding (e.g. incorrect BASE64 form) that |
| 1308 | ;; Decoding is done by rfc2047-decode-region only for a | 1309 | ;; may be signaled by rmail-mime-insert. |
| 1309 | ;; header. But, as the used coding system may have been | 1310 | ;; FIXME: The current code doesn't set a proper error symbol |
| 1310 | ;; overridden by mm-charset-override-alist, we can't | 1311 | ;; in ERR. We must find a way to propagate a correct error |
| 1311 | ;; trust (car rmail-mime-coding-system). So, here we | 1312 | ;; symbol that is caused in the very deep code of text |
| 1312 | ;; try the decoding again with mm-charset-override-alist | 1313 | ;; decoding (e.g. an error by base64-decode-region called by |
| 1313 | ;; bound to nil. | 1314 | ;; post-read-conversion function of utf-7). |
| 1314 | (let ((mm-charset-override-alist nil)) | 1315 | (condition-case err |
| 1315 | (setq rmail-mime-coding-system | 1316 | (progn |
| 1316 | (rmail-mime-find-header-encoding | 1317 | (rmail-mime-insert entity) |
| 1317 | (rmail-mime-entity-header entity))))) | 1318 | (if (consp rmail-mime-coding-system) |
| 1318 | (set-buffer-file-coding-system | 1319 | ;; Decoding is done by rfc2047-decode-region only for a |
| 1319 | (if rmail-mime-coding-system | 1320 | ;; header. But, as the used coding system may have been |
| 1320 | (coding-system-base rmail-mime-coding-system) | 1321 | ;; overridden by mm-charset-override-alist, we can't |
| 1321 | 'undecided) | 1322 | ;; trust (car rmail-mime-coding-system). So, here we |
| 1322 | t t)) | 1323 | ;; try the decoding again with mm-charset-override-alist |
| 1324 | ;; bound to nil. | ||
| 1325 | (let ((mm-charset-override-alist nil)) | ||
| 1326 | (setq rmail-mime-coding-system | ||
| 1327 | (rmail-mime-find-header-encoding | ||
| 1328 | (rmail-mime-entity-header entity))))) | ||
| 1329 | (set-buffer-file-coding-system | ||
| 1330 | (if rmail-mime-coding-system | ||
| 1331 | (coding-system-base rmail-mime-coding-system) | ||
| 1332 | 'undecided) | ||
| 1333 | t t)) | ||
| 1334 | (error (setq entity (format "%s" err)))))) | ||
| 1335 | ;; Re-check ENTITY. It may be set to an error string. | ||
| 1336 | (when (stringp entity) | ||
| 1323 | ;; Decoding failed. ENTITY is an error message. Insert the | 1337 | ;; Decoding failed. ENTITY is an error message. Insert the |
| 1324 | ;; original message body as is, and show warning. | 1338 | ;; original message body as is, and show warning. |
| 1325 | (let ((region (with-current-buffer rmail-mime-mbox-buffer | 1339 | (let ((region (with-current-buffer rmail-mime-mbox-buffer |