diff options
| author | Lars Ingebrigtsen | 2016-02-14 14:54:28 +1100 |
|---|---|---|
| committer | Lars Ingebrigtsen | 2016-02-14 14:54:28 +1100 |
| commit | c311723eee7278a0da036adc684290ea1690f35d (patch) | |
| tree | 356201765457ed380a7a4a82e5f974414dac8bc8 | |
| parent | 374c21d59a3e2b8a49c7e4ecc466edb5313dbb98 (diff) | |
| download | emacs-c311723eee7278a0da036adc684290ea1690f35d.tar.gz emacs-c311723eee7278a0da036adc684290ea1690f35d.zip | |
Remove compat code from rfc2047
* lisp/gnus/rfc2047.el (rfc2047-encode-message-header): Remove
compat code.
(rfc2047-decode-string): Ditto.
| -rw-r--r-- | lisp/gnus/rfc2047.el | 95 |
1 files changed, 44 insertions, 51 deletions
diff --git a/lisp/gnus/rfc2047.el b/lisp/gnus/rfc2047.el index b05dfc1e109..4cb10e54393 100644 --- a/lisp/gnus/rfc2047.el +++ b/lisp/gnus/rfc2047.el | |||
| @@ -290,9 +290,7 @@ Should be called narrowed to the head of the message." | |||
| 290 | (let ((rfc2047-encoding-type 'mime)) | 290 | (let ((rfc2047-encoding-type 'mime)) |
| 291 | (rfc2047-encode-region (point) (point-max)))) | 291 | (rfc2047-encode-region (point) (point-max)))) |
| 292 | ((eq method 'default) | 292 | ((eq method 'default) |
| 293 | (if (and (featurep 'mule) | 293 | (if (and (default-value 'enable-multibyte-characters) |
| 294 | (if (boundp 'enable-multibyte-characters) | ||
| 295 | (default-value 'enable-multibyte-characters)) | ||
| 296 | mail-parse-charset) | 294 | mail-parse-charset) |
| 297 | (encode-coding-region (point) (point-max) | 295 | (encode-coding-region (point) (point-max) |
| 298 | mail-parse-charset))) | 296 | mail-parse-charset))) |
| @@ -317,11 +315,8 @@ Should be called narrowed to the head of the message." | |||
| 317 | ;;; (rfc2047-encode-region (point-min) (point-max)) | 315 | ;;; (rfc2047-encode-region (point-min) (point-max)) |
| 318 | ;;; (error "Cannot send unencoded text"))) | 316 | ;;; (error "Cannot send unencoded text"))) |
| 319 | ((mm-coding-system-p method) | 317 | ((mm-coding-system-p method) |
| 320 | (if (or (and (featurep 'mule) | 318 | (when (default-value 'enable-multibyte-characters) |
| 321 | (if (boundp 'enable-multibyte-characters) | 319 | (encode-coding-region (point) (point-max) method))) |
| 322 | (default-value 'enable-multibyte-characters))) | ||
| 323 | (featurep 'file-coding)) | ||
| 324 | (encode-coding-region (point) (point-max) method))) | ||
| 325 | ;; Hm. | 320 | ;; Hm. |
| 326 | (t))) | 321 | (t))) |
| 327 | (goto-char (point-max)))))))) | 322 | (goto-char (point-max)))))))) |
| @@ -1103,49 +1098,47 @@ strings are stripped." | |||
| 1103 | "Decode MIME-encoded STRING and return the result. | 1098 | "Decode MIME-encoded STRING and return the result. |
| 1104 | If ADDRESS-MIME is non-nil, strip backslashes which precede characters | 1099 | If ADDRESS-MIME is non-nil, strip backslashes which precede characters |
| 1105 | other than `\"' and `\\' in quoted strings." | 1100 | other than `\"' and `\\' in quoted strings." |
| 1106 | ;; (let ((m (mm-multibyte-p))) | 1101 | (if (string-match "=\\?" string) |
| 1107 | (if (string-match "=\\?" string) | 1102 | (with-temp-buffer |
| 1108 | (with-temp-buffer | 1103 | ;; We used to only call mm-enable-multibyte if `m' is non-nil, |
| 1109 | ;; We used to only call mm-enable-multibyte if `m' is non-nil, | 1104 | ;; but this can't be the right criterion. Don't just revert this |
| 1110 | ;; but this can't be the right criterion. Don't just revert this | 1105 | ;; change if it encounters a bug. Please help me fix it |
| 1111 | ;; change if it encounters a bug. Please help me fix it | 1106 | ;; right instead. --Stef |
| 1112 | ;; right instead. --Stef | 1107 | ;; The string returned should always be multibyte in a multibyte |
| 1113 | ;; The string returned should always be multibyte in a multibyte | 1108 | ;; session, i.e. the buffer should be multibyte before |
| 1114 | ;; session, i.e. the buffer should be multibyte before | 1109 | ;; `buffer-string' is called. |
| 1115 | ;; `buffer-string' is called. | 1110 | (mm-enable-multibyte) |
| 1116 | (mm-enable-multibyte) | 1111 | (insert string) |
| 1117 | (insert string) | 1112 | (inline |
| 1118 | (inline | 1113 | (rfc2047-decode-region (point-min) (point-max) address-mime)) |
| 1119 | (rfc2047-decode-region (point-min) (point-max) address-mime)) | 1114 | (buffer-string)) |
| 1120 | (buffer-string)) | 1115 | (when address-mime |
| 1121 | (when address-mime | 1116 | (setq string |
| 1122 | (setq string | 1117 | (with-temp-buffer |
| 1123 | (with-temp-buffer | 1118 | (when (multibyte-string-p string) |
| 1124 | (when (multibyte-string-p string) | 1119 | (mm-enable-multibyte)) |
| 1125 | (mm-enable-multibyte)) | 1120 | (insert string) |
| 1126 | (insert string) | 1121 | (rfc2047-strip-backslashes-in-quoted-strings) |
| 1127 | (rfc2047-strip-backslashes-in-quoted-strings) | 1122 | (buffer-string)))) |
| 1128 | (buffer-string)))) | 1123 | ;; Fixme: As above, `m' here is inappropriate. |
| 1129 | ;; Fixme: As above, `m' here is inappropriate. | 1124 | (if (and ;; m |
| 1130 | (if (and ;; m | 1125 | mail-parse-charset |
| 1131 | mail-parse-charset | 1126 | (not (eq mail-parse-charset 'us-ascii)) |
| 1132 | (not (eq mail-parse-charset 'us-ascii)) | 1127 | (not (eq mail-parse-charset 'gnus-decoded))) |
| 1133 | (not (eq mail-parse-charset 'gnus-decoded))) | 1128 | ;; `decode-coding-string' in Emacs offers a third optional |
| 1134 | ;; `decode-coding-string' in Emacs offers a third optional | 1129 | ;; arg NOCOPY to avoid consing a new string if the decoding |
| 1135 | ;; arg NOCOPY to avoid consing a new string if the decoding | 1130 | ;; is "trivial". Unfortunately it currently doesn't |
| 1136 | ;; is "trivial". Unfortunately it currently doesn't | 1131 | ;; consider anything else than a nil coding system |
| 1137 | ;; consider anything else than a nil coding system | 1132 | ;; trivial. |
| 1138 | ;; trivial. | 1133 | ;; `rfc2047-decode-string' is called multiple times for each |
| 1139 | ;; `rfc2047-decode-string' is called multiple times for each | 1134 | ;; article during summary buffer generation, and we really |
| 1140 | ;; article during summary buffer generation, and we really | 1135 | ;; want to avoid unnecessary consing. So we bypass |
| 1141 | ;; want to avoid unnecessary consing. So we bypass | 1136 | ;; `decode-coding-string' if the string is purely ASCII. |
| 1142 | ;; `decode-coding-string' if the string is purely ASCII. | 1137 | (if (eq (detect-coding-string string t) 'undecided) |
| 1143 | (if (and (fboundp 'detect-coding-string) | 1138 | ;; string is purely ASCII |
| 1144 | ;; string is purely ASCII | 1139 | string |
| 1145 | (eq (detect-coding-string string t) 'undecided)) | 1140 | (decode-coding-string string mail-parse-charset)) |
| 1146 | string | 1141 | (string-to-multibyte string)))) |
| 1147 | (decode-coding-string string mail-parse-charset)) | ||
| 1148 | (string-to-multibyte string)))) ;; ) | ||
| 1149 | 1142 | ||
| 1150 | (defun rfc2047-decode-address-string (string) | 1143 | (defun rfc2047-decode-address-string (string) |
| 1151 | "Decode MIME-encoded STRING and return the result. | 1144 | "Decode MIME-encoded STRING and return the result. |