Re: [PATCH 0/4] Allow specifying alternate names for addresses in other_email
[notmuch-archives.git] / d7 / 7c184de35b060c6590b87e8fa010111f767e2c
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 54347431FAF\r
6         for <notmuch@notmuchmail.org>; Sat, 14 Apr 2012 13:34:57 -0700 (PDT)\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 U762HNNAJI82 for <notmuch@notmuchmail.org>;\r
17         Sat, 14 Apr 2012 13:34:56 -0700 (PDT)\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 7AAA0431FAE\r
22         for <notmuch@notmuchmail.org>; Sat, 14 Apr 2012 13:34:56 -0700 (PDT)\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 1SJ9gJ-0000Gy-RD; Sat, 14 Apr 2012 21:34:52 +0100\r
27 Received: from 94-192-233-223.zone6.bethere.co.uk ([94.192.233.223]\r
28         helo=localhost)\r
29         by smtp.qmul.ac.uk with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.69)\r
30         (envelope-from <m.walters@qmul.ac.uk>)\r
31         id 1SJ9gJ-0006OO-Hi; Sat, 14 Apr 2012 21:34:51 +0100\r
32 From: Mark Walters <markwalters1009@gmail.com>\r
33 To: Jameson Graef Rollins <jrollins@finestructure.net>,\r
34         Notmuch Mail <notmuch@notmuchmail.org>\r
35 Subject: Re: [PATCH 2/5] emacs: allow notmuch-tag to accept string inputs and\r
36         prompt for tags\r
37 In-Reply-To: <1334429574-12918-3-git-send-email-jrollins@finestructure.net>\r
38 References: <1333845338-22960-1-git-send-email-jrollins@finestructure.net>\r
39         <1334429574-12918-1-git-send-email-jrollins@finestructure.net>\r
40         <1334429574-12918-2-git-send-email-jrollins@finestructure.net>\r
41         <1334429574-12918-3-git-send-email-jrollins@finestructure.net>\r
42 User-Agent: Notmuch/0.12+110~gbc97b4a (http://notmuchmail.org) Emacs/23.3.1\r
43         (x86_64-pc-linux-gnu)\r
44 Date: Sat, 14 Apr 2012 21:35:09 +0100\r
45 Message-ID: <878vhyt5ky.fsf@qmul.ac.uk>\r
46 MIME-Version: 1.0\r
47 Content-Type: text/plain; charset=us-ascii\r
48 X-Sender-Host-Address: 94.192.233.223\r
49 X-QM-SPAM-Info: Sender has good ham record.  :)\r
50 X-QM-Body-MD5: e0635b4381a868d44440cf1ae961df84 (of first 20000 bytes)\r
51 X-SpamAssassin-Score: -1.8\r
52 X-SpamAssassin-SpamBar: -\r
53 X-SpamAssassin-Report: The QM spam filters have analysed this message to\r
54         determine if it is\r
55         spam. We require at least 5.0 points to mark a message as spam.\r
56         This message scored -1.8 points.\r
57         Summary of the scoring: \r
58         * -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at http://www.dnswl.org/,\r
59         *      medium trust\r
60         *      [138.37.6.40 listed in list.dnswl.org]\r
61         * 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail\r
62         provider *      (markwalters1009[at]gmail.com)\r
63         * -0.0 T_RP_MATCHES_RCVD Envelope sender domain matches handover relay\r
64         *      domain\r
65         *  0.5 AWL AWL: From: address is in the auto white-list\r
66 X-QM-Scan-Virus: ClamAV says the message is clean\r
67 X-BeenThere: notmuch@notmuchmail.org\r
68 X-Mailman-Version: 2.1.13\r
69 Precedence: list\r
70 List-Id: "Use and development of the notmuch mail system."\r
71         <notmuch.notmuchmail.org>\r
72 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
73         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
74 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
75 List-Post: <mailto:notmuch@notmuchmail.org>\r
76 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
77 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
78         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
79 X-List-Received-Date: Sat, 14 Apr 2012 20:34:57 -0000\r
80 \r
81 On Sat, 14 Apr 2012, Jameson Graef Rollins <jrollins@finestructure.net> wrote:\r
82 > notmuch-tag is extended to accept various formats of the tag changes.\r
83 > In particular, user prompting for tag changes is now incorporated\r
84 > here, so it is common for modes.\r
85 >\r
86 > The tag binary and the notmuch-{before,after}-tag-hooks are only\r
87 > called if tag changes is non-nil.\r
88 >\r
89 > The actual tag-changes applied are returned by the function.\r
90 > ---\r
91 >  emacs/notmuch-tag.el |   20 +++++++++++++++-----\r
92 >  1 file changed, 15 insertions(+), 5 deletions(-)\r
93 >\r
94 > diff --git a/emacs/notmuch-tag.el b/emacs/notmuch-tag.el\r
95 > index c25cff8..dd7f9d7 100644\r
96 > --- a/emacs/notmuch-tag.el\r
97 > +++ b/emacs/notmuch-tag.el\r
98 > @@ -108,18 +108,26 @@ from TAGS if present."\r
99 >          (error "Changed tag must be of the form `+this_tag' or `-that_tag'")))))\r
100 >      (sort result-tags 'string<)))\r
101 >  \r
102 > -(defun notmuch-tag (query &rest tag-changes)\r
103 > +(defun notmuch-tag (query &optional tag-changes)\r
104 >    "Add/remove tags in TAG-CHANGES to messages matching QUERY.\r
105 >  \r
106 > -TAG-CHANGES should be a list of strings of the form \"+tag\" or\r
107 > -\"-tag\" and QUERY should be a string containing the\r
108 > -search-query.\r
109 > +QUERY should be a string containing the search-terms.\r
110 > +TAG-CHANGES can take multiple forms.  If TAG-CHANGES is a list of\r
111 > +strings of the form \"+tag\" or \"-tag\" then those are the tag\r
112 > +changes applied.  If TAG-CHANGES is a string then it is\r
113 > +interpreted as a single tag change.  If TAG-CHANGES is the string\r
114 > +\"-\" or \"+\", or null, then the user is prompted to enter the\r
115 > +tag changes.\r
116 >  \r
117 >  Note: Other code should always use this function alter tags of\r
118 >  messages instead of running (notmuch-call-notmuch-process \"tag\" ..)\r
119 >  directly, so that hooks specified in notmuch-before-tag-hook and\r
120 >  notmuch-after-tag-hook will be run."\r
121 >    ;; Perform some validation\r
122 > +  (if (string-or-null-p tag-changes)\r
123 > +      (if (or (string= tag-changes "-") (string= tag-changes "+") (null tag-changes))\r
124 > +       (setq tag-changes (notmuch-read-tag-changes tag-changes query))\r
125 > +     (setq tag-changes (list tag-changes))))\r
126 >    (mapc (lambda (tag-change)\r
127 >         (unless (string-match-p "^[-+]\\S-+$" tag-change)\r
128 >           (error "Tag must be of the form `+this_tag' or `-that_tag'")))\r
129 > @@ -128,7 +136,9 @@ notmuch-after-tag-hook will be run."\r
130 >      (run-hooks 'notmuch-before-tag-hook)\r
131 >      (apply 'notmuch-call-notmuch-process "tag"\r
132 >          (append tag-changes (list "--" query)))\r
133 > -    (run-hooks 'notmuch-after-tag-hook)))\r
134 > +    (run-hooks 'notmuch-after-tag-hook))\r
135 \r
136 Hi\r
137 \r
138 The series looks good to me with one minor point:\r
139 \r
140 > +  ;; return the list of actual changed tags\r
141 > +  tag-changes)\r
142 \r
143 I found the comment confusing: I read it as the function looked at the\r
144 tags the message had before and after and returned the\r
145 difference. Perhaps something like "in all cases we return tag-changes\r
146 as a list" (and a similar comment for the commit message).\r
147 \r
148 Best wishes\r
149 \r
150 Mark\r
151 \r