Re: [PATCH v4 01/16] add util/search-path.{c, h} to test for executables in $PATH
[notmuch-archives.git] / 95 / b4e829b95411859b81836999b095185a50e173
1 Return-Path: <m.walters@qmul.ac.uk>\r
2 X-Original-To: notmuch@notmuchmail.org\r
3 Delivered-To: notmuch@notmuchmail.org\r
4 Received: from localhost (localhost [127.0.0.1])\r
5         by olra.theworths.org (Postfix) with ESMTP id 3C73C431FB6\r
6         for <notmuch@notmuchmail.org>; Thu, 20 Feb 2014 14:36:33 -0800 (PST)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: -1.098\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=-1.098 tagged_above=-999 required=5\r
12         tests=[DKIM_ADSP_CUSTOM_MED=0.001, FREEMAIL_FROM=0.001,\r
13         NML_ADSP_CUSTOM_MED=1.2, RCVD_IN_DNSWL_MED=-2.3] autolearn=disabled\r
14 Received: from olra.theworths.org ([127.0.0.1])\r
15         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
16         with ESMTP id us8IoMzp-yR7 for <notmuch@notmuchmail.org>;\r
17         Thu, 20 Feb 2014 14:36:29 -0800 (PST)\r
18 Received: from mail2.qmul.ac.uk (mail2.qmul.ac.uk [138.37.6.6])\r
19         (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))\r
20         (No client certificate requested)\r
21         by olra.theworths.org (Postfix) with ESMTPS id 11EB4431FAE\r
22         for <notmuch@notmuchmail.org>; Thu, 20 Feb 2014 14:36:29 -0800 (PST)\r
23 Received: from smtp.qmul.ac.uk ([138.37.6.40])\r
24         by mail2.qmul.ac.uk with esmtp (Exim 4.71)\r
25         (envelope-from <m.walters@qmul.ac.uk>)\r
26         id 1WGcE5-0002az-PI; Thu, 20 Feb 2014 22:36:23 +0000\r
27 Received: from 93-97-24-31.zone5.bethere.co.uk ([93.97.24.31] helo=localhost)\r
28         by smtp.qmul.ac.uk with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.71)\r
29         (envelope-from <m.walters@qmul.ac.uk>)\r
30         id 1WGcE5-0001hE-CG; Thu, 20 Feb 2014 22:36:17 +0000\r
31 From: Mark Walters <markwalters1009@gmail.com>\r
32 To: Austin Clements <amdragon@MIT.EDU>, notmuch@notmuchmail.org\r
33 Subject: Re: [PATCH 4/4] emacs: Simplify and fix\r
34         `notmuch-mua-prompt-for-sender'\r
35 In-Reply-To: <1392923797-17045-5-git-send-email-amdragon@mit.edu>\r
36 References: <1392923797-17045-1-git-send-email-amdragon@mit.edu>\r
37         <1392923797-17045-5-git-send-email-amdragon@mit.edu>\r
38 User-Agent: Notmuch/0.15.2+484~gfb59956 (http://notmuchmail.org) Emacs/23.4.1\r
39         (x86_64-pc-linux-gnu)\r
40 Date: Thu, 20 Feb 2014 22:36:15 +0000\r
41 Message-ID: <87fvndfm3k.fsf@qmul.ac.uk>\r
42 MIME-Version: 1.0\r
43 Content-Type: text/plain; charset=us-ascii\r
44 X-Sender-Host-Address: 93.97.24.31\r
45 X-QM-Geographic: According to ripencc,\r
46         this message was delivered by a machine in Britain (UK) (GB).\r
47 X-QM-SPAM-Info: Sender has good ham record.  :)\r
48 X-QM-Body-MD5: 16e9f3dc22b4143d09fb5c5221c09767 (of first 20000 bytes)\r
49 X-SpamAssassin-Score: 0.0\r
50 X-SpamAssassin-SpamBar: /\r
51 X-SpamAssassin-Report: The QM spam filters have analysed this message to\r
52         determine if it is\r
53         spam. We require at least 5.0 points to mark a message as spam.\r
54         This message scored 0.0 points. Summary of the scoring: \r
55         * 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail\r
56         provider *      (markwalters1009[at]gmail.com)\r
57         *  0.0 AWL AWL: From: address is in the auto white-list\r
58 X-QM-Scan-Virus: ClamAV says the message is clean\r
59 Cc: bjonnh-nm@bjonnh.net\r
60 X-BeenThere: notmuch@notmuchmail.org\r
61 X-Mailman-Version: 2.1.13\r
62 Precedence: list\r
63 List-Id: "Use and development of the notmuch mail system."\r
64         <notmuch.notmuchmail.org>\r
65 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
66         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
67 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
68 List-Post: <mailto:notmuch@notmuchmail.org>\r
69 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
70 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
71         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
72 X-List-Received-Date: Thu, 20 Feb 2014 22:36:33 -0000\r
73 \r
74 \r
75 Patches 1-3 look fine +1.\r
76 \r
77 This one I am less sure about. I agree with the principle but for my use\r
78 case it is a little annoying:\r
79 \r
80 I only use one name for all my addresses (Mark Walters), some addresses\r
81 are mark@.. and some walters@..\r
82 \r
83 ido-completing-read is definitely less nice to use when all the addresses\r
84 match mark and walters.\r
85 \r
86 I wonder if we could get the old behaviour in a more robust fashion. Two\r
87 possibilities we could consider are\r
88 \r
89 1) if getting the information from the config file (when there is\r
90 necessarily a single name) then only complete the addresses.\r
91 \r
92 2) make notmuch-identities a list of cons cells (name . email). Then\r
93 there is no parsing and the old method could be robust.\r
94 \r
95 OTOH I can get used to the change.\r
96 \r
97 Best wishes\r
98 \r
99 Mark\r
100 \r
101 \r
102 \r
103 On Thu, 20 Feb 2014, Austin Clements <amdragon@MIT.EDU> wrote:\r
104 > `notmuch-mua-prompt-for-sender' is over-engineered and often wrong.\r
105 > It attempts to detect when all identities have the same name and\r
106 > specialize the prompt to just the email address part, but this has\r
107 > several problems.  First, it uses `mail-extract-address-components',\r
108 > which is meant for displaying email addresses, not general-purpose\r
109 > parsing, and hence performs many canonicalizations that can interfere\r
110 > with this use.  For example, configuring notmuch-identities to\r
111 > ("Austin <austin@example.com>"), will cause\r
112 > `notmuch-mua-prompt-for-sender' to lose the name part entirely and\r
113 > return " <austin@example.com>".  Second, though less serious, the\r
114 > prompt specialization means the user can't enter a different name like\r
115 > they can if their identities have different names.\r
116 >\r
117 > This patch rewrites `notmuch-mua-prompt-for-sender' to simply prompt\r
118 > for a full identity, where the list of identities is derived from\r
119 > either notmuch-identities or the user's Notmuch configuration.\r
120 >\r
121 > The original code also did several strange things, like using `eval'\r
122 > and specifying that this function was interactive.  As a side-effect,\r
123 > this patch fixes these problems.  And it adds a docstring.\r
124 > ---\r
125 >  emacs/notmuch-mua.el | 33 +++++++++------------------------\r
126 >  1 file changed, 9 insertions(+), 24 deletions(-)\r
127 >\r
128 > diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el\r
129 > index f2df770..4a485a4 100644\r
130 > --- a/emacs/notmuch-mua.el\r
131 > +++ b/emacs/notmuch-mua.el\r
132 > @@ -286,30 +286,15 @@ the From: header is already filled in by notmuch."\r
133 >        (ad-activate 'ido-completing-read)))\r
134 >  \r
135 >  (defun notmuch-mua-prompt-for-sender ()\r
136 > -  (interactive)\r
137 > -  (let (name addresses one-name-only)\r
138 > -    ;; If notmuch-identities is non-nil, check if there is a fixed user name.\r
139 > -    (if notmuch-identities\r
140 > -     (let ((components (mapcar 'mail-extract-address-components notmuch-identities)))\r
141 > -       (setq name          (caar components)\r
142 > -             addresses     (mapcar 'cadr components)\r
143 > -             one-name-only (eval\r
144 > -                            (cons 'and\r
145 > -                                  (mapcar (lambda (identity)\r
146 > -                                            (string-equal name (car identity)))\r
147 > -                                          components)))))\r
148 > -      ;; If notmuch-identities is nil, use values from the notmuch configuration file.\r
149 > -      (setq name          (notmuch-user-name)\r
150 > -         addresses     (cons (notmuch-user-primary-email) (notmuch-user-other-email))\r
151 > -         one-name-only t))\r
152 > -    ;; Now prompt the user, either for an email address only or for a full identity.\r
153 > -    (if one-name-only\r
154 > -     (let ((address\r
155 > -            (ido-completing-read (concat "Sender address for " name ": ") addresses\r
156 > -                                 nil nil nil 'notmuch-mua-sender-history (car addresses))))\r
157 > -       (concat name " <" address ">"))\r
158 > -      (ido-completing-read "Send mail From: " notmuch-identities\r
159 > -                        nil nil nil 'notmuch-mua-sender-history (car notmuch-identities)))))\r
160 > +  "Prompt for a sender from the user's configured identities."\r
161 > +  (let ((identities (or notmuch-identities\r
162 > +                     (let ((name (notmuch-user-name)))\r
163 > +                       (mapcar (lambda (addr) (concat name " <" addr ">"))\r
164 > +                               (cons (notmuch-user-primary-email)\r
165 > +                                     (notmuch-user-other-email)))))))\r
166 > +    (ido-completing-read "Send mail from: " identities\r
167 > +                      nil nil nil 'notmuch-mua-sender-history\r
168 > +                      (car identities))))\r
169 >  \r
170 >  (put 'notmuch-mua-new-mail 'notmuch-prefix-doc "... and prompt for sender")\r
171 >  (defun notmuch-mua-new-mail (&optional prompt-for-sender)\r
172 > -- \r
173 > 1.8.4.rc3\r
174 >\r
175 > _______________________________________________\r
176 > notmuch mailing list\r
177 > notmuch@notmuchmail.org\r
178 > http://notmuchmail.org/mailman/listinfo/notmuch\r