diff options
| author | Katsumi Yamaoka | 2019-11-14 08:05:05 +0000 |
|---|---|---|
| committer | Katsumi Yamaoka | 2019-11-14 08:05:05 +0000 |
| commit | 7a1f401b8341f363f2c6b9e58344dc2738259ddc (patch) | |
| tree | 6b0f10d07920d89f04756325ad0bdcc7f4f19b33 | |
| parent | fd60824be998d47baa19cee317c96d1c7c97251b (diff) | |
| download | emacs-7a1f401b8341f363f2c6b9e58344dc2738259ddc.tar.gz emacs-7a1f401b8341f363f2c6b9e58344dc2738259ddc.zip | |
Remove rfc2047-quote-special-characters-in-quoted-strings (bug#38200)
* lisp/mail/rfc2047.el
(rfc2047-quote-special-characters-in-quoted-strings): Remove function.
(rfc2047-encode-message-header, rfc2047-encode-region): Don't use it.
| -rw-r--r-- | lisp/mail/rfc2047.el | 72 |
1 files changed, 9 insertions, 63 deletions
diff --git a/lisp/mail/rfc2047.el b/lisp/mail/rfc2047.el index 188e5dc3969..8229bebfd67 100644 --- a/lisp/mail/rfc2047.el +++ b/lisp/mail/rfc2047.el | |||
| @@ -184,55 +184,6 @@ This is either `base64' or `quoted-printable'." | |||
| 184 | (re-search-forward ":[ \t\n]*" nil t) | 184 | (re-search-forward ":[ \t\n]*" nil t) |
| 185 | (buffer-substring-no-properties (point) (point-max))))) | 185 | (buffer-substring-no-properties (point) (point-max))))) |
| 186 | 186 | ||
| 187 | (defun rfc2047-quote-special-characters-in-quoted-strings (&optional | ||
| 188 | encodable-regexp) | ||
| 189 | "Quote special characters with `\\'s in quoted strings. | ||
| 190 | Quoting will not be done in a quoted string if it contains characters | ||
| 191 | matching ENCODABLE-REGEXP or it is within parentheses." | ||
| 192 | (goto-char (point-min)) | ||
| 193 | (let ((tspecials (concat "[" ietf-drums-tspecials "]")) | ||
| 194 | (start (point)) | ||
| 195 | beg end) | ||
| 196 | (with-syntax-table (standard-syntax-table) | ||
| 197 | (while (not (eobp)) | ||
| 198 | (if (ignore-errors | ||
| 199 | (forward-list 1) | ||
| 200 | (eq (char-before) ?\))) | ||
| 201 | (forward-list -1) | ||
| 202 | (goto-char (point-max))) | ||
| 203 | (save-restriction | ||
| 204 | (narrow-to-region start (point)) | ||
| 205 | (goto-char start) | ||
| 206 | (while (search-forward "\"" nil t) | ||
| 207 | (setq beg (match-beginning 0)) | ||
| 208 | (unless (eq (char-before beg) ?\\) | ||
| 209 | (goto-char beg) | ||
| 210 | (setq beg (1+ beg)) | ||
| 211 | (condition-case nil | ||
| 212 | (progn | ||
| 213 | (forward-sexp) | ||
| 214 | (setq end (1- (point))) | ||
| 215 | (goto-char beg) | ||
| 216 | (if (and encodable-regexp | ||
| 217 | (re-search-forward encodable-regexp end t)) | ||
| 218 | (goto-char (1+ end)) | ||
| 219 | (save-restriction | ||
| 220 | (narrow-to-region beg end) | ||
| 221 | (while (re-search-forward tspecials nil 'move) | ||
| 222 | (if (eq (char-before) ?\\) | ||
| 223 | (if (looking-at tspecials) ;; Already quoted. | ||
| 224 | (forward-char) | ||
| 225 | (insert "\\")) | ||
| 226 | (goto-char (match-beginning 0)) | ||
| 227 | (insert "\\") | ||
| 228 | (forward-char)))) | ||
| 229 | (forward-char))) | ||
| 230 | (error | ||
| 231 | (goto-char beg))))) | ||
| 232 | (goto-char (point-max))) | ||
| 233 | (forward-list 1) | ||
| 234 | (setq start (point)))))) | ||
| 235 | |||
| 236 | (defvar rfc2047-encoding-type 'address-mime | 187 | (defvar rfc2047-encoding-type 'address-mime |
| 237 | "The type of encoding done by `rfc2047-encode-region'. | 188 | "The type of encoding done by `rfc2047-encode-region'. |
| 238 | This should be dynamically bound around calls to | 189 | This should be dynamically bound around calls to |
| @@ -269,18 +220,15 @@ Should be called narrowed to the head of the message." | |||
| 269 | (setq alist nil | 220 | (setq alist nil |
| 270 | method (cdr elem)))) | 221 | method (cdr elem)))) |
| 271 | (if (not (rfc2047-encodable-p)) | 222 | (if (not (rfc2047-encodable-p)) |
| 272 | (prog2 | 223 | (if (and (eq (mm-body-7-or-8) '8bit) |
| 273 | (when (eq method 'address-mime) | 224 | (mm-multibyte-p) |
| 274 | (rfc2047-quote-special-characters-in-quoted-strings)) | 225 | (mm-coding-system-p |
| 275 | (if (and (eq (mm-body-7-or-8) '8bit) | 226 | (car message-posting-charset))) |
| 276 | (mm-multibyte-p) | 227 | ;; 8 bit must be decoded. |
| 277 | (mm-coding-system-p | 228 | (encode-coding-region |
| 278 | (car message-posting-charset))) | 229 | (point-min) (point-max) |
| 279 | ;; 8 bit must be decoded. | 230 | (mm-charset-to-coding-system |
| 280 | (encode-coding-region | 231 | (car message-posting-charset)))) |
| 281 | (point-min) (point-max) | ||
| 282 | (mm-charset-to-coding-system | ||
| 283 | (car message-posting-charset))))) | ||
| 284 | ;; We found something that may perhaps be encoded. | 232 | ;; We found something that may perhaps be encoded. |
| 285 | (re-search-forward "^[^:]+: *" nil t) | 233 | (re-search-forward "^[^:]+: *" nil t) |
| 286 | (cond | 234 | (cond |
| @@ -397,8 +345,6 @@ Dynamically bind `rfc2047-encoding-type' to change that." | |||
| 397 | (if (> (point) start) | 345 | (if (> (point) start) |
| 398 | (rfc2047-encode start (point)) | 346 | (rfc2047-encode start (point)) |
| 399 | (goto-char end)))) | 347 | (goto-char end)))) |
| 400 | ;; `address-mime' case -- take care of quoted words, comments. | ||
| 401 | (rfc2047-quote-special-characters-in-quoted-strings encodable-regexp) | ||
| 402 | (with-syntax-table rfc2047-syntax-table | 348 | (with-syntax-table rfc2047-syntax-table |
| 403 | (goto-char (point-min)) | 349 | (goto-char (point-min)) |
| 404 | (condition-case err ; in case of unbalanced quotes | 350 | (condition-case err ; in case of unbalanced quotes |