bug in emacs-ui ?

2011-06-28 Thread Dmitry Kurochkin
Hi Jani.

On Tue, 28 Jun 2011 10:35:48 + (UTC), Jani Nikula  
wrote:
> Carl Worth  writes:
> 
> > 
> > On Wed, 22 Jun 2011 08:50:23 +0200, Sebastien Binet
> >  wrote:
> > > On Tue, 21 Jun 2011 15:09:20 -0700, Carl Worth  wrote:
> > > > Perhaps this is an emacs bug?
> > > could be, but,
> > > 
> > > > I'm using Debian's emacs 23.3.1 and have not encountered the problem
> > > > described.
> > > I don't see anything related to 'point', 'point-invisible-p' nor
> 'forward-char' in there:
> > > http://patch-tracker.debian.org/package/emacs23/23.3+1-1
> > 
> > Perhaps I was confused. I thought 23.3.1 was a distinct upstream release
> > From 23.3, but maybe not, (emacs version numbers use 1-based indexing
> > perhaps?).
> > 
> > > anyways... for the moment I'll just live with it...
> > 
> > Sorry about that.
> > 
> > > except if somebody has some insights on how to "catch" the 'End of
> > > buffer' error and add some more protective programming around the
> > > 'scroll-up' function ?
> > 
> > My emacs lisp skills are primarily restricted to actual
> > experimentation. So if I can replicate the bug, I might be able to find
> > a fix. I'm not very good at doing theoretical fixes with emacs lisp
> > code.
> 
> I bisected the problem to commit 95ef8da29439f2e79115c36ab4d2a80aef1a1462 
> ("Fix
> hiding a message while some citations are shown in notmuch-show view").
> Reverting that fixes the problem for me. (If you don't want to resolve
> conflicts, also revert 432e091924c1d1d8950a44ca78bc5b9c5ade47e4 first.) I 
> don't
> have the time just now to try to figure out the problem in that, but perhaps
> this will help others go forward.
> 

Thanks for tracking this.  I will look into it.

Regards,
  Dmitry

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


[PATCH 2/2] test: use emacsclient(1) for Emacs tests

2011-06-28 Thread Dmitry Kurochkin
On Tue, 28 Jun 2011 12:22:57 -0400, Austin Clements  wrote:
> Quoth myself on Jun 27 at 11:49 pm:
> > Quoth Dmitry Kurochkin on Jun 28 at  5:03 am:
> > EMACSDONE=$TEST_DIRECTORY/emacsdone
> > mkfifo $EMACSDONE
> > coproc emacs --batch --eval '(while t (eval (read)) (write-region "\n" nil 
> > "'$EMACSDONE'" t 0))'
> > EMACSFD=${COPROC[1]}
> > 
> > test_emacs() {
> > echo "$1" >&$EMACSFD
> > read <$EMACSDONE
> > }
> > 
> > test_emacs '(sleep-for 2)'
> > test_emacs '(message "Hi")'
> > 
> > echo '(kill-emacs)' >&$EMACSFD
> 
> Oops, got a little overzealous with TEST_DIRECTORY.  For reference,
> the pipe should, of course, have gone in the current directory (or
> TMP_DIRECTORY).
> 
> mkfifo emacsdone
> coproc emacs --batch --eval '(while t (eval (read)) (write-region "\n" nil 
> "emacsdone" t 0))'
> EMACSFD=${COPROC[1]}
> 
> test_emacs() {
> echo "$1" >&$EMACSFD
> read < emacsdone
> }
> 
> 
> (I don't really see how that could be either more shell code or more
> elisp code than using emacsclient plus cleanup code [nor why it
> matters for five lines of code], but I'm probably missing something.)

Well, it may not be less code if you count lines.  It is just IMHO, but
it shell code in case of emacsclient is simpler (no fifo, no coproc),
cleanup is the same (one line with kill-emacs).  More lisp code in
emacsclient variant, but that is just because you put it all on one line
:)

Code size does not matter indeed.  Your approach just feels more of a
hack to me and unnecessary complex.  Again, this is just my IMHO.

I would like to hear what other (Carl in particular) think about this.
If the consensus is for your approach, I would be happy to implement it.

Regards,
  Dmitry


[PATCH 1/2] Add part filename and content-id in notmuch show output if available.

2011-06-28 Thread Carl Worth
On Sun, 29 May 2011 02:03:47 +0400, Dmitry Kurochkin  wrote:
> Also, the patch adds Content-id to text output format of notmuch
> show.

I don't think I've raised this point before, but I've been tempted to
setup a git hook that rejects any commits with a paragraph beginning
with the word "also" or the word "additionally". These words are clues
to me that the commit is doing multiple independent things and should
really be split up.

> The patch makes notmuch show always output filename if available,
> independent of Content-Disposition.  Both JSON and text output
> formats are changed.

The commit message claims to change both JSON and text output, (and the
patch bears that out). But the test suite only gets changes to text
output.

This suggests to me that the test suite needs an additional test here
(for a "Content-Disposition: inline" attachment with a filename).

What can I say, I must be feeling soft today, because in spite of both
of those issues I've just pushed these two commits, (I did augment the
commit message of the second commit to be more than a single line?I know
that I've discussed that issue before).

Thanks, Dmitry, for the improvements.

-Carl

-- 
carl.d.worth at intel.com
-- next part --
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: 
<http://notmuchmail.org/pipermail/notmuch/attachments/20110628/3d17a4f1/attachment.pgp>


notmuch Digest, Vol 20, Issue 57

2011-06-28 Thread Carl Worth
On Tue, 28 Jun 2011 16:38:30 -0600, Mark Anderson  wrote:
> I had briefly considered adding another output format "file", just to get a
> single file for each message in the db, but the file/files distinction
> feels a bit niggling.  Perhaps it should be changed to "files" and
> "filelists" or something else more clear.

Another option that would be general to several commands would be:

notmuch search --output=files --exclude-duplicates

Or alternately, --include-duplicates. That might be more useful for
"notmuch show" which is a case where users have previously asked for the
ability to ask for duplicate messages, (and where the duplicates are
squelched by default).

Thoughts?

-Carl

-- 
carl.d.worth at intel.com
-- next part --
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: 
<http://notmuchmail.org/pipermail/notmuch/attachments/20110628/271594cb/attachment.pgp>


[PATCH] libnotmuch: build symbols list without relying on gcc -aux-info.

2011-06-28 Thread David Bremner
On Tue, 28 Jun 2011 12:04:39 -0700, Carl Worth  wrote:

> I assume by "better" you mean that this one is less fragile to issues
> like the precise formatting of our notmuch.h header file.

Yes, that's what I meant.

> Meanwhile, though, our API *is* declared in the header file, (that's
> what the header file exists for), so I do prefer to base our symbol list
> on it.

Sure, that makes sense to me.  I cherry-picked the sed patch to the
release branch.

> In fact, the ideal would probably be to take the objdump method and use
> it in the test suite to verify that its output matches the contents of
> notmuch.sym generated from the header file.

The second patch being turned into a test sounds like a great idea. I
can do that.

d


-- next part --
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 315 bytes
Desc: not available
URL: 
<http://notmuchmail.org/pipermail/notmuch/attachments/20110628/cbd6136f/attachment.pgp>


notmuch Digest, Vol 20, Issue 57

2011-06-28 Thread Mark Anderson
On Tue, 28 Jun 2011 23:43:52 +0200, "Sander Boer"  wrote:
> 
> Carl Worth  writes:> 
> I was hoping that google somehow was able to expose the tags in the "All
> Mail" folder, like the headers that are gmail specific: X-pstn-nxpr and 
> X-pstn-nxp (which contains a
> hash) for instance.

I don't even see those headers in my email in All Mail.  How are you
fetching your mail?

Or are you hoping for something else to be there that isn't there?

-Mark


notmuch Digest, Vol 20, Issue 57

2011-06-28 Thread Mark Anderson
On Tue, 28 Jun 2011 23:43:52 +0200, "Sander Boer"  wrote:
> Carl Worth  writes:> 
> >
> > Hopefully it's clear enough that you could do the above in a script that
> > loops over all of your existing tags.
> >
> > And if you were doing a one-time switch from Gmail to notmuch that would
> > be all you would need.
> >
> > I don't know if you're looking to also push tags added via some notmuch
> > interface back to Gmail, (does Gmail even provide a mechanism for doing
> > that?). If so, then you'd need something that took notmuch tags and made
> > copies of the message in the appropriate files. That would hopefully be
> > easy to script based on the output of:
> >
> > notmuch search --output=files tag:important

You'd probably actually want this:

 notmuch search --output=files tag:importand and not folder:important

Although until the folder: tag bug is fixed, it won't be as definitive
as you want, because once the message was in folder:important, it
doesn't really leave.

However, With my recent patch you'll also get more filenames than you
want for this behavior.  If you already have the mail in All Mail,
Inbox, my_special_tag, and not_that_tag, do you want 4 links or copies
of the message placed in the folder for Important?

I had thought of this, because I am a Gmail/notmuch user (well,
somewhat, I have some of the infra in place, but it's not polished, I
usually end up using phone or web)

I had briefly considered adding another output format "file", just to get a
single file for each message in the db, but the file/files distinction
feels a bit niggling.  Perhaps it should be changed to "files" and
"filelists" or something else more clear.

It was nagging me as I implemented the fix I submitted, which looks like
it has been pushed.

Any comments?  I don't think I have time to code any changes to this for
a couple days.

> > I think my short answer is that it's fairly easy to convert from Gmail
> > tags to notmuch tags as part of a one-time import. Doing this on a
> > continual basis might benefit from writing a few scripts, and I don't
> > know if anyone has written those scripts yet.

Yes, you need a label->folder as well as a folder->label part of the
script.  I think of it as:

1. label->folder sync
2. offlineimap (pushes label changes, pulls new mail)
3. folder->label sync

There is certainly room for some conflict, if you use multiple
interfaces.  So watch your head.

-Mark

> >
> > Would any Gmail+notmuch users care to add anything to the conversation?
> >
> > -Carl
> 
> 
> now using gnus still, b/c notmuch does not build for the N900 (bummer)
> 
> -- 
> Sander Boer
> 
> ___
> notmuch mailing list
> notmuch at notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch


[PATCH v3] test:Improve test behaviors when --root is used

2011-06-28 Thread Mark Anderson
Change add_email_corpus, emacs_deliver_message and tests to use
$TEST_DIRECTORY instead of '..'.

This improves the behavior of the usage of --root=, as the
assumption of what '..' means will usually be incorrect.

Document -root option in README and update valgrind to work with
-root.
---

This patch actually fixes what Austin pointed out.  

 test/README|9 +
 test/basic |   10 +-
 test/crypto|2 +-
 test/emacs |4 ++--
 test/symbol-hiding |4 ++--
 test/test-lib.sh   |   18 +-
 6 files changed, 28 insertions(+), 19 deletions(-)

diff --git a/test/README b/test/README
index be75e0e..8fbf78d 100644
--- a/test/README
+++ b/test/README
@@ -41,6 +41,15 @@ The following command-line options are available when 
running tests:
As the names depend on the tests' file names, it is safe to
run the tests with this option in parallel.

+--root=::
+   This runs the testsuites specified under a seperate directory.
+   However, caution is advised, as not all tests are maintained
+   with this relocation in mind, so some tests may behave
+   differently.
+
+   Pointing this argument at a tmpfs filesystem can improve the
+   speed of the test suite for some users.
+
 When invoking the test suite via "make test" any of the above options
 can be specified as follows:

diff --git a/test/basic b/test/basic
index d6e8c10..33bf711 100755
--- a/test/basic
+++ b/test/basic
@@ -51,9 +51,9 @@ test_expect_code 2 'failure to clean up causes the test to 
fail' '

 # Ensure that all tests are being run
 test_begin_subtest 'Ensure that all available tests will be run by 
notmuch-test'
-eval $(sed -n -e '/^TESTS="$/,/^"$/p' notmuch-test ../notmuch-test)
+eval $(sed -n -e '/^TESTS="$/,/^"$/p' notmuch-test 
$TEST_DIRECTORY/notmuch-test)
 tests_in_suite=$(for i in $TESTS; do echo $i; done | sort)
-available=$(ls -1 ../ | \
+available=$(ls -1 $TEST_DIRECTORY/ | \
 sed -r -e 
"/^(aggregate-results.sh|Makefile|Makefile.local|notmuch-test)/d" \
   -e 
"/^(README|test-lib.sh|test-lib.el|test-results|tmp.*|valgrind|corpus*)/d" \
   -e 
"/^(emacs.expected-output|smtp-dummy|smtp-dummy.c|test-verbose|symbol-test.cc)/d"
 \
@@ -63,19 +63,19 @@ available=$(ls -1 ../ | \
   | sort)
 test_expect_equal "$tests_in_suite" "$available"

-EXPECTED=../test.expected-output
+EXPECTED=$TEST_DIRECTORY/test.expected-output
 suppress_diff_date() {
 sed -e 's/\(.*\-\-\- test-verbose\.4\.\expected\).*/\1/' \
-e 's/\(.*\+\+\+ test-verbose\.4\.\output\).*/\1/'
 }

 test_begin_subtest "Ensure that test output is suppressed unless the test 
fails"
-output=$(cd ..; ./test-verbose 2>&1 | suppress_diff_date)
+output=$(cd $TEST_DIRECTORY; ./test-verbose 2>&1 | suppress_diff_date)
 expected=$(cat $EXPECTED/test-verbose-no | suppress_diff_date)
 test_expect_equal "$output" "$expected"

 test_begin_subtest "Ensure that -v does not suppress test output"
-output=$(cd ..; ./test-verbose -v 2>&1 | suppress_diff_date)
+output=$(cd $TEST_DIRECTORY; ./test-verbose -v 2>&1 | suppress_diff_date)
 expected=$(cat $EXPECTED/test-verbose-yes | suppress_diff_date)
 # Do not include the results of test-verbose in totals
 rm $TEST_DIRECTORY/test-results/test-verbose-*
diff --git a/test/crypto b/test/crypto
index 01daffe..7eb3559 100755
--- a/test/crypto
+++ b/test/crypto
@@ -12,7 +12,7 @@ add_gnupg_home ()
 local output
 [ -d ${GNUPGHOME} ] && return
 mkdir -m 0700 "$GNUPGHOME"
-gpg --no-tty --import <../gnupg-secret-key.asc >"$GNUPGHOME"/import.log 
2>&1
+gpg --no-tty --import <$TEST_DIRECTORY/gnupg-secret-key.asc 
>"$GNUPGHOME"/import.log 2>&1
 test_debug "cat $GNUPGHOME/import.log"
 if (gpg --quick-random --version >/dev/null 2>&1) ; then
echo quick-random >> "$GNUPGHOME"/gpg.conf
diff --git a/test/emacs b/test/emacs
index 6f82b08..f91078e 100755
--- a/test/emacs
+++ b/test/emacs
@@ -2,7 +2,7 @@
 test_description="emacs interface"
 . test-lib.sh

-EXPECTED=../emacs.expected-output
+EXPECTED=$TEST_DIRECTORY/emacs.expected-output

 add_email_corpus

@@ -81,7 +81,7 @@ mkdir -p mail/sent/cur
 mkdir -p mail/sent/new
 mkdir -p mail/sent/tmp

-../smtp-dummy sent_message &
+$TEST_DIRECTORY/smtp-dummy sent_message &
 smtp_dummy_pid=$!
 test_emacs "(setq message-send-mail-function 'message-smtpmail-send-it) (setq 
smtpmail-smtp-server \"localhost\") (setq smtpmail-smtp-service \"25025\") 
(notmuch-hello) (notmuch-mua-mail) (message-goto-to) (insert \"user at 
example.com\nDate: Fri, 29 Mar 1974 10:00:00 -\") (message-goto-subject) 
(insert \"Testing message sent via SMTP\") (message-goto-body) (insert \"This 
is a test that messages are sent via SMTP\") (message-send-and-exit)" 
>/dev/null 2>&1
 wait ${smtp_dummy_pid}
diff --git a/test/symbol-hiding b/test/symbol-hiding
index bb55524..d0b31ae 100755
--- a/test/symbol-hiding
+++ b/test/symbol-hiding
@@ -12,13 +12,13 @@ test_description='exception symbol 

[PATCH v3] test:Improve test behaviors when --root is used

2011-06-28 Thread Carl Worth
On Tue, 28 Jun 2011 16:11:32 -0600, Mark Anderson  wrote:
> Change add_email_corpus, emacs_deliver_message and tests to use
> $TEST_DIRECTORY instead of '..'.
...
> Document -root option in README and update valgrind to work with
> -root.

Thanks for the features, Mark. These should all be quite handy.

> This patch actually fixes what Austin pointed out.  

And thanks for the eagle-eyed review, Austin!

This is pushed out now.

-Carl
<
-- next part --
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: 
<http://notmuchmail.org/pipermail/notmuch/attachments/20110628/19f7e85c/attachment.pgp>


[PATCH 2/2] test: use emacsclient(1) for Emacs tests

2011-06-28 Thread Carl Worth
On Wed, 29 Jun 2011 00:58:41 +0400, Dmitry Kurochkin  wrote:
> BTW Carl, while we continue our debate, you may consider applying the
> first 9 patches from the series :)

Yes, I already did that.

And I would have even installed all 10 (with the debate still going)
except that I'm seeing tests fail, (as mentioned in the other thread).

-Carl

-- 
carl.d.worth at intel.com
-- next part --
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: 
<http://notmuchmail.org/pipermail/notmuch/attachments/20110628/fe35a6ae/attachment.pgp>


[PATCH v2] test:Improve test behaviors when --root is used

2011-06-28 Thread Mark Anderson
Change add_email_corpus, emacs_deliver_message and tests to use
$TEST_DIRECTORY instead of '..'.

This improves the behavior of the usage of --root=, as the
assumption of what '..' means will usually be incorrect.

Document -root option in README and update valgrind to work with
-root.

Signed-off-by: Mark Anderson 
---
> If you could follow up with an updated patch, (or an argument that the
> original patch is correct), that would be great.

Updated the patch with Austin's suggestion.

I'm not personally ready to forbid the use of '..', although I certainly
appreciate the motivation to keep our tests working in --root mode.

 test/README|9 +
 test/basic |   10 +-
 test/crypto|2 +-
 test/emacs |4 ++--
 test/symbol-hiding |4 ++--
 test/test-lib.sh   |   18 +-
 6 files changed, 28 insertions(+), 19 deletions(-)

diff --git a/test/README b/test/README
index be75e0e..8fbf78d 100644
--- a/test/README
+++ b/test/README
@@ -41,6 +41,15 @@ The following command-line options are available when 
running tests:
As the names depend on the tests' file names, it is safe to
run the tests with this option in parallel.

+--root=::
+   This runs the testsuites specified under a seperate directory.
+   However, caution is advised, as not all tests are maintained
+   with this relocation in mind, so some tests may behave
+   differently.
+
+   Pointing this argument at a tmpfs filesystem can improve the
+   speed of the test suite for some users.
+
 When invoking the test suite via "make test" any of the above options
 can be specified as follows:

diff --git a/test/basic b/test/basic
index d6e8c10..33bf711 100755
--- a/test/basic
+++ b/test/basic
@@ -51,9 +51,9 @@ test_expect_code 2 'failure to clean up causes the test to 
fail' '

 # Ensure that all tests are being run
 test_begin_subtest 'Ensure that all available tests will be run by 
notmuch-test'
-eval $(sed -n -e '/^TESTS="$/,/^"$/p' notmuch-test ../notmuch-test)
+eval $(sed -n -e '/^TESTS="$/,/^"$/p' notmuch-test 
$TEST_DIRECTORY/notmuch-test)
 tests_in_suite=$(for i in $TESTS; do echo $i; done | sort)
-available=$(ls -1 ../ | \
+available=$(ls -1 $TEST_DIRECTORY/ | \
 sed -r -e 
"/^(aggregate-results.sh|Makefile|Makefile.local|notmuch-test)/d" \
   -e 
"/^(README|test-lib.sh|test-lib.el|test-results|tmp.*|valgrind|corpus*)/d" \
   -e 
"/^(emacs.expected-output|smtp-dummy|smtp-dummy.c|test-verbose|symbol-test.cc)/d"
 \
@@ -63,19 +63,19 @@ available=$(ls -1 ../ | \
   | sort)
 test_expect_equal "$tests_in_suite" "$available"

-EXPECTED=../test.expected-output
+EXPECTED=$TEST_DIRECTORY/test.expected-output
 suppress_diff_date() {
 sed -e 's/\(.*\-\-\- test-verbose\.4\.\expected\).*/\1/' \
-e 's/\(.*\+\+\+ test-verbose\.4\.\output\).*/\1/'
 }

 test_begin_subtest "Ensure that test output is suppressed unless the test 
fails"
-output=$(cd ..; ./test-verbose 2>&1 | suppress_diff_date)
+output=$(cd $TEST_DIRECTORY; ./test-verbose 2>&1 | suppress_diff_date)
 expected=$(cat $EXPECTED/test-verbose-no | suppress_diff_date)
 test_expect_equal "$output" "$expected"

 test_begin_subtest "Ensure that -v does not suppress test output"
-output=$(cd ..; ./test-verbose -v 2>&1 | suppress_diff_date)
+output=$(cd $TEST_DIRECTORY; ./test-verbose -v 2>&1 | suppress_diff_date)
 expected=$(cat $EXPECTED/test-verbose-yes | suppress_diff_date)
 # Do not include the results of test-verbose in totals
 rm $TEST_DIRECTORY/test-results/test-verbose-*
diff --git a/test/crypto b/test/crypto
index 01daffe..7eb3559 100755
--- a/test/crypto
+++ b/test/crypto
@@ -12,7 +12,7 @@ add_gnupg_home ()
 local output
 [ -d ${GNUPGHOME} ] && return
 mkdir -m 0700 "$GNUPGHOME"
-gpg --no-tty --import <../gnupg-secret-key.asc >"$GNUPGHOME"/import.log 
2>&1
+gpg --no-tty --import <$TEST_DIRECTORY/gnupg-secret-key.asc 
>"$GNUPGHOME"/import.log 2>&1
 test_debug "cat $GNUPGHOME/import.log"
 if (gpg --quick-random --version >/dev/null 2>&1) ; then
echo quick-random >> "$GNUPGHOME"/gpg.conf
diff --git a/test/emacs b/test/emacs
index 6f82b08..f91078e 100755
--- a/test/emacs
+++ b/test/emacs
@@ -2,7 +2,7 @@
 test_description="emacs interface"
 . test-lib.sh

-EXPECTED=../emacs.expected-output
+EXPECTED=$TEST_DIRECTORY/emacs.expected-output

 add_email_corpus

@@ -81,7 +81,7 @@ mkdir -p mail/sent/cur
 mkdir -p mail/sent/new
 mkdir -p mail/sent/tmp

-../smtp-dummy sent_message &
+$TEST_DIRECTORY/smtp-dummy sent_message &
 smtp_dummy_pid=$!
 test_emacs "(setq message-send-mail-function 'message-smtpmail-send-it) (setq 
smtpmail-smtp-server \"localhost\") (setq smtpmail-smtp-service \"25025\") 
(notmuch-hello) (notmuch-mua-mail) (message-goto-to) (insert \"user at 
example.com\nDate: Fri, 29 Mar 1974 10:00:00 -\") (message-goto-subject) 
(insert \"Testing message sent via SMTP\") (message-goto-body) (insert \"This 
is a test that 

[PATCH 10/10] test: use emacsclient(1) for Emacs tests

2011-06-28 Thread Carl Worth
On Tue, 28 Jun 2011 08:45:11 +0400, Dmitry Kurochkin  wrote:
> Before the change, every Emacs test ran in a separate Emacs
> instance.  Starting Emacs many times wastes considerable time and
> it gets worse as the test suite grows.  The patch solves this by
> using a single Emacs server and emacsclient(1) to run multiple
> tests. 

Great, great stuff, Dmitry!

I've pushed everything earlier than this patch in this series.

And I'd be fine pushing this one as well, (if Austin cares strongly
about not polling, I'll invite him to improve things from here).

Except that things don't actually work for me with this patch applied.

I'm not getting consistent results from the test suite, (I have seen
both "2 tests failed" and "5 tests failed"). Here are the failures from
a recent run with 5 failures:

 FAIL   decryption, --format=text
 FAIL   decryption, --format=json
 FAIL   decryption, --format=json, --part=4
 FAIL   decrypt attachment (--part=5 --format=raw)
 FAIL   decryption failure with missing key

In each case the actual output was either empty, or an empty JSON
array. In some cases notmuch also gave an error:

Error: search term did not match precisely one message.

Are you not getting these same failures?

Let me know what else I can do to investigate this.

-Carl

-- 
carl.d.worth at intel.com
-- next part --
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: 
<http://notmuchmail.org/pipermail/notmuch/attachments/20110628/91bc0251/attachment.pgp>


Drafts being tagged as inbox

2011-06-28 Thread Carl Worth
On Tue, 28 Jun 2011 08:00:53 +0100, Robin Green  wrote:
> On Tue, 28 Jun 2011 08:34:44 +0200, Pieter Praet  wrote:
> > notmuch tag -inbox +draft -- folder:${where_your_drafts_reside}
> 
> My notmuch help does not mention "folder:", and indeed folder:drafts as a
> search term is just treated as the words folder and drafts. Perhaps this
> is implemented in git head.

Yes, sorry about that. We're woefully late on a release that will
include this feature. Our current release manager expects that release
within a couple of days at least, so that's good!

> However, when I try to compile git head on Dragonfly BSD, I get this error:
>
> CXX -O2 notmuch-shared
> notmuch-count.o: In function `notmuch_count_command':
> notmuch-count.c:(.text+0x63): undefined reference to `notmuch_database_open'
> notmuch-count.c:(.text+0x9d): undefined reference to `notmuch_query_create'

Ouch. It looks like your linker isn't finding anything in the notmuch
library at all. I wonder what went wrong there. Some things to try would
be:

make V=1

to see the complete linker command line to see if something is obviously
wrong there.

And otherwise to try a "git bisect" to see when the compilation stopped
working.

To start a bisect, you'll need to know a point where notmuch actually
compiles successfully on your system?0.5 perhaps? Double-check that
with:

git checkout 0.5# Get the code from the 0.5 release
make# See if it compiles
git checkout master # Come back to master

If that went fine then you can bisect with:

git bisect start
git bisect good 0.5 # Indicate that 0.5 is good
git bisect bad  # Indicate that the current state is bad

After that you'll iterate by running:

make

Followed by one of the following:

git bisect good # If the compile succeeded
git bisect bad  # If the compile failed

In the end, git should tell you a "first bad commit". Send that output
to the list and we can start pinning down what went wrong. Then you can
finalize your git-bisect run with:

git bisect reset

Good luck!

-Carl
-- next part --
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: 
<http://notmuchmail.org/pipermail/notmuch/attachments/20110628/ac46e905/attachment.pgp>


Drafts being tagged as inbox

2011-06-28 Thread Carl Worth
On Mon, 27 Jun 2011 22:50:25 +0100, Robin Green  wrote:
> My drafts (created using emacs message mode) are being tagged as
> inbox. However, they are not tagged as drafts. This is because emacs
> message mode does not store drafts in Maildir format, so there are no
> Maildir flags (e.g. D for draft) to sync tags with.
> 
> Now, I could simply store drafts somewhere else, but then I wouldn't be
> able to search them using notmuch. Is there another way to have drafts
> correctly tagged?

Notmuch isn't much involved in the current saving of drafts, so if we
wanted to do something like save drafts to a maildir instead, we could
override the buffer-saving functions in our message-composition buffers.

Meanwhile, even without a tag, I do like that my drafts are currently
getting indexed by notmuch and show up in search results, (they even
show up with a timestamp of 0 so accidentally get sorted right to the
top of many search results). That's convenient.

Even handier would be a separate notmuch-hello search result showing me
I have some drafts to complete, (which would then, benefit from a tag).

The biggest annoyance I currently have with drafts is that they aren't
automatically removed from the filesystem when I finally send the
message. If someone were to contribute a fix for that, it would really
make my day.

-Carl

-- 
carl.d.worth at intel.com
-- next part --
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: 
<http://notmuchmail.org/pipermail/notmuch/attachments/20110628/9451691f/attachment.pgp>


[PATCH] test:Improve test behaviors when --root is used

2011-06-28 Thread Carl Worth
On Mon, 27 Jun 2011 17:03:03 -0600, Mark Anderson  
wrote:
> On Mon, 27 Jun 2011 15:50:47 -0500, Austin Clements  
> wrote:
> > This looks great (modulo one bug, below).  I've wanted to run the
> > tests on tmpfs before, but was too lazy to actually fix the tests.

Yes, it does look great. Thanks for the patch, Mark!

Did you miss Austin's note about a possible bug? (You quoted it but
didn't reply). See below:

> > > ?run_test(){
> > > - ? ?result=$(LD_LIBRARY_PATH=../../lib ./symbol-test 2>&1)
> > > + ? ?result=$(LD_LIBRARY_PATH=$TEST_DIRECTORY/../../lib ./symbol-test 
> > > 2>&1)
> > 
> > Did you mean $TEST_DIRECTORY/../lib?

If you could follow up with an updated patch, (or an argument that the
original patch is correct), that would be great.

-Carl

-- 
carl.d.worth at intel.com
-- next part --
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: 
<http://notmuchmail.org/pipermail/notmuch/attachments/20110628/c60d2f39/attachment.pgp>


notmuch Digest, Vol 20, Issue 57

2011-06-28 Thread Carl Worth
On Mon, 27 Jun 2011 09:43:41 +0200, Sander Boer  wrote:
> For instance, is this a possibility sync gmail tags with notmuch tags ?
> As fas as I am aware Gmail exposes its tags through imap folders, I am
> not too thrilled about the mixing of paradigms (folders vs tags) and it
> would be great if it could be aligned.

I'm not a gmail user myself, but I can describe some of the options
available.

First, it's important to understand that any friction here comes from
Gmail exposing its tags as folders, (which in turn could be the lack of
availability of a more tag-aware protocol than imap).

So, let's say you've done an imap-based fetch of all of your mail and
now have it in several folders corresponding to the various tags you
made in the Gmail interface, (and you've run "notmuch new" to create a
notmuch database of all of that).

At that point, you can search (with current notmuch from git---and soon
to be released as notmuch 0.6) on the folder names. This allows you to
do a search based on a Gmail tag. For example, you might have an
"important" tag in Gmail which you could search with:

notmuch search folder:important

If you wanted to make an actual notmuch tag based on those search
results, you could do that as well:

notmuch tag +important folder:important

And you could even do that on a regular basis, (for example in some
script that sucks down new email from Gmail). In this case you might
want to avoid re-tagging pre-tagged mail by amending the search terms:

notmuch tag +important folder:important and not tag:important

(Note that this is an optimization that notmuch could be making
automatically, and that's something I'd love to see happen in notmuch at
some point.)

Hopefully it's clear enough that you could do the above in a script that
loops over all of your existing tags.

And if you were doing a one-time switch from Gmail to notmuch that would
be all you would need.

I don't know if you're looking to also push tags added via some notmuch
interface back to Gmail, (does Gmail even provide a mechanism for doing
that?). If so, then you'd need something that took notmuch tags and made
copies of the message in the appropriate files. That would hopefully be
easy to script based on the output of:

notmuch search --output=files tag:important

I think my short answer is that it's fairly easy to convert from Gmail
tags to notmuch tags as part of a one-time import. Doing this on a
continual basis might benefit from writing a few scripts, and I don't
know if anyone has written those scripts yet.

Would any Gmail+notmuch users care to add anything to the conversation?

-Carl

-- 
carl.d.worth at intel.com
-- next part --
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: 
<http://notmuchmail.org/pipermail/notmuch/attachments/20110628/147c3670/attachment-0001.pgp>


[PATCH 2/2] test: use emacsclient(1) for Emacs tests

2011-06-28 Thread Carl Worth
On Tue, 28 Jun 2011 20:42:42 +0400, Dmitry Kurochkin  wrote:
> I would like to hear what other (Carl in particular) think about this.
> If the consensus is for your approach, I would be happy to implement
> it.

In general, I love the whole series, thanks! I'm looking forward to our
future, faster test suite.

Even more, I love the constructive dialog that follows the original
series and the attention being focused on getting things right.

As for the detail of whether to use emacsclient or Austin's look-alike,
I don't have a strong attachment to either solution. I do appreciate
concrete technical things like "robust against recycled PIDs", "more
robust against leaving daemon's around for some reason", etc.

Would any of this potentially interfere with my own usage of emacsclient
and emacs server? I use them regularly and would be quite surprised (and
likely frustrated) if the test suite got mixed up with my existing emacs
server (or the other way around). Maybe that's already taken care of
with either approach? (A quick skim of the emacsclient manual age didn't
make it obvious to me how emacslcient finds its server.)

-Carl

-- 
carl.d.worth at intel.com
-- next part --
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: 
<http://notmuchmail.org/pipermail/notmuch/attachments/20110628/a65483ac/attachment.pgp>


Race condition for '*' command

2011-06-28 Thread Carl Worth
On Tue, 28 Jun 2011 11:36:10 -0600, Mark Anderson  wrote:
> On Tue, 28 Jun 2011 08:49:06 +0200, Pieter Praet  wrote:
> > On Sun, 26 Jun 2011 10:00:41 +0100, Robin Green  
> > wrote:
> > > On Sat, 25 Jun 2011 16:57:50 -0700, Jameson Graef Rollins  > > finestructure.net> wrote:
> > > > On Sat, 25 Jun 2011 23:18:52 +0100, Robin Green  > > > greenrd.org> wrote:
> > > > > A race condition in the '*' command was noted when it was first
> > > > > proposed. It looks to me like it still exists - has anything been done
> > > > > about it?

Not much. I did add this note to notmuch/TODO at the time:

Fix '*' to work by simply calling '+' or '-' on a region
consisting of the entire buffer

> > Could be solved by doing it with `notmuch-search', `mark-whole-buffer'
> > and `notmuch-search-{add,remove}-tag-region' instead, but I'm sure
> > there's a better way (of which I'm as of yet unaware).

That's a more concrete description of the same idea.

I did some experiments at one point and determined that doing this would
make '*' far too painful to be usable with large search-result buffers,
(which is precisely when I am most likely to use it).

But even if we were willing to accept the performance penalty, (or if we
fixed notmuch-search-*-tag-region to accumulate the thread IDs and make
a single invocation of notmuch to avoid the performance penalty). Even
then, there would still be race conditions here, (though more subtle
than the current race).

At that point we would only be acting on threads that matched the
original search, but we could be acting on more messages than were
originally presented to the user.

For example, a thread might have been displayed as having only one post,
but the "* -inbox" operation would remove the inbox tag from any replies
received in the interim.

I'd love to find some clean solutions here, as I would love notmuch to
offer an interface that is free of these race conditions, (which are
scary since they can prevent a user from seeing some mail).

Personally, I'm avoiding all races right now by only running "notmuch
new" manually, (and not otherwise interacting with notmuch while
"notmuch new" is running). This does avoid the races, but is fairly
awkward, (I have to manually run this (or use the annoyingly blocking
'G'[*] binding), so I would prefer the ability to have new mail
incorporated automatically as it arrives.

Independent of this particular race condition, having something like
fetchmail automatically invoke "notmuch new" also has the potential to
break your mail client with Xapian Database-modified exceptions.

So we do need some more direct support for this mode of operation.

In the meantime, I've at least updated the TODO note a bit:

Fix '*' to work by simply calling '+' or '-' on a region
consisting of the entire buffer, (this would avoid one race
condition---while still leaving other race conditions---but
could also potentially make '*' a very expensive operation).

-Carl

[*] notmuch-search-poll-and-refresh-view

-- 
carl.d.worth at intel.com
-- next part --
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: 
<http://notmuchmail.org/pipermail/notmuch/attachments/20110628/b2a5ff0f/attachment.pgp>


Debian package not building

2011-06-28 Thread Carl Worth
On Fri, 24 Jun 2011 16:34:02 -0700, Jameson Graef Rollins  wrote:
> Hey, folks.  As of today I am for some reason no longer able to build
> the Notmuch Debian package.  I'm using the same build technique I have
> been using for a while (git-buildpackage).  The tail of the failing
> build log is pasted at the bottom of this message.  Is anyone else
> encountering anything like this?

I use git-buildpackage as well. I did recently need to "apt-get install
python-all" for a recent build-dependency addition. But I'm not getting
any failure like you are getting here.

> I did recently do a system upgrade, so it's
> possible that something there could have caused the problem.

For what it's worth, I did hit some recent problems when doing a Debian
upgrade of libc6. The problem I hit manifested itself much worse, (no
dynamically-linked programs would run). That bug (and its fix) is
described here:

http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=629534

I don't know if it's related to your problem at all, but it's certainly
possible that something unrelated to notmuch is causing the failure
you're getting.

-Carl

-- 
carl.d.worth at intel.com
-- next part --
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: 
<http://notmuchmail.org/pipermail/notmuch/attachments/20110628/c276c239/attachment.pgp>


[PATCH 2/2] test: use emacsclient(1) for Emacs tests

2011-06-28 Thread Austin Clements
Quoth myself on Jun 27 at 11:49 pm:
> Quoth Dmitry Kurochkin on Jun 28 at  5:03 am:
> EMACSDONE=$TEST_DIRECTORY/emacsdone
> mkfifo $EMACSDONE
> coproc emacs --batch --eval '(while t (eval (read)) (write-region "\n" nil 
> "'$EMACSDONE'" t 0))'
> EMACSFD=${COPROC[1]}
> 
> test_emacs() {
> echo "$1" >&$EMACSFD
> read <$EMACSDONE
> }
> 
> test_emacs '(sleep-for 2)'
> test_emacs '(message "Hi")'
> 
> echo '(kill-emacs)' >&$EMACSFD

Oops, got a little overzealous with TEST_DIRECTORY.  For reference,
the pipe should, of course, have gone in the current directory (or
TMP_DIRECTORY).

mkfifo emacsdone
coproc emacs --batch --eval '(while t (eval (read)) (write-region "\n" nil 
"emacsdone" t 0))'
EMACSFD=${COPROC[1]}

test_emacs() {
echo "$1" >&$EMACSFD
read < emacsdone
}


(I don't really see how that could be either more shell code or more
elisp code than using emacsclient plus cleanup code [nor why it
matters for five lines of code], but I'm probably missing something.)


[PATCH 2/2] search --output=files: Output all filenames for each matching message

2011-06-28 Thread Carl Worth
On Tue, 28 Jun 2011 12:12:52 -0700, Carl Worth  wrote:
> I think the only thing I would like to see in addition is an update to
> the documentation to make it explicit that --output=files will emit all
> filenames for a message that has more than one filename.

Actually, I went to go update the documentation itself, and I found that
it doesn't really need anything new here. The current text is:

--output=files

Output the filenames of all messages matching the search terms,
either one per line (--format=text) or as a JSON array
(--format=json).

And that's pretty clearly "the filenames of all messages".

The fact that we share a single "message object" when two files contain
the same message-id seems like an implementation detail that's not worth
bringing up here. (It would add more concepts to the documentation but
not actually change the meaning.)

So I've pushed the test and fix as-is now.

-Carl

-- 
carl.d.worth at intel.com
-- next part --
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: 
<http://notmuchmail.org/pipermail/notmuch/attachments/20110628/5fabd97a/attachment.pgp>


[PATCH 2/2] search --output=files: Output all filenames for each matching message

2011-06-28 Thread Carl Worth
On Fri, 24 Jun 2011 17:26:55 -0600, Mark Anderson  wrote:
> Messages in the database can have multiple files associated with a
> single message-id, but until now only one filename for each message
> has been reported by "notmuch search --output=files"

Hi Mark,

Thanks for contributing this patch!

I know from a conversation we had in IRC that you needed this feature to
track down a bug you were hitting. Thanks for going the extra mile to
write a new test case and a complete patch for the new feature.

I think the only thing I would like to see in addition is an update to
the documentation to make it explicit that --output=files will emit all
filenames for a message that has more than one filename.

> Perhaps someone can offer a little help making the "separator" code
> tighter, but this works.

It's amazing how painful it is to get the corner cases right here, isn't
it? It's almost enough to make me wish that we allowed trailing
separators as a standard element of style in conventional prose. [*]

-Carl

[*] Though if I had that wish, I'd also want to wish for the abolition
of any distinction for singular and plural nouns. The code to generate
messages like the following is a pain to write:

Processed 1 file in almost no time.
Added 1 new message to the database. Removed 1 message.

(And that's without even adding support for translations which would
further complicate this.) Ah, well, the price we pay to make code with
clean output.

-- 
carl.d.worth at intel.com
-- next part --
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: 
<http://notmuchmail.org/pipermail/notmuch/attachments/20110628/464837b9/attachment.pgp>


[PATCH] libnotmuch: build symbols list without relying on gcc -aux-info.

2011-06-28 Thread Carl Worth
On Sun, 26 Jun 2011 23:42:25 -0300, david at tethera.net wrote:
>  Here is another way of doing this, probably better unless you are
>  very attached to the idea of declaring the API in the header file.

Thanks for both of these, David. I've gone ahead and pushed the first,
(generating the symbol list with sed and notmuch.h).

I assume by "better" you mean that this one is less fragile to issues
like the precise formatting of our notmuch.h header file.

Meanwhile, though, our API *is* declared in the header file, (that's
what the header file exists for), so I do prefer to base our symbol list
on it.

In fact, the ideal would probably be to take the objdump method and use
it in the test suite to verify that its output matches the contents of
notmuch.sym generated from the header file.

-Carl

-- 
carl.d.worth at intel.com
-- next part --
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: 
<http://notmuchmail.org/pipermail/notmuch/attachments/20110628/970e7520/attachment.pgp>


[PATCH] libnotmuch: fix typos in CLEAN setting, add file

2011-06-28 Thread Carl Worth
On Sat, 25 Jun 2011 09:45:58 -0300, david at tethera.net wrote:
> Here is an updated version.

Thanks. I've committed this now, (waiting to be pushed until I fix my
build---the symbols stuff---so I can actually run "make test" again).

> I'm not sure the best way to do a test of
> the cleaning; maybe we should ship a MANIFEST file containing the
> output of git ls-files. I'm not sure how much churn this would cause
> in git.  Perhaps it could be treated like version, and generated from
> git if possible.

Definitely wouldn't want a generated file under revision control. It
would be possible to just run "git ls-files" if we're in a git
repository and skip the test otherwise. Or...

> In any case I guess this couldn't really be part of
> our regular test suite, because all the other tests would fail ;).

Heh, that would be a bad failure mode. :-)

The typical way to do this (as far as I understand) is as part of "make
distcheck". The idea there is to make a tar file; verify that the tar
file can be unpacked, configured, built, and installed; and then to
verify that "make distclean" returns the directory to the same state as
just after having unpacked the tar file.

I'm not really all that concerned about it though. We don't add/remove
files all that often, and it's generally not too bad of a failure mode
if "make clean" isn't perfect.

So if someone added testing for this, that would be fine, but it's not a
high priority for me.

-Carl

-- 
carl.d.worth at intel.com
-- next part --
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: 
<http://notmuchmail.org/pipermail/notmuch/attachments/20110628/d5138233/attachment.pgp>


Race condition for '*' command

2011-06-28 Thread Mark Anderson
On Tue, 28 Jun 2011 08:49:06 +0200, Pieter Praet  wrote:
> On Sun, 26 Jun 2011 10:00:41 +0100, Robin Green  
> wrote:
> > On Sat, 25 Jun 2011 16:57:50 -0700, Jameson Graef Rollins  > finestructure.net> wrote:
> > > On Sat, 25 Jun 2011 23:18:52 +0100, Robin Green  
> > > wrote:
> > > > A race condition in the '*' command was noted when it was first
> > > > proposed. It looks to me like it still exists - has anything been done
> > > > about it?
> > > 
> > > Hi, Robin.  Can you explain what you mean by the "'*' command"?
> > 
> > Sorry - forgot to say I'm talking about the notmuch emacs mode. In that
> > mode '*' applies tags to all messages matching the current search query,
> > which means that (here's the race condition) new results that have
> > appeared since the last refresh will also be tagged.
> 
> This issue appears to stem from the fact that `notmuch-search-operate-all'
> runs (apply 'notmuch-tag notmuch-search-query-string action-split), in which
> `notmuch-search-query-string' points to a moving target.
> 
> Could be solved by doing it with `notmuch-search', `mark-whole-buffer'
> and `notmuch-search-{add,remove}-tag-region' instead, but I'm sure
> there's a better way (of which I'm as of yet unaware).

I don't think there's a better way, the results which the user is
viewing is the only visual reference for what the action they intend to
apply will use as the object of said action.  I can imagine some people
wanting to have a way to apply an action to a live query string, but I
distinguish between these people and normal humans reading their email.
I expect that when a normal human is reading their email, they do not
intend to apply actions to messages as yet unseen.

I can see some people using the '*' notmuch emacs command as a very
interactive notmuch-poll.sh script.  But I imagine the principle of
least surprise would be to have '*' only apply to visible messages, and
if the buffer is old, the buffer is the only record of what is being
viewed.

-Mark

> 
> > -- 
> > Robin
> > ___
> > notmuch mailing list
> > notmuch at notmuchmail.org
> > http://notmuchmail.org/mailman/listinfo/notmuch
> 
> Peace
> 
> -- 
> Pieter
> ___
> notmuch mailing list
> notmuch at notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch


Notmuch scripts

2011-06-28 Thread Pieter Praet
On Mon, 27 Jun 2011 21:31:26 -0400, Ben Gamari  
wrote:
> [SNIP] It
> would be nice, however, if the emacs interface supported hiding tags
> matching certain patterns (say /\..+/).

This should be possible as of last month (eb4e0ea2),
by courtesy of Daniel Schoepe [1].

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


Peace

-- 
Pieter


[1] id:"87fwoath2s.fsf at gilead.home.box"


bug in emacs-ui ?

2011-06-28 Thread Jani Nikula
Carl Worth  writes:

> 
> On Wed, 22 Jun 2011 08:50:23 +0200, Sebastien Binet
>  wrote:
> > On Tue, 21 Jun 2011 15:09:20 -0700, Carl Worth  wrote:
> > > Perhaps this is an emacs bug?
> > could be, but,
> > 
> > > I'm using Debian's emacs 23.3.1 and have not encountered the problem
> > > described.
> > I don't see anything related to 'point', 'point-invisible-p' nor
'forward-char' in there:
> > http://patch-tracker.debian.org/package/emacs23/23.3+1-1
> 
> Perhaps I was confused. I thought 23.3.1 was a distinct upstream release
> From 23.3, but maybe not, (emacs version numbers use 1-based indexing
> perhaps?).
> 
> > anyways... for the moment I'll just live with it...
> 
> Sorry about that.
> 
> > except if somebody has some insights on how to "catch" the 'End of
> > buffer' error and add some more protective programming around the
> > 'scroll-up' function ?
> 
> My emacs lisp skills are primarily restricted to actual
> experimentation. So if I can replicate the bug, I might be able to find
> a fix. I'm not very good at doing theoretical fixes with emacs lisp
> code.

I bisected the problem to commit 95ef8da29439f2e79115c36ab4d2a80aef1a1462 ("Fix
hiding a message while some citations are shown in notmuch-show view").
Reverting that fixes the problem for me. (If you don't want to resolve
conflicts, also revert 432e091924c1d1d8950a44ca78bc5b9c5ade47e4 first.) I don't
have the time just now to try to figure out the problem in that, but perhaps
this will help others go forward.

Jani




Drafts being tagged as inbox

2011-06-28 Thread Pieter Praet
On Tue, 28 Jun 2011 08:00:53 +0100, Robin Green  wrote:
> On Tue, 28 Jun 2011 08:34:44 +0200, Pieter Praet  wrote:
> > notmuch tag -inbox +draft -- folder:${where_your_drafts_reside}
> 
> My notmuch help does not mention "folder:", and indeed folder:drafts as a
> search term is just treated as the words folder and drafts. Perhaps this
> is implemented in git head. However, when I try to compile git head on
> Dragonfly BSD, I get this error:
> 
> [SNIP]

Hmmm, rather anticlimactic.

Can't help you with the errors nor give you an exact bearing, but
folder-based search was implemented around January this year, and I can
definitely vouch for commit 0c0b4172 (got a few old branches based
there).

Peace

-- 
Pieter


[PATCH] fix sum moar typos

2011-06-28 Thread Pieter Praet
On Mon, 27 Jun 2011 14:17:27 -0700, Carl Worth  wrote:
Non-text part: multipart/signed
> On Fri, 24 Jun 2011 22:04:13 +0200, Pieter Praet  wrote:
> > You however, seem to be incredibly disciplined in this respect,
> > so statistically speaking, you're destined to become typo-king,
> > and you have every reason to be *proud* of it. :D
> 
> Thanks for the compliment (even if sideways)! I enjoyed the laugh.
> 
> > The only thing you could possibly have to be embarrassed about,
> > is insufficient laziness (which, for programmers, is considered a
> > virtue) ;)
> 
> And thanks as well for the gentle chiding. I hope to benefit from it.

I hope so as well.

I mean, it's okay to be enterprising, but imagine what would become of
our noble profession (nay, the world!) if we forgot to -now and again-
remind one another to maintain adequately lofty levels of laziness?

It would upheave the very foundation on which Computer Science (and all
it entails, which is pretty much everything these days) was built!

I'm prepared though, I've got a sizable amount of post doves buried
in the backyard, just in case. Which reminds me, I should check their
expiration dates one of these days.

> -Carl
> 
> -- 
> carl.d.worth at intel.com
Non-text part: application/pgp-signature


Peace

-- 
Pieter


Notmuch scripts

2011-06-28 Thread Ben Gamari
On Tue, 28 Jun 2011 10:36:59 +0200, Pieter Praet  wrote:
> On Mon, 27 Jun 2011 21:31:26 -0400, Ben Gamari  
> wrote:
> > [SNIP] It
> > would be nice, however, if the emacs interface supported hiding tags
> > matching certain patterns (say /\..+/).
> 
> This should be possible as of last month (eb4e0ea2),
> by courtesy of Daniel Schoepe [1].
> 
Thanks for your note, althought it appears this only appears to apply to
the notmuch-hello all-tags list. I was hoping one could hide tag
patterns from all lists (or at least search results). This is definitely
a good first step, however.

Cheers,

- Ben


[PATCH] test: use emacsclient(1) for Emacs tests

2011-06-28 Thread Dmitry Kurochkin
Before the change, every Emacs test ran in a separate Emacs
instance.  Starting Emacs many times wastes considerable time and
it gets worse as the test suite grows.  The patch solves this by
using a single Emacs server and emacsclient(1) to run multiple
tests.  Emacs server is started on the first test_emacs call and
stopped when test_done is called.  We take care not to leave
orphan Emacs processes behind when test is terminated by whatever
reason: Emacs server runs a watchdog that periodically checks
that the test is still running.

Some tests need to provide user input.  Before the change, this
was done using echo(1) to Emacs stdin.  This no longer works and
instead `standard-input' variable is set accordingly to make
`read' return the appropriate string.
---

Amended patch with a more appropriate Emacs server name.  Sorry,
for inconvenience, should go to sleep.

Regards,
  Dmitry

 test/emacs   |   10 +-
 test/test-lib.el |   13 +
 test/test-lib.sh |   24 +---
 3 files changed, 31 insertions(+), 16 deletions(-)

diff --git a/test/emacs b/test/emacs
index 3d42645..0f5f99c 100755
--- a/test/emacs
+++ b/test/emacs
@@ -259,15 +259,15 @@ test_expect_equal_file OUTPUT EXPECTED

 test_begin_subtest "Save attachment from within emacs using 
notmuch-show-save-attachments"
 # save as archive to test that Emacs does not re-compress .gz
-echo ./attachment1.gz |
-test_emacs '(notmuch-show "id:cf0c4d610911171136h1713aa59w9cf9aa31f052ad0a at 
mail.gmail.com")
-   (notmuch-show-save-attachments)' > /dev/null 2>&1
+test_emacs '(let ((standard-input "\"attachment1.gz\""))
+ (notmuch-show "id:cf0c4d610911171136h1713aa59w9cf9aa31f052ad0a at 
mail.gmail.com")
+ (notmuch-show-save-attachments))' > /dev/null 2>&1
 test_expect_equal_file attachment1.gz "$EXPECTED/attachment"

 test_begin_subtest "Save attachment from within emacs using 
notmuch-show-save-part"
 # save as archive to test that Emacs does not re-compress .gz
-echo ./attachment2.gz |
-test_emacs '(notmuch-show-save-part 
"id:cf0c4d610911171136h1713aa59w9cf9aa31f052ad0a at mail.gmail.com" 5)' > 
/dev/null 2>&1
+test_emacs '(let ((standard-input "\"attachment2.gz\""))
+ (notmuch-show-save-part 
"id:cf0c4d610911171136h1713aa59w9cf9aa31f052ad0a at mail.gmail.com" 5))' > 
/dev/null 2>&1
 test_expect_equal_file attachment2.gz "$EXPECTED/attachment"

 test_begin_subtest "View raw message within emacs"
diff --git a/test/test-lib.el b/test/test-lib.el
index 4e7f5cf..a783936 100644
--- a/test/test-lib.el
+++ b/test/test-lib.el
@@ -23,6 +23,12 @@
 ;; avoid crazy 10-column default of --batch
 (set-frame-width (window-frame (get-buffer-window)) 80)

+;; `read-file-name' by default uses `completing-read' function to read
+;; user input.  It does not respect `standard-input' variable which we
+;; use in tests to provide user input.  So replace it with a plain
+;; `read' call.
+(setq read-file-name-function (lambda ( _) (read)))
+
 (defun notmuch-test-wait ()
   "Wait for process completion."
   (while (get-buffer-process (current-buffer))
@@ -51,3 +57,10 @@ FILENAME is OUTPUT."
  (setq str (concat str (buffer-substring start next-pos
(setq start next-pos)))
 str))
+
+(defun orphan-watchdog (pid)
+  "Periodically check that the process with id PID is still
+running, quit if it terminated."
+  (if (not (process-attributes pid))
+  (kill-emacs)
+(run-at-time "1 min" nil 'orphan-watchdog pid)))
diff --git a/test/test-lib.sh b/test/test-lib.sh
index 48bace2..bcf18ec 100755
--- a/test/test-lib.sh
+++ b/test/test-lib.sh
@@ -829,6 +829,8 @@ test_done () {

echo

+   [ -n "$EMACS_SERVER" ] && test_emacs '(kill-emacs)'
+
if [ "$test_failure" = "0" ]; then
if [ "$test_broken" = "0" ]; then   
rm -rf "$remove_tmp"
@@ -848,16 +850,8 @@ emacs_generate_script () {
 export PATH=$PATH
 export NOTMUCH_CONFIG=$NOTMUCH_CONFIG

-# We assume that the user will give a command-line argument only if
-# wanting to run in batch mode.
-if [ \$# -gt 0 ]; then
-   BATCH=--batch
-fi
-
 # Here's what we are using here:
 #
-# --batch: Quit after given commands and print all (messages)
-#
 # --no-init-file   Don't load users ~/.emacs
 #
 # --no-site-file   Don't load the site-wide startup stuff
@@ -866,16 +860,24 @@ fi
 #
 # --load   Force loading of notmuch.el and test-lib.el

-emacs \$BATCH --no-init-file --no-site-file \
+emacs --no-init-file --no-site-file \
--directory "$TMP_DIRECTORY/../../emacs" --load notmuch.el \
--directory "$TMP_DIRECTORY/.." --load test-lib.el \
-   --eval "(progn \$@)"
+   "\$@"
 EOF
chmod a+x "$TMP_DIRECTORY/run_emacs"
 }

 test_emacs () {
-   "$TMP_DIRECTORY/run_emacs" "$@"
+   if [ -z "$EMACS_SERVER" ]; then
+   EMACS_SERVER="notmuch-test-suite-$$"
+   "$TMP_DIRECTORY/run_emacs" \
+   

Race condition for '*' command

2011-06-28 Thread Pieter Praet
On Sun, 26 Jun 2011 10:00:41 +0100, Robin Green  wrote:
> On Sat, 25 Jun 2011 16:57:50 -0700, Jameson Graef Rollins  finestructure.net> wrote:
> > On Sat, 25 Jun 2011 23:18:52 +0100, Robin Green  
> > wrote:
> > > A race condition in the '*' command was noted when it was first
> > > proposed. It looks to me like it still exists - has anything been done
> > > about it?
> > 
> > Hi, Robin.  Can you explain what you mean by the "'*' command"?
> 
> Sorry - forgot to say I'm talking about the notmuch emacs mode. In that
> mode '*' applies tags to all messages matching the current search query,
> which means that (here's the race condition) new results that have
> appeared since the last refresh will also be tagged.

This issue appears to stem from the fact that `notmuch-search-operate-all'
runs (apply 'notmuch-tag notmuch-search-query-string action-split), in which
`notmuch-search-query-string' points to a moving target.

Could be solved by doing it with `notmuch-search', `mark-whole-buffer'
and `notmuch-search-{add,remove}-tag-region' instead, but I'm sure
there's a better way (of which I'm as of yet unaware).

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

Peace

-- 
Pieter


[PATCH 10/10] test: use emacsclient(1) for Emacs tests

2011-06-28 Thread Dmitry Kurochkin
Before the change, every Emacs test ran in a separate Emacs
instance.  Starting Emacs many times wastes considerable time and
it gets worse as the test suite grows.  The patch solves this by
using a single Emacs server and emacsclient(1) to run multiple
tests.  Emacs server is started on the first test_emacs call and
stopped when test_done is called.  We take care not to leave
orphan Emacs processes behind when test is terminated by whatever
reason: Emacs server runs a watchdog that periodically checks
that the test is still running.

Some tests need to provide user input.  Before the change, this
was done using echo(1) to Emacs stdin.  This no longer works and
instead `standard-input' variable is set accordingly to make
`read' return the appropriate string.
---
 test/emacs   |   10 +-
 test/test-lib.el |   13 +
 test/test-lib.sh |   24 +---
 3 files changed, 31 insertions(+), 16 deletions(-)

diff --git a/test/emacs b/test/emacs
index 3d42645..0f5f99c 100755
--- a/test/emacs
+++ b/test/emacs
@@ -259,15 +259,15 @@ test_expect_equal_file OUTPUT EXPECTED

 test_begin_subtest "Save attachment from within emacs using 
notmuch-show-save-attachments"
 # save as archive to test that Emacs does not re-compress .gz
-echo ./attachment1.gz |
-test_emacs '(notmuch-show "id:cf0c4d610911171136h1713aa59w9cf9aa31f052ad0a at 
mail.gmail.com")
-   (notmuch-show-save-attachments)' > /dev/null 2>&1
+test_emacs '(let ((standard-input "\"attachment1.gz\""))
+ (notmuch-show "id:cf0c4d610911171136h1713aa59w9cf9aa31f052ad0a at 
mail.gmail.com")
+ (notmuch-show-save-attachments))' > /dev/null 2>&1
 test_expect_equal_file attachment1.gz "$EXPECTED/attachment"

 test_begin_subtest "Save attachment from within emacs using 
notmuch-show-save-part"
 # save as archive to test that Emacs does not re-compress .gz
-echo ./attachment2.gz |
-test_emacs '(notmuch-show-save-part 
"id:cf0c4d610911171136h1713aa59w9cf9aa31f052ad0a at mail.gmail.com" 5)' > 
/dev/null 2>&1
+test_emacs '(let ((standard-input "\"attachment2.gz\""))
+ (notmuch-show-save-part 
"id:cf0c4d610911171136h1713aa59w9cf9aa31f052ad0a at mail.gmail.com" 5))' > 
/dev/null 2>&1
 test_expect_equal_file attachment2.gz "$EXPECTED/attachment"

 test_begin_subtest "View raw message within emacs"
diff --git a/test/test-lib.el b/test/test-lib.el
index 4e7f5cf..a783936 100644
--- a/test/test-lib.el
+++ b/test/test-lib.el
@@ -23,6 +23,12 @@
 ;; avoid crazy 10-column default of --batch
 (set-frame-width (window-frame (get-buffer-window)) 80)

+;; `read-file-name' by default uses `completing-read' function to read
+;; user input.  It does not respect `standard-input' variable which we
+;; use in tests to provide user input.  So replace it with a plain
+;; `read' call.
+(setq read-file-name-function (lambda ( _) (read)))
+
 (defun notmuch-test-wait ()
   "Wait for process completion."
   (while (get-buffer-process (current-buffer))
@@ -51,3 +57,10 @@ FILENAME is OUTPUT."
  (setq str (concat str (buffer-substring start next-pos
(setq start next-pos)))
 str))
+
+(defun orphan-watchdog (pid)
+  "Periodically check that the process with id PID is still
+running, quit if it terminated."
+  (if (not (process-attributes pid))
+  (kill-emacs)
+(run-at-time "1 min" nil 'orphan-watchdog pid)))
diff --git a/test/test-lib.sh b/test/test-lib.sh
index 48bace2..e8f8629 100755
--- a/test/test-lib.sh
+++ b/test/test-lib.sh
@@ -829,6 +829,8 @@ test_done () {

echo

+   [ -n "$EMACS_SERVER" ] && test_emacs '(kill-emacs)'
+
if [ "$test_failure" = "0" ]; then
if [ "$test_broken" = "0" ]; then   
rm -rf "$remove_tmp"
@@ -848,16 +850,8 @@ emacs_generate_script () {
 export PATH=$PATH
 export NOTMUCH_CONFIG=$NOTMUCH_CONFIG

-# We assume that the user will give a command-line argument only if
-# wanting to run in batch mode.
-if [ \$# -gt 0 ]; then
-   BATCH=--batch
-fi
-
 # Here's what we are using here:
 #
-# --batch: Quit after given commands and print all (messages)
-#
 # --no-init-file   Don't load users ~/.emacs
 #
 # --no-site-file   Don't load the site-wide startup stuff
@@ -866,16 +860,24 @@ fi
 #
 # --load   Force loading of notmuch.el and test-lib.el

-emacs \$BATCH --no-init-file --no-site-file \
+emacs --no-init-file --no-site-file \
--directory "$TMP_DIRECTORY/../../emacs" --load notmuch.el \
--directory "$TMP_DIRECTORY/.." --load test-lib.el \
-   --eval "(progn \$@)"
+   "\$@"
 EOF
chmod a+x "$TMP_DIRECTORY/run_emacs"
 }

 test_emacs () {
-   "$TMP_DIRECTORY/run_emacs" "$@"
+   if [ -z "$EMACS_SERVER" ]; then
+   EMACS_SERVER="notmuch-server-$$"
+   "$TMP_DIRECTORY/run_emacs" \
+   --daemon \
+   --eval "(setq server-name \"$EMACS_SERVER\")" \
+   --eval "(orphan-watchdog 

[PATCH 09/10] test: generate run_emacs script once on test startup

2011-06-28 Thread Dmitry Kurochkin
Instead of generating auxiliary run_emacs script every time
test_emacs is run, do it once in the beginning of the test.

Also, use absolute paths in the script to make it more robust.
---
 test/test-lib.sh |   17 +++--
 1 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/test/test-lib.sh b/test/test-lib.sh
index 7c8a86f..48bace2 100755
--- a/test/test-lib.sh
+++ b/test/test-lib.sh
@@ -839,11 +839,11 @@ test_done () {
fi
 }

-test_emacs () {
+emacs_generate_script () {
# Construct a little test script here for the benefit of the user,
# (who can easily run "run_emacs" to get the same emacs environment
# for investigating any failures).
-   cat < run_emacs
+   cat <"$TMP_DIRECTORY/run_emacs"
 #!/bin/sh
 export PATH=$PATH
 export NOTMUCH_CONFIG=$NOTMUCH_CONFIG
@@ -867,12 +867,15 @@ fi
 # --load   Force loading of notmuch.el and test-lib.el

 emacs \$BATCH --no-init-file --no-site-file \
-   --directory ../../emacs --load notmuch.el \
-   --directory .. --load test-lib.el \
+   --directory "$TMP_DIRECTORY/../../emacs" --load notmuch.el \
+   --directory "$TMP_DIRECTORY/.." --load test-lib.el \
--eval "(progn \$@)"
 EOF
-   chmod a+x ./run_emacs
-   ./run_emacs "$@"
+   chmod a+x "$TMP_DIRECTORY/run_emacs"
+}
+
+test_emacs () {
+   "$TMP_DIRECTORY/run_emacs" "$@"
 }


@@ -1000,6 +1003,8 @@ primary_email=test_suite at notmuchmail.org
 other_email=test_suite_other at notmuchmail.org;test_suite at otherdomain.org
 EOF

+emacs_generate_script
+

 # Use -P to resolve symlinks in our working directory so that the cwd
 # in subprocesses like git equals our $PWD (for pathname comparisons).
-- 
1.7.5.4



[PATCH 08/10] test: set variables using `let' instead of `setq' in Emacs tests

2011-06-28 Thread Dmitry Kurochkin
Using `setq' for setting variables in Emacs tests affect other
tests that may run in the same Emacs environment.  Currently it
works because each test is run in a separate Emacs instance.  But
in the future multiple tests will run in a single Emacs instance.
The patch changes all variables to use `let', so the scope of the
change is limited to a single test.
---
 test/emacs   |   70 +
 test/test-lib.sh |   27 ++--
 2 files changed, 52 insertions(+), 45 deletions(-)

diff --git a/test/emacs b/test/emacs
index 409e033..3d42645 100755
--- a/test/emacs
+++ b/test/emacs
@@ -1,4 +1,10 @@
 #!/usr/bin/env bash
+
+# Note: do not use `setq' for setting variables in Emacs tests because
+# it affects other tests that may run in the same Emacs instance.  Use
+# `let' instead so the scope of the changed variables is limited to a
+# single test.
+
 test_description="emacs interface"
 . test-lib.sh

@@ -12,20 +18,20 @@ test_emacs '(notmuch-hello)
 test_expect_equal_file OUTPUT $EXPECTED/notmuch-hello

 test_begin_subtest "Saved search with 0 results"
-test_emacs '(setq notmuch-show-empty-saved-searches t)
-   (setq notmuch-saved-searches
- '\''(("inbox" . "tag:inbox")
-  ("unread" . "tag:unread")
-  ("empty" . "tag:doesnotexist")))
-   (notmuch-hello)
-   (test-output)'
+test_emacs '(let ((notmuch-show-empty-saved-searches t)
+ (notmuch-saved-searches
+  '\''(("inbox" . "tag:inbox")
+   ("unread" . "tag:unread")
+   ("empty" . "tag:doesnotexist"
+ (notmuch-hello)
+ (test-output))'
 test_expect_equal_file OUTPUT $EXPECTED/notmuch-hello-with-empty

 test_begin_subtest "No saved searches displayed (all with 0 results)"
-test_emacs '(setq notmuch-saved-searches
- '\''(("empty" . "tag:doesnotexist")))
-   (notmuch-hello)
-   (test-output)'
+test_emacs '(let ((notmuch-saved-searches
+  '\''(("empty" . "tag:doesnotexist"
+ (notmuch-hello)
+ (test-output))'
 test_expect_equal_file OUTPUT $EXPECTED/notmuch-hello-no-saved-searches

 test_begin_subtest "Basic notmuch-search view in emacs"
@@ -147,9 +153,9 @@ output=$(notmuch search 'subject:"testing message sent via 
SMTP"' | notmuch_sear
 test_expect_equal "$output" "thread:XXX   2000-01-01 [1/1] Notmuch Test Suite; 
Testing message sent via SMTP (inbox)"

 test_begin_subtest "notmuch-fcc-dirs set to nil"
-test_emacs "(setq notmuch-fcc-dirs nil)
-   (notmuch-mua-mail)
-   (test-output)"
+test_emacs "(let ((notmuch-fcc-dirs nil))
+ (notmuch-mua-mail)
+ (test-output))"
 cat 

[PATCH 07/10] test: use emacs_deliver_message in Emacs SMTP send test

2011-06-28 Thread Dmitry Kurochkin
Minor changes to expected results of other Emacs tests were
needed because the message Date header changed.
---
 test/emacs |   34 +-
 1 files changed, 9 insertions(+), 25 deletions(-)

diff --git a/test/emacs b/test/emacs
index 4592005..409e033 100755
--- a/test/emacs
+++ b/test/emacs
@@ -118,28 +118,12 @@ output=$(notmuch search 'id:"123..456 at example"' | 
notmuch_search_sanitize)
 test_expect_equal "$output" "thread:XXX   2001-01-05 [1/1] Notmuch Test Suite; 
Message with .. in Message-Id (inbox search-add show-add)"

 test_begin_subtest "Sending a message via (fake) SMTP"
-
-# Before we can send a message, we have to prepare the FCC maildir
-mkdir -p mail/sent/cur
-mkdir -p mail/sent/new
-mkdir -p mail/sent/tmp
-
-../smtp-dummy sent_message &
-smtp_dummy_pid=$!
-test_emacs "(setq message-send-mail-function 'message-smtpmail-send-it)
-   (setq smtpmail-smtp-server \"localhost\")
-   (setq smtpmail-smtp-service \"25025\")
-   (notmuch-hello)
-   (notmuch-mua-mail)
-   (message-goto-to)
-   (insert \"user at example.com\nDate: Fri, 29 Mar 1974 10:00:00 
-\")
-   (message-goto-subject)
-   (insert \"Testing message sent via SMTP\")
-   (message-goto-body)
-   (insert \"This is a test that messages are sent via SMTP\")
-   (message-send-and-exit)" >/dev/null 2>&1
-wait ${smtp_dummy_pid}
-
+emacs_deliver_message \
+'Testing message sent via SMTP' \
+'This is a test that messages are sent via SMTP' \
+'(message-goto-to)
+ (kill-whole-line)
+ (insert "To: user at example.com\n")'
 sed \
 -e s',^User-Agent: Notmuch/.* Emacs/.*,User-Agent: Notmuch/XXX Emacs/XXX,' 
\
 -e s',^Message-ID: <.*>$,Message-ID: ,' < sent_message >OUTPUT
@@ -147,7 +131,7 @@ cat  /dev/null
 output=$(notmuch search 'subject:"testing message sent via SMTP"' | 
notmuch_search_sanitize)
-test_expect_equal "$output" "thread:XXX   1974-03-29 [1/1] Notmuch Test Suite; 
Testing message sent via SMTP (inbox)"
+test_expect_equal "$output" "thread:XXX   2000-01-01 [1/1] Notmuch Test Suite; 
Testing message sent via SMTP (inbox)"

 test_begin_subtest "notmuch-fcc-dirs set to nil"
 test_emacs "(setq notmuch-fcc-dirs nil)
@@ -262,7 +246,7 @@ Subject: Re: Testing message sent via SMTP
 In-Reply-To: 
 Fcc: $(pwd)/mail/sent
 --text follows this line--
-On Fri, 29 Mar 1974 10:00:00 -, Notmuch Test Suite  wrote:
+On 01 Jan 2000 12:00:00 -, Notmuch Test Suite  wrote:
 > This is a test that messages are sent via SMTP
 EOF
 test_expect_equal_file OUTPUT EXPECTED
-- 
1.7.5.4



[PATCH 04/10] test: wrap and indent test_emacs calls

2011-06-28 Thread Dmitry Kurochkin
Most test_emacs calls have long arguments that consist of many
expressions.  Putting them on a single line makes it hard to read
and produces poor diff when they are changed.  The patch puts
every expression in test_emacs calls on a separate line.
---
 test/emacs   |  124 --
 test/test-lib.sh |   14 ++-
 2 files changed, 114 insertions(+), 24 deletions(-)

diff --git a/test/emacs b/test/emacs
index f4ff3f1..fddb4a1 100755
--- a/test/emacs
+++ b/test/emacs
@@ -7,32 +7,51 @@ EXPECTED=../emacs.expected-output
 add_email_corpus

 test_begin_subtest "Basic notmuch-hello view in emacs"
-test_emacs '(notmuch-hello) (princ (buffer-string))' >OUTPUT
+test_emacs '(notmuch-hello)
+   (princ (buffer-string))' >OUTPUT
 test_expect_equal_file OUTPUT $EXPECTED/notmuch-hello

 test_begin_subtest "Saved search with 0 results"
-test_emacs '(setq notmuch-show-empty-saved-searches t) (setq 
notmuch-saved-searches '\''(("inbox" . "tag:inbox") ("unread" . "tag:unread") 
("empty" . "tag:doesnotexist"))) (notmuch-hello) (princ (buffer-string))' 
>OUTPUT
+test_emacs '(setq notmuch-show-empty-saved-searches t)
+   (setq notmuch-saved-searches
+ '\''(("inbox" . "tag:inbox")
+  ("unread" . "tag:unread")
+  ("empty" . "tag:doesnotexist")))
+   (notmuch-hello)
+   (princ (buffer-string))' >OUTPUT
 test_expect_equal_file OUTPUT $EXPECTED/notmuch-hello-with-empty

 test_begin_subtest "No saved searches displayed (all with 0 results)"
-test_emacs '(setq notmuch-saved-searches '\''(("empty" . "tag:doesnotexist"))) 
(notmuch-hello) (princ (buffer-string))' >OUTPUT
+test_emacs '(setq notmuch-saved-searches
+ '\''(("empty" . "tag:doesnotexist")))
+   (notmuch-hello)
+   (princ (buffer-string))' >OUTPUT
 test_expect_equal_file OUTPUT $EXPECTED/notmuch-hello-no-saved-searches

 test_begin_subtest "Basic notmuch-search view in emacs"
-test_emacs '(notmuch-search "tag:inbox") (notmuch-test-wait) (princ 
(buffer-string))' >OUTPUT
+test_emacs '(notmuch-search "tag:inbox")
+   (notmuch-test-wait)
+   (princ (buffer-string))' >OUTPUT
 test_expect_equal_file OUTPUT $EXPECTED/notmuch-search-tag-inbox

 test_begin_subtest "Navigation of notmuch-hello to search results"
-test_emacs '(notmuch-hello) (goto-char (point-min)) (re-search-forward 
"inbox") (widget-button-press (point)) (notmuch-test-wait) (princ 
(buffer-string))' >OUTPUT
+test_emacs '(notmuch-hello)
+   (goto-char (point-min))
+   (re-search-forward "inbox")
+   (widget-button-press (point))
+   (notmuch-test-wait)
+   (princ (buffer-string))' >OUTPUT
 test_expect_equal_file OUTPUT $EXPECTED/notmuch-hello-view-inbox

 test_begin_subtest "Basic notmuch-show view in emacs"
 maildir_storage_thread=$(notmuch search --output=threads 
id:20091117190054.GU3165 at dottiness.seas.harvard.edu)
-test_emacs "(notmuch-show \"$maildir_storage_thread\") (princ 
(buffer-string))" >OUTPUT
+test_emacs "(notmuch-show \"$maildir_storage_thread\")
+   (princ (buffer-string))" >OUTPUT
 test_expect_equal_file OUTPUT $EXPECTED/notmuch-show-thread-maildir-storage

 test_begin_subtest "notmuch-show for message with invalid From"
-add_message "[subject]=\"message-with-invalid-from\"" "[from]=\"\\\"Invalid 
\\\" From\\\" \""
+add_message "[subject]=\"message-with-invalid-from\"" \
+   "[from]=\"\\\"Invalid \\\" From\\\" \""
 thread=$(notmuch search --output=threads subject:message-with-invalid-from)
 output=$(test_emacs "(notmuch-show \"$thread\") (princ (buffer-string))")
 test_expect_equal "$output" \
@@ -44,33 +63,54 @@ Date: Tue, 05 Jan 2001 15:43:57 -
 This is just a test message (#1)'

 test_begin_subtest "Navigation of notmuch-search to thread view"
-test_emacs '(notmuch-search "tag:inbox") (notmuch-test-wait) (goto-char 
(point-min)) (re-search-forward "Working with Maildir") 
(notmuch-search-show-thread) (notmuch-test-wait) (princ (buffer-string))' 
>OUTPUT
+test_emacs '(notmuch-search "tag:inbox")
+   (notmuch-test-wait)
+   (goto-char (point-min))
+   (re-search-forward "Working with Maildir")
+   (notmuch-search-show-thread)
+   (notmuch-test-wait)
+   (princ (buffer-string))' >OUTPUT
 test_expect_equal_file OUTPUT $EXPECTED/notmuch-show-thread-maildir-storage

 test_begin_subtest "Add tag from search view"
 os_x_darwin_thread=$(notmuch search --output=threads 
id:ddd65cda0911171950o4eea4389v86de9525e46052d3 at mail.gmail.com)
-test_emacs "(notmuch-search \"$os_x_darwin_thread\") (notmuch-test-wait) 
(notmuch-search-add-tag \"tag-from-search-view\")"
+test_emacs "(notmuch-search \"$os_x_darwin_thread\")
+   (notmuch-test-wait)
+   (notmuch-search-add-tag \"tag-from-search-view\")"
 output=$(notmuch search $os_x_darwin_thread | notmuch_search_sanitize)
 test_expect_equal "$output" "thread:XXX   

[PATCH 03/10] test: cleanup test_emacs

2011-06-28 Thread Dmitry Kurochkin
Move auxiliary function definition and configuration from command
line to test-lib.el.
---
 test/test-lib.el |8 
 test/test-lib.sh |9 +
 2 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/test/test-lib.el b/test/test-lib.el
index 9439996..344a02e 100644
--- a/test/test-lib.el
+++ b/test/test-lib.el
@@ -20,6 +20,14 @@
 ;;
 ;; Authors: Dmitry Kurochkin 

+;; avoid crazy 10-column default of --batch
+(set-frame-width (window-frame (get-buffer-window)) 80)
+
+(defun notmuch-test-wait ()
+  "Wait for process completion."
+  (while (get-buffer-process (current-buffer))
+(sleep-for 0.1)))
+
 (defun visible-buffer-string ()
   "Same as `buffer-string', but excludes invisible text."
   (visible-buffer-substring (point-min) (point-max)))
diff --git a/test/test-lib.sh b/test/test-lib.sh
index 3ec388c..5f61960 100755
--- a/test/test-lib.sh
+++ b/test/test-lib.sh
@@ -852,18 +852,11 @@ fi
 # --directory  Ensure that the local elisp sources are found
 #
 # --load   Force loading of notmuch.el and test-lib.el
-#
-# notmuch-test-waitFunction for tests to use to wait for process completion
-#
-# set-frame-width  80 columns (avoids crazy 10-column default of --batch)

 emacs \$BATCH --no-init-file --no-site-file \
--directory ../../emacs --load notmuch.el \
--directory .. --load test-lib.el \
-   --eval "(defun notmuch-test-wait ()
-   (while (get-buffer-process (current-buffer))
-   (sleep-for 0.1)))" \
-   --eval "(progn (set-frame-width (window-frame (get-buffer-window)) 80) 
\$@)"
+   --eval "(progn \$@)"
 EOF
chmod a+x ./run_emacs
./run_emacs "$@"
-- 
1.7.5.4



[PATCH 02/10] test: do not set `message-signature' in test_emacs

2011-06-28 Thread Dmitry Kurochkin
It is no longer needed since tests are run in a temporary home
directory instead of the user's one.
---
 test/test-lib.sh |3 ---
 1 files changed, 0 insertions(+), 3 deletions(-)

diff --git a/test/test-lib.sh b/test/test-lib.sh
index cc20f41..3ec388c 100755
--- a/test/test-lib.sh
+++ b/test/test-lib.sh
@@ -855,8 +855,6 @@ fi
 #
 # notmuch-test-waitFunction for tests to use to wait for process completion
 #
-# message-signatureAvoiding appending user's signature on messages
-#
 # set-frame-width  80 columns (avoids crazy 10-column default of --batch)

 emacs \$BATCH --no-init-file --no-site-file \
@@ -865,7 +863,6 @@ emacs \$BATCH --no-init-file --no-site-file \
--eval "(defun notmuch-test-wait ()
(while (get-buffer-process (current-buffer))
(sleep-for 0.1)))" \
-   --eval "(setq message-signature nil)" \
--eval "(progn (set-frame-width (window-frame (get-buffer-window)) 80) 
\$@)"
 EOF
chmod a+x ./run_emacs
-- 
1.7.5.4



[PATCH 2/2] test: use emacsclient(1) for Emacs tests

2011-06-28 Thread Dmitry Kurochkin
On Tue, 28 Jun 2011 00:17:42 -0400, Austin Clements  wrote:
> Quoth Dmitry Kurochkin on Jun 28 at  7:59 am:
> > I am sure that would work, but I do not like the complexity.  How about
> > getting back to standard emacsclient and running a watchdog in the
> > emacs?  Like:
> > 
> > (defun orphan-watchdog (pid)
> >   "Periodically check that the process with id PID is still
> > running, quit if it terminated."
> >   (if (not (process-attributes pid))
> >   (kill-emacs)
> > (run-at-time "1 min" nil orphan-watchdog pid)))
> > 
> > This function (or my other changes) do not work (by yet unknown reason
> > :)), but you get the idea.
> 
> I would consider this more complex than a few file descriptors. ]:--8)

More shell code and more elisp code.  I do not think can be considered
simpler :)

> Though, I'm automatically distrustful of anything that relies on
> polling (why poll when you can be notified instantly?).
> 

I agree that polling is not as elegant as an instant notification.  But
IMO reinventing emacsclient just kills all the beauty of this solution.
I liked it when it was a simple read loop, but now it is too complex to
my taste.  Besides, I am a bit worried that we will face new problems in
the future that would force us to add more "features" to our
not-so-poor-man's Emacs server implementation.

> It also has some problems.  For example, PID's are easily reused, so
> if another process happens to take up that PID, the emacs could still
> hang around for a long time.

Indeed.  We may add a more complex process detection, but IMO it is an
overkill.

Anyway, I am done with reworking the patch series and will post it now.
Perhaps others would voice their opinion on this one.

Regards,
  Dmitry


[PATCH] test:Folder tags shouldn't match after removal of file in given folder

2011-06-28 Thread Pieter Praet
On Mon, 27 Jun 2011 11:12:24 -0600, Mark Anderson  wrote:
> 
> Test for bug.  Current stemming support for notmuch adds extra terms
> to the DB which aren't removed when the file renames are detected.
> 
> When folder tags are added to a message, Xapian terms for both XFOLDER
> and ZXFOLDER are generated.  When one of the filenames are
> renamed/removed, only the XFOLDER tags are removed, leaving it possible
> for a match on a folder: tag that was previously but is no longer a
> match in the maildir.
> ---
> 
> I found this bug last week.  Essentially when the folder:spam tag is
> added and puts the XFOLDERspam, it also inserts the ZXFOLDERspam.  Then
> if the mail is removed from the folder, it neglects to remove
> ZXFOLDERspam.
> 
> This was detected with my offlineimap usage with gmail, still haven't
> polished my personal folder/label transition.  As I was looking into it,
> I saw some unusual things flagged as spam, and investigated.

+1

This bug was reported by Sebastian back in January [1], and I
submitted a test [2], but yours is much more thorough, both
regarding the actual test as well as the commit message.

I'd forgotten all about this issue myself, so it's very nice
to see it brought up again.

Thanks!

> 
>  test/notmuch-test|1 +
>  test/search-folder-coherence |   48 
> ++
>  2 files changed, 49 insertions(+), 0 deletions(-)
>  create mode 100755 test/search-folder-coherence
> 
> diff --git a/test/notmuch-test b/test/notmuch-test
> index fe85c6a..79e6267 100755
> --- a/test/notmuch-test
> +++ b/test/notmuch-test
> @@ -41,6 +41,7 @@ TESTS="
>maildir-sync
>crypto
>symbol-hiding
> +  search-folder-coherence
>  "
>  TESTS=${NOTMUCH_TESTS:=$TESTS}
>  
> diff --git a/test/search-folder-coherence b/test/search-folder-coherence
> new file mode 100755
> index 000..cf3ba40
> --- /dev/null
> +++ b/test/search-folder-coherence
> @@ -0,0 +1,48 @@
> +#!/usr/bin/env bash
> +test_description='folder tags removed and added through file renames remain 
> consistent'
> +. ./test-lib.sh
> +
> +test_begin_subtest "No new messages"
> +output=$(NOTMUCH_NEW)
> +test_expect_equal "$output" "No new mail."
> +
> +
> +test_begin_subtest "Single new message"
> +generate_message
> +file_x=$gen_msg_filename
> +id_x=$gen_msg_id
> +output=$(NOTMUCH_NEW)
> +test_expect_equal "$output" "Added 1 new message to the database."
> +
> +test_begin_subtest "Add second folder for same message"
> +dir=$(dirname $file_x)
> +mkdir $dir/spam
> +cp $file_x $dir/spam
> +output=$(NOTMUCH_NEW)
> +test_expect_equal "$output" "No new mail."
> +
> +
> +test_begin_subtest "Multiple files for same message"
> +cat  +MAIL_DIR/msg-001
> +MAIL_DIR/spam/msg-001
> +EOF
> +notmuch search --output=files id:$id_x | sed -e "s,$MAIL_DIR,MAIL_DIR," 
> >OUTPUT
> +test_expect_equal_file OUTPUT EXPECTED
> +
> +test_begin_subtest "Test matches folder:spam"
> +output=$(notmuch search folder:spam)
> +test_expect_equal "$output" "thread:0001   2001-01-05 [1/1] 
> Notmuch Test Suite; Test message #1 (inbox unread)"
> +
> +sleep 1;
> +
> +test_begin_subtest "Remove folder:spam copy of email"
> +rm $dir/spam/$(basename $file_x)
> +output=$(NOTMUCH_NEW)
> +test_expect_equal "$output" "No new mail. Detected 1 file rename."
> +
> +test_begin_subtest "No mails match the folder:spam search"
> +output=$(notmuch search folder:spam)
> +test_expect_equal "$output" ""
> +
> +test_done
> -- 
> 1.7.4.1
> 
> ___
> notmuch mailing list
> notmuch at notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch


Peace

-- 
Pieter

[1] id:"87vd1n4rd2.fsf at SSpaeth.de"
[2] id:"1305270308-30660-1-git-send-email-pieter at praet.org"


Debian package not building

2011-06-28 Thread Pieter Praet
On Fri, 24 Jun 2011 16:34:02 -0700, Jameson Graef Rollins  wrote:
Non-text part: multipart/mixed
Non-text part: multipart/signed
> Hey, folks.  As of today I am for some reason no longer able to build
> the Notmuch Debian package.  I'm using the same build technique I have
> been using for a while (git-buildpackage).  The tail of the failing
> build log is pasted at the bottom of this message.  Is anyone else
> encountering anything like this?
> 
> I don't see what of the recent packaging changes, other than the RPATH
> stuff, could be affecting this, and I get the same failure even if I
> revert the revert of the RPATH override (ie. RPATH_LDFLAGS auto-build
> override in place).  I did recently do a system upgrade, so it's
> possible that something there could have caused the problem.
> 
> What could be preventing dpkg-shlibdeps from finding libpthread.so.0 or
> libc.so.6?

May be PKG_CONFIG_PATH related?

> jamie.
> 
> 
> servo:~/src/notmuch/git [master] 1$ git buildpackage -us -uc 
> --git-ignore-branch
> ...
> dpkg-shlibdeps: error: couldn't find library libpthread.so.0 needed by 
> debian/notmuch/usr/bin/notmuch (ELF format: 'elf64-x86-64'; RPATH: '').
> dpkg-shlibdeps: error: couldn't find library libc.so.6 needed by 
> debian/notmuch/usr/bin/notmuch (ELF format: 'elf64-x86-64'; RPATH: '').
> dpkg-shlibdeps: error: Cannot continue due to the errors listed above.
> Note: libraries are not searched in other binary packages that do not have 
> any shlibs or symbols file.
> To help dpkg-shlibdeps find private libraries, you might need to set 
> LD_LIBRARY_PATH.
> dh_shlibdeps: dpkg-shlibdeps -Tdebian/notmuch.substvars 
> debian/notmuch/usr/bin/notmuch returned exit code 2
> make: *** [binary] Error 2
> dpkg-buildpackage: error: fakeroot debian/rules binary gave error exit status 
> 2
> debuild: fatal error at line 1340:
> dpkg-buildpackage -rfakeroot -D -us -uc -i -I failed
> gbp:error: debuild -i -I returned 29
> gbp:error: Couldn't run 'debuild -i -I -us -uc'
> servo:~/src/notmuch/git [master] 1$ 
Non-text part: application/pgp-signature
> ___
> notmuch mailing list
> notmuch at notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch

Peace

-- 
Pieter


[PATCH] test:Improve test behaviors when --root is used

2011-06-28 Thread Pieter Praet
On Mon, 27 Jun 2011 16:50:47 -0400, Austin Clements  wrote:
> This looks great (modulo one bug, below).  I've wanted to run the
> tests on tmpfs before, but was too lazy to actually fix the tests.
> 
> Given how easy it is to accidentally use "..", I wonder if there's a
> way to force people to use $TEST_DIRECTORY?

Something like this? Mind you, my grep-fu is non-existent.

#+BEGIN_SRC sh
  dotdot=$(rgrep -nH -e "\.\.\/" . | grep -v -e "\$TEST_DIRECTORY")
  if [ -n "${dotdot}" ] ; then
echo -e "Don't dot dot me! Use \$TEST_DIRECTORY as prefix 
instead.\n\nOffending lines:\n ${dotdot}"
  fi
#+END_SRC

> On Mon, Jun 27, 2011 at 12:09 PM, Mark Anderson  wrote:
> > --- a/test/symbol-hiding
> > +++ b/test/symbol-hiding
> > @@ -12,13 +12,13 @@ test_description='exception symbol hiding'
> > ?. ./test-lib.sh
> >
> > ?run_test(){
> > - ? ?result=$(LD_LIBRARY_PATH=../../lib ./symbol-test 2>&1)
> > + ? ?result=$(LD_LIBRARY_PATH=$TEST_DIRECTORY/../../lib ./symbol-test 2>&1)
> 
> Did you mean $TEST_DIRECTORY/../lib?
> ___
> notmuch mailing list
> notmuch at notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch

Peace

-- 
Pieter


Drafts being tagged as inbox

2011-06-28 Thread Pieter Praet
On Mon, 27 Jun 2011 22:50:25 +0100, Robin Green  wrote:
> My drafts (created using emacs message mode) are being tagged as
> inbox. However, they are not tagged as drafts. This is because emacs
> message mode does not store drafts in Maildir format, so there are no
> Maildir flags (e.g. D for draft) to sync tags with.
> 
> Now, I could simply store drafts somewhere else, but then I wouldn't be
> able to search them using notmuch. Is there another way to have drafts
> correctly tagged?

notmuch tag -inbox +draft -- folder:${where_your_drafts_reside}

... in your tagging script.

> Thanks,
> Robin Green
> ___
> notmuch mailing list
> notmuch at notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch

Peace

-- 
Pieter


Drafts being tagged as inbox

2011-06-28 Thread Robin Green
On Tue, 28 Jun 2011 08:34:44 +0200, Pieter Praet  wrote:
> notmuch tag -inbox +draft -- folder:${where_your_drafts_reside}

My notmuch help does not mention "folder:", and indeed folder:drafts as a
search term is just treated as the words folder and drafts. Perhaps this
is implemented in git head. However, when I try to compile git head on
Dragonfly BSD, I get this error:

CXX -O2 notmuch-shared
notmuch-count.o: In function `notmuch_count_command':
notmuch-count.c:(.text+0x63): undefined reference to `notmuch_database_open'
notmuch-count.c:(.text+0x9d): undefined reference to `notmuch_query_create'
notmuch-count.c:(.text+0xb1): undefined reference to 
`notmuch_query_count_messages'
notmuch-count.c:(.text+0xc9): undefined reference to `notmuch_query_destroy'
notmuch-count.c:(.text+0xd1): undefined reference to `notmuch_database_close'
notmuch-dump.o: In function `notmuch_dump_command':
notmuch-dump.c:(.text+0x33): undefined reference to `notmuch_database_open'
notmuch-dump.c:(.text+0x4e): undefined reference to `notmuch_query_create'
notmuch-dump.c:(.text+0x67): undefined reference to `notmuch_query_set_sort'
notmuch-dump.c:(.text+0x81): undefined reference to 
`notmuch_query_search_messages'
notmuch-dump.c:(.text+0x8c): undefined reference to `notmuch_messages_valid'
notmuch-dump.c:(.text+0xa4): undefined reference to `notmuch_messages_get'
notmuch-dump.c:(.text+0xaf): undefined reference to 
`notmuch_message_get_message_id'
notmuch-dump.c:(.text+0xcb): undefined reference to `notmuch_message_get_tags'
notmuch-dump.c:(.text+0xe5): undefined reference to `notmuch_tags_get'
notmuch-dump.c:(.text+0xf9): undefined reference to `notmuch_tags_move_to_next'
notmuch-dump.c:(.text+0x10a): undefined reference to `notmuch_tags_valid'
notmuch-dump.c:(.text+0x14d): undefined reference to `notmuch_message_destroy'
notmuch-dump.c:(.text+0x155): undefined reference to 
`notmuch_messages_move_to_next'
notmuch-dump.c:(.text+0x15d): undefined reference to `notmuch_messages_valid'
notmuch-dump.c:(.text+0x17a): undefined reference to `notmuch_query_destroy'
notmuch-dump.c:(.text+0x182): undefined reference to `notmuch_database_close'
notmuch-new.o: In function `_remove_directory':
notmuch-new.c:(.text+0x585): undefined reference to 
`notmuch_database_get_directory'
notmuch-new.c:(.text+0x592): undefined reference to 
`notmuch_directory_get_child_files'
notmuch-new.c:(.text+0x5b8): undefined reference to 
`notmuch_filenames_move_to_next'
notmuch-new.c:(.text+0x5c0): undefined reference to `notmuch_filenames_valid'
notmuch-new.c:(.text+0x5cc): undefined reference to `notmuch_filenames_get'
notmuch-new.c:(.text+0x5f1): undefined reference to 
`notmuch_database_remove_message'
notmuch-new.c:(.text+0x609): undefined reference to 
`notmuch_directory_get_child_directories'
notmuch-new.c:(.text+0x616): undefined reference to `notmuch_filenames_get'
notmuch-new.c:(.text+0x65c): undefined reference to 
`notmuch_filenames_move_to_next'
notmuch-new.c:(.text+0x664): undefined reference to `notmuch_filenames_valid'
notmuch-new.o: In function `add_files_recursive':
notmuch-new.c:(.text+0x7d6): undefined reference to 
`notmuch_database_get_directory'
notmuch-new.c:(.text+0x7e3): undefined reference to 
`notmuch_directory_get_mtime'
notmuch-new.c:(.text+0xa24): undefined reference to `notmuch_filenames_get'
notmuch-new.c:(.text+0xa3f): undefined reference to `notmuch_filenames_get'
notmuch-new.c:(.text+0xa6b): undefined reference to 
`notmuch_filenames_move_to_next'
notmuch-new.c:(.text+0xa73): undefined reference to `notmuch_filenames_valid'
notmuch-new.c:(.text+0xa7f): undefined reference to `notmuch_filenames_valid'
notmuch-new.c:(.text+0xb08): undefined reference to `notmuch_filenames_destroy'
notmuch-new.c:(.text+0xb16): undefined reference to `notmuch_filenames_destroy'
notmuch-new.c:(.text+0xb2c): undefined reference to `notmuch_directory_destroy'
notmuch-new.c:(.text+0xb64): undefined reference to 
`notmuch_filenames_move_to_next'
notmuch-new.c:(.text+0xb6c): undefined reference to `notmuch_filenames_valid'
notmuch-new.c:(.text+0xb7c): undefined reference to `notmuch_filenames_get'
notmuch-new.c:(.text+0xb97): undefined reference to `notmuch_filenames_get'
notmuch-new.c:(.text+0xbc9): undefined reference to `notmuch_filenames_get'
notmuch-new.c:(.text+0xbf5): undefined reference to 
`notmuch_filenames_move_to_next'
notmuch-new.c:(.text+0xbfd): undefined reference to `notmuch_filenames_valid'
notmuch-new.c:(.text+0xc14): undefined reference to `notmuch_filenames_get'
notmuch-new.c:(.text+0xc40): undefined reference to 
`notmuch_filenames_move_to_next'
notmuch-new.c:(.text+0xc48): undefined reference to `notmuch_filenames_valid'
notmuch-new.c:(.text+0xc69): undefined reference to 
`notmuch_directory_set_mtime'
notmuch-new.c:(.text+0xcf9): undefined reference to `notmuch_filenames_valid'
notmuch-new.c:(.text+0xd05): undefined reference to `notmuch_filenames_get'
notmuch-new.c:(.text+0xdca): undefined reference to 

[PATCH 2/2] test: use emacsclient(1) for Emacs tests

2011-06-28 Thread Dmitry Kurochkin
On Mon, 27 Jun 2011 23:49:37 -0400, Austin Clements  wrote:
> Quoth Dmitry Kurochkin on Jun 28 at  5:03 am:
> > > >  The only way I know to
> > > > reliably kill a child process is to open a pipe to it and have it exit
> > > > on its own when it reads EOF.  Unfortunately, I couldn't find a way to
> > > > do this with an emacs daemon (it appears daemon mode aggressively
> > > > cleans up things like pipes), but here's a different approach:
> > > > 
> > > > coproc emacs --batch --eval "(while t (eval (read)))"
> > > > EMACSFD=${COPROC[1]}
> > > > trap "echo '(kill-emacs)' >&$EMACSFD" EXIT
> > > > 
> > > > echo '(message "Hi")' >&$EMACSFD
> > > > # ...
> > > > 
> > > > This is, basically, a poor man's emacs server, but the coprocess pipe
> > > > binds it tightly to the shell.  If the shell exits for *any* reason,
> > > > the pipe will be closed by the kernel, emacs will read an EOF, and
> > > > exit.
> > > 
> > > I like this idea.
> > > 
> > > >  The trap is there just to cleanly shut down in case of a normal
> > > > exit [1].
> > > 
> > > For normal exit we should just put this into test_done.  Otherwise it is
> > > not a normal exit and we do not care about Emacs error message.  No?
> > > 
> > > >  This also has the advantage that read-from-minibuffer still
> > > > works:
> > > > 
> > > > echo '(message (read-from-minibuffer ""))' >&$EMACSFD
> > > > echo 'Test' >&$EMACSFD
> > > > 
> > > > Thoughts?
> > > > 
> > > 
> > > I like it and I will implement it.  Thanks for the idea.
> > > 
> > 
> > While implementing the idea, I stumbled upon a problem: we need to know
> > when Emacs finished what we echoed or failed with an error.  At the
> > moment tests fail because they check for OUTPUT before Emacs creates it.
> > 
> > We can tell Emacs to print some special marker and wait for it.  But
> > there may be exceptions and errors which may make it difficult.  I did
> > not found a good solution yet.  Would love to hear your thoughts :)
> 
> Oof, yes, of course.  How about making the one-line poor man's emacs
> server slightly less poor?  Use a FIFO to communicate completion.
> Something like,
> 
> EMACSDONE=$TEST_DIRECTORY/emacsdone
> mkfifo $EMACSDONE
> coproc emacs --batch --eval '(while t (eval (read)) (write-region "\n" nil 
> "'$EMACSDONE'" t 0))'
> EMACSFD=${COPROC[1]}
> 
> test_emacs() {
> echo "$1" >&$EMACSFD
> read <$EMACSDONE
> }
> 
> test_emacs '(sleep-for 2)'
> test_emacs '(message "Hi")'
> 
> echo '(kill-emacs)' >&$EMACSFD

I am sure that would work, but I do not like the complexity.  How about
getting back to standard emacsclient and running a watchdog in the
emacs?  Like:

(defun orphan-watchdog (pid)
  "Periodically check that the process with id PID is still
running, quit if it terminated."
  (if (not (process-attributes pid))
  (kill-emacs)
(run-at-time "1 min" nil orphan-watchdog pid)))

This function (or my other changes) do not work (by yet unknown reason
:)), but you get the idea.

Regards,
  Dmitry


[PATCH 4/4] emacs: Add pseudo tag to match all messages that have no tags

2011-06-28 Thread Jani Nikula
Add a pseudo tag that matches all the messages that have no tags. Add new
customization option notmuch-tags-nomatch to enable and name the pseudo
tag.
---
 emacs/notmuch-hello.el |   18 --
 1 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el
index b9c9b01..1770f60 100644
--- a/emacs/notmuch-hello.el
+++ b/emacs/notmuch-hello.el
@@ -53,6 +53,12 @@
 string)
   :group 'notmuch)

+(defcustom notmuch-tags-nomatch nil
+  "Name of the pseudo tag to match messages that have no tags."
+  :type '(choice (const :tag "Off" nil)
+string)
+  :group 'notmuch)
+
 (defvar notmuch-hello-indent 4
   "How much to indent non-headers.")

@@ -352,7 +358,7 @@ Complete list of currently available key bindings:

 (defun notmuch-hello-generate-tag-alist ()
   "Return an alist from tags to queries to display in the all-tags section."
-  (notmuch-remove-if-not
+  (let ((tag-alist (notmuch-remove-if-not
#'cdr
(mapcar (lambda (tag)
 (cons tag
@@ -367,7 +373,15 @@ Complete list of currently available key bindings:
   (notmuch-remove-if-not
(lambda (tag)
  (not (member tag notmuch-hello-hide-tags)))
-   (process-lines notmuch-command "search-tags")
+   (process-lines notmuch-command "search-tags"))
+(when notmuch-tags-nomatch
+  (let ((no-tag-search
+(cons notmuch-tags-nomatch
+  (mapconcat (lambda (arg) (concat "(not (" (cdr arg) "))")) 
tag-alist " and "
+   (if (> (string-to-number (notmuch-saved-search-count (cdr 
no-tag-search))) 0)
+   ;; Append the no-match search.
+   (add-to-list 'tag-alist no-tag-search t
+tag-alist))

 (defun notmuch-hello-saved-alist ()
   (if notmuch-saved-searches
-- 
1.7.1



[PATCH 2/4] emacs: Add option to make adding saved searches append, not prepend

2011-06-28 Thread Jani Nikula
Add new customization option notmuch-add-saved-search-appends to determine
whether new saved searches should be appended to or inserted in front of
saved searches. The default remains insert in front.
---
 emacs/notmuch-hello.el |   10 --
 1 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el
index 65fde75..84bce3a 100644
--- a/emacs/notmuch-hello.el
+++ b/emacs/notmuch-hello.el
@@ -42,6 +42,11 @@
   :type 'boolean
   :group 'notmuch)

+(defcustom notmuch-add-saved-search-appends nil
+  "Should new saved searches be appended instead of inserted to saved 
searches?"
+  :type 'boolean
+  :group 'notmuch)
+
 (defvar notmuch-hello-indent 4
   "How much to indent non-headers.")

@@ -168,8 +173,9 @@ Typically \",\" in the US and UK and \".\" in Europe."
collect elem))
 ;; Add the new one.
 (customize-save-variable 'notmuch-saved-searches
-(push (cons name search)
-  notmuch-saved-searches))
+(add-to-list 'notmuch-saved-searches
+ (cons name search)
+ notmuch-add-saved-search-appends))
 (message "Saved '%s' as '%s'." search name)
 (notmuch-hello-update)))

-- 
1.7.1



[PATCH 1/4] emacs: Add functions and bindings to archive and mark thread as read

2011-06-28 Thread Jani Nikula
Add "mark as read" versions of the archive thread functions to archive and
and mark each message in thread as read by removing the "inbox" and
"unread" tags from the messages. Also add default keybindings A and X for
them: shifted a and x also mark as read.
---
 emacs/notmuch-show.el |   25 ++---
 1 files changed, 22 insertions(+), 3 deletions(-)

diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index 6685717..dbed0a4 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -886,7 +886,9 @@ function is used. "
(define-key map "-" 'notmuch-show-remove-tag)
(define-key map "+" 'notmuch-show-add-tag)
(define-key map "x" 'notmuch-show-archive-thread-then-exit)
+   (define-key map "X" 'notmuch-show-archive-and-read-thread-then-exit)
(define-key map "a" 'notmuch-show-archive-thread)
+   (define-key map "A" 'notmuch-show-archive-and-read-thread)
(define-key map "N" 'notmuch-show-next-message)
(define-key map "P" 'notmuch-show-previous-message)
(define-key map "n" 'notmuch-show-next-open-message)
@@ -1349,10 +1351,12 @@ argument, hide all of the messages."
   (interactive)
   (backward-button 1))

-(defun notmuch-show-archive-thread-internal (show-next)
+(defun notmuch-show-archive-thread-internal (show-next mark-read)
   ;; Remove the tag from the current set of messages.
   (goto-char (point-min))
   (loop do (notmuch-show-remove-tag "inbox")
+   (if mark-read
+   (notmuch-show-remove-tag "unread"))
until (not (notmuch-show-goto-message-next)))
   ;; Move to the next item in the search results, if any.
   (let ((parent-buffer notmuch-show-parent-buffer))
@@ -1376,12 +1380,27 @@ 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-internal t))
+  (notmuch-show-archive-thread-internal t nil))
+
+(defun notmuch-show-archive-and-read-thread ()
+  "Archive and read each message in thread, then show next thread from search.
+
+Archive and mark as read each message currently shown by removing
+the \"inbox\" and \"unread\" tags from each. Then kill this
+buffer and show the next thread from the search from which this
+thread was originally shown."
+  (interactive)
+  (notmuch-show-archive-thread-internal t t))

 (defun notmuch-show-archive-thread-then-exit ()
   "Archive each message in thread, then exit back to search results."
   (interactive)
-  (notmuch-show-archive-thread-internal nil))
+  (notmuch-show-archive-thread-internal nil nil))
+
+(defun notmuch-show-archive-and-read-thread-then-exit ()
+  "Archive and read each message in thread, then exit back to search results."
+  (interactive)
+  (notmuch-show-archive-thread-internal nil t))

 (defun notmuch-show-stash-cc ()
   "Copy CC field of current message to kill-ring."
-- 
1.7.1



[PATCH 0/4] emacs: find non-matching mails, plus small tweaks

2011-06-28 Thread Jani Nikula
Hi, I've found the following features useful with Emacs. Please have a
look. And be gentle; these are my first lines of lisp I'm sharing in
public, and perhaps not quite as lispy as I'd like them to be... :)

Jani


Jani Nikula (4):
  emacs: Add functions and bindings to archive and mark thread as read
  emacs: Add option to make adding saved searches append, not prepend
  emacs: Add pseudo saved search to match mail that no saved search
matches
  emacs: Add pseudo tag to match all messages that have no tags

 emacs/notmuch-hello.el |   58 ++-
 emacs/notmuch-show.el  |   25 ++--
 2 files changed, 69 insertions(+), 14 deletions(-)



[PATCH 2/2] test: use emacsclient(1) for Emacs tests

2011-06-28 Thread Dmitry Kurochkin
Austin,

On Tue, 28 Jun 2011 00:22:41 +0400, Dmitry Kurochkin  wrote:
> On Mon, 27 Jun 2011 16:02:12 -0400, Austin Clements  
> wrote:
> > This looks like a great idea!  The test suite has been getting irritating 
> > slow.
> > 
> > A few minor comments: This patch would be clearer if it the
> > setq-to-let translation were a separate patch.  It would also be worth
> > adding a big comment at the top of the test explaining why all of the
> > tests let-bind everything instead of setq'ing, primarily for the
> > benefit of people writing new tests.
> > 
> 
> Agreed, will separate and add the warning.
> 
> > I might just be having trouble reading the patch, but the difference
> > between emacs_start and emacs_server_start seems unclear.  Perhaps the
> > comments should explain how somebody would use these scripts?
> > 
> 
> emacs_start start a normal Emacs in non-daemon mode.  Something you
> might prefer when debugging.
> 
> > 
> > My bigger concern with this change is that it may leave behind stale
> > emacs daemons if the script gets interrupted.
> 
> That is an issue indeed.  I would probably do smth like a periodic check
> inside Emacs that the shell is alive, but your approach below looks more
> reliable.
> 
> >  The only way I know to
> > reliably kill a child process is to open a pipe to it and have it exit
> > on its own when it reads EOF.  Unfortunately, I couldn't find a way to
> > do this with an emacs daemon (it appears daemon mode aggressively
> > cleans up things like pipes), but here's a different approach:
> > 
> > coproc emacs --batch --eval "(while t (eval (read)))"
> > EMACSFD=${COPROC[1]}
> > trap "echo '(kill-emacs)' >&$EMACSFD" EXIT
> > 
> > echo '(message "Hi")' >&$EMACSFD
> > # ...
> > 
> > This is, basically, a poor man's emacs server, but the coprocess pipe
> > binds it tightly to the shell.  If the shell exits for *any* reason,
> > the pipe will be closed by the kernel, emacs will read an EOF, and
> > exit.
> 
> I like this idea.
> 
> >  The trap is there just to cleanly shut down in case of a normal
> > exit [1].
> 
> For normal exit we should just put this into test_done.  Otherwise it is
> not a normal exit and we do not care about Emacs error message.  No?
> 
> >  This also has the advantage that read-from-minibuffer still
> > works:
> > 
> > echo '(message (read-from-minibuffer ""))' >&$EMACSFD
> > echo 'Test' >&$EMACSFD
> > 
> > Thoughts?
> > 
> 
> I like it and I will implement it.  Thanks for the idea.
> 

While implementing the idea, I stumbled upon a problem: we need to know
when Emacs finished what we echoed or failed with an error.  At the
moment tests fail because they check for OUTPUT before Emacs creates it.

We can tell Emacs to print some special marker and wait for it.  But
there may be exceptions and errors which may make it difficult.  I did
not found a good solution yet.  Would love to hear your thoughts :)

Regards,
  Dmitry

> Regards,
>   Dmitry
> 
> > [1] If you don't do this, emacs complains that it can't read from
> > stdin before it exits.  It would be nice to catch this condition in
> > the elisp code and not bother with the trap, but the error thrown is
> > just an 'error, so I don't think we can catch and ignore it without
> > catching and ignoring *all* errors.
> > 
> > On Sun, Jun 26, 2011 at 11:54 PM, Dmitry Kurochkin
> >  wrote:
> > > Before the change, every Emacs tests ran in a separate Emacs
> > > instance. ?Starting Emacs many times wastes considerable time and
> > > it gets worse as the test suite grows. ?The patch solves this by
> > > using a single Emacs server and emacsclient(1) to run multiple
> > > tests. ?Emacs server is started on the first test_emacs call and
> > > stopped when test_done is called or the test is killed by a
> > > signal. ?Several auxiliary scripts useful for debugging and test
> > > development are generated instead of the run_emacs script:
> > >
> > > ?* emacs_server_start - start Emacs server
> > > ?* emacs_server_stop ?- stop Emacs server
> > > ?* emacs_start ? ? ? ?- start Emacs
> > > ?* emacs_run ? ? ? ? ?- execute ELisp expressions in running Emacs server
> > >
> > > Since multiple tests are run in a single Emacs instance, they
> > > must not change Emacs environment because it may affect other
> > > tests. ?For now, the only Emacs environment modifications done by
> > > the tests are variable settings. ?Before the change, variables
> > > were set with `setq' which affected other tests. ?The patch
> > > changes all variables to use `let', so the scope of the change is
> > > limited to a single test.
> > > ---
> > > ?test/emacs ? ? ? | ? 74 +-
> > > ?test/test-lib.el | ? ?6 ++
> > > ?test/test-lib.sh | ?149 
> > > ++---
> > > ?3 files changed, 161 insertions(+), 68 deletions(-)
> > >
> > > diff --git a/test/emacs b/test/emacs
> > > index 4f16b41..f1939dc 100755
> > > --- a/test/emacs
> > > +++ b/test/emacs
> > > @@ 

[PATCH 2/2] test: use emacsclient(1) for Emacs tests

2011-06-28 Thread Dmitry Kurochkin
On Mon, 27 Jun 2011 16:02:12 -0400, Austin Clements  wrote:
> This looks like a great idea!  The test suite has been getting irritating 
> slow.
> 
> A few minor comments: This patch would be clearer if it the
> setq-to-let translation were a separate patch.  It would also be worth
> adding a big comment at the top of the test explaining why all of the
> tests let-bind everything instead of setq'ing, primarily for the
> benefit of people writing new tests.
> 

Agreed, will separate and add the warning.

> I might just be having trouble reading the patch, but the difference
> between emacs_start and emacs_server_start seems unclear.  Perhaps the
> comments should explain how somebody would use these scripts?
> 

emacs_start start a normal Emacs in non-daemon mode.  Something you
might prefer when debugging.

> 
> My bigger concern with this change is that it may leave behind stale
> emacs daemons if the script gets interrupted.

That is an issue indeed.  I would probably do smth like a periodic check
inside Emacs that the shell is alive, but your approach below looks more
reliable.

>  The only way I know to
> reliably kill a child process is to open a pipe to it and have it exit
> on its own when it reads EOF.  Unfortunately, I couldn't find a way to
> do this with an emacs daemon (it appears daemon mode aggressively
> cleans up things like pipes), but here's a different approach:
> 
> coproc emacs --batch --eval "(while t (eval (read)))"
> EMACSFD=${COPROC[1]}
> trap "echo '(kill-emacs)' >&$EMACSFD" EXIT
> 
> echo '(message "Hi")' >&$EMACSFD
> # ...
> 
> This is, basically, a poor man's emacs server, but the coprocess pipe
> binds it tightly to the shell.  If the shell exits for *any* reason,
> the pipe will be closed by the kernel, emacs will read an EOF, and
> exit.

I like this idea.

>  The trap is there just to cleanly shut down in case of a normal
> exit [1].

For normal exit we should just put this into test_done.  Otherwise it is
not a normal exit and we do not care about Emacs error message.  No?

>  This also has the advantage that read-from-minibuffer still
> works:
> 
> echo '(message (read-from-minibuffer ""))' >&$EMACSFD
> echo 'Test' >&$EMACSFD
> 
> Thoughts?
> 

I like it and I will implement it.  Thanks for the idea.

Regards,
  Dmitry

> [1] If you don't do this, emacs complains that it can't read from
> stdin before it exits.  It would be nice to catch this condition in
> the elisp code and not bother with the trap, but the error thrown is
> just an 'error, so I don't think we can catch and ignore it without
> catching and ignoring *all* errors.
> 
> On Sun, Jun 26, 2011 at 11:54 PM, Dmitry Kurochkin
>  wrote:
> > Before the change, every Emacs tests ran in a separate Emacs
> > instance. ?Starting Emacs many times wastes considerable time and
> > it gets worse as the test suite grows. ?The patch solves this by
> > using a single Emacs server and emacsclient(1) to run multiple
> > tests. ?Emacs server is started on the first test_emacs call and
> > stopped when test_done is called or the test is killed by a
> > signal. ?Several auxiliary scripts useful for debugging and test
> > development are generated instead of the run_emacs script:
> >
> > ?* emacs_server_start - start Emacs server
> > ?* emacs_server_stop ?- stop Emacs server
> > ?* emacs_start ? ? ? ?- start Emacs
> > ?* emacs_run ? ? ? ? ?- execute ELisp expressions in running Emacs server
> >
> > Since multiple tests are run in a single Emacs instance, they
> > must not change Emacs environment because it may affect other
> > tests. ?For now, the only Emacs environment modifications done by
> > the tests are variable settings. ?Before the change, variables
> > were set with `setq' which affected other tests. ?The patch
> > changes all variables to use `let', so the scope of the change is
> > limited to a single test.
> > ---
> > ?test/emacs ? ? ? | ? 74 +-
> > ?test/test-lib.el | ? ?6 ++
> > ?test/test-lib.sh | ?149 
> > ++---
> > ?3 files changed, 161 insertions(+), 68 deletions(-)
> >
> > diff --git a/test/emacs b/test/emacs
> > index 4f16b41..f1939dc 100755
> > --- a/test/emacs
> > +++ b/test/emacs
> > @@ -12,20 +12,20 @@ test_emacs '(notmuch-hello)
> > ?test_expect_equal_file OUTPUT $EXPECTED/notmuch-hello
> >
> > ?test_begin_subtest "Saved search with 0 results"
> > -test_emacs '(setq notmuch-show-empty-saved-searches t)
> > - ? ? ? ? ? (setq notmuch-saved-searches
> > - ? ? ? ? ? ? ? ? '\''(("inbox" . "tag:inbox")
> > - ? ? ? ? ? ? ? ? ? ? ?("unread" . "tag:unread")
> > - ? ? ? ? ? ? ? ? ? ? ?("empty" . "tag:doesnotexist")))
> > - ? ? ? ? ? (notmuch-hello)
> > - ? ? ? ? ? (test-output)'
> > +test_emacs '(let ((notmuch-show-empty-saved-searches t)
> > + ? ? ? ? ? ? ? ? (notmuch-saved-searches
> > + ? ? ? ? ? ? ? ? ?'\''(("inbox" . "tag:inbox")
> > + ? ? ? ? ? ? ? ? ? ? ? ("unread" . "tag:unread")
> > + ? ? ? ? ? ? ? ? ? ? ? 

[PATCH 2/2] test: use emacsclient(1) for Emacs tests

2011-06-28 Thread Austin Clements
Quoth Dmitry Kurochkin on Jun 28 at  7:59 am:
> I am sure that would work, but I do not like the complexity.  How about
> getting back to standard emacsclient and running a watchdog in the
> emacs?  Like:
> 
> (defun orphan-watchdog (pid)
>   "Periodically check that the process with id PID is still
> running, quit if it terminated."
>   (if (not (process-attributes pid))
>   (kill-emacs)
> (run-at-time "1 min" nil orphan-watchdog pid)))
> 
> This function (or my other changes) do not work (by yet unknown reason
> :)), but you get the idea.

I would consider this more complex than a few file descriptors. ]:--8)
Though, I'm automatically distrustful of anything that relies on
polling (why poll when you can be notified instantly?).

It also has some problems.  For example, PID's are easily reused, so
if another process happens to take up that PID, the emacs could still
hang around for a long time.


[PATCH 2/2] test: use emacsclient(1) for Emacs tests

2011-06-28 Thread Austin Clements
Quoth Dmitry Kurochkin on Jun 28 at  5:03 am:
> > >  The only way I know to
> > > reliably kill a child process is to open a pipe to it and have it exit
> > > on its own when it reads EOF.  Unfortunately, I couldn't find a way to
> > > do this with an emacs daemon (it appears daemon mode aggressively
> > > cleans up things like pipes), but here's a different approach:
> > > 
> > > coproc emacs --batch --eval "(while t (eval (read)))"
> > > EMACSFD=${COPROC[1]}
> > > trap "echo '(kill-emacs)' >&$EMACSFD" EXIT
> > > 
> > > echo '(message "Hi")' >&$EMACSFD
> > > # ...
> > > 
> > > This is, basically, a poor man's emacs server, but the coprocess pipe
> > > binds it tightly to the shell.  If the shell exits for *any* reason,
> > > the pipe will be closed by the kernel, emacs will read an EOF, and
> > > exit.
> > 
> > I like this idea.
> > 
> > >  The trap is there just to cleanly shut down in case of a normal
> > > exit [1].
> > 
> > For normal exit we should just put this into test_done.  Otherwise it is
> > not a normal exit and we do not care about Emacs error message.  No?
> > 
> > >  This also has the advantage that read-from-minibuffer still
> > > works:
> > > 
> > > echo '(message (read-from-minibuffer ""))' >&$EMACSFD
> > > echo 'Test' >&$EMACSFD
> > > 
> > > Thoughts?
> > > 
> > 
> > I like it and I will implement it.  Thanks for the idea.
> > 
> 
> While implementing the idea, I stumbled upon a problem: we need to know
> when Emacs finished what we echoed or failed with an error.  At the
> moment tests fail because they check for OUTPUT before Emacs creates it.
> 
> We can tell Emacs to print some special marker and wait for it.  But
> there may be exceptions and errors which may make it difficult.  I did
> not found a good solution yet.  Would love to hear your thoughts :)

Oof, yes, of course.  How about making the one-line poor man's emacs
server slightly less poor?  Use a FIFO to communicate completion.
Something like,

EMACSDONE=$TEST_DIRECTORY/emacsdone
mkfifo $EMACSDONE
coproc emacs --batch --eval '(while t (eval (read)) (write-region "\n" nil 
"'$EMACSDONE'" t 0))'
EMACSFD=${COPROC[1]}

test_emacs() {
echo "$1" >&$EMACSFD
read <$EMACSDONE
}

test_emacs '(sleep-for 2)'
test_emacs '(message "Hi")'

echo '(kill-emacs)' >&$EMACSFD


Re: [PATCH] test:Improve test behaviors when --root is used

2011-06-28 Thread Pieter Praet
On Mon, 27 Jun 2011 16:50:47 -0400, Austin Clements amdra...@mit.edu wrote:
 This looks great (modulo one bug, below).  I've wanted to run the
 tests on tmpfs before, but was too lazy to actually fix the tests.
 
 Given how easy it is to accidentally use .., I wonder if there's a
 way to force people to use $TEST_DIRECTORY?

Something like this? Mind you, my grep-fu is non-existent.

#+BEGIN_SRC sh
  dotdot=$(rgrep -nH -e \.\.\/ . | grep -v -e \$TEST_DIRECTORY)
  if [ -n ${dotdot} ] ; then
echo -e Don't dot dot me! Use \$TEST_DIRECTORY as prefix 
instead.\n\nOffending lines:\n ${dotdot}
  fi
#+END_SRC

 On Mon, Jun 27, 2011 at 12:09 PM, Mark Anderson ma.sk...@gmail.com wrote:
  --- a/test/symbol-hiding
  +++ b/test/symbol-hiding
  @@ -12,13 +12,13 @@ test_description='exception symbol hiding'
   . ./test-lib.sh
 
   run_test(){
  -    result=$(LD_LIBRARY_PATH=../../lib ./symbol-test 21)
  +    result=$(LD_LIBRARY_PATH=$TEST_DIRECTORY/../../lib ./symbol-test 21)
 
 Did you mean $TEST_DIRECTORY/../lib?
 ___
 notmuch mailing list
 notmuch@notmuchmail.org
 http://notmuchmail.org/mailman/listinfo/notmuch

Peace

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


Re: Debian package not building

2011-06-28 Thread Pieter Praet
On Fri, 24 Jun 2011 16:34:02 -0700, Jameson Graef Rollins 
jroll...@finestructure.net wrote:
Non-text part: multipart/mixed
Non-text part: multipart/signed
 Hey, folks.  As of today I am for some reason no longer able to build
 the Notmuch Debian package.  I'm using the same build technique I have
 been using for a while (git-buildpackage).  The tail of the failing
 build log is pasted at the bottom of this message.  Is anyone else
 encountering anything like this?
 
 I don't see what of the recent packaging changes, other than the RPATH
 stuff, could be affecting this, and I get the same failure even if I
 revert the revert of the RPATH override (ie. RPATH_LDFLAGS auto-build
 override in place).  I did recently do a system upgrade, so it's
 possible that something there could have caused the problem.
 
 What could be preventing dpkg-shlibdeps from finding libpthread.so.0 or
 libc.so.6?

May be PKG_CONFIG_PATH related?

 jamie.
 
 
 servo:~/src/notmuch/git [master] 1$ git buildpackage -us -uc 
 --git-ignore-branch
 ...
 dpkg-shlibdeps: error: couldn't find library libpthread.so.0 needed by 
 debian/notmuch/usr/bin/notmuch (ELF format: 'elf64-x86-64'; RPATH: '').
 dpkg-shlibdeps: error: couldn't find library libc.so.6 needed by 
 debian/notmuch/usr/bin/notmuch (ELF format: 'elf64-x86-64'; RPATH: '').
 dpkg-shlibdeps: error: Cannot continue due to the errors listed above.
 Note: libraries are not searched in other binary packages that do not have 
 any shlibs or symbols file.
 To help dpkg-shlibdeps find private libraries, you might need to set 
 LD_LIBRARY_PATH.
 dh_shlibdeps: dpkg-shlibdeps -Tdebian/notmuch.substvars 
 debian/notmuch/usr/bin/notmuch returned exit code 2
 make: *** [binary] Error 2
 dpkg-buildpackage: error: fakeroot debian/rules binary gave error exit status 
 2
 debuild: fatal error at line 1340:
 dpkg-buildpackage -rfakeroot -D -us -uc -i -I failed
 gbp:error: debuild -i -I returned 29
 gbp:error: Couldn't run 'debuild -i -I -us -uc'
 servo:~/src/notmuch/git [master] 1$ 
Non-text part: application/pgp-signature
 ___
 notmuch mailing list
 notmuch@notmuchmail.org
 http://notmuchmail.org/mailman/listinfo/notmuch

Peace

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


Re: [PATCH] test:Folder tags shouldn't match after removal of file in given folder

2011-06-28 Thread Pieter Praet
On Mon, 27 Jun 2011 11:12:24 -0600, Mark Anderson ma.sk...@gmail.com wrote:
 
 Test for bug.  Current stemming support for notmuch adds extra terms
 to the DB which aren't removed when the file renames are detected.
 
 When folder tags are added to a message, Xapian terms for both XFOLDER
 and ZXFOLDER are generated.  When one of the filenames are
 renamed/removed, only the XFOLDER tags are removed, leaving it possible
 for a match on a folder: tag that was previously but is no longer a
 match in the maildir.
 ---
 
 I found this bug last week.  Essentially when the folder:spam tag is
 added and puts the XFOLDERspam, it also inserts the ZXFOLDERspam.  Then
 if the mail is removed from the folder, it neglects to remove
 ZXFOLDERspam.
 
 This was detected with my offlineimap usage with gmail, still haven't
 polished my personal folder/label transition.  As I was looking into it,
 I saw some unusual things flagged as spam, and investigated.

+1

This bug was reported by Sebastian back in January [1], and I
submitted a test [2], but yours is much more thorough, both
regarding the actual test as well as the commit message.

I'd forgotten all about this issue myself, so it's very nice
to see it brought up again.

Thanks!

 
  test/notmuch-test|1 +
  test/search-folder-coherence |   48 
 ++
  2 files changed, 49 insertions(+), 0 deletions(-)
  create mode 100755 test/search-folder-coherence
 
 diff --git a/test/notmuch-test b/test/notmuch-test
 index fe85c6a..79e6267 100755
 --- a/test/notmuch-test
 +++ b/test/notmuch-test
 @@ -41,6 +41,7 @@ TESTS=
maildir-sync
crypto
symbol-hiding
 +  search-folder-coherence
  
  TESTS=${NOTMUCH_TESTS:=$TESTS}
  
 diff --git a/test/search-folder-coherence b/test/search-folder-coherence
 new file mode 100755
 index 000..cf3ba40
 --- /dev/null
 +++ b/test/search-folder-coherence
 @@ -0,0 +1,48 @@
 +#!/usr/bin/env bash
 +test_description='folder tags removed and added through file renames remain 
 consistent'
 +. ./test-lib.sh
 +
 +test_begin_subtest No new messages
 +output=$(NOTMUCH_NEW)
 +test_expect_equal $output No new mail.
 +
 +
 +test_begin_subtest Single new message
 +generate_message
 +file_x=$gen_msg_filename
 +id_x=$gen_msg_id
 +output=$(NOTMUCH_NEW)
 +test_expect_equal $output Added 1 new message to the database.
 +
 +test_begin_subtest Add second folder for same message
 +dir=$(dirname $file_x)
 +mkdir $dir/spam
 +cp $file_x $dir/spam
 +output=$(NOTMUCH_NEW)
 +test_expect_equal $output No new mail.
 +
 +
 +test_begin_subtest Multiple files for same message
 +cat EOF EXPECTED
 +MAIL_DIR/msg-001
 +MAIL_DIR/spam/msg-001
 +EOF
 +notmuch search --output=files id:$id_x | sed -e s,$MAIL_DIR,MAIL_DIR, 
 OUTPUT
 +test_expect_equal_file OUTPUT EXPECTED
 +
 +test_begin_subtest Test matches folder:spam
 +output=$(notmuch search folder:spam)
 +test_expect_equal $output thread:0001   2001-01-05 [1/1] 
 Notmuch Test Suite; Test message #1 (inbox unread)
 +
 +sleep 1;
 +
 +test_begin_subtest Remove folder:spam copy of email
 +rm $dir/spam/$(basename $file_x)
 +output=$(NOTMUCH_NEW)
 +test_expect_equal $output No new mail. Detected 1 file rename.
 +
 +test_begin_subtest No mails match the folder:spam search
 +output=$(notmuch search folder:spam)
 +test_expect_equal $output 
 +
 +test_done
 -- 
 1.7.4.1
 
 ___
 notmuch mailing list
 notmuch@notmuchmail.org
 http://notmuchmail.org/mailman/listinfo/notmuch


Peace

-- 
Pieter

[1] id:87vd1n4rd2@sspaeth.de
[2] id:1305270308-30660-1-git-send-email-pie...@praet.org
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: Race condition for '*' command

2011-06-28 Thread Pieter Praet
On Sun, 26 Jun 2011 10:00:41 +0100, Robin Green gree...@greenrd.org wrote:
 On Sat, 25 Jun 2011 16:57:50 -0700, Jameson Graef Rollins 
 jroll...@finestructure.net wrote:
  On Sat, 25 Jun 2011 23:18:52 +0100, Robin Green gree...@greenrd.org wrote:
   A race condition in the '*' command was noted when it was first
   proposed. It looks to me like it still exists - has anything been done
   about it?
  
  Hi, Robin.  Can you explain what you mean by the '*' command?
 
 Sorry - forgot to say I'm talking about the notmuch emacs mode. In that
 mode '*' applies tags to all messages matching the current search query,
 which means that (here's the race condition) new results that have
 appeared since the last refresh will also be tagged.

This issue appears to stem from the fact that `notmuch-search-operate-all'
runs (apply 'notmuch-tag notmuch-search-query-string action-split), in which
`notmuch-search-query-string' points to a moving target.

Could be solved by doing it with `notmuch-search', `mark-whole-buffer'
and `notmuch-search-{add,remove}-tag-region' instead, but I'm sure
there's a better way (of which I'm as of yet unaware).

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

Peace

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


Re: Drafts being tagged as inbox

2011-06-28 Thread Robin Green
On Tue, 28 Jun 2011 08:34:44 +0200, Pieter Praet pie...@praet.org wrote:
 notmuch tag -inbox +draft -- folder:${where_your_drafts_reside}

My notmuch help does not mention folder:, and indeed folder:drafts as a
search term is just treated as the words folder and drafts. Perhaps this
is implemented in git head. However, when I try to compile git head on
Dragonfly BSD, I get this error:

CXX -O2 notmuch-shared
notmuch-count.o: In function `notmuch_count_command':
notmuch-count.c:(.text+0x63): undefined reference to `notmuch_database_open'
notmuch-count.c:(.text+0x9d): undefined reference to `notmuch_query_create'
notmuch-count.c:(.text+0xb1): undefined reference to 
`notmuch_query_count_messages'
notmuch-count.c:(.text+0xc9): undefined reference to `notmuch_query_destroy'
notmuch-count.c:(.text+0xd1): undefined reference to `notmuch_database_close'
notmuch-dump.o: In function `notmuch_dump_command':
notmuch-dump.c:(.text+0x33): undefined reference to `notmuch_database_open'
notmuch-dump.c:(.text+0x4e): undefined reference to `notmuch_query_create'
notmuch-dump.c:(.text+0x67): undefined reference to `notmuch_query_set_sort'
notmuch-dump.c:(.text+0x81): undefined reference to 
`notmuch_query_search_messages'
notmuch-dump.c:(.text+0x8c): undefined reference to `notmuch_messages_valid'
notmuch-dump.c:(.text+0xa4): undefined reference to `notmuch_messages_get'
notmuch-dump.c:(.text+0xaf): undefined reference to 
`notmuch_message_get_message_id'
notmuch-dump.c:(.text+0xcb): undefined reference to `notmuch_message_get_tags'
notmuch-dump.c:(.text+0xe5): undefined reference to `notmuch_tags_get'
notmuch-dump.c:(.text+0xf9): undefined reference to `notmuch_tags_move_to_next'
notmuch-dump.c:(.text+0x10a): undefined reference to `notmuch_tags_valid'
notmuch-dump.c:(.text+0x14d): undefined reference to `notmuch_message_destroy'
notmuch-dump.c:(.text+0x155): undefined reference to 
`notmuch_messages_move_to_next'
notmuch-dump.c:(.text+0x15d): undefined reference to `notmuch_messages_valid'
notmuch-dump.c:(.text+0x17a): undefined reference to `notmuch_query_destroy'
notmuch-dump.c:(.text+0x182): undefined reference to `notmuch_database_close'
notmuch-new.o: In function `_remove_directory':
notmuch-new.c:(.text+0x585): undefined reference to 
`notmuch_database_get_directory'
notmuch-new.c:(.text+0x592): undefined reference to 
`notmuch_directory_get_child_files'
notmuch-new.c:(.text+0x5b8): undefined reference to 
`notmuch_filenames_move_to_next'
notmuch-new.c:(.text+0x5c0): undefined reference to `notmuch_filenames_valid'
notmuch-new.c:(.text+0x5cc): undefined reference to `notmuch_filenames_get'
notmuch-new.c:(.text+0x5f1): undefined reference to 
`notmuch_database_remove_message'
notmuch-new.c:(.text+0x609): undefined reference to 
`notmuch_directory_get_child_directories'
notmuch-new.c:(.text+0x616): undefined reference to `notmuch_filenames_get'
notmuch-new.c:(.text+0x65c): undefined reference to 
`notmuch_filenames_move_to_next'
notmuch-new.c:(.text+0x664): undefined reference to `notmuch_filenames_valid'
notmuch-new.o: In function `add_files_recursive':
notmuch-new.c:(.text+0x7d6): undefined reference to 
`notmuch_database_get_directory'
notmuch-new.c:(.text+0x7e3): undefined reference to 
`notmuch_directory_get_mtime'
notmuch-new.c:(.text+0xa24): undefined reference to `notmuch_filenames_get'
notmuch-new.c:(.text+0xa3f): undefined reference to `notmuch_filenames_get'
notmuch-new.c:(.text+0xa6b): undefined reference to 
`notmuch_filenames_move_to_next'
notmuch-new.c:(.text+0xa73): undefined reference to `notmuch_filenames_valid'
notmuch-new.c:(.text+0xa7f): undefined reference to `notmuch_filenames_valid'
notmuch-new.c:(.text+0xb08): undefined reference to `notmuch_filenames_destroy'
notmuch-new.c:(.text+0xb16): undefined reference to `notmuch_filenames_destroy'
notmuch-new.c:(.text+0xb2c): undefined reference to `notmuch_directory_destroy'
notmuch-new.c:(.text+0xb64): undefined reference to 
`notmuch_filenames_move_to_next'
notmuch-new.c:(.text+0xb6c): undefined reference to `notmuch_filenames_valid'
notmuch-new.c:(.text+0xb7c): undefined reference to `notmuch_filenames_get'
notmuch-new.c:(.text+0xb97): undefined reference to `notmuch_filenames_get'
notmuch-new.c:(.text+0xbc9): undefined reference to `notmuch_filenames_get'
notmuch-new.c:(.text+0xbf5): undefined reference to 
`notmuch_filenames_move_to_next'
notmuch-new.c:(.text+0xbfd): undefined reference to `notmuch_filenames_valid'
notmuch-new.c:(.text+0xc14): undefined reference to `notmuch_filenames_get'
notmuch-new.c:(.text+0xc40): undefined reference to 
`notmuch_filenames_move_to_next'
notmuch-new.c:(.text+0xc48): undefined reference to `notmuch_filenames_valid'
notmuch-new.c:(.text+0xc69): undefined reference to 
`notmuch_directory_set_mtime'
notmuch-new.c:(.text+0xcf9): undefined reference to `notmuch_filenames_valid'
notmuch-new.c:(.text+0xd05): undefined reference to `notmuch_filenames_get'
notmuch-new.c:(.text+0xdca): undefined reference to 

Re: [PATCH] fix sum moar typos

2011-06-28 Thread Pieter Praet
On Mon, 27 Jun 2011 14:17:27 -0700, Carl Worth cwo...@cworth.org wrote:
Non-text part: multipart/signed
 On Fri, 24 Jun 2011 22:04:13 +0200, Pieter Praet pie...@praet.org wrote:
  You however, seem to be incredibly disciplined in this respect,
  so statistically speaking, you're destined to become typo-king,
  and you have every reason to be *proud* of it. :D
 
 Thanks for the compliment (even if sideways)! I enjoyed the laugh.
 
  The only thing you could possibly have to be embarrassed about,
  is insufficient laziness (which, for programmers, is considered a
  virtue) ;)
 
 And thanks as well for the gentle chiding. I hope to benefit from it.

I hope so as well.

I mean, it's okay to be enterprising, but imagine what would become of
our noble profession (nay, the world!) if we forgot to -now and again-
remind one another to maintain adequately lofty levels of laziness?

It would upheave the very foundation on which Computer Science (and all
it entails, which is pretty much everything these days) was built!

I'm prepared though, I've got a sizable amount of post doves buried
in the backyard, just in case. Which reminds me, I should check their
expiration dates one of these days.

 -Carl
 
 -- 
 carl.d.wo...@intel.com
Non-text part: application/pgp-signature


Peace

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


Re: Drafts being tagged as inbox

2011-06-28 Thread Pieter Praet
On Tue, 28 Jun 2011 08:00:53 +0100, Robin Green gree...@greenrd.org wrote:
 On Tue, 28 Jun 2011 08:34:44 +0200, Pieter Praet pie...@praet.org wrote:
  notmuch tag -inbox +draft -- folder:${where_your_drafts_reside}
 
 My notmuch help does not mention folder:, and indeed folder:drafts as a
 search term is just treated as the words folder and drafts. Perhaps this
 is implemented in git head. However, when I try to compile git head on
 Dragonfly BSD, I get this error:
 
 [SNIP]

Hmmm, rather anticlimactic.

Can't help you with the errors nor give you an exact bearing, but
folder-based search was implemented around January this year, and I can
definitely vouch for commit 0c0b4172 (got a few old branches based
there).

Peace

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


Re: Notmuch scripts

2011-06-28 Thread Pieter Praet
On Mon, 27 Jun 2011 21:31:26 -0400, Ben Gamari bgamari.f...@gmail.com wrote:
 [SNIP] It
 would be nice, however, if the emacs interface supported hiding tags
 matching certain patterns (say /\..+/).

This should be possible as of last month (eb4e0ea2),
by courtesy of Daniel Schoepe [1].

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


Peace

-- 
Pieter


[1] id:87fwoath2s@gilead.home.box
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: bug in emacs-ui ?

2011-06-28 Thread Jani Nikula
Carl Worth cworth@... writes:

 
 On Wed, 22 Jun 2011 08:50:23 +0200, Sebastien Binet
 seb.binet@... wrote:
  On Tue, 21 Jun 2011 15:09:20 -0700, Carl Worth cworth@... wrote:
   Perhaps this is an emacs bug?
  could be, but,
  
   I'm using Debian's emacs 23.3.1 and have not encountered the problem
   described.
  I don't see anything related to 'point', 'point-invisible-p' nor
'forward-char' in there:
  http://patch-tracker.debian.org/package/emacs23/23.3+1-1
 
 Perhaps I was confused. I thought 23.3.1 was a distinct upstream release
 From 23.3, but maybe not, (emacs version numbers use 1-based indexing
 perhaps?).
 
  anyways... for the moment I'll just live with it...
 
 Sorry about that.
 
  except if somebody has some insights on how to catch the 'End of
  buffer' error and add some more protective programming around the
  'scroll-up' function ?
 
 My emacs lisp skills are primarily restricted to actual
 experimentation. So if I can replicate the bug, I might be able to find
 a fix. I'm not very good at doing theoretical fixes with emacs lisp
 code.

I bisected the problem to commit 95ef8da29439f2e79115c36ab4d2a80aef1a1462 (Fix
hiding a message while some citations are shown in notmuch-show view).
Reverting that fixes the problem for me. (If you don't want to resolve
conflicts, also revert 432e091924c1d1d8950a44ca78bc5b9c5ade47e4 first.) I don't
have the time just now to try to figure out the problem in that, but perhaps
this will help others go forward.

Jani


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


Re: Notmuch scripts

2011-06-28 Thread Ben Gamari
On Tue, 28 Jun 2011 10:36:59 +0200, Pieter Praet pie...@praet.org wrote:
 On Mon, 27 Jun 2011 21:31:26 -0400, Ben Gamari bgamari.f...@gmail.com wrote:
  [SNIP] It
  would be nice, however, if the emacs interface supported hiding tags
  matching certain patterns (say /\..+/).
 
 This should be possible as of last month (eb4e0ea2),
 by courtesy of Daniel Schoepe [1].
 
Thanks for your note, althought it appears this only appears to apply to
the notmuch-hello all-tags list. I was hoping one could hide tag
patterns from all lists (or at least search results). This is definitely
a good first step, however.

Cheers,

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


Re: [PATCH 2/2] test: use emacsclient(1) for Emacs tests

2011-06-28 Thread Austin Clements
Quoth myself on Jun 27 at 11:49 pm:
 Quoth Dmitry Kurochkin on Jun 28 at  5:03 am:
 EMACSDONE=$TEST_DIRECTORY/emacsdone
 mkfifo $EMACSDONE
 coproc emacs --batch --eval '(while t (eval (read)) (write-region \n nil 
 '$EMACSDONE' t 0))'
 EMACSFD=${COPROC[1]}
 
 test_emacs() {
 echo $1 $EMACSFD
 read $EMACSDONE
 }
 
 test_emacs '(sleep-for 2)'
 test_emacs '(message Hi)'
 
 echo '(kill-emacs)' $EMACSFD

Oops, got a little overzealous with TEST_DIRECTORY.  For reference,
the pipe should, of course, have gone in the current directory (or
TMP_DIRECTORY).

mkfifo emacsdone
coproc emacs --batch --eval '(while t (eval (read)) (write-region \n nil 
emacsdone t 0))'
EMACSFD=${COPROC[1]}

test_emacs() {
echo $1 $EMACSFD
read  emacsdone
}


(I don't really see how that could be either more shell code or more
elisp code than using emacsclient plus cleanup code [nor why it
matters for five lines of code], but I'm probably missing something.)
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH 2/2] test: use emacsclient(1) for Emacs tests

2011-06-28 Thread Dmitry Kurochkin
On Tue, 28 Jun 2011 12:22:57 -0400, Austin Clements amdra...@mit.edu wrote:
 Quoth myself on Jun 27 at 11:49 pm:
  Quoth Dmitry Kurochkin on Jun 28 at  5:03 am:
  EMACSDONE=$TEST_DIRECTORY/emacsdone
  mkfifo $EMACSDONE
  coproc emacs --batch --eval '(while t (eval (read)) (write-region \n nil 
  '$EMACSDONE' t 0))'
  EMACSFD=${COPROC[1]}
  
  test_emacs() {
  echo $1 $EMACSFD
  read $EMACSDONE
  }
  
  test_emacs '(sleep-for 2)'
  test_emacs '(message Hi)'
  
  echo '(kill-emacs)' $EMACSFD
 
 Oops, got a little overzealous with TEST_DIRECTORY.  For reference,
 the pipe should, of course, have gone in the current directory (or
 TMP_DIRECTORY).
 
 mkfifo emacsdone
 coproc emacs --batch --eval '(while t (eval (read)) (write-region \n nil 
 emacsdone t 0))'
 EMACSFD=${COPROC[1]}
 
 test_emacs() {
 echo $1 $EMACSFD
 read  emacsdone
 }
 
 
 (I don't really see how that could be either more shell code or more
 elisp code than using emacsclient plus cleanup code [nor why it
 matters for five lines of code], but I'm probably missing something.)

Well, it may not be less code if you count lines.  It is just IMHO, but
it shell code in case of emacsclient is simpler (no fifo, no coproc),
cleanup is the same (one line with kill-emacs).  More lisp code in
emacsclient variant, but that is just because you put it all on one line
:)

Code size does not matter indeed.  Your approach just feels more of a
hack to me and unnecessary complex.  Again, this is just my IMHO.

I would like to hear what other (Carl in particular) think about this.
If the consensus is for your approach, I would be happy to implement it.

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


Re: Race condition for '*' command

2011-06-28 Thread Mark Anderson
On Tue, 28 Jun 2011 08:49:06 +0200, Pieter Praet pie...@praet.org wrote:
 On Sun, 26 Jun 2011 10:00:41 +0100, Robin Green gree...@greenrd.org wrote:
  On Sat, 25 Jun 2011 16:57:50 -0700, Jameson Graef Rollins 
  jroll...@finestructure.net wrote:
   On Sat, 25 Jun 2011 23:18:52 +0100, Robin Green gree...@greenrd.org 
   wrote:
A race condition in the '*' command was noted when it was first
proposed. It looks to me like it still exists - has anything been done
about it?
   
   Hi, Robin.  Can you explain what you mean by the '*' command?
  
  Sorry - forgot to say I'm talking about the notmuch emacs mode. In that
  mode '*' applies tags to all messages matching the current search query,
  which means that (here's the race condition) new results that have
  appeared since the last refresh will also be tagged.
 
 This issue appears to stem from the fact that `notmuch-search-operate-all'
 runs (apply 'notmuch-tag notmuch-search-query-string action-split), in which
 `notmuch-search-query-string' points to a moving target.
 
 Could be solved by doing it with `notmuch-search', `mark-whole-buffer'
 and `notmuch-search-{add,remove}-tag-region' instead, but I'm sure
 there's a better way (of which I'm as of yet unaware).

I don't think there's a better way, the results which the user is
viewing is the only visual reference for what the action they intend to
apply will use as the object of said action.  I can imagine some people
wanting to have a way to apply an action to a live query string, but I
distinguish between these people and normal humans reading their email.
I expect that when a normal human is reading their email, they do not
intend to apply actions to messages as yet unseen.

I can see some people using the '*' notmuch emacs command as a very
interactive notmuch-poll.sh script.  But I imagine the principle of
least surprise would be to have '*' only apply to visible messages, and
if the buffer is old, the buffer is the only record of what is being
viewed.

-Mark

 
  -- 
  Robin
  ___
  notmuch mailing list
  notmuch@notmuchmail.org
  http://notmuchmail.org/mailman/listinfo/notmuch
 
 Peace
 
 -- 
 Pieter
 ___
 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 0/4] emacs: find non-matching mails, plus small tweaks

2011-06-28 Thread Jani Nikula
Hi, I've found the following features useful with Emacs. Please have a
look. And be gentle; these are my first lines of lisp I'm sharing in
public, and perhaps not quite as lispy as I'd like them to be... :)

Jani


Jani Nikula (4):
  emacs: Add functions and bindings to archive and mark thread as read
  emacs: Add option to make adding saved searches append, not prepend
  emacs: Add pseudo saved search to match mail that no saved search
matches
  emacs: Add pseudo tag to match all messages that have no tags

 emacs/notmuch-hello.el |   58 ++-
 emacs/notmuch-show.el  |   25 ++--
 2 files changed, 69 insertions(+), 14 deletions(-)

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


[PATCH 1/4] emacs: Add functions and bindings to archive and mark thread as read

2011-06-28 Thread Jani Nikula
Add mark as read versions of the archive thread functions to archive and
and mark each message in thread as read by removing the inbox and
unread tags from the messages. Also add default keybindings A and X for
them: shifted a and x also mark as read.
---
 emacs/notmuch-show.el |   25 ++---
 1 files changed, 22 insertions(+), 3 deletions(-)

diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index 6685717..dbed0a4 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -886,7 +886,9 @@ function is used. 
(define-key map - 'notmuch-show-remove-tag)
(define-key map + 'notmuch-show-add-tag)
(define-key map x 'notmuch-show-archive-thread-then-exit)
+   (define-key map X 'notmuch-show-archive-and-read-thread-then-exit)
(define-key map a 'notmuch-show-archive-thread)
+   (define-key map A 'notmuch-show-archive-and-read-thread)
(define-key map N 'notmuch-show-next-message)
(define-key map P 'notmuch-show-previous-message)
(define-key map n 'notmuch-show-next-open-message)
@@ -1349,10 +1351,12 @@ argument, hide all of the messages.
   (interactive)
   (backward-button 1))
 
-(defun notmuch-show-archive-thread-internal (show-next)
+(defun notmuch-show-archive-thread-internal (show-next mark-read)
   ;; Remove the tag from the current set of messages.
   (goto-char (point-min))
   (loop do (notmuch-show-remove-tag inbox)
+   (if mark-read
+   (notmuch-show-remove-tag unread))
until (not (notmuch-show-goto-message-next)))
   ;; Move to the next item in the search results, if any.
   (let ((parent-buffer notmuch-show-parent-buffer))
@@ -1376,12 +1380,27 @@ 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-internal t))
+  (notmuch-show-archive-thread-internal t nil))
+
+(defun notmuch-show-archive-and-read-thread ()
+  Archive and read each message in thread, then show next thread from search.
+
+Archive and mark as read each message currently shown by removing
+the \inbox\ and \unread\ tags from each. Then kill this
+buffer and show the next thread from the search from which this
+thread was originally shown.
+  (interactive)
+  (notmuch-show-archive-thread-internal t t))
 
 (defun notmuch-show-archive-thread-then-exit ()
   Archive each message in thread, then exit back to search results.
   (interactive)
-  (notmuch-show-archive-thread-internal nil))
+  (notmuch-show-archive-thread-internal nil nil))
+
+(defun notmuch-show-archive-and-read-thread-then-exit ()
+  Archive and read each message in thread, then exit back to search results.
+  (interactive)
+  (notmuch-show-archive-thread-internal nil t))
 
 (defun notmuch-show-stash-cc ()
   Copy CC field of current message to kill-ring.
-- 
1.7.1

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


[PATCH 2/4] emacs: Add option to make adding saved searches append, not prepend

2011-06-28 Thread Jani Nikula
Add new customization option notmuch-add-saved-search-appends to determine
whether new saved searches should be appended to or inserted in front of
saved searches. The default remains insert in front.
---
 emacs/notmuch-hello.el |   10 --
 1 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el
index 65fde75..84bce3a 100644
--- a/emacs/notmuch-hello.el
+++ b/emacs/notmuch-hello.el
@@ -42,6 +42,11 @@
   :type 'boolean
   :group 'notmuch)
 
+(defcustom notmuch-add-saved-search-appends nil
+  Should new saved searches be appended instead of inserted to saved 
searches?
+  :type 'boolean
+  :group 'notmuch)
+
 (defvar notmuch-hello-indent 4
   How much to indent non-headers.)
 
@@ -168,8 +173,9 @@ Typically \,\ in the US and UK and \.\ in Europe.
collect elem))
 ;; Add the new one.
 (customize-save-variable 'notmuch-saved-searches
-(push (cons name search)
-  notmuch-saved-searches))
+(add-to-list 'notmuch-saved-searches
+ (cons name search)
+ notmuch-add-saved-search-appends))
 (message Saved '%s' as '%s'. search name)
 (notmuch-hello-update)))
 
-- 
1.7.1

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


[PATCH 3/4] emacs: Add pseudo saved search to match mail that no saved search matches

2011-06-28 Thread Jani Nikula
Add a pseudo saved search that matches all the mail that no other saved
search matches. Add new customization option notmuch-saved-searches-nomatch
to enable and name the pseudo saved search.
---
 emacs/notmuch-hello.el |   30 +++---
 1 files changed, 23 insertions(+), 7 deletions(-)

diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el
index 84bce3a..b9c9b01 100644
--- a/emacs/notmuch-hello.el
+++ b/emacs/notmuch-hello.el
@@ -47,6 +47,12 @@
   :type 'boolean
   :group 'notmuch)
 
+(defcustom notmuch-saved-searches-nomatch nil
+  Name of the pseudo saved search that no other saved search matches.
+  :type '(choice (const :tag Off nil)
+string)
+  :group 'notmuch)
+
 (defvar notmuch-hello-indent 4
   How much to indent non-headers.)
 
@@ -363,6 +369,22 @@ Complete list of currently available key bindings:
  (not (member tag notmuch-hello-hide-tags)))
(process-lines notmuch-command search-tags)
 
+(defun notmuch-hello-saved-alist ()
+  (if notmuch-saved-searches
+  (let ((saved-alist notmuch-saved-searches))
+   (when notmuch-saved-searches-nomatch
+ ;; Append the no-match search.
+ (add-to-list 'saved-alist
+  (cons notmuch-saved-searches-nomatch
+(mapconcat (lambda (arg) (concat (not ( (cdr 
arg)  notmuch-saved-searches  and )) t))
+   ;; Filter out empty saved searches if required.
+   (if notmuch-show-empty-saved-searches
+   saved-alist
+ (loop for elem in saved-alist
+   if ( (string-to-number (notmuch-saved-search-count (cdr 
elem))) 0)
+   collect elem)))
+notmuch-saved-searches))
+
 ;;;###autoload
 (defun notmuch-hello (optional no-display)
   Run notmuch and display saved searches, known tags, etc.
@@ -433,13 +455,7 @@ Complete list of currently available key bindings:
 
 (let ((found-target-pos nil)
  (final-target-pos nil))
-  (let* ((saved-alist
- ;; Filter out empty saved searches if required.
- (if notmuch-show-empty-saved-searches
- notmuch-saved-searches
-   (loop for elem in notmuch-saved-searches
- if ( (string-to-number (notmuch-saved-search-count (cdr 
elem))) 0)
- collect elem)))
+  (let* ((saved-alist (notmuch-hello-saved-alist))
 (saved-widest (notmuch-hello-longest-label saved-alist))
 (alltags-alist (if notmuch-show-all-tags-list 
(notmuch-hello-generate-tag-alist)))
 (alltags-widest (notmuch-hello-longest-label alltags-alist))
-- 
1.7.1

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


[PATCH 4/4] emacs: Add pseudo tag to match all messages that have no tags

2011-06-28 Thread Jani Nikula
Add a pseudo tag that matches all the messages that have no tags. Add new
customization option notmuch-tags-nomatch to enable and name the pseudo
tag.
---
 emacs/notmuch-hello.el |   18 --
 1 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el
index b9c9b01..1770f60 100644
--- a/emacs/notmuch-hello.el
+++ b/emacs/notmuch-hello.el
@@ -53,6 +53,12 @@
 string)
   :group 'notmuch)
 
+(defcustom notmuch-tags-nomatch nil
+  Name of the pseudo tag to match messages that have no tags.
+  :type '(choice (const :tag Off nil)
+string)
+  :group 'notmuch)
+
 (defvar notmuch-hello-indent 4
   How much to indent non-headers.)
 
@@ -352,7 +358,7 @@ Complete list of currently available key bindings:
 
 (defun notmuch-hello-generate-tag-alist ()
   Return an alist from tags to queries to display in the all-tags section.
-  (notmuch-remove-if-not
+  (let ((tag-alist (notmuch-remove-if-not
#'cdr
(mapcar (lambda (tag)
 (cons tag
@@ -367,7 +373,15 @@ Complete list of currently available key bindings:
   (notmuch-remove-if-not
(lambda (tag)
  (not (member tag notmuch-hello-hide-tags)))
-   (process-lines notmuch-command search-tags)
+   (process-lines notmuch-command search-tags))
+(when notmuch-tags-nomatch
+  (let ((no-tag-search
+(cons notmuch-tags-nomatch
+  (mapconcat (lambda (arg) (concat (not ( (cdr arg)  
tag-alist  and 
+   (if ( (string-to-number (notmuch-saved-search-count (cdr 
no-tag-search))) 0)
+   ;; Append the no-match search.
+   (add-to-list 'tag-alist no-tag-search t
+tag-alist))
 
 (defun notmuch-hello-saved-alist ()
   (if notmuch-saved-searches
-- 
1.7.1

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


Re: [PATCH] libnotmuch: fix typos in CLEAN setting, add file

2011-06-28 Thread Carl Worth
On Sat, 25 Jun 2011 09:45:58 -0300, da...@tethera.net wrote:
 Here is an updated version.

Thanks. I've committed this now, (waiting to be pushed until I fix my
build---the symbols stuff---so I can actually run make test again).

 I'm not sure the best way to do a test of
 the cleaning; maybe we should ship a MANIFEST file containing the
 output of git ls-files. I'm not sure how much churn this would cause
 in git.  Perhaps it could be treated like version, and generated from
 git if possible.

Definitely wouldn't want a generated file under revision control. It
would be possible to just run git ls-files if we're in a git
repository and skip the test otherwise. Or...

 In any case I guess this couldn't really be part of
 our regular test suite, because all the other tests would fail ;).

Heh, that would be a bad failure mode. :-)

The typical way to do this (as far as I understand) is as part of make
distcheck. The idea there is to make a tar file; verify that the tar
file can be unpacked, configured, built, and installed; and then to
verify that make distclean returns the directory to the same state as
just after having unpacked the tar file.

I'm not really all that concerned about it though. We don't add/remove
files all that often, and it's generally not too bad of a failure mode
if make clean isn't perfect.

So if someone added testing for this, that would be fine, but it's not a
high priority for me.

-Carl

-- 
carl.d.wo...@intel.com


pgpwhYk1kMXVL.pgp
Description: PGP signature
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH] libnotmuch: build symbols list without relying on gcc -aux-info.

2011-06-28 Thread Carl Worth
On Sun, 26 Jun 2011 23:42:25 -0300, da...@tethera.net wrote:
  Here is another way of doing this, probably better unless you are
  very attached to the idea of declaring the API in the header file.

Thanks for both of these, David. I've gone ahead and pushed the first,
(generating the symbol list with sed and notmuch.h).

I assume by better you mean that this one is less fragile to issues
like the precise formatting of our notmuch.h header file.

Meanwhile, though, our API *is* declared in the header file, (that's
what the header file exists for), so I do prefer to base our symbol list
on it.

In fact, the ideal would probably be to take the objdump method and use
it in the test suite to verify that its output matches the contents of
notmuch.sym generated from the header file.

-Carl

-- 
carl.d.wo...@intel.com


pgpq1YsTRMFiU.pgp
Description: PGP signature
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH 2/2] search --output=files: Output all filenames for each matching message

2011-06-28 Thread Carl Worth
On Fri, 24 Jun 2011 17:26:55 -0600, Mark Anderson ma.sk...@gmail.com wrote:
 Messages in the database can have multiple files associated with a
 single message-id, but until now only one filename for each message
 has been reported by notmuch search --output=files

Hi Mark,

Thanks for contributing this patch!

I know from a conversation we had in IRC that you needed this feature to
track down a bug you were hitting. Thanks for going the extra mile to
write a new test case and a complete patch for the new feature.

I think the only thing I would like to see in addition is an update to
the documentation to make it explicit that --output=files will emit all
filenames for a message that has more than one filename.

 Perhaps someone can offer a little help making the separator code
 tighter, but this works.

It's amazing how painful it is to get the corner cases right here, isn't
it? It's almost enough to make me wish that we allowed trailing
separators as a standard element of style in conventional prose. [*]

-Carl

[*] Though if I had that wish, I'd also want to wish for the abolition
of any distinction for singular and plural nouns. The code to generate
messages like the following is a pain to write:

Processed 1 file in almost no time.
Added 1 new message to the database. Removed 1 message.

(And that's without even adding support for translations which would
further complicate this.) Ah, well, the price we pay to make code with
clean output.

-- 
carl.d.wo...@intel.com


pgp4Ig6NPhPrR.pgp
Description: PGP signature
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH 2/2] search --output=files: Output all filenames for each matching message

2011-06-28 Thread Carl Worth
On Tue, 28 Jun 2011 12:12:52 -0700, Carl Worth cwo...@cworth.org wrote:
 I think the only thing I would like to see in addition is an update to
 the documentation to make it explicit that --output=files will emit all
 filenames for a message that has more than one filename.

Actually, I went to go update the documentation itself, and I found that
it doesn't really need anything new here. The current text is:

--output=files

Output the filenames of all messages matching the search terms,
either one per line (--format=text) or as a JSON array
(--format=json).

And that's pretty clearly the filenames of all messages.

The fact that we share a single message object when two files contain
the same message-id seems like an implementation detail that's not worth
bringing up here. (It would add more concepts to the documentation but
not actually change the meaning.)

So I've pushed the test and fix as-is now.

-Carl

-- 
carl.d.wo...@intel.com


pgpiLXQb5RN5d.pgp
Description: PGP signature
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: Debian package not building

2011-06-28 Thread Carl Worth
On Fri, 24 Jun 2011 16:34:02 -0700, Jameson Graef Rollins 
jroll...@finestructure.net wrote:
 Hey, folks.  As of today I am for some reason no longer able to build
 the Notmuch Debian package.  I'm using the same build technique I have
 been using for a while (git-buildpackage).  The tail of the failing
 build log is pasted at the bottom of this message.  Is anyone else
 encountering anything like this?

I use git-buildpackage as well. I did recently need to apt-get install
python-all for a recent build-dependency addition. But I'm not getting
any failure like you are getting here.

 I did recently do a system upgrade, so it's
 possible that something there could have caused the problem.

For what it's worth, I did hit some recent problems when doing a Debian
upgrade of libc6. The problem I hit manifested itself much worse, (no
dynamically-linked programs would run). That bug (and its fix) is
described here:

http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=629534

I don't know if it's related to your problem at all, but it's certainly
possible that something unrelated to notmuch is causing the failure
you're getting.

-Carl

-- 
carl.d.wo...@intel.com


pgpAgnkiMeOZv.pgp
Description: PGP signature
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH] libnotmuch: build symbols list without relying on gcc -aux-info.

2011-06-28 Thread David Bremner
On Tue, 28 Jun 2011 12:04:39 -0700, Carl Worth cwo...@cworth.org wrote:

 I assume by better you mean that this one is less fragile to issues
 like the precise formatting of our notmuch.h header file.

Yes, that's what I meant.

 Meanwhile, though, our API *is* declared in the header file, (that's
 what the header file exists for), so I do prefer to base our symbol list
 on it.

Sure, that makes sense to me.  I cherry-picked the sed patch to the
release branch.

 In fact, the ideal would probably be to take the objdump method and use
 it in the test suite to verify that its output matches the contents of
 notmuch.sym generated from the header file.

The second patch being turned into a test sounds like a great idea. I
can do that.

d




pgpcjjdxQHVY3.pgp
Description: PGP signature
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: Race condition for '*' command

2011-06-28 Thread Carl Worth
On Tue, 28 Jun 2011 11:36:10 -0600, Mark Anderson ma.sk...@gmail.com wrote:
 On Tue, 28 Jun 2011 08:49:06 +0200, Pieter Praet pie...@praet.org wrote:
  On Sun, 26 Jun 2011 10:00:41 +0100, Robin Green gree...@greenrd.org wrote:
   On Sat, 25 Jun 2011 16:57:50 -0700, Jameson Graef Rollins 
   jroll...@finestructure.net wrote:
On Sat, 25 Jun 2011 23:18:52 +0100, Robin Green gree...@greenrd.org 
wrote:
 A race condition in the '*' command was noted when it was first
 proposed. It looks to me like it still exists - has anything been done
 about it?

Not much. I did add this note to notmuch/TODO at the time:

Fix '*' to work by simply calling '+' or '-' on a region
consisting of the entire buffer

  Could be solved by doing it with `notmuch-search', `mark-whole-buffer'
  and `notmuch-search-{add,remove}-tag-region' instead, but I'm sure
  there's a better way (of which I'm as of yet unaware).

That's a more concrete description of the same idea.

I did some experiments at one point and determined that doing this would
make '*' far too painful to be usable with large search-result buffers,
(which is precisely when I am most likely to use it).

But even if we were willing to accept the performance penalty, (or if we
fixed notmuch-search-*-tag-region to accumulate the thread IDs and make
a single invocation of notmuch to avoid the performance penalty). Even
then, there would still be race conditions here, (though more subtle
than the current race).

At that point we would only be acting on threads that matched the
original search, but we could be acting on more messages than were
originally presented to the user.

For example, a thread might have been displayed as having only one post,
but the * -inbox operation would remove the inbox tag from any replies
received in the interim.

I'd love to find some clean solutions here, as I would love notmuch to
offer an interface that is free of these race conditions, (which are
scary since they can prevent a user from seeing some mail).

Personally, I'm avoiding all races right now by only running notmuch
new manually, (and not otherwise interacting with notmuch while
notmuch new is running). This does avoid the races, but is fairly
awkward, (I have to manually run this (or use the annoyingly blocking
'G'[*] binding), so I would prefer the ability to have new mail
incorporated automatically as it arrives.

Independent of this particular race condition, having something like
fetchmail automatically invoke notmuch new also has the potential to
break your mail client with Xapian Database-modified exceptions.

So we do need some more direct support for this mode of operation.

In the meantime, I've at least updated the TODO note a bit:

Fix '*' to work by simply calling '+' or '-' on a region
consisting of the entire buffer, (this would avoid one race
condition---while still leaving other race conditions---but
could also potentially make '*' a very expensive operation).

-Carl

[*] notmuch-search-poll-and-refresh-view

-- 
carl.d.wo...@intel.com


pgpD2u5aqQbMs.pgp
Description: PGP signature
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH 2/2] test: use emacsclient(1) for Emacs tests

2011-06-28 Thread Carl Worth
On Tue, 28 Jun 2011 20:42:42 +0400, Dmitry Kurochkin 
dmitry.kuroch...@gmail.com wrote:
 I would like to hear what other (Carl in particular) think about this.
 If the consensus is for your approach, I would be happy to implement
 it.

In general, I love the whole series, thanks! I'm looking forward to our
future, faster test suite.

Even more, I love the constructive dialog that follows the original
series and the attention being focused on getting things right.

As for the detail of whether to use emacsclient or Austin's look-alike,
I don't have a strong attachment to either solution. I do appreciate
concrete technical things like robust against recycled PIDs, more
robust against leaving daemon's around for some reason, etc.

Would any of this potentially interfere with my own usage of emacsclient
and emacs server? I use them regularly and would be quite surprised (and
likely frustrated) if the test suite got mixed up with my existing emacs
server (or the other way around). Maybe that's already taken care of
with either approach? (A quick skim of the emacsclient manual age didn't
make it obvious to me how emacslcient finds its server.)

-Carl

-- 
carl.d.wo...@intel.com


pgpHutqMRmY5m.pgp
Description: PGP signature
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: notmuch Digest, Vol 20, Issue 57

2011-06-28 Thread Carl Worth
On Mon, 27 Jun 2011 09:43:41 +0200, Sander Boer sanderb...@mauc.nl wrote:
 For instance, is this a possibility sync gmail tags with notmuch tags ?
 As fas as I am aware Gmail exposes its tags through imap folders, I am
 not too thrilled about the mixing of paradigms (folders vs tags) and it
 would be great if it could be aligned.

I'm not a gmail user myself, but I can describe some of the options
available.

First, it's important to understand that any friction here comes from
Gmail exposing its tags as folders, (which in turn could be the lack of
availability of a more tag-aware protocol than imap).

So, let's say you've done an imap-based fetch of all of your mail and
now have it in several folders corresponding to the various tags you
made in the Gmail interface, (and you've run notmuch new to create a
notmuch database of all of that).

At that point, you can search (with current notmuch from git---and soon
to be released as notmuch 0.6) on the folder names. This allows you to
do a search based on a Gmail tag. For example, you might have an
important tag in Gmail which you could search with:

notmuch search folder:important

If you wanted to make an actual notmuch tag based on those search
results, you could do that as well:

notmuch tag +important folder:important

And you could even do that on a regular basis, (for example in some
script that sucks down new email from Gmail). In this case you might
want to avoid re-tagging pre-tagged mail by amending the search terms:

notmuch tag +important folder:important and not tag:important

(Note that this is an optimization that notmuch could be making
automatically, and that's something I'd love to see happen in notmuch at
some point.)

Hopefully it's clear enough that you could do the above in a script that
loops over all of your existing tags.

And if you were doing a one-time switch from Gmail to notmuch that would
be all you would need.

I don't know if you're looking to also push tags added via some notmuch
interface back to Gmail, (does Gmail even provide a mechanism for doing
that?). If so, then you'd need something that took notmuch tags and made
copies of the message in the appropriate files. That would hopefully be
easy to script based on the output of:

notmuch search --output=files tag:important

I think my short answer is that it's fairly easy to convert from Gmail
tags to notmuch tags as part of a one-time import. Doing this on a
continual basis might benefit from writing a few scripts, and I don't
know if anyone has written those scripts yet.

Would any Gmail+notmuch users care to add anything to the conversation?

-Carl

-- 
carl.d.wo...@intel.com


pgp3P2K0619Lp.pgp
Description: PGP signature
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH] test:Improve test behaviors when --root is used

2011-06-28 Thread Carl Worth
On Mon, 27 Jun 2011 17:03:03 -0600, Mark Anderson markr.ander...@amd.com 
wrote:
 On Mon, 27 Jun 2011 15:50:47 -0500, Austin Clements amdra...@mit.edu wrote:
  This looks great (modulo one bug, below).  I've wanted to run the
  tests on tmpfs before, but was too lazy to actually fix the tests.

Yes, it does look great. Thanks for the patch, Mark!

Did you miss Austin's note about a possible bug? (You quoted it but
didn't reply). See below:

    run_test(){
   -    result=$(LD_LIBRARY_PATH=../../lib ./symbol-test 21)
   +    result=$(LD_LIBRARY_PATH=$TEST_DIRECTORY/../../lib ./symbol-test 
   21)
  
  Did you mean $TEST_DIRECTORY/../lib?

If you could follow up with an updated patch, (or an argument that the
original patch is correct), that would be great.

-Carl

-- 
carl.d.wo...@intel.com


pgpP8WphNufET.pgp
Description: PGP signature
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: Drafts being tagged as inbox

2011-06-28 Thread Carl Worth
On Mon, 27 Jun 2011 22:50:25 +0100, Robin Green gree...@greenrd.org wrote:
 My drafts (created using emacs message mode) are being tagged as
 inbox. However, they are not tagged as drafts. This is because emacs
 message mode does not store drafts in Maildir format, so there are no
 Maildir flags (e.g. D for draft) to sync tags with.
 
 Now, I could simply store drafts somewhere else, but then I wouldn't be
 able to search them using notmuch. Is there another way to have drafts
 correctly tagged?

Notmuch isn't much involved in the current saving of drafts, so if we
wanted to do something like save drafts to a maildir instead, we could
override the buffer-saving functions in our message-composition buffers.

Meanwhile, even without a tag, I do like that my drafts are currently
getting indexed by notmuch and show up in search results, (they even
show up with a timestamp of 0 so accidentally get sorted right to the
top of many search results). That's convenient.

Even handier would be a separate notmuch-hello search result showing me
I have some drafts to complete, (which would then, benefit from a tag).

The biggest annoyance I currently have with drafts is that they aren't
automatically removed from the filesystem when I finally send the
message. If someone were to contribute a fix for that, it would really
make my day.

-Carl

-- 
carl.d.wo...@intel.com


pgpiNRhgurust.pgp
Description: PGP signature
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH 2/2] test: use emacsclient(1) for Emacs tests

2011-06-28 Thread Dmitry Kurochkin
On Tue, 28 Jun 2011 13:10:58 -0700, Carl Worth cwo...@cworth.org wrote:
 On Tue, 28 Jun 2011 20:42:42 +0400, Dmitry Kurochkin 
 dmitry.kuroch...@gmail.com wrote:
  I would like to hear what other (Carl in particular) think about this.
  If the consensus is for your approach, I would be happy to implement
  it.
 
 In general, I love the whole series, thanks! I'm looking forward to our
 future, faster test suite.
 
 Even more, I love the constructive dialog that follows the original
 series and the attention being focused on getting things right.
 
 As for the detail of whether to use emacsclient or Austin's look-alike,
 I don't have a strong attachment to either solution. I do appreciate
 concrete technical things like robust against recycled PIDs,

This is an issue indeed.  We can take more care to better identify the
process.  But I think this is not really needed.  I am fine with leaving
a small (very tiny, really :)) possibility for leaving Emacs running for
longer than needed.  Note this only happens if test is terminated
abnormally.

 more
 robust against leaving daemon's around for some reason, etc.
 

Not sure I agree with this.  The watchdog is not perfect, but not less
reliable.  It reacts with a delay, but again I do not think this is so
important.

I think I found an issue with Austin's approach: if an error happens
(and is not catched), the loop would stop.  Currently, this would result
in non-working tests and also would leave the Emacs process behind.  I
guess we will have to add error catching in the loop.  Austin?

 Would any of this potentially interfere with my own usage of emacsclient
 and emacs server? I use them regularly and would be quite surprised (and
 likely frustrated) if the test suite got mixed up with my existing emacs
 server (or the other way around). Maybe that's already taken care of
 with either approach? (A quick skim of the emacsclient manual age didn't
 make it obvious to me how emacslcient finds its server.)
 

Emacs uses `server-name' and emacsclient --socket-name to identify the
server.  Tests use notmuch-test-suite-TEST_SHELL_PID server name.
While it is not entirely impossible to mess your existing Emacs server,
it is unlikely enough IMO.

Regards,
  Dmitry

 -Carl
 
 -- 
 carl.d.wo...@intel.com
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH 2/2] test: use emacsclient(1) for Emacs tests

2011-06-28 Thread Dmitry Kurochkin
On Tue, 28 Jun 2011 13:10:58 -0700, Carl Worth cwo...@cworth.org wrote:
Non-text part: multipart/signed
 On Tue, 28 Jun 2011 20:42:42 +0400, Dmitry Kurochkin 
 dmitry.kuroch...@gmail.com wrote:
  I would like to hear what other (Carl in particular) think about this.
  If the consensus is for your approach, I would be happy to implement
  it.
 
 In general, I love the whole series, thanks! I'm looking forward to our
 future, faster test suite.
 

BTW Carl, while we continue our debate, you may consider applying the
first 9 patches from the series :)

id:1309236311-2162-1-git-send-email-dmitry.kuroch...@gmail.com

Regards,
  Dmitry

 Even more, I love the constructive dialog that follows the original
 series and the attention being focused on getting things right.
 
 As for the detail of whether to use emacsclient or Austin's look-alike,
 I don't have a strong attachment to either solution. I do appreciate
 concrete technical things like robust against recycled PIDs, more
 robust against leaving daemon's around for some reason, etc.
 
 Would any of this potentially interfere with my own usage of emacsclient
 and emacs server? I use them regularly and would be quite surprised (and
 likely frustrated) if the test suite got mixed up with my existing emacs
 server (or the other way around). Maybe that's already taken care of
 with either approach? (A quick skim of the emacsclient manual age didn't
 make it obvious to me how emacslcient finds its server.)
 
 -Carl
 
 -- 
 carl.d.wo...@intel.com
Non-text part: application/pgp-signature
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


[PATCH v2] test:Improve test behaviors when --root is used

2011-06-28 Thread Mark Anderson
Change add_email_corpus, emacs_deliver_message and tests to use
$TEST_DIRECTORY instead of '..'.

This improves the behavior of the usage of --root=dir, as the
assumption of what '..' means will usually be incorrect.

Document -root option in README and update valgrind to work with
-root.

Signed-off-by: Mark Anderson ma.sk...@gmail.com
---
 If you could follow up with an updated patch, (or an argument that the
 original patch is correct), that would be great.

Updated the patch with Austin's suggestion.

I'm not personally ready to forbid the use of '..', although I certainly
appreciate the motivation to keep our tests working in --root mode.

 test/README|9 +
 test/basic |   10 +-
 test/crypto|2 +-
 test/emacs |4 ++--
 test/symbol-hiding |4 ++--
 test/test-lib.sh   |   18 +-
 6 files changed, 28 insertions(+), 19 deletions(-)

diff --git a/test/README b/test/README
index be75e0e..8fbf78d 100644
--- a/test/README
+++ b/test/README
@@ -41,6 +41,15 @@ The following command-line options are available when 
running tests:
As the names depend on the tests' file names, it is safe to
run the tests with this option in parallel.
 
+--root=dir::
+   This runs the testsuites specified under a seperate directory.
+   However, caution is advised, as not all tests are maintained
+   with this relocation in mind, so some tests may behave
+   differently.
+
+   Pointing this argument at a tmpfs filesystem can improve the
+   speed of the test suite for some users.
+
 When invoking the test suite via make test any of the above options
 can be specified as follows:
 
diff --git a/test/basic b/test/basic
index d6e8c10..33bf711 100755
--- a/test/basic
+++ b/test/basic
@@ -51,9 +51,9 @@ test_expect_code 2 'failure to clean up causes the test to 
fail' '
 
 # Ensure that all tests are being run
 test_begin_subtest 'Ensure that all available tests will be run by 
notmuch-test'
-eval $(sed -n -e '/^TESTS=$/,/^$/p' notmuch-test ../notmuch-test)
+eval $(sed -n -e '/^TESTS=$/,/^$/p' notmuch-test 
$TEST_DIRECTORY/notmuch-test)
 tests_in_suite=$(for i in $TESTS; do echo $i; done | sort)
-available=$(ls -1 ../ | \
+available=$(ls -1 $TEST_DIRECTORY/ | \
 sed -r -e 
/^(aggregate-results.sh|Makefile|Makefile.local|notmuch-test)/d \
   -e 
/^(README|test-lib.sh|test-lib.el|test-results|tmp.*|valgrind|corpus*)/d \
   -e 
/^(emacs.expected-output|smtp-dummy|smtp-dummy.c|test-verbose|symbol-test.cc)/d
 \
@@ -63,19 +63,19 @@ available=$(ls -1 ../ | \
   | sort)
 test_expect_equal $tests_in_suite $available
 
-EXPECTED=../test.expected-output
+EXPECTED=$TEST_DIRECTORY/test.expected-output
 suppress_diff_date() {
 sed -e 's/\(.*\-\-\- test-verbose\.4\.\expected\).*/\1/' \
-e 's/\(.*\+\+\+ test-verbose\.4\.\output\).*/\1/'
 }
 
 test_begin_subtest Ensure that test output is suppressed unless the test 
fails
-output=$(cd ..; ./test-verbose 21 | suppress_diff_date)
+output=$(cd $TEST_DIRECTORY; ./test-verbose 21 | suppress_diff_date)
 expected=$(cat $EXPECTED/test-verbose-no | suppress_diff_date)
 test_expect_equal $output $expected
 
 test_begin_subtest Ensure that -v does not suppress test output
-output=$(cd ..; ./test-verbose -v 21 | suppress_diff_date)
+output=$(cd $TEST_DIRECTORY; ./test-verbose -v 21 | suppress_diff_date)
 expected=$(cat $EXPECTED/test-verbose-yes | suppress_diff_date)
 # Do not include the results of test-verbose in totals
 rm $TEST_DIRECTORY/test-results/test-verbose-*
diff --git a/test/crypto b/test/crypto
index 01daffe..7eb3559 100755
--- a/test/crypto
+++ b/test/crypto
@@ -12,7 +12,7 @@ add_gnupg_home ()
 local output
 [ -d ${GNUPGHOME} ]  return
 mkdir -m 0700 $GNUPGHOME
-gpg --no-tty --import ../gnupg-secret-key.asc $GNUPGHOME/import.log 
21
+gpg --no-tty --import $TEST_DIRECTORY/gnupg-secret-key.asc 
$GNUPGHOME/import.log 21
 test_debug cat $GNUPGHOME/import.log
 if (gpg --quick-random --version /dev/null 21) ; then
echo quick-random  $GNUPGHOME/gpg.conf
diff --git a/test/emacs b/test/emacs
index 6f82b08..f91078e 100755
--- a/test/emacs
+++ b/test/emacs
@@ -2,7 +2,7 @@
 test_description=emacs interface
 . test-lib.sh
 
-EXPECTED=../emacs.expected-output
+EXPECTED=$TEST_DIRECTORY/emacs.expected-output
 
 add_email_corpus
 
@@ -81,7 +81,7 @@ mkdir -p mail/sent/cur
 mkdir -p mail/sent/new
 mkdir -p mail/sent/tmp
 
-../smtp-dummy sent_message 
+$TEST_DIRECTORY/smtp-dummy sent_message 
 smtp_dummy_pid=$!
 test_emacs (setq message-send-mail-function 'message-smtpmail-send-it) (setq 
smtpmail-smtp-server \localhost\) (setq smtpmail-smtp-service \25025\) 
(notmuch-hello) (notmuch-mua-mail) (message-goto-to) (insert 
\u...@example.com\nDate: Fri, 29 Mar 1974 10:00:00 -\) 
(message-goto-subject) (insert \Testing message sent via SMTP\) 
(message-goto-body) (insert \This is a test that messages are sent via SMTP\) 

Re: notmuch Digest, Vol 20, Issue 57

2011-06-28 Thread Sander Boer

Carl Worth cwo...@cworth.org writes: 

[snip]

 First, it's important to understand that any friction here comes from
 Gmail exposing its tags as folders, (which in turn could be the lack of
 availability of a more tag-aware protocol than imap).


I agree that this is the key issue here. 
I was hoping that google somehow was able to expose the tags in the All
Mail folder, like the headers that are gmail specific: X-pstn-nxpr and 
X-pstn-nxp (which contains a
hash) for instance.


 So, let's say you've done an imap-based fetch of all of your mail and
 now have it in several folders corresponding to the various tags you
 made in the Gmail interface, (and you've run notmuch new to create a
 notmuch database of all of that).

 At that point, you can search (with current notmuch from git---and soon
 to be released as notmuch 0.6) on the folder names. This allows you to
 do a search based on a Gmail tag. For example, you might have an
 important tag in Gmail which you could search with:

   notmuch search folder:important

ah, I have the ubuntu version,  will update to git soon.


 If you wanted to make an actual notmuch tag based on those search
 results, you could do that as well:

   notmuch tag +important folder:important

 And you could even do that on a regular basis, (for example in some
 script that sucks down new email from Gmail). In this case you might
 want to avoid re-tagging pre-tagged mail by amending the search terms:

   notmuch tag +important folder:important and not tag:important

 (Note that this is an optimization that notmuch could be making
 automatically, and that's something I'd love to see happen in notmuch at
 some point.)

 Hopefully it's clear enough that you could do the above in a script that
 loops over all of your existing tags.

 And if you were doing a one-time switch from Gmail to notmuch that would
 be all you would need.

 I don't know if you're looking to also push tags added via some notmuch
 interface back to Gmail, (does Gmail even provide a mechanism for doing
 that?). If so, then you'd need something that took notmuch tags and made
 copies of the message in the appropriate files. That would hopefully be
 easy to script based on the output of:

   notmuch search --output=files tag:important

 I think my short answer is that it's fairly easy to convert from Gmail
 tags to notmuch tags as part of a one-time import. Doing this on a
 continual basis might benefit from writing a few scripts, and I don't
 know if anyone has written those scripts yet.

 Would any Gmail+notmuch users care to add anything to the conversation?

 -Carl


now using gnus still, b/c notmuch does not build for the N900 (bummer)

-- 
Sander Boer

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


[PATCH v3] test:Improve test behaviors when --root is used

2011-06-28 Thread Mark Anderson
Change add_email_corpus, emacs_deliver_message and tests to use
$TEST_DIRECTORY instead of '..'.

This improves the behavior of the usage of --root=dir, as the
assumption of what '..' means will usually be incorrect.

Document -root option in README and update valgrind to work with
-root.
---

This patch actually fixes what Austin pointed out.  

 test/README|9 +
 test/basic |   10 +-
 test/crypto|2 +-
 test/emacs |4 ++--
 test/symbol-hiding |4 ++--
 test/test-lib.sh   |   18 +-
 6 files changed, 28 insertions(+), 19 deletions(-)

diff --git a/test/README b/test/README
index be75e0e..8fbf78d 100644
--- a/test/README
+++ b/test/README
@@ -41,6 +41,15 @@ The following command-line options are available when 
running tests:
As the names depend on the tests' file names, it is safe to
run the tests with this option in parallel.
 
+--root=dir::
+   This runs the testsuites specified under a seperate directory.
+   However, caution is advised, as not all tests are maintained
+   with this relocation in mind, so some tests may behave
+   differently.
+
+   Pointing this argument at a tmpfs filesystem can improve the
+   speed of the test suite for some users.
+
 When invoking the test suite via make test any of the above options
 can be specified as follows:
 
diff --git a/test/basic b/test/basic
index d6e8c10..33bf711 100755
--- a/test/basic
+++ b/test/basic
@@ -51,9 +51,9 @@ test_expect_code 2 'failure to clean up causes the test to 
fail' '
 
 # Ensure that all tests are being run
 test_begin_subtest 'Ensure that all available tests will be run by 
notmuch-test'
-eval $(sed -n -e '/^TESTS=$/,/^$/p' notmuch-test ../notmuch-test)
+eval $(sed -n -e '/^TESTS=$/,/^$/p' notmuch-test 
$TEST_DIRECTORY/notmuch-test)
 tests_in_suite=$(for i in $TESTS; do echo $i; done | sort)
-available=$(ls -1 ../ | \
+available=$(ls -1 $TEST_DIRECTORY/ | \
 sed -r -e 
/^(aggregate-results.sh|Makefile|Makefile.local|notmuch-test)/d \
   -e 
/^(README|test-lib.sh|test-lib.el|test-results|tmp.*|valgrind|corpus*)/d \
   -e 
/^(emacs.expected-output|smtp-dummy|smtp-dummy.c|test-verbose|symbol-test.cc)/d
 \
@@ -63,19 +63,19 @@ available=$(ls -1 ../ | \
   | sort)
 test_expect_equal $tests_in_suite $available
 
-EXPECTED=../test.expected-output
+EXPECTED=$TEST_DIRECTORY/test.expected-output
 suppress_diff_date() {
 sed -e 's/\(.*\-\-\- test-verbose\.4\.\expected\).*/\1/' \
-e 's/\(.*\+\+\+ test-verbose\.4\.\output\).*/\1/'
 }
 
 test_begin_subtest Ensure that test output is suppressed unless the test 
fails
-output=$(cd ..; ./test-verbose 21 | suppress_diff_date)
+output=$(cd $TEST_DIRECTORY; ./test-verbose 21 | suppress_diff_date)
 expected=$(cat $EXPECTED/test-verbose-no | suppress_diff_date)
 test_expect_equal $output $expected
 
 test_begin_subtest Ensure that -v does not suppress test output
-output=$(cd ..; ./test-verbose -v 21 | suppress_diff_date)
+output=$(cd $TEST_DIRECTORY; ./test-verbose -v 21 | suppress_diff_date)
 expected=$(cat $EXPECTED/test-verbose-yes | suppress_diff_date)
 # Do not include the results of test-verbose in totals
 rm $TEST_DIRECTORY/test-results/test-verbose-*
diff --git a/test/crypto b/test/crypto
index 01daffe..7eb3559 100755
--- a/test/crypto
+++ b/test/crypto
@@ -12,7 +12,7 @@ add_gnupg_home ()
 local output
 [ -d ${GNUPGHOME} ]  return
 mkdir -m 0700 $GNUPGHOME
-gpg --no-tty --import ../gnupg-secret-key.asc $GNUPGHOME/import.log 
21
+gpg --no-tty --import $TEST_DIRECTORY/gnupg-secret-key.asc 
$GNUPGHOME/import.log 21
 test_debug cat $GNUPGHOME/import.log
 if (gpg --quick-random --version /dev/null 21) ; then
echo quick-random  $GNUPGHOME/gpg.conf
diff --git a/test/emacs b/test/emacs
index 6f82b08..f91078e 100755
--- a/test/emacs
+++ b/test/emacs
@@ -2,7 +2,7 @@
 test_description=emacs interface
 . test-lib.sh
 
-EXPECTED=../emacs.expected-output
+EXPECTED=$TEST_DIRECTORY/emacs.expected-output
 
 add_email_corpus
 
@@ -81,7 +81,7 @@ mkdir -p mail/sent/cur
 mkdir -p mail/sent/new
 mkdir -p mail/sent/tmp
 
-../smtp-dummy sent_message 
+$TEST_DIRECTORY/smtp-dummy sent_message 
 smtp_dummy_pid=$!
 test_emacs (setq message-send-mail-function 'message-smtpmail-send-it) (setq 
smtpmail-smtp-server \localhost\) (setq smtpmail-smtp-service \25025\) 
(notmuch-hello) (notmuch-mua-mail) (message-goto-to) (insert 
\u...@example.com\nDate: Fri, 29 Mar 1974 10:00:00 -\) 
(message-goto-subject) (insert \Testing message sent via SMTP\) 
(message-goto-body) (insert \This is a test that messages are sent via SMTP\) 
(message-send-and-exit) /dev/null 21
 wait ${smtp_dummy_pid}
diff --git a/test/symbol-hiding b/test/symbol-hiding
index bb55524..d0b31ae 100755
--- a/test/symbol-hiding
+++ b/test/symbol-hiding
@@ -12,13 +12,13 @@ test_description='exception symbol hiding'
 . ./test-lib.sh
 
 run_test(){
-

Re: [PATCH 10/10] test: use emacsclient(1) for Emacs tests

2011-06-28 Thread Dmitry Kurochkin
On Tue, 28 Jun 2011 15:14:04 -0700, Carl Worth cwo...@cworth.org wrote:
 On Tue, 28 Jun 2011 08:45:11 +0400, Dmitry Kurochkin 
 dmitry.kuroch...@gmail.com wrote:
  Before the change, every Emacs test ran in a separate Emacs
  instance.  Starting Emacs many times wastes considerable time and
  it gets worse as the test suite grows.  The patch solves this by
  using a single Emacs server and emacsclient(1) to run multiple
  tests. 
 
 Great, great stuff, Dmitry!
 
 I've pushed everything earlier than this patch in this series.
 
 And I'd be fine pushing this one as well, (if Austin cares strongly
 about not polling, I'll invite him to improve things from here).
 
 Except that things don't actually work for me with this patch applied.
 
 I'm not getting consistent results from the test suite, (I have seen
 both 2 tests failed and 5 tests failed). Here are the failures from
 a recent run with 5 failures:
 
  FAIL   decryption, --format=text
  FAIL   decryption, --format=json
  FAIL   decryption, --format=json, --part=4
  FAIL   decrypt attachment (--part=5 --format=raw)
  FAIL   decryption failure with missing key
 
 In each case the actual output was either empty, or an empty JSON
 array. In some cases notmuch also gave an error:
 
 Error: search term did not match precisely one message.
 
 Are you not getting these same failures?
 

Ouch.  I never saw these.  Do you get these in crypto tests only?

Regards,
  Dmitry

 Let me know what else I can do to investigate this.
 
 -Carl
 
 -- 
 carl.d.wo...@intel.com
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: notmuch Digest, Vol 20, Issue 57

2011-06-28 Thread Mark Anderson
On Tue, 28 Jun 2011 23:43:52 +0200, Sander Boer sanb...@gmail.com wrote:
 Carl Worth cwo...@cworth.org writes: 
 
  Hopefully it's clear enough that you could do the above in a script that
  loops over all of your existing tags.
 
  And if you were doing a one-time switch from Gmail to notmuch that would
  be all you would need.
 
  I don't know if you're looking to also push tags added via some notmuch
  interface back to Gmail, (does Gmail even provide a mechanism for doing
  that?). If so, then you'd need something that took notmuch tags and made
  copies of the message in the appropriate files. That would hopefully be
  easy to script based on the output of:
 
  notmuch search --output=files tag:important

You'd probably actually want this:

 notmuch search --output=files tag:importand and not folder:important

Although until the folder: tag bug is fixed, it won't be as definitive
as you want, because once the message was in folder:important, it
doesn't really leave.

However, With my recent patch you'll also get more filenames than you
want for this behavior.  If you already have the mail in All Mail,
Inbox, my_special_tag, and not_that_tag, do you want 4 links or copies
of the message placed in the folder for Important?

I had thought of this, because I am a Gmail/notmuch user (well,
somewhat, I have some of the infra in place, but it's not polished, I
usually end up using phone or web)

I had briefly considered adding another output format file, just to get a
single file for each message in the db, but the file/files distinction
feels a bit niggling.  Perhaps it should be changed to files and
filelists or something else more clear.

It was nagging me as I implemented the fix I submitted, which looks like
it has been pushed.

Any comments?  I don't think I have time to code any changes to this for
a couple days.

  I think my short answer is that it's fairly easy to convert from Gmail
  tags to notmuch tags as part of a one-time import. Doing this on a
  continual basis might benefit from writing a few scripts, and I don't
  know if anyone has written those scripts yet.

Yes, you need a label-folder as well as a folder-label part of the
script.  I think of it as:

1. label-folder sync
2. offlineimap (pushes label changes, pulls new mail)
3. folder-label sync

There is certainly room for some conflict, if you use multiple
interfaces.  So watch your head.

-Mark

 
  Would any Gmail+notmuch users care to add anything to the conversation?
 
  -Carl
 
 
 now using gnus still, b/c notmuch does not build for the N900 (bummer)
 
 -- 
 Sander Boer
 
 ___
 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 2/2] test: use emacsclient(1) for Emacs tests

2011-06-28 Thread Carl Worth
On Wed, 29 Jun 2011 00:47:37 +0400, Dmitry Kurochkin 
dmitry.kuroch...@gmail.com wrote:
  more robust against leaving daemon's around for some reason, etc.
 
 Not sure I agree with this.

I'm sorry. I wasn't clear.

I wasn't advocating one solution over the other. I was just giving an
example of the kind of technical merits on which I would like to see the
approaches evaluated.

I care about the robustness of the approach here. I'm less inclined to
care about the messiness of the implementation (however that is
measured).

If both approaches are equally robust, then I'll take your word for it,
and that's great.

-Carl

-- 
carl.d.wo...@intel.com


pgpFrIGbTC0UI.pgp
Description: PGP signature
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH 2/2] test: use emacsclient(1) for Emacs tests

2011-06-28 Thread Carl Worth
On Wed, 29 Jun 2011 00:58:41 +0400, Dmitry Kurochkin 
dmitry.kuroch...@gmail.com wrote:
 BTW Carl, while we continue our debate, you may consider applying the
 first 9 patches from the series :)

Yes, I already did that.

And I would have even installed all 10 (with the debate still going)
except that I'm seeing tests fail, (as mentioned in the other thread).

-Carl

-- 
carl.d.wo...@intel.com


pgpaZkx9nNs0X.pgp
Description: PGP signature
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: notmuch Digest, Vol 20, Issue 57

2011-06-28 Thread Mark Anderson
On Tue, 28 Jun 2011 23:43:52 +0200, Sander Boer sanb...@gmail.com wrote:
 
 Carl Worth cwo...@cworth.org writes: 
 I was hoping that google somehow was able to expose the tags in the All
 Mail folder, like the headers that are gmail specific: X-pstn-nxpr and 
 X-pstn-nxp (which contains a
 hash) for instance.

I don't even see those headers in my email in All Mail.  How are you
fetching your mail?

Or are you hoping for something else to be there that isn't there?

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


Re: [PATCH v3] test:Improve test behaviors when --root is used

2011-06-28 Thread Carl Worth
On Tue, 28 Jun 2011 16:11:32 -0600, Mark Anderson ma.sk...@gmail.com wrote:
 Change add_email_corpus, emacs_deliver_message and tests to use
 $TEST_DIRECTORY instead of '..'.
...
 Document -root option in README and update valgrind to work with
 -root.

Thanks for the features, Mark. These should all be quite handy.

 This patch actually fixes what Austin pointed out.  

And thanks for the eagle-eyed review, Austin!

This is pushed out now.

-Carl



pgpLZRle4crA2.pgp
Description: PGP signature
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: notmuch Digest, Vol 20, Issue 57

2011-06-28 Thread Carl Worth
On Tue, 28 Jun 2011 16:38:30 -0600, Mark Anderson ma.sk...@gmail.com wrote:
 I had briefly considered adding another output format file, just to get a
 single file for each message in the db, but the file/files distinction
 feels a bit niggling.  Perhaps it should be changed to files and
 filelists or something else more clear.

Another option that would be general to several commands would be:

notmuch search --output=files --exclude-duplicates

Or alternately, --include-duplicates. That might be more useful for
notmuch show which is a case where users have previously asked for the
ability to ask for duplicate messages, (and where the duplicates are
squelched by default).

Thoughts?

-Carl

-- 
carl.d.wo...@intel.com


pgpngGAwFCxED.pgp
Description: PGP signature
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH 10/10] test: use emacsclient(1) for Emacs tests

2011-06-28 Thread Carl Worth
On Wed, 29 Jun 2011 02:22:31 +0400, Dmitry Kurochkin 
dmitry.kuroch...@gmail.com wrote:
 Ouch.  I never saw these.  Do you get these in crypto tests only?

Yes.

I just found the bug. The crypto tests use emacs_deliver_message to
generate signed/encrypted messages, but that function doesn't call
increment_mtime between running emacs and running notmuch new.

That means that if the emacs_deliver_message code is fast enough, (less
than 1 second), and if the test suite is being run on a lame filesystem
without sub-second timestamp granularity (including ext3fs) that the
notmuch new invocation will not see the mail[*].

I've added a call to increment_mtime and the failures go away. So I've
pushed the patch to use emacsclient now.

Thanks very much for helping our test suite run faster!

-Carl

[*] And, yes, this does mean that there are race conditions under which
mail can be delivered and notmuch won't see it, (unless subsequent mails
are delivered to the same directory). Austin has a plan to fix the use
of the mtime timestamp in notmuch, (never storing the current mtime in
the database if it's the same as the current time), that should
hopefully close this race window.

-- 
carl.d.wo...@intel.com


pgp57jpDcxJ7N.pgp
Description: PGP signature
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


[PATCH 1/3] test: `notmuch-show-advance-and-archive' with invisible signature

2011-06-28 Thread Dmitry Kurochkin
Add Emacs test to check that `notmuch-show-advance-and-archive'
works for the last message in thread with invisible signature.
---

This patch series fixes the bug reported by Sebastien in [1].  I
was able to reproduce it and confirm that the second patch from
this series fixes the problem.  Unfortunately, I can not explain
why it fixes it.  The patch uses a cleaner approach for visible
text search.  But the old approach should work fine as well.
Apparently, it does not work when `invisible' property is not a
single symbol but a list (which was changed in
95ef8da29439f2e79115c36ab4d2a80aef1a1462).  I suspect that it is
an Emacs bug.  I plan to look at it later.

Another issue is that the test does not demonstrate the bug.
Again, I do not really know why.  It passes both before and after
the fix.  Although if I run the test commands by hand I hit the
bug.  I guess it has something to do with emacs daemon mode when
the buffer is not visible.  I hope someone with a better elisp
knowledge can tell what is going on and how to make the test
work.

I believe patches 2 and 3 can be pushed after review even without
a working test.

Regards,
  Dmitry

[1] id:8739j5rn2d@cern.ch

 test/emacs |   12 
 1 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/test/emacs b/test/emacs
index e59de47..65a96a5 100755
--- a/test/emacs
+++ b/test/emacs
@@ -347,4 +347,16 @@ test_emacs '(notmuch-show 
id:f35dbb950911171438k5df6eb56k77b6c0944e2e79ae@mail.
(test-visible-output)'
 test_expect_equal_file OUTPUT 
$EXPECTED/notmuch-show-thread-with-hidden-messages
 
+test_begin_subtest 'notmuch-show-advance-and-archive with invisible signature'
+message1='id:20091118010116.gc25...@dottiness.seas.harvard.edu'
+message2='id:1258491078-29658-1-git-send-email-dotted...@dottedmag.net'
+test_emacs (notmuch-search \$message1 or $message2\)
+   (notmuch-test-wait)
+   (notmuch-search-show-thread)
+   (notmuch-show-advance-and-archive)
+   (test-output)
+test_emacs (notmuch-show \$message2\)
+   (test-output \EXPECTED\)
+test_expect_equal_file OUTPUT EXPECTED
+
 test_done
-- 
1.7.5.4

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


[PATCH 2/3] emacs: improve hidden signatures handling in notmuch-show-advance-and-archive

2011-06-28 Thread Dmitry Kurochkin
Use `previous-single-char-property-change' instead of going
through each character by hand and testing it's visibility.  This
fixes `notmuch-show-advance-and-archive' to work for the last
message in thread with hidden signature.
---
 emacs/notmuch-show.el |   17 +
 1 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index 6685717..ad3cc7b 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -1113,17 +1113,18 @@ thread, (remove the \inbox\ tag from each message). 
Also kill
 this buffer, and display the next thread from the search from
 which this thread was originally shown.
   (interactive)
-  (let ((end-of-this-message (notmuch-show-message-bottom)))
+  (let* ((end-of-this-message (notmuch-show-message-bottom))
+(visible-end-of-this-message (1- end-of-this-message)))
+(while (invisible-p visible-end-of-this-message)
+  (setq visible-end-of-this-message
+   (previous-single-char-property-change visible-end-of-this-message
+ 'invisible)))
 (cond
  ;; Ideally we would test `end-of-this-message' against the result
  ;; of `window-end', but that doesn't account for the fact that
- ;; the end of the message might be hidden, so we have to actually
- ;; go to the end, walk back over invisible text and then see if
- ;; point is visible.
- ((save-excursion
-   (goto-char (- end-of-this-message 1))
-   (notmuch-show-move-past-invisible-backward)
-   ( (point) (window-end)))
+ ;; the end of the message might be hidden.
+ ((and visible-end-of-this-message
+  ( visible-end-of-this-message (window-end)))
   ;; The bottom of this message is not visible - scroll.
   (scroll-up nil))
 
-- 
1.7.5.4

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


[PATCH 3/3] emacs: remove no longer used functions from notmuch-show.el

2011-06-28 Thread Dmitry Kurochkin
Remove `notmuch-show-move-past-invisible-backward' and
`notmuch-show-move-past-invisible-forward' functions which are
unused.
---
 emacs/notmuch-show.el |8 
 1 files changed, 0 insertions(+), 8 deletions(-)

diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index ad3cc7b..dcaea65 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -977,14 +977,6 @@ All currently available key bindings:
 (notmuch-show-move-to-message-top)
 t))
 
-(defun notmuch-show-move-past-invisible-forward ()
-  (while (point-invisible-p)
-(forward-char)))
-
-(defun notmuch-show-move-past-invisible-backward ()
-  (while (point-invisible-p)
-(backward-char)))
-
 ;; Functions relating to the visibility of messages and their
 ;; components.
 
-- 
1.7.5.4

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


Re: bug in emacs-ui ?

2011-06-28 Thread Dmitry Kurochkin
On Tue, 28 Jun 2011 21:38:17 +0400, Dmitry Kurochkin 
dmitry.kuroch...@gmail.com wrote:
 Hi Jani.
 
 On Tue, 28 Jun 2011 10:35:48 + (UTC), Jani Nikula j...@nikula.org wrote:
  Carl Worth cworth@... writes:
  
   
   On Wed, 22 Jun 2011 08:50:23 +0200, Sebastien Binet
   seb.binet@... wrote:
On Tue, 21 Jun 2011 15:09:20 -0700, Carl Worth cworth@... wrote:
 Perhaps this is an emacs bug?
could be, but,

 I'm using Debian's emacs 23.3.1 and have not encountered the problem
 described.
I don't see anything related to 'point', 'point-invisible-p' nor
  'forward-char' in there:
http://patch-tracker.debian.org/package/emacs23/23.3+1-1
   
   Perhaps I was confused. I thought 23.3.1 was a distinct upstream release
   From 23.3, but maybe not, (emacs version numbers use 1-based indexing
   perhaps?).
   
anyways... for the moment I'll just live with it...
   
   Sorry about that.
   
except if somebody has some insights on how to catch the 'End of
buffer' error and add some more protective programming around the
'scroll-up' function ?
   
   My emacs lisp skills are primarily restricted to actual
   experimentation. So if I can replicate the bug, I might be able to find
   a fix. I'm not very good at doing theoretical fixes with emacs lisp
   code.
  
  I bisected the problem to commit 95ef8da29439f2e79115c36ab4d2a80aef1a1462 
  (Fix
  hiding a message while some citations are shown in notmuch-show view).
  Reverting that fixes the problem for me. (If you don't want to resolve
  conflicts, also revert 432e091924c1d1d8950a44ca78bc5b9c5ade47e4 first.) I 
  don't
  have the time just now to try to figure out the problem in that, but perhaps
  this will help others go forward.
  
 
 Thanks for tracking this.  I will look into it.
 

I have posted a patch to fix this bug [1].

Regards,
  Dmitry

[1] id:1309312132-14564-2-git-send-email-dmitry.kuroch...@gmail.com

 Regards,
   Dmitry
 
  Jani
  
  
  ___
  notmuch mailing list
  notmuch@notmuchmail.org
  http://notmuchmail.org/mailman/listinfo/notmuch
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


  1   2   >