aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Love2002-06-24 19:05:12 +0000
committerDave Love2002-06-24 19:05:12 +0000
commitc724d286c7a7d96d469ef1757496d8d930cb1f9f (patch)
tree3af6d613959dad60aa0a85c54b3c55b7787f47ab
parentc163613eac3f6f41bd7af86a2bf02b378ce412fa (diff)
downloademacs-c724d286c7a7d96d469ef1757496d8d930cb1f9f.tar.gz
emacs-c724d286c7a7d96d469ef1757496d8d930cb1f9f.zip
(mm-body-7-or-8): Don't special-case Mule.
(mm-encode-body): Just call mm-encode-coding-region in encoding case.
-rw-r--r--lisp/gnus/mm-bodies.el61
1 files changed, 13 insertions, 48 deletions
diff --git a/lisp/gnus/mm-bodies.el b/lisp/gnus/mm-bodies.el
index 51a16a6a7f1..36590572e27 100644
--- a/lisp/gnus/mm-bodies.el
+++ b/lisp/gnus/mm-bodies.el
@@ -56,8 +56,8 @@ Valid encodings are `7bit', `8bit', `quoted-printable' and `base64'."
56(defun mm-encode-body () 56(defun mm-encode-body ()
57 "Encode a body. 57 "Encode a body.
58Should be called narrowed to the body that is to be encoded. 58Should be called narrowed to the body that is to be encoded.
59If there is more than one non-ASCII MULE charset, then list of found 59If there is more than one non-ASCII Mule charset, then list of found
60MULE charsets are returned. 60Mule charsets are returned.
61If successful, the MIME charset is returned. 61If successful, the MIME charset is returned.
62If no encoding was done, nil is returned." 62If no encoding was done, nil is returned."
63 (if (not (mm-multibyte-p)) 63 (if (not (mm-multibyte-p))
@@ -73,8 +73,7 @@ If no encoding was done, nil is returned."
73 nil)) 73 nil))
74 (save-excursion 74 (save-excursion
75 (goto-char (point-min)) 75 (goto-char (point-min))
76 (let ((charsets (mm-find-mime-charset-region (point-min) (point-max))) 76 (let ((charsets (mm-find-mime-charset-region (point-min) (point-max))))
77 charset)
78 (cond 77 (cond
79 ;; No encoding. 78 ;; No encoding.
80 ((null charsets) 79 ((null charsets)
@@ -84,29 +83,10 @@ If no encoding was done, nil is returned."
84 charsets) 83 charsets)
85 ;; We encode. 84 ;; We encode.
86 (t 85 (t
87 (let ((charset (car charsets)) 86 (mm-encode-coding-region (point-min) (point-max)
88 start) 87 (mm-charset-to-coding-system
89 (when (or t 88 (car charsets)))
90 ;; We always decode. 89 (car charsets)))))))
91 (not (mm-coding-system-equal
92 charset buffer-file-coding-system)))
93 (while (not (eobp))
94 (if (eq (mm-charset-after) 'ascii)
95 (when start
96 (save-restriction
97 (narrow-to-region start (point))
98 (mm-encode-coding-region
99 start (point) (mm-charset-to-coding-system charset))
100 (goto-char (point-max)))
101 (setq start nil))
102 (unless start
103 (setq start (point))))
104 (forward-char 1))
105 (when start
106 (mm-encode-coding-region start (point)
107 (mm-charset-to-coding-system charset))
108 (setq start nil)))
109 charset)))))))
110 90
111(eval-when-compile (defvar message-posting-charset)) 91(eval-when-compile (defvar message-posting-charset))
112 92
@@ -133,27 +113,12 @@ If no encoding was done, nil is returned."
133 113
134(defun mm-body-7-or-8 () 114(defun mm-body-7-or-8 ()
135 "Say whether the body is 7bit or 8bit." 115 "Say whether the body is 7bit or 8bit."
136 (cond 116 (if (save-excursion
137 ((not (featurep 'mule)) 117 (goto-char (point-min))
138 (if (save-excursion 118 (skip-chars-forward mm-7bit-chars)
139 (goto-char (point-min)) 119 (eobp))
140 (skip-chars-forward mm-7bit-chars) 120 '7bit
141 (eobp)) 121 '8bit))
142 '7bit
143 '8bit))
144 (t
145 ;; Mule version
146 (if (and (null (delq 'ascii
147 (mm-find-charset-region (point-min) (point-max))))
148 ;;!!!The following is necessary because the function
149 ;;!!!above seems to return the wrong result under
150 ;;!!!Emacs 20.3. Sometimes.
151 (save-excursion
152 (goto-char (point-min))
153 (skip-chars-forward mm-7bit-chars)
154 (eobp)))
155 '7bit
156 '8bit))))
157 122
158;;; 123;;;
159;;; Functions for decoding 124;;; Functions for decoding