diff options
| -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 d2ab4b60c8b..d35f5475bbc 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,9 @@ | |||
| 1 | 2012-05-03 Kenichi Handa <handa@m17n.org> | ||
| 2 | |||
| 3 | * mail/rmailmm.el (rmail-show-mime): Catch an error caused by text | ||
| 4 | decoding, and show a warning message without signalling an error | ||
| 5 | (Bug#11282). | ||
| 6 | |||
| 1 | 2012-05-02 Juanma Barranquero <lekktu@gmail.com> | 7 | 2012-05-02 Juanma Barranquero <lekktu@gmail.com> |
| 2 | 8 | ||
| 3 | * notifications.el (dbus-debug): | 9 | * notifications.el (dbus-debug): |
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 |