Subject: mail/mail-utils.el (mail-strip-quoted-names): check all whitespace address

From: Jari Aalto <[email-masked]>
Date: Fri, 17 Dec 2010 20:25:27 +0200

Package: emacs
Version: 23.2+1-5.1
Severity: wishlist
Tags: patch

The following is optimization for the mail-strip-quoted-names: it returns
immediately if there is nothing to do. The patch is against Git:

    9344a2b 2010-12-17  Merge branch 'master' of git://git.sv.gnu.org/emacs

2010-12-17  Jari Aalto  <[email-masked]>

	* mail/mail-utils.el (mail-strip-quoted-names): If address
	is all whitespace, return immediately with nil.
	(rmail-dont-reply-to): Add check that `naked-address' is a string.
	Needed due to change in `mail-strip-quoted-names'.

-- System Information
Debian Release: squeeze/sid
  APT Prefers testing
  APT policy: (990, testing) (500, unstable) (1, experimental)
Architecture: amd64
Kernel: Linux picasso 2.6.32-5-amd64 #1 SMP Fri Sep 17 21:50:19 UTC 2010 x86_64 GNU/Linux
Locale: LANG=en_DK.UTF-8

-- Versions of packages `emacs depends on'.
Depends:
emacs23         23.2+1-5.1      GNU Emacs is the extensible self-documenting 
emacs23-lucid   23.2+1-5.1      GNU Emacs is the extensible self-documenting 
emacs23-nox     23.2+1-5.1      GNU Emacs is the extensible self-documenting 

>From 3d3737886b7f39556cddf0804521a1c44a6f81e3 Mon Sep 17 00:00:00 2001
From: Jari Aalto <[email-masked]>
Date: Fri, 17 Dec 2010 20:12:54 +0200
Subject: [PATCH] mail/mail-utils.el (mail-strip-quoted-names): Return on all whitespace
Organization: Private
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit

In ` (mail-strip-quoted-names)' if address is all whitespace, return
immediately with nil. In `rmail-dont-reply-to' Add check that
`naked-address' is a string. Needed due to change in
`mail-strip-quoted-names'.

Signed-off-by: Jari Aalto <[email-masked]>
---
 lisp/mail/mail-utils.el |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/lisp/mail/mail-utils.el b/lisp/mail/mail-utils.el
index a8d8451..7e87276 100644
--- a/lisp/mail/mail-utils.el
+++ b/lisp/mail/mail-utils.el
@@ -175,7 +175,10 @@ as Rmail does."
   "Delete comments and quoted strings in an address list ADDRESS.
 Also delete leading/trailing whitespace and replace FOO <BAR> with just BAR.
 Return a modified address list."
-  (if (null address)
+  (if (or (null address)
+	  (and (stringp address)
+	       ;; Effectively empty
+	       (string-match "^[[:space:]]*\\'" address)))
       nil
     (if mail-use-rfc822
 	(progn (require 'rfc822)
@@ -284,7 +287,8 @@ the comma-separated list.  The pruned list is returned."
 	      (setq cur-pos start-pos)))
 	(let* ((address (substring destinations start-pos cur-pos))
 	       (naked-address (mail-strip-quoted-names address)))
-	  (if (string-match rmail-dont-reply-to-names naked-address)
+	  (if (and (stringp naked-address)
+		   (string-match rmail-dont-reply-to-names naked-address))
 	      (setq destinations (concat (substring destinations 0 start-pos)
 				    (and cur-pos (substring destinations
 							    (1+ cur-pos))))
-- 
1.7.2.3