# HG changeset patch # User Katsumi Yamaoka # Date 1258495840 0 # Node ID fc3c7104330dcc1ce6057108e536527959a2a85f # Parent 8c46fe65b4c6f523f713bcb122d66cbe696282c8 (rfc2047-decode-region): Don't quote decoded words containing tspecial characters if they have been already quoted. -- Synch with Gnus trunk. diff -r 8c46fe65b4c6 -r fc3c7104330d lisp/gnus/ChangeLog --- a/lisp/gnus/ChangeLog Tue Nov 17 21:57:48 2009 +0000 +++ b/lisp/gnus/ChangeLog Tue Nov 17 22:10:40 2009 +0000 @@ -1,3 +1,8 @@ +2009-11-17 Katsumi Yamaoka + + * rfc2047.el (rfc2047-decode-region): Don't quote decoded words + containing tspecial characters if they have been already quoted. + 2009-10-24 Glenn Morris * gnus-art.el (help-xref-stack-item): Define for compiler. diff -r 8c46fe65b4c6 -r fc3c7104330d lisp/gnus/rfc2047.el --- a/lisp/gnus/rfc2047.el Tue Nov 17 21:57:48 2009 +0000 +++ b/lisp/gnus/rfc2047.el Tue Nov 17 22:10:40 2009 +0000 @@ -1026,6 +1026,7 @@ ;; things essentially must not be there. (while (re-search-forward "[\n\r]+" nil t) (replace-match " ")) + (setq end (point-max)) ;; Quote decoded words if there are special characters ;; which might violate RFC2822. (when (and rfc2047-quote-decoded-words-containing-tspecials @@ -1035,10 +1036,15 @@ (when regexp (save-restriction (widen) - (beginning-of-line) - (while (and (memq (char-after) '(? ?\t)) - (zerop (forward-line -1)))) - (looking-at regexp))))) + (and + ;; Don't quote words if already quoted. + (not (and (eq (char-before e) ?\") + (eq (char-after end) ?\"))) + (progn + (beginning-of-line) + (while (and (memq (char-after) '(? ?\t)) + (zerop (forward-line -1)))) + (looking-at regexp))))))) (let (quoted) (goto-char e) (skip-chars-forward " \t")