1 Return-Path: <pieter@praet.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 B5C48429E25
\r
6 for <notmuch@notmuchmail.org>; Sun, 10 Jul 2011 07:11:53 -0700 (PDT)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5
\r
12 tests=[RCVD_IN_DNSWL_LOW=-0.7] 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 9cCeYYwX5Y7T for <notmuch@notmuchmail.org>;
\r
16 Sun, 10 Jul 2011 07:11:53 -0700 (PDT)
\r
17 Received: from mail-ww0-f45.google.com (mail-ww0-f45.google.com
\r
18 [74.125.82.45]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client
\r
19 certificate requested) by olra.theworths.org (Postfix) with ESMTPS id
\r
20 9AB99431FB6 for <notmuch@notmuchmail.org>; Sun, 10 Jul 2011 07:11:52 -0700
\r
22 Received: by wwj40 with SMTP id 40so1490275wwj.2
\r
23 for <notmuch@notmuchmail.org>; Sun, 10 Jul 2011 07:11:51 -0700 (PDT)
\r
24 Received: by 10.216.202.9 with SMTP id c9mr2288319weo.14.1310307111071;
\r
25 Sun, 10 Jul 2011 07:11:51 -0700 (PDT)
\r
26 Received: from localhost ([109.131.150.231])
\r
27 by mx.google.com with ESMTPS id z22sm6414076weq.2.2011.07.10.07.11.48
\r
28 (version=TLSv1/SSLv3 cipher=OTHER);
\r
29 Sun, 10 Jul 2011 07:11:49 -0700 (PDT)
\r
30 From: Pieter Praet <pieter@praet.org>
\r
31 To: Austin Clements <amdragon@MIT.EDU>
\r
32 Subject: [PATCH] emacs: bad regexp @ `notmuch-search-process-filter'
\r
33 Date: Sun, 10 Jul 2011 16:11:39 +0200
\r
34 Message-Id: <1310307099-25197-1-git-send-email-pieter@praet.org>
\r
35 X-Mailer: git-send-email 1.7.5.4
\r
36 In-Reply-To: <20110705214234.GA15360@mit.edu>
\r
37 References: <20110705214234.GA15360@mit.edu>
\r
38 Cc: Notmuch Mail <notmuch@notmuchmail.org>
\r
39 X-BeenThere: notmuch@notmuchmail.org
\r
40 X-Mailman-Version: 2.1.13
\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: Sun, 10 Jul 2011 14:11:53 -0000
\r
53 Ok, I've got everything pretty much ready to go, minus the crux:
\r
54 the regexp @ `notmuch-search-process-filter' :)
\r
56 My misguided attempt seems to work perfectly fine with `re-builder' on a
\r
57 large sample of my mail store, but in the actual search buffer and tests,
\r
58 the Message-Ids appear to get cut off at some arbitrary point.
\r
60 This patch introduces the following changes (on top of Austin's 2nd patch):
\r
61 - notmuch-search.c: to prevent a slew of failing tests obscuring
\r
62 interesting failures, only output Message-Ids when supplied with the
\r
63 `--output=summary-ids' option.
\r
64 - emacs/notmuch.el: add property `msgids' to every result in search buffer
\r
66 After applying it, two tests fail, at different places, even though they
\r
67 output the exact same results (albeit with a different sort order) :
\r
68 - Basic notmuch-search view in emacs
\r
69 - Navigation of notmuch-hello to search results
\r
71 Could someone please provide my ignorant @$$ with a regexp that works?
\r
75 Signed-off-by: Pieter Praet <pieter@praet.org>
\r
77 emacs/notmuch.el | 5 ++++-
\r
78 notmuch-search.c | 6 +++++-
\r
79 2 files changed, 9 insertions(+), 2 deletions(-)
\r
81 diff --git a/emacs/notmuch.el b/emacs/notmuch.el
\r
82 index f11ec24..501c1a2 100644
\r
83 --- a/emacs/notmuch.el
\r
84 +++ b/emacs/notmuch.el
\r
85 @@ -801,13 +801,14 @@ non-authors is found, assume that all of the authors match."
\r
87 (while (and (< line (length string)) (= (elt string line) ?\n))
\r
88 (setq line (1+ line)))
\r
89 - (if (string-match "^\\(thread:[0-9A-Fa-f]*\\) \\([^][]*\\) \\(\\[[0-9/]*\\]\\) \\([^;]*\\); \\(.*\\) (\\([^()]*\\))$" string line)
\r
90 + (if (string-match "^\\(thread:[0-9A-Fa-f]*\\) \\([^][]*\\) \\(\\[[0-9/]*\\]\\) \\([^;]*\\); \\(.*\\) (\\([^()]*\\)) \\(.*\\)$" string line)
\r
91 (let* ((thread-id (match-string 1 string))
\r
92 (date (match-string 2 string))
\r
93 (count (match-string 3 string))
\r
94 (authors (match-string 4 string))
\r
95 (subject (match-string 5 string))
\r
96 (tags (match-string 6 string))
\r
97 + (msgids (match-string 7 string))
\r
98 (tag-list (if tags (save-match-data (split-string tags)))))
\r
99 (goto-char (point-max))
\r
100 (if (/= (match-beginning 1) line)
\r
101 @@ -816,6 +817,7 @@ non-authors is found, assume that all of the authors match."
\r
102 (notmuch-search-show-result date count authors subject tags)
\r
103 (notmuch-search-color-line beg (point-marker) tag-list)
\r
104 (put-text-property beg (point-marker) 'notmuch-search-thread-id thread-id)
\r
105 + (put-text-property beg (point-marker) 'notmuch-search-msgids msgids)
\r
106 (put-text-property beg (point-marker) 'notmuch-search-authors authors)
\r
107 (put-text-property beg (point-marker) 'notmuch-search-subject subject)
\r
108 (if (string= thread-id notmuch-search-target-thread)
\r
109 @@ -913,6 +915,7 @@ The optional parameters are used as follows:
\r
110 (let ((proc (start-process
\r
111 "notmuch-search" buffer
\r
112 notmuch-command "search"
\r
113 + "--output=summary-ids"
\r
115 "--sort=oldest-first"
\r
116 "--sort=newest-first")
\r
117 diff --git a/notmuch-search.c b/notmuch-search.c
\r
118 index 2288eb7..b3af88b 100644
\r
119 --- a/notmuch-search.c
\r
120 +++ b/notmuch-search.c
\r
125 + OUTPUT_SUMMARY_IDS,
\r
129 @@ -274,7 +275,7 @@ do_search_threads (const search_format_t *format,
\r
131 fputs (format->tag_end, stdout);
\r
133 - if (format == &format_text) {
\r
134 + if (format == &format_text && output == OUTPUT_SUMMARY_IDS) {
\r
135 notmuch_messages_t *toplevel;
\r
138 @@ -462,6 +463,8 @@ notmuch_search_command (void *ctx, int argc, char *argv[])
\r
139 opt = argv[i] + sizeof ("--output=") - 1;
\r
140 if (strcmp (opt, "summary") == 0) {
\r
141 output = OUTPUT_SUMMARY;
\r
142 + } else if (strcmp (opt, "summary-ids") == 0) {
\r
143 + output = OUTPUT_SUMMARY_IDS;
\r
144 } else if (strcmp (opt, "threads") == 0) {
\r
145 output = OUTPUT_THREADS;
\r
146 } else if (strcmp (opt, "messages") == 0) {
\r
147 @@ -513,6 +516,7 @@ notmuch_search_command (void *ctx, int argc, char *argv[])
\r
150 case OUTPUT_SUMMARY:
\r
151 + case OUTPUT_SUMMARY_IDS:
\r
152 case OUTPUT_THREADS:
\r
153 ret = do_search_threads (format, query, sort, output);
\r