--- /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 3C73C431FB6\r
+ for <notmuch@notmuchmail.org>; Thu, 20 Feb 2014 14:36:33 -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 us8IoMzp-yR7 for <notmuch@notmuchmail.org>;\r
+ Thu, 20 Feb 2014 14:36: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 11EB4431FAE\r
+ for <notmuch@notmuchmail.org>; Thu, 20 Feb 2014 14:36:29 -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 1WGcE5-0002az-PI; Thu, 20 Feb 2014 22:36:23 +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 1WGcE5-0001hE-CG; Thu, 20 Feb 2014 22:36:17 +0000\r
+From: Mark Walters <markwalters1009@gmail.com>\r
+To: Austin Clements <amdragon@MIT.EDU>, notmuch@notmuchmail.org\r
+Subject: Re: [PATCH 4/4] emacs: Simplify and fix\r
+ `notmuch-mua-prompt-for-sender'\r
+In-Reply-To: <1392923797-17045-5-git-send-email-amdragon@mit.edu>\r
+References: <1392923797-17045-1-git-send-email-amdragon@mit.edu>\r
+ <1392923797-17045-5-git-send-email-amdragon@mit.edu>\r
+User-Agent: Notmuch/0.15.2+484~gfb59956 (http://notmuchmail.org) Emacs/23.4.1\r
+ (x86_64-pc-linux-gnu)\r
+Date: Thu, 20 Feb 2014 22:36:15 +0000\r
+Message-ID: <87fvndfm3k.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: 16e9f3dc22b4143d09fb5c5221c09767 (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
+Cc: bjonnh-nm@bjonnh.net\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: Thu, 20 Feb 2014 22:36:33 -0000\r
+\r
+\r
+Patches 1-3 look fine +1.\r
+\r
+This one I am less sure about. I agree with the principle but for my use\r
+case it is a little annoying:\r
+\r
+I only use one name for all my addresses (Mark Walters), some addresses\r
+are mark@.. and some walters@..\r
+\r
+ido-completing-read is definitely less nice to use when all the addresses\r
+match mark and walters.\r
+\r
+I wonder if we could get the old behaviour in a more robust fashion. Two\r
+possibilities we could consider are\r
+\r
+1) if getting the information from the config file (when there is\r
+necessarily a single name) then only complete the addresses.\r
+\r
+2) make notmuch-identities a list of cons cells (name . email). Then\r
+there is no parsing and the old method could be robust.\r
+\r
+OTOH I can get used to the change.\r
+\r
+Best wishes\r
+\r
+Mark\r
+\r
+\r
+\r
+On Thu, 20 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, but this has\r
+> several problems. First, it uses `mail-extract-address-components',\r
+> which is meant for displaying email addresses, not general-purpose\r
+> parsing, and hence performs many canonicalizations that can interfere\r
+> with this use. For example, configuring notmuch-identities to\r
+> ("Austin <austin@example.com>"), will cause\r
+> `notmuch-mua-prompt-for-sender' to lose the name part entirely and\r
+> return " <austin@example.com>". Second, though less serious, the\r
+> prompt specialization means the user can't enter a different name like\r
+> they can if their identities have different names.\r
+>\r
+> This patch rewrites `notmuch-mua-prompt-for-sender' to simply prompt\r
+> for a full identity, where the list of identities is derived from\r
+> either notmuch-identities or the user's Notmuch configuration.\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
+> emacs/notmuch-mua.el | 33 +++++++++------------------------\r
+> 1 file changed, 9 insertions(+), 24 deletions(-)\r
+>\r
+> diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el\r
+> index f2df770..4a485a4 100644\r
+> --- a/emacs/notmuch-mua.el\r
+> +++ b/emacs/notmuch-mua.el\r
+> @@ -286,30 +286,15 @@ 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
+> + (let ((identities (or notmuch-identities\r
+> + (let ((name (notmuch-user-name)))\r
+> + (mapcar (lambda (addr) (concat name " <" addr ">"))\r
+> + (cons (notmuch-user-primary-email)\r
+> + (notmuch-user-other-email)))))))\r
+> + (ido-completing-read "Send mail from: " identities\r
+> + nil nil nil 'notmuch-mua-sender-history\r
+> + (car identities))))\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
+>\r
+> _______________________________________________\r
+> notmuch mailing list\r
+> notmuch@notmuchmail.org\r
+> http://notmuchmail.org/mailman/listinfo/notmuch\r