Re: [PATCH 0/4] Allow specifying alternate names for addresses in other_email
[notmuch-archives.git] / 4a / a02d997c314bc76834151d7897f384854a5a74
1 Return-Path: <jani@nikula.org>\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 B511A431FAE\r
6         for <notmuch@notmuchmail.org>; Thu,  6 Sep 2012 08:33:00 -0700 (PDT)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "References"\r
9 X-Spam-Flag: NO\r
10 X-Spam-Score: -0.7\r
11 X-Spam-Level: \r
12 X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5\r
13         tests=[RCVD_IN_DNSWL_LOW=-0.7] 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 8TByU1CfzxsP for <notmuch@notmuchmail.org>;\r
17         Thu,  6 Sep 2012 08:32:59 -0700 (PDT)\r
18 Received: from mail-lb0-f181.google.com (mail-lb0-f181.google.com\r
19         [209.85.217.181]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
20         (No client certificate requested)\r
21         by olra.theworths.org (Postfix) with ESMTPS id 4F814431FDA\r
22         for <notmuch@notmuchmail.org>; Thu,  6 Sep 2012 08:32:59 -0700 (PDT)\r
23 Received: by mail-lb0-f181.google.com with SMTP id gk1so1344042lbb.26\r
24         for <notmuch@notmuchmail.org>; Thu, 06 Sep 2012 08:32:58 -0700 (PDT)\r
25 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;\r
26         d=google.com; s=20120113;\r
27         h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references\r
28         :in-reply-to:references:x-gm-message-state;\r
29         bh=KvsPlCuF3X1Mzei7UwbBUt4hBv7Iv6yroufjbejmM9Q=;\r
30         b=gP807FpEBBI+R4pOxLEsDD0R7b/Xh9WEnoWY8nxGrQfrnxrEGh4L9ztS7LG7byaQ+s\r
31         kxKtCgNYocFV5GMnLUCFdFdaf6G045djKVIM1EgYZuuvEOdY/r4XhTFTL7PIw6GkeaLL\r
32         esIcIOI6svgVk1WYYnTAvAHD/G17niuLdcP8bc565Otjoj5UArISGYGLUvIe32wyBWNe\r
33         4vQxy8LG5vVNVJvVfRCOVoDpzvW3LTWzHteB265HZjSM5xTM1J3ClZi57B77ggQTGESx\r
34         Ah9kk9mUz3G20WvI+cYDLVH5kP4NtINxRSI/7s+A4YQz3O/q4p2eLgTerNLF7Wq+oBUw\r
35         d3kQ==\r
36 Received: by 10.152.135.147 with SMTP id ps19mr2317442lab.52.1346945578883;\r
37         Thu, 06 Sep 2012 08:32:58 -0700 (PDT)\r
38 Received: from localhost (dsl-hkibrasgw4-fe51df00-27.dhcp.inet.fi.\r
39         [80.223.81.27])\r
40         by mx.google.com with ESMTPS id o7sm678046lbg.4.2012.09.06.08.32.56\r
41         (version=SSLv3 cipher=OTHER); Thu, 06 Sep 2012 08:32:57 -0700 (PDT)\r
42 From: Jani Nikula <jani@nikula.org>\r
43 To: notmuch@notmuchmail.org\r
44 Subject: [PATCH v2 4/6] emacs: add support for custom tag changes on\r
45         message/thread archive\r
46 Date: Thu,  6 Sep 2012 18:32:40 +0300\r
47 Message-Id:\r
48  <6158e4e4866e1ba5d77a09e30b1540098a0cd000.1346945257.git.jani@nikula.org>\r
49 X-Mailer: git-send-email 1.7.9.5\r
50 In-Reply-To: <cover.1346945257.git.jani@nikula.org>\r
51 References: <cover.1346945257.git.jani@nikula.org>\r
52 In-Reply-To: <cover.1346945257.git.jani@nikula.org>\r
53 References: <cover.1346945257.git.jani@nikula.org>\r
54 X-Gm-Message-State:\r
55  ALoCoQlVzOXnlwb3GUkmEOpWVfdxYLjDYJsQVYftSRsienmGQZWHpr0OgFZK/VLxN90sMnm1qiam\r
56 Cc: Tomi Ollila <tomi.ollila@iki.fi>\r
57 X-BeenThere: notmuch@notmuchmail.org\r
58 X-Mailman-Version: 2.1.13\r
59 Precedence: list\r
60 List-Id: "Use and development of the notmuch mail system."\r
61         <notmuch.notmuchmail.org>\r
62 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
63         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
64 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
65 List-Post: <mailto:notmuch@notmuchmail.org>\r
66 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
67 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
68         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
69 X-List-Received-Date: Thu, 06 Sep 2012 15:33:01 -0000\r
70 \r
71 Add support for customization of the tag changes that are applied when\r
72 a message or a thread is archived. Instead of hard-coded removal of\r
73 the "inbox" tag, the user can now specify a list of tag changes to\r
74 perform.\r
75 ---\r
76  emacs/notmuch-lib.el  |   14 ++++++++++++++\r
77  emacs/notmuch-show.el |   29 +++++++++++++++++------------\r
78  emacs/notmuch.el      |   12 ++++++++++--\r
79  3 files changed, 41 insertions(+), 14 deletions(-)\r
80 \r
81 diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el\r
82 index 900235b..20d990d 100644\r
83 --- a/emacs/notmuch-lib.el\r
84 +++ b/emacs/notmuch-lib.el\r
85 @@ -82,6 +82,20 @@\r
86    :type '(alist :key-type string :value-type string)\r
87    :group 'notmuch-hello)\r
88  \r
89 +(defcustom notmuch-archive-tags '("-inbox")\r
90 +  "List of tag changes to apply to a message or a thread when it is archived.\r
91 +\r
92 +Tags starting with \"+\" (or not starting with either \"+\" or\r
93 +\"-\") in the list will be added, and tags starting with \"-\"\r
94 +will be removed from the message or thread being archived.\r
95 +\r
96 +For example, if you wanted to remove an \"inbox\" tag and add an\r
97 +\"archived\" tag, you would set:\r
98 +    (\"-inbox\" \"+archived\")"\r
99 +  :type '(repeat string)\r
100 +  :group 'notmuch-search\r
101 +  :group 'notmuch-show)\r
102 +\r
103  (defvar notmuch-folders nil\r
104    "Deprecated name for what is now known as `notmuch-saved-searches'.")\r
105  \r
106 diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el\r
107 index ce5ea6f..e701aec 100644\r
108 --- a/emacs/notmuch-show.el\r
109 +++ b/emacs/notmuch-show.el\r
110 @@ -1748,18 +1748,20 @@ argument, hide all of the messages."\r
111  (defun notmuch-show-archive-thread (&optional unarchive)\r
112    "Archive each message in thread.\r
113  \r
114 -Archive each message currently shown by removing the \"inbox\"\r
115 -tag from each.  If a prefix argument is given, the messages will\r
116 -be \"unarchived\" (ie. the \"inbox\" tag will be added instead of\r
117 -removed).\r
118 +Archive each message currently shown by applying the tag changes\r
119 +in `notmuch-archive-tags' to each (remove the \"inbox\" tag by\r
120 +default). If a prefix argument is given, the messages will be\r
121 +\"unarchived\", i.e. the tag changes in `notmuch-archive-tags'\r
122 +will be reversed.\r
123  \r
124  Note: This command is safe from any race condition of new messages\r
125  being delivered to the same thread. It does not archive the\r
126  entire thread, but only the messages shown in the current\r
127  buffer."\r
128    (interactive "P")\r
129 -  (let ((op (if unarchive "+" "-")))\r
130 -    (notmuch-show-tag-all (concat op "inbox"))))\r
131 +  (when notmuch-archive-tags\r
132 +    (notmuch-show-tag-all\r
133 +     (notmuch-tag-change-list notmuch-archive-tags unarchive))))\r
134  \r
135  (defun notmuch-show-archive-thread-then-next ()\r
136    "Archive all messages in the current buffer, then show next thread from search."\r
137 @@ -1774,14 +1776,17 @@ buffer."\r
138    (notmuch-show-next-thread))\r
139  \r
140  (defun notmuch-show-archive-message (&optional unarchive)\r
141 -  "Archive the current message (remove \"inbox\" tag).\r
142 +  "Archive the current message.\r
143  \r
144 -If a prefix argument is given, the message will be\r
145 -\"unarchived\" (ie. the \"inbox\" tag will be added instead of\r
146 -removed)."\r
147 +Archive the current message by applying the tag changes in\r
148 +`notmuch-archive-tags' to it (remove the \"inbox\" tag by\r
149 +default). If a prefix argument is given, the message will be\r
150 +\"unarchived\", i.e. the tag changes in `notmuch-archive-tags'\r
151 +will be reversed."\r
152    (interactive "P")\r
153 -  (let ((op (if unarchive "+" "-")))\r
154 -    (notmuch-show-tag-message (concat op "inbox"))))\r
155 +  (when notmuch-archive-tags\r
156 +    (apply 'notmuch-show-tag-message\r
157 +          (notmuch-tag-change-list notmuch-archive-tags unarchive))))\r
158  \r
159  (defun notmuch-show-archive-message-then-next-or-exit ()\r
160    "Archive the current message, then show the next open message in the current thread.\r
161 diff --git a/emacs/notmuch.el b/emacs/notmuch.el\r
162 index 1c43d3e..64caa3e 100644\r
163 --- a/emacs/notmuch.el\r
164 +++ b/emacs/notmuch.el\r
165 @@ -594,11 +594,19 @@ See `notmuch-tag' for information on the format of TAG-CHANGES."\r
166    (notmuch-search-tag "-"))\r
167  \r
168  (defun notmuch-search-archive-thread ()\r
169 -  "Archive the currently selected thread (remove its \"inbox\" tag).\r
170 +  "Archive the currently selected thread.\r
171 +\r
172 +Archive each message in the currently selected thread by applying\r
173 +the tag changes in `notmuch-archive-tags' to each (remove the\r
174 +\"inbox\" tag by default). If a prefix argument is given, the\r
175 +messages will be \"unarchived\" (i.e. the tag changes in\r
176 +`notmuch-archive-tags' will be reversed).\r
177  \r
178  This function advances the next thread when finished."\r
179    (interactive)\r
180 -  (notmuch-search-tag '("-inbox"))\r
181 +  (when notmuch-archive-tags\r
182 +    (notmuch-search-tag\r
183 +     (notmuch-tag-change-list notmuch-archive-tags)))\r
184    (notmuch-search-next-thread))\r
185  \r
186  (defun notmuch-search-update-result (result &optional pos)\r
187 -- \r
188 1.7.9.5\r
189 \r