From d805866ec502540e80b6209bfb6a54fd24ff4458 Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Mon, 20 Sep 2010 16:37:53 -0700 Subject: [PATCH] test: Add a corpus of email messages to be used in testing. This is simply 50 messages from the early history of the notmuch mailing list, (fetched from the public archives). --- test/corpus/01 | 34 +++++ test/corpus/02 | 32 +++++ test/corpus/03 | 39 ++++++ test/corpus/04 | 30 +++++ test/corpus/05 | 33 +++++ test/corpus/06 | 36 +++++ test/corpus/07 | 57 ++++++++ test/corpus/08 | 33 +++++ test/corpus/09 | 33 +++++ test/corpus/10 | 54 ++++++++ test/corpus/11 | 27 ++++ test/corpus/12 | 27 ++++ test/corpus/13 | 178 ++++++++++++++++++++++++ test/corpus/14 | 39 ++++++ test/corpus/15 | 22 +++ test/corpus/16 | 27 ++++ test/corpus/17 | 23 ++++ test/corpus/18 | 12 ++ test/corpus/19 | 360 +++++++++++++++++++++++++++++++++++++++++++++++++ test/corpus/20 | 54 ++++++++ test/corpus/21 | 43 ++++++ test/corpus/22 | 30 +++++ test/corpus/23 | 77 +++++++++++ test/corpus/24 | 86 ++++++++++++ test/corpus/25 | 32 +++++ test/corpus/26 | 121 +++++++++++++++++ test/corpus/27 | 21 +++ test/corpus/28 | 38 ++++++ test/corpus/29 | 21 +++ test/corpus/30 | 75 +++++++++++ test/corpus/31 | 31 +++++ test/corpus/32 | 165 +++++++++++++++++++++++ test/corpus/33 | 13 ++ test/corpus/34 | 46 +++++++ test/corpus/35 | 24 ++++ test/corpus/36 | 25 ++++ test/corpus/37 | 22 +++ test/corpus/38 | 40 ++++++ test/corpus/39 | 32 +++++ test/corpus/40 | 31 +++++ test/corpus/41 | 37 +++++ test/corpus/42 | 30 +++++ test/corpus/43 | 26 ++++ test/corpus/44 | 29 ++++ test/corpus/45 | 41 ++++++ test/corpus/46 | 57 ++++++++ test/corpus/47 | 84 ++++++++++++ test/corpus/48 | 17 +++ test/corpus/49 | 33 +++++ test/corpus/50 | 39 ++++++ 50 files changed, 2516 insertions(+) create mode 100644 test/corpus/01 create mode 100644 test/corpus/02 create mode 100644 test/corpus/03 create mode 100644 test/corpus/04 create mode 100644 test/corpus/05 create mode 100644 test/corpus/06 create mode 100644 test/corpus/07 create mode 100644 test/corpus/08 create mode 100644 test/corpus/09 create mode 100644 test/corpus/10 create mode 100644 test/corpus/11 create mode 100644 test/corpus/12 create mode 100644 test/corpus/13 create mode 100644 test/corpus/14 create mode 100644 test/corpus/15 create mode 100644 test/corpus/16 create mode 100644 test/corpus/17 create mode 100644 test/corpus/18 create mode 100644 test/corpus/19 create mode 100644 test/corpus/20 create mode 100644 test/corpus/21 create mode 100644 test/corpus/22 create mode 100644 test/corpus/23 create mode 100644 test/corpus/24 create mode 100644 test/corpus/25 create mode 100644 test/corpus/26 create mode 100644 test/corpus/27 create mode 100644 test/corpus/28 create mode 100644 test/corpus/29 create mode 100644 test/corpus/30 create mode 100644 test/corpus/31 create mode 100644 test/corpus/32 create mode 100644 test/corpus/33 create mode 100644 test/corpus/34 create mode 100644 test/corpus/35 create mode 100644 test/corpus/36 create mode 100644 test/corpus/37 create mode 100644 test/corpus/38 create mode 100644 test/corpus/39 create mode 100644 test/corpus/40 create mode 100644 test/corpus/41 create mode 100644 test/corpus/42 create mode 100644 test/corpus/43 create mode 100644 test/corpus/44 create mode 100644 test/corpus/45 create mode 100644 test/corpus/46 create mode 100644 test/corpus/47 create mode 100644 test/corpus/48 create mode 100644 test/corpus/49 create mode 100644 test/corpus/50 diff --git a/test/corpus/01 b/test/corpus/01 new file mode 100644 index 00000000..7e9e3490 --- /dev/null +++ b/test/corpus/01 @@ -0,0 +1,34 @@ +From: "Mikhail Gusarov" +To: notmuch@notmuchmail.org +Date: Tue, 17 Nov 2009 21:28:37 +0600 +Subject: [notmuch] [PATCH 1/2] Close message file after parsing message + headers +Message-ID: <1258471718-6781-1-git-send-email-dottedmag@dottedmag.net> + +Keeping unused files open helps to see "Too many open files" often. + +Signed-off-by: Mikhail Gusarov +--- + lib/message-file.c | 5 +++++ + 1 files changed, 5 insertions(+), 0 deletions(-) + +diff --git a/lib/message-file.c b/lib/message-file.c +index 8a3f8ee..197ab01 100644 +--- a/lib/message-file.c ++++ b/lib/message-file.c +@@ -325,6 +325,11 @@ notmuch_message_file_get_header (notmuch_message_file_t *message, + return decoded_value; + } + ++ if (message->parsing_finished) { ++ fclose (message->file); ++ message->file = NULL; ++ } ++ + if (message->line) + free (message->line); + message->line = NULL; +-- +1.6.3.3 + + diff --git a/test/corpus/02 b/test/corpus/02 new file mode 100644 index 00000000..dadcdaac --- /dev/null +++ b/test/corpus/02 @@ -0,0 +1,32 @@ +From: "Mikhail Gusarov" +To: notmuch@notmuchmail.org +Date: Tue, 17 Nov 2009 21:28:38 +0600 +Subject: [notmuch] [PATCH 2/2] Include to get uint32_t in C++ + file with gcc 4.4 +In-Reply-To: <1258471718-6781-1-git-send-email-dottedmag@dottedmag.net> +References: <1258471718-6781-1-git-send-email-dottedmag@dottedmag.net> +Message-ID: <1258471718-6781-2-git-send-email-dottedmag@dottedmag.net> + + +Signed-off-by: Mikhail Gusarov +--- + lib/message.cc | 2 ++ + 1 files changed, 2 insertions(+), 0 deletions(-) + +diff --git a/lib/message.cc b/lib/message.cc +index 72c350f..a4b090b 100644 +--- a/lib/message.cc ++++ b/lib/message.cc +@@ -21,6 +21,8 @@ + #include "notmuch-private.h" + #include "database-private.h" + ++#include ++ + #include + + #include +-- +1.6.3.3 + + diff --git a/test/corpus/03 b/test/corpus/03 new file mode 100644 index 00000000..09cceece --- /dev/null +++ b/test/corpus/03 @@ -0,0 +1,39 @@ +From: "Lars Kellogg-Stedman" +To: notmuch@notmuchmail.org +Date: Tue, 17 Nov 2009 14:00:54 -0500 +Subject: [notmuch] Working with Maildir storage? +Message-ID: <20091117190054.GU3165@dottiness.seas.harvard.edu> + +I saw the LWN article and decided to take a look at notmuch. I'm +currently using mutt and mairix to index and read a collection of +Maildir mail folders (around 40,000 messages total). + +notmuch indexed the messages without complaint, but my attempt at +searching bombed out. Running, for example: + + notmuch search storage + +Resulted in 4604 lines of errors along the lines of: + + Error opening + /home/lars/Mail/read-messages.2008/cur/1246413773.24928_27334.hostname,U=3026:2,S: + Too many open files + +I'm curious if this is expected behavior (i.e., notmuch does not work +with Maildir) or if something else is going on. + +Cheers, + +-- +Lars Kellogg-Stedman +Senior Technologist, Computing and Information Technology +Harvard University School of Engineering and Applied Sciences + +-------------- next part -------------- +A non-text attachment was scrubbed... +Name: not available +Type: application/pgp-signature +Size: 489 bytes +Desc: not available +URL: + diff --git a/test/corpus/04 b/test/corpus/04 new file mode 100644 index 00000000..4431a6dc --- /dev/null +++ b/test/corpus/04 @@ -0,0 +1,30 @@ +From: "Mikhail Gusarov" +To: notmuch@notmuchmail.org +Date: Wed, 18 Nov 2009 01:02:38 +0600 +Subject: [notmuch] Working with Maildir storage? +In-Reply-To: <20091117190054.GU3165@dottiness.seas.harvard.edu> (Lars + Kellogg-Stedman's message of "Tue, 17 Nov 2009 14:00:54 -0500") +References: <20091117190054.GU3165@dottiness.seas.harvard.edu> +Message-ID: <87iqd9rn3l.fsf@vertex.dottedmag> + + +Twas brillig at 14:00:54 17.11.2009 UTC-05 when lars at seas.harvard.edu did gyre and gimble: + + LK> Resulted in 4604 lines of errors along the lines of: + + LK> Error opening + LK> /home/lars/Mail/read-messages.2008/cur/1246413773.24928_27334.hostname,U=3026:2,S: + LK> Too many open files + +See the patch just posted here. + +-- + http://fossarchy.blogspot.com/ +-------------- next part -------------- +A non-text attachment was scrubbed... +Name: not available +Type: application/pgp-signature +Size: 834 bytes +Desc: not available +URL: + diff --git a/test/corpus/05 b/test/corpus/05 new file mode 100644 index 00000000..b918d1ce --- /dev/null +++ b/test/corpus/05 @@ -0,0 +1,33 @@ +From: "Alex Botero-Lowry" +To: notmuch@notmuchmail.org +Date: Tue, 17 Nov 2009 11:36:14 -0800 +Subject: [notmuch] preliminary FreeBSD support +Message-ID: + +I saw the announcement this morning, and was very excited, as I had been +hoping sup would be turned into a library, +since I like the concept more than the UI (I'd rather an emacs interface). + +I did a preliminary compile which worked out fine, but +sysconf(_SC_SC_GETPW_R_SIZE_MAX) returns -1 on +FreeBSD, so notmuch_config_open segfaulted. + +Attached is a patch that supplies a default buffer size of 64 in cases where +-1 is returned. + +http://www.opengroup.org/austin/docs/austin_328.txt - seems to indicate this +is acceptable behavior, +and http://mail-index.netbsd.org/pkgsrc-bugs/2006/06/07/msg016808.htmlspecifically +uses 64 as the +buffer size. +-------------- next part -------------- +An HTML attachment was scrubbed... +URL: +-------------- next part -------------- +A non-text attachment was scrubbed... +Name: 0001-Deal-with-situation-where-sysconf-_SC_GETPW_R_SIZE_M.patch +Type: application/octet-stream +Size: 1050 bytes +Desc: not available +URL: + diff --git a/test/corpus/06 b/test/corpus/06 new file mode 100644 index 00000000..3baad491 --- /dev/null +++ b/test/corpus/06 @@ -0,0 +1,36 @@ +From: "Carl Worth" +To: notmuch@notmuchmail.org +Date: Tue, 17 Nov 2009 12:19:24 -0800 +Subject: [notmuch] preliminary FreeBSD support +In-Reply-To: +References: +Message-ID: <87lji4lx9v.fsf@yoom.home.cworth.org> + +On Tue, 17 Nov 2009 11:36:14 -0800, Alex Botero-Lowry wrote: +> I saw the announcement this morning, and was very excited, as I had been +> hoping sup would be turned into a library, +> since I like the concept more than the UI (I'd rather an emacs interface). + +Hi Alex, + +That's great! It's good to hear that there are like-minded people out +there. I hope that Notmuch will be useful for you. + +> I did a preliminary compile which worked out fine, but +> sysconf(_SC_SC_GETPW_R_SIZE_MAX) returns -1 on +> FreeBSD, so notmuch_config_open segfaulted. +> +> Attached is a patch that supplies a default buffer size of 64 in cases where +> -1 is returned. + +Thanks for the patch. As we discussed in IRC[*], we should probably +do the correct thing and check for ERANGE and loop as necessary (even if +sysconf returns a positive value). Example code here: + +http://www.opengroup.org/austin/docs/austin_328.txt + +-Carl + +[*] #notmuch on irc.freenode.net for those who didn't just guess that +already, (and I'll add that to the website soon). + diff --git a/test/corpus/07 b/test/corpus/07 new file mode 100644 index 00000000..7b1e2bbe --- /dev/null +++ b/test/corpus/07 @@ -0,0 +1,57 @@ +From: "Carl Worth" +To: notmuch@notmuchmail.org +Date: Tue, 17 Nov 2009 09:13:27 -0800 +Subject: [notmuch] [PATCH 1/2] Close message file after parsing message + headers +In-Reply-To: <1258471718-6781-1-git-send-email-dottedmag@dottedmag.net> +References: <1258471718-6781-1-git-send-email-dottedmag@dottedmag.net> +Message-ID: <87lji5cbwo.fsf@yoom.home.cworth.org> + +On Tue, 17 Nov 2009 21:28:37 +0600, Mikhail Gusarov wrote: +> Keeping unused files open helps to see "Too many open files" often. +> +> Signed-off-by: Mikhail Gusarov +... +On Tue, 17 Nov 2009 21:28:38 +0600, Mikhail Gusarov wrote: +> +> Signed-off-by: Mikhail Gusarov +> --- +> lib/message.cc | 2 ++ +> 1 files changed, 2 insertions(+), 0 deletions(-) + +Hi Mikhail, + +Welcome to notmuch, and thanks for these patches! I've pushed both of +them out now. + +Keith ran into the same problem of "too many open files" and wrote a +more complex fix, (which included what you did here). His code can be +seen at: + + git://keithp.com/git/notmuch + +I didn't apply Keith's fix yet, because I think I'd rather just fix the +indexer to store the In-Reply-To header in a separate term prefix from +the term used for the References header[*]. That will then let us lookup +the in-reply-to value later for thread constructions without having to +open the original email file at all. + +-Carl + +[*] Yes, this is my first post to our new mailing list and I'm already +spouting off about "terms" and "prefixes" without any definitions. I +apologize for that. I hope that people will ask questions freely here on +the list whenever anything is not clear, and I'll be glad to explain +things as needed. (Then when can shove answers into a HACKING document.) + +PS. This reply is a great example of a feature that notmuch *almost* +supports already---repling to multiple messages at once. The "notmuch +reply" command line does everything necessary to make this work, but we +haven't yet hooked up any keybindings for this in the emacs client yet. +Obviously, 'r' from the search view could reply to the entire thread. +But when viewing a thread, anyone have a good keybinding suggestion? +(There's obviously 'R' as opposed to 'r', but I think we'll probably +want to distinguish "reply to sender" from "reply to all" before trying +to distinguish "reply to message" from "reply to thread" (which I +imagine is more rare of an operation). + diff --git a/test/corpus/08 b/test/corpus/08 new file mode 100644 index 00000000..6cfc48a9 --- /dev/null +++ b/test/corpus/08 @@ -0,0 +1,33 @@ +From: "Lars Kellogg-Stedman" +To: notmuch@notmuchmail.org +Date: Tue, 17 Nov 2009 15:33:01 -0500 +Subject: [notmuch] Working with Maildir storage? +In-Reply-To: <87iqd9rn3l.fsf@vertex.dottedmag> +References: <20091117190054.GU3165@dottiness.seas.harvard.edu> + <87iqd9rn3l.fsf@vertex.dottedmag> +Message-ID: <20091117203301.GV3165@dottiness.seas.harvard.edu> + +> See the patch just posted here. + +Is the list archived anywhere? The obvious archives +(http://notmuchmail.org/pipermail/notmuch/) aren't available, and I +think I subscribed too late to get the patch (I only just saw the +discussion about it). + +It doesn't look like the patch is in git yet. + +-- Lars + +-- +Lars Kellogg-Stedman +Senior Technologist, Computing and Information Technology +Harvard University School of Engineering and Applied Sciences + +-------------- next part -------------- +A non-text attachment was scrubbed... +Name: not available +Type: application/pgp-signature +Size: 489 bytes +Desc: not available +URL: + diff --git a/test/corpus/09 b/test/corpus/09 new file mode 100644 index 00000000..26b51b1f --- /dev/null +++ b/test/corpus/09 @@ -0,0 +1,33 @@ +From: "Mikhail Gusarov" +To: notmuch@notmuchmail.org +Date: Wed, 18 Nov 2009 02:50:48 +0600 +Subject: [notmuch] Working with Maildir storage? +In-Reply-To: <20091117203301.GV3165@dottiness.seas.harvard.edu> (Lars + Kellogg-Stedman's message of "Tue, 17 Nov 2009 15:33:01 -0500") +References: <20091117190054.GU3165@dottiness.seas.harvard.edu> + <87iqd9rn3l.fsf@vertex.dottedmag> + <20091117203301.GV3165@dottiness.seas.harvard.edu> +Message-ID: <87fx8can9z.fsf@vertex.dottedmag> + + +Twas brillig at 15:33:01 17.11.2009 UTC-05 when lars at seas.harvard.edu did gyre and gimble: + + LK> Is the list archived anywhere? The obvious archives + LK> (http://notmuchmail.org/pipermail/notmuch/) aren't available, and I + LK> think I subscribed too late to get the patch (I only just saw the + LK> discussion about it). + + LK> It doesn't look like the patch is in git yet. + +Just has been pushed + +-- + http://fossarchy.blogspot.com/ +-------------- next part -------------- +A non-text attachment was scrubbed... +Name: not available +Type: application/pgp-signature +Size: 834 bytes +Desc: not available +URL: + diff --git a/test/corpus/10 b/test/corpus/10 new file mode 100644 index 00000000..4211d734 --- /dev/null +++ b/test/corpus/10 @@ -0,0 +1,54 @@ +From: "Mikhail Gusarov" +To: notmuch@notmuchmail.org +Date: Wed, 18 Nov 2009 02:51:18 +0600 +Subject: [notmuch] [PATCH] Handle rename of message file +Message-ID: <1258491078-29658-1-git-send-email-dottedmag@dottedmag.net> + +If message file has been renamed, just update filename in the DB. + +Signed-off-by: Mikhail Gusarov +--- + lib/database.cc | 21 ++++++++++++--------- + 1 files changed, 12 insertions(+), 9 deletions(-) + +diff --git a/lib/database.cc b/lib/database.cc +index 3c8d626..c4eb8b6 100644 +--- a/lib/database.cc ++++ b/lib/database.cc +@@ -925,20 +925,23 @@ notmuch_database_add_message (notmuch_database_t *notmuch, + if (private_status == NOTMUCH_PRIVATE_STATUS_NO_DOCUMENT_FOUND) { + _notmuch_message_set_filename (message, filename); + _notmuch_message_add_term (message, "type", "mail"); ++ ++ ret = _notmuch_database_link_message (notmuch, message, message_file); ++ if (ret) ++ goto DONE; ++ ++ date = notmuch_message_file_get_header (message_file, "date"); ++ _notmuch_message_set_date (message, date); ++ ++ _notmuch_message_index_file (message, filename); ++ } else if (strcmp(notmuch_message_get_filename(message), filename)) { ++ /* Message file has been moved/renamed */ ++ _notmuch_message_set_filename (message, filename); + } else { + ret = NOTMUCH_STATUS_DUPLICATE_MESSAGE_ID; + goto DONE; + } + +- ret = _notmuch_database_link_message (notmuch, message, message_file); +- if (ret) +- goto DONE; +- +- date = notmuch_message_file_get_header (message_file, "date"); +- _notmuch_message_set_date (message, date); +- +- _notmuch_message_index_file (message, filename); +- + _notmuch_message_sync (message); + } catch (const Xapian::Error &error) { + fprintf (stderr, "A Xapian exception occurred: %s.\n", +-- +1.6.3.3 + + diff --git a/test/corpus/11 b/test/corpus/11 new file mode 100644 index 00000000..c0701def --- /dev/null +++ b/test/corpus/11 @@ -0,0 +1,27 @@ +From: "Keith Packard" +To: notmuch@notmuchmail.org +Date: Tue, 17 Nov 2009 13:15:25 -0800 +Subject: [notmuch] [PATCH 1/2] Close message file after parsing message + headers +In-Reply-To: <87lji5cbwo.fsf@yoom.home.cworth.org> +References: <1258471718-6781-1-git-send-email-dottedmag@dottedmag.net> + <87lji5cbwo.fsf@yoom.home.cworth.org> +Message-ID: + +On Tue, 17 Nov 2009 09:13:27 -0800, Carl Worth wrote: + +> I didn't apply Keith's fix yet, because I think I'd rather just fix the +> indexer to store the In-Reply-To header in a separate term prefix from +> the term used for the References header[*]. That will then let us lookup +> the in-reply-to value later for thread constructions without having to +> open the original email file at all. + +Threading the message also involves displaying the from and to contents, +which requires opening the message file. The alternative to the fix I +provided is to just parse all of the message headers when first opening +the message; it could then be immediately closed and the hash referred +to for all header data. Given the choice, just having the caller say +when it has finished with a message is probably a reasonable option... + +-keith + diff --git a/test/corpus/12 b/test/corpus/12 new file mode 100644 index 00000000..fbc604c0 --- /dev/null +++ b/test/corpus/12 @@ -0,0 +1,27 @@ +From: "Keith Packard" +To: notmuch@notmuchmail.org +Date: Tue, 17 Nov 2009 13:24:13 -0800 +Subject: [notmuch] Working with Maildir storage? +In-Reply-To: <20091117203301.GV3165@dottiness.seas.harvard.edu> +References: <20091117190054.GU3165@dottiness.seas.harvard.edu> + <87iqd9rn3l.fsf@vertex.dottedmag> + <20091117203301.GV3165@dottiness.seas.harvard.edu> +Message-ID: + +On Tue, 17 Nov 2009 15:33:01 -0500, Lars Kellogg-Stedman wrote: +> > See the patch just posted here. + +I've also pushed a slightly more complicated (and complete) fix to my +private notmuch repository + +git://keithp.com/git/notmuch + +> Is the list archived anywhere? + +Oops. Looks like Carl's mail server is broken. He's traveling to +Barcelona today and so it won't get fixed for a while. + +Thanks to everyone for trying out notmuch! + +-keith + diff --git a/test/corpus/13 b/test/corpus/13 new file mode 100644 index 00000000..03cb3744 --- /dev/null +++ b/test/corpus/13 @@ -0,0 +1,178 @@ +From: "Keith Packard" +To: notmuch@notmuchmail.org +Date: Tue, 17 Nov 2009 13:32:45 -0800 +Subject: [notmuch] [PATCH] Make notmuch-show 'X' (and 'x') commands remove + inbox (and unread) tags +Message-ID: <1258493565-13508-1-git-send-email-keithp@keithp.com> + +When closing a thread view, mark the thread as archived by removing +the "inbox" tag, and for the 'x' variant, the "unread" tag as well, +then kill the buffer and update the search window view as well. + +This makes 'x' much the same as 'a', but instead of taking you to the +next message, it takes you back to the search window instead. + +Signed-off-by: Keith Packard +--- + notmuch.el | 86 ++++++++++++++++++++++++++++++++++++++++++++++------------- + 1 files changed, 67 insertions(+), 19 deletions(-) + +diff --git a/notmuch.el b/notmuch.el +index 638d49d..7b0d72c 100644 +--- a/notmuch.el ++++ b/notmuch.el +@@ -31,8 +31,8 @@ + ; Will be much preferable to switch to direct manipulation for + ; toggling visibility of these components. Probably using + ; overlays-at to query and manipulate the current overlay. +- (define-key map "a" 'notmuch-show-archive-thread) +- (define-key map "A" 'notmuch-show-mark-read-then-archive-thread) ++ (define-key map "a" 'notmuch-show-mark-read-archive-thread-next-thread) ++ (define-key map "A" 'notmuch-show-archive-thread-next-thread) + (define-key map "b" 'notmuch-show-toggle-body-read-visible) + (define-key map "c" 'notmuch-show-toggle-citations-visible) + (define-key map "h" 'notmuch-show-toggle-headers-visible) +@@ -47,7 +47,8 @@ + (define-key map "s" 'notmuch-show-toggle-signatures-visible) + (define-key map "v" 'notmuch-show-view-all-mime-parts) + (define-key map "w" 'notmuch-show-view-raw-message) +- (define-key map "x" 'kill-this-buffer) ++ (define-key map "x" 'notmuch-show-mark-read-archive-thread-kill-buffer) ++ (define-key map "X" 'notmuch-show-archive-thread-kill-buffer) + (define-key map "+" 'notmuch-show-add-tag) + (define-key map "-" 'notmuch-show-remove-tag) + (define-key map (kbd "DEL") 'notmuch-show-rewind) +@@ -183,7 +184,33 @@ Unlike builtin `next-line' this version accepts no arguments." + (cons (notmuch-show-get-message-id) nil))) + (notmuch-show-set-tags (sort (set-difference tags toremove :test 'string=) 'string<)))))) + +-(defun notmuch-show-archive-thread-maybe-mark-read (markread) ++(defun notmuch-show-next-thread (markread) ++ (let ((parent-buffer notmuch-show-parent-buffer)) ++ (kill-this-buffer) ++ (if parent-buffer ++ (progn ++ (switch-to-buffer parent-buffer) ++ (forward-line) ++ (notmuch-search-show-thread))))) ++ ++(defun notmuch-delete-tags (to-remove from) ++ (if to-remove ++ (delete (car to-remove) (notmuch-delete-tags (cdr to-remove) from)) ++ from)) ++ ++(defun notmuch-kill-message-buffer (markread) ++ (let ((parent-buffer notmuch-show-parent-buffer)) ++ (kill-this-buffer) ++ (if parent-buffer ++ (progn ++ (switch-to-buffer parent-buffer) ++ (let ((tags (notmuch-search-get-tags))) ++ (setq tags (delete "inbox" tags)) ++ (if markread (setq tags (delete "unread" tags))) ++ (notmuch-search-set-tags tags)) ++ (forward-line))))) ++ ++(defun notmuch-show-archive-thread-maybe-mark-read (markread shownext) + (save-excursion + (goto-char (point-min)) + (while (not (eobp)) +@@ -194,15 +221,9 @@ Unlike builtin `next-line' this version accepts no arguments." + (forward-char)) + (if (not (re-search-forward notmuch-show-message-begin-regexp nil t)) + (goto-char (point-max))))) +- (let ((parent-buffer notmuch-show-parent-buffer)) +- (kill-this-buffer) +- (if parent-buffer +- (progn +- (switch-to-buffer parent-buffer) +- (forward-line) +- (notmuch-search-show-thread))))) ++ (if shownext (notmuch-show-next-thread markread) (notmuch-kill-message-buffer markread))) + +-(defun notmuch-show-mark-read-then-archive-thread () ++(defun notmuch-show-mark-read-archive-thread-next-thread () + "Remove \"unread\" tag from each message, then archive and show next thread. + + Archive each message currrently shown by removing the \"unread\" +@@ -215,9 +236,22 @@ being delivered to the same thread. It does not archive the + entire thread, but only the messages shown in the current + buffer." + (interactive) +- (notmuch-show-archive-thread-maybe-mark-read t)) ++ (notmuch-show-archive-thread-maybe-mark-read t t)) ++ ++(defun notmuch-show-mark-read-archive-thread-kill-buffer () ++ "Remove \"unread\" tag from each message, then archive and kill the buffer. ++ ++Archive each message currrently shown by removing the \"unread\" ++and \"inbox\" tag from each. Then kill this buffer. ++ ++Note: This command is safe from any race condition of new messages ++being delivered to the same thread. It does not archive the ++entire thread, but only the messages shown in the current ++buffer." ++ (interactive) ++ (notmuch-show-archive-thread-maybe-mark-read t nil)) + +-(defun notmuch-show-archive-thread () ++(defun notmuch-show-archive-thread-next-thread () + "Archive each message in thread, and show next thread from search. + + Archive each message currrently shown by removing the \"inbox\" +@@ -229,7 +263,20 @@ being delivered to the same thread. It does not archive the + entire thread, but only the messages shown in the current + buffer." + (interactive) +- (notmuch-show-archive-thread-maybe-mark-read nil)) ++ (notmuch-show-archive-thread-maybe-mark-read nil t)) ++ ++(defun notmuch-show-archive-thread-kill-buffer () ++ "Archive each message in thread, and kill the thread buffer. ++ ++Archive each message currrently shown by removing the \"inbox\" ++tag from each. Then kill this buffer. ++ ++Note: This command is safe from any race condition of new messages ++being delivered to the same thread. It does not archive the ++entire thread, but only the messages shown in the current ++buffer." ++ (interactive) ++ (notmuch-show-archive-thread-maybe-mark-read nil t)) + + (defun notmuch-show-view-raw-message () + "View the raw email of the current message." +@@ -297,7 +344,7 @@ by searching backward)." + (not (re-search-forward notmuch-show-message-begin-regexp nil t))))) + + (defun notmuch-show-message-unread-p () +- "Preficate testing whether current message is unread." ++ "Predicate testing whether current message is unread." + (member "unread" (notmuch-show-get-tags))) + + (defun notmuch-show-next-message () +@@ -434,7 +481,7 @@ which this thread was originally shown." + (let ((last (notmuch-show-last-message-p))) + (notmuch-show-mark-read-then-next-open-message) + (if last +- (notmuch-show-archive-thread)))))) ++ (notmuch-show-archive-thread-next-thread)))))) + + (defun notmuch-show-markup-citations-region (beg end depth) + (goto-char beg) +@@ -618,8 +665,9 @@ messages. Each time you navigate away from a message with + + You can add or remove tags from the current message with '+' and + '-'. You can also archive all messages in the current +-view, (remove the \"inbox\" tag from each), with +-`notmuch-show-archive-thread' (bound to 'a' by default). ++view, (remove the \"inbox\" tag from each), with either ++`notmuch-show-archive-thread-next-thread' (bound to 'a' by default) or ++`notmuch-show-archive-thread-kill-buffer' (bound to 'x' by default). + + \\{notmuch-show-mode-map}" + (interactive) +-- +1.6.5.2 + + diff --git a/test/corpus/14 b/test/corpus/14 new file mode 100644 index 00000000..d3fe78db --- /dev/null +++ b/test/corpus/14 @@ -0,0 +1,39 @@ +From: "Jan Janak" +To: notmuch@notmuchmail.org +Date: Tue, 17 Nov 2009 23:18:47 +0100 +Subject: [notmuch] [PATCH] Older versions of install do not support -C. +Message-ID: <1258496327-12086-1-git-send-email-jan@ryngle.com> + +Do not use -C cmdline option of install, older versions, commonly found in +distributions like Debian, do not seem to support it. Running make install +on such systems (tested on Debian Lenny) fails. + +Signed-off-by: Jan Janak +--- + Makefile.local | 8 ++++---- + 1 files changed, 4 insertions(+), 4 deletions(-) + +diff --git a/Makefile.local b/Makefile.local +index f824bed..f51f1d1 100644 +--- a/Makefile.local ++++ b/Makefile.local +@@ -27,11 +27,11 @@ install: all notmuch.1.gz + for d in $(DESTDIR)$(prefix)/bin/ $(DESTDIR)$(prefix)/share/man/man1 \ + $(DESTDIR)/etc/bash_completion.d/ ; \ + do \ +- install -C -d $$d ; \ ++ install -d $$d ; \ + done ; +- install -C notmuch $(DESTDIR)$(prefix)/bin/ +- install -C -m0644 notmuch.1.gz $(DESTDIR)$(prefix)/share/man/man1/ +- install -C notmuch-completion.bash \ ++ install notmuch $(DESTDIR)$(prefix)/bin/ ++ install -m0644 notmuch.1.gz $(DESTDIR)$(prefix)/share/man/man1/ ++ install notmuch-completion.bash \ + $(DESTDIR)/etc/bash_completion.d/notmuch + + SRCS := $(SRCS) $(notmuch_client_srcs) +-- +1.6.3.3 + + diff --git a/test/corpus/15 b/test/corpus/15 new file mode 100644 index 00000000..6824d5ea --- /dev/null +++ b/test/corpus/15 @@ -0,0 +1,22 @@ +From: "Jan Janak" +To: notmuch@notmuchmail.org +Date: Tue, 17 Nov 2009 23:35:30 +0100 +Subject: [notmuch] What a great idea! +Message-ID: + +Hello, + +First of all, notmuch is a wonderful idea, both the cmdline tool and +the emacs interface! Thanks a lot for writing it, I was really excited +when I read the announcement today. + +Have you considered sending an announcement to the org-mode mailing list? +http://org-mode.org + +Various ways of searching/referencing emails from emacs were discussed +there several times and none of them were as elegant as notmuch (not +even close). Maybe notmuch would attract some of the developers +there.. + + -- Jan + diff --git a/test/corpus/16 b/test/corpus/16 new file mode 100644 index 00000000..f531eb93 --- /dev/null +++ b/test/corpus/16 @@ -0,0 +1,27 @@ +From: "Jan Janak" +To: notmuch@notmuchmail.org +Date: Tue, 17 Nov 2009 23:38:47 +0100 +Subject: [notmuch] What a great idea! +In-Reply-To: +References: +Message-ID: + +On Tue, Nov 17, 2009 at 11:35 PM, Jan Janak wrote: +> Hello, +> +> First of all, notmuch is a wonderful idea, both the cmdline tool and +> the emacs interface! Thanks a lot for writing it, I was really excited +> when I read the announcement today. +> +> Have you considered sending an announcement to the org-mode mailing list? +> http://org-mode.org + +Sorry, wrong URL, the correct one is: http://orgmode.org + +> Various ways of searching/referencing emails from emacs were discussed +> there several times and none of them were as elegant as notmuch (not +> even close). Maybe notmuch would attract some of the developers +> there.. + + -- Jan + diff --git a/test/corpus/17 b/test/corpus/17 new file mode 100644 index 00000000..d3b75685 --- /dev/null +++ b/test/corpus/17 @@ -0,0 +1,23 @@ +From: "Israel Herraiz" +To: notmuch@notmuchmail.org +Date: Tue, 17 Nov 2009 23:57:18 +0100 +Subject: [notmuch] New to the list +Message-ID: <1258498485-sup-142@elly> + +Hi all, + +I have subscribed to the list. As suggested by the welcome message, I +am introducing myself. My name is Israel Herraiz, and I have done a +couple of contributions to Sup, the probably well-known here e-mail +client. + +"Not much" sounds interesting, and I wonder whether it could be +integrated with the views of Sup (inbox, threads, etc). So I have +subscribed to the list to keep an eye on what's going on here. + +I have just heard of "Not much". I have not even tried to download the +code yet. + +Cheers, +Israel + diff --git a/test/corpus/18 b/test/corpus/18 new file mode 100644 index 00000000..f522f69e --- /dev/null +++ b/test/corpus/18 @@ -0,0 +1,12 @@ +From: "Aron Griffis" +To: notmuch@notmuchmail.org +Date: Tue, 17 Nov 2009 18:21:38 -0500 +Subject: [notmuch] archive +Message-ID: <20091117232137.GA7669@griffis1.net> + +Just subscribed, I'd like to catch up on the previous postings, +but the archive link seems to be bogus? + +Thanks, +Aron + diff --git a/test/corpus/19 b/test/corpus/19 new file mode 100644 index 00000000..1b7872b0 --- /dev/null +++ b/test/corpus/19 @@ -0,0 +1,360 @@ +From: "Ingmar Vanhassel" +To: notmuch@notmuchmail.org +Date: Wed, 18 Nov 2009 00:23:42 +0100 +Subject: [notmuch] [PATCH] Typsos +Message-ID: <1258500222-32066-1-git-send-email-ingmar@exherbo.org> + +--- + Makefile | 4 ++-- + README | 6 +++--- + gmime-filter-reply.h | 2 +- + lib/database.cc | 2 +- + lib/index.cc | 2 +- + lib/message.cc | 2 +- + lib/messages.c | 2 +- + lib/notmuch-private.h | 2 +- + lib/notmuch.h | 10 +++++----- + lib/sha1.c | 2 +- + lib/thread.cc | 2 +- + notmuch-completion.bash | 2 +- + notmuch-new.c | 4 ++-- + notmuch-search.c | 2 +- + notmuch.1 | 4 ++-- + notmuch.el | 10 +++++----- + show-message.c | 2 +- + 17 files changed, 30 insertions(+), 30 deletions(-) + +diff --git a/Makefile b/Makefile +index 436dacf..96aaa73 100644 +--- a/Makefile ++++ b/Makefile +@@ -1,4 +1,4 @@ +-# Default FLAGS, (can be overriden by user such as "make CFLAGS=-O2") ++# Default FLAGS, (can be overridden by user such as "make CFLAGS=-O2") + WARN_FLAGS=-Wall -Wextra -Wmissing-declarations -Wwrite-strings -Wswitch-enum + CFLAGS=-O2 + +@@ -14,7 +14,7 @@ override CXXFLAGS += $(WARN_FLAGS) $(extra_cflags) $(extra_cxxflags) + override LDFLAGS += `pkg-config --libs glib-2.0 gmime-2.4 talloc` \ + `xapian-config --libs` + +-# Include our local Makfile.local first so that its first target is default ++# Include our local Makefile.local first so that its first target is default + include Makefile.local + include lib/Makefile.local + +diff --git a/README b/README +index 40f05ab..27af77f 100644 +--- a/README ++++ b/README +@@ -3,7 +3,7 @@ Notmuch - thread-based email index, search and tagging. + Notmuch is a system for indexing, searching, reading, and tagging + large collections of email messages. It uses the Xapian library to + provide fast, full-text search of very large collection of email with +-a very convenient search syntas. ++a very convenient search syntax. + + Notmuch is free software, released under the GNU General Public + License version 3 (or later). +@@ -45,7 +45,7 @@ obtaining a more sophisticated interface: + notmuch.el file in this distribution. + + If someone were to write a curses-based interface, or similar, +- it might also be reasonable to buil on the "notmuch" ++ it might also be reasonable to build on the "notmuch" + command-line interface. + + 2. Build on top of the notmuch library interface. +@@ -67,4 +67,4 @@ still in development. We would appreciate any contributions to these + efforts. + + +- +\ No newline at end of file ++ +diff --git a/gmime-filter-reply.h b/gmime-filter-reply.h +index 41cbc13..b7cbc6b 100644 +--- a/gmime-filter-reply.h ++++ b/gmime-filter-reply.h +@@ -40,7 +40,7 @@ typedef struct _GMimeFilterReplyClass GMimeFilterReplyClass; + * @saw_nl: previous char was a \n + * @saw_angle: previous char was a > + * +- * A filter to insert/remove reply markers (lines begining with >) ++ * A filter to insert/remove reply markers (lines beginning with >) + **/ + struct _GMimeFilterReply { + GMimeFilter parent_object; +diff --git a/lib/database.cc b/lib/database.cc +index 3c8d626..27597cf 100644 +--- a/lib/database.cc ++++ b/lib/database.cc +@@ -180,7 +180,7 @@ notmuch_status_to_string (notmuch_status_t status) + case NOTMUCH_STATUS_TAG_TOO_LONG: + return "Tag value is too long (exceeds NOTMUCH_TAG_MAX)"; + case NOTMUCH_STATUS_UNBALANCED_FREEZE_THAW: +- return "Unblanced number of calls to notmuch_message_freeze/thaw"; ++ return "Unbalanced number of calls to notmuch_message_freeze/thaw"; + default: + case NOTMUCH_STATUS_LAST_STATUS: + return "Unknown error status value"; +diff --git a/lib/index.cc b/lib/index.cc +index 65b83b3..80df64b 100644 +--- a/lib/index.cc ++++ b/lib/index.cc +@@ -198,7 +198,7 @@ _index_mime_part (notmuch_message_t *message, + if (i == 1) + continue; + if (i > 1) +- fprintf (stderr, "Warning: Unexpected extra parts of mutlipart/signed. Indexing anyway.\n"); ++ fprintf (stderr, "Warning: Unexpected extra parts of multipart/signed. Indexing anyway.\n"); + } + _index_mime_part (message, + g_mime_multipart_get_part (multipart, i)); +diff --git a/lib/message.cc b/lib/message.cc +index a4b090b..1d6623f 100644 +--- a/lib/message.cc ++++ b/lib/message.cc +@@ -144,7 +144,7 @@ _notmuch_message_create (const void *talloc_owner, + } + + /* Create a new notmuch_message_t object for a specific message ID, +- * (which may or may not already exist in the databas). ++ * (which may or may not already exist in the database). + * + * Here, 'talloc owner' is an optional talloc context to which the new + * message will belong. This allows for the caller to not bother +diff --git a/lib/messages.c b/lib/messages.c +index a588f8f..2f7c283 100644 +--- a/lib/messages.c ++++ b/lib/messages.c +@@ -47,7 +47,7 @@ _notmuch_message_list_create (const void *ctx) + return list; + } + +-/* Append 'node' (which can of course point to an aribtrarily long ++/* Append 'node' (which can of course point to an arbitrarily long + * list of nodes) to the end of 'list'. + */ + void +diff --git a/lib/notmuch-private.h b/lib/notmuch-private.h +index 6036ce4..af82e58 100644 +--- a/lib/notmuch-private.h ++++ b/lib/notmuch-private.h +@@ -235,7 +235,7 @@ notmuch_message_file_open (const char *filename); + notmuch_message_file_t * + _notmuch_message_file_open_ctx (void *ctx, const char *filename); + +-/* Close a notmuch message preivously opened with notmuch_message_open. */ ++/* Close a notmuch message previously opened with notmuch_message_open. */ + void + notmuch_message_file_close (notmuch_message_file_t *message); + +diff --git a/lib/notmuch.h b/lib/notmuch.h +index 32b5332..384c177 100644 +--- a/lib/notmuch.h ++++ b/lib/notmuch.h +@@ -222,7 +222,7 @@ notmuch_database_get_timestamp (notmuch_database_t *database, + + /* Add a new message to the given notmuch database. + * +- * Here,'filename' should be a path relative to the the path of ++ * Here,'filename' should be a path relative to the path of + * 'database' (see notmuch_database_get_path), or else should be an + * absolute filename with initial components that match the path of + * 'database'. +@@ -258,7 +258,7 @@ notmuch_database_add_message (notmuch_database_t *database, + const char *filename, + notmuch_message_t **message); + +-/* Find a message with the given messsage_id. ++/* Find a message with the given message_id. + * + * If the database contains a message with the given message_id, then + * a new notmuch_message_t object is returned. The caller should call +@@ -620,7 +620,7 @@ notmuch_messages_advance (notmuch_messages_t *messages); + /* Destroy a notmuch_messages_t object. + * + * It's not strictly necessary to call this function. All memory from +- * the notmuch_messages_t object will be reclaimed when the containg ++ * the notmuch_messages_t object will be reclaimed when the containing + * query object is destroyed. + */ + void +@@ -865,7 +865,7 @@ notmuch_tags_has_more (notmuch_tags_t *tags); + /* Get the current tag from 'tags' as a string. + * + * Note: The returned string belongs to 'tags' and has a lifetime +- * identical to it (and the query to which it utlimately belongs). ++ * identical to it (and the query to which it ultimately belongs). + * + * See the documentation of notmuch_message_get_tags for example code + * showing how to iterate over a notmuch_tags_t object. +@@ -884,7 +884,7 @@ notmuch_tags_advance (notmuch_tags_t *tags); + /* Destroy a notmuch_tags_t object. + * + * It's not strictly necessary to call this function. All memory from +- * the notmuch_tags_t object will be reclaimed when the containg ++ * the notmuch_tags_t object will be reclaimed when the containing + * message or query objects are destroyed. + */ + void +diff --git a/lib/sha1.c b/lib/sha1.c +index ff4dd16..cc48108 100644 +--- a/lib/sha1.c ++++ b/lib/sha1.c +@@ -43,7 +43,7 @@ _hex_of_sha1_digest (const unsigned char digest[SHA1_DIGEST_SIZE]) + return result; + } + +-/* Create a hexadcimal string version of the SHA-1 digest of 'str' ++/* Create a hexadecimal string version of the SHA-1 digest of 'str' + * (including its null terminating character). + * + * This function returns a newly allocated string which the caller +diff --git a/lib/thread.cc b/lib/thread.cc +index 4411d64..da58edc 100644 +--- a/lib/thread.cc ++++ b/lib/thread.cc +@@ -190,7 +190,7 @@ _resolve_thread_relationships (unused (notmuch_thread_t *thread)) + * subject line, the total count of messages, and all authors). The + * second search is for all messages that are in the thread and that + * also match the given query_string. This is to allow for a separate +- * count of matched messages, and to allow a viewer to diplay these ++ * count of matched messages, and to allow a viewer to display these + * messages differently. + * + * Here, 'ctx' is talloc context for the resulting thread object. +diff --git a/notmuch-completion.bash b/notmuch-completion.bash +index ad55f6d..cdad05d 100644 +--- a/notmuch-completion.bash ++++ b/notmuch-completion.bash +@@ -1,4 +1,4 @@ +-# Bash completion for notmutch ++# Bash completion for notmuch + # + # Copyright ?? 2009 Carl Worth + # +diff --git a/notmuch-new.c b/notmuch-new.c +index 83a05ba..5405a9f 100644 +--- a/notmuch-new.c ++++ b/notmuch-new.c +@@ -303,7 +303,7 @@ add_files (notmuch_database_t *notmuch, + + /* XXX: This should be merged with the add_files function since it + * shares a lot of logic with it. */ +-/* Recursively count all regular files in path and all sub-direcotries ++/* Recursively count all regular files in path and all sub-directories + * of path. The result is added to *count (which should be + * initialized to zero by the top-level caller before calling + * count_files). */ +@@ -469,7 +469,7 @@ notmuch_new_command (void *ctx, + + if (elapsed > 1 && ! add_files_state.saw_read_only_directory) { + printf ("\nTip: If you have any sub-directories that are archives (that is,\n" +- "they will never receive new mail), marking these directores as\n" ++ "they will never receive new mail), marking these directories as\n" + "read-only (chmod u-w /path/to/dir) will make \"notmuch new\"\n" + "much more efficient (it won't even look in those directories).\n"); + } +diff --git a/notmuch-search.c b/notmuch-search.c +index 8db09c7..ac81372 100644 +--- a/notmuch-search.c ++++ b/notmuch-search.c +@@ -76,7 +76,7 @@ notmuch_search_command (void *ctx, int argc, char *argv[]) + + query_str = query_string_from_args (ctx, argc, argv); + if (query_str == NULL) { +- fprintf (stderr, "Out of moemory.\n"); ++ fprintf (stderr, "Out of memory.\n"); + return 1; + } + +diff --git a/notmuch.1 b/notmuch.1 +index 6c3d10f..86d5f59 100644 +--- a/notmuch.1 ++++ b/notmuch.1 +@@ -60,7 +60,7 @@ archives, and will then proceed to build a database that indexes the + mail to allow for fast search of the archive. + + This directory can contain any number of sub-directories and should +-primarily contain only files with indvidual email messages ++primarily contain only files with individual email messages + (eg. maildir or mh archives are perfect). If there are other, + non-email files (such as indexes maintained by other email programs) + then notmuch will do its best to detect those and ignore them. +@@ -173,7 +173,7 @@ Constructs a reply template for a set of messages. + + See the documentation of + .B search +-for deatils of the supported syntax of search terms. ++for details of the supported syntax of search terms. + + To make replying to email easier, + .B notmuch reply +diff --git a/notmuch.el b/notmuch.el +index 8894a8e..7e01ed6 100644 +--- a/notmuch.el ++++ b/notmuch.el +@@ -205,7 +205,7 @@ Unlike builtin `next-line' this version accepts no arguments." + (defun notmuch-show-mark-read-then-archive-thread () + "Remove \"unread\" tag from each message, then archive and show next thread. + +-Archive each message currrently shown by removing the \"unread\" ++Archive each message currently shown by removing the \"unread\" + and \"inbox\" tag from each. Then kill this buffer and show the + next thread from the search from which this thread was originally + shown. +@@ -220,7 +220,7 @@ buffer." + (defun notmuch-show-archive-thread () + "Archive each message in thread, and show next thread from search. + +-Archive each message currrently shown by removing the \"inbox\" ++Archive each message currently shown by removing the \"inbox\" + tag from each. Then kill this buffer and show the next thread + from the search from which this thread was originally shown. + +@@ -340,7 +340,7 @@ there are no more unread messages past the current point." + (notmuch-show-next-message))) + + (defun notmuch-show-next-open-message () +- "Advance to the the next message which is not hidden. ++ "Advance to the next message which is not hidden. + + If read messages are currently hidden, advance to the next unread + message. Otherwise, advance to the next message." +@@ -674,7 +674,7 @@ thread from that buffer can be show when done with this one)." + ))) + + (defvar notmuch-search-authors-width 40 +- "Number of columns to use to diplay authors in a notmuch-search buffer.") ++ "Number of columns to use to display authors in a notmuch-search buffer.") + + (defvar notmuch-search-mode-map + (let ((map (make-sparse-keymap))) +@@ -910,7 +910,7 @@ the beginning of the buffer). + + This command toggles the sort order for the current search. + +-Note that any fitlered searches created by ++Note that any filtered searches created by + `notmuch-search-filter' retain the search order of the parent + search." + (interactive) +diff --git a/show-message.c b/show-message.c +index 79b02e2..38f5897 100644 +--- a/show-message.c ++++ b/show-message.c +@@ -38,7 +38,7 @@ show_message_part (GMimeObject *part, int *part_count, + if (i == 1) + continue; + if (i > 1) +- fprintf (stderr, "Warning: Unexpected extra parts of mutlipart/signed. Continuing.\n"); ++ fprintf (stderr, "Warning: Unexpected extra parts of multipart/signed. Continuing.\n"); + } + show_message_part (g_mime_multipart_get_part (multipart, i), + part_count, show_part); +-- +1.6.5.2.433.g23cdb + + diff --git a/test/corpus/20 b/test/corpus/20 new file mode 100644 index 00000000..7b9873e0 --- /dev/null +++ b/test/corpus/20 @@ -0,0 +1,54 @@ +From: "Adrian Perez de Castro" +To: notmuch@notmuchmail.org +Date: Wed, 18 Nov 2009 00:20:59 +0100 +Subject: [notmuch] Introducing myself +Message-ID: <20091118002059.067214ed@hikari> + + +Hello to all, + +I have just heard about Not Much today in some random Linux-related news +site (LWN?), my name is Adrian Perez and I work as systems administrator +(although I can do some code as well :P). I have always thought that the +ideas behind Sup were great, but after some time using it, I got tired of +the oddities that it has. I also do not like doing things like having to +install Ruby just for reading and sorting mails. Some time ago I thought +about doing something like Not Much and in fact I played a bit with the +Python+Xapian and the Python+Whoosh combinations, because I find relaxing +to code things in Python when I am not working and also it is installed +by default on most distribution. I got to have some mailboxes indexed and +basic searching working a couple of months ago. Lately I have been very +busy and had no time for coding, and them... boom! Not Much appears -- and +it is almost exactly what I was trying to do, but faster. I have been +playing a bit with Not Much today, and I think it has potential. + +Also, I would like to share one idea I had in mind, that you might find +interesting: One thing I have found very annoying is having to re-tag my +mail when the indexes get b0rked (it happened a couple of times to me while +using Sup), so I was planning to mails as read/unread and adding the tags +not just to the index, but to the mail text itself, e.g. by adding a +"X-Tags" header field or by reusing the "Keywords" one. This way, the index +could be totally recreated by re-reading the mail directories, and this +would also allow to a tools like OfflineIMAP [1] to get the mails into a +local maildir, tagging and indexing the mails with the e-mail reader and +then syncing back the messages with the "X-Tags" header to the IMAP server. +This would allow to use the mail reader from a different computer and still +have everything tagged finely. + +Best regards, + + +--- +[1] http://software.complete.org/software/projects/show/offlineimap + +-- +Adrian Perez de Castro +Igalia - Free Software Engineering +-------------- next part -------------- +A non-text attachment was scrubbed... +Name: signature.asc +Type: application/pgp-signature +Size: 198 bytes +Desc: not available +URL: + diff --git a/test/corpus/21 b/test/corpus/21 new file mode 100644 index 00000000..bc9361d8 --- /dev/null +++ b/test/corpus/21 @@ -0,0 +1,43 @@ +From: "Alex Botero-Lowry" +To: notmuch@notmuchmail.org +Date: Tue, 17 Nov 2009 16:23:53 -0800 +Subject: [notmuch] [PATCH] Error out if no query is supplied to search + instead of going into an infinite loop +Message-ID: + +In this case error out when no query is supplied. There seems to be an +infinite-loop casued by i think notmuch_query_search_threads having +an exception: + +A Xapian exception occurred: Syntax: AND +A Xapian exception occurred: Syntax: AND +A Xapian exception occurred: Syntax: AND +A Xapian exception occurred: Syntax: AND +A Xapian exception occurred: Syntax: AND +A Xapian exception occurred: Syntax: AND +A Xapian exception occurred: Syntax: AND +A Xapian exception occurred: Syntax: AND +A Xapian exception occurred: Syntax: AND +A Xapian exception occurred: Syntax: AND +A Xapian exception occurred: Syntax: AND +A Xapian exception occurred: Syntax: AND +A Xapian exception occurred: Syntax: AND +A Xapian exception occurred: Syntax: AND +A Xapian exception occurred: Syntax: AND + +I'll look into that bug specifically a bit later. + +It might be better to do a usage instead of just throwing an error here? + +alex +-------------- next part -------------- +An HTML attachment was scrubbed... +URL: +-------------- next part -------------- +A non-text attachment was scrubbed... +Name: 0001-Error-out-if-no-query-is-supplied-to-search-instead-.patch +Type: application/octet-stream +Size: 793 bytes +Desc: not available +URL: + diff --git a/test/corpus/22 b/test/corpus/22 new file mode 100644 index 00000000..fa3d2681 --- /dev/null +++ b/test/corpus/22 @@ -0,0 +1,30 @@ +From: "Lars Kellogg-Stedman" +To: notmuch@notmuchmail.org +Date: Tue, 17 Nov 2009 19:50:40 -0500 +Subject: [notmuch] Working with Maildir storage? +In-Reply-To: +References: <20091117190054.GU3165@dottiness.seas.harvard.edu> + <87iqd9rn3l.fsf@vertex.dottedmag> + <20091117203301.GV3165@dottiness.seas.harvard.edu> + +Message-ID: <20091118005040.GA25380@dottiness.seas.harvard.edu> + +> I've also pushed a slightly more complicated (and complete) fix to my +> private notmuch repository + +The version of lib/messages.cc in your repo doesn't build because it's +missing "#include " (for the uint32_t on line 466). + +-- +Lars Kellogg-Stedman +Senior Technologist, Computing and Information Technology +Harvard University School of Engineering and Applied Sciences + +-------------- next part -------------- +A non-text attachment was scrubbed... +Name: not available +Type: application/pgp-signature +Size: 489 bytes +Desc: not available +URL: + diff --git a/test/corpus/23 b/test/corpus/23 new file mode 100644 index 00000000..c2b26dc8 --- /dev/null +++ b/test/corpus/23 @@ -0,0 +1,77 @@ +From: "Lars Kellogg-Stedman" +To: notmuch@notmuchmail.org +Date: Tue, 17 Nov 2009 19:58:29 -0500 +Subject: [notmuch] "notmuch help" outputs to stderr? +Message-ID: <20091118005829.GB25380@dottiness.seas.harvard.edu> + +I'm just noticing that 'notmuch help ...' outputs to stderr, which +isn't terribly intuitive. For example, the obvious invocation: + + notmuch help | less + +...isn't terribly helpful. + +I've attached a patch that lets usage() take a FILE * argument so that +you can output to stderr in response to usage errors, and stdout in +response to an explicit request. + +-- +Lars Kellogg-Stedman +Senior Technologist, Computing and Information Technology +Harvard University School of Engineering and Applied Sciences + +-------------- next part -------------- +diff --git a/notmuch.c b/notmuch.c +index c47e640..a35cb99 100644 +--- a/notmuch.c ++++ b/notmuch.c +@@ -157,23 +157,23 @@ command_t commands[] = { + }; + + static void +-usage (void) ++usage (FILE *out) + { + command_t *command; + unsigned int i; + +- fprintf (stderr, "Usage: notmuch [args...]\n"); +- fprintf (stderr, "\n"); +- fprintf (stderr, "Where and [args...] are as follows:\n"); +- fprintf (stderr, "\n"); ++ fprintf (out, "Usage: notmuch [args...]\n"); ++ fprintf (out, "\n"); ++ fprintf (out, "Where and [args...] are as follows:\n"); ++ fprintf (out, "\n"); + + for (i = 0; i < ARRAY_SIZE (commands); i++) { + command = &commands[i]; + +- fprintf (stderr, "\t%s\t%s\n\n", command->name, command->summary); ++ fprintf (out, "\t%s\t%s\n\n", command->name, command->summary); + } + +- fprintf (stderr, "Use \"notmuch help \" for more details on each command.\n\n"); ++ fprintf (out, "Use \"notmuch help \" for more details on each command.\n\n"); + } + + static int +@@ -183,8 +183,8 @@ notmuch_help_command (unused (void *ctx), int argc, char *argv[]) + unsigned int i; + + if (argc == 0) { +- fprintf (stderr, "The notmuch mail system.\n\n"); +- usage (); ++ fprintf (stdout, "The notmuch mail system.\n\n"); ++ usage (stdout); + return 0; + } + +-------------- next part -------------- +A non-text attachment was scrubbed... +Name: not available +Type: application/pgp-signature +Size: 489 bytes +Desc: not available +URL: + diff --git a/test/corpus/24 b/test/corpus/24 new file mode 100644 index 00000000..03049d85 --- /dev/null +++ b/test/corpus/24 @@ -0,0 +1,86 @@ +From: "Lars Kellogg-Stedman" +To: notmuch@notmuchmail.org +Date: Tue, 17 Nov 2009 20:01:16 -0500 +Subject: [notmuch] "notmuch help" outputs to stderr? +In-Reply-To: <20091118005829.GB25380@dottiness.seas.harvard.edu> +References: <20091118005829.GB25380@dottiness.seas.harvard.edu> +Message-ID: <20091118010116.GC25380@dottiness.seas.harvard.edu> + +> I've attached a patch that lets usage() take a FILE * argument so that +> you can output to stderr in response to usage errors, and stdout in +> response to an explicit request. + +Whoops, missed a couple of stderr's in that last patch. New one +attached. + +-- +Lars Kellogg-Stedman +Senior Technologist, Computing and Information Technology +Harvard University School of Engineering and Applied Sciences + +-------------- next part -------------- +diff --git a/notmuch.c b/notmuch.c +index c47e640..446c810 100644 +--- a/notmuch.c ++++ b/notmuch.c +@@ -157,23 +157,23 @@ command_t commands[] = { + }; + + static void +-usage (void) ++usage (FILE *out) + { + command_t *command; + unsigned int i; + +- fprintf (stderr, "Usage: notmuch [args...]\n"); +- fprintf (stderr, "\n"); +- fprintf (stderr, "Where and [args...] are as follows:\n"); +- fprintf (stderr, "\n"); ++ fprintf (out, "Usage: notmuch [args...]\n"); ++ fprintf (out, "\n"); ++ fprintf (out, "Where and [args...] are as follows:\n"); ++ fprintf (out, "\n"); + + for (i = 0; i < ARRAY_SIZE (commands); i++) { + command = &commands[i]; + +- fprintf (stderr, "\t%s\t%s\n\n", command->name, command->summary); ++ fprintf (out, "\t%s\t%s\n\n", command->name, command->summary); + } + +- fprintf (stderr, "Use \"notmuch help \" for more details on each command.\n\n"); ++ fprintf (out, "Use \"notmuch help \" for more details on each command.\n\n"); + } + + static int +@@ -183,8 +183,8 @@ notmuch_help_command (unused (void *ctx), int argc, char *argv[]) + unsigned int i; + + if (argc == 0) { +- fprintf (stderr, "The notmuch mail system.\n\n"); +- usage (); ++ fprintf (stdout, "The notmuch mail system.\n\n"); ++ usage (stdout); + return 0; + } + +@@ -192,8 +192,8 @@ notmuch_help_command (unused (void *ctx), int argc, char *argv[]) + command = &commands[i]; + + if (strcmp (argv[0], command->name) == 0) { +- fprintf (stderr, "Help for \"notmuch %s\":\n\n", argv[0]); +- fprintf (stderr, "\t%s\t%s\n\n%s\n\n", command->name, ++ fprintf (stdout, "Help for \"notmuch %s\":\n\n", argv[0]); ++ fprintf (stdout, "\t%s\t%s\n\n%s\n\n", command->name, + command->summary, command->documentation); + return 0; + } +-------------- next part -------------- +A non-text attachment was scrubbed... +Name: not available +Type: application/pgp-signature +Size: 489 bytes +Desc: not available +URL: + diff --git a/test/corpus/25 b/test/corpus/25 new file mode 100644 index 00000000..7378f820 --- /dev/null +++ b/test/corpus/25 @@ -0,0 +1,32 @@ +From: "Stewart Smith" +To: notmuch@notmuchmail.org +Date: Wed, 18 Nov 2009 12:05:53 +1100 +Subject: [notmuch] [PATCH] Fix linking with gcc to use g++ to link in C++ + libs. +Message-ID: <1258506353-20352-1-git-send-email-stewart@flamingspork.com> + +Previously, Ubuntu 9.10, gcc 4.4.1 was getting: + +ccache gcc `pkg-config --libs glib-2.0 gmime-2.4 talloc` `xapian-config --libs` notmuch.o notmuch-config.o notmuch-dump.o notmuch-new.o notmuch-reply.o notmuch-restore.o notmuch-search.o notmuch-setup.o notmuch-show.o notmuch-tag.o notmuch-time.o gmime-filter-reply.o query-string.o show-message.o lib/notmuch.a -o notmuch +/usr/bin/ld: lib/notmuch.a(database.o): in function global constructors keyed to BOOLEAN_PREFIX_INTERNAL:database.cc(.text+0x3a): error: undefined reference to 'std::ios_base::Init::Init()' +--- + Makefile.local | 2 +- + 1 files changed, 1 insertions(+), 1 deletions(-) + +diff --git a/Makefile.local b/Makefile.local +index f824bed..dbd3e20 100644 +--- a/Makefile.local ++++ b/Makefile.local +@@ -18,7 +18,7 @@ notmuch_client_srcs = \ + + notmuch_client_modules = $(notmuch_client_srcs:.c=.o) + notmuch: $(notmuch_client_modules) lib/notmuch.a +- $(CC) $(LDFLAGS) $^ -o $@ ++ $(CXX) $(LDFLAGS) $^ -o $@ + + notmuch.1.gz: + gzip --stdout notmuch.1 > notmuch.1.gz +-- +1.6.3.3 + + diff --git a/test/corpus/26 b/test/corpus/26 new file mode 100644 index 00000000..f3c5f53d --- /dev/null +++ b/test/corpus/26 @@ -0,0 +1,121 @@ +From: "Stewart Smith" +To: notmuch@notmuchmail.org +Date: Wed, 18 Nov 2009 12:56:40 +1100 +Subject: [notmuch] [PATCH 2/2] Read mail directory in inode number order +Message-ID: <1258509400-32511-1-git-send-email-stewart@flamingspork.com> + +This gives a rather decent reduction in number of seeks required when +reading a Maildir that isn't in pagecache. + +Most filesystems give some locality on disk based on inode numbers. +In ext[234] this is the inode tables, in XFS groups of sequential inode +numbers are together on disk and the most significant bits indicate +allocation group (i.e inode 1,000,000 is always after inode 1,000). + +With this patch, we read in the whole directory, sort by inode number +before stat()ing the contents. + +Ideally, directory is sequential and then we make one scan through the +file system stat()ing. + +Since the universe is not ideal, we'll probably seek during reading the +directory and a fair bit while reading the inodes themselves. + +However... with readahead, and stat()ing in inode order, we should be +in the best place possible to hit the cache. + +In a (not very good) benchmark of "how long does it take to find the first +15,000 messages in my Maildir after 'echo 3 > /proc/sys/vm/drop_caches'", +this patch consistently cut at least 8 seconds off the scan time. + +Without patch: 50 seconds +With patch: 38-42 seconds. + +(I did this in a previous maildir reading project and saw large improvements too) +--- + notmuch-new.c | 32 +++++++++++++++----------------- + 1 files changed, 15 insertions(+), 17 deletions(-) + +diff --git a/notmuch-new.c b/notmuch-new.c +index 83a05ba..11fad8c 100644 +--- a/notmuch-new.c ++++ b/notmuch-new.c +@@ -73,6 +73,11 @@ add_files_print_progress (add_files_state_t *state) + fflush (stdout); + } + ++static int ino_cmp(const struct dirent **a, const struct dirent **b) ++{ ++ return ((*a)->d_ino < (*b)->d_ino)? -1: 1; ++} ++ + /* Examine 'path' recursively as follows: + * + * o Ask the filesystem for the mtime of 'path' (path_mtime) +@@ -100,13 +105,12 @@ add_files_recursive (notmuch_database_t *notmuch, + add_files_state_t *state) + { + DIR *dir = NULL; +- struct dirent *e, *entry = NULL; +- int entry_length; +- int err; ++ struct dirent *entry = NULL; + char *next = NULL; + time_t path_mtime, path_dbtime; + notmuch_status_t status, ret = NOTMUCH_STATUS_SUCCESS; + notmuch_message_t *message = NULL; ++ struct dirent **namelist = NULL; + + /* If we're told to, we bail out on encountering a read-only + * directory, (with this being a clear clue from the user to +@@ -122,31 +126,23 @@ add_files_recursive (notmuch_database_t *notmuch, + path_mtime = st->st_mtime; + + path_dbtime = notmuch_database_get_timestamp (notmuch, path); ++ int n_entries= scandir(path, &namelist, 0, ino_cmp); + +- dir = opendir (path); +- if (dir == NULL) { ++ if (n_entries == -1) { + fprintf (stderr, "Error opening directory %s: %s\n", + path, strerror (errno)); + ret = NOTMUCH_STATUS_FILE_ERROR; + goto DONE; + } + +- entry_length = offsetof (struct dirent, d_name) + +- pathconf (path, _PC_NAME_MAX) + 1; +- entry = malloc (entry_length); ++ int i=0; + + while (!interrupted) { +- err = readdir_r (dir, entry, &e); +- if (err) { +- fprintf (stderr, "Error reading directory: %s\n", +- strerror (errno)); +- ret = NOTMUCH_STATUS_FILE_ERROR; +- goto DONE; +- } +- +- if (e == NULL) ++ if (i == n_entries) + break; + ++ entry= namelist[i++]; ++ + /* If this directory hasn't been modified since the last + * add_files, then we only need to look further for + * sub-directories. */ +@@ -243,6 +239,8 @@ add_files_recursive (notmuch_database_t *notmuch, + free (entry); + if (dir) + closedir (dir); ++ if (namelist) ++ free (namelist); + + return ret; + } +-- +1.6.3.3 + + diff --git a/test/corpus/27 b/test/corpus/27 new file mode 100644 index 00000000..7f0f045b --- /dev/null +++ b/test/corpus/27 @@ -0,0 +1,21 @@ +From: "Keith Packard" +To: notmuch@notmuchmail.org +Date: Tue, 17 Nov 2009 17:59:49 -0800 +Subject: [notmuch] New to the list +In-Reply-To: <1258498485-sup-142@elly> +References: <1258498485-sup-142@elly> +Message-ID: + +On Tue, 17 Nov 2009 23:57:18 +0100, Israel Herraiz wrote: + +> "Not much" sounds interesting, and I wonder whether it could be +> integrated with the views of Sup (inbox, threads, etc). So I have +> subscribed to the list to keep an eye on what's going on here. + +We've tried to clone much of the sup UI inside emacs, including the +inbox and threaded message presentation. Of course, we had to "improve" +it a bit, as much due to the differences between curses and emacs as due +to personal preferences... + +-keith + diff --git a/test/corpus/28 b/test/corpus/28 new file mode 100644 index 00000000..83ce01bd --- /dev/null +++ b/test/corpus/28 @@ -0,0 +1,38 @@ +From: "Keith Packard" +To: notmuch@notmuchmail.org +Date: Tue, 17 Nov 2009 18:03:17 -0800 +Subject: [notmuch] Introducing myself +In-Reply-To: <20091118002059.067214ed@hikari> +References: <20091118002059.067214ed@hikari> +Message-ID: + +On Wed, 18 Nov 2009 00:20:59 +0100, Adrian Perez de Castro wrote: + +> Some time ago I thought +> about doing something like Not Much and in fact I played a bit with the +> Python+Xapian and the Python+Whoosh combinations, because I find relaxing +> to code things in Python when I am not working and also it is installed +> by default on most distribution. I got to have some mailboxes indexed and +> basic searching working a couple of months ago. + +Sup certainly started a lot of people thinking... + +> Also, I would like to share one idea I had in mind, that you might find +> interesting: One thing I have found very annoying is having to re-tag my +> mail when the indexes get b0rked (it happened a couple of times to me while +> using Sup), so I was planning to mails as read/unread and adding the tags +> not just to the index, but to the mail text itself, e.g. by adding a +> "X-Tags" header field or by reusing the "Keywords" one. + +Easier than that, notmuch (and sup too), provide a 'dump' command which +just lists all of the message IDs and their associated tags. Makes +saving tags easy and doesn't involve rewriting messages. I do this once +a day just before my computer is backed up to an external drive. + +If the index is destroyed, you can reindex the messages and then reapply +all of the tags with 'notmuch restore'. + +-- +keith.packard at intel.com + + diff --git a/test/corpus/29 b/test/corpus/29 new file mode 100644 index 00000000..c76eff33 --- /dev/null +++ b/test/corpus/29 @@ -0,0 +1,21 @@ +From: "Keith Packard" +To: notmuch@notmuchmail.org +Date: Tue, 17 Nov 2009 18:04:31 -0800 +Subject: [notmuch] archive +In-Reply-To: <20091117232137.GA7669@griffis1.net> +References: <20091117232137.GA7669@griffis1.net> +Message-ID: + +On Tue, 17 Nov 2009 18:21:38 -0500, Aron Griffis wrote: + +> Just subscribed, I'd like to catch up on the previous postings, +> but the archive link seems to be bogus? + +Yeah, the archive appears broken and will need to wait until Carl +arrives in Barcelona to get fixed. + +-- +keith.packard at intel.com + + + diff --git a/test/corpus/30 b/test/corpus/30 new file mode 100644 index 00000000..a5b94a0a --- /dev/null +++ b/test/corpus/30 @@ -0,0 +1,75 @@ +From: "Stewart Smith" +To: notmuch@notmuchmail.org +Date: Wed, 18 Nov 2009 13:22:20 +1100 +Subject: [notmuch] [PATCH] count_files: sort directory in inode order before + statting +Message-ID: <1258510940-7018-1-git-send-email-stewart@flamingspork.com> + +--- + notmuch-new.c | 30 ++++++++++-------------------- + 1 files changed, 10 insertions(+), 20 deletions(-) + +diff --git a/notmuch-new.c b/notmuch-new.c +index 11fad8c..c5f841a 100644 +--- a/notmuch-new.c ++++ b/notmuch-new.c +@@ -308,36 +308,26 @@ add_files (notmuch_database_t *notmuch, + static void + count_files (const char *path, int *count) + { +- DIR *dir; +- struct dirent *e, *entry = NULL; +- int entry_length; +- int err; ++ struct dirent *entry = NULL; + char *next; + struct stat st; ++ struct dirent **namelist = NULL; + +- dir = opendir (path); ++ int n_entries= scandir(path, &namelist, 0, ino_cmp); + +- if (dir == NULL) { ++ if (n_entries == -1) { + fprintf (stderr, "Warning: failed to open directory %s: %s\n", + path, strerror (errno)); + goto DONE; + } + +- entry_length = offsetof (struct dirent, d_name) + +- pathconf (path, _PC_NAME_MAX) + 1; +- entry = malloc (entry_length); ++ int i=0; + + while (!interrupted) { +- err = readdir_r (dir, entry, &e); +- if (err) { +- fprintf (stderr, "Error reading directory: %s\n", +- strerror (errno)); +- free (entry); +- goto DONE; +- } ++ if (i == n_entries) ++ break; + +- if (e == NULL) +- break; ++ entry= namelist[i++]; + + /* Ignore special directories to avoid infinite recursion. + * Also ignore the .notmuch directory. +@@ -376,8 +366,8 @@ count_files (const char *path, int *count) + DONE: + if (entry) + free (entry); +- +- closedir (dir); ++ if (namelist) ++ free (namelist); + } + + int +-- +1.6.3.3 + + diff --git a/test/corpus/31 b/test/corpus/31 new file mode 100644 index 00000000..88f17ca9 --- /dev/null +++ b/test/corpus/31 @@ -0,0 +1,31 @@ +From: "Jjgod Jiang" +To: notmuch@notmuchmail.org +Date: Wed, 18 Nov 2009 11:50:17 +0800 +Subject: [notmuch] Mac OS X/Darwin compatibility issues +Message-ID: + +Hi, + +When I tried to compile notmuch under Mac OS X 10.6, several issues +arisen: + +1. g++ reports 'warning: command line option "-Wmissing-declarations" +is valid for C/ObjC but not for C++' + +2. +notmuch-reply.c: In function ?address_is_users?: +notmuch-reply.c:87: warning: passing argument 2 of +?notmuch_config_get_user_other_email? from incompatible pointer type + +That's due to the size incompatibility of 'unsigned int' and 'size_t' +(size_t is uint64_t in Mac OS X). + +3. Several errors about missing GNU extensions like getline() and strndup(): + +warning: implicit declaration of function ?getline? +error: ?strndup? was not declared in this scope + +We can implement these with fgets() and strncpy() though. + +- Jiang + diff --git a/test/corpus/32 b/test/corpus/32 new file mode 100644 index 00000000..c1633cdd --- /dev/null +++ b/test/corpus/32 @@ -0,0 +1,165 @@ +From: "Jan Janak" +To: notmuch@notmuchmail.org +Date: Wed, 18 Nov 2009 05:57:03 +0100 +Subject: [notmuch] [PATCH] notmuch new: Support for conversion of spool + subdirectories into tags +Message-ID: <1258520223-15328-1-git-send-email-jan@ryngle.com> + +This patch makes it possible to convert subdirectory names inside the +spool directory into message tags. Messages stored in subdirectory +"foo" will be marked with tag "foo". Message duplicates found in several +subdirectories will be given one tag per subdirectory. + +This feature can be used to synchronize notmuch's tags with with gmail +tags, for example. Gmail IMAP servers convert tags to IMAP +subdirectories and those subdirectories can be converted back to tags +in notmuch. + +The patch modifies notmuch_database_add_message function to return a +pointer to the message even if a message duplicate was found in the +database. This is needed if we want to add a tag for each subdirectory +in which a message duplicate was found. + +In addition to that, it makes the pointer to notmuch_config_t global +(previously it was a local variable in notmuch_new_command). The +configuration data structure is used by the function which converts +subdirectory names to tags. + +Finally, there is a new function called subdir_to_tag. The function +extracts the name of the subdirectory inside the spool from the full +path of the message (also removing Maildir's cur,dir,and tmp +subdirectories) and adds it as a new tag to the message. + +Signed-off-by: Jan Janak +--- + lib/database.cc | 3 +- + notmuch-new.c | 74 +++++++++++++++++++++++++++++++++++++++++++++++++++++- + 2 files changed, 74 insertions(+), 3 deletions(-) + +diff --git a/lib/database.cc b/lib/database.cc +index 3c8d626..f7799d2 100644 +--- a/lib/database.cc ++++ b/lib/database.cc +@@ -949,7 +949,8 @@ notmuch_database_add_message (notmuch_database_t *notmuch, + + DONE: + if (message) { +- if (ret == NOTMUCH_STATUS_SUCCESS && message_ret) ++ if ((ret == NOTMUCH_STATUS_SUCCESS || ++ ret == NOTMUCH_STATUS_DUPLICATE_MESSAGE_ID) && message_ret) + *message_ret = message; + else + notmuch_message_destroy (message); +diff --git a/notmuch-new.c b/notmuch-new.c +index 83a05ba..d94ce16 100644 +--- a/notmuch-new.c ++++ b/notmuch-new.c +@@ -19,6 +19,9 @@ + */ + + #include "notmuch-client.h" ++#include ++ ++static notmuch_config_t *config = 0; + + static volatile sig_atomic_t do_add_files_print_progress = 0; + +@@ -45,6 +48,69 @@ tag_inbox_and_unread (notmuch_message_t *message) + notmuch_message_add_tag (message, "unread"); + } + ++/* ++ * Extracts the sub-directory from the filename and adds it as a new tag to ++ * the message. The filename must begin with the database directory configured ++ * in the configuration file. This prefix is then removed. If the remaining ++ * sub-directory ends with one of the Maildir special directories (/tmp, /new, ++ * /cur) then they are removed as well. If there is anything left then the ++ * function adds it as a new tag to the message. ++ * ++ * The function does nothing if it cannot extract a sub-directory from ++ * filename. ++ */ ++static void ++subdir_to_tag (char* filename, notmuch_message_t *message) ++{ ++ const char* db_path; ++ char *msg_dir, *tmp; ++ int db_path_len, msg_dir_len; ++ ++ if (config == NULL) return; ++ db_path = notmuch_config_get_database_path (config); ++ if (db_path == NULL) return; ++ db_path_len = strlen(db_path); ++ ++ /* Make a copy of the string as dirname may need to modify it. */ ++ tmp = talloc_strdup(message, filename); ++ msg_dir = dirname(tmp); ++ msg_dir_len = strlen(msg_dir); ++ ++ /* If msg_dir starts with db_path, remove it, including the / which delimits ++ * it from the rest of the directory name. */ ++ if (db_path_len < msg_dir_len && ++ !strncmp(db_path, msg_dir, db_path_len)) { ++ msg_dir += db_path_len + 1; ++ msg_dir_len -= db_path_len + 1; ++ } else { ++ /* If we get here, either the message filename is not inside the ++ * database directory configured in the configuration file, or it is a ++ * file in the root directory of the database. Either way we just skip ++ * it because we do not know how to convert it to a meaningful ++ * subdirectory string that we could add as tag. */ ++ goto out; ++ } ++ ++ /* Special conditioning for Maildirs. If the remainder of the directory ++ * name ends with /new, /cur, or /tmp then remove it. */ ++ if ((msg_dir_len >= 4) && ++ (!strncmp(msg_dir + msg_dir_len - 4, "/new", 4) || ++ !strncmp(msg_dir + msg_dir_len - 4, "/cur", 4) || ++ !strncmp(msg_dir + msg_dir_len - 4, "/tmp", 4))) { ++ msg_dir[msg_dir_len - 4] = '\0'; ++ } ++ ++ /* If, after all the modifications, we still have a subdirectory, add it ++ * as tag. */ ++ if (strlen(msg_dir)) { ++ notmuch_message_add_tag (message, msg_dir); ++ } ++ ++out: ++ talloc_free(tmp); ++} ++ ++ + static void + add_files_print_progress (add_files_state_t *state) + { +@@ -186,10 +252,15 @@ add_files_recursive (notmuch_database_t *notmuch, + case NOTMUCH_STATUS_SUCCESS: + state->added_messages++; + tag_inbox_and_unread (message); ++ subdir_to_tag(next, message); + break; + /* Non-fatal issues (go on to next file) */ + case NOTMUCH_STATUS_DUPLICATE_MESSAGE_ID: +- /* Stay silent on this one. */ ++ /* Stay silent on this one. The message already exists in the ++ * database, that means we may have found a duplicate in ++ * another directory. If that's the case then we add another ++ * tag to the message with the sub-directory. */ ++ subdir_to_tag(next, message); + break; + case NOTMUCH_STATUS_FILE_NOT_EMAIL: + fprintf (stderr, "Note: Ignoring non-mail file: %s\n", +@@ -386,7 +457,6 @@ int + notmuch_new_command (void *ctx, + unused (int argc), unused (char *argv[])) + { +- notmuch_config_t *config; + notmuch_database_t *notmuch; + add_files_state_t add_files_state; + double elapsed; +-- +1.6.3.3 + + diff --git a/test/corpus/33 b/test/corpus/33 new file mode 100644 index 00000000..a9b32524 --- /dev/null +++ b/test/corpus/33 @@ -0,0 +1,13 @@ +From: "Rolland Santimano" +To: notmuch@notmuchmail.org +Date: Tue, 17 Nov 2009 21:12:23 -0800 (PST) +Subject: [notmuch] Link to mailing list archives ? +Message-ID: <736613.51770.qm@web113505.mail.gq1.yahoo.com> + +The link[1] provided on the list page[2] is broken: +[1] http://notmuchmail.org/pipermail/notmuch/ +[2] http://notmuchmail.org/mailman/listinfo/notmuch + + + + diff --git a/test/corpus/34 b/test/corpus/34 new file mode 100644 index 00000000..b94dd069 --- /dev/null +++ b/test/corpus/34 @@ -0,0 +1,46 @@ +From: "Alexander Botero-Lowry" +To: notmuch@notmuchmail.org +Date: Tue, 17 Nov 2009 21:45:36 -0800 +Subject: [notmuch] Mac OS X/Darwin compatibility issues +In-Reply-To: +References: +Message-ID: <86einw2xof.fsf@fortitudo.i-did-not-set--mail-host-address--so-tickle-me> + +On Wed, 18 Nov 2009 11:50:17 +0800, Jjgod Jiang wrote: +> Hi, +> +> When I tried to compile notmuch under Mac OS X 10.6, several issues +> arisen: +> +> 1. g++ reports 'warning: command line option "-Wmissing-declarations" +> is valid for C/ObjC but not for C++' +> +I got that too. I presume it's newly supported in GCC4.4? + +> 3. Several errors about missing GNU extensions like getline() and strndup(): +> +strndup from V8: + +char* strndup(char* str, size_t n) { + // Stupid implementation of strndup since macos isn't born with + // one. + size_t len = strlen(str); + if (len <= n) + return StrDup(str); + char* result = new char[n+1]; + size_t i; + for (i = 0; i <= n; i++) + result[i] = str[i]; + result[i] = '\0'; + return result; +} + +> warning: implicit declaration of function ?getline? +> error: ?strndup? was not declared in this scope +> +for getline do you mind trying #define _GNU_SOURCE 1 +before #include in the offending files? The FreeBSD man pages +mentions that as a way of enabling the GNU version of getline(). + +Alex + diff --git a/test/corpus/35 b/test/corpus/35 new file mode 100644 index 00000000..d7276705 --- /dev/null +++ b/test/corpus/35 @@ -0,0 +1,24 @@ +From: "Jjgod Jiang" +To: notmuch@notmuchmail.org +Date: Wed, 18 Nov 2009 14:14:27 +0800 +Subject: [notmuch] Mac OS X/Darwin compatibility issues +In-Reply-To: <86einw2xof.fsf@fortitudo.i-did-not-set--mail-host-address--so-tickle-me> +References: + <86einw2xof.fsf@fortitudo.i-did-not-set--mail-host-address--so-tickle-me> +Message-ID: + +Hi, + +On Wed, Nov 18, 2009 at 1:45 PM, Alexander Botero-Lowry + wrote: +> for getline do you mind trying #define _GNU_SOURCE 1 +> before #include in the offending files? The FreeBSD man pages +> mentions that as a way of enabling the GNU version of getline(). + +It seems even _GNU_SOURCE is defined, getline is still not present. +the C lib in Mac OS X simply doesn't have it. See also [1]. + +- Jiang + +[1] http://stackoverflow.com/questions/1117108/compiling-c-code-using-gnu-c-getline-on-mac-osx + diff --git a/test/corpus/36 b/test/corpus/36 new file mode 100644 index 00000000..4cd0d200 --- /dev/null +++ b/test/corpus/36 @@ -0,0 +1,25 @@ +From: "Alexander Botero-Lowry" +To: notmuch@notmuchmail.org +Date: Tue, 17 Nov 2009 22:19:29 -0800 +Subject: [notmuch] Mac OS X/Darwin compatibility issues +In-Reply-To: +References: + <86einw2xof.fsf@fortitudo.i-did-not-set--mail-host-address--so-tickle-me> + +Message-ID: <86d43g2w3y.fsf@fortitudo.i-did-not-set--mail-host-address--so-tickle-me> + +On Wed, 18 Nov 2009 14:14:27 +0800, Jjgod Jiang wrote: +> Hi, +> +> On Wed, Nov 18, 2009 at 1:45 PM, Alexander Botero-Lowry +> wrote: +> > for getline do you mind trying #define _GNU_SOURCE 1 +> > before #include in the offending files? The FreeBSD man pages +> > mentions that as a way of enabling the GNU version of getline(). +> +> It seems even _GNU_SOURCE is defined, getline is still not present. +> the C lib in Mac OS X simply doesn't have it. See also [1]. +> +Alas. Since it's ostensibly based on the FreeBSD one, I figured there +was a chance that would fix the problem. :/ + diff --git a/test/corpus/37 b/test/corpus/37 new file mode 100644 index 00000000..4e17e82b --- /dev/null +++ b/test/corpus/37 @@ -0,0 +1,22 @@ +From: "Alexander Botero-Lowry" +To: notmuch@notmuchmail.org +Date: Wed, 18 Nov 2009 00:02:56 -0800 +Subject: [notmuch] request for pull +Message-ID: <86aayk2rbj.fsf@fortitudo.i-did-not-set--mail-host-address--so-tickle-me> + +The following changes since commit e8c9c3e6a534fc6c2919c2c1de63cea7250eb488: + Ingmar Vanhassel (1): + Makefile: Manual pages shouldn't be executable + +are available in the git repository at: + + git://alexbl.net/notmuch.git master + +Alexander Botero-Lowry (2): + Error out if no query is supplied to search instead of going into an infinite loop + set a local truncate-line variable in notmuch-search-mode, so that subjects don't wrap and make the output look weird + + notmuch-search.c | 5 +++++ + notmuch.el | 1 + + 2 files changed, 6 insertions(+), 0 deletions(-) + diff --git a/test/corpus/38 b/test/corpus/38 new file mode 100644 index 00000000..f5537ffe --- /dev/null +++ b/test/corpus/38 @@ -0,0 +1,40 @@ +From: "Keith Packard" +To: notmuch@notmuchmail.org +Date: Wed, 18 Nov 2009 00:29:59 -0800 +Subject: [notmuch] [PATCH] Create a default notmuch-show-hook that + highlights URLs and uses word-wrap +Message-ID: <1258532999-9316-1-git-send-email-keithp@keithp.com> + +I created the notmuch-show-hook precisely so I could add these two +options, but I suspect most people will want them, so I just made them +the default. If you don't want them, you can use remove-hook to get +rid of this. + +Signed-off-by: Keith Packard +--- + notmuch.el | 8 ++++++++ + 1 files changed, 8 insertions(+), 0 deletions(-) + +diff --git a/notmuch.el b/notmuch.el +index 1bb1294..c95cb43 100644 +--- a/notmuch.el ++++ b/notmuch.el +@@ -698,6 +698,14 @@ view, (remove the \"inbox\" tag from each), with either + :options '(goto-address) + :group 'notmuch) + ++; Make show mode a bit prettier, highlighting URLs and using word wrap ++ ++(defun notmuch-show-pretty-hook () ++ (goto-address-mode 1) ++ (visual-line-mode)) ++ ++(add-hook 'notmuch-show-hook 'notmuch-show-pretty-hook) ++ + (defun notmuch-show (thread-id &optional parent-buffer) + "Run \"notmuch show\" with the given thread ID and display results. + +-- +1.6.5.2 + + diff --git a/test/corpus/39 b/test/corpus/39 new file mode 100644 index 00000000..637b3c74 --- /dev/null +++ b/test/corpus/39 @@ -0,0 +1,32 @@ +From: "Alexander Botero-Lowry" +To: notmuch@notmuchmail.org +Date: Wed, 18 Nov 2009 00:52:34 -0800 +Subject: [notmuch] [PATCH] Create a default notmuch-show-hook that + highlights URLs and uses word-wrap +In-Reply-To: <1258532999-9316-1-git-send-email-keithp@keithp.com> +References: <1258532999-9316-1-git-send-email-keithp@keithp.com> +Message-ID: <867hto2p0t.fsf@fortitudo.i-did-not-set--mail-host-address--so-tickle-me> + +On Wed, 18 Nov 2009 00:29:59 -0800, Keith Packard wrote: +> I created the notmuch-show-hook precisely so I could add these two +> options, but I suspect most people will want them, so I just made them +> the default. If you don't want them, you can use remove-hook to get +> rid of this. +> +Yes, hooks should be added for search as well. :) + +> +; Make show mode a bit prettier, highlighting URLs and using word wrap +> + +> +(defun notmuch-show-pretty-hook () +> + (goto-address-mode 1) +> + (visual-line-mode)) +> + +visual-line-mode turns out to make subject look pretty ugly if there is a +continuation. It doesn't do much good for the citation headers +either. We probably need to do our own intelligent wrapping rather then +use visual-line-mode to make this actually look right. + +goto-address-mode is important though. :) + +alex + diff --git a/test/corpus/40 b/test/corpus/40 new file mode 100644 index 00000000..91a15a8d --- /dev/null +++ b/test/corpus/40 @@ -0,0 +1,31 @@ +From: "Carl Worth" +To: notmuch@notmuchmail.org +Date: Wed, 18 Nov 2009 01:42:02 -0800 +Subject: [notmuch] [PATCH 1/2] Close message file after parsing message + headers +In-Reply-To: +References: <1258471718-6781-1-git-send-email-dottedmag@dottedmag.net> + <87lji5cbwo.fsf@yoom.home.cworth.org> +Message-ID: <87pr7gqidx.fsf@yoom.home.cworth.org> + +On Tue, 17 Nov 2009 13:15:25 -0800, Keith Packard wrote: +> Threading the message also involves displaying the from and to contents, +> which requires opening the message file. The alternative to the fix I +> provided is to just parse all of the message headers when first opening +> the message; it could then be immediately closed and the hash referred +> to for all header data. Given the choice, just having the caller say +> when it has finished with a message is probably a reasonable option... + +Hi Keith, + +Once I finally got back on the ground again, I pushed out a revised +version of your patch, (didn't need the reply-to stuff anymore since I +had fixed that differently in the meantime). + +I'm pretty happy with the state of this portion of the code now. + +Thanks Keith and Mikhail for your input on and code to fix this bug. + +-Carl + + diff --git a/test/corpus/41 b/test/corpus/41 new file mode 100644 index 00000000..da22cc02 --- /dev/null +++ b/test/corpus/41 @@ -0,0 +1,37 @@ +From: "Carl Worth" +To: notmuch@notmuchmail.org +Date: Wed, 18 Nov 2009 02:08:10 -0800 +Subject: [notmuch] Working with Maildir storage? +In-Reply-To: <20091117190054.GU3165@dottiness.seas.harvard.edu> +References: <20091117190054.GU3165@dottiness.seas.harvard.edu> +Message-ID: <87ocn0qh6d.fsf@yoom.home.cworth.org> + +On Tue, 17 Nov 2009 14:00:54 -0500, Lars Kellogg-Stedman wrote: +> I saw the LWN article and decided to take a look at notmuch. I'm +> currently using mutt and mairix to index and read a collection of +> Maildir mail folders (around 40,000 messages total). + +Welcome, Lars! + +I hadn't even seen that Keith's blog post had been picked up by lwn.net. +That's very interesting. So, thanks for coming and trying out notmuch. + +> Error opening +> /home/lars/Mail/read-messages.2008/cur/1246413773.24928_27334.hostname,U=3026:2,S: +> Too many open files + +Sadly, the lwn article coincided with me having just introduced this +bug, and then getting on a Trans-Atlantic flight. So I fixed the bug +fairly quickly, but there was quite a bit of latency before I could push +the fix out. It should be fixed now. + +> I'm curious if this is expected behavior (i.e., notmuch does not work +> with Maildir) or if something else is going on. + +Notmuch works just fine with maildir---it's one of the things that it +likes the best. + +Happy hacking, + +-Carl + diff --git a/test/corpus/42 b/test/corpus/42 new file mode 100644 index 00000000..98fa75fa --- /dev/null +++ b/test/corpus/42 @@ -0,0 +1,30 @@ +From: "Carl Worth" +To: notmuch@notmuchmail.org +Date: Wed, 18 Nov 2009 02:19:26 -0800 +Subject: [notmuch] [PATCH] Make notmuch-show 'X' (and 'x') commands + remove inbox (and unread) tags +In-Reply-To: <1258493565-13508-1-git-send-email-keithp@keithp.com> +References: <1258493565-13508-1-git-send-email-keithp@keithp.com> +Message-ID: <87k4xoqgnl.fsf@yoom.home.cworth.org> + +On Tue, 17 Nov 2009 13:32:45 -0800, Keith Packard wrote: +> When closing a thread view, mark the thread as archived by removing +> the "inbox" tag, and for the 'x' variant, the "unread" tag as well, +> then kill the buffer and update the search window view as well. +> +> This makes 'x' much the same as 'a', but instead of taking you to the +> next message, it takes you back to the search window instead. + +I don't like this---but that's because I use 'x' precisely *because* it +preserves these tags. + +Otherwise, you might as well just remove inbox and unread as soon as the +message is presented to the user. And that's a bug in a lot of other +email programs that I'm unwilling to replicate. + +We may run into a need to define different ways that people like to work +with their email here. (I know that so far I've just been coding up the +way I want my mail to work.) + +-Carl + diff --git a/test/corpus/43 b/test/corpus/43 new file mode 100644 index 00000000..2f6c8bc8 --- /dev/null +++ b/test/corpus/43 @@ -0,0 +1,26 @@ +From: "Carl Worth" +To: notmuch@notmuchmail.org +Date: Wed, 18 Nov 2009 02:22:12 -0800 +Subject: [notmuch] archive +In-Reply-To: +References: <20091117232137.GA7669@griffis1.net> + +Message-ID: <87iqd8qgiz.fsf@yoom.home.cworth.org> + +On Tue, 17 Nov 2009 18:04:31 -0800, Keith Packard wrote: +> On Tue, 17 Nov 2009 18:21:38 -0500, Aron Griffis wrote: +> +> > Just subscribed, I'd like to catch up on the previous postings, +> > but the archive link seems to be bogus? +> +> Yeah, the archive appears broken and will need to wait until Carl +> arrives in Barcelona to get fixed. + +Fixed it in transit in Frankfurt---with only moments to spare on my +battery and no outlets in sight. + +Thanks for the report, Aron. And welcome to notmuch! + +-Carl (who wants to reply to a lot more mail, but will have to wait + until later for that) + diff --git a/test/corpus/44 b/test/corpus/44 new file mode 100644 index 00000000..c896c189 --- /dev/null +++ b/test/corpus/44 @@ -0,0 +1,29 @@ +From: "Carl Worth" +To: notmuch@notmuchmail.org +Date: Wed, 18 Nov 2009 02:43:50 -0800 +Subject: [notmuch] [PATCH] Older versions of install do not support -C. +In-Reply-To: <1258496327-12086-1-git-send-email-jan@ryngle.com> +References: <1258496327-12086-1-git-send-email-jan@ryngle.com> +Message-ID: <87hbssqfix.fsf@yoom.home.cworth.org> + +On Tue, 17 Nov 2009 23:18:47 +0100, Jan Janak wrote: +> Do not use -C cmdline option of install, older versions, commonly found in +> distributions like Debian, do not seem to support it. Running make install +> on such systems (tested on Debian Lenny) fails. +> +> Signed-off-by: Jan Janak + +Thanks, Jan. This is pushed now. + +And did I say welcome to notmuch yet? (It's easy to lose track with all +the newcomers---which I'm not complaining about---especially since so +many are sharing code.) + +-Carl + +PS. I actually really like the behavior of -C (especially when +installing a low-level library to avoid big waterfalls of needless +recompiles). But since we're *not* actually installing a library (yet) +I'm happy with this patch rather than writing code in configure to check +if "install -C" works or not. + diff --git a/test/corpus/45 b/test/corpus/45 new file mode 100644 index 00000000..806b0e89 --- /dev/null +++ b/test/corpus/45 @@ -0,0 +1,41 @@ +From: "Carl Worth" +To: notmuch@notmuchmail.org +Date: Wed, 18 Nov 2009 02:49:52 -0800 +Subject: [notmuch] What a great idea! +In-Reply-To: +References: +Message-ID: <87fx8cqf8v.fsf@yoom.home.cworth.org> + +On Tue, 17 Nov 2009 23:35:30 +0100, Jan Janak wrote: +> First of all, notmuch is a wonderful idea, both the cmdline tool and +> the emacs interface! Thanks a lot for writing it, I was really excited +> when I read the announcement today. + +Ah, here's where I planned a nice welcome. So welcome (again), Jan! :-) + +I've been having a lot of fun with notmuch already, (though there have +been some days of pain before it was functional enough and my +email-reply latency went way up). But regardless---I got through that, +and I'm able to work more efficiently with notmuch now than I could with +sup before. So I'm happy. + +And I'm delighted when other people find this interesting as well. + +> Have you considered sending an announcement to the org-mode mailing list? +> http://orgmode.org + +Thanks for the idea. I think I may have looked into org-mode years ago, +(when I was investigating planner-mode and various emacs "personal wiki" +systems for keeping random notes and what-not). + +> Various ways of searching/referencing emails from emacs were discussed +> there several times and none of them were as elegant as notmuch (not +> even close). Maybe notmuch would attract some of the developers +> there.. + +Yeah. I'll drop them a mail. Having a real emacs wizard on board would +be nice. (I'm afraid the elisp I've written so far for this project is +fairly grim.) + +-Carl + diff --git a/test/corpus/46 b/test/corpus/46 new file mode 100644 index 00000000..bbd1b37f --- /dev/null +++ b/test/corpus/46 @@ -0,0 +1,57 @@ +From: "Carl Worth" +To: notmuch@notmuchmail.org +Date: Wed, 18 Nov 2009 03:02:43 -0800 +Subject: [notmuch] New to the list +In-Reply-To: <1258498485-sup-142@elly> +References: <1258498485-sup-142@elly> +Message-ID: <87bpj0qeng.fsf@yoom.home.cworth.org> + +On Tue, 17 Nov 2009 23:57:18 +0100, Israel Herraiz wrote: +> I have subscribed to the list. As suggested by the welcome message, I +> am introducing myself. My name is Israel Herraiz, and I have done a +> couple of contributions to Sup, the probably well-known here e-mail +> client. + +Welcome, Israel! + +I'm glad people read that little bit of text in the welcome email and +are introducing themselves. I like to think of our new notmuch community +as a very personable place. + +> "Not much" sounds interesting, and I wonder whether it could be +> integrated with the views of Sup (inbox, threads, etc). So I have +> subscribed to the list to keep an eye on what's going on here. +> +> I have just heard of "Not much". I have not even tried to download the +> code yet. + +Yes, take a look. If you're already an emacs user, then you'll find the +interface of notmuch very comfortable, (looks a lot like sup, but lives +inside of emacs). Even outside of emacs, the command line interface of +notmuch gives view *fairly* similar to those of sup: + + notmuch search tag:inbox # Very much like sup's inbox + + notmuch show thread:some-thread-id # A lot like sup's thread -view + +The command-line output right now isn't nearly as neat as sup's, (it +doesn't elide comments--it doesn't do the indenting of threads, etc.), +even though the command-line interface has all the information it needs +to do that. The reason for that is to let the emacs code own most of the +formatting, (so that it can be more flexible--such as making hidden +things visible, changing column widths, etc.). + +But one thing I wonder is if there would be situations where it would +make sense to get the cleaner output directly out of the command-line +tool. + +For example, for someone who isn't an emacs user, the command-line +interface might be their only introduction to what the "notmuch +experience" is like. So maybe "notmuch show" should give nice clean +output by default and then the emacs code could call "notmuch show +--format=emacs-friendly" or something to get the current output. + +That's an idea anyway. + +-Carl + diff --git a/test/corpus/47 b/test/corpus/47 new file mode 100644 index 00000000..9de5532c --- /dev/null +++ b/test/corpus/47 @@ -0,0 +1,84 @@ +From: "Carl Worth" +To: notmuch@notmuchmail.org +Date: Wed, 18 Nov 2009 03:15:31 -0800 +Subject: [notmuch] Introducing myself +In-Reply-To: <20091118002059.067214ed@hikari> +References: <20091118002059.067214ed@hikari> +Message-ID: <87aaykqe24.fsf@yoom.home.cworth.org> + +On Wed, 18 Nov 2009 00:20:59 +0100, Adrian Perez de Castro wrote: +> I have just heard about Not Much today in some random Linux-related news +> site (LWN?), my name is Adrian Perez and I work as systems administrator + +Welcome to notmuch, Adrian! We're glad to have you here. + +> by default on most distribution. I got to have some mailboxes indexed and +> basic searching working a couple of months ago. Lately I have been very +> busy and had no time for coding, and them... boom! Not Much appears -- and +> it is almost exactly what I was trying to do, but faster. I have been +> playing a bit with Not Much today, and I think it has potential. + +It's funny, because I had the exact same experience with sup a couple of +months ago. I had been frustrated for years with email programs, and had +been thinking about how I'd like things to work n the back of my mind +for a long time, (but never *quite* getting to the point where I would +commit to writing an email system myself). + +And then... boom! I found sup and was instantly hooked. It had so much +of what I had imagined, (and much of what I hadn't yet imagined) that I +was quite delighted. + +It was really quite by accident that I ended up inventing a different +system. I had started out just trying to speedup index creation for sup. +If I hadn't run into the problem that it was very difficult[*] to create a +sup-compatible index from C code, I might have stopped there. + +So I'd written a bunch of functional code, only to find myself stuck at +the very last step, (hooking it up to the existing sup interface). Then +Keith suggested emacs and it all seemed pretty easy since I'd already +done all the Xapian work. So it's funny, I was only willing to commit to +this project because I wasn't consciously aware I was working on it. +Otherwise it would have seemed to overwhelming to start. :-) + +Anyway, that's a lot of off-topic rambling off of your introduction. But +I'm glad that notmuch can now give that same "boom!" to others, and I'm +glad you see potential in it. + +> Also, I would like to share one idea I had in mind, that you might find +> interesting: One thing I have found very annoying is having to re-tag my +> mail when the indexes get b0rked (it happened a couple of times to me while +> using Sup), so I was planning to mails as read/unread and adding the tags +> not just to the index, but to the mail text itself, e.g. by adding a +> "X-Tags" header field or by reusing the "Keywords" one. This way, the index +> could be totally recreated by re-reading the mail directories, and this +> would also allow to a tools like OfflineIMAP [1] to get the mails into a +> local maildir, tagging and indexing the mails with the e-mail reader and +> then syncing back the messages with the "X-Tags" header to the IMAP server. +> This would allow to use the mail reader from a different computer and still +> have everything tagged finely. + +It is an interesting idea. But there's also something really comforting +about the email indexed never modifying the mail files. If you're +reading the notmuch commit logs closely you'll see that I'm not actually +careful enough to be trusted with your mail (but I try). So I like that +I don't even have to trust myself---the worst that happens is that I +have to recreate my index. + +And as Keith mentioned, we've got the "notmuch dump; notmuch restore" +idea working exactly as it did in sup. (Though I am thinking of also +adding thread IDs to that now---more on that later.) + +The big annoyance I had with sup index creation, (I ended up having to +do it more than once too), was that it takes *forever*. Right now, +notmuch is a little bit faster, but not a lot faster. And I've got some +ideas to fix that. It would be really nice if index creation were pain +free. (And maybe it is for some user with small amounts of mail---oh, to +have only 40000 messages to have to index!). + +-Carl + +[*] The problem here is that sup puts serialized ruby data structures +into the data field of its Xapian documents. So being compatible with +sup means being able to recreate serialized data structures for a +particular version of ruby. + diff --git a/test/corpus/48 b/test/corpus/48 new file mode 100644 index 00000000..419e21db --- /dev/null +++ b/test/corpus/48 @@ -0,0 +1,17 @@ +From: "Carl Worth" +To: notmuch@notmuchmail.org +Date: Wed, 18 Nov 2009 03:22:32 -0800 +Subject: [notmuch] [PATCH] Typsos +In-Reply-To: <1258500222-32066-1-git-send-email-ingmar@exherbo.org> +References: <1258500222-32066-1-git-send-email-ingmar@exherbo.org> +Message-ID: <878we4qdqf.fsf@yoom.home.cworth.org> + +On Wed, 18 Nov 2009 00:23:42 +0100, Ingmar Vanhassel wrote: +> 17 files changed, 30 insertions(+), 30 deletions(-) + +Yikes. That's a lot of typos. + +Thanks Ingmar, for cleaning up after my sloppy keyboarding. Pushed. + +-Carl + diff --git a/test/corpus/49 b/test/corpus/49 new file mode 100644 index 00000000..b244f8ce --- /dev/null +++ b/test/corpus/49 @@ -0,0 +1,33 @@ +From: "Carl Worth" +To: notmuch@notmuchmail.org +Date: Wed, 18 Nov 2009 03:31:23 -0800 +Subject: [notmuch] [PATCH] Error out if no query is supplied to search + instead of going into an infinite loop +In-Reply-To: +References: +Message-ID: <877htoqdbo.fsf@yoom.home.cworth.org> + +On Tue, 17 Nov 2009 16:23:53 -0800, Alex Botero-Lowry wrote: +> In this case error out when no query is supplied. There seems to be an +> infinite-loop casued by i think notmuch_query_search_threads having +> an exception: +> A Xapian exception occurred: Syntax: AND +> A Xapian exception occurred: Syntax: AND +> A Xapian exception occurred: Syntax: AND +> +> I'll look into that bug specifically a bit later. +> +> It might be better to do a usage instead of just throwing an error here? + +Definitely. + +Priit Laes reported the same thing in IRC and I've just committed a +patch to give a nice error message: + +$ ./notmuch search +Error: notmuch search requires at least one search term. + +Thanks for the report! + +-Carl + diff --git a/test/corpus/50 b/test/corpus/50 new file mode 100644 index 00000000..44e8be5d --- /dev/null +++ b/test/corpus/50 @@ -0,0 +1,39 @@ +From: "Chris Wilson" +To: notmuch@notmuchmail.org +Date: Wed, 18 Nov 2009 11:34:54 +0000 +Subject: [notmuch] [PATCH 1/2] Makefile: evaluate pkg-config once +Message-ID: <1258544095-16616-1-git-send-email-chris@chris-wilson.co.uk> + +Currently the same `pkg-config ...` is executed for every target, so +just store the results in a variable. +--- + Makefile | 9 +++++---- + 1 files changed, 5 insertions(+), 4 deletions(-) + +diff --git a/Makefile b/Makefile +index 96aaa73..023b2ec 100644 +--- a/Makefile ++++ b/Makefile +@@ -4,15 +4,16 @@ CFLAGS=-O2 + + # Additional flags that we will append to whatever the user set. + # These aren't intended for the user to manipulate. +-extra_cflags = `pkg-config --cflags glib-2.0 gmime-2.4 talloc` +-extra_cxxflags = `xapian-config --cxxflags` ++extra_cflags := $(shell pkg-config --cflags glib-2.0 gmime-2.4 talloc) ++extra_cxxflags := $(shell xapian-config --cxxflags) + + # Now smash together user's values with our extra values + override CFLAGS += $(WARN_FLAGS) $(extra_cflags) + override CXXFLAGS += $(WARN_FLAGS) $(extra_cflags) $(extra_cxxflags) + +-override LDFLAGS += `pkg-config --libs glib-2.0 gmime-2.4 talloc` \ +- `xapian-config --libs` ++override LDFLAGS += \ ++ $(shell pkg-config --libs glib-2.0 gmime-2.4 talloc) \ ++ $(shell xapian-config --libs) + + # Include our local Makefile.local first so that its first target is default + include Makefile.local +-- +1.6.5.2 -- 2.43.0