diff lisp/gnus/gnus-util.el @ 90667:dbe3f29e61d6

Merge from emacs--devo--0 Patches applied: * emacs--devo--0 (patch 505-522) - Update from CVS - Merge from gnus--rel--5.10 - Update from CVS: etc/TUTORIAL.cn: Updated. - Merge from erc--emacs--22 * gnus--rel--5.10 (patch 164-167) - Update from CVS Revision: emacs@sv.gnu.org/emacs--unicode--0--patch-137
author Miles Bader <miles@gnu.org>
date Tue, 21 Nov 2006 08:56:38 +0000
parents 8dd8c8286063 234305495123
children 95d0cdf160ea
line wrap: on
line diff
--- a/lisp/gnus/gnus-util.el	Tue Nov 21 01:10:47 2006 +0000
+++ b/lisp/gnus/gnus-util.el	Tue Nov 21 08:56:38 2006 +0000
@@ -202,8 +202,13 @@
     ;; First find the address - the thing with the @ in it.  This may
     ;; not be accurate in mail addresses, but does the trick most of
     ;; the time in news messages.
-    (when (string-match "\\b[^@ \t<>]+[!@][^@ \t<>]+\\b" from)
-      (setq address (substring from (match-beginning 0) (match-end 0))))
+    (cond (;; Check ``<foo@bar>'' first in order to handle the quite common
+	   ;; form ``"abc@xyz" <foo@bar>'' (i.e. ``@'' as part of a comment)
+	   ;; correctly.
+	   (string-match "<\\([^@ \t<>]+[!@][^@ \t<>]+\\)>" from)
+	   (setq address (substring from (match-beginning 1) (match-end 1))))
+	  ((string-match "\\b[^@ \t<>]+[!@][^@ \t<>]+\\b" from)
+	   (setq address (substring from (match-beginning 0) (match-end 0)))))
     ;; Then we check whether the "name <address>" format is used.
     (and address
 	 ;; Linear white space is not required.