X-Git-Url: https://code.delx.au/gnu-emacs/blobdiff_plain/d709390421bc438bfcf6d24e4f07a51e20c84fa1..65e86587ab836aaa86b12ce30b219bcb4fcbaa06:/lisp/gnus/rfc2047.el diff --git a/lisp/gnus/rfc2047.el b/lisp/gnus/rfc2047.el index cda7979252..4fd60ed8f7 100644 --- a/lisp/gnus/rfc2047.el +++ b/lisp/gnus/rfc2047.el @@ -1,6 +1,6 @@ ;;; rfc2047.el --- functions for encoding and decoding rfc2047 messages -;; Copyright (C) 1998, 1999, 2000, 2002, 2003, 2004, +;; Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, ;; 2005, 2006 Free Software Foundation, Inc. ;; Author: Lars Magne Ingebrigtsen @@ -178,30 +178,32 @@ Quoting will not be done in a quoted string if it contains characters 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)) + (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) - (unless (and (eq (char-before) ?\\) ;; Already quoted. - (looking-at tspecials)) + (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 "\\"))) - (forward-char))))) + (insert "\\") + (forward-char)))) + (forward-char))) (error (goto-char beg))))))))