From 521c4a232934f0fc894008ace17f589e3f9c918a Mon Sep 17 00:00:00 2001
From: Andreas Schwab <schwab@suse.de>
Date: Sat, 27 Sep 2008 08:12:03 +0000
Subject: [PATCH] (gnus-split-references): Strip comments. (gnus-parent-id):
 Likewise.

---
 lisp/gnus/ChangeLog    | 5 +++++
 lisp/gnus/gnus-util.el | 7 ++++---
 2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog
index 1e66d688a23..8ba0d86a40c 100644
--- a/lisp/gnus/ChangeLog
+++ b/lisp/gnus/ChangeLog
@@ -1,3 +1,8 @@
+2008-09-27  Andreas Schwab  <schwab@suse.de>
+
+	* gnus-util.el (gnus-split-references): Strip comments.
+	(gnus-parent-id): Likewise.
+
 2008-09-25  Teodor Zlatanov  <tzz@lifelogs.com>
 
 	* message.el (message-confirm-send): Fixed variable documentation to
diff --git a/lisp/gnus/gnus-util.el b/lisp/gnus/gnus-util.el
index 129e1e641de..253366a4ea4 100644
--- a/lisp/gnus/gnus-util.el
+++ b/lisp/gnus/gnus-util.el
@@ -625,7 +625,7 @@ ARGS are passed to `message'."
 (defun gnus-split-references (references)
   "Return a list of Message-IDs in REFERENCES."
   (let ((beg 0)
-	(references (or references ""))
+	(references (mail-header-remove-comments (or references "")))
 	ids)
     (while (string-match "<[^<]+[^< \t]" references beg)
       (push (substring references (match-beginning 0) (setq beg (match-end 0)))
@@ -652,8 +652,9 @@ If N, return the Nth ancestor instead."
 	  (while (nthcdr n ids)
 	    (setq ids (cdr ids)))
 	  (car ids))
-      (when (string-match "\\(<[^<]+>\\)[ \t]*\\'" references)
-	(match-string 1 references)))))
+      (let ((references (mail-header-remove-comments references)))
+	(when (string-match "\\(<[^<]+>\\)[ \t]*\\'" references)
+	  (match-string 1 references))))))
 
 (defun gnus-buffer-live-p (buffer)
   "Say whether BUFFER is alive or not."
-- 
2.39.5