[PATCH v2] ruby: extern linkage portability improvement

2012-06-24 Thread Tomi Ollila
Some C compilers are stricter when it comes to (tentative) definition
of a variable -- in those compilers introducing variable without 'extern'
keyword always allocates new 'storage' to the variable and linking all
these modules fails due to duplicate symbols.

This is reimplementation of Charlie Allom's patch:
id:"1336481467-66356-1-git-send-email-charlie at mediasp.com",
written originally by Ali Polatel. This version has
more accurate commit message.
---
 bindings/ruby/defs.h |   46 +++---
 bindings/ruby/init.c |   26 ++
 2 files changed, 49 insertions(+), 23 deletions(-)

diff --git a/bindings/ruby/defs.h b/bindings/ruby/defs.h
index 3f9512b..fe81b3f 100644
--- a/bindings/ruby/defs.h
+++ b/bindings/ruby/defs.h
@@ -24,31 +24,31 @@
 #include 
 #include 

-VALUE notmuch_rb_cDatabase;
-VALUE notmuch_rb_cDirectory;
-VALUE notmuch_rb_cFileNames;
-VALUE notmuch_rb_cQuery;
-VALUE notmuch_rb_cThreads;
-VALUE notmuch_rb_cThread;
-VALUE notmuch_rb_cMessages;
-VALUE notmuch_rb_cMessage;
-VALUE notmuch_rb_cTags;
-
-VALUE notmuch_rb_eBaseError;
-VALUE notmuch_rb_eDatabaseError;
-VALUE notmuch_rb_eMemoryError;
-VALUE notmuch_rb_eReadOnlyError;
-VALUE notmuch_rb_eXapianError;
-VALUE notmuch_rb_eFileError;
-VALUE notmuch_rb_eFileNotEmailError;
-VALUE notmuch_rb_eNullPointerError;
-VALUE notmuch_rb_eTagTooLongError;
-VALUE notmuch_rb_eUnbalancedFreezeThawError;
-VALUE notmuch_rb_eUnbalancedAtomicError;
-
-ID ID_call;
-ID ID_db_create;
-ID ID_db_mode;
+extern VALUE notmuch_rb_cDatabase;
+extern VALUE notmuch_rb_cDirectory;
+extern VALUE notmuch_rb_cFileNames;
+extern VALUE notmuch_rb_cQuery;
+extern VALUE notmuch_rb_cThreads;
+extern VALUE notmuch_rb_cThread;
+extern VALUE notmuch_rb_cMessages;
+extern VALUE notmuch_rb_cMessage;
+extern VALUE notmuch_rb_cTags;
+
+extern VALUE notmuch_rb_eBaseError;
+extern VALUE notmuch_rb_eDatabaseError;
+extern VALUE notmuch_rb_eMemoryError;
+extern VALUE notmuch_rb_eReadOnlyError;
+extern VALUE notmuch_rb_eXapianError;
+extern VALUE notmuch_rb_eFileError;
+extern VALUE notmuch_rb_eFileNotEmailError;
+extern VALUE notmuch_rb_eNullPointerError;
+extern VALUE notmuch_rb_eTagTooLongError;
+extern VALUE notmuch_rb_eUnbalancedFreezeThawError;
+extern VALUE notmuch_rb_eUnbalancedAtomicError;
+
+extern ID ID_call;
+extern ID ID_db_create;
+extern ID ID_db_mode;

 /* RSTRING_PTR() is new in ruby-1.9 */
 #if !defined(RSTRING_PTR)
diff --git a/bindings/ruby/init.c b/bindings/ruby/init.c
index 3fe60fb..f4931d3 100644
--- a/bindings/ruby/init.c
+++ b/bindings/ruby/init.c
@@ -20,6 +20,32 @@

 #include "defs.h"

+VALUE notmuch_rb_cDatabase;
+VALUE notmuch_rb_cDirectory;
+VALUE notmuch_rb_cFileNames;
+VALUE notmuch_rb_cQuery;
+VALUE notmuch_rb_cThreads;
+VALUE notmuch_rb_cThread;
+VALUE notmuch_rb_cMessages;
+VALUE notmuch_rb_cMessage;
+VALUE notmuch_rb_cTags;
+
+VALUE notmuch_rb_eBaseError;
+VALUE notmuch_rb_eDatabaseError;
+VALUE notmuch_rb_eMemoryError;
+VALUE notmuch_rb_eReadOnlyError;
+VALUE notmuch_rb_eXapianError;
+VALUE notmuch_rb_eFileError;
+VALUE notmuch_rb_eFileNotEmailError;
+VALUE notmuch_rb_eNullPointerError;
+VALUE notmuch_rb_eTagTooLongError;
+VALUE notmuch_rb_eUnbalancedFreezeThawError;
+VALUE notmuch_rb_eUnbalancedAtomicError;
+
+ID ID_call;
+ID ID_db_create;
+ID ID_db_mode;
+
 /*
  * Document-module: Notmuch
  *
-- 
1.7.1



[PATCH v2] emacs: add function to toggle display of all multipart/alternative parts

2012-06-24 Thread Mark Walters

On Tue, 19 Jun 2012, Jani Nikula  wrote:
> Add function notmuch-show-toggle-multipart-alternative to toggle the
> value of notmuch-show-all-multipart/alternative-parts variable in the
> buffer, and redisplay the thread with either all or preferred
> alternative parts expanded.
>
> A small wrinkle is that in order to make the variable survive
> notmuch-show-refresh-view (which is required for expanding/collapsing
> the parts, but ends up calling kill-all-local-variables through
> notmuch-show-mode) it is necessary to give it the permanent-local
> property.

Hi 

This patch looks good to me with one small concern: I set the
variable notmuch-show-all-multipart/alternative-parts in my an emacs file
loaded from my .emacs file rather than through customize using 
(setq notmuch-show-all-multipart/alternative-parts nil)

This no longer works because of the buffer local property (ie I see all
parts): I need to use 
(setq-default notmuch-show-all-multipart/alternative-parts nil)

This "change" might be worth flagging up in the news file.

I do not think the existence of my semi-patch
id:"87pq8vokmp.fsf at qmul.ac.uk" should hold up this patch. My patch is
only a draft and I definitely do not know enough lisp to be able to
write a correct version (with correct quoting of message-ids etc).

Best wishes

Mark



> ---
>  emacs/notmuch-show.el |   12 
>  1 file changed, 12 insertions(+)
>
> diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
> index 36cad93..4d3f03f 100644
> --- a/emacs/notmuch-show.el
> +++ b/emacs/notmuch-show.el
> @@ -98,6 +98,18 @@ any given message."
>"Should all parts of multipart/alternative parts be shown?"
>:type 'boolean
>:group 'notmuch-show)
> +(make-variable-buffer-local 'notmuch-show-all-multipart/alternative-parts)
> +(put 'notmuch-show-all-multipart/alternative-parts 'permanent-local t)
> +
> +(defun notmuch-show-toggle-multipart-alternative ()
> +  "Toggle the display of all multipart/alternative parts."
> +  (interactive)
> +  (setq notmuch-show-all-multipart/alternative-parts
> + (not notmuch-show-all-multipart/alternative-parts))
> +  (message (if notmuch-show-all-multipart/alternative-parts
> +"Showing all multipart/alternative parts."
> +  "Showing preferred multipart/alternative part."))
> +  (notmuch-show-refresh-view))
>  
>  (defcustom notmuch-show-indent-messages-width 1
>"Width of message indentation in threads.
> -- 
> 1.7.9.5
>
> ___
> notmuch mailing list
> notmuch at notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch


[PATCH 3/3] new: don't read unchanged directories from disk

2012-06-24 Thread Sascha Silbe
Previously, notmuch new listed all directories on disk, even if they
were unchanged from the state recorded in the database. This could take
a huge amount of time for large numbers of mails as it would list each
individual mail.

By iterating over the subdirectories recorded in the database we can
avoid accessing the file system for each unchanged directory. If the
modification time does not match we fall back to a full file system scan
so new subdirectories will get picked up and scanned recursively.

Timings for an Athlon BE-2300 with 4GiB RAM and a Samsung HD204UI hard
disk containing a mail store of around 900k mails, for the "no new mail"
case, three samples each:

Hot cache (first run discarded):
Before  After   Speedup
realmean 5.0s stdev 0.1smean 1.8s stdev 0.1s2.8
usermean 2.4s stdev 0.1smean 1.0s stdev 0.1s2.4
sys mean 2.6s stdev 0.0smean 0.9s stdev 0.0s2.9

Cold cache on each run:
Before  After   Speedup
realmean 433s stdev 1.2smean 130s stdev 0.1s3.3
usermean 6.0s stdev 0.2smean 2.5s stdev 0.0s2.4
sys mean 6.7s stdev 0.1smean 2.8s stdev 0.1s2.4

Signed-off-by: Sascha Silbe 
---
 notmuch-new.c |  130 +++--
 1 file changed, 98 insertions(+), 32 deletions(-)

diff --git a/notmuch-new.c b/notmuch-new.c
index 938ae29..93feb5c 100644
--- a/notmuch-new.c
+++ b/notmuch-new.c
@@ -225,6 +225,33 @@ _entries_resemble_maildir (const char *path, struct dirent 
**entries, int count)
 return 0;
 }

+/* Test if a directory recorded in the database looks like a Maildir directory.
+ *
+ * Search through the iterator of directory entries to see if we can find all
+ * three subdirectories typical for Maildir, that is "new", "cur", and "tmp".
+ *
+ * Return 1 if the directory looks like a Maildir and 0 otherwise.
+ */
+static int
+_subdirs_resemble_maildir (notmuch_filenames_t *db_subdirs)
+{
+int found = 0;
+
+while (notmuch_filenames_valid(db_subdirs) && found != 3)
+{
+   const char *filename = notmuch_filenames_get(db_subdirs);
+
+   if (strcmp(filename, "new") == 0 || strcmp(filename, "cur") == 0 ||
+   strcmp(filename, "tmp") == 0)
+   {
+   found++;
+   }
+   notmuch_filenames_move_to_next (db_subdirs);
+}
+
+return (found == 3) ? 1 : 0 ;
+}
+
 /* Test if the file/directory is to be ignored.
  */
 static notmuch_bool_t
@@ -243,20 +270,22 @@ _entry_in_ignore_list (const char *entry, 
add_files_state_t *state)
  *
  *   o Ask the filesystem for the mtime of 'path' (fs_mtime)
  *   o Ask the database for its timestamp of 'path' (db_mtime)
+ *   o Ask the database for directories within 'path' (db_subdirs)
  *
- *   o Ask the filesystem for files and directories within 'path'
- * (via scandir and stored in fs_entries)
+ *   o If fs_mtime is newer than db_mtime, ask the filesystem for
+ * files and directories within 'path' (via scandir and stored in
+ * fs_entries)
  *
- *   o Pass 1: For each directory in fs_entries, recursively call into
- * this same function.
+ *   o Pass 1: For each subdirectory, recursively call into this same
+ * function. If fs_mtime is newer than db_mtime, scan fs_entries
+ * for subdirectories. Otherwise use the database (db_subdirs).
  *
  *   o Compare fs_mtime to db_mtime. If they are equivalent, terminate
  * the algorithm at this point, (this directory has not been
  * updated in the filesystem since the last database scan of PASS
  * 2).
  *
- *   o Ask the database for files and directories within 'path'
- * (db_files and db_subdirs)
+ *   o Ask the database for files within 'path' (db_files)
  *
  *   o Pass 2: Walk fs_entries simultaneously with db_files and
  * db_subdirs. Look for one of three interesting cases:
@@ -321,28 +350,48 @@ add_files (notmuch_database_t *notmuch,
goto DONE;
 }
 db_mtime = directory ? notmuch_directory_get_mtime (directory) : 0;
+if (directory)
+   db_subdirs = notmuch_directory_get_child_directories (directory);

-/* If the database knows about this directory, then we sort based
- * on strcmp to match the database sorting. Otherwise, we can do
- * inode-based sorting for faster filesystem operation. */
-num_fs_entries = scandir (path, _entries, 0,
- directory ?
- dirent_sort_strcmp_name : dirent_sort_inode);
+/* If the directory's modification time in the filesystem is the
+ * same as what we recorded in the database the last time we
+ * scanned it, then we can skip reading the entries from disk.
+ *
+ * We test for strict equality here to avoid a bug that can happen
+ * if the system clock jumps backward, (preventing new mail from
+ * being discovered until the clock catches up and the directory
+ * is 

[PATCH 2/3] lib: add support for rewinding a filenames iterator

2012-06-24 Thread Sascha Silbe
This allows the same iterator to be traversed multiple times, instead of
destroying and reconstructing it.

Signed-off-by: Sascha Silbe 
---
 lib/filenames.c |   11 +++
 lib/notmuch.h   |8 
 2 files changed, 19 insertions(+)

diff --git a/lib/filenames.c b/lib/filenames.c
index 4f7c0d8..62ccb39 100644
--- a/lib/filenames.c
+++ b/lib/filenames.c
@@ -21,6 +21,7 @@
 #include "notmuch-private.h"

 struct _notmuch_filenames {
+notmuch_string_node_t *first;
 notmuch_string_node_t *iterator;
 };

@@ -36,6 +37,7 @@ _notmuch_filenames_create (const void *ctx,
 if (unlikely (filenames == NULL))
return NULL;

+filenames->first = list->head;
 filenames->iterator = list->head;
 (void) talloc_reference (filenames, list);

@@ -70,6 +72,15 @@ notmuch_filenames_move_to_next (notmuch_filenames_t 
*filenames)
 }

 void
+notmuch_filenames_rewind (notmuch_filenames_t *filenames)
+{
+if (filenames == NULL)
+   return;
+
+filenames->iterator = filenames->first;
+}
+
+void
 notmuch_filenames_destroy (notmuch_filenames_t *filenames)
 {
 talloc_free (filenames);
diff --git a/lib/notmuch.h b/lib/notmuch.h
index 3633bed..e99e2a3 100644
--- a/lib/notmuch.h
+++ b/lib/notmuch.h
@@ -1382,6 +1382,14 @@ notmuch_filenames_get (notmuch_filenames_t *filenames);
 void
 notmuch_filenames_move_to_next (notmuch_filenames_t *filenames);

+/* Move the 'filenames' iterator back to the first filename.
+ *
+ * It is acceptable to pass NULL for 'filenames', in which case this
+ * function will do nothing.
+ */
+void
+notmuch_filenames_rewind (notmuch_filenames_t *filenames);
+
 /* Destroy a notmuch_filenames_t object.
  *
  * It's not strictly necessary to call this function. All memory from
-- 
1.7.10



[Patch v8 0/6] Allow JSON to use non-entire thread, and use for elide

2012-06-24 Thread David Bremner
Mark Walters  writes:

> This is version 8 of this patch series: the previous version is at
> id:"1338723972-13063-1-git-send-email-markwalters1009 at gmail.com". The
> only change in this version is a rebase so that it applies to master.
>
> I think this version addresses all comments made in reviews.

I have tentatively marked this series as ready to push in nmbug. I'll
leave it in the ready queue for at least a few days.

d


[PATCH 3/3] test: add test for showing Reply-To headers

2012-06-24 Thread Peter Wang
Test that show --format=text and --format=json now output
Reply-To headers when present.
---
 test/json |4 ++--
 test/text |3 ++-
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/test/json b/test/json
index 6439788..0a692ac 100755
--- a/test/json
+++ b/test/json
@@ -3,9 +3,9 @@ test_description="--format=json output"
 . ./test-lib.sh

 test_begin_subtest "Show message: json"
-add_message "[subject]=\"json-show-subject\"" "[date]=\"Sat, 01 Jan 2000 
12:00:00 -\"" "[body]=\"json-show-message\""
+add_message "[subject]=\"json-show-subject\"" "[date]=\"Sat, 01 Jan 2000 
12:00:00 -\"" "[body]=\"json-show-message\"" 
"[reply-to]=\"json-show-reply-to\""
 output=$(notmuch show --format=json "json-show-message")
-test_expect_equal "$output" "[[[{\"id\": \"${gen_msg_id}\", \"match\": true, 
\"excluded\": false, \"filename\": \"${gen_msg_filename}\", \"timestamp\": 
946728000, \"date_relative\": \"2000-01-01\", \"tags\": [\"inbox\",\"unread\"], 
\"headers\": {\"Subject\": \"json-show-subject\", \"From\": \"Notmuch Test 
Suite \", \"To\": \"Notmuch Test Suite 
\", \"Date\": \"Sat, 01 Jan 2000 12:00:00 
+\"}, \"body\": [{\"id\": 1, \"content-type\": \"text/plain\", \"content\": 
\"json-show-message\n\"}]}, ["
+test_expect_equal "$output" "[[[{\"id\": \"${gen_msg_id}\", \"match\": true, 
\"excluded\": false, \"filename\": \"${gen_msg_filename}\", \"timestamp\": 
946728000, \"date_relative\": \"2000-01-01\", \"tags\": [\"inbox\",\"unread\"], 
\"headers\": {\"Subject\": \"json-show-subject\", \"From\": \"Notmuch Test 
Suite \", \"To\": \"Notmuch Test Suite 
\", \"Reply-To\": \"json-show-reply-to\", 
\"Date\": \"Sat, 01 Jan 2000 12:00:00 +\"}, \"body\": [{\"id\": 1, 
\"content-type\": \"text/plain\", \"content\": \"json-show-message\n\"}]}, 
["

 test_begin_subtest "Search message: json"
 add_message "[subject]=\"json-search-subject\"" "[date]=\"Sat, 01 Jan 2000 
12:00:00 -\"" "[body]=\"json-search-message\""
diff --git a/test/text b/test/text
index 428c89b..bf1dfd1 100755
--- a/test/text
+++ b/test/text
@@ -3,7 +3,7 @@ test_description="--format=text output"
 . ./test-lib.sh

 test_begin_subtest "Show message: text"
-add_message "[subject]=\"text-show-subject\"" "[date]=\"Sat, 01 Jan 2000 
12:00:00 -\"" "[body]=\"text-show-message\""
+add_message "[subject]=\"text-show-subject\"" "[date]=\"Sat, 01 Jan 2000 
12:00:00 -\"" "[body]=\"text-show-message\"" 
"[reply-to]=\"text-show-reply-to\""
 output=$(notmuch show --format=text "text-show-message" | 
notmuch_show_sanitize_all)
 test_expect_equal "$output" "\
 message{ id:X depth:0 match:1 excluded:0 filename:X
@@ -12,6 +12,7 @@ Notmuch Test Suite  
(2000-01-01) (inbox unread)
 Subject: text-show-subject
 From: Notmuch Test Suite 
 To: Notmuch Test Suite 
+Reply-To: text-show-reply-to
 Date: Sat, 01 Jan 2000 12:00:00 +
 header}
 body{
-- 
1.7.4.4



[PATCH 2/3] show: output Reply-To headers

2012-06-24 Thread Peter Wang
Output Reply-To headers when present in a message.
These were missing in text and json output formats.
---
 notmuch-show.c |   10 ++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/notmuch-show.c b/notmuch-show.c
index 8247f1d..de63f06 100644
--- a/notmuch-show.c
+++ b/notmuch-show.c
@@ -198,6 +198,7 @@ format_headers_json (const void *ctx, GMimeMessage 
*message, notmuch_bool_t repl
 void *local = talloc_new (ctx);
 InternetAddressList *recipients;
 const char *recipients_string;
+const char *reply_to_string;

 printf ("{%s: %s",
json_quote_str (local, "Subject"),
@@ -217,6 +218,11 @@ format_headers_json (const void *ctx, GMimeMessage 
*message, notmuch_bool_t repl
printf (", %s: %s",
json_quote_str (local, "Cc"),
json_quote_str (local, recipients_string));
+reply_to_string = g_mime_message_get_reply_to (message);
+if (reply_to_string)
+   printf (", %s: %s",
+   json_quote_str (local, "Reply-To"),
+   json_quote_str (local, reply_to_string));

 if (reply) {
printf (", %s: %s",
@@ -512,6 +518,7 @@ format_part_text (const void *ctx, mime_node_t *node,
GMimeMessage *message = GMIME_MESSAGE (node->part);
InternetAddressList *recipients;
const char *recipients_string;
+   const char *reply_to_string;

printf ("\fheader{\n");
if (node->envelope_file)
@@ -526,6 +533,9 @@ format_part_text (const void *ctx, mime_node_t *node,
recipients_string = internet_address_list_to_string (recipients, 0);
if (recipients_string)
printf ("Cc: %s\n", recipients_string);
+   reply_to_string = g_mime_message_get_reply_to (message);
+   if (reply_to_string)
+   printf ("Reply-To: %s\n", reply_to_string);
printf ("Date: %s\n", g_mime_message_get_date_as_string (message));
printf ("\fheader}\n");

-- 
1.7.4.4



[PATCH 1/3] test: add basic show, search --format=text tests

2012-06-24 Thread Peter Wang
There didn't seem to be these basic tests for --format=text,
as there are for --format=json.  These are just the tests from
the `json' script, with adjusted expected outputs.
---
 test/notmuch-test |1 +
 test/text |   55 +
 2 files changed, 56 insertions(+), 0 deletions(-)
 create mode 100755 test/text

diff --git a/test/notmuch-test b/test/notmuch-test
index bfad5d3..ea39dfc 100755
--- a/test/notmuch-test
+++ b/test/notmuch-test
@@ -31,6 +31,7 @@ TESTS="
   excludes
   tagging
   json
+  text
   multipart
   thread-naming
   raw
diff --git a/test/text b/test/text
new file mode 100755
index 000..428c89b
--- /dev/null
+++ b/test/text
@@ -0,0 +1,55 @@
+#!/usr/bin/env bash
+test_description="--format=text output"
+. ./test-lib.sh
+
+test_begin_subtest "Show message: text"
+add_message "[subject]=\"text-show-subject\"" "[date]=\"Sat, 01 Jan 2000 
12:00:00 -\"" "[body]=\"text-show-message\""
+output=$(notmuch show --format=text "text-show-message" | 
notmuch_show_sanitize_all)
+test_expect_equal "$output" "\
+message{ id:X depth:0 match:1 excluded:0 filename:X
+header{
+Notmuch Test Suite  (2000-01-01) (inbox unread)
+Subject: text-show-subject
+From: Notmuch Test Suite 
+To: Notmuch Test Suite 
+Date: Sat, 01 Jan 2000 12:00:00 +
+header}
+body{
+part{ ID: 1, Content-type: text/plain
+text-show-message
+part}
+body}
+message}"
+
+test_begin_subtest "Search message: text"
+add_message "[subject]=\"text-search-subject\"" "[date]=\"Sat, 01 Jan 2000 
12:00:00 -\"" "[body]=\"text-search-message\""
+output=$(notmuch search --format=text "text-search-message" | 
notmuch_search_sanitize)
+test_expect_equal "$output" \
+"thread:XXX   2000-01-01 [1/1] Notmuch Test Suite; text-search-subject (inbox 
unread)"
+
+test_begin_subtest "Show message: text, utf-8"
+add_message "[subject]=\"text-show-utf8-body-s?bj?ct\"" "[date]=\"Sat, 01 Jan 
2000 12:00:00 -\"" "[body]=\"t?xt-show-m?ssage\""
+output=$(notmuch show --format=text "t?xt-show-m?ssage" | 
notmuch_show_sanitize_all)
+test_expect_equal "$output" "\
+message{ id:X depth:0 match:1 excluded:0 filename:X
+header{
+Notmuch Test Suite  (2000-01-01) (inbox unread)
+Subject: text-show-utf8-body-s?bj?ct
+From: Notmuch Test Suite 
+To: Notmuch Test Suite 
+Date: Sat, 01 Jan 2000 12:00:00 +
+header}
+body{
+part{ ID: 1, Content-type: text/plain
+t?xt-show-m?ssage
+part}
+body}
+message}"
+
+test_begin_subtest "Search message: text, utf-8"
+add_message "[subject]=\"text-search-utf8-body-s?bj?ct\"" "[date]=\"Sat, 01 
Jan 2000 12:00:00 -\"" "[body]=\"t?xt-search-m?ssage\""
+output=$(notmuch search --format=text "t?xt-search-m?ssage" | 
notmuch_search_sanitize)
+test_expect_equal "$output" \
+"thread:XXX   2000-01-01 [1/1] Notmuch Test Suite; 
text-search-utf8-body-s?bj?ct (inbox unread)"
+
+test_done
-- 
1.7.4.4



[PATCH] ruby: extern linkage portability improvement

2012-06-24 Thread David Bremner
Tomi Ollila  writes:

>
> (Hmm, I hope no-one got confused that the trick was mine and not yours :)
>
> So, the patch you provided in github would be good...
>
> Tomi
>

Hi Gang;

This ruby portability patch seems to have stalled. What is the current
proposal?

d


Re: [PATCH v2] emacs: add function to toggle display of all multipart/alternative parts

2012-06-24 Thread Jani Nikula
On Jun 23, 2012 1:34 AM, David Bremner da...@tethera.net wrote:

 Jani Nikula j...@nikula.org writes:

 
  A small wrinkle is that in order to make the variable survive
  notmuch-show-refresh-view (which is required for expanding/collapsing
  the parts, but ends up calling kill-all-local-variables through
  notmuch-show-mode) it is necessary to give it the permanent-local
  property.

 The code looks simple enough; should we apply this patch while we wait
 for something fancier?

Applying this doesn't make the fancy stuff harder to do at all. And this
doesn't have a key binding, on purpose, so we're not committed to that
either. But then I'm biased...

 I don't really know how to evaluate the
 permanent-local bit.

All the other show mode toggles use that too. It's probably less surprising
like this than the permanently local only as needed approach in v1.


 d
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH] ruby: extern linkage portability improvement

2012-06-24 Thread David Bremner
Tomi Ollila tomi.oll...@iki.fi writes:


 (Hmm, I hope no-one got confused that the trick was mine and not yours :)

 So, the patch you provided in github would be good...

 Tomi


Hi Gang;

This ruby portability patch seems to have stalled. What is the current
proposal?

d
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


[PATCH 0/3] Speed up notmuch new for unchanged directories

2012-06-24 Thread Sascha Silbe
All the time I thought what makes notmuch new so abysmally slow is the
stat() for each maildir. But as it continued to be slow even after I
moved most mails out of 'new' (into 'new-20120624'), I strace'd notmuch
and noticed it listed even unchanged directories, thereby listing and
iterating over each and every single of the 900k mails in my mail store.

There's still quite some room for further improvements as it continues
to take several minutes to scan  100 new mails in changed directories
containing  1000 mails in total. Even the rsync run that fetches the
new mails is faster.

Sascha Silbe (3):
  lib: fix NULL checks for filenames iterators
  lib: add support for rewinding a filenames iterator
  new: don't read unchanged directories from disk

 lib/filenames.c |   15 ++-
 lib/notmuch.h   |8 
 notmuch-new.c   |  130 +--
 3 files changed, 119 insertions(+), 34 deletions(-)

-- 
1.7.10

___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


[PATCH 3/3] new: don't read unchanged directories from disk

2012-06-24 Thread Sascha Silbe
Previously, notmuch new listed all directories on disk, even if they
were unchanged from the state recorded in the database. This could take
a huge amount of time for large numbers of mails as it would list each
individual mail.

By iterating over the subdirectories recorded in the database we can
avoid accessing the file system for each unchanged directory. If the
modification time does not match we fall back to a full file system scan
so new subdirectories will get picked up and scanned recursively.

Timings for an Athlon BE-2300 with 4GiB RAM and a Samsung HD204UI hard
disk containing a mail store of around 900k mails, for the no new mail
case, three samples each:

Hot cache (first run discarded):
Before  After   Speedup
realmean 5.0s stdev 0.1smean 1.8s stdev 0.1s2.8
usermean 2.4s stdev 0.1smean 1.0s stdev 0.1s2.4
sys mean 2.6s stdev 0.0smean 0.9s stdev 0.0s2.9

Cold cache on each run:
Before  After   Speedup
realmean 433s stdev 1.2smean 130s stdev 0.1s3.3
usermean 6.0s stdev 0.2smean 2.5s stdev 0.0s2.4
sys mean 6.7s stdev 0.1smean 2.8s stdev 0.1s2.4

Signed-off-by: Sascha Silbe sascha-...@silbe.org
---
 notmuch-new.c |  130 +++--
 1 file changed, 98 insertions(+), 32 deletions(-)

diff --git a/notmuch-new.c b/notmuch-new.c
index 938ae29..93feb5c 100644
--- a/notmuch-new.c
+++ b/notmuch-new.c
@@ -225,6 +225,33 @@ _entries_resemble_maildir (const char *path, struct dirent 
**entries, int count)
 return 0;
 }
 
+/* Test if a directory recorded in the database looks like a Maildir directory.
+ *
+ * Search through the iterator of directory entries to see if we can find all
+ * three subdirectories typical for Maildir, that is new, cur, and tmp.
+ *
+ * Return 1 if the directory looks like a Maildir and 0 otherwise.
+ */
+static int
+_subdirs_resemble_maildir (notmuch_filenames_t *db_subdirs)
+{
+int found = 0;
+
+while (notmuch_filenames_valid(db_subdirs)  found != 3)
+{
+   const char *filename = notmuch_filenames_get(db_subdirs);
+
+   if (strcmp(filename, new) == 0 || strcmp(filename, cur) == 0 ||
+   strcmp(filename, tmp) == 0)
+   {
+   found++;
+   }
+   notmuch_filenames_move_to_next (db_subdirs);
+}
+
+return (found == 3) ? 1 : 0 ;
+}
+
 /* Test if the file/directory is to be ignored.
  */
 static notmuch_bool_t
@@ -243,20 +270,22 @@ _entry_in_ignore_list (const char *entry, 
add_files_state_t *state)
  *
  *   o Ask the filesystem for the mtime of 'path' (fs_mtime)
  *   o Ask the database for its timestamp of 'path' (db_mtime)
+ *   o Ask the database for directories within 'path' (db_subdirs)
  *
- *   o Ask the filesystem for files and directories within 'path'
- * (via scandir and stored in fs_entries)
+ *   o If fs_mtime is newer than db_mtime, ask the filesystem for
+ * files and directories within 'path' (via scandir and stored in
+ * fs_entries)
  *
- *   o Pass 1: For each directory in fs_entries, recursively call into
- * this same function.
+ *   o Pass 1: For each subdirectory, recursively call into this same
+ * function. If fs_mtime is newer than db_mtime, scan fs_entries
+ * for subdirectories. Otherwise use the database (db_subdirs).
  *
  *   o Compare fs_mtime to db_mtime. If they are equivalent, terminate
  * the algorithm at this point, (this directory has not been
  * updated in the filesystem since the last database scan of PASS
  * 2).
  *
- *   o Ask the database for files and directories within 'path'
- * (db_files and db_subdirs)
+ *   o Ask the database for files within 'path' (db_files)
  *
  *   o Pass 2: Walk fs_entries simultaneously with db_files and
  * db_subdirs. Look for one of three interesting cases:
@@ -321,28 +350,48 @@ add_files (notmuch_database_t *notmuch,
goto DONE;
 }
 db_mtime = directory ? notmuch_directory_get_mtime (directory) : 0;
+if (directory)
+   db_subdirs = notmuch_directory_get_child_directories (directory);
 
-/* If the database knows about this directory, then we sort based
- * on strcmp to match the database sorting. Otherwise, we can do
- * inode-based sorting for faster filesystem operation. */
-num_fs_entries = scandir (path, fs_entries, 0,
- directory ?
- dirent_sort_strcmp_name : dirent_sort_inode);
+/* If the directory's modification time in the filesystem is the
+ * same as what we recorded in the database the last time we
+ * scanned it, then we can skip reading the entries from disk.
+ *
+ * We test for strict equality here to avoid a bug that can happen
+ * if the system clock jumps backward, (preventing new mail from
+ * being discovered until the clock catches up and the directory
+

[PATCH 2/3] lib: add support for rewinding a filenames iterator

2012-06-24 Thread Sascha Silbe
This allows the same iterator to be traversed multiple times, instead of
destroying and reconstructing it.

Signed-off-by: Sascha Silbe sascha-...@silbe.org
---
 lib/filenames.c |   11 +++
 lib/notmuch.h   |8 
 2 files changed, 19 insertions(+)

diff --git a/lib/filenames.c b/lib/filenames.c
index 4f7c0d8..62ccb39 100644
--- a/lib/filenames.c
+++ b/lib/filenames.c
@@ -21,6 +21,7 @@
 #include notmuch-private.h
 
 struct _notmuch_filenames {
+notmuch_string_node_t *first;
 notmuch_string_node_t *iterator;
 };
 
@@ -36,6 +37,7 @@ _notmuch_filenames_create (const void *ctx,
 if (unlikely (filenames == NULL))
return NULL;
 
+filenames-first = list-head;
 filenames-iterator = list-head;
 (void) talloc_reference (filenames, list);
 
@@ -70,6 +72,15 @@ notmuch_filenames_move_to_next (notmuch_filenames_t 
*filenames)
 }
 
 void
+notmuch_filenames_rewind (notmuch_filenames_t *filenames)
+{
+if (filenames == NULL)
+   return;
+
+filenames-iterator = filenames-first;
+}
+
+void
 notmuch_filenames_destroy (notmuch_filenames_t *filenames)
 {
 talloc_free (filenames);
diff --git a/lib/notmuch.h b/lib/notmuch.h
index 3633bed..e99e2a3 100644
--- a/lib/notmuch.h
+++ b/lib/notmuch.h
@@ -1382,6 +1382,14 @@ notmuch_filenames_get (notmuch_filenames_t *filenames);
 void
 notmuch_filenames_move_to_next (notmuch_filenames_t *filenames);
 
+/* Move the 'filenames' iterator back to the first filename.
+ *
+ * It is acceptable to pass NULL for 'filenames', in which case this
+ * function will do nothing.
+ */
+void
+notmuch_filenames_rewind (notmuch_filenames_t *filenames);
+
 /* Destroy a notmuch_filenames_t object.
  *
  * It's not strictly necessary to call this function. All memory from
-- 
1.7.10

___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


[PATCH 1/3] lib: fix NULL checks for filenames iterators

2012-06-24 Thread Sascha Silbe
The API documentation (notmuch.h) states that the parameter may be NULL,
but the implementation only checked the current element, potentially
dereferencing a NULL pointer in the process.

Signed-off-by: Sascha Silbe sascha-...@silbe.org
---
 lib/filenames.c |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/filenames.c b/lib/filenames.c
index f1ea243..4f7c0d8 100644
--- a/lib/filenames.c
+++ b/lib/filenames.c
@@ -54,7 +54,7 @@ notmuch_filenames_valid (notmuch_filenames_t *filenames)
 const char *
 notmuch_filenames_get (notmuch_filenames_t *filenames)
 {
-if (filenames-iterator == NULL)
+if ((filenames == NULL) || (filenames-iterator == NULL))
return NULL;
 
 return filenames-iterator-string;
@@ -63,7 +63,7 @@ notmuch_filenames_get (notmuch_filenames_t *filenames)
 void
 notmuch_filenames_move_to_next (notmuch_filenames_t *filenames)
 {
-if (filenames-iterator == NULL)
+if ((filenames == NULL) || (filenames-iterator == NULL))
return;
 
 filenames-iterator = filenames-iterator-next;
-- 
1.7.10

___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: [Patch v8 0/6] Allow JSON to use non-entire thread, and use for elide

2012-06-24 Thread David Bremner
Mark Walters markwalters1...@gmail.com writes:

 This is version 8 of this patch series: the previous version is at
 id:1338723972-13063-1-git-send-email-markwalters1...@gmail.com. The
 only change in this version is a rebase so that it applies to master.

 I think this version addresses all comments made in reviews.

I have tentatively marked this series as ready to push in nmbug. I'll
leave it in the ready queue for at least a few days.

d
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


[PATCH v2] ruby: extern linkage portability improvement

2012-06-24 Thread Tomi Ollila
Some C compilers are stricter when it comes to (tentative) definition
of a variable -- in those compilers introducing variable without 'extern'
keyword always allocates new 'storage' to the variable and linking all
these modules fails due to duplicate symbols.

This is reimplementation of Charlie Allom's patch:
id:1336481467-66356-1-git-send-email-char...@mediasp.com,
written originally by Ali Polatel. This version has
more accurate commit message.
---
 bindings/ruby/defs.h |   46 +++---
 bindings/ruby/init.c |   26 ++
 2 files changed, 49 insertions(+), 23 deletions(-)

diff --git a/bindings/ruby/defs.h b/bindings/ruby/defs.h
index 3f9512b..fe81b3f 100644
--- a/bindings/ruby/defs.h
+++ b/bindings/ruby/defs.h
@@ -24,31 +24,31 @@
 #include notmuch.h
 #include ruby.h
 
-VALUE notmuch_rb_cDatabase;
-VALUE notmuch_rb_cDirectory;
-VALUE notmuch_rb_cFileNames;
-VALUE notmuch_rb_cQuery;
-VALUE notmuch_rb_cThreads;
-VALUE notmuch_rb_cThread;
-VALUE notmuch_rb_cMessages;
-VALUE notmuch_rb_cMessage;
-VALUE notmuch_rb_cTags;
-
-VALUE notmuch_rb_eBaseError;
-VALUE notmuch_rb_eDatabaseError;
-VALUE notmuch_rb_eMemoryError;
-VALUE notmuch_rb_eReadOnlyError;
-VALUE notmuch_rb_eXapianError;
-VALUE notmuch_rb_eFileError;
-VALUE notmuch_rb_eFileNotEmailError;
-VALUE notmuch_rb_eNullPointerError;
-VALUE notmuch_rb_eTagTooLongError;
-VALUE notmuch_rb_eUnbalancedFreezeThawError;
-VALUE notmuch_rb_eUnbalancedAtomicError;
-
-ID ID_call;
-ID ID_db_create;
-ID ID_db_mode;
+extern VALUE notmuch_rb_cDatabase;
+extern VALUE notmuch_rb_cDirectory;
+extern VALUE notmuch_rb_cFileNames;
+extern VALUE notmuch_rb_cQuery;
+extern VALUE notmuch_rb_cThreads;
+extern VALUE notmuch_rb_cThread;
+extern VALUE notmuch_rb_cMessages;
+extern VALUE notmuch_rb_cMessage;
+extern VALUE notmuch_rb_cTags;
+
+extern VALUE notmuch_rb_eBaseError;
+extern VALUE notmuch_rb_eDatabaseError;
+extern VALUE notmuch_rb_eMemoryError;
+extern VALUE notmuch_rb_eReadOnlyError;
+extern VALUE notmuch_rb_eXapianError;
+extern VALUE notmuch_rb_eFileError;
+extern VALUE notmuch_rb_eFileNotEmailError;
+extern VALUE notmuch_rb_eNullPointerError;
+extern VALUE notmuch_rb_eTagTooLongError;
+extern VALUE notmuch_rb_eUnbalancedFreezeThawError;
+extern VALUE notmuch_rb_eUnbalancedAtomicError;
+
+extern ID ID_call;
+extern ID ID_db_create;
+extern ID ID_db_mode;
 
 /* RSTRING_PTR() is new in ruby-1.9 */
 #if !defined(RSTRING_PTR)
diff --git a/bindings/ruby/init.c b/bindings/ruby/init.c
index 3fe60fb..f4931d3 100644
--- a/bindings/ruby/init.c
+++ b/bindings/ruby/init.c
@@ -20,6 +20,32 @@
 
 #include defs.h
 
+VALUE notmuch_rb_cDatabase;
+VALUE notmuch_rb_cDirectory;
+VALUE notmuch_rb_cFileNames;
+VALUE notmuch_rb_cQuery;
+VALUE notmuch_rb_cThreads;
+VALUE notmuch_rb_cThread;
+VALUE notmuch_rb_cMessages;
+VALUE notmuch_rb_cMessage;
+VALUE notmuch_rb_cTags;
+
+VALUE notmuch_rb_eBaseError;
+VALUE notmuch_rb_eDatabaseError;
+VALUE notmuch_rb_eMemoryError;
+VALUE notmuch_rb_eReadOnlyError;
+VALUE notmuch_rb_eXapianError;
+VALUE notmuch_rb_eFileError;
+VALUE notmuch_rb_eFileNotEmailError;
+VALUE notmuch_rb_eNullPointerError;
+VALUE notmuch_rb_eTagTooLongError;
+VALUE notmuch_rb_eUnbalancedFreezeThawError;
+VALUE notmuch_rb_eUnbalancedAtomicError;
+
+ID ID_call;
+ID ID_db_create;
+ID ID_db_mode;
+
 /*
  * Document-module: Notmuch
  *
-- 
1.7.1

___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH v2] emacs: add function to toggle display of all multipart/alternative parts

2012-06-24 Thread Mark Walters

On Tue, 19 Jun 2012, Jani Nikula j...@nikula.org wrote:
 Add function notmuch-show-toggle-multipart-alternative to toggle the
 value of notmuch-show-all-multipart/alternative-parts variable in the
 buffer, and redisplay the thread with either all or preferred
 alternative parts expanded.

 A small wrinkle is that in order to make the variable survive
 notmuch-show-refresh-view (which is required for expanding/collapsing
 the parts, but ends up calling kill-all-local-variables through
 notmuch-show-mode) it is necessary to give it the permanent-local
 property.

Hi 

This patch looks good to me with one small concern: I set the
variable notmuch-show-all-multipart/alternative-parts in my an emacs file
loaded from my .emacs file rather than through customize using 
(setq notmuch-show-all-multipart/alternative-parts nil)

This no longer works because of the buffer local property (ie I see all
parts): I need to use 
(setq-default notmuch-show-all-multipart/alternative-parts nil)

This change might be worth flagging up in the news file.

I do not think the existence of my semi-patch
id:87pq8vokmp@qmul.ac.uk should hold up this patch. My patch is
only a draft and I definitely do not know enough lisp to be able to
write a correct version (with correct quoting of message-ids etc).

Best wishes

Mark



 ---
  emacs/notmuch-show.el |   12 
  1 file changed, 12 insertions(+)

 diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
 index 36cad93..4d3f03f 100644
 --- a/emacs/notmuch-show.el
 +++ b/emacs/notmuch-show.el
 @@ -98,6 +98,18 @@ any given message.
Should all parts of multipart/alternative parts be shown?
:type 'boolean
:group 'notmuch-show)
 +(make-variable-buffer-local 'notmuch-show-all-multipart/alternative-parts)
 +(put 'notmuch-show-all-multipart/alternative-parts 'permanent-local t)
 +
 +(defun notmuch-show-toggle-multipart-alternative ()
 +  Toggle the display of all multipart/alternative parts.
 +  (interactive)
 +  (setq notmuch-show-all-multipart/alternative-parts
 + (not notmuch-show-all-multipart/alternative-parts))
 +  (message (if notmuch-show-all-multipart/alternative-parts
 +Showing all multipart/alternative parts.
 +  Showing preferred multipart/alternative part.))
 +  (notmuch-show-refresh-view))
  
  (defcustom notmuch-show-indent-messages-width 1
Width of message indentation in threads.
 -- 
 1.7.9.5

 ___
 notmuch mailing list
 notmuch@notmuchmail.org
 http://notmuchmail.org/mailman/listinfo/notmuch
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


[PATCH] manpages: consistent format for NAME section

2012-06-24 Thread Tomi Ollila
The NAME section in manpages generally doesn't start with capital
letter (unless the word is 'proper noun') and doesn't end with
period. Notmuch manual pages now matches that format.
---

See http://notmuchmail.org/manpages/ for reference.


 man/man1/notmuch-config.1   |2 +-
 man/man1/notmuch-count.1|2 +-
 man/man1/notmuch-dump.1 |2 +-
 man/man1/notmuch-new.1  |2 +-
 man/man1/notmuch-reply.1|2 +-
 man/man1/notmuch-restore.1  |2 +-
 man/man1/notmuch-search.1   |2 +-
 man/man1/notmuch-show.1 |2 +-
 man/man1/notmuch-tag.1  |2 +-
 man/man7/notmuch-search-terms.7 |2 +-
 10 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/man/man1/notmuch-config.1 b/man/man1/notmuch-config.1
index 4f7985c..2ee555d 100644
--- a/man/man1/notmuch-config.1
+++ b/man/man1/notmuch-config.1
@@ -1,6 +1,6 @@
 .TH NOTMUCH-CONFIG 1 2012-06-01 Notmuch 0.13.2
 .SH NAME
-notmuch-config \- Access notmuch configuration file.
+notmuch-config \- access notmuch configuration file
 .SH SYNOPSIS
 
 .B notmuch config get
diff --git a/man/man1/notmuch-count.1 b/man/man1/notmuch-count.1
index 8029174..8551ab2 100644
--- a/man/man1/notmuch-count.1
+++ b/man/man1/notmuch-count.1
@@ -1,6 +1,6 @@
 .TH NOTMUCH-COUNT 1 2012-06-01 Notmuch 0.13.2
 .SH NAME
-notmuch-count \- Count messages matching the given search terms.
+notmuch-count \- count messages matching the given search terms
 .SH SYNOPSIS
 
 .B notmuch count
diff --git a/man/man1/notmuch-dump.1 b/man/man1/notmuch-dump.1
index 9c7dd84..64abf01 100644
--- a/man/man1/notmuch-dump.1
+++ b/man/man1/notmuch-dump.1
@@ -1,6 +1,6 @@
 .TH NOTMUCH-DUMP 1 2012-06-01 Notmuch 0.13.2
 .SH NAME
-notmuch-dump \- Creates a plain-text dump of the tags of each message.
+notmuch-dump \- creates a plain-text dump of the tags of each message
 
 .SH SYNOPSIS
 
diff --git a/man/man1/notmuch-new.1 b/man/man1/notmuch-new.1
index cd83a88..e01f2eb 100644
--- a/man/man1/notmuch-new.1
+++ b/man/man1/notmuch-new.1
@@ -1,6 +1,6 @@
 .TH NOTMUCH-NEW 1 2012-06-01 Notmuch 0.13.2
 .SH NAME
-notmuch-new \- Incorporate new mail into the notmuch database.
+notmuch-new \- incorporate new mail into the notmuch database
 .SH SYNOPSIS
 
 .B notmuch new
diff --git a/man/man1/notmuch-reply.1 b/man/man1/notmuch-reply.1
index fb5114c..5aa86c0 100644
--- a/man/man1/notmuch-reply.1
+++ b/man/man1/notmuch-reply.1
@@ -1,6 +1,6 @@
 .TH NOTMUCH-REPLY 1 2012-06-01 Notmuch 0.13.2
 .SH NAME
-notmuch-reply \- Constructs a reply template for a set of messages.
+notmuch-reply \- constructs a reply template for a set of messages
 
 .SH SYNOPSIS
 
diff --git a/man/man1/notmuch-restore.1 b/man/man1/notmuch-restore.1
index 3156af7..18281c7 100644
--- a/man/man1/notmuch-restore.1
+++ b/man/man1/notmuch-restore.1
@@ -1,6 +1,6 @@
 .TH NOTMUCH-RESTORE 1 2012-06-01 Notmuch 0.13.2
 .SH NAME
-notmuch-restore \- Restores the tags from the given file (see notmuch dump).
+notmuch-restore \- restores the tags from the given file (see notmuch dump)
 
 .SH SYNOPSIS
 
diff --git a/man/man1/notmuch-search.1 b/man/man1/notmuch-search.1
index 5c72c4b..b42eb2c 100644
--- a/man/man1/notmuch-search.1
+++ b/man/man1/notmuch-search.1
@@ -1,6 +1,6 @@
 .TH NOTMUCH-SEARCH 1 2012-06-01 Notmuch 0.13.2
 .SH NAME
-notmuch-search \- Search for messages matching the given search terms.
+notmuch-search \- search for messages matching the given search terms
 .SH SYNOPSIS
 
 .B notmuch search
diff --git a/man/man1/notmuch-show.1 b/man/man1/notmuch-show.1
index 4aab17c..b51a54c 100644
--- a/man/man1/notmuch-show.1
+++ b/man/man1/notmuch-show.1
@@ -1,6 +1,6 @@
 .TH NOTMUCH-SHOW 1 2012-06-01 Notmuch 0.13.2
 .SH NAME
-notmuch-show \- Show messages matching the given search terms.
+notmuch-show \- show messages matching the given search terms
 .SH SYNOPSIS
 
 .B notmuch show
diff --git a/man/man1/notmuch-tag.1 b/man/man1/notmuch-tag.1
index 27e682e..d810e1b 100644
--- a/man/man1/notmuch-tag.1
+++ b/man/man1/notmuch-tag.1
@@ -1,6 +1,6 @@
 .TH NOTMUCH-TAG 1 2012-06-01 Notmuch 0.13.2
 .SH NAME
-notmuch-tag \- Add/remove tags for all messages matching the search terms.
+notmuch-tag \- add/remove tags for all messages matching the search terms
 
 .SH SYNOPSIS
 .B notmuch tag
diff --git a/man/man7/notmuch-search-terms.7 b/man/man7/notmuch-search-terms.7
index c559ed6..b8ab52d 100644
--- a/man/man7/notmuch-search-terms.7
+++ b/man/man7/notmuch-search-terms.7
@@ -1,7 +1,7 @@
 .TH NOTMUCH-SEARCH-TERMS 7 2012-06-01 Notmuch 0.13.2
 
 .SH NAME
-notmuch-search-terms \- Syntax for notmuch queries
+notmuch-search-terms \- syntax for notmuch queries
 
 .SH SYNOPSIS
 
-- 
1.7.1

___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH v2] ruby: extern linkage portability improvement

2012-06-24 Thread Ali Polatel
2012/6/24 Tomi Ollila tomi.oll...@iki.fi:
 Some C compilers are stricter when it comes to (tentative) definition
 of a variable -- in those compilers introducing variable without 'extern'
 keyword always allocates new 'storage' to the variable and linking all
 these modules fails due to duplicate symbols.

 This is reimplementation of Charlie Allom's patch:
 id:1336481467-66356-1-git-send-email-char...@mediasp.com,
 written originally by Ali Polatel. This version has
 more accurate commit message.
 ---
  bindings/ruby/defs.h |   46 +++---
  bindings/ruby/init.c |   26 ++
  2 files changed, 49 insertions(+), 23 deletions(-)

 diff --git a/bindings/ruby/defs.h b/bindings/ruby/defs.h
 index 3f9512b..fe81b3f 100644
 --- a/bindings/ruby/defs.h
 +++ b/bindings/ruby/defs.h
 @@ -24,31 +24,31 @@
  #include notmuch.h
  #include ruby.h

 -VALUE notmuch_rb_cDatabase;
 -VALUE notmuch_rb_cDirectory;
 -VALUE notmuch_rb_cFileNames;
 -VALUE notmuch_rb_cQuery;
 -VALUE notmuch_rb_cThreads;
 -VALUE notmuch_rb_cThread;
 -VALUE notmuch_rb_cMessages;
 -VALUE notmuch_rb_cMessage;
 -VALUE notmuch_rb_cTags;
 -
 -VALUE notmuch_rb_eBaseError;
 -VALUE notmuch_rb_eDatabaseError;
 -VALUE notmuch_rb_eMemoryError;
 -VALUE notmuch_rb_eReadOnlyError;
 -VALUE notmuch_rb_eXapianError;
 -VALUE notmuch_rb_eFileError;
 -VALUE notmuch_rb_eFileNotEmailError;
 -VALUE notmuch_rb_eNullPointerError;
 -VALUE notmuch_rb_eTagTooLongError;
 -VALUE notmuch_rb_eUnbalancedFreezeThawError;
 -VALUE notmuch_rb_eUnbalancedAtomicError;
 -
 -ID ID_call;
 -ID ID_db_create;
 -ID ID_db_mode;
 +extern VALUE notmuch_rb_cDatabase;
 +extern VALUE notmuch_rb_cDirectory;
 +extern VALUE notmuch_rb_cFileNames;
 +extern VALUE notmuch_rb_cQuery;
 +extern VALUE notmuch_rb_cThreads;
 +extern VALUE notmuch_rb_cThread;
 +extern VALUE notmuch_rb_cMessages;
 +extern VALUE notmuch_rb_cMessage;
 +extern VALUE notmuch_rb_cTags;
 +
 +extern VALUE notmuch_rb_eBaseError;
 +extern VALUE notmuch_rb_eDatabaseError;
 +extern VALUE notmuch_rb_eMemoryError;
 +extern VALUE notmuch_rb_eReadOnlyError;
 +extern VALUE notmuch_rb_eXapianError;
 +extern VALUE notmuch_rb_eFileError;
 +extern VALUE notmuch_rb_eFileNotEmailError;
 +extern VALUE notmuch_rb_eNullPointerError;
 +extern VALUE notmuch_rb_eTagTooLongError;
 +extern VALUE notmuch_rb_eUnbalancedFreezeThawError;
 +extern VALUE notmuch_rb_eUnbalancedAtomicError;
 +
 +extern ID ID_call;
 +extern ID ID_db_create;
 +extern ID ID_db_mode;

  /* RSTRING_PTR() is new in ruby-1.9 */
  #if !defined(RSTRING_PTR)
 diff --git a/bindings/ruby/init.c b/bindings/ruby/init.c
 index 3fe60fb..f4931d3 100644
 --- a/bindings/ruby/init.c
 +++ b/bindings/ruby/init.c
 @@ -20,6 +20,32 @@

  #include defs.h

 +VALUE notmuch_rb_cDatabase;
 +VALUE notmuch_rb_cDirectory;
 +VALUE notmuch_rb_cFileNames;
 +VALUE notmuch_rb_cQuery;
 +VALUE notmuch_rb_cThreads;
 +VALUE notmuch_rb_cThread;
 +VALUE notmuch_rb_cMessages;
 +VALUE notmuch_rb_cMessage;
 +VALUE notmuch_rb_cTags;
 +
 +VALUE notmuch_rb_eBaseError;
 +VALUE notmuch_rb_eDatabaseError;
 +VALUE notmuch_rb_eMemoryError;
 +VALUE notmuch_rb_eReadOnlyError;
 +VALUE notmuch_rb_eXapianError;
 +VALUE notmuch_rb_eFileError;
 +VALUE notmuch_rb_eFileNotEmailError;
 +VALUE notmuch_rb_eNullPointerError;
 +VALUE notmuch_rb_eTagTooLongError;
 +VALUE notmuch_rb_eUnbalancedFreezeThawError;
 +VALUE notmuch_rb_eUnbalancedAtomicError;
 +
 +ID ID_call;
 +ID ID_db_create;
 +ID ID_db_mode;
 +
  /*
  * Document-module: Notmuch
  *
 --
 1.7.1

 ___
 notmuch mailing list
 notmuch@notmuchmail.org
 http://notmuchmail.org/mailman/listinfo/notmuch

Looks highly familiar yet strangely good to me.
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch