[PATCH v2 3/7] emacs: rename `notmuch-show-toggle-headers' to `notmuch-show-toggle-visibility-headers'

2012-10-18 Thread Tomi Ollila
On Thu, Oct 18 2012, Ethan wrote:

> On Thu, Oct 18, 2012 at 5:50 AM, Tomi Ollila  wrote:
>
>> On Thu, Oct 18 2012, Ethan Glasser-Camp wrote:
>>
>> > Ethan Glasser-Camp  writes:
>> >
>> >> This patch, and its predecessors, all look great to me.
>> >
>> > But a note: many of the first lines in your commit messages ("{show,
>>
>> Hmm, first lines -- IIRC mailman adds those tabs to the subject line -- and
>> those are converted to spaces in git-am (??)
>>
>
> I guess this is called "line folding" and notmuch should be sure to undo
> it, as I guess git-am already does.
>
> https://bugs.launchpad.net/mailman/+bug/265915
>
> I guess I can stop complaining about it ;) Patches 1-3 are probably ready
> then. Thanks, Tomi.

Np. Tests pass and the function name change is trivial. 
Removed needs-review on these 3 patches.

> Ethan

Tomi


[PATCH] test: Move tests from emacs to emacs-show

2012-10-18 Thread Tomi Ollila
On Thu, Oct 18 2012, Ethan Glasser-Camp wrote:

> This requires changing the contents of the crypto tests, as one thread
> that was marked read by the earlier tests in test/emacs is no longer
> marked read.
>
> This moves tests for:
>
> - 09d19ac "test: emacs: toggle eliding of non-matching messages in
>`notmuch-show'", which should have actually read: "test: emacs:
>toggle processing of cryptographic MIME parts in `notmuch-show'".
>See commit 19ec74c5.
>
> - 5ea1dbe "test: emacs: toggle eliding of non-matching messages in
>   `notmuch-show'"
>
> - 345faab "test: emacs: toggle thread content indentation in
>   `notmuch-show'"
>
> Signed-off-by: Ethan Glasser-Camp 
> ---
> I screwed up with git commit --amend or something on the last patch,
> so David Bremner suggested that I take advantage of the situation to
> write this patch, which does something useful as a side effect.

+1

Tomi

>
>  test/emacs |   67 -
>  test/emacs-show|   71 ++
>  .../notmuch-show-elide-non-matching-messages-off   |   79 
> 
>  .../notmuch-show-elide-non-matching-messages-on|   75 +++
>  .../notmuch-show-indent-thread-content-off |   79 
> 
>  .../notmuch-show-process-crypto-mime-parts-off |   31 
>  .../notmuch-show-process-crypto-mime-parts-on  |   32 
>  .../notmuch-show-elide-non-matching-messages-off   |   79 
> 
>  .../notmuch-show-elide-non-matching-messages-on|   75 ---
>  .../notmuch-show-indent-thread-content-off |   79 
> 
>  .../notmuch-show-process-crypto-mime-parts-off |   31 
>  .../notmuch-show-process-crypto-mime-parts-on  |   32 
>  12 files changed, 367 insertions(+), 363 deletions(-)
>  create mode 100644 
> test/emacs-show.expected-output/notmuch-show-elide-non-matching-messages-off
>  create mode 100644 
> test/emacs-show.expected-output/notmuch-show-elide-non-matching-messages-on
>  create mode 100644 
> test/emacs-show.expected-output/notmuch-show-indent-thread-content-off
>  create mode 100644 
> test/emacs-show.expected-output/notmuch-show-process-crypto-mime-parts-off
>  create mode 100644 
> test/emacs-show.expected-output/notmuch-show-process-crypto-mime-parts-on
>  delete mode 100644 
> test/emacs.expected-output/notmuch-show-elide-non-matching-messages-off
>  delete mode 100644 
> test/emacs.expected-output/notmuch-show-elide-non-matching-messages-on
>  delete mode 100644 
> test/emacs.expected-output/notmuch-show-indent-thread-content-off
>  delete mode 100644 
> test/emacs.expected-output/notmuch-show-process-crypto-mime-parts-off
>  delete mode 100644 
> test/emacs.expected-output/notmuch-show-process-crypto-mime-parts-on
>


[PATCH 1/2] test: add check for filename argument for test_expect_equal_file

2012-10-18 Thread Tomi Ollila
On Fri, Oct 12 2012, Ethan Glasser-Camp wrote:

> Dmitry Kurochkin  writes:
>
>> Actually, we can do both: check file name for consistent diff order
>> (from expected to actual) and use file names that the caller provides.
>
> Hi! Reviewing the patch queue a little bit here. It seems like this
> patch ended up getting dropped because the other approach (using the
> filenames that the caller provided) won out and was even pushed. I'm
> therefore marking this series notmuch::obsolete (and also
> notmuch::stale since it doesn't apply cleanly).

I think stale is unnecessary and inconvenient when patch is marked
obsolete

1) it is easier to look for stale patches by just searching stale tag
2) most obsolete patch goes stale at later time

If no-one resists I'll execute

notmuch tag -notmuch::stale tag:notmuch::obsolete

in near future (I take silence as an approval :D).

Currently:

notmuch search --output=messages tag:notmuch::stale and tag:notmuch::obsolete

id:1334077496-9172-3-git-send-email-markwalters1009 at gmail.com
id:1334077496-9172-2-git-send-email-markwalters1009 at gmail.com
id:1331402091-15663-1-git-send-email-tom.prince at ualberta.net
id:1328141050-30356-2-git-send-email-dmitry.kurochkin at gmail.com
id:1327985666-29191-3-git-send-email-dmitry.kurochkin at gmail.com
id:1327961195-4204-2-git-send-email-dmitry.kurochkin at gmail.com
id:1327926286-16680-2-git-send-email-dmitry.kurochkin at gmail.com
id:1325986015-22510-5-git-send-email-jrollins at finestructure.net


Tomi


[PATCH v2 3/7] emacs: rename `notmuch-show-toggle-headers' to `notmuch-show-toggle-visibility-headers'

2012-10-18 Thread Tomi Ollila
On Thu, Oct 18 2012, Ethan Glasser-Camp wrote:

> Ethan Glasser-Camp  writes:
>
>> This patch, and its predecessors, all look great to me.
>
> But a note: many of the first lines in your commit messages ("{show,

Hmm, first lines -- IIRC mailman adds those tabs to the subject line -- and
those are converted to spaces in git-am (??)
>
> Ethan

Tomi


[PATCH v2 3/7] emacs: rename `notmuch-show-toggle-headers' to `notmuch-show-toggle-visibility-headers'

2012-10-18 Thread Tomi Ollila
On Thu, Oct 18 2012, Ethan Glasser-Camp wrote:

> Ethan Glasser-Camp  writes:
>
>> This patch, and its predecessors, all look great to me.
>
> But a note: many of the first lines in your commit messages ("{show,
> hide} message headers") contain tabs. I hate tabs. Is this intentional?
> I have noticed it on other patches you've sent (such as
> id:"1330122640-18895-6-git-send-email-pieter at praet.org" and
> id:"1330122640-18895-7-git-send-email-pieter at praet.org").

I also see tabs, but when I press '<' (remove indent) then
those tabs go away... I guess emacs (or notmuch indentation code)
uses tabs when doing message indenting ?

> Ethan

Tomi

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


[PATCH 1/3] Add notmuch_database_close_compact

2012-10-18 Thread Tomi Ollila
On Wed, Oct 17 2012, Ben Gamari  wrote:

> ---
>  configure   |   21 -
>  lib/database.cc |   54 ++
>  lib/notmuch.h   |   14 ++
>  3 files changed, 88 insertions(+), 1 deletion(-)
>
> diff --git a/configure b/configure
> index acb90a8..6551b13 100755
> --- a/configure
> +++ b/configure
> @@ -270,7 +270,8 @@ printf "Checking for Xapian development files... "
>  have_xapian=0
>  for xapian_config in ${XAPIAN_CONFIG}; do
>  if ${xapian_config} --version > /dev/null 2>&1; then
> - printf "Yes (%s).\n" $(${xapian_config} --version | sed -e 's/.* //')
> + xapian_version=$(${xapian_config} --version | sed -e 's/.* //')
> + printf "Yes (%s).\n" ${xapian_version}
>   have_xapian=1
>   xapian_cxxflags=$(${xapian_config} --cxxflags)
>   xapian_ldflags=$(${xapian_config} --libs)
> @@ -282,6 +283,20 @@ if [ ${have_xapian} = "0" ]; then
>  errors=$((errors + 1))
>  fi
>  
> +have_xapian_compact=0
> +if [ ${have_xapian} = "1" ]; then
> +printf "Checking for Xapian compact support... "
> +case "${xapian_version}" in
> +0.*|1.[01].*|1.2.[0-5])
> +printf "No.\n" ;;
> +[1-9]*.[0-9]*.[0-9]*) 
> +have_xapian_compact=1
> +printf "Yes.\n" ;;
> +*)
> +printf "Unknown version.\n" ;;
> +esac
> +fi

This is pretty good approximation(*) for the version check, but some
comments are in place, like mentioning that compaction is supported
in Xapian versions 1.2.6 and newer (as the code is not obvious to
casual reader).

(*) The match for yes part gives some room for non-digit version
parts (if that would ever be needed) and also it rules out (most) 
cases where garbage were assigned to xapian_version.

Tomi

> +
>  printf "Checking for GMime development files... "
>  have_gmime=0
>  IFS=';'
> @@ -679,6 +694,9 @@ LINKER_RESOLVES_LIBRARY_DEPENDENCIES = 
> ${linker_resolves_library_dependencies}
>  XAPIAN_CXXFLAGS = ${xapian_cxxflags}
>  XAPIAN_LDFLAGS = ${xapian_ldflags}
>  
> +# Whether compact is supported by this version of Xapian
> +HAVE_XAPIAN_COMPACT = ${have_xapian_compact}
> +
>  # Flags needed to compile and link against GMime-2.4
>  GMIME_CFLAGS = ${gmime_cflags}
>  GMIME_LDFLAGS = ${gmime_ldflags}
> @@ -715,6 +733,7 @@ CONFIGURE_CFLAGS = -DHAVE_GETLINE=\$(HAVE_GETLINE) 
> \$(GMIME_CFLAGS)  \\
>  CONFIGURE_CXXFLAGS = -DHAVE_GETLINE=\$(HAVE_GETLINE) \$(GMIME_CFLAGS)\\
>\$(TALLOC_CFLAGS) -DHAVE_VALGRIND=\$(HAVE_VALGRIND) \\
>\$(VALGRIND_CFLAGS) \$(XAPIAN_CXXFLAGS) \\
> + -DHAVE_XAPIAN_COMPACT=\$(HAVE_XAPIAN_COMPACT)   \\
>   -DHAVE_STRCASESTR=\$(HAVE_STRCASESTR)
>  CONFIGURE_LDFLAGS =  \$(GMIME_LDFLAGS) \$(TALLOC_LDFLAGS) \$(XAPIAN_LDFLAGS)
>  EOF
> diff --git a/lib/database.cc b/lib/database.cc
> index 761dc1a..6e83a61 100644
> --- a/lib/database.cc
> +++ b/lib/database.cc
> @@ -781,6 +781,60 @@ notmuch_database_close (notmuch_database_t *notmuch)
>  }
>  
>  void
> +notmuch_database_close_compact (notmuch_database_t *notmuch)
> +{
> +void *local = talloc_new (NULL);
> +Xapian::Compactor compactor;
> +char *notmuch_path, *xapian_path, *compact_xapian_path, *old_xapian_path;
> +
> +#if HAVE_XAPIAN_COMPACT
> +if (! (notmuch_path = talloc_asprintf (local, "%s/%s", notmuch->path, 
> ".notmuch"))) {
> + fprintf (stderr, "Out of memory\n");
> + goto DONE;
> +}
> +
> +if (! (xapian_path = talloc_asprintf (local, "%s/%s", notmuch_path, 
> "xapian"))) {
> + fprintf (stderr, "Out of memory\n");
> + goto DONE;
> +}
> +
> +if (! (compact_xapian_path = talloc_asprintf (local, "%s.compact", 
> xapian_path))) {
> + fprintf (stderr, "Out of memory\n");
> + goto DONE;
> +}
> +
> +if (! (old_xapian_path = talloc_asprintf (local, "%s.old", 
> xapian_path))) {
> + fprintf (stderr, "Out of memory\n");
> + goto DONE;
> +}
> +
> +try {
> + compactor.set_renumber(false);
> + compactor.add_source(xapian_path);
> + compactor.set_destdir(compact_xapian_path);
> + compactor.compact();
> +
> + if (rename(xapian_path, old_xapian_path)) {
> + fprintf (stderr, "Error moving old database out of the way\n");
> + goto DONE;
> + }
> +
> + if (rename(compact_xapian_path, xapian_path)) {
> + fprintf (stderr, "Error moving compacted database\n");
> + goto DONE;
> + }
> +} catch (Xapian::InvalidArgumentError e) {
> + fprintf (stderr, "Error while compacting: %s", e.get_msg().c_str());
> +}
> +
> +#endif
> +
> +notmuch_database_close(notmuch);
> +DONE:
> +talloc_free(local);
> +}
> +
> +void
>  notmuch_database_destroy (notmuch_database_t *notmuch)
>  {
>  notmuch_database_close (notmuch);
> diff --git a/lib/notmuch.h b/lib/notmuch.h
> index 3633bed..50babfb 100644
> --- a/lib/notmuch.h
> +++ 

[PATCH v2 3/7] emacs: rename `notmuch-show-toggle-headers' to `notmuch-show-toggle-visibility-headers'

2012-10-18 Thread Ethan
On Thu, Oct 18, 2012 at 5:50 AM, Tomi Ollila  wrote:

> On Thu, Oct 18 2012, Ethan Glasser-Camp wrote:
>
> > Ethan Glasser-Camp  writes:
> >
> >> This patch, and its predecessors, all look great to me.
> >
> > But a note: many of the first lines in your commit messages ("{show,
>
> Hmm, first lines -- IIRC mailman adds those tabs to the subject line -- and
> those are converted to spaces in git-am (??)
>

I guess this is called "line folding" and notmuch should be sure to undo
it, as I guess git-am already does.

https://bugs.launchpad.net/mailman/+bug/265915

I guess I can stop complaining about it ;) Patches 1-3 are probably ready
then. Thanks, Tomi.

Ethan
-- next part --
An HTML attachment was scrubbed...
URL: 
<http://notmuchmail.org/pipermail/notmuch/attachments/20121018/291cc76a/attachment.html>


[PATCH 3/3] Add notmuch compact command

2012-10-18 Thread Tomi Ollila
On Wed, Oct 17 2012, Jani Nikula  wrote:

> Nag nag nag: Commit message. ;)
>
> The custom is to have a man page for each notmuch cli command.
>
> Small nitpicks below.
>
>
> BR,
> Jani.
>
>
> On Wed, 17 Oct 2012, Ben Gamari  wrote:
>> ---
>>  Makefile.local|1 +
>>  notmuch-client.h  |3 +++
>>  notmuch-compact.c |   43 +++
>>  notmuch.c |3 +++
>>  4 files changed, 50 insertions(+)
>>  create mode 100644 notmuch-compact.c
>>
>> diff --git a/Makefile.local b/Makefile.local
>> index 7f2d4f1..e050ba6 100644
>> --- a/Makefile.local
>> +++ b/Makefile.local
>> @@ -258,6 +258,7 @@ notmuch_client_srcs =\
>>  gmime-filter-headers.c  \
>>  hooks.c \
>>  notmuch.c   \
>> +notmuch-compact.c   \
>>  notmuch-config.c\
>>  notmuch-count.c \
>>  notmuch-dump.c  \
>> diff --git a/notmuch-client.h b/notmuch-client.h
>> index ae9344b..a6c624b 100644
>> --- a/notmuch-client.h
>> +++ b/notmuch-client.h
>> @@ -157,6 +157,9 @@ int
>>  notmuch_cat_command (void *ctx, int argc, char *argv[]);
>>  
>>  int
>> +notmuch_compact_command (void *ctx, int argc, char *argv[]);
>> +
>> +int
>>  notmuch_config_command (void *ctx, int argc, char *argv[]);
>>  
>>  const char *
>> diff --git a/notmuch-compact.c b/notmuch-compact.c
>> new file mode 100644
>> index 000..6deb2ec
>> --- /dev/null
>> +++ b/notmuch-compact.c
>> @@ -0,0 +1,43 @@
>> +/* notmuch - Not much of an email program, (just index and search)
>> + *
>> + * Copyright ? 2009 Carl Worth
>
> It's your code, this year.

... but you can give copyright to Carl if you wish...

>> + *
>> + * This program is free software: you can redistribute it and/or modify
>> + * it under the terms of the GNU General Public License as published by
>> + * the Free Software Foundation, either version 3 of the License, or
>> + * (at your option) any later version.
>> + *
>> + * This program is distributed in the hope that it will be useful,
>> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
>> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
>> + * GNU General Public License for more details.
>> + *
>> + * You should have received a copy of the GNU General Public License
>> + * along with this program.  If not, see http://www.gnu.org/licenses/ .
>> + *
>> + * Author: Carl Worth 
>
> It's your code.

Yes, all the praise and blames ;)





[PATCH] test: handle filenames that have directories in them

2012-10-18 Thread David Bremner
Ethan Glasser-Camp  writes:

> Since $TEST_DIRECTORY is an absolute path, any filenames generated
> with it will be complete paths. Only use the basename to generate
> suffixes for filenames.

pushed.

d


[PATCH] test: Move tests from emacs to emacs-show

2012-10-18 Thread David Bremner
Ethan Glasser-Camp  writes:

> This requires changing the contents of the crypto tests, as one thread
> that was marked read by the earlier tests in test/emacs is no longer
> marked read.

pushed.

d


[PATCH] test: handle filenames that have directories in them

2012-10-18 Thread Tomi Ollila
On Fri, Oct 12 2012, Ethan Glasser-Camp  wrote:

> Since $TEST_DIRECTORY is an absolute path, any filenames generated
> with it will be complete paths. Only use the basename to generate
> suffixes for filenames.
>
> Signed-off-by: Ethan Glasser-Camp 
> ---
> Discovered this while reviewing the patch queue. test/emacs generates
> filenames using $TEST_DIRECTORY, which is generated using pwd(1). Test
> failures then cause failures in the test harness.


LGTM. 

Removing needs-review (for this trivial change) as this helps the
good review work Ethan is doing :D

Tomi

Ps: some shell "trivia ;)" basename=`basename "$file"` works for variable
assignment; when giving as argument to command that needs one more quotes:
e.g. wc "`basename "$file"`"
fun?!

>
>  test/test-lib.sh |8 +---
>  1 file changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/test/test-lib.sh b/test/test-lib.sh
> index 7448b45..8de5e32 100644
> --- a/test/test-lib.sh
> +++ b/test/test-lib.sh
> @@ -498,16 +498,18 @@ test_expect_equal_file ()
>   error "bug in the test script: not 2 or 3 parameters to 
> test_expect_equal"
>  
>   file1="$1"
> + basename1=`basename "$file1"`
>   file2="$2"
> + basename2=`basename "$file2"`
>   if ! test_skip "$test_subtest_name"
>   then
>   if diff -q "$file1" "$file2" >/dev/null ; then
>   test_ok_ "$test_subtest_name"
>   else
>   testname=$this_test.$test_count
> - cp "$file1" "$testname.$file1"
> - cp "$file2" "$testname.$file2"
> - test_failure_ "$test_subtest_name" "$(diff -u 
> "$testname.$file1" "$testname.$file2")"
> + cp "$file1" "$testname.$basename1"
> + cp "$file2" "$testname.$basename2"
> + test_failure_ "$test_subtest_name" "$(diff -u 
> "$testname.$basename1" "$testname.$basename2")"
>   fi
>  fi
>  }
> -- 
> 1.7.9.5
>
> ___
> notmuch mailing list
> notmuch at notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch


[PATCH 2/2] Add notmuch_database_reopen method

2012-10-18 Thread Adrien Bustany
Calling notmuch_database_reopen is needed to refresh the database
contents when the database on disk was modified by another
notmuch_database_t instance, for example in a different thread.
---
 lib/database.cc | 17 +
 lib/notmuch.h   |  8 
 2 files changed, 25 insertions(+)

diff --git a/lib/database.cc b/lib/database.cc
index 1b680ab..f27d57f 100644
--- a/lib/database.cc
+++ b/lib/database.cc
@@ -763,6 +763,23 @@ notmuch_database_flush(notmuch_database_t *notmuch)
 return status;
 }

+notmuch_status_t
+notmuch_database_reopen(notmuch_database_t *notmuch)
+{
+notmuch_status_t status = NOTMUCH_STATUS_SUCCESS;
+
+try {
+   if (notmuch->xapian_db != NULL)
+   (notmuch->xapian_db)->reopen ();
+} catch (const Xapian::Error ) {
+   fprintf(stderr, "A Xapian exception occured reopening the database: 
%s\n",
+   error.get_msg().c_str());
+   status = NOTMUCH_STATUS_XAPIAN_EXCEPTION;
+}
+
+return status;
+}
+
 void
 notmuch_database_close (notmuch_database_t *notmuch)
 {
diff --git a/lib/notmuch.h b/lib/notmuch.h
index aef5c56..51d6a9a 100644
--- a/lib/notmuch.h
+++ b/lib/notmuch.h
@@ -205,6 +205,14 @@ notmuch_database_open (const char *path,
 notmuch_status_t
 notmuch_database_flush (notmuch_database_t *database);

+/* Refresh the database contents to the latest version.
+ *
+ * This is needed only if another instance of notmuch_database_t has
+ * modified the database contents on disk.
+ */
+notmuch_status_t
+notmuch_database_reopen (notmuch_database_t *database);
+
 /* Close the given notmuch database.
  *
  * After notmuch_database_close has been called, calls to other
-- 
1.7.11.7



[PATCH 1/2] Add notmuch_database_flush method

2012-10-18 Thread Adrien Bustany
This method explicitly flushes the pending modifications to disk. It is
useful if your program has various threads, each with a read only DB and
one writer thread with a read/write DB. In that case, you most likely
want the writer to sync the changes to disk so that the readers can see
them, without having to close and reopen the database completely.
---
 lib/database.cc | 18 ++
 lib/notmuch.h   |  4 
 2 files changed, 22 insertions(+)

diff --git a/lib/database.cc b/lib/database.cc
index 761dc1a..1b680ab 100644
--- a/lib/database.cc
+++ b/lib/database.cc
@@ -745,6 +745,24 @@ notmuch_database_open (const char *path,
 return status;
 }

+notmuch_status_t
+notmuch_database_flush(notmuch_database_t *notmuch)
+{
+notmuch_status_t status = NOTMUCH_STATUS_SUCCESS;
+
+try {
+   if (notmuch->xapian_db != NULL &&
+   notmuch->mode == NOTMUCH_DATABASE_MODE_READ_WRITE)
+   (static_cast  
(notmuch->xapian_db))->flush ();
+} catch (const Xapian::Error ) {
+   fprintf(stderr, "A Xapian exception occured flushing the database: 
%s\n",
+   error.get_msg().c_str());
+   status = NOTMUCH_STATUS_XAPIAN_EXCEPTION;
+}
+
+return status;
+}
+
 void
 notmuch_database_close (notmuch_database_t *notmuch)
 {
diff --git a/lib/notmuch.h b/lib/notmuch.h
index 3633bed..aef5c56 100644
--- a/lib/notmuch.h
+++ b/lib/notmuch.h
@@ -201,6 +201,10 @@ notmuch_database_open (const char *path,
   notmuch_database_mode_t mode,
   notmuch_database_t **database);

+/* Flushes all the pending modifications to the database to disk. */
+notmuch_status_t
+notmuch_database_flush (notmuch_database_t *database);
+
 /* Close the given notmuch database.
  *
  * After notmuch_database_close has been called, calls to other
-- 
1.7.11.7



[PATCH v2 0/2] Add flush/reopen methods to notmuch_database_t

2012-10-18 Thread Adrien Bustany
The code of the patches in unchanged, but the formatting issues are now
hopefully fixed.



[PATCH 1/2] Add notmuch_database_flush method

2012-10-18 Thread Adrien Bustany
Le 17/10/2012 18:53, Ethan Glasser-Camp a ?crit :
> Adrien Bustany  writes:
>
>> This method explicitly flushes the pending modifications to disk. It is
>> useful if your program has various threads, each with a read only DB and
>> one writer thread with a read/write DB. In that case, you most likely
>> want the writer to sync the changes to disk so that the readers can see
>> them, without having to close and reopen the database completely.
>
> These patches are pretty straightforward. But to conform to notmuch style..
>
>> +notmuch_status_t
>> +notmuch_database_flush(notmuch_database_t *notmuch)
>> +{
>> +notmuch_status_t status = NOTMUCH_STATUS_SUCCESS;
>
> Indent is 4 spaces. (You have tabs here, which are 8 spaces, according
> to devel/STYLE.)
>
>> +try {
>> +if (notmuch->xapian_db != NULL &&
>
> if should be more indented than try. (So when you pull try back to 4
> spaces, leave if at 8 spaces.)

Sorry about that... I think I copied the style from 
notmuch_database_close, but my editor was set to have 4-space tabs, so I 
got confused. I'll send a fixed version of the patches.

>
>> +notmuch->mode == NOTMUCH_DATABASE_MODE_READ_WRITE)
>> +(static_cast  
>> (notmuch->xapian_db))->flush ();
>
> This line is 90 characters, and will remain at 86 once you indent using
> the in-house style. I'm not sure if it's worth reformatting.
> notmuch_database_close calls flush() using exactly the same 86-character
> line. I'd say "don't make it worse", but personally I think breaking
> this line might be worse.
>

Yes, I also think breaking this line will not make things prettier :-/

> Ethan
>

Thanks for the review!

Adrien


Re: [PATCH 3/3] Add notmuch compact command

2012-10-18 Thread Tomi Ollila
On Wed, Oct 17 2012, Jani Nikula j...@nikula.org wrote:

 Nag nag nag: Commit message. ;)

 The custom is to have a man page for each notmuch cli command.

 Small nitpicks below.


 BR,
 Jani.


 On Wed, 17 Oct 2012, Ben Gamari bgamari.f...@gmail.com wrote:
 ---
  Makefile.local|1 +
  notmuch-client.h  |3 +++
  notmuch-compact.c |   43 +++
  notmuch.c |3 +++
  4 files changed, 50 insertions(+)
  create mode 100644 notmuch-compact.c

 diff --git a/Makefile.local b/Makefile.local
 index 7f2d4f1..e050ba6 100644
 --- a/Makefile.local
 +++ b/Makefile.local
 @@ -258,6 +258,7 @@ notmuch_client_srcs =\
  gmime-filter-headers.c  \
  hooks.c \
  notmuch.c   \
 +notmuch-compact.c   \
  notmuch-config.c\
  notmuch-count.c \
  notmuch-dump.c  \
 diff --git a/notmuch-client.h b/notmuch-client.h
 index ae9344b..a6c624b 100644
 --- a/notmuch-client.h
 +++ b/notmuch-client.h
 @@ -157,6 +157,9 @@ int
  notmuch_cat_command (void *ctx, int argc, char *argv[]);
  
  int
 +notmuch_compact_command (void *ctx, int argc, char *argv[]);
 +
 +int
  notmuch_config_command (void *ctx, int argc, char *argv[]);
  
  const char *
 diff --git a/notmuch-compact.c b/notmuch-compact.c
 new file mode 100644
 index 000..6deb2ec
 --- /dev/null
 +++ b/notmuch-compact.c
 @@ -0,0 +1,43 @@
 +/* notmuch - Not much of an email program, (just index and search)
 + *
 + * Copyright © 2009 Carl Worth

 It's your code, this year.

... but you can give copyright to Carl if you wish...

 + *
 + * This program is free software: you can redistribute it and/or modify
 + * it under the terms of the GNU General Public License as published by
 + * the Free Software Foundation, either version 3 of the License, or
 + * (at your option) any later version.
 + *
 + * This program is distributed in the hope that it will be useful,
 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 + * GNU General Public License for more details.
 + *
 + * You should have received a copy of the GNU General Public License
 + * along with this program.  If not, see http://www.gnu.org/licenses/ .
 + *
 + * Author: Carl Worth cwo...@cworth.org

 It's your code.

Yes, all the praise and blames ;)



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


Re: [PATCH 1/3] Add notmuch_database_close_compact

2012-10-18 Thread Tomi Ollila
On Wed, Oct 17 2012, Ben Gamari bgamari.f...@gmail.com wrote:

 ---
  configure   |   21 -
  lib/database.cc |   54 ++
  lib/notmuch.h   |   14 ++
  3 files changed, 88 insertions(+), 1 deletion(-)

 diff --git a/configure b/configure
 index acb90a8..6551b13 100755
 --- a/configure
 +++ b/configure
 @@ -270,7 +270,8 @@ printf Checking for Xapian development files... 
  have_xapian=0
  for xapian_config in ${XAPIAN_CONFIG}; do
  if ${xapian_config} --version  /dev/null 21; then
 - printf Yes (%s).\n $(${xapian_config} --version | sed -e 's/.* //')
 + xapian_version=$(${xapian_config} --version | sed -e 's/.* //')
 + printf Yes (%s).\n ${xapian_version}
   have_xapian=1
   xapian_cxxflags=$(${xapian_config} --cxxflags)
   xapian_ldflags=$(${xapian_config} --libs)
 @@ -282,6 +283,20 @@ if [ ${have_xapian} = 0 ]; then
  errors=$((errors + 1))
  fi
  
 +have_xapian_compact=0
 +if [ ${have_xapian} = 1 ]; then
 +printf Checking for Xapian compact support... 
 +case ${xapian_version} in
 +0.*|1.[01].*|1.2.[0-5])
 +printf No.\n ;;
 +[1-9]*.[0-9]*.[0-9]*) 
 +have_xapian_compact=1
 +printf Yes.\n ;;
 +*)
 +printf Unknown version.\n ;;
 +esac
 +fi

This is pretty good approximation(*) for the version check, but some
comments are in place, like mentioning that compaction is supported
in Xapian versions 1.2.6 and newer (as the code is not obvious to
casual reader).

(*) The match for yes part gives some room for non-digit version
parts (if that would ever be needed) and also it rules out (most) 
cases where garbage were assigned to xapian_version.

Tomi

 +
  printf Checking for GMime development files... 
  have_gmime=0
  IFS=';'
 @@ -679,6 +694,9 @@ LINKER_RESOLVES_LIBRARY_DEPENDENCIES = 
 ${linker_resolves_library_dependencies}
  XAPIAN_CXXFLAGS = ${xapian_cxxflags}
  XAPIAN_LDFLAGS = ${xapian_ldflags}
  
 +# Whether compact is supported by this version of Xapian
 +HAVE_XAPIAN_COMPACT = ${have_xapian_compact}
 +
  # Flags needed to compile and link against GMime-2.4
  GMIME_CFLAGS = ${gmime_cflags}
  GMIME_LDFLAGS = ${gmime_ldflags}
 @@ -715,6 +733,7 @@ CONFIGURE_CFLAGS = -DHAVE_GETLINE=\$(HAVE_GETLINE) 
 \$(GMIME_CFLAGS)  \\
  CONFIGURE_CXXFLAGS = -DHAVE_GETLINE=\$(HAVE_GETLINE) \$(GMIME_CFLAGS)\\
\$(TALLOC_CFLAGS) -DHAVE_VALGRIND=\$(HAVE_VALGRIND) \\
\$(VALGRIND_CFLAGS) \$(XAPIAN_CXXFLAGS) \\
 + -DHAVE_XAPIAN_COMPACT=\$(HAVE_XAPIAN_COMPACT)   \\
   -DHAVE_STRCASESTR=\$(HAVE_STRCASESTR)
  CONFIGURE_LDFLAGS =  \$(GMIME_LDFLAGS) \$(TALLOC_LDFLAGS) \$(XAPIAN_LDFLAGS)
  EOF
 diff --git a/lib/database.cc b/lib/database.cc
 index 761dc1a..6e83a61 100644
 --- a/lib/database.cc
 +++ b/lib/database.cc
 @@ -781,6 +781,60 @@ notmuch_database_close (notmuch_database_t *notmuch)
  }
  
  void
 +notmuch_database_close_compact (notmuch_database_t *notmuch)
 +{
 +void *local = talloc_new (NULL);
 +Xapian::Compactor compactor;
 +char *notmuch_path, *xapian_path, *compact_xapian_path, *old_xapian_path;
 +
 +#if HAVE_XAPIAN_COMPACT
 +if (! (notmuch_path = talloc_asprintf (local, %s/%s, notmuch-path, 
 .notmuch))) {
 + fprintf (stderr, Out of memory\n);
 + goto DONE;
 +}
 +
 +if (! (xapian_path = talloc_asprintf (local, %s/%s, notmuch_path, 
 xapian))) {
 + fprintf (stderr, Out of memory\n);
 + goto DONE;
 +}
 +
 +if (! (compact_xapian_path = talloc_asprintf (local, %s.compact, 
 xapian_path))) {
 + fprintf (stderr, Out of memory\n);
 + goto DONE;
 +}
 +
 +if (! (old_xapian_path = talloc_asprintf (local, %s.old, 
 xapian_path))) {
 + fprintf (stderr, Out of memory\n);
 + goto DONE;
 +}
 +
 +try {
 + compactor.set_renumber(false);
 + compactor.add_source(xapian_path);
 + compactor.set_destdir(compact_xapian_path);
 + compactor.compact();
 +
 + if (rename(xapian_path, old_xapian_path)) {
 + fprintf (stderr, Error moving old database out of the way\n);
 + goto DONE;
 + }
 +
 + if (rename(compact_xapian_path, xapian_path)) {
 + fprintf (stderr, Error moving compacted database\n);
 + goto DONE;
 + }
 +} catch (Xapian::InvalidArgumentError e) {
 + fprintf (stderr, Error while compacting: %s, e.get_msg().c_str());
 +}
 +
 +#endif
 +
 +notmuch_database_close(notmuch);
 +DONE:
 +talloc_free(local);
 +}
 +
 +void
  notmuch_database_destroy (notmuch_database_t *notmuch)
  {
  notmuch_database_close (notmuch);
 diff --git a/lib/notmuch.h b/lib/notmuch.h
 index 3633bed..50babfb 100644
 --- a/lib/notmuch.h
 +++ b/lib/notmuch.h
 @@ -215,6 +215,20 @@ notmuch_database_open (const char *path,
  void
  notmuch_database_close (notmuch_database_t *database);
  
 +/* Close the given 

Re: [PATCH v2 3/7] emacs: rename `notmuch-show-toggle-headers' to `notmuch-show-toggle-visibility-headers'

2012-10-18 Thread Tomi Ollila
On Thu, Oct 18 2012, Ethan Glasser-Camp wrote:

 Ethan Glasser-Camp ethan.glasser.c...@gmail.com writes:

 This patch, and its predecessors, all look great to me.

 But a note: many of the first lines in your commit messages ({show,
 hide} message headers) contain tabs. I hate tabs. Is this intentional?
 I have noticed it on other patches you've sent (such as
 id:1330122640-18895-6-git-send-email-pie...@praet.org and
 id:1330122640-18895-7-git-send-email-pie...@praet.org).

I also see tabs, but when I press '' (remove indent) then
those tabs go away... I guess emacs (or notmuch indentation code)
uses tabs when doing message indenting ?

 Ethan

Tomi

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


Re: [PATCH 1/2] test: add check for expected filename argument for test_expect_equal_file

2012-10-18 Thread Tomi Ollila
On Fri, Oct 12 2012, Ethan Glasser-Camp wrote:

 Dmitry Kurochkin dmitry.kuroch...@gmail.com writes:

 Actually, we can do both: check file name for consistent diff order
 (from expected to actual) and use file names that the caller provides.

 Hi! Reviewing the patch queue a little bit here. It seems like this
 patch ended up getting dropped because the other approach (using the
 filenames that the caller provided) won out and was even pushed. I'm
 therefore marking this series notmuch::obsolete (and also
 notmuch::stale since it doesn't apply cleanly).

I think stale is unnecessary and inconvenient when patch is marked
obsolete

1) it is easier to look for stale patches by just searching stale tag
2) most obsolete patch goes stale at later time

If no-one resists I'll execute

notmuch tag -notmuch::stale tag:notmuch::obsolete

in near future (I take silence as an approval :D).

Currently:

notmuch search --output=messages tag:notmuch::stale and tag:notmuch::obsolete

id:1334077496-9172-3-git-send-email-markwalters1...@gmail.com
id:1334077496-9172-2-git-send-email-markwalters1...@gmail.com
id:1331402091-15663-1-git-send-email-tom.pri...@ualberta.net
id:1328141050-30356-2-git-send-email-dmitry.kuroch...@gmail.com
id:1327985666-29191-3-git-send-email-dmitry.kuroch...@gmail.com
id:1327961195-4204-2-git-send-email-dmitry.kuroch...@gmail.com
id:1327926286-16680-2-git-send-email-dmitry.kuroch...@gmail.com
id:1325986015-22510-5-git-send-email-jroll...@finestructure.net


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


Re: [PATCH] test: Move tests from emacs to emacs-show

2012-10-18 Thread David Bremner
Ethan Glasser-Camp ethan.glasser.c...@gmail.com writes:

 This requires changing the contents of the crypto tests, as one thread
 that was marked read by the earlier tests in test/emacs is no longer
 marked read.

pushed.

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


Re: [PATCH] test: handle filenames that have directories in them

2012-10-18 Thread David Bremner
Ethan Glasser-Camp ethan.glasser.c...@gmail.com writes:

 Since $TEST_DIRECTORY is an absolute path, any filenames generated
 with it will be complete paths. Only use the basename to generate
 suffixes for filenames.

pushed.

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


Re: [PATCH v2 3/7] emacs: rename `notmuch-show-toggle-headers' to `notmuch-show-toggle-visibility-headers'

2012-10-18 Thread Ethan
On Thu, Oct 18, 2012 at 5:50 AM, Tomi Ollila tomi.oll...@iki.fi wrote:

 On Thu, Oct 18 2012, Ethan Glasser-Camp wrote:

  Ethan Glasser-Camp ethan.glasser.c...@gmail.com writes:
 
  This patch, and its predecessors, all look great to me.
 
  But a note: many of the first lines in your commit messages ({show,

 Hmm, first lines -- IIRC mailman adds those tabs to the subject line -- and
 those are converted to spaces in git-am (??)


I guess this is called line folding and notmuch should be sure to undo
it, as I guess git-am already does.

https://bugs.launchpad.net/mailman/+bug/265915

I guess I can stop complaining about it ;) Patches 1-3 are probably ready
then. Thanks, Tomi.

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


Re: [PATCH v2 0/2] Add flush/reopen methods to notmuch_database_t

2012-10-18 Thread Ethan Glasser-Camp
Adrien Bustany adr...@bustany.org writes:

 The code of the patches in unchanged, but the formatting issues are now
 hopefully fixed.

These look fine to me, and they're pretty trivial.

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


Re: Notmuch scripts (again), now with more usenet

2012-10-18 Thread Ethan Glasser-Camp
c...@webprojekty.cz writes:

 Hello, for quite some time my set of scripts just lied in my repo and
 waited for polish before release. So tonight I finally managed to update
 the docs, remove old stuff, rewrite some unfortunate things etc.

 One notable addition is slrn2maildir script which can convert NNTP
 spool, eg. gmane mailing lists or blogs, as fetched by slrnpull to
 maildir format. This way you can follow plethora of mailing lists
 without subscribing, any blog that publishes full atom/rss feed or
 usenet newsgroup.

 For details see the readme:
   http://webprojekty.cz/ccx/loggerhead/zmuch/view/head:/README
 or check out the code:
   bzr branch http://webprojekty.cz/ccx/bzr/zmuch

 I hope it's now in the form acceptable for inclusion to contrib.

Hi! Sorry about the delay, but I'm going through the patch queue now and
it seems like this branch is just completely gone. I get 502 Bad Gateway
errors when I follow the first link. Did it move or is there a problem
with your site?

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


Re: [PATCH 7/8] lib: add NOTMUCH_EXCLUDE_FLAG to notmuch_exclude_t

2012-10-18 Thread Ethan Glasser-Camp
Peter Wang noval...@gmail.com writes:

 Add NOTMUCH_EXCLUDE_FLAG to notmuch_exclude_t so that it can
 cover all four values of search --exclude in the cli.

This series looks good to me. It's a nice clean up and a nice new
feature. Patches all apply.

However, I'm getting test failures like:

 FAIL   Search, exclude deleted messages from message search --exclude=false
--- excludes.3.expected 2012-10-19 04:45:06.900518377 +
+++ excludes.3.output   2012-10-19 04:45:06.900518377 +
@@ -1,2 +1,2 @@
-id:msg-001@notmuch-test-suite
 id:msg-002@notmuch-test-suite
+id:msg-001@notmuch-test-suite

 FAIL   Search, don't exclude deleted messages when --exclude=flag specified
--- excludes.7.expected 2012-10-19 04:45:07.004518378 +
+++ excludes.7.output   2012-10-19 04:45:07.004518378 +
@@ -1,2 +1,2 @@
-thread:XXX   2001-01-05 [1/1] Notmuch Test Suite; Not deleted (inbox 
unread)
 thread:XXX   2001-01-05 [1/2] Notmuch Test Suite; Not deleted reply 
(deleted inbox unread)
+thread:XXX   2001-01-05 [1/1] Notmuch Test Suite; Not deleted (inbox 
unread)

 FAIL   Search, don't exclude deleted messages from search if not configured
--- excludes.8.expected 2012-10-19 04:45:07.028518377 +
+++ excludes.8.output   2012-10-19 04:45:07.028518377 +
@@ -1,2 +1,2 @@
-thread:XXX   2001-01-05 [1/1] Notmuch Test Suite; Not deleted (inbox 
unread)
 thread:XXX   2001-01-05 [2/2] Notmuch Test Suite; Deleted (deleted 
inbox unread)
+thread:XXX   2001-01-05 [1/1] Notmuch Test Suite; Not deleted (inbox 
unread)

In other words, threads and messages are coming up out of order. I'm not
sure of the right way to fix this. If you would like me to try sticking
| sort here and there in the tests I will do so. I'm not sure if the
test suite is guaranteed to scan messages in a certain order.

Mark Walters wrote in
id:1340198947-29370-5-git-send-email-noval...@gmail.com that he
thought patch 1/8 seemed more intrusive than he liked. Maybe I just have
a higher standard for intrusive than he does ;) but I thought it was
fine.

It looks like you have better wording for patch 4/8 so I'd like to see
you resend it.

 - if (query-omit_excluded != NOTMUCH_EXCLUDE_FALSE)
 + if (query-omit_excluded == NOTMUCH_EXCLUDE_TRUE ||
 + query-omit_excluded == NOTMUCH_EXCLUDE_ALL)
 + {
   final_query = Xapian::Query (Xapian::Query::OP_AND_NOT,
final_query, exclude_query);
 - else {
 + } else {

House style is to not put braces around one-line then-clauses. This is
the only place where you did that.

I'm marking patches 3, 4, and 7 as moreinfo. Please resubmit!

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