Re: Applying patches directly from emails?
[notmuch-archives.git] / ee / 3381606e3f7949a53fe894534a392391dc1649
1 Return-Path: <amdragon@mit.edu>\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 BD043431FB6\r
6         for <notmuch@notmuchmail.org>; Sat,  5 Apr 2014 18:24:43 -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: -0.7\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5\r
12         tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\r
13 Received: from olra.theworths.org ([127.0.0.1])\r
14         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
15         with ESMTP id rfuMv+UT8XwF for <notmuch@notmuchmail.org>;\r
16         Sat,  5 Apr 2014 18:24:32 -0700 (PDT)\r
17 Received: from dmz-mailsec-scanner-7.mit.edu (dmz-mailsec-scanner-7.mit.edu\r
18         [18.7.68.36])\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 9FE67431FAF\r
22         for <notmuch@notmuchmail.org>; Sat,  5 Apr 2014 18:24:30 -0700 (PDT)\r
23 X-AuditID: 12074424-f79e26d000000c70-61-5340accb4cbe\r
24 Received: from mailhub-auth-3.mit.edu ( [18.9.21.43])\r
25         (using TLS with cipher AES256-SHA (256/256 bits))\r
26         (Client did not present a certificate)\r
27         by dmz-mailsec-scanner-7.mit.edu (Symantec Messaging Gateway) with SMTP\r
28         id F7.FA.03184.BCCA0435; Sat,  5 Apr 2014 21:24:27 -0400 (EDT)\r
29 Received: from outgoing.mit.edu (outgoing-auth-1.mit.edu [18.9.28.11])\r
30         by mailhub-auth-3.mit.edu (8.13.8/8.9.2) with ESMTP id s361ORNH030356; \r
31         Sat, 5 Apr 2014 21:24:27 -0400\r
32 Received: from awakening.csail.mit.edu (awakening.csail.mit.edu [18.26.4.91])\r
33         (authenticated bits=0)\r
34         (User authenticated as amdragon@ATHENA.MIT.EDU)\r
35         by outgoing.mit.edu (8.13.8/8.12.4) with ESMTP id s361OPWb019432\r
36         (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NOT);\r
37         Sat, 5 Apr 2014 21:24:26 -0400\r
38 Received: from amthrax by awakening.csail.mit.edu with local (Exim 4.80)\r
39         (envelope-from <amdragon@mit.edu>)\r
40         id 1WWbov-000786-If; Sat, 05 Apr 2014 21:24:25 -0400\r
41 Date: Sat, 5 Apr 2014 21:24:25 -0400\r
42 From: Austin Clements <amdragon@MIT.EDU>\r
43 To: Mark Walters <markwalters1009@gmail.com>\r
44 Subject: Re: [PATCH 4/5] emacs: hello: switch notmuch-hello-insert-buttons to\r
45         plists\r
46 Message-ID: <20140406012425.GF15472@mit.edu>\r
47 References: <1396733065-32602-1-git-send-email-markwalters1009@gmail.com>\r
48         <1396733065-32602-5-git-send-email-markwalters1009@gmail.com>\r
49 MIME-Version: 1.0\r
50 Content-Type: text/plain; charset=us-ascii\r
51 Content-Disposition: inline\r
52 In-Reply-To: <1396733065-32602-5-git-send-email-markwalters1009@gmail.com>\r
53 User-Agent: Mutt/1.5.21 (2010-09-15)\r
54 X-Brightmail-Tracker:\r
55  H4sIAAAAAAAAA+NgFmpileLIzCtJLcpLzFFi42IR4hTV1j29xiHY4O1fG4vVc3ksrt+cyezA\r
56         5LFz1l12j2erbjEHMEVx2aSk5mSWpRbp2yVwZcxcsZ254LxcxfpTE9kaGKdJdDFyckgImEhM\r
57         mfGbHcIWk7hwbz1bFyMXh5DAbCaJt8cnMYMkhAQ2MEo0Hk2HSJxikpg6ZSM7hLOEUeLWrGVM\r
58         XYwcHCwCKhLvNkqCNLAJaEhs27+cEcQWEdCRuH1oAdgGZgFpiW+/m5lAbGGBMIm7fX/ZQGxe\r
59         oJpdPXtYIGZ2Mkq8a5rNDJEQlDg58wkLRLOWxI1/L8F2gQxa/o8DJMwp4CVx+9M3sF2iQCdM\r
60         ObmNbQKj0Cwk3bOQdM9C6F7AyLyKUTYlt0o3NzEzpzg1Wbc4OTEvL7VI11wvN7NELzWldBMj\r
61         KKjZXVR2MDYfUjrEKMDBqMTDW5HjECzEmlhWXJl7iFGSg0lJlLdrBlCILyk/pTIjsTgjvqg0\r
62         J7X4EKMEB7OSCO+TIKAcb0piZVVqUT5MSpqDRUmc9621VbCQQHpiSWp2ampBahFMVoaDQ0mC\r
63         d8ZqoEbBotT01Iq0zJwShDQTByfIcB6g4Q0gNbzFBYm5xZnpEPlTjIpS4rwuq4ASAiCJjNI8\r
64         uF5Y0nnFKA70ijBvM0g7DzBhwXW/AhrMBDI4zA5kcEkiQkqqgVHl5CfhBYyzXCxNXHj6soQy\r
65         ZTM2hM6ewu38pmJCwXlOzv2vVtlXtCwP0Xpw//DT0P8C/8MWuW4NmjI3n/2zzg5/t8MJtqwx\r
66         r7a665kb7hfl1J/T3MOwra1PoLe1X/7a2cbZ+dcvLpN3DK3ZcjknzWvi2Yt/nV52tj0Qfq9x\r
67         5ZR+yYVTvht0apVYijMSDbWYi4oTAfgMpcEVAwAA\r
68 Cc: notmuch@notmuchmail.org\r
69 X-BeenThere: notmuch@notmuchmail.org\r
70 X-Mailman-Version: 2.1.13\r
71 Precedence: list\r
72 List-Id: "Use and development of the notmuch mail system."\r
73         <notmuch.notmuchmail.org>\r
74 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
75         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
76 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
77 List-Post: <mailto:notmuch@notmuchmail.org>\r
78 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
79 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
80         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
81 X-List-Received-Date: Sun, 06 Apr 2014 01:24:43 -0000\r
82 \r
83 Quoth Mark Walters on Apr 05 at 10:24 pm:\r
84 > Switching notmuch-hello-insert-buttons to plists means we can easily\r
85 > pass extra options through to the buttons.\r
86 > ---\r
87 >  emacs/notmuch-hello.el |   33 +++++++++++++++++++--------------\r
88 >  1 file changed, 19 insertions(+), 14 deletions(-)\r
89\r
90 > diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el\r
91 > index c729af2..aa40e6f 100644\r
92 > --- a/emacs/notmuch-hello.el\r
93 > +++ b/emacs/notmuch-hello.el\r
94 > @@ -425,7 +425,9 @@ (defun notmuch-hello-query-counts (query-list &rest options)\r
95 >  these is a plist but other options are available for backwards\r
96 >  compatibility: see notmuch-saved-search-get for details.\r
97 >  \r
98 > -The result is the list of elements of the form (NAME QUERY COUNT).\r
99 > +The result is a list of plists each of which includes the\r
100 > +pairs :name NAME, :query QUERY and :count COUNT, together with\r
101 > +any pairs in the original saved-search.\r
102 \r
103 "Pair" can be synonymous with "cons", which is not what you mean here.\r
104 "Properties"?\r
105 \r
106 >  \r
107 >  The values :show-empty-searches, :filter and :filter-count from\r
108 >  options will be handled as specified for\r
109 > @@ -455,23 +457,26 @@ (defun notmuch-hello-query-counts (query-list &rest options)\r
110 >       #'identity\r
111 >       (mapcar\r
112 >        (lambda (elem)\r
113 > -     (let ((name (notmuch-saved-search-get elem :name))\r
114 > -           (search-query (notmuch-saved-search-get elem :query))\r
115 > -           (message-count (prog1 (read (current-buffer))\r
116 > +     (let* ((elem-plist (notmuch-hello-saved-search-to-plist elem))\r
117 > +            (search-query (plist-get elem-plist :query))\r
118 > +            (filtered-query (notmuch-hello-filtered-query\r
119 > +                             search-query (plist-get options :filter)))\r
120 > +            (message-count (prog1 (read (current-buffer))\r
121 >                               (forward-line 1))))\r
122 >         (and (or (plist-get options :show-empty-searches) (> message-count 0))\r
123 > -            (list name (notmuch-hello-filtered-query\r
124 > -                        search-query (plist-get options :filter))\r
125 > -                  message-count))))\r
126 > +            (setq elem-plist (plist-put elem-plist :query filtered-query))\r
127 \r
128 This technically works, but `setq' is a strange thing to see in an\r
129 `and'.  But the problem isn't the `setq'; it's that crazy `and'.  I'd\r
130 replace the `and' with `when', keep the `setq' and `plist-put' in the\r
131 body, and squint a lot less at this code.\r
132 \r
133 > +            (plist-put elem-plist :count message-count))))\r
134 >        query-list))))\r
135 >  \r
136 >  (defun notmuch-hello-insert-buttons (searches)\r
137 >    "Insert buttons for SEARCHES.\r
138 >  \r
139 > -SEARCHES must be a list containing lists of the form (NAME QUERY COUNT), where\r
140 > -QUERY is the query to start when the button for the corresponding entry is\r
141 > -activated. COUNT should be the number of messages matching the query.\r
142 > -Such a list can be computed with `notmuch-hello-query-counts'."\r
143 > +SEARCHES must be a list of plists each of which should contain at\r
144 > +least pairs for :name NAME :query QUERY and :count COUNT, where\r
145 \r
146 Same comment about "pairs".\r
147 \r
148 > +QUERY is the query to start when the button for the corresponding\r
149 > +entry is activated, and COUNT should be the number of messages\r
150 > +matching the query.  Such a plist can be computed with\r
151 > +`notmuch-hello-query-counts'."\r
152 >    (let* ((widest (notmuch-hello-longest-label searches))\r
153 >        (tags-and-width (notmuch-hello-tags-per-line widest))\r
154 >        (tags-per-line (car tags-and-width))\r
155 > @@ -489,9 +494,9 @@ (defun notmuch-hello-insert-buttons (searches)\r
156 >           (when elem\r
157 >             (if (> column-indent 0)\r
158 >                 (widget-insert (make-string column-indent ? )))\r
159 > -           (let* ((name (first elem))\r
160 > -                  (query (second elem))\r
161 > -                  (msg-count (third elem)))\r
162 > +           (let* ((name (plist-get elem :name))\r
163 > +                  (query (plist-get elem :query))\r
164 > +                  (msg-count (plist-get elem :count)))\r
165 >               (widget-insert (format "%8s "\r
166 >                                      (notmuch-hello-nice-number msg-count)))\r
167 >               (widget-create 'push-button\r