--- /dev/null
+Return-Path: <amdragon@mit.edu>\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 C26C3431FB6\r
+ for <notmuch@notmuchmail.org>; Thu, 20 Feb 2014 18:17:31 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.7\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5\r
+ tests=[RCVD_IN_DNSWL_LOW=-0.7] 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 7pc84SoFkpcG for <notmuch@notmuchmail.org>;\r
+ Thu, 20 Feb 2014 18:17:24 -0800 (PST)\r
+Received: from dmz-mailsec-scanner-2.mit.edu (dmz-mailsec-scanner-2.mit.edu\r
+ [18.9.25.13])\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 309AA431FAE\r
+ for <notmuch@notmuchmail.org>; Thu, 20 Feb 2014 18:17:24 -0800 (PST)\r
+X-AuditID: 1209190d-f79776d000000ce9-42-5306b732ddd5\r
+Received: from mailhub-auth-3.mit.edu ( [18.9.21.43])\r
+ (using TLS with cipher AES256-SHA (256/256 bits))\r
+ (Client did not present a certificate)\r
+ by dmz-mailsec-scanner-2.mit.edu (Symantec Messaging Gateway) with SMTP\r
+ id 25.7C.03305.237B6035; Thu, 20 Feb 2014 21:17:22 -0500 (EST)\r
+Received: from outgoing.mit.edu (outgoing-auth-1.mit.edu [18.9.28.11])\r
+ by mailhub-auth-3.mit.edu (8.13.8/8.9.2) with ESMTP id s1L2HKJu012769; \r
+ Thu, 20 Feb 2014 21:17:21 -0500\r
+Received: from awakening.csail.mit.edu (awakening.csail.mit.edu [18.26.4.91])\r
+ (authenticated bits=0)\r
+ (User authenticated as amdragon@ATHENA.MIT.EDU)\r
+ by outgoing.mit.edu (8.13.8/8.12.4) with ESMTP id s1L2HIsR005680\r
+ (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NOT);\r
+ Thu, 20 Feb 2014 21:17:19 -0500\r
+Received: from amthrax by awakening.csail.mit.edu with local (Exim 4.80)\r
+ (envelope-from <amdragon@mit.edu>)\r
+ id 1WGffw-0002xS-Th; Thu, 20 Feb 2014 21:17:17 -0500\r
+Date: Thu, 20 Feb 2014 21:17:15 -0500\r
+From: Austin Clements <amdragon@MIT.EDU>\r
+To: Mark Walters <markwalters1009@gmail.com>\r
+Subject: Re: [PATCH 4/4] emacs: Simplify and fix\r
+ `notmuch-mua-prompt-for-sender'\r
+Message-ID: <20140221021715.GB4620@mit.edu>\r
+References: <1392923797-17045-1-git-send-email-amdragon@mit.edu>\r
+ <1392923797-17045-5-git-send-email-amdragon@mit.edu>\r
+ <87fvndfm3k.fsf@qmul.ac.uk>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain; charset=us-ascii\r
+Content-Disposition: inline\r
+In-Reply-To: <87fvndfm3k.fsf@qmul.ac.uk>\r
+User-Agent: Mutt/1.5.21 (2010-09-15)\r
+X-Brightmail-Tracker:\r
+ H4sIAAAAAAAAA+NgFprJKsWRmVeSWpSXmKPExsUixCmqrWu0nS3Y4ESniMXrBZPYLFbP5bG4\r
+ fnMmswOzx+q1nSweO2fdZfd4tuoWcwBzFJdNSmpOZllqkb5dAldG78LJbAUHtSsWz5/H2MD4\r
+ WLGLkYNDQsBEYtplpi5GTiBTTOLCvfVsXYxcHEICs5kkzp7qg3I2Mkr8e7wByjnNJLHv8Xdm\r
+ CGcJo0Rz3wNGkH4WAVWJnh1XmEFsNgENiW37l4PFRQR0JG4fWsAOYjMLGEqcPbQfrEZYIEji\r
+ ftNkVhCbV0Bb4sCVTywQQ6cySvQ07WODSAhKnJz5hAWiWUvixr+XTCB3MwtISyz/xwES5gTa\r
+ dWPJdLCZogIqElNObmObwCg0C0n3LCTdsxC6FzAyr2KUTcmt0s1NzMwpTk3WLU5OzMtLLdI1\r
+ 0svNLNFLTSndxAgOdUneHYzvDiodYhTgYFTi4T0hxRYsxJpYVlyZe4hRkoNJSZQ3djNQiC8p\r
+ P6UyI7E4I76oNCe1+BCjBAezkghvzlqgHG9KYmVValE+TEqag0VJnLfW4leQkEB6Yklqdmpq\r
+ QWoRTFaGg0NJgrd9G1CjYFFqempFWmZOCUKaiYMTZDgP0PD5IDW8xQWJucWZ6RD5U4y6HO8X\r
+ /P3EKMSSl5+XKiXOm7IVqEgApCijNA9uDixFvWIUB3pLmHcRyCgeYHqDm/QKaAkT0JKSjawg\r
+ S0oSEVJSDYxqLpa5z2s8fq6rSq/IsZHR9p+RceNtSlzvog27D3T6Tjyy7v+NKbEbk14ZnVV8\r
+ /vDAWZY9Vg9dzyxPyVz9ottcsuvuvK+f6w7J/8ifwm8r73A/gsFgjfTz/IKrO9cnqred/tPz\r
+ qHxm8J3HB+f2/v5jfnzFAwknl27v4+6Jm+6E5Akx/qrb/dpHiaU4I9FQi7moOBEAi6H6gCwD AAA=\r
+Cc: bjonnh-nm@bjonnh.net, notmuch@notmuchmail.org\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: Fri, 21 Feb 2014 02:17:32 -0000\r
+\r
+Quoth Mark Walters on Feb 20 at 10:36 pm:\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
+Ah, interesting. I'd figured ido would make this change *less*\r
+jarring because you could enter just the email substring.\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
+This would be easy enough. I'd chosen not to do this partly because I\r
+thought the user may want to enter an address in "Name <email>" form\r
+to override the name, especially if they only have one configured\r
+identity (and since Emacs somehow lacks a address parser that can\r
+extract the name without also transforming it to death, this is hard\r
+to detect). But I'm happy to ignore that situation.\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
+> > _______________________________________________\r
+> > notmuch mailing list\r
+> > notmuch@notmuchmail.org\r
+> > http://notmuchmail.org/mailman/listinfo/notmuch\r
+\r
+-- \r
+Austin Clements MIT/'06/PhD/CSAIL\r
+amdragon@mit.edu http://web.mit.edu/amdragon\r
+ Somewhere in the dream we call reality you will find me,\r
+ searching for the reality we call dreams.\r