--- /dev/null
+Return-Path: <m.walters@qmul.ac.uk>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+ by olra.theworths.org (Postfix) with ESMTP id 0D3DA431FBF\r
+ for <notmuch@notmuchmail.org>; Sat, 1 Mar 2014 01:37:34 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -1.098\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-1.098 tagged_above=-999 required=5\r
+ tests=[DKIM_ADSP_CUSTOM_MED=0.001, FREEMAIL_FROM=0.001,\r
+ NML_ADSP_CUSTOM_MED=1.2, RCVD_IN_DNSWL_MED=-2.3] autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+ by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+ with ESMTP id 4Gh0fp-L97fV for <notmuch@notmuchmail.org>;\r
+ Sat, 1 Mar 2014 01:37:29 -0800 (PST)\r
+Received: from mail2.qmul.ac.uk (mail2.qmul.ac.uk [138.37.6.6])\r
+ (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))\r
+ (No client certificate requested)\r
+ by olra.theworths.org (Postfix) with ESMTPS id B7210431FAF\r
+ for <notmuch@notmuchmail.org>; Sat, 1 Mar 2014 01:37:28 -0800 (PST)\r
+Received: from smtp.qmul.ac.uk ([138.37.6.40])\r
+ by mail2.qmul.ac.uk with esmtp (Exim 4.71)\r
+ (envelope-from <m.walters@qmul.ac.uk>)\r
+ id 1WJgMG-0000S6-2P; Sat, 01 Mar 2014 09:37:24 +0000\r
+Received: from 93-97-24-31.zone5.bethere.co.uk ([93.97.24.31] helo=localhost)\r
+ by smtp.qmul.ac.uk with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.71)\r
+ (envelope-from <m.walters@qmul.ac.uk>)\r
+ id 1WJgMF-000554-NF; Sat, 01 Mar 2014 09:37:23 +0000\r
+From: Mark Walters <markwalters1009@gmail.com>\r
+To: Austin Clements <amdragon@MIT.EDU>, notmuch@notmuchmail.org\r
+Subject: Re: [PATCH v2] emacs: Simplify and fix\r
+ `notmuch-mua-prompt-for-sender'\r
+In-Reply-To: <1393524654-20502-1-git-send-email-amdragon@mit.edu>\r
+References: <87fvndfm3k.fsf@qmul.ac.uk>\r
+ <1393524654-20502-1-git-send-email-amdragon@mit.edu>\r
+User-Agent: Notmuch/0.15.2+562~g339f306 (http://notmuchmail.org) Emacs/23.4.1\r
+ (x86_64-pc-linux-gnu)\r
+Date: Sat, 01 Mar 2014 09:37:22 +0000\r
+Message-ID: <87ob1q2ral.fsf@qmul.ac.uk>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain; charset=us-ascii\r
+X-Sender-Host-Address: 93.97.24.31\r
+X-QM-Geographic: According to ripencc,\r
+ this message was delivered by a machine in Britain (UK) (GB).\r
+X-QM-SPAM-Info: Sender has good ham record. :)\r
+X-QM-Body-MD5: d9e6958e205d01ceeae768d0b26ac86f (of first 20000 bytes)\r
+X-SpamAssassin-Score: 0.0\r
+X-SpamAssassin-SpamBar: /\r
+X-SpamAssassin-Report: The QM spam filters have analysed this message to\r
+ determine if it is\r
+ spam. We require at least 5.0 points to mark a message as spam.\r
+ This message scored 0.0 points. Summary of the scoring: \r
+ * 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail\r
+ provider * (markwalters1009[at]gmail.com)\r
+ * 0.0 AWL AWL: From: address is in the auto white-list\r
+X-QM-Scan-Virus: ClamAV says the message is clean\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+ <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Sat, 01 Mar 2014 09:37:34 -0000\r
+\r
+\r
+This version is fine (thanks!). And the patch looks good to me too +1.\r
+\r
+Best wishes\r
+\r
+Mark\r
+\r
+\r
+On Thu, 27 Feb 2014, Austin Clements <amdragon@MIT.EDU> wrote:\r
+> `notmuch-mua-prompt-for-sender' is over-engineered and often wrong.\r
+> It attempts to detect when all identities have the same name and\r
+> specialize the prompt to just the email address part. However, to do\r
+> this it uses `mail-extract-address-components', which is meant for\r
+> displaying email addresses, not general-purpose parsing, and hence\r
+> performs many canonicalizations that can interfere with this use. For\r
+> example, configuring notmuch-identities to ("Austin\r
+> <austin@example.com>"), will cause `notmuch-mua-prompt-for-sender' to\r
+> lose the name part entirely and return " <austin@example.com>".\r
+>\r
+> This patch rewrites `notmuch-mua-prompt-for-sender' to simply prompt\r
+> for a full identity when notmuch-identities is configured, or to\r
+> prompt for a sender address when it isn't.\r
+>\r
+> The original code also did several strange things, like using `eval'\r
+> and specifying that this function was interactive. As a side-effect,\r
+> this patch fixes these problems. And it adds a docstring.\r
+> ---\r
+>\r
+> Mark, is this better?\r
+>\r
+> emacs/notmuch-mua.el | 37 +++++++++++++------------------------\r
+> 1 file changed, 13 insertions(+), 24 deletions(-)\r
+>\r
+> diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el\r
+> index f2df770..b16a10e 100644\r
+> --- a/emacs/notmuch-mua.el\r
+> +++ b/emacs/notmuch-mua.el\r
+> @@ -286,30 +286,19 @@ the From: header is already filled in by notmuch."\r
+> (ad-activate 'ido-completing-read)))\r
+> \r
+> (defun notmuch-mua-prompt-for-sender ()\r
+> - (interactive)\r
+> - (let (name addresses one-name-only)\r
+> - ;; If notmuch-identities is non-nil, check if there is a fixed user name.\r
+> - (if notmuch-identities\r
+> - (let ((components (mapcar 'mail-extract-address-components notmuch-identities)))\r
+> - (setq name (caar components)\r
+> - addresses (mapcar 'cadr components)\r
+> - one-name-only (eval\r
+> - (cons 'and\r
+> - (mapcar (lambda (identity)\r
+> - (string-equal name (car identity)))\r
+> - components)))))\r
+> - ;; If notmuch-identities is nil, use values from the notmuch configuration file.\r
+> - (setq name (notmuch-user-name)\r
+> - addresses (cons (notmuch-user-primary-email) (notmuch-user-other-email))\r
+> - one-name-only t))\r
+> - ;; Now prompt the user, either for an email address only or for a full identity.\r
+> - (if one-name-only\r
+> - (let ((address\r
+> - (ido-completing-read (concat "Sender address for " name ": ") addresses\r
+> - nil nil nil 'notmuch-mua-sender-history (car addresses))))\r
+> - (concat name " <" address ">"))\r
+> - (ido-completing-read "Send mail From: " notmuch-identities\r
+> - nil nil nil 'notmuch-mua-sender-history (car notmuch-identities)))))\r
+> + "Prompt for a sender from the user's configured identities."\r
+> + (if notmuch-identities\r
+> + (ido-completing-read "Send mail from: " notmuch-identities\r
+> + nil nil nil 'notmuch-mua-sender-history\r
+> + (car notmuch-identities))\r
+> + (let* ((name (notmuch-user-name))\r
+> + (addrs (cons (notmuch-user-primary-email)\r
+> + (notmuch-user-other-email)))\r
+> + (address\r
+> + (ido-completing-read (concat "Sender address for " name ": ") addrs\r
+> + nil nil nil 'notmuch-mua-sender-history\r
+> + (car addrs))))\r
+> + (concat name " <" address ">"))))\r
+> \r
+> (put 'notmuch-mua-new-mail 'notmuch-prefix-doc "... and prompt for sender")\r
+> (defun notmuch-mua-new-mail (&optional prompt-for-sender)\r
+> -- \r
+> 1.8.4.rc3\r