Re: A systematic way of handling Xapian lock errors?
[notmuch-archives.git] / 18 / 971bf2a04626f17b96969a779ad8cc4aa57035
1 Return-Path: <MarkR.Anderson@amd.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 013BA431FAF\r
6         for <notmuch@notmuchmail.org>; Tue, 27 Mar 2012 13:25:02 -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: -2.3\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=-2.3 tagged_above=-999 required=5\r
12         tests=[RCVD_IN_DNSWL_MED=-2.3] 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 FPv8uG6I4HHP for <notmuch@notmuchmail.org>;\r
16         Tue, 27 Mar 2012 13:25:02 -0700 (PDT)\r
17 Received: from va3outboundpool.messaging.microsoft.com\r
18         (va3ehsobe006.messaging.microsoft.com [216.32.180.16])\r
19         (using TLSv1 with cipher AES128-SHA (128/128 bits))\r
20         (No client certificate requested)\r
21         by olra.theworths.org (Postfix) with ESMTPS id 5DEAF431FAE\r
22         for <notmuch@notmuchmail.org>; Tue, 27 Mar 2012 13:25:02 -0700 (PDT)\r
23 Received: from mail173-va3-R.bigfish.com (10.7.14.251) by\r
24         VA3EHSOBE001.bigfish.com (10.7.40.21) with Microsoft SMTP Server id\r
25         14.1.225.23; Tue, 27 Mar 2012 20:24:48 +0000\r
26 Received: from mail173-va3 (localhost [127.0.0.1])      by\r
27         mail173-va3-R.bigfish.com (Postfix) with ESMTP id AF831C038D    for\r
28         <notmuch@notmuchmail.org>; Tue, 27 Mar 2012 20:24:47 +0000 (UTC)\r
29 X-SpamScore: 0\r
30 X-BigFish: VPS0(zzzz1202hzzz2dh668h839h944hd24h)\r
31 X-Forefront-Antispam-Report: CIP:163.181.249.109; KIP:(null); UIP:(null);\r
32         IPV:NLI; H:ausb3twp02.amd.com; RD:none; EFVD:NLI\r
33 Received: from mail173-va3 (localhost.localdomain [127.0.0.1]) by mail173-va3\r
34         (MessageSwitch) id 1332879885528605_15614;\r
35         Tue, 27 Mar 2012 20:24:45 +0000 (UTC)\r
36 Received: from VA3EHSMHS013.bigfish.com (unknown [10.7.14.240]) by\r
37         mail173-va3.bigfish.com (Postfix) with ESMTP id 77510600C0      for\r
38         <notmuch@notmuchmail.org>; Tue, 27 Mar 2012 20:24:45 +0000 (UTC)\r
39 Received: from ausb3twp02.amd.com (163.181.249.109) by\r
40         VA3EHSMHS013.bigfish.com (10.7.99.23) with Microsoft SMTP Server id\r
41         14.1.225.23; Tue, 27 Mar 2012 20:24:45 +0000\r
42 X-WSS-ID: 0M1K8PG-02-34Z-02\r
43 X-M-MSG: \r
44 Received: from sausexedgep02.amd.com (sausexedgep02-ext.amd.com\r
45         [163.181.249.73])       (using TLSv1 with cipher AES128-SHA (128/128\r
46         bits))  (No\r
47         client certificate requested)   by ausb3twp02.amd.com (Axway MailGate\r
48         3.8.1)\r
49         with ESMTP id 2B55BC8121        for <notmuch@notmuchmail.org>; Tue, 27 Mar 2012\r
50         15:24:52 -0500 (CDT)\r
51 Received: from sausexhtp02.amd.com (163.181.3.152) by sausexedgep02.amd.com\r
52         (163.181.36.59) with Microsoft SMTP Server (TLS) id 8.3.192.1;\r
53         Tue, 27 Mar 2012 15:25:05 -0500\r
54 Received: from adcvmail01.amd.com (163.181.21.78) by sausexhtp02.amd.com\r
55         (163.181.3.152) with Microsoft SMTP Server (TLS) id 8.3.213.0;\r
56         Tue, 27 Mar 2012 15:24:56 -0500\r
57 Received: from mhdc-ns01.amd.com (mhdc-ns01.amd.com [165.204.35.147])   by\r
58         adcvmail01.amd.com (8.13.8/8.13.8) with ESMTP id q2RKOolB021084 for\r
59         <notmuch@notmuchmail.org>; Tue, 27 Mar 2012 15:24:52 -0500\r
60 Received: from testarossa.amd.com (testarossa.amd.com [165.204.147.44]) by\r
61         mhdc-ns01.amd.com (8.13.8+Sun/8.13.8) with ESMTP id q2RKOsKc026864      for\r
62         <notmuch@notmuchmail.org>; Tue, 27 Mar 2012 14:24:54 -0600 (MDT)\r
63 Received: (from manderso@localhost)     by testarossa.amd.com\r
64         (8.13.8/8.13.8/Submit) id q2RKOcAY010042;\r
65         Tue, 27 Mar 2012 14:24:38 -0600\r
66 X-Authentication-Warning: testarossa.amd.com: manderso set sender to\r
67         MarkR.Anderson@amd.com using -f\r
68 From: Mark Anderson <MarkR.Anderson@amd.com>\r
69 To: Notmuch Mail <notmuch@notmuchmail.org>\r
70 Subject: Goto command for existing search windows\r
71 User-Agent: Notmuch/0.11.1+251~g1093c24 (http://notmuchmail.org) Emacs/23.2.1\r
72         (i686-pc-linux-gnu)\r
73 Date: Tue, 27 Mar 2012 14:24:36 -0600\r
74 Message-ID: <3wd1uod7px7.fsf@testarossa.amd.com>\r
75 MIME-Version: 1.0\r
76 Content-Type: text/plain; charset="us-ascii"\r
77 X-OriginatorOrg: amd.com\r
78 X-BeenThere: notmuch@notmuchmail.org\r
79 X-Mailman-Version: 2.1.13\r
80 Precedence: list\r
81 List-Id: "Use and development of the notmuch mail system."\r
82         <notmuch.notmuchmail.org>\r
83 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
84         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
85 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
86 List-Post: <mailto:notmuch@notmuchmail.org>\r
87 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
88 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
89         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
90 X-List-Received-Date: Tue, 27 Mar 2012 20:25:03 -0000\r
91 \r
92 I was looking for a function which would find a buffer based on one of\r
93 my saved searches, and perform the search if it didn't exist.\r
94 \r
95 I've gotten it a bit closer, if I perform the search that matches a\r
96 saved search, then this routine will find it because of the magic in\r
97 notmuch-search-buffer-title, but perhaps someone else feels up to\r
98 searching through the saved searches directly?\r
99 \r
100 \r
101 \r
102 (defun notmuch-goto-or-search (&optional query)\r
103   "Find a notmuch-search buffer with the given query, or run \r
104 \"notmuch search\" with the given `query' and display results.\r
105 \r
106 If `query' is nil, it is read interactively from the minibuffer."\r
107   (interactive)\r
108   (if (null query)\r
109       (setq query (notmuch-read-query "Notmuch goto-or-search: ")))\r
110   (let ((buffer-name (notmuch-search-buffer-title query)))\r
111     (setq buf (get-buffer buffer-name)))\r
112               \r
113     (if (not buf)\r
114         (notmuch-search query)\r
115       (switch-to-buffer buf)\r
116       )))\r
117 \r
118 I then use it something like this:\r
119 \r
120 (global-set-key [C-f1] (lambda () (interactive) (notmuch-goto-or-search "tag:inbox and tag:unread and not tag:deleted")))\r
121 (global-set-key [C-f2] (lambda () (interactive) (notmuch-goto-or-search "tag:inbox and not tag:deleted")))\r
122 (global-set-key [C-f3] 'notmuch)\r
123 (global-set-key [C-f6] (lambda () (interactive) (notmuch-goto-or-search "tag:todo and not tag:deleted")))\r
124 \r
125 It would be better if I could use my Inbox, INBOX and todo names for the\r
126 saved searches, but how to do that without breaking generality of\r
127 searching the body of the email?  Do I have to define my own ss: (saved\r
128 search) prefix or something, as I believe some others have?\r
129 \r
130 This is what I'm willing to do today, and it works for me, I could patch\r
131 notmuch.el, but I wondered about answering the other questions.\r
132 \r
133 Also, some elisp master could hint about how to make the binding not so\r
134 ugly. ;)\r
135 \r
136 Another appreciated elisp hint would be how to get the buf variable to\r
137 go inside the let, I keep getting complaints about buffer-name not being\r
138 defined, thus the "ugly" setq, which works.\r
139 \r
140 Enjoy,\r
141 \r
142 -Mark\r
143 \r