Re: notmuchsync: handling of the deleted tag
[notmuch-archives.git] / 4e / 671b1b98e2b9524de04195d10925da01029bf8
1 Return-Path: <cworth@cworth.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 75A6540DDED\r
6         for <notmuch@notmuchmail.org>; Fri, 12 Nov 2010 16:53:03 -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: -2.89\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=-2.89 tagged_above=-999 required=5\r
12         tests=[ALL_TRUSTED=-1, BAYES_00=-1.9, T_MIME_NO_TEXT=0.01]\r
13         autolearn=ham\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 fDOL47gCbthG; Fri, 12 Nov 2010 16:52:52 -0800 (PST)\r
17 Received: from yoom.home.cworth.org (localhost [127.0.0.1])\r
18         by olra.theworths.org (Postfix) with ESMTP id 0850A40DDCA;\r
19         Fri, 12 Nov 2010 16:52:52 -0800 (PST)\r
20 Received: by yoom.home.cworth.org (Postfix, from userid 1000)\r
21         id A5EDA25412B; Fri, 12 Nov 2010 16:52:51 -0800 (PST)\r
22 From: Carl Worth <cworth@cworth.org>\r
23 To: Dirk Hohndel <hohndel@infradead.org>,\r
24         Sebastian Spaeth <Sebastian@SSpaeth.de>,\r
25         Notmuch developer list <notmuch@notmuchmail.org>\r
26 Subject: Re: notmuchsync: handling of the deleted tag\r
27 In-Reply-To: <m34obmdzjj.fsf@x201s.gr8dns.org>\r
28 References: <87bp7vewa5.fsf@raven.defaultvalue.org>\r
29  <87mxrcsb8a.fsf@SSpaeth.de>    <87r5gnomt2.fsf@raven.defaultvalue.org>\r
30         <87hbfnmiux.fsf@yoom.home.cworth.org>   <87oc9vf17n.fsf@SSpaeth.de>\r
31  <m34obmdzjj.fsf@x201s.gr8dns.org>\r
32 User-Agent: Notmuch/0.4 (http://notmuchmail.org) Emacs/23.2.1\r
33         (i486-pc-linux-gnu)\r
34 Date: Fri, 12 Nov 2010 16:52:51 -0800\r
35 Message-ID: <87pqua82os.fsf@yoom.home.cworth.org>\r
36 MIME-Version: 1.0\r
37 Content-Type: multipart/signed; boundary="=-=-=";\r
38         micalg=pgp-sha1; protocol="application/pgp-signature"\r
39 X-BeenThere: notmuch@notmuchmail.org\r
40 X-Mailman-Version: 2.1.13\r
41 Precedence: list\r
42 List-Id: "Use and development of the notmuch mail system."\r
43         <notmuch.notmuchmail.org>\r
44 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
45         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
46 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
47 List-Post: <mailto:notmuch@notmuchmail.org>\r
48 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
49 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
50         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
51 X-List-Received-Date: Sat, 13 Nov 2010 00:53:03 -0000\r
52 \r
53 --=-=-=\r
54 Content-Transfer-Encoding: quoted-printable\r
55 \r
56 On Fri, 12 Nov 2010 13:04:16 -0800, Dirk Hohndel <hohndel@infradead.org> wr=\r
57 ote:\r
58 > > notmuchsync. Seriously, what does notmuchsync still provide that notmuch\r
59 > > cannot do? I wonder if I shouldn't stick a "deprecated" warning on it.\r
60 >=20\r
61 > Please don't! I use it all the time:\r
62 \r
63 Excellent. I love getting more feedback from users so that we can\r
64 understand things better.\r
65 \r
66 > I use it to archive mail that I don't want on an imap server any more,\r
67 > but in a local maildir. Can't do that with notmuch.\r
68 \r
69 Can you describe this use case in a bit more detail? I'd like to\r
70 understand what needs to be done to support this.\r
71 \r
72 > I use it to prune mail that has the deleted tag. Again not something\r
73 > that notmuch supports.\r
74 \r
75 This one is a simple one-liner as of notmuch 0.4:\r
76 \r
77     notmuch search --output=3Dfiles tag:deleted -print0 | xargs -0 rm\r
78 \r
79 And that's something we could even add to a keybinding in the emacs\r
80 interface[*].\r
81 \r
82 Meanwhile, I know people have asked for keybindings to even just add the\r
83 "deleted" tag before. What I still want for that is good support for\r
84 being able to configure tags that cause mails to be automatically\r
85 omitted from search results---unless the user is explicitly searching\r
86 for mails with that tag. So for example, I would add "deleted" and\r
87 "spam" to such a list and never see mails with that tag unless I go\r
88 looking for a mis-tagged email with a search like "from:someone and\r
89 tag:spam".\r
90 \r
91 I think the above should be fairly easy. One way to do it is to just\r
92 implicitly add "and not (tag:deleted or tag:spam)" to all searches. And\r
93 then simply omit the relevant portion of this if the original search\r
94 terms happen to mention tag:deleted or tag:spam. This is what sup does,\r
95 for example.\r
96 \r
97 =2DCarl\r
98 \r
99 [*] Personally, I don't want a keybinding for actual deletion of mail\r
100 files. As long as nothing appears in searches, then I'd prefer the\r
101 tagged messages not be deleted right away. Instead, I'd like a cron job\r
102 to delete appropriately tagged messages after some safety interval (a\r
103 month, say). For that, I'd like better support for specifying message\r
104 dates of course, (that's been on my todo list for some time). But\r
105 really, I care about the date of the tag, not the date of the\r
106 message. We don't save information like that, but the cron script could\r
107 do something cheesy like implement counters in tags:\r
108 \r
109   # XXX: Entirely untested!\r
110 \r
111   # Days after a mail is tag:deleted when the mail will be deleted\r
112   EXPIRATION=3D30\r
113   for days in $(seq 0 $((EXPIRATION - 1))); do\r
114     notmuch tag +expire-$((days)) -expire-$((days + 1)) tag:expire-$(days +=\r
115  1))\r
116   done\r
117 \r
118   notmuch search --output=3Dfiles tag:expire-0 and tag:deleted -print0 | xa=\r
119 rgs -0 rm\r
120   notmuch tag -expire-0 tag:expire-0\r
121 \r
122   notmuch tag +expire-$EXPIRATION +expiring tag:deleted and not tag:expiring\r
123   notmuch tag -expiring not tag:deleted\r
124 \r
125 OK. Looking at that---that's *really* cheesy. Perhaps we should come up\r
126 with a sane way to do this. Hooks on the addition or deletion of the\r
127 "deleted" tag that set/cleared a date value in the message document in\r
128 the database might be much cleaner.\r
129 \r
130 But the above might actually work for now. Anyone brave enough to test\r
131 it?\r
132 \r
133 =2D-=20\r
134 carl.d.worth@intel.com\r
135 \r
136 --=-=-=\r
137 Content-Type: application/pgp-signature\r
138 \r
139 -----BEGIN PGP SIGNATURE-----\r
140 Version: GnuPG v1.4.10 (GNU/Linux)\r
141 \r
142 iD8DBQFM3eFj6JDdNq8qSWgRAuxSAJ96voAudHOJQNe1pMpfp02iydOBzgCgoH3V\r
143 la+asnmRbd7AOdTao2yjEes=\r
144 =mGIG\r
145 -----END PGP SIGNATURE-----\r
146 --=-=-=--\r