From d16dda6e22c5f1c3fbf58d2a581131be91078ed6 Mon Sep 17 00:00:00 2001
From: Henrik Enberg <henrik.enberg@telia.com>
Date: Wed, 25 Jan 2006 16:39:44 +0000
Subject: [PATCH] (rmail-summary-get-sender): Handle a nil value of
 rmail-user-mail-address-regexp.

---
 lisp/mail/rmailsum.el | 21 +++++++++++----------
 1 file changed, 11 insertions(+), 10 deletions(-)

diff --git a/lisp/mail/rmailsum.el b/lisp/mail/rmailsum.el
index 45256366203..85df2c88f73 100644
--- a/lisp/mail/rmailsum.el
+++ b/lisp/mail/rmailsum.el
@@ -300,15 +300,15 @@ By default, `identity' is set."
 
 ;;;###autoload
 (defcustom rmail-user-mail-address-regexp
-(concat "^\\("
-	(regexp-quote (user-login-name))
-	"\\($\\|@\\)\\|"
-	(regexp-quote
-	 (or user-mail-address
-	     (concat (user-login-name) "@"
-		     (or mail-host-address
-			 (system-name)))))
-	"\\>\\)")
+  (concat "^\\("
+	  (regexp-quote (user-login-name))
+	  "\\($\\|@\\)\\|"
+	  (regexp-quote
+	   (or user-mail-address
+	       (concat (user-login-name) "@"
+		       (or mail-host-address
+			   (system-name)))))
+	  "\\>\\)")
   "*Regexp matching user mail addresses.
 If non-nil, this variable is used to identify the correspondent
 when receiving new mail.  If it matches the address of the
@@ -1482,7 +1482,8 @@ If sender matches `rmail-user-mail-address-regexp' or
 `user-mail-address', return the to-address instead."
   (let ((sender (rmail-desc-get-sender n)))
     (if (or (null sender)
-	    (string-match rmail-user-mail-address-regexp sender))
+	    (and rmail-user-mail-address-regexp
+		 (string-match rmail-user-mail-address-regexp sender)))
 	;; Either no sender known, or it's this user.
 	(save-restriction
 	  (narrow-to-region (rmail-desc-get-start n)
-- 
2.39.5