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