Re: [PATCH 9/9] add has: query prefix to search for specific properties
[notmuch-archives.git] / 80 / c704f81f6a11e5931c2b8e0a93b912f1b246ca
1 Return-Path: <bgamari.foss@gmail.com>\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 589DA49F192\r
6         for <notmuch@notmuchmail.org>; Thu, 11 Mar 2010 07:24:22 -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: -0.185\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=-0.185 tagged_above=-999 required=5\r
12         tests=[BAYES_40=-0.185] autolearn=ham\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 hc6pchu6htkz for <notmuch@notmuchmail.org>;\r
16         Thu, 11 Mar 2010 07:24:21 -0800 (PST)\r
17 Received: from mail-ew0-f219.google.com (mail-ew0-f219.google.com\r
18         [209.85.219.219])\r
19         by olra.theworths.org (Postfix) with ESMTP id B57D849F191\r
20         for <notmuch@notmuchmail.org>; Thu, 11 Mar 2010 07:24:20 -0800 (PST)\r
21 Received: by ewy19 with SMTP id 19so63174ewy.2\r
22         for <notmuch@notmuchmail.org>; Thu, 11 Mar 2010 07:24:05 -0800 (PST)\r
23 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;\r
24         h=domainkey-signature:received:received:message-id:date:from:to\r
25         :subject; bh=xan/iuTKOLF5y4MI7UmMIFb74H6ycdvGvr5s4REcn/Y=;\r
26         b=BUreiEoIh38HVcAqQgUVHI+mrv0o88PsUS+gpJHIB2WSE0MxrrFkmsOiGGeiNvozcm\r
27         3135a9olixiXPlsG5KGclnxbIPVscLUonPaLzA38s82ezPKsFGQ6Jairx0iABHuZ2Ys0\r
28         9VeJJTEmB2NMT9hIlEsMWF0FeYxJ/AlB0I+xI=\r
29 DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma;\r
30         h=message-id:date:from:to:subject;\r
31         b=gCON4S5DTgHH0d/KoGPYD8WExdJPy64d45u1mr/j7sSvjf4keFg25H/wJspVfsUYDD\r
32         7Fmpes8wIJbsiVR2domKHAQa5XjGs310z3kPEe5wO3IfCjw0n2Gw48CLxGydqDKhtbza\r
33         EPIsqv30ocsxYacYGmRRSwfBXWxYhIYVKdhLY=\r
34 Received: by 10.213.103.146 with SMTP id k18mr2158847ebo.5.1268321045515;\r
35         Thu, 11 Mar 2010 07:24:05 -0800 (PST)\r
36 Received: from localhost (pool-96-236-125-203.spfdma.east.verizon.net\r
37         [96.236.125.203])\r
38         by mx.google.com with ESMTPS id 15sm62383ewy.8.2010.03.11.07.24.02\r
39         (version=TLSv1/SSLv3 cipher=RC4-MD5);\r
40         Thu, 11 Mar 2010 07:24:05 -0800 (PST)\r
41 Message-ID: <4b990b15.0f67f10a.361e.0682@mx.google.com>\r
42 Date: Thu, 11 Mar 2010 07:24:05 -0800 (PST)\r
43 From: Ben Gamari <bgamari.foss@gmail.com>\r
44 To: notmuch <notmuch@notmuchmail.org>\r
45 Subject: [notmuch] My shiny new notmuch configuration\r
46 X-BeenThere: notmuch@notmuchmail.org\r
47 X-Mailman-Version: 2.1.13\r
48 Precedence: list\r
49 List-Id: "Use and development of the notmuch mail system."\r
50         <notmuch.notmuchmail.org>\r
51 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
52         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
53 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
54 List-Post: <mailto:notmuch@notmuchmail.org>\r
55 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
56 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
57         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
58 X-List-Received-Date: Thu, 11 Mar 2010 15:24:22 -0000\r
59 \r
60 Hey all,\r
61 \r
62 After standing on the sidelines for several months now, I've finally transitioned to\r
63 using notmuch exclusively. I had originally intended on waiting until the vim was\r
64 in a usable state, but it seems that the emacs client is usable enough for\r
65 basic mail reading for the time being. It took a bit of thinking to figure out\r
66 how thing should be implemented, but I think it turned out alright. There are\r
67 still a few sticky spots, but hopefully I'll be able to iron those out in time.\r
68 \r
69 Regardless, I couldn't sacrifice my preference for vim for email composition and\r
70 therefore have been using a small wrapper script[10] to begin new drafts. I\r
71 also have a small python script[12] so that I can make use of my old sup address\r
72 book. Finally, I have a script for sending a draft and placing it in my sent\r
73 maildir. My tagging script[13] is very similar to those posted here before.\r
74 \r
75 All-in-all, things seem very usable and I'm quite happy with how my notmuch\r
76 configuration has turned out. It will be very nice with a real vim interface, which I'll\r
77 hopefully have time to work on in May or so.\r
78 \r
79 Unfortunately, both notmuch new and the initial tagging process are a bit slower\r
80 than I would like (with fairly warm caches notmuch new just took 20 seconds to\r
81 add 2 messages, which then took an additional 45 seconds to tag) but still\r
82 usable. I believe I should have the newest Xapian bits so I guess figuring out\r
83 the issue here could require some investigation. \r
84 \r
85 In the meantime, I've done a some hacking on the noneatall[1] web interface\r
86 that was posted here a little while ago, restructing the code a little and\r
87 adding a tag list. I intend doing more work on this in the future. At the\r
88 moment the latency really kills usability, but with some work I suspect a web\r
89 interface might be very usable.\r
90 \r
91 I hope that someone finds this at least slightly useful.\r
92 \r
93 Cheers,\r
94 \r
95 - Ben\r
96 \r
97 \r
98 [1] 874okzdgh0.fsf@aw.hh.sledj.ne\r
99 \r
100 [10] compose-mail\r
101 #!/bin/bash\r
102 \r
103 cd ~/.mail/.drafts\r
104 TO=$(contacts $@)\r
105 gvim - +3 -c'set syntax=mail'  <<EOF\r
106 From: Ben Gamari <bgamari@gmail.com>\r
107 To: ${TO}\r
108 Subject: \r
109 \r
110 \r
111 EOF\r
112 \r
113 \r
114 [11] contacts\r
115 #!/usr/bin/python\r
116 \r
117 # Simple address book lookup:\r
118 # Usage: contacts.py [alias]\r
119 # Outputs: Full Name <Email@address>\r
120 \r
121 import os\r
122 import sys\r
123 \r
124 contacts_file = os.path.expanduser('~/.contacts')\r
125 \r
126 def get():\r
127         contacts = {}\r
128         for l in open(contacts_file, 'r'):\r
129                 name,address = l.split(':')\r
130                 contacts[name.strip()] = address.strip()\r
131         return contacts\r
132 \r
133 if __name__ == '__main__':\r
134         contacts = get()\r
135         m = []\r
136         m = [ contacts.get(name, name) for name in sys.argv[1:] ]\r
137         print ", ".join(m)\r
138 \r
139 \r
140 [13] sort-mail\r
141 #!/usr/bin/python\r
142 \r
143 dry_run = False\r
144 \r
145 \r
146 import subprocess\r
147 import time\r
148 \r
149 def sf_list(name):\r
150         return 'to:%s@lists.sourceforge.net or to:%s@lists.sf.net' % (name, name)\r
151 def kernel_list(name):\r
152         return 'to:%s@vger.kernel.org' % name\r
153 def fdo_list(name):\r
154         return 'to:%s@lists.freedesktop.org' % name\r
155 \r
156 # These are bulk message sources which should be immediately archived\r
157 list_tags = {\r
158         kernel_list('linux-kernel'): 'lkml',\r
159         kernel_list('linux-omap') : 'linux-omap',\r
160         kernel_list('linux-next'): 'linux-next',\r
161         'to:linux-arm-kernel@lists.infradead.org': 'linux-arm',\r
162         sf_list('oprofile-list'): 'oprofile',\r
163 \r
164         sf_list('ipw3945-devel'): 'ipw',\r
165         'to:hostap@lists.shmoo.com': 'hostap',\r
166         'to:ath9k-devel@': 'ath9k',\r
167         'to:vim-dev@vim.org': 'vim',\r
168         \r
169         fdo_list('intel-gfx'): 'intel-gfx',\r
170         fdo_list('xorg'): 'xorg',\r
171         fdo_list('hal'): 'hal',\r
172         fdo_list('compiz'): 'compiz',\r
173         sf_list('dri-devel'): 'dri',\r
174         sf_list('dri-users'): 'dri',\r
175         sf_list('mesa3d-dev'): 'mesa',\r
176 \r
177         fdo_list('devkit-devel'): 'devkit',\r
178         sf_list('matplotlib-users'): 'matplotlib',\r
179         'to:notmuch@notmuchmail.org': 'notmuch',\r
180 \r
181         'to:openembedded-devel@lists.openembedded.org': 'openembedded',\r
182         'to:beagleboard@googlegroups.com': 'beagleboard',\r
183         'to:angstrom-distro-devel@linuxtogo.org': 'angstrom',\r
184         'to:angstrom-distro-users@linuxtogo.org': 'angstrom',\r
185 \r
186         'to:mono-devel-list@lists.ximian.com': 'mono',\r
187         'to:mono-list@': 'mono',\r
188         'to:ubuntu-devel-discuss@lists.ubuntu.com': 'ubuntu-devel',\r
189         'to:git@vger.kernel.org': 'git',\r
190         'to:sup-talk@rubyforge.org': 'sup',\r
191 \r
192         'from:bugzilla': 'bugs',\r
193         'to:gdh@gdhour.com': 'gdh',\r
194         'from:Facebook': 'facebook',\r
195 }\r
196 \r
197 # Tags that aren't for lists\r
198 generic_tags = {\r
199         'from:goldner': 'lori',\r
200         'to:goldnerlab': 'lori',\r
201         'to:babaev1@physics.umass.edu': 'stat-mech',\r
202         'to:pgradon@physics.umass.edu': 'pgradon',\r
203 }\r
204 \r
205 def notmuch(*args):\r
206         cmd = ['notmuch']\r
207         cmd.extend(args)\r
208         print ' '.join(cmd)\r
209         if dry_run: return\r
210 \r
211         while True:\r
212                 res = subprocess.call(cmd)\r
213                 if res == 0: break\r
214                 print "Call failed. Trying again in 1 second..."\r
215                 time.sleep(1)\r
216         \r
217 \r
218 # Tag things\r
219 for terms, tag in generic_tags.items():\r
220         notmuch('tag', '+%s' % tag, 'tag:inbox', terms)\r
221 \r
222 # Tag lists\r
223 for terms, tag in list_tags.items():\r
224         notmuch('tag', '+list', '+%s' % tag, 'tag:inbox', terms)\r
225 \r
226 # Remove inbox for lists\r
227 for terms, tag in list_tags.items():\r
228         notmuch('tag', '-inbox', 'tag:inbox', terms)\r
229 \r
230 \r