2006-09-07 Katsumi Yamaoka <yamaoka@jpl.org>
- * rfc2047.el (rfc2047-quote-special-characters-in-quoted-strings):
- Fix the way to find boundaries of quoted strings.
+ * rfc2047.el (rfc2047-quote-special-characters-in-quoted-strings): Fix
+ backslashes handling and the way to find boundaries of quoted strings.
2006-09-07 Daiki Ueno <ueno@unixuser.org>
matching ENCODABLE-REGEXP."
(goto-char (point-min))
(let ((tspecials (concat "[" ietf-drums-tspecials "]"))
- beg)
+ beg end)
(with-syntax-table (standard-syntax-table)
(while (search-forward "\"" nil t)
- (unless (eq (char-before) ?\\)
- (setq beg (match-end 0))
- (goto-char (match-beginning 0))
+ (setq beg (match-beginning 0))
+ (unless (eq (char-before beg) ?\\)
+ (goto-char beg)
+ (setq beg (1+ beg))
(condition-case nil
(progn
(forward-sexp)
- (save-restriction
- (narrow-to-region beg (1- (point)))
- (goto-char beg)
- (unless (and encodable-regexp
- (re-search-forward encodable-regexp nil t))
- (while (re-search-forward tspecials nil t)
- (unless (and (eq (char-before) ?\\) ;; Already quoted.
- (looking-at tspecials))
+ (setq end (1- (point)))
+ (goto-char beg)
+ (if (and encodable-regexp
+ (re-search-forward encodable-regexp end t))
+ (goto-char (1+ end))
+ (save-restriction
+ (narrow-to-region beg end)
+ (while (re-search-forward tspecials nil 'move)
+ (if (eq (char-before) ?\\)
+ (if (looking-at tspecials) ;; Already quoted.
+ (forward-char)
+ (insert "\\"))
(goto-char (match-beginning 0))
- (unless (or (eq (char-before) ?\\)
- (and rfc2047-encode-encoded-words
- (eq (char-after) ??)
- (eq (char-before) ?=)))
- (insert "\\"))
+ (insert "\\")
(forward-char))))
- (goto-char (point-max)))
- (forward-char))
+ (forward-char)))
(error
(goto-char beg))))))))