[PATCH 9/9] add has: query prefix to search for specific properties
[notmuch-archives.git] / 96 / 1c4c17dce1614f753e23615153389491303e29
1 Return-Path: <brett.viren@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 6D2DA40DF1F\r
6         for <notmuch@notmuchmail.org>; Sat, 20 Nov 2010 17:12:54 -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: -1.999\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=-1.999 tagged_above=-999 required=5\r
12         tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1,\r
13         DKIM_VALID_AU=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001]\r
14         autolearn=ham\r
15 Received: from olra.theworths.org ([127.0.0.1])\r
16         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
17         with ESMTP id b9SpYFpOPHWk for <notmuch@notmuchmail.org>;\r
18         Sat, 20 Nov 2010 17:12:42 -0800 (PST)\r
19 Received: from mail-fx0-f53.google.com (mail-fx0-f53.google.com\r
20         [209.85.161.53])\r
21         by olra.theworths.org (Postfix) with ESMTP id 9B5E540DEEC\r
22         for <notmuch@notmuchmail.org>; Sat, 20 Nov 2010 17:12:42 -0800 (PST)\r
23 Received: by fxm10 with SMTP id 10so952083fxm.26\r
24         for <notmuch@notmuchmail.org>; Sat, 20 Nov 2010 17:12:41 -0800 (PST)\r
25 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;\r
26         h=domainkey-signature:mime-version:received:received:in-reply-to\r
27         :references:date:message-id:subject:from:to:content-type\r
28         :content-transfer-encoding;\r
29         bh=j7D6tAs4NKNqGZT3xJMP7/gE67E21ksM0Mak/L51WCI=;\r
30         b=ttkurPhHi+T8GMJR5VbytDIl1FYp0nHWPBKWbfMm5qN7UCwk+7UzyudGb6EhOf7pjj\r
31         OcIqqD5N6+iwnHTQoo8Ank+rUGzdng5J9pSqmJav2KuVyltuvxxebHNwfQADoxTGy+0l\r
32         +I5ireUq1h5DT2/rfhiZ7SFi8UW2RKqJZgAoM=\r
33 DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma;\r
34         h=mime-version:in-reply-to:references:date:message-id:subject:from:to\r
35         :content-type:content-transfer-encoding;\r
36         b=DcXqgBHrr9dtWwu93wOIKGPBnGLQVFLOUFM3jBKKjU+CrvpJ+KfJNPQDZykpoPLCGX\r
37         ZhiWe4PGYjwpT9rkwChY1Ojk/guLcsiYlEWhRRsimpBcxYPoOub7NKOEXhneEld6jDHr\r
38         h64+UTqnFYN4t7FzTDG0QNg0YxiDTAiTWOq6o=\r
39 MIME-Version: 1.0\r
40 Received: by 10.223.122.146 with SMTP id l18mr2598426far.102.1290301961671;\r
41         Sat, 20 Nov 2010 17:12:41 -0800 (PST)\r
42 Received: by 10.223.89.142 with HTTP; Sat, 20 Nov 2010 17:12:41 -0800 (PST)\r
43 In-Reply-To: <87zl6cl595.fsf@thinkpad.tsdh.de>\r
44 References: <87zl6cl595.fsf@thinkpad.tsdh.de>\r
45 Date: Sat, 20 Nov 2010 20:12:41 -0500\r
46 Message-ID: <AANLkTimrF2OXzJFNfhrJ-rA44FRDRw_7PKMGD3Kec2D4@mail.gmail.com>\r
47 Subject: Re: [notmuch] Snippet to jump to message in Gnus from notmuch-show\r
48         buffer\r
49 From: Brett Viren <brett.viren@gmail.com>\r
50 To: notmuch@notmuchmail.org\r
51 Content-Type: text/plain; charset=ISO-8859-1\r
52 Content-Transfer-Encoding: quoted-printable\r
53 X-BeenThere: notmuch@notmuchmail.org\r
54 X-Mailman-Version: 2.1.13\r
55 Precedence: list\r
56 List-Id: "Use and development of the notmuch mail system."\r
57         <notmuch.notmuchmail.org>\r
58 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
59         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
60 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
61 List-Post: <mailto:notmuch@notmuchmail.org>\r
62 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
63 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
64         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
65 X-List-Received-Date: Sun, 21 Nov 2010 01:12:54 -0000\r
66 \r
67 Hi Tassilo,\r
68 \r
69 I adapted your code for my use and found it was failing due to some\r
70 stray double-quotes.  I'm using notmuch from git so maybe these quotes\r
71 were added in the year since you first posted your idea.\r
72 \r
73 See below for the simple fix:\r
74 \r
75 On Tue, Nov 24, 2009 at 3:02 AM, Tassilo Horn <tassilo@member.fsf.org> wrot=\r
76 e:\r
77 > --8<---------------cut here---------------start------------->8---\r
78 > (require 'notmuch)\r
79 >\r
80 > (defun th-notmuch-file-to-group (file)\r
81 > =A0"Calculate the Gnus group name from the given file name.\r
82 >\r
83 > Example:\r
84 >\r
85 > =A0IN: /home/horn/Mail/Dovecot/uni/INBOX/dbox-Mails/u.4075\r
86 > =A0OUT: nnimap+Uni:INBOX"\r
87 > =A0(concat "nnimap+"\r
88 > =A0 =A0 =A0 =A0 =A0(replace-regexp-in-string\r
89 > =A0 =A0 =A0 =A0 =A0 "^\\([^/]+\\)/" "\\1:"\r
90 > =A0 =A0 =A0 =A0 =A0 (replace-regexp-in-string\r
91 > =A0 =A0 =A0 =A0 =A0 =A0"/dbox-Mails/.*" ""\r
92 > =A0 =A0 =A0 =A0 =A0 =A0(replace-regexp-in-string\r
93 > =A0 =A0 =A0 =A0 =A0 =A0 "/home/horn/Mail/Dovecot/" "" file)))))\r
94 >\r
95 > (defun th-notmuch-goto-message-in-gnus ()\r
96 > =A0"Open a summary buffer containing the current notmuch\r
97 > article."\r
98 > =A0(interactive)\r
99 > =A0(let ((group (th-notmuch-file-to-group (notmuch-show-get-filename)))\r
100 > =A0 =A0 =A0 =A0(message-id (replace-regexp-in-string\r
101 > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 "^id:" "" (notmuch-show-get-messa=\r
102 ge-id))))\r
103 \r
104 I needed to define the message-id like:\r
105 \r
106        (message-id (replace-regexp-in-string\r
107                     "\"" ""\r
108                     (replace-regexp-in-string\r
109                     "^id:" "" (notmuch-show-get-message-id)))))\r
110 \r
111 \r
112 > =A0 =A0(message "G: %s, mid: %s" group message-id)\r
113 > =A0 =A0(if (and group message-id)\r
114 > =A0 =A0 =A0 =A0(org-gnus-follow-link group message-id)\r
115 > =A0 =A0 =A0(message "Couldn't get relevant infos for switching to Gnus.")=\r
116 )))\r
117 >\r
118 > (define-key notmuch-show-mode-map (kbd "C-c C-c") 'th-notmuch-goto-messag=\r
119 e-in-gnus)\r
120 > --8<---------------cut here---------------end--------------->8---\r
121 \r
122 Regards and thanks for this handy code!\r
123 -Brett.\r