[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] master c311723 07/12: Remove compat code from rfc2047
From: |
Lars Ingebrigtsen |
Subject: |
[Emacs-diffs] master c311723 07/12: Remove compat code from rfc2047 |
Date: |
Sun, 14 Feb 2016 04:18:04 +0000 |
branch: master
commit c311723eee7278a0da036adc684290ea1690f35d
Author: Lars Ingebrigtsen <address@hidden>
Commit: Lars Ingebrigtsen <address@hidden>
Remove compat code from rfc2047
* lisp/gnus/rfc2047.el (rfc2047-encode-message-header): Remove
compat code.
(rfc2047-decode-string): Ditto.
---
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 b05dfc1..4cb10e5 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."
(let ((rfc2047-encoding-type 'mime))
(rfc2047-encode-region (point) (point-max))))
((eq method 'default)
- (if (and (featurep 'mule)
- (if (boundp 'enable-multibyte-characters)
- (default-value 'enable-multibyte-characters))
+ (if (and (default-value 'enable-multibyte-characters)
mail-parse-charset)
(encode-coding-region (point) (point-max)
mail-parse-charset)))
@@ -317,11 +315,8 @@ Should be called narrowed to the head of the message."
;;; (rfc2047-encode-region (point-min) (point-max))
;;; (error "Cannot send unencoded text")))
((mm-coding-system-p method)
- (if (or (and (featurep 'mule)
- (if (boundp 'enable-multibyte-characters)
- (default-value 'enable-multibyte-characters)))
- (featurep 'file-coding))
- (encode-coding-region (point) (point-max) method)))
+ (when (default-value 'enable-multibyte-characters)
+ (encode-coding-region (point) (point-max) method)))
;; Hm.
(t)))
(goto-char (point-max))))))))
@@ -1103,49 +1098,47 @@ strings are stripped."
"Decode MIME-encoded STRING and return the result.
If ADDRESS-MIME is non-nil, strip backslashes which precede characters
other than `\"' and `\\' in quoted strings."
- ;; (let ((m (mm-multibyte-p)))
- (if (string-match "=\\?" string)
- (with-temp-buffer
- ;; We used to only call mm-enable-multibyte if `m' is non-nil,
- ;; but this can't be the right criterion. Don't just revert this
- ;; change if it encounters a bug. Please help me fix it
- ;; right instead. --Stef
- ;; The string returned should always be multibyte in a multibyte
- ;; session, i.e. the buffer should be multibyte before
- ;; `buffer-string' is called.
- (mm-enable-multibyte)
- (insert string)
- (inline
- (rfc2047-decode-region (point-min) (point-max) address-mime))
- (buffer-string))
- (when address-mime
- (setq string
- (with-temp-buffer
- (when (multibyte-string-p string)
- (mm-enable-multibyte))
- (insert string)
- (rfc2047-strip-backslashes-in-quoted-strings)
- (buffer-string))))
- ;; Fixme: As above, `m' here is inappropriate.
- (if (and ;; m
- mail-parse-charset
- (not (eq mail-parse-charset 'us-ascii))
- (not (eq mail-parse-charset 'gnus-decoded)))
- ;; `decode-coding-string' in Emacs offers a third optional
- ;; arg NOCOPY to avoid consing a new string if the decoding
- ;; is "trivial". Unfortunately it currently doesn't
- ;; consider anything else than a nil coding system
- ;; trivial.
- ;; `rfc2047-decode-string' is called multiple times for each
- ;; article during summary buffer generation, and we really
- ;; want to avoid unnecessary consing. So we bypass
- ;; `decode-coding-string' if the string is purely ASCII.
- (if (and (fboundp 'detect-coding-string)
- ;; string is purely ASCII
- (eq (detect-coding-string string t) 'undecided))
- string
- (decode-coding-string string mail-parse-charset))
- (string-to-multibyte string)))) ;; )
+ (if (string-match "=\\?" string)
+ (with-temp-buffer
+ ;; We used to only call mm-enable-multibyte if `m' is non-nil,
+ ;; but this can't be the right criterion. Don't just revert this
+ ;; change if it encounters a bug. Please help me fix it
+ ;; right instead. --Stef
+ ;; The string returned should always be multibyte in a multibyte
+ ;; session, i.e. the buffer should be multibyte before
+ ;; `buffer-string' is called.
+ (mm-enable-multibyte)
+ (insert string)
+ (inline
+ (rfc2047-decode-region (point-min) (point-max) address-mime))
+ (buffer-string))
+ (when address-mime
+ (setq string
+ (with-temp-buffer
+ (when (multibyte-string-p string)
+ (mm-enable-multibyte))
+ (insert string)
+ (rfc2047-strip-backslashes-in-quoted-strings)
+ (buffer-string))))
+ ;; Fixme: As above, `m' here is inappropriate.
+ (if (and ;; m
+ mail-parse-charset
+ (not (eq mail-parse-charset 'us-ascii))
+ (not (eq mail-parse-charset 'gnus-decoded)))
+ ;; `decode-coding-string' in Emacs offers a third optional
+ ;; arg NOCOPY to avoid consing a new string if the decoding
+ ;; is "trivial". Unfortunately it currently doesn't
+ ;; consider anything else than a nil coding system
+ ;; trivial.
+ ;; `rfc2047-decode-string' is called multiple times for each
+ ;; article during summary buffer generation, and we really
+ ;; want to avoid unnecessary consing. So we bypass
+ ;; `decode-coding-string' if the string is purely ASCII.
+ (if (eq (detect-coding-string string t) 'undecided)
+ ;; string is purely ASCII
+ string
+ (decode-coding-string string mail-parse-charset))
+ (string-to-multibyte string))))
(defun rfc2047-decode-address-string (string)
"Decode MIME-encoded STRING and return the result.
- [Emacs-diffs] master updated (8e14ce4 -> 598ff23), Lars Ingebrigtsen, 2016/02/13
- [Emacs-diffs] master b9baa80 01/12: Remove compat code and functions from message.el, Lars Ingebrigtsen, 2016/02/13
- [Emacs-diffs] master 014e0d1 02/12: Remove some compat code from mm-*.el, Lars Ingebrigtsen, 2016/02/13
- [Emacs-diffs] master 8f597e9 03/12: Remove compat code and compat functions from mm-util.el, Lars Ingebrigtsen, 2016/02/13
- [Emacs-diffs] master f3cdf9c 04/12: Remove compat code from some mml files, Lars Ingebrigtsen, 2016/02/13
- [Emacs-diffs] master 2366c70 05/12: Remove compat code in Gnus backends, Lars Ingebrigtsen, 2016/02/13
- [Emacs-diffs] master 374c21d 06/12: Remove compat function from pop3, Lars Ingebrigtsen, 2016/02/13
- [Emacs-diffs] master c311723 07/12: Remove compat code from rfc2047,
Lars Ingebrigtsen <=
- [Emacs-diffs] master f322abc 08/12: Remove compat code from smiley, Lars Ingebrigtsen, 2016/02/13
- [Emacs-diffs] master 928bb3f 09/12: Remove compat functions from smime.el, Lars Ingebrigtsen, 2016/02/13
- [Emacs-diffs] master 19d298f 10/12: Remove compat functions from starttls.el, Lars Ingebrigtsen, 2016/02/13
- [Emacs-diffs] master 920414f 11/12: Remove compat code that relies on (featurep 'mule), Lars Ingebrigtsen, 2016/02/13
- [Emacs-diffs] master 598ff23 12/12: Use open-network-stream instead of open-protocol-stream, Lars Ingebrigtsen, 2016/02/13