diff options
| author | Stefan Monnier | 2008-03-12 18:30:52 +0000 |
|---|---|---|
| committer | Stefan Monnier | 2008-03-12 18:30:52 +0000 |
| commit | d4eb2b7e39d6b6ee1bee4be0b0d53a3f3202da5a (patch) | |
| tree | f2ee38b568448d332618928fb669f523c692d141 | |
| parent | 228b6ecd21215cfb3296a643fb8fe065b1683c42 (diff) | |
| download | emacs-d4eb2b7e39d6b6ee1bee4be0b0d53a3f3202da5a.tar.gz emacs-d4eb2b7e39d6b6ee1bee4be0b0d53a3f3202da5a.zip | |
(mm-with-part): Set the buffer to unibyte before inserting
the handle-buffer's text, so the implicit multibyte->unibyte conversion
uses string-make-unibyte rather than string-as-unibyte.
| -rw-r--r-- | lisp/gnus/ChangeLog | 4 | ||||
| -rw-r--r-- | lisp/gnus/mm-decode.el | 26 |
2 files changed, 16 insertions, 14 deletions
diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog index e1ea5e7c6c5..21d531f59f7 100644 --- a/lisp/gnus/ChangeLog +++ b/lisp/gnus/ChangeLog | |||
| @@ -1,5 +1,9 @@ | |||
| 1 | 2008-03-12 Stefan Monnier <monnier@iro.umontreal.ca> | 1 | 2008-03-12 Stefan Monnier <monnier@iro.umontreal.ca> |
| 2 | 2 | ||
| 3 | * mm-decode.el (mm-with-part): Set the buffer to unibyte before inserting | ||
| 4 | the handle-buffer's text, so the implicit multibyte->unibyte conversion | ||
| 5 | uses string-make-unibyte rather than string-as-unibyte. | ||
| 6 | |||
| 3 | * gnus-msg.el: Use with-current-buffer. | 7 | * gnus-msg.el: Use with-current-buffer. |
| 4 | 8 | ||
| 5 | * message.el (message-ignored-resent-headers): Add "Delivered-To". | 9 | * message.el (message-ignored-resent-headers): Add "Delivered-To". |
diff --git a/lisp/gnus/mm-decode.el b/lisp/gnus/mm-decode.el index 46bf4b8d8fe..331174ef2cf 100644 --- a/lisp/gnus/mm-decode.el +++ b/lisp/gnus/mm-decode.el | |||
| @@ -663,11 +663,11 @@ Postpone undisplaying of viewers for types in | |||
| 663 | 663 | ||
| 664 | (defun mm-copy-to-buffer () | 664 | (defun mm-copy-to-buffer () |
| 665 | "Copy the contents of the current buffer to a fresh buffer." | 665 | "Copy the contents of the current buffer to a fresh buffer." |
| 666 | (let ((obuf (current-buffer)) | 666 | (let ((obuf (current-buffer)) |
| 667 | beg) | 667 | beg) |
| 668 | (goto-char (point-min)) | 668 | (goto-char (point-min)) |
| 669 | (search-forward-regexp "^\n" nil t) | 669 | (search-forward-regexp "^\n" nil t) |
| 670 | (setq beg (point)) | 670 | (setq beg (point)) |
| 671 | (with-current-buffer | 671 | (with-current-buffer |
| 672 | ;; Preserve the data's unibyteness (for url-insert-file-contents). | 672 | ;; Preserve the data's unibyteness (for url-insert-file-contents). |
| 673 | (let ((default-enable-multibyte-characters (mm-multibyte-p))) | 673 | (let ((default-enable-multibyte-characters (mm-multibyte-p))) |
| @@ -1127,17 +1127,15 @@ in HANDLE." | |||
| 1127 | 1127 | ||
| 1128 | (defmacro mm-with-part (handle &rest forms) | 1128 | (defmacro mm-with-part (handle &rest forms) |
| 1129 | "Run FORMS in the temp buffer containing the contents of HANDLE." | 1129 | "Run FORMS in the temp buffer containing the contents of HANDLE." |
| 1130 | `(let* ((handle ,handle) | 1130 | ;; The handle-buffer's content is a sequence of bytes, not a sequence of |
| 1131 | ;; The multibyteness of the temp buffer should be turned on | 1131 | ;; chars, so the buffer should be unibyte. It may happen that the |
| 1132 | ;; if inserting a multibyte string. Contrarily, the buffer's | 1132 | ;; handle-buffer is multibyte for some reason, in which case now is a good |
| 1133 | ;; multibyteness should be off if inserting a unibyte string, | 1133 | ;; time to adjust it, since we know at this point that it should |
| 1134 | ;; especially if a string contains 8bit data. | 1134 | ;; be unibyte. |
| 1135 | (default-enable-multibyte-characters | 1135 | `(let* ((handle ,handle)) |
| 1136 | (with-current-buffer (mm-handle-buffer handle) | ||
| 1137 | (mm-multibyte-p)))) | ||
| 1138 | (with-temp-buffer | 1136 | (with-temp-buffer |
| 1139 | (insert-buffer-substring (mm-handle-buffer handle)) | ||
| 1140 | (mm-disable-multibyte) | 1137 | (mm-disable-multibyte) |
| 1138 | (insert-buffer-substring (mm-handle-buffer handle)) | ||
| 1141 | (mm-decode-content-transfer-encoding | 1139 | (mm-decode-content-transfer-encoding |
| 1142 | (mm-handle-encoding handle) | 1140 | (mm-handle-encoding handle) |
| 1143 | (mm-handle-media-type handle)) | 1141 | (mm-handle-media-type handle)) |