Return-Path: X-Original-To: notmuch@notmuchmail.org Delivered-To: notmuch@notmuchmail.org Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id B5C48429E25 for ; Sun, 10 Jul 2011 07:11:53 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -0.7 X-Spam-Level: X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5 tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled Received: from olra.theworths.org ([127.0.0.1]) by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 9cCeYYwX5Y7T for ; Sun, 10 Jul 2011 07:11:53 -0700 (PDT) Received: from mail-ww0-f45.google.com (mail-ww0-f45.google.com [74.125.82.45]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id 9AB99431FB6 for ; Sun, 10 Jul 2011 07:11:52 -0700 (PDT) Received: by wwj40 with SMTP id 40so1490275wwj.2 for ; Sun, 10 Jul 2011 07:11:51 -0700 (PDT) Received: by 10.216.202.9 with SMTP id c9mr2288319weo.14.1310307111071; Sun, 10 Jul 2011 07:11:51 -0700 (PDT) Received: from localhost ([109.131.150.231]) by mx.google.com with ESMTPS id z22sm6414076weq.2.2011.07.10.07.11.48 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 10 Jul 2011 07:11:49 -0700 (PDT) From: Pieter Praet To: Austin Clements Subject: [PATCH] emacs: bad regexp @ `notmuch-search-process-filter' Date: Sun, 10 Jul 2011 16:11:39 +0200 Message-Id: <1310307099-25197-1-git-send-email-pieter@praet.org> X-Mailer: git-send-email 1.7.5.4 In-Reply-To: <20110705214234.GA15360@mit.edu> References: <20110705214234.GA15360@mit.edu> Cc: Notmuch Mail X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Jul 2011 14:11:53 -0000 Ok, I've got everything pretty much ready to go, minus the crux: the regexp @ `notmuch-search-process-filter' :) My misguided attempt seems to work perfectly fine with `re-builder' on a large sample of my mail store, but in the actual search buffer and tests, the Message-Ids appear to get cut off at some arbitrary point. This patch introduces the following changes (on top of Austin's 2nd patch): - notmuch-search.c: to prevent a slew of failing tests obscuring interesting failures, only output Message-Ids when supplied with the `--output=summary-ids' option. - emacs/notmuch.el: add property `msgids' to every result in search buffer After applying it, two tests fail, at different places, even though they output the exact same results (albeit with a different sort order) : - Basic notmuch-search view in emacs - Navigation of notmuch-hello to search results Could someone please provide my ignorant @$$ with a regexp that works? Peace Signed-off-by: Pieter Praet --- emacs/notmuch.el | 5 ++++- notmuch-search.c | 6 +++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/emacs/notmuch.el b/emacs/notmuch.el index f11ec24..501c1a2 100644 --- a/emacs/notmuch.el +++ b/emacs/notmuch.el @@ -801,13 +801,14 @@ non-authors is found, assume that all of the authors match." (while more (while (and (< line (length string)) (= (elt string line) ?\n)) (setq line (1+ line))) - (if (string-match "^\\(thread:[0-9A-Fa-f]*\\) \\([^][]*\\) \\(\\[[0-9/]*\\]\\) \\([^;]*\\); \\(.*\\) (\\([^()]*\\))$" string line) + (if (string-match "^\\(thread:[0-9A-Fa-f]*\\) \\([^][]*\\) \\(\\[[0-9/]*\\]\\) \\([^;]*\\); \\(.*\\) (\\([^()]*\\)) \\(.*\\)$" string line) (let* ((thread-id (match-string 1 string)) (date (match-string 2 string)) (count (match-string 3 string)) (authors (match-string 4 string)) (subject (match-string 5 string)) (tags (match-string 6 string)) + (msgids (match-string 7 string)) (tag-list (if tags (save-match-data (split-string tags))))) (goto-char (point-max)) (if (/= (match-beginning 1) line) @@ -816,6 +817,7 @@ non-authors is found, assume that all of the authors match." (notmuch-search-show-result date count authors subject tags) (notmuch-search-color-line beg (point-marker) tag-list) (put-text-property beg (point-marker) 'notmuch-search-thread-id thread-id) + (put-text-property beg (point-marker) 'notmuch-search-msgids msgids) (put-text-property beg (point-marker) 'notmuch-search-authors authors) (put-text-property beg (point-marker) 'notmuch-search-subject subject) (if (string= thread-id notmuch-search-target-thread) @@ -913,6 +915,7 @@ The optional parameters are used as follows: (let ((proc (start-process "notmuch-search" buffer notmuch-command "search" + "--output=summary-ids" (if oldest-first "--sort=oldest-first" "--sort=newest-first") diff --git a/notmuch-search.c b/notmuch-search.c index 2288eb7..b3af88b 100644 --- a/notmuch-search.c +++ b/notmuch-search.c @@ -22,6 +22,7 @@ typedef enum { OUTPUT_SUMMARY, + OUTPUT_SUMMARY_IDS, OUTPUT_THREADS, OUTPUT_MESSAGES, OUTPUT_FILES, @@ -274,7 +275,7 @@ do_search_threads (const search_format_t *format, fputs (format->tag_end, stdout); - if (format == &format_text) { + if (format == &format_text && output == OUTPUT_SUMMARY_IDS) { notmuch_messages_t *toplevel; const char *first; @@ -462,6 +463,8 @@ notmuch_search_command (void *ctx, int argc, char *argv[]) opt = argv[i] + sizeof ("--output=") - 1; if (strcmp (opt, "summary") == 0) { output = OUTPUT_SUMMARY; + } else if (strcmp (opt, "summary-ids") == 0) { + output = OUTPUT_SUMMARY_IDS; } else if (strcmp (opt, "threads") == 0) { output = OUTPUT_THREADS; } else if (strcmp (opt, "messages") == 0) { @@ -513,6 +516,7 @@ notmuch_search_command (void *ctx, int argc, char *argv[]) switch (output) { default: case OUTPUT_SUMMARY: + case OUTPUT_SUMMARY_IDS: case OUTPUT_THREADS: ret = do_search_threads (format, query, sort, output); break; -- 1.7.5.4