[PATCH 1/9] lib: read "property" terms from messages.
[notmuch-archives.git] / 40 / b8ad8c695c19a29ef0b2db543160c59c6c0479
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 CFA14431FBF\r
6         for <notmuch@notmuchmail.org>; Tue, 22 Oct 2013 17:22:42 -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 SjPu9ujcn4EZ for <notmuch@notmuchmail.org>;\r
16         Tue, 22 Oct 2013 17:22:37 -0700 (PDT)\r
17 Received: from dmz-mailsec-scanner-4.mit.edu (dmz-mailsec-scanner-4.mit.edu\r
18         [18.9.25.15])\r
19         by olra.theworths.org (Postfix) with ESMTP id B8A6F431FBC\r
20         for <notmuch@notmuchmail.org>; Tue, 22 Oct 2013 17:22:16 -0700 (PDT)\r
21 X-AuditID: 1209190f-b7fa08e0000009c6-c9-526716b84dd7\r
22 Received: from mailhub-auth-4.mit.edu ( [18.7.62.39])\r
23         by dmz-mailsec-scanner-4.mit.edu (Symantec Messaging Gateway) with SMTP\r
24         id 4E.A6.02502.8B617625; Tue, 22 Oct 2013 20:22:16 -0400 (EDT)\r
25 Received: from outgoing.mit.edu (outgoing-auth-1.mit.edu [18.9.28.11])\r
26         by mailhub-auth-4.mit.edu (8.13.8/8.9.2) with ESMTP id r9N0M5gb017164; \r
27         Tue, 22 Oct 2013 20:22:05 -0400\r
28 Received: from drake.dyndns.org\r
29         (216-15-114-40.c3-0.arl-ubr1.sbo-arl.ma.cable.rcn.com\r
30         [216.15.114.40]) (authenticated bits=0)\r
31         (User authenticated as amdragon@ATHENA.MIT.EDU)\r
32         by outgoing.mit.edu (8.13.8/8.12.4) with ESMTP id r9N0M3XF005841\r
33         (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT);\r
34         Tue, 22 Oct 2013 20:22:04 -0400\r
35 Received: from amthrax by drake.dyndns.org with local (Exim 4.77)\r
36         (envelope-from <amdragon@mit.edu>)\r
37         id 1VYmD5-0008KI-Nt; Tue, 22 Oct 2013 20:22:03 -0400\r
38 From: Austin Clements <amdragon@MIT.EDU>\r
39 To: notmuch@notmuchmail.org\r
40 Subject: [PATCH v2 3/8] emacs: Use interactive specifications for tag changes\r
41         in show\r
42 Date: Tue, 22 Oct 2013 20:21:56 -0400\r
43 Message-Id: <1382487721-31776-4-git-send-email-amdragon@mit.edu>\r
44 X-Mailer: git-send-email 1.8.4.rc3\r
45 In-Reply-To: <1382487721-31776-1-git-send-email-amdragon@mit.edu>\r
46 References: <1382487721-31776-1-git-send-email-amdragon@mit.edu>\r
47 X-Brightmail-Tracker:\r
48  H4sIAAAAAAAAA+NgFtrDIsWRmVeSWpSXmKPExsUixG6nrrtDLD3IoHm7kMXquTwW12/OZHZg\r
49         8tg56y67x7NVt5gDmKK4bFJSczLLUov07RK4Mt6sNCs4JlNx4MdDtgbGJ+JdjJwcEgImEpMn\r
50         3WGBsMUkLtxbz9bFyMUhJLCPUeLE8i1QzkZGib7/HewQzh0miYuTjkE5cxkldvfvYAfpZxPQ\r
51         kNi2fzkjiC0iIC2x8+5sVhCbWcBR4vP+RWwgtrBAqMTUzTPB9rEIqEos/f8NrJ5XwEHiw6/p\r
52         UHcoSSw8tQ2slxOo982OD2C9QkA1U3aeYZnAyL+AkWEVo2xKbpVubmJmTnFqsm5xcmJeXmqR\r
53         rolebmaJXmpK6SZGUCBxSvLvYPx2UOkQowAHoxIP74OWtCAh1sSy4srcQ4ySHExKorzq/OlB\r
54         QnxJ+SmVGYnFGfFFpTmpxYcYJTiYlUR4m32BynlTEiurUovyYVLSHCxK4rw3OeyDhATSE0tS\r
55         s1NTC1KLYLIyHBxKErxMwIgREixKTU+tSMvMKUFIM3FwggznARquDFLDW1yQmFucmQ6RP8Wo\r
56         KCXOe0YUKCEAksgozYPrhUX6K0ZxoFeEeZ+BVPEAkwRc9yugwUxAg6csAbm6uCQRISXVwKj9\r
57         q2fTqpm/mY67pyp26Jcz/5C2LXXaxvDU5N5RVtlPeqd+OzoXvzpz7mbRkYykedOs+Zok7LV+\r
58         /cssjD+xrCJ11wWlFa+X99wxEn5xv8/7o+Xctrl7d69imKSY9sU5IedB6xMNX6mJStdnMj1+\r
59         550Za+BQl7W9o1CSXeYpn24/Y2Xy3sv3W5RYijMSDbWYi4oTAUgxkkTPAgAA\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: Wed, 23 Oct 2013 00:22:43 -0000\r
73 \r
74 This modifies all tagging operations in show to call\r
75 `notmuch-read-tag-changes' in their interactive specification to input\r
76 tag changes, rather than depending on lower-level functions to prompt\r
77 for tag changes regardless of their calling context.\r
78 \r
79 Besides being more Elispy and providing a more consistent programmatic\r
80 API, this enables callers to provide two call site-specific pieces of\r
81 information: an appropriate prompt, and the set of visible tags.  The\r
82 prompt lets us differentiate * from +/-.  Providing visible tags\r
83 enables a more consistent user experience than retrieving the\r
84 (potentially different) tags from the database, and avoids a\r
85 round-trip to the CLI and database.\r
86 ---\r
87  emacs/notmuch-show.el | 33 ++++++++++++++++++++-------------\r
88  1 file changed, 20 insertions(+), 13 deletions(-)\r
89 \r
90 diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el\r
91 index 7325792..f66d669 100644\r
92 --- a/emacs/notmuch-show.el\r
93 +++ b/emacs/notmuch-show.el\r
94 @@ -1780,23 +1780,28 @@ TAG-CHANGES is a list of tag operations for `notmuch-tag'."\r
95        (notmuch-tag (notmuch-show-get-message-id) tag-changes)\r
96        (notmuch-show-set-tags new-tags))))\r
97  \r
98 -(defun notmuch-show-tag (&optional tag-changes)\r
99 +(defun notmuch-show-tag (tag-changes)\r
100    "Change tags for the current message.\r
101  \r
102  See `notmuch-tag' for information on the format of TAG-CHANGES."\r
103 -  (interactive)\r
104 -  (let* ((tag-changes (notmuch-tag (notmuch-show-get-message-id) tag-changes))\r
105 -        (current-tags (notmuch-show-get-tags))\r
106 +  (interactive (list (notmuch-read-tag-changes (notmuch-show-get-tags)\r
107 +                                              "Tag message")))\r
108 +  (notmuch-tag (notmuch-show-get-message-id) tag-changes)\r
109 +  (let* ((current-tags (notmuch-show-get-tags))\r
110          (new-tags (notmuch-update-tags current-tags tag-changes)))\r
111      (unless (equal current-tags new-tags)\r
112        (notmuch-show-set-tags new-tags))))\r
113  \r
114 -(defun notmuch-show-tag-all (&optional tag-changes)\r
115 +(defun notmuch-show-tag-all (tag-changes)\r
116    "Change tags for all messages in the current show buffer.\r
117  \r
118  See `notmuch-tag' for information on the format of TAG-CHANGES."\r
119 -  (interactive)\r
120 -  (setq tag-changes (notmuch-tag (notmuch-show-get-messages-ids-search) tag-changes))\r
121 +  (interactive\r
122 +   (list (let (tags)\r
123 +          (notmuch-show-mapc\r
124 +           (lambda () (setq tags (append (notmuch-show-get-tags) tags))))\r
125 +          (notmuch-read-tag-changes tags "Tag thread"))))\r
126 +  (notmuch-tag (notmuch-show-get-messages-ids-search) tag-changes)\r
127    (notmuch-show-mapc\r
128     (lambda ()\r
129       (let* ((current-tags (notmuch-show-get-tags))\r
130 @@ -1804,19 +1809,21 @@ See `notmuch-tag' for information on the format of TAG-CHANGES."\r
131         (unless (equal current-tags new-tags)\r
132          (notmuch-show-set-tags new-tags))))))\r
133  \r
134 -(defun notmuch-show-add-tag ()\r
135 +(defun notmuch-show-add-tag (tag-changes)\r
136    "Change tags for the current message (defaulting to add).\r
137  \r
138  Same as `notmuch-show-tag' but sets initial input to '+'."\r
139 -  (interactive)\r
140 -  (notmuch-show-tag "+"))\r
141 +  (interactive\r
142 +   (list (notmuch-read-tag-changes (notmuch-show-get-tags) "Tag message" "+")))\r
143 +  (notmuch-show-tag tag-changes))\r
144  \r
145 -(defun notmuch-show-remove-tag ()\r
146 +(defun notmuch-show-remove-tag (tag-changes)\r
147    "Change tags for the current message (defaulting to remove).\r
148  \r
149  Same as `notmuch-show-tag' but sets initial input to '-'."\r
150 -  (interactive)\r
151 -  (notmuch-show-tag "-"))\r
152 +  (interactive\r
153 +   (list (notmuch-read-tag-changes (notmuch-show-get-tags) "Tag message" "-")))\r
154 +  (notmuch-show-tag tag-changes))\r
155  \r
156  (defun notmuch-show-toggle-visibility-headers ()\r
157    "Toggle the visibility of the current message headers."\r
158 -- \r
159 1.8.4.rc3\r
160 \r