Changes committed gnus/lisp (ChangeLog rfc2047.el)

"Katsumi Yamaoka" <[email protected]> Tue, 17 Nov 2009 03:22:49 +0100
Newsgroups gmane.emacs.gnus.commits
Message-ID <[email protected]>
Modified: ChangeLog rfc2047.el

(rfc2047-decode-region): Don't quote decoded words containing tspecial
 characters if they have been already quoted.


Index: ChangeLog
diff -u gnus/lisp/ChangeLog:7.2034 gnus/lisp/ChangeLog:7.2035
--- ChangeLog:7.2034	Mon Nov  9 05:15:08 2009
+++ ChangeLog	Tue Nov 17 03:22:49 2009
@@ -1,3 +1,8 @@
+2009-11-17  Katsumi Yamaoka  <[email protected]>
+
+	* rfc2047.el (rfc2047-decode-region): Don't quote decoded words
+	containing tspecial characters if they have been already quoted.
+
 2009-11-05  Dan Nicolaescu  <[email protected]>
 
 	* dns-mode.el (auto-mode-alist): Purecopy string.
Index: rfc2047.el
diff -u gnus/lisp/rfc2047.el:7.76 gnus/lisp/rfc2047.el:7.77
--- rfc2047.el:7.76	Wed Sep  9 11:31:35 2009
+++ rfc2047.el	Tue Nov 17 03:22:49 2009
@@ -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")