aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEli Zaretskii2009-02-07 15:16:57 +0000
committerEli Zaretskii2009-02-07 15:16:57 +0000
commit782c80e89204cbf2c9559ec49d1ebd3ea7fcc9ad (patch)
tree03c7c06ea273e3a863b393f1e677ecb31cac2265
parent201af049c37b7444280b2e25d1a0d9f4d45ba7c6 (diff)
downloademacs-782c80e89204cbf2c9559ec49d1ebd3ea7fcc9ad.tar.gz
emacs-782c80e89204cbf2c9559ec49d1ebd3ea7fcc9ad.zip
(rmail-cease-edit): Look for the message's encoding, and its
"content-transfer-encoding" and "content-type" headers only in the headers' portion. (Bug#2017)
-rw-r--r--lisp/ChangeLog6
-rw-r--r--lisp/mail/rmailedit.el30
2 files changed, 25 insertions, 11 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 02fab5292c9..cb04a520e5f 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,9 @@
12009-02-07 Eli Zaretskii <eliz@gnu.org>
2
3 * mail/rmailedit.el (rmail-cease-edit): Look for the message's
4 encoding, and its "content-transfer-encoding" and "content-type"
5 headers only in the headers' portion. (Bug#2017)
6
12009-02-07 Ulf Jasper <ulf.jasper@web.de> 72009-02-07 Ulf Jasper <ulf.jasper@web.de>
2 8
3 * net/newst-treeview.el 9 * net/newst-treeview.el
diff --git a/lisp/mail/rmailedit.el b/lisp/mail/rmailedit.el
index 44f749fdc05..8a5b53b421e 100644
--- a/lisp/mail/rmailedit.el
+++ b/lisp/mail/rmailedit.el
@@ -124,7 +124,7 @@ This functions runs the normal hook `rmail-edit-mode-hook'.
124 (insert "\n"))) 124 (insert "\n")))
125 (let ((old rmail-old-text) 125 (let ((old rmail-old-text)
126 character-coding is-text-message coding-system 126 character-coding is-text-message coding-system
127 headers-end) 127 headers-end limit)
128 ;; Go back to Rmail mode, but carefully. 128 ;; Go back to Rmail mode, but carefully.
129 (force-mode-line-update) 129 (force-mode-line-update)
130 (let ((rmail-buffer-swapped nil)) ; Prevent change-major-mode-hook 130 (let ((rmail-buffer-swapped nil)) ; Prevent change-major-mode-hook
@@ -146,16 +146,24 @@ This functions runs the normal hook `rmail-edit-mode-hook'.
146 (rmail-swap-buffers-maybe) 146 (rmail-swap-buffers-maybe)
147 147
148 (narrow-to-region (rmail-msgbeg rmail-current-message) 148 (narrow-to-region (rmail-msgbeg rmail-current-message)
149 (rmail-msgend rmail-current-message)) 149 (rmail-msgend rmail-current-message))
150 150
151 (setq character-coding (mail-fetch-field "content-transfer-encoding") 151 (save-restriction
152 is-text-message (rmail-is-text-p) 152 (setq limit
153 coding-system (rmail-get-coding-system)) 153 (save-excursion
154 (goto-char (point-min))
155 (search-forward "\n\n" nil t)))
156 ;; All 3 of the functions we call below assume the buffer was
157 ;; narrowed to just the headers of the message.
158 (narrow-to-region (rmail-msgbeg rmail-current-message) limit)
159 (setq character-coding
160 (mail-fetch-field "content-transfer-encoding")
161 is-text-message (rmail-is-text-p)
162 coding-system (rmail-get-coding-system)))
154 (if character-coding 163 (if character-coding
155 (setq character-coding (downcase character-coding))) 164 (setq character-coding (downcase character-coding)))
156 165
157 (goto-char (point-min)) 166 (goto-char limit)
158 (search-forward "\n\n")
159 (let ((inhibit-read-only t)) 167 (let ((inhibit-read-only t))
160 (let ((data-buffer (current-buffer)) 168 (let ((data-buffer (current-buffer))
161 (end (copy-marker (point) t))) 169 (end (copy-marker (point) t)))
@@ -164,14 +172,14 @@ This functions runs the normal hook `rmail-edit-mode-hook'.
164 data-buffer)) 172 data-buffer))
165 (delete-region end (point-max))) 173 (delete-region end (point-max)))
166 174
167 ;; Re-encode the message body in whatever 175 ;; Re-apply content-transfer-encoding, if any, on the message
168 ;; way it was decoded. 176 ;; body.
169 (cond 177 (cond
170 ((string= character-coding "quoted-printable") 178 ((string= character-coding "quoted-printable")
171 (mail-quote-printable-region (point) (point-max))) 179 (mail-quote-printable-region (point) (point-max)))
172 ((and (string= character-coding "base64") is-text-message) 180 ((and (string= character-coding "base64") is-text-message)
173 (base64-encode-region (point) (point-max))) 181 (base64-encode-region (point) (point-max)))
174 ((eq character-coding 'uuencode) 182 ((and (eq character-coding 'uuencode) is-text-message)
175 (error "uuencoded messages are not supported yet."))) 183 (error "uuencoded messages are not supported yet.")))
176 )) 184 ))
177 185