have "notmuch help" call man?

2011-12-21 Thread David Bremner
On Tue, 20 Dec 2011 00:16:47 -0400, David Bremner  wrote:

> You can also look at the patches in git://pivot.cs.unb.ca/notmuch 
> branch split-man

I made some progress.

The man pages are now installed, a notmuch help (built from this branch)
uses them.

The hacks we added to update and check the versions in the man page need
to be re-done or maybe re-thought; perhaps some simple preprocessing
with m4 or equivalent is in order to embed version numbers.

All going well, I'd like to push these relatively soon after we freeze
0.11, so that future documentation changes can take advantage of doing
it in one place.

I'm not sure if posting the patches make sense; it's up to 74k of diffs,
even using "git format-patch -D".  I'm open to suggestions, as always.

d




[PATCH 2/2] test: add test for `notmuch-hello-refresh-hook'

2011-12-21 Thread Thomas Jost
On Thu, 22 Dec 2011 01:54:21 +0400, Dmitry Kurochkin  wrote:
> On Wed, 21 Dec 2011 22:49:13 +0100, Thomas Jost  
> wrote:
> > On Wed, 21 Dec 2011 22:18:26 +0400, Dmitry Kurochkin  > gmail.com> wrote:
> > > Test that `notmuch-hello-refresh-hook' is called once when
> > > `notmuch-hello' is called and twice when calling
> > > `notmuch-hello-update' after that.
> > > 
> > > The tests are very similar to tests for `notmuch-hello-mode-hook'.
> > 
> > Quite nice, better than what I sent earlier [1] :)
> > 
> > However I'm not sure that notmuch-hello.el is the right place for this
> > kind of stuff; notmuch-lib.el may be better (so that it can also be used
> > in other hooks.
> > 
> 
> These patches do not touch notmuch-hello.el.  The functions are added to
> test/test-lib.el.

Wow. So apparently 22:49 is too late for me to read correctly.

Full ACK for me then!

Regards,
Thomas

> 
> Regards,
>   Dmitry
> 
> > Regards,
> > Thomas
> > 
> > [1] id:"1324473189-8622-1-git-send-email-schnouki at schnouki.net"
> > 
> > 
> > > ---
> > >  test/emacs   |   19 +++
> > >  test/test-lib.el |1 +
> > >  2 files changed, 20 insertions(+), 0 deletions(-)
> > > 
> > > diff --git a/test/emacs b/test/emacs
> > > index dffad0f..ca82445 100755
> > > --- a/test/emacs
> > > +++ b/test/emacs
> > > @@ -495,4 +495,23 @@ counter=$(test_emacs \
> > >  )
> > >  test_expect_equal "$counter" 1
> > >  
> > > +test_begin_subtest "notmuch-hello-refresh hook is called"
> > > +counter=$(test_emacs \
> > > +'(let ((notmuch-hello-refresh-hook-counter 0))
> > > +   (kill-buffer "*notmuch-hello*")
> > > +   (notmuch-hello)
> > > +   notmuch-hello-refresh-hook-counter)'
> > > +)
> > > +test_expect_equal "$counter" 1
> > > +
> > > +test_begin_subtest "notmuch-hello-refresh hook is called on updates"
> > > +counter=$(test_emacs \
> > > +'(let ((notmuch-hello-refresh-hook-counter 0))
> > > +   (kill-buffer "*notmuch-hello*")
> > > +   (notmuch-hello)
> > > +   (notmuch-hello-update)
> > > +   notmuch-hello-refresh-hook-counter)'
> > > +)
> > > +test_expect_equal "$counter" 2
> > > +
> > >  test_done
> > > diff --git a/test/test-lib.el b/test/test-lib.el
> > > index 83b8a65..3b817c3 100644
> > > --- a/test/test-lib.el
> > > +++ b/test/test-lib.el
> > > @@ -75,3 +75,4 @@ nothing."
> > >(add-hook hook (apply-partially 'hook-counter hook)))
> > >  
> > >  (add-hook-counter 'notmuch-hello-mode-hook)
> > > +(add-hook-counter 'notmuch-hello-refresh-hook)
> > > -- 
> > > 1.7.7.3
> > > 
> > > ___
> > > notmuch mailing list
> > > notmuch at notmuchmail.org
> > > http://notmuchmail.org/mailman/listinfo/notmuch
> > 
> > -- 
> > Thomas/Schnouki

-- 
Thomas/Schnouki
-- next part --
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 489 bytes
Desc: not available
URL: 
<http://notmuchmail.org/pipermail/notmuch/attachments/20111221/6882c762/attachment.pgp>


[PATCH] notmuch: Quiet buildbot warnings.

2011-12-21 Thread Thomas Jost
On Tue, 20 Dec 2011 15:20:04 +, David Edmondson  wrote:
> Cast away the result of various *write functions. Provide a default
> value for some variables to avoid "use before set" warnings.
> ---
> 
> The buildbot complains about these, though my own system (Debian
> testing on amd64) does not.

What's the version of glibc on the buildbot?
http://sourceware.org/bugzilla/show_bug.cgi?id=11959

Regards,

-- 
Thomas/Schnouki
-- next part --
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 489 bytes
Desc: not available
URL: 
<http://notmuchmail.org/pipermail/notmuch/attachments/20111221/057b651c/attachment.pgp>


[PATCH 2/2] test: add test for `notmuch-hello-refresh-hook'

2011-12-21 Thread Thomas Jost
On Wed, 21 Dec 2011 22:18:26 +0400, Dmitry Kurochkin  wrote:
> Test that `notmuch-hello-refresh-hook' is called once when
> `notmuch-hello' is called and twice when calling
> `notmuch-hello-update' after that.
> 
> The tests are very similar to tests for `notmuch-hello-mode-hook'.

Quite nice, better than what I sent earlier [1] :)

However I'm not sure that notmuch-hello.el is the right place for this
kind of stuff; notmuch-lib.el may be better (so that it can also be used
in other hooks.

Regards,
Thomas

[1] id:"1324473189-8622-1-git-send-email-schnouki at schnouki.net"


> ---
>  test/emacs   |   19 +++
>  test/test-lib.el |1 +
>  2 files changed, 20 insertions(+), 0 deletions(-)
> 
> diff --git a/test/emacs b/test/emacs
> index dffad0f..ca82445 100755
> --- a/test/emacs
> +++ b/test/emacs
> @@ -495,4 +495,23 @@ counter=$(test_emacs \
>  )
>  test_expect_equal "$counter" 1
>  
> +test_begin_subtest "notmuch-hello-refresh hook is called"
> +counter=$(test_emacs \
> +'(let ((notmuch-hello-refresh-hook-counter 0))
> +   (kill-buffer "*notmuch-hello*")
> +   (notmuch-hello)
> +   notmuch-hello-refresh-hook-counter)'
> +)
> +test_expect_equal "$counter" 1
> +
> +test_begin_subtest "notmuch-hello-refresh hook is called on updates"
> +counter=$(test_emacs \
> +'(let ((notmuch-hello-refresh-hook-counter 0))
> +   (kill-buffer "*notmuch-hello*")
> +   (notmuch-hello)
> +   (notmuch-hello-update)
> +   notmuch-hello-refresh-hook-counter)'
> +)
> +test_expect_equal "$counter" 2
> +
>  test_done
> diff --git a/test/test-lib.el b/test/test-lib.el
> index 83b8a65..3b817c3 100644
> --- a/test/test-lib.el
> +++ b/test/test-lib.el
> @@ -75,3 +75,4 @@ nothing."
>(add-hook hook (apply-partially 'hook-counter hook)))
>  
>  (add-hook-counter 'notmuch-hello-mode-hook)
> +(add-hook-counter 'notmuch-hello-refresh-hook)
> -- 
> 1.7.7.3
> 
> ___
> notmuch mailing list
> notmuch at notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch

-- 
Thomas/Schnouki
-- next part --
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 489 bytes
Desc: not available
URL: 
<http://notmuchmail.org/pipermail/notmuch/attachments/20111221/2776ea32/attachment.pgp>


[PATCH] test: add tests for `notmuch-hello-refresh-hook'

2011-12-21 Thread Dmitry Kurochkin
Hi Thomas.

I think all hook count tests must be consistent.  We should either add
hook counters in test-lib.el (like it is already done for
`notmuch-hello-mode-hook') or use lambdas in individual test cases (like
you did in the patch).

I believe the former approach is better (that is why I used it in the
first place :)).  So I sent patches [1] that add general hook counter to
test-lib.el and `notmuch-hello-mode-hook' tests that use it.

Regards,
  Dmitry

[1] id:"1324491506-1134-1-git-send-email-dmitry.kurochkin at gmail.com"


[PATCH] emacs: create patch filename from subject for inline patch fake parts

2011-12-21 Thread Jani Nikula
On Wed, 21 Dec 2011 09:40:08 -0500, Austin Clements  wrote:
> I would definitely go with the latter.
> 
> It might feel less unwieldy with a shorter variable name than
> "filename", since that has to be repeated so many times.  (It's also
> not really a filename in the middle of the replace process.)
> 
> This is splitting hairs, but in my original suggestion, I was thinking
> something like
> 
>   (let* ((s subject)
>  (s (replace-regexp-in-string "^ *\\(\\[[^]]*\\]\\)? *" "" s))
>  (s (replace-regexp-in-string "[. ]*$" "" s))
>  (s (replace-regexp-in-string "[^A-Za-z0-9._-]+" "-" s))
>  (s (replace-regexp-in-string "\\.+" "." s))
>  (s (substring s 0 (min (length s) 50
>  (concat s ".patch"))
> 
> Out of curiosity, where'd the regexps come from?  They all seem
> reasonable, but some of them seem somewhat arbitrary.

The regexps should definitely have some explanation. I tried to mimic
the 'git format-patch' behaviour [1] using as simple and straightforward
regexps as possible. For simplicity, there's no creation of patch
sequence numbers. The max length is the same as in git, excluding the
sequence number.

If the patch was sent using git format-patch/send-email, this should
result in re-creation of the same filename as the sender had (apart from
the sequence number, obviously).

I seem to be missing the trimming of any trailing '.' and '-' after
truncating the string to max length, though.


BR,
Jani.

[1] https://github.com/gitster/git/blob/master/pretty.c#L712



[PATCH 2/2] test: add test for `notmuch-hello-refresh-hook'

2011-12-21 Thread Dmitry Kurochkin
Test that `notmuch-hello-refresh-hook' is called once when
`notmuch-hello' is called and twice when calling
`notmuch-hello-update' after that.

The tests are very similar to tests for `notmuch-hello-mode-hook'.
---
 test/emacs   |   19 +++
 test/test-lib.el |1 +
 2 files changed, 20 insertions(+), 0 deletions(-)

diff --git a/test/emacs b/test/emacs
index dffad0f..ca82445 100755
--- a/test/emacs
+++ b/test/emacs
@@ -495,4 +495,23 @@ counter=$(test_emacs \
 )
 test_expect_equal "$counter" 1

+test_begin_subtest "notmuch-hello-refresh hook is called"
+counter=$(test_emacs \
+'(let ((notmuch-hello-refresh-hook-counter 0))
+   (kill-buffer "*notmuch-hello*")
+   (notmuch-hello)
+   notmuch-hello-refresh-hook-counter)'
+)
+test_expect_equal "$counter" 1
+
+test_begin_subtest "notmuch-hello-refresh hook is called on updates"
+counter=$(test_emacs \
+'(let ((notmuch-hello-refresh-hook-counter 0))
+   (kill-buffer "*notmuch-hello*")
+   (notmuch-hello)
+   (notmuch-hello-update)
+   notmuch-hello-refresh-hook-counter)'
+)
+test_expect_equal "$counter" 2
+
 test_done
diff --git a/test/test-lib.el b/test/test-lib.el
index 83b8a65..3b817c3 100644
--- a/test/test-lib.el
+++ b/test/test-lib.el
@@ -75,3 +75,4 @@ nothing."
   (add-hook hook (apply-partially 'hook-counter hook)))

 (add-hook-counter 'notmuch-hello-mode-hook)
+(add-hook-counter 'notmuch-hello-refresh-hook)
-- 
1.7.7.3



[PATCH 1/2] test: add general Emacs hook counter

2011-12-21 Thread Dmitry Kurochkin
Replace `notmuch-hello-mode-hook-counter' with general `hook-counter'
and `add-hook-counter' functions to allow counting calls for any hook.
---
 test/test-lib.el |   21 +
 1 files changed, 13 insertions(+), 8 deletions(-)

diff --git a/test/test-lib.el b/test/test-lib.el
index 3bca138..83b8a65 100644
--- a/test/test-lib.el
+++ b/test/test-lib.el
@@ -62,11 +62,16 @@ running, quit if it terminated."
   (kill-emacs)
 (run-at-time "1 min" nil 'orphan-watchdog pid)))

-(defun notmuch-hello-mode-hook-counter ()
-  "Count how many times `notmuch-hello-mode-hook' is called.
-Increments `notmuch-hello-mode-hook-counter' variable value if it
-is bound, otherwise does nothing."
-  (if (boundp 'notmuch-hello-mode-hook-counter)
-  (setq notmuch-hello-mode-hook-counter
-   (1+ notmuch-hello-mode-hook-counter
-(add-hook 'notmuch-hello-mode-hook 'notmuch-hello-mode-hook-counter)
+(defun hook-counter (hook)
+  "Count how many times a hook is called.  Increments
+`hook'-counter variable value if it is bound, otherwise does
+nothing."
+  (let ((counter (intern (concat (symbol-name hook) "-counter"
+(if (boundp counter)
+   (set counter (1+ (symbol-value counter))
+
+(defun add-hook-counter (hook)
+  "Add hook to count how many times `hook' is called."
+  (add-hook hook (apply-partially 'hook-counter hook)))
+
+(add-hook-counter 'notmuch-hello-mode-hook)
-- 
1.7.7.3



[RFC][PATCH] notmuch: Workaround to allow ignoring non-void function return.

2011-12-21 Thread David Edmondson
---

The mechanism used here works for me in an isolated test case and no
warnings appear when using it as below, but I'm unsure why the
original warning that it is intended to address didn't appear when I
build. Any thoughts?

 compat/compat.h |6 ++
 notmuch-new.c   |2 +-
 notmuch-show.c  |2 +-
 notmuch-tag.c   |2 +-
 4 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/compat/compat.h b/compat/compat.h
index 7767fe8..1160301 100644
--- a/compat/compat.h
+++ b/compat/compat.h
@@ -30,6 +30,12 @@
 extern "C" {
 #endif

+#ifdef __GNUC__
+#define ignore_result(x) ({ __typeof__(x) z = x; (void) sizeof (z); })
+#else /* !__GNUC__ */
+#define ignore_result(x) x
+#endif /* __GNUC__ */
+
 #if !HAVE_GETLINE
 #include 
 #include 
diff --git a/notmuch-new.c b/notmuch-new.c
index 3512de7..0ac04cc 100644
--- a/notmuch-new.c
+++ b/notmuch-new.c
@@ -67,7 +67,7 @@ handle_sigint (unused (int sig))
 {
 static char msg[] = "Stopping... \n";

-(void) write(2, msg, sizeof(msg)-1);
+ignore_result(write(STDERR_FILENO, msg, sizeof(msg)-1));
 interrupted = 1;
 }

diff --git a/notmuch-show.c b/notmuch-show.c
index 19fb49f..681f778 100644
--- a/notmuch-show.c
+++ b/notmuch-show.c
@@ -866,7 +866,7 @@ do_show_single (void *ctx,

while (!feof (file)) {
size = fread (buf, 1, sizeof (buf), file);
-   (void) fwrite (buf, size, 1, stdout);
+   ignore_result(fwrite (buf, size, 1, stdout));
}

fclose (file);
diff --git a/notmuch-tag.c b/notmuch-tag.c
index 292c5da..2cbfdc3 100644
--- a/notmuch-tag.c
+++ b/notmuch-tag.c
@@ -26,7 +26,7 @@ static void
 handle_sigint (unused (int sig))
 {
 static char msg[] = "Stopping... \n";
-(void) write(2, msg, sizeof(msg)-1);
+ignore_result(write(STDERR_FILENO, msg, sizeof(msg)-1));
 interrupted = 1;
 }

-- 
1.7.7.3



have "notmuch help" call man?

2011-12-21 Thread Jameson Graef Rollins
On Wed, 21 Dec 2011 23:43:09 -0400, David Bremner  wrote:
> The man pages are now installed, a notmuch help (built from this branch)
> uses them.

Hey, David this is really great.  Thank you so much for working on this.
This will make things much easier to maintain down the line.

I think what you've done looks great.  A couple small issues:

* There are a couple of formatting issues (notmuch.1, notmuch-config.1,
  notmuch-reply.1).

* The notmuch part command is completely deprecated, so I don't think
  there's really any reason to include a man page for it.

* There's no man page for restore (notmuch-restore.1).

It also occurs to me while looking through this: do we really need a
separate "setup" command?  Does that ever really get run?  Doesn't
notmuch new run the setup if it doesn't detect a config?  If there's
really reason to run it again at a later point, why don't we just have a
--setup option to notmuch new instead?  It would also make notmuch.1
cleaner if we removed it.

> I'm not sure if posting the patches make sense; it's up to 74k of diffs,
> even using "git format-patch -D".  I'm open to suggestions, as always.

While in general I think it's nice to have patches to the list, but I'm
not sure how much benefit there is in this case.  I would be fine to
just see the patch merged directly from your branch.

Again, thanks for the work on this, David.  This 

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


[PATCH 1/2] emacs: rename notmuch-decimal-separator to notmuch-hello-thousands-separator

2011-12-21 Thread Dmitry Kurochkin
Both patches look good to me.

Thanks, Thomas!

Regards,
  Dmitry


[PATCH 2/2] emacs: Change the default thousands separator to a space

2011-12-21 Thread Tomi Ollila
On Wed, 21 Dec 2011 14:44:19 +0100, Thomas Jost  
wrote:

Both patches LGTM.

Tomi


[PATCH] emacs: Don't prompt the user to choose from zero matching addresses.

2011-12-21 Thread Tomi Ollila
On Wed, 21 Dec 2011 12:35:27 +, David Edmondson  wrote:
> If the address matching function generates no matches, don't prompt
> the user to choose between them (!). Instead, generate a message to
> report that there were no matches.
> ---

LGTM

>  emacs/notmuch-address.el |   21 ++---
>  1 files changed, 14 insertions(+), 7 deletions(-)
> 
> diff --git a/emacs/notmuch-address.el b/emacs/notmuch-address.el
> index 1a7c577..8eba7a0 100644
> --- a/emacs/notmuch-address.el
> +++ b/emacs/notmuch-address.el
> @@ -54,15 +54,22 @@ line."
>(completion-ignore-case t)
>(options (notmuch-address-options orig))
>(num-options (length options))
> -  (chosen (if (eq num-options 1)
> -  (car options)
> +  (chosen (cond
> +   ((eq num-options 0)
> +nil)
> +   ((eq num-options 1)
> +(car options))
> +   (t
>  (completing-read (format "Address (%s matches): " 
> num-options)
>   (cdr options) nil nil (car options)
> - 'notmuch-address-history
> -(when chosen
> -  (push chosen notmuch-address-history)
> -  (delete-region beg end)
> -  (insert chosen
> + 'notmuch-address-history)
> +(if chosen
> + (progn
> +   (push chosen notmuch-address-history)
> +   (delete-region beg end)
> +   (insert chosen))
> +  (message "No matches.")
> +  (ding
>  
>  ;; Copied from `w3m-which-command'.
>  (defun notmuch-address-locate-command (command)
> -- 
> 1.7.7.3

Tomi


[BUG?] Pressing SPACEbar is not doing what's expected.

2011-12-21 Thread Jameson Graef Rollins
On Thu, 22 Dec 2011 00:08:38 +0100, Xavier Maillard  wrote:
> What happens here is just what is described in paragraph 2. Although I
> am in situation described in first paragraph, pressing SPC just advance
> to next message and never scroll to see the next part of the current
> message.

Hi, Xavier.  I have noticed this as well, and it's definitely a bug and
not a feature (there's no way to change this behavior).  I think it has
to do with there being hidden text at the end of the current message,
and notmuch somehow assuming that it is at the end of the message when
it's really not.

This issue has actually been addressed once, with a patch in fact [0].
However, somehow my patch to split the "and-archive" bit out of the
notmuch-show-advance-and-archive function [1] seems to have exposed a
problem.

I've been meaning to give it a look, but I'm hoping Dmitry can look at
it, since he understands this stuff better than I do.

jamie.

[0] id:"1320570241-30733-2-git-send-email-dmitry.kurochkin at gmail.com"
[1] id:"1321219008-11690-2-git-send-email-jrollins at finestructure.net"
-- next part --
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 835 bytes
Desc: not available
URL: 
<http://notmuchmail.org/pipermail/notmuch/attachments/20111221/938e1573/attachment.pgp>


[PATCH 2/2] emacs: Change the default thousands separator to a space

2011-12-21 Thread Thomas Jost
This had been discussed and decided on IRC.

Rationale:
  Therefore the space is recommended in the SI/ISO 31-0 standard, and the
  International Bureau of Weights and Measures states that "for numbers with
  many digits the digits may be divided into groups of three by a thin space, in
  order to facilitate reading. Neither dots nor commas are inserted in the
  spaces between groups of three".

(http://en.wikipedia.org/wiki/Decimal_separator#Digit_grouping)
---
 emacs/notmuch-hello.el |6 --
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el
index ef585ea..878d92a 100644
--- a/emacs/notmuch-hello.el
+++ b/emacs/notmuch-hello.el
@@ -131,10 +131,12 @@ So:
  (integer :tag "Number of characters")
  (float :tag "Fraction of window")))

-(defcustom notmuch-hello-thousands-separator ","
+(defcustom notmuch-hello-thousands-separator " "
   "The string used as a thousands separator.

-Typically \",\" in the US and UK and \".\" in Europe."
+Typically \",\" in the US and UK and \".\" or \" \" in Europe.
+The latter is recommended in the SI/ISO 31-0 standard and by the
+International Bureau of Weights and Measures."
   :group 'notmuch
   :type 'string)

-- 
1.7.8



[PATCH 1/2] emacs: rename notmuch-decimal-separator to notmuch-hello-thousands-separator

2011-12-21 Thread Thomas Jost
In 123,456.78, "." is the decimal separator, but "," is the thousands separator.
---
 emacs/notmuch-hello.el |6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el
index f892ff7..ef585ea 100644
--- a/emacs/notmuch-hello.el
+++ b/emacs/notmuch-hello.el
@@ -131,8 +131,8 @@ So:
  (integer :tag "Number of characters")
  (float :tag "Fraction of window")))

-(defcustom notmuch-decimal-separator ","
-  "The string used as a decimal separator.
+(defcustom notmuch-hello-thousands-separator ","
+  "The string used as a thousands separator.

 Typically \",\" in the US and UK and \".\" in Europe."
   :group 'notmuch
@@ -169,7 +169,7 @@ Typically \",\" in the US and UK and \".\" in Europe."
 (apply #'concat
  (number-to-string (car result))
  (mapcar (lambda (elem)
- (format "%s%03d" notmuch-decimal-separator elem))
+ (format "%s%03d" notmuch-hello-thousands-separator elem))
 (cdr result)

 (defun notmuch-hello-trim (search)
-- 
1.7.8



[PATCH 2/2] python: make the result of Message.get_replies() more pythonic

2011-12-21 Thread Justus Winter
Formerly Message.get_replies() returned an iterator or None forcing
users to check the result before iterating over it leading to strange
looking code at the call site.

Fix this flaw by adding an EmptyMessagesResult class that behaves like
the Messages class but immediatly raises StopIteration if used as an
iterator and returning objects of this type from Message.get_replies()
to indicate that there are no replies.
---
 bindings/python/notmuch/message.py |   22 +++---
 1 files changed, 15 insertions(+), 7 deletions(-)

diff --git a/bindings/python/notmuch/message.py 
b/bindings/python/notmuch/message.py
index cc9fc2a..975db1c 100644
--- a/bindings/python/notmuch/message.py
+++ b/bindings/python/notmuch/message.py
@@ -232,10 +232,10 @@ class Messages(object):
 next_indent = indent + 1

 # get replies and print them also out (if there are any)
-replies = msg.get_replies()
-if not replies is None:
+replies = msg.get_replies().format_messages(format, next_indent, 
entire_thread)
+if replies:
 result.append(set_sep)
-result.extend(replies.format_messages(format, next_indent, 
entire_thread))
+result.extend(replies)

 result.append(set_end)
 result.append(set_end)
@@ -253,6 +253,15 @@ class Messages(object):
 """
 handle.write(''.join(self.format_messages(format, indent, 
entire_thread)))

+class EmptyMessagesResult(Messages):
+def __init__(self, parent):
+self._msgs = None
+self._parent = parent
+
+def __next__(self):
+raise StopIteration()
+next = __next__
+
 class Message(object):
 """Represents a single Email message

@@ -383,10 +392,9 @@ class Message(object):
 number of subsequent calls to :meth:`get_replies`). If this message
 was obtained through some non-thread means, (such as by a call to
 :meth:`Query.search_messages`), then this function will return
-`None`.
+an empty Messages iterator.

-:returns: :class:`Messages` or `None` if there are no replies to
-this message.
+:returns: :class:`Messages`.
 :exception: :exc:`NotmuchError` STATUS.NOT_INITIALIZED if the message
 is not initialized.
 """
@@ -396,7 +404,7 @@ class Message(object):
 msgs_p = Message._get_replies(self._msg)

 if msgs_p is None:
-return None
+return EmptyMessagesResult(self)

 return Messages(msgs_p, self)

-- 
1.7.7.3



[PATCH 1/2] python: refactor print_messages into format_messages and print_messages

2011-12-21 Thread Justus Winter
---
 bindings/python/notmuch/message.py |   37 +--
 1 files changed, 26 insertions(+), 11 deletions(-)

diff --git a/bindings/python/notmuch/message.py 
b/bindings/python/notmuch/message.py
index ce8e718..cc9fc2a 100644
--- a/bindings/python/notmuch/message.py
+++ b/bindings/python/notmuch/message.py
@@ -186,14 +186,17 @@ class Messages(object):
 if self._msgs is not None:
 self._destroy(self._msgs)

-def print_messages(self, format, indent=0, entire_thread=False):
-"""Outputs messages as needed for 'notmuch show' to sys.stdout
+def format_messages(self, format, indent=0, entire_thread=False):
+"""Formats messages as needed for 'notmuch show'.

 :param format: A string of either 'text' or 'json'.
 :param indent: A number indicating the reply depth of these messages.
 :param entire_thread: A bool, indicating whether we want to output
whole threads or only the matching messages.
+:return: a list of lines
 """
+result = list()
+
 if format.lower() == "text":
 set_start = ""
 set_end = ""
@@ -207,36 +210,48 @@ class Messages(object):

 first_set = True

-sys.stdout.write(set_start)
+result.append(set_start)

 # iterate through all toplevel messages in this thread
 for msg in self:
 # if not msg:
 # break
 if not first_set:
-sys.stdout.write(set_sep)
+result.append(set_sep)
 first_set = False

-sys.stdout.write(set_start)
+result.append(set_start)
 match = msg.is_match()
 next_indent = indent

 if (match or entire_thread):
 if format.lower() == "text":
-sys.stdout.write(msg.format_message_as_text(indent))
+result.append(msg.format_message_as_text(indent))
 else:
-sys.stdout.write(msg.format_message_as_json(indent))
+result.append(msg.format_message_as_json(indent))
 next_indent = indent + 1

 # get replies and print them also out (if there are any)
 replies = msg.get_replies()
 if not replies is None:
-sys.stdout.write(set_sep)
-replies.print_messages(format, next_indent, entire_thread)
+result.append(set_sep)
+result.extend(replies.format_messages(format, next_indent, 
entire_thread))
+
+result.append(set_end)
+result.append(set_end)

-sys.stdout.write(set_end)
-sys.stdout.write(set_end)
+return result

+def print_messages(self, format, indent=0, entire_thread=False, 
handle=sys.stdout):
+"""Outputs messages as needed for 'notmuch show' to a file like object.
+
+:param format: A string of either 'text' or 'json'.
+:param handle: A file like object to print to (default is sys.stdout).
+:param indent: A number indicating the reply depth of these messages.
+:param entire_thread: A bool, indicating whether we want to output
+   whole threads or only the matching messages.
+"""
+handle.write(''.join(self.format_messages(format, indent, 
entire_thread)))

 class Message(object):
 """Represents a single Email message
-- 
1.7.7.3



python: unpythonic result of Message.get_replies()

2011-12-21 Thread Justus Winter
The attached patch series fixes this problem. Note that the wrapping
nature of the notmuch bindings makes it kind of awkward to fix the
behavior.

I've decided to avoid introducing code to the Messages class to
indicate that there are no messages and there is no notmuch object
being wrapped, but to subclass it and change the constructor and
__next__ function.

Well, what do you think?
Justus


[PATCH] test: add tests for `notmuch-hello-refresh-hook'

2011-12-21 Thread Thomas Jost
Test that it's called once when `notmuch-hello' is called, and twice when
calling `notmuch-hello-update' after that.
---
Here it is. No broken subtest first since the first patch was already pushed
though.

Regards,
Thomas

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

diff --git a/test/emacs b/test/emacs
index dffad0f..94b9171 100755
--- a/test/emacs
+++ b/test/emacs
@@ -495,4 +495,27 @@ counter=$(test_emacs \
 )
 test_expect_equal "$counter" 1

+test_begin_subtest "notmuch-hello-refresh-hook is called"
+counter=$(test_emacs \
+"(let ((refresh-hook-counter 0)
+   (notmuch-hello-refresh-hook nil))
+   (kill-buffer \"*notmuch-hello*\")
+   (add-hook 'notmuch-hello-refresh-hook (lambda () (incf 
refresh-hook-counter)))
+   (notmuch-hello)
+   refresh-hook-counter)"
+)
+test_expect_equal "$counter" 1
+
+test_begin_subtest "notmuch-hello-refresh-hook is called on updates"
+counter=$(test_emacs \
+"(let ((refresh-hook-counter 0)
+   (notmuch-hello-refresh-hook nil))
+   (kill-buffer \"*notmuch-hello*\")
+   (add-hook 'notmuch-hello-refresh-hook (lambda () (incf 
refresh-hook-counter)))
+   (notmuch-hello)
+   (notmuch-hello-update)
+   refresh-hook-counter)"
+)
+test_expect_equal "$counter" 2
+
 test_done
-- 
1.7.8



[PATCH] notmuch-addresses: Match on the full name as well as components.

2011-12-21 Thread David Edmondson
---
 notmuch_addresses.py |7 +--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/notmuch_addresses.py b/notmuch_addresses.py
index bf45151..74a743c 100755
--- a/notmuch_addresses.py
+++ b/notmuch_addresses.py
@@ -164,11 +164,14 @@ class NotmuchAddressMatcher(object):
 addrs.append(v)
 parsed_addrs = email.utils.getaddresses(addrs)
 for addr in parsed_addrs:
-mail = addr[1].lower()
-split_names = addr[0].split(" ")
+full_name = addr[0]
+split_names = full_name.split(" ")
+mail = addr[1]
 if (len([name for name in split_names 
  if self.match_function(name)]) > 0
 or 
+self.match_function(full_name)
+or 
 self.match_function(mail)):

 emails.add_email_and_name(mail, addr[0])
-- 
1.7.7.3



[PATCH] emacs: Don't prompt the user to choose from zero matching addresses.

2011-12-21 Thread David Edmondson
If the address matching function generates no matches, don't prompt
the user to choose between them (!). Instead, generate a message to
report that there were no matches.
---
 emacs/notmuch-address.el |   21 ++---
 1 files changed, 14 insertions(+), 7 deletions(-)

diff --git a/emacs/notmuch-address.el b/emacs/notmuch-address.el
index 1a7c577..8eba7a0 100644
--- a/emacs/notmuch-address.el
+++ b/emacs/notmuch-address.el
@@ -54,15 +54,22 @@ line."
 (completion-ignore-case t)
 (options (notmuch-address-options orig))
 (num-options (length options))
-(chosen (if (eq num-options 1)
-(car options)
+(chosen (cond
+ ((eq num-options 0)
+  nil)
+ ((eq num-options 1)
+  (car options))
+ (t
   (completing-read (format "Address (%s matches): " 
num-options)
(cdr options) nil nil (car options)
-   'notmuch-address-history
-(when chosen
-  (push chosen notmuch-address-history)
-  (delete-region beg end)
-  (insert chosen
+   'notmuch-address-history)
+(if chosen
+   (progn
+ (push chosen notmuch-address-history)
+ (delete-region beg end)
+ (insert chosen))
+  (message "No matches.")
+  (ding

 ;; Copied from `w3m-which-command'.
 (defun notmuch-address-locate-command (command)
-- 
1.7.7.3



RFC: use the XDG Base Directory Specification for configuration data

2011-12-21 Thread Justus Winter
Hi :)

I'd like to propose to store notmuchs configuration in
$XDG_CONFIG_HOME/notmuch/config as suggested in the XDG Base Directory
Specification [0].

Similarly $XDG_DATA_HOME/nmbug might be a more appropriate location
for nmbugs git checkout than ~/.nmbug.

Cheers,
Justus

0: http://standards.freedesktop.org/basedir-spec/latest/
-- next part --
A non-text attachment was scrubbed...
Name: .signature
Type: application/octet-stream
Size: 17 bytes
Desc: not available
URL: 
<http://notmuchmail.org/pipermail/notmuch/attachments/20111221/83d18ed3/attachment.obj>


patchwork link 404s

2011-12-21 Thread Justus Winter
Hi everyone :)

the patchwork instance referenced on notmuchmail.org [0] returns a
404 not found.

Cheers,
Justus

0: http://patchwork.notmuchmail.org/project/notmuch
-- next part --
A non-text attachment was scrubbed...
Name: .signature
Type: application/octet-stream
Size: 17 bytes
Desc: not available
URL: 
<http://notmuchmail.org/pipermail/notmuch/attachments/20111221/26bd1b7b/attachment.obj>


S/MIME support in notmuch

2011-12-21 Thread Darren McGuicken
On Wed, 07 Dec 2011 21:58:03 -0500, Dan Bryant  wrote:
> I'd like to report some success on getting S/MIME signature
> verification working using notmuch and the recently-released GMime
> 2.6. I specifically tested with notmuch-0.10.2 and gmime-2.6.1.

[...]

> I don't have submittable patches for #2/#3 yet, but I wanted to share
> what I found about the scope of what actually needs to be done, which
> is fairly small. (The biggest blocker is probably that Debian & other
> distros haven't packaged gmime-2.6.)

Hi Dan, nice find!  As another Fedora user I'd be happy to test out any
patches you come up with.

When you make those changes to the gpg_context are you breaking gpg
signature validation?  Or is the one a superset of the other?
-- 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/20111221/afa2ff1e/attachment.pgp>


RFC: use the XDG Base Directory Specification for configuration data

2011-12-21 Thread Jameson Graef Rollins
On Wed, 21 Dec 2011 07:44:16 -0400, David Bremner  wrote:
> On Wed, 21 Dec 2011 12:19:38 +0100, Justus Winter <4winter at 
> informatik.uni-hamburg.de> wrote:
> > I'd like to propose to store notmuchs configuration in
> > $XDG_CONFIG_HOME/notmuch/config as suggested in the XDG Base Directory
> > Specification [0].
> 
> Can you use NOTMUCH_CONFIG to achieve what you want? 

I think the suggestion is to just look in
$XDG_CONFIG_HOME/notmuch/config (and maybe ~/.config/notmuch/config)
after ~/.notmuch-config if NOTMUCH_CONFIG isn't set.  I think that's
totally reasonable.

> On my machine all of the programs (except nottoomuch ;) ) that use
> ~/.config are gui based, and a bunch of them store binary blobs (or not
> plain text anyway) there. It might be irrational, but I don't really
> want notmuch to be associated with that crowd ;).

It's not all gui applications.  I see multiple non-gui apps storing
their config in there.  I would personally love it if everything
respected that standard.  It would clear up my home directory
significantly.

jamie.
-- next part --
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 835 bytes
Desc: not available
URL: 
<http://notmuchmail.org/pipermail/notmuch/attachments/20111221/82c0b458/attachment-0001.pgp>


patchwork link 404s

2011-12-21 Thread Jameson Graef Rollins
On Wed, 21 Dec 2011 07:46:58 -0400, David Bremner  wrote:
> I'm not sure, maybe Martin retired the patchwork instance. I know that
> neither Carl nor I used it.

id:"20110630090114.GA10571 at albatross.gern.madduck.net"


[afew] announcing afew, an universal tagging solution with some fancy features

2011-12-21 Thread Justus Winter
Hey Pazz,

Quoting Patrick Totzke (2011-12-19 19:17:12)
>Also, should i not get some output when calling afew with -vv ?

Yes you should ;). Here's an example run on my box:

teythoon at thinkbox ~/repos/afew (git)-[master] % python3.2 bin/afew -vv --tag 
--new
INFO:root:Tagging spam messages
DEBUG:root:Executing query '(tag:new)'
INFO:root:Committing changes to 0 messages
INFO:root:Tagging via classification
DEBUG:root:Executing query '(tag:new)'
DEBUG:root:executing ['dbacl', '-c', ..., '-n']
INFO:root:Committing changes to 1 messages
INFO:root:Looking for messages in killed threads that are not yet killed
DEBUG:root:Executing query '((tag:new)) AND (NOT tag:killed)'
DEBUG:root:Executing query 'thread:"5d6e" AND tag:killed'
DEBUG:root:Executing query 'thread:"5d6d" AND tag:killed'
INFO:root:Committing changes to 0 messages
INFO:root:Tagging mailing list posts
DEBUG:root:Executing query '((tag:new)) AND (NOT tag:lists)'
INFO:root:Committing changes to 0 messages
INFO:root:No message specified for filter
DEBUG:root:Executing query '((tag:new)) AND (subject:"[Mafia]")'
INFO:root:Committing changes to 0 messages
INFO:root:Archiving all mails sent by myself
DEBUG:root:Executing query '((tag:new)) AND (from:"4winter at 
informatik.uni-hamburg.de" OR from:"teythoon at jade-hamburg.de")'
INFO:root:Committing changes to 0 messages
INFO:root:Retags all messages not tagged as junk or killed as inbox
DEBUG:root:Executing query '((tag:new)) AND ((tag:new))'
DEBUG:root:Removing tags new from "Fachschaftsratsvernetzung"  (new unread) (2011-12-21)
DEBUG:root:Adding tags inbox to "Fachschaftsratsvernetzung"  (new unread) (2011-12-21)
INFO:root:Committing changes to 1 messages

If you don't get any output at all you might try using the strace
hammer again.

Justus
-- next part --
A non-text attachment was scrubbed...
Name: .signature
Type: application/octet-stream
Size: 17 bytes
Desc: not available
URL: 
<http://notmuchmail.org/pipermail/notmuch/attachments/20111221/8a560052/attachment.obj>


[PATCH] emacs: create patch filename from subject for inline patch fake parts

2011-12-21 Thread Austin Clements
I would definitely go with the latter.

It might feel less unwieldy with a shorter variable name than
"filename", since that has to be repeated so many times.  (It's also
not really a filename in the middle of the replace process.)

This is splitting hairs, but in my original suggestion, I was thinking
something like

  (let* ((s subject)
 (s (replace-regexp-in-string "^ *\\(\\[[^]]*\\]\\)? *" "" s))
 (s (replace-regexp-in-string "[. ]*$" "" s))
 (s (replace-regexp-in-string "[^A-Za-z0-9._-]+" "-" s))
 (s (replace-regexp-in-string "\\.+" "." s))
 (s (substring s 0 (min (length s) 50
 (concat s ".patch"))

Out of curiosity, where'd the regexps come from?  They all seem
reasonable, but some of them seem somewhat arbitrary.

Quoth David Edmondson on Dec 21 at  9:21 am:
> On Tue, 20 Dec 2011 16:52:52 -0500, Austin Clements  
> wrote:
> > Seems like a definite improvement, but perhaps a let* instead of all
> > of the setq's?
> 
> What would be a lispy approach? I tried:
> 
> (defun notmuch-subject-to-patch-filename (subject)
>   "Convert a typical patch mail subject line into a suitable filename."
>   (concat 
>(let ((filename subject)
>(transforms
> '(("^ *\\(\\[[^]]*\\]\\)? *" . "")
>   ("[. ]*$" . "")
>   ("[^A-Za-z0-9._-]+" . "-")
>   ("\\.+" . "."
>  (mapc (lambda (transform)
>(setq filename (replace-regexp-in-string (car transform) (cdr 
> transform) filename)))
>  transforms)
>  (substring filename 0 (min (length filename) 50)))
>".patch"))
> 
> ...but that seems a bit unwieldy. `let*' looks best, but still feels a
> bit odd:
> 
> (defun notmuch-subject-to-patch-filename (subject)
>   "Convert a typical patch mail subject line into a suitable filename."
>   (concat 
>(let* ((filename (replace-regexp-in-string "^ *\\(\\[[^]]*\\]\\)? *" "" 
> subject))
> (filename (replace-regexp-in-string "[. ]*$" "" filename))
> (filename (replace-regexp-in-string "[^A-Za-z0-9._-]+" "-" filename))
> (filename (replace-regexp-in-string "\\.+" "." filename)))
>  (substring filename 0 (min (length filename) 50)))
>".patch"))
> 
> dme.


[afew] announcing afew, an universal tagging solution with some fancy features

2011-12-21 Thread Justus Winter
Hey Jamie :)

Quoting Jameson Graef Rollins (2011-12-19 18:57:00)
>On Mon, 19 Dec 2011 15:13:51 +0100, Justus Winter <4winter at 
>informatik.uni-hamburg.de> wrote:
>> Is your new tag called 'is:new'? Mine is just called 'new'
>
>is: is a search prefix, synonymous with tag:

Ah, thanks for the clarification.

>> That could be a problem since 'new' as tag for new mails is currently
>> hardcoded at various locations. I thought it was universally accepted,
>> but then again hardcoding these things is obviously a bad practice...
>
>Tags for new messages is configurable with the new.tags config setting.
>If you're program needs to know that setting, I suggest it retrieve it
>From the notmuch config directly ("notmuch config get new.tags").

That's a nice touch, it's implemented now :)

Justus
-- next part --
A non-text attachment was scrubbed...
Name: .signature
Type: application/octet-stream
Size: 17 bytes
Desc: not available
URL: 
<http://notmuchmail.org/pipermail/notmuch/attachments/20111221/a91dae59/attachment.obj>


[PATCH] emacs: create patch filename from subject for inline patch fake parts

2011-12-21 Thread David Edmondson
On Tue, 20 Dec 2011 16:52:52 -0500, Austin Clements  wrote:
> Seems like a definite improvement, but perhaps a let* instead of all
> of the setq's?

What would be a lispy approach? I tried:

(defun notmuch-subject-to-patch-filename (subject)
  "Convert a typical patch mail subject line into a suitable filename."
  (concat 
   (let ((filename subject)
 (transforms
  '(("^ *\\(\\[[^]]*\\]\\)? *" . "")
("[. ]*$" . "")
("[^A-Za-z0-9._-]+" . "-")
("\\.+" . "."
 (mapc (lambda (transform)
 (setq filename (replace-regexp-in-string (car transform) (cdr 
transform) filename)))
   transforms)
 (substring filename 0 (min (length filename) 50)))
   ".patch"))

...but that seems a bit unwieldy. `let*' looks best, but still feels a
bit odd:

(defun notmuch-subject-to-patch-filename (subject)
  "Convert a typical patch mail subject line into a suitable filename."
  (concat 
   (let* ((filename (replace-regexp-in-string "^ *\\(\\[[^]]*\\]\\)? *" "" 
subject))
  (filename (replace-regexp-in-string "[. ]*$" "" filename))
  (filename (replace-regexp-in-string "[^A-Za-z0-9._-]+" "-" filename))
  (filename (replace-regexp-in-string "\\.+" "." filename)))
 (substring filename 0 (min (length filename) 50)))
   ".patch"))

dme.
-- 
David Edmondson, http://dme.org
-- 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/20111221/f9b88266/attachment-0001.pgp>


[PATCH v2 0/2] emacs: trivial defcustom fixes

2011-12-21 Thread David Edmondson
On Tue, 20 Dec 2011 21:53:12 +0200, Jani Nikula  wrote:
> Hi all, v2 of a couple of defcustom fixes. Now with a default value for 
> "Custom
> filter" in patch 1/2 as suggested by Dmitry. No other changes.

Looks good.

dme.
-- 
David Edmondson, http://dme.org
-- 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/20111221/d33aca75/attachment.pgp>


[PATCH] emacs: add notmuch-hello-refresh-hook

2011-12-21 Thread David Bremner
On Wed, 21 Dec 2011 02:28:14 +0100, Thomas Jost  
wrote:
> This hook is called every time a notmuch-hello buffer is updated.
> ---

pushed.


[PATCH] notmuch: Quiet buildbot warnings.

2011-12-21 Thread David Bremner
On Tue, 20 Dec 2011 15:20:04 +, David Edmondson  wrote:
> Cast away the result of various *write functions. Provide a default
> value for some variables to avoid "use before set" warnings.

Pushed. It turns out this doesn't quiet 3 of the warnings. Maybe Tom can
investigate what is different about buildbots environment.

d


[PATCH] emacs: add notmuch-hello-refresh-hook

2011-12-21 Thread David Bremner
On Wed, 21 Dec 2011 02:28:14 +0100, Thomas Jost  
wrote:
> This hook is called every time a notmuch-hello buffer is updated.
> ---

pushed

d


patchwork link 404s

2011-12-21 Thread David Bremner
On Wed, 21 Dec 2011 12:09:50 +0100, Justus Winter <4winter at 
informatik.uni-hamburg.de> wrote:
> 
> the patchwork instance referenced on notmuchmail.org [0] returns a
> 404 not found.
> 

I'm not sure, maybe Martin retired the patchwork instance. I know that
neither Carl nor I used it.

If that turns out to be the case, Someone (TM) should update the wiki.

d




RFC: use the XDG Base Directory Specification for configuration data

2011-12-21 Thread David Bremner
On Wed, 21 Dec 2011 12:19:38 +0100, Justus Winter <4winter at 
informatik.uni-hamburg.de> wrote:
> Hi :)
> 
> I'd like to propose to store notmuchs configuration in
> $XDG_CONFIG_HOME/notmuch/config as suggested in the XDG Base Directory
> Specification [0].

Can you use NOTMUCH_CONFIG to achieve what you want? 

On my machine all of the programs (except nottoomuch ;) ) that use
~/.config are gui based, and a bunch of them store binary blobs (or not
plain text anyway) there. It might be irrational, but I don't really
want notmuch to be associated with that crowd ;).

> Similarly $XDG_DATA_HOME/nmbug might be a more appropriate location
> for nmbugs git checkout than ~/.nmbug.

Similarly the environment variable NMBGIT is available.

d


[PATCH v3 3/4] emacs: rename notmuch-decimal-separator to notmuch-thousands-separator

2011-12-21 Thread Dmitry Kurochkin
Hi Thomas.

On Wed, 21 Dec 2011 01:30:48 +0100, Thomas Jost  
wrote:
> On Fri, 16 Dec 2011 16:34:03 +0400, Dmitry Kurochkin  gmail.com> wrote:
> > On Fri, 16 Dec 2011 08:29:00 -0400, David Bremner  
> > wrote:
> > > On Fri, 16 Dec 2011 04:59:22 +0400, Dmitry Kurochkin  > > gmail.com> wrote:
> > > > 
> > > > What do perople think about making the thousands separator a space by
> > > > default?
> > > > 
> > > 
> > > Is that really good for a majority of users? I had never heard of it
> > > until now. I know this is hardly scientific, but still...
> > > 
> > 
> > Well, to me "1 000 000 000" looks better than "1,000,000,000".  But I do
> > not know about the others.  That is why I was asking :)
> 
> That's a complex topic unfortunately. I prefer "1 000 000" too, but many
> would prefer "1,000,000", others would prefer "1'000'000", and in India
> many would even prefer "1,00,"
> (https://en.wikipedia.org/wiki/Thousands_separator#Examples_of_use).
> 
> The cleanest solution would be to use something that cares about the
> LC_NUMERIC environment variable. sprintf() can do such things, but I'm
> not aware of any possibility to do that in elisp.
> 

We discussed this on IRC.  And, surprisingly, everyone agreed on
changing the default to a space in a separate patch.

But my other comment for this patch is still relevant: please rename
`notmuch-thousands-separator' to `notmuch-hello-thousands-separator'.

If you decide to make another patch that changes the default to a space,
please add this link [1] to the preamble and a citation:

  Therefore the space is recommended in the SI/ISO 31-0 standard,
  and the International Bureau of Weights and Measures states that "for
  numbers with many digits the digits may be divided into groups of
  three by a thin space, in order to facilitate reading. Neither dots
  nor commas are inserted in the spaces between groups of three".

Regards,
  Dmitry

[1] http://en.wikipedia.org/wiki/Decimal_separator#Digit_grouping

> -- 
> Thomas/Schnouki


[PATCH] emacs: add notmuch-hello-refresh-hook

2011-12-21 Thread Dmitry Kurochkin
Hi Thomas.

Looks good to me.

We should also add tests for this, similar to those for
`notmuch-hello-mode-hook'.  Thomas, do you think you can work on it?

Regards,
  Dmitry


[PATCH] emacs: add notmuch-hello-refresh-hook

2011-12-21 Thread Thomas Jost
This hook is called every time a notmuch-hello buffer is updated.
---
Oops, the previous patch had a typo which prevented it to work (":group notmuch"
instead of ":group 'notmuch"). Sorry about that.

 emacs/notmuch-hello.el |9 -
 1 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el
index 115f80a..a2b1c4c 100644
--- a/emacs/notmuch-hello.el
+++ b/emacs/notmuch-hello.el
@@ -143,6 +143,11 @@ Typically \",\" in the US and UK and \".\" or \" \" in 
Europe."
   :group 'notmuch
   :type 'hook)

+(defcustom notmuch-hello-refresh-hook nil
+  "Functions called after updating a `notmuch-hello' buffer."
+  :type 'hook
+  :group 'notmuch)
+
 (defvar notmuch-hello-url "http://notmuchmail.org;
   "The `notmuch' web site.")

@@ -590,7 +595,9 @@ Complete list of currently available key bindings:
  (widget-forward 1)))

   (unless (widget-at)
-   (notmuch-hello-goto-search)
+   (notmuch-hello-goto-search
+
+  (run-hooks 'notmuch-hello-refresh-hook))

 (defun notmuch-folder ()
   "Deprecated function for invoking notmuch---calling `notmuch' is preferred 
now."
-- 
1.7.8



[PATCH 2/5] lib: Add a MTIME value to every mail document

2011-12-21 Thread Thomas Jost
,8 @@ notmuch_database_add_message (notmuch_database_t 
> > *notmuch,
> > date = notmuch_message_file_get_header (message_file, "date");
> > _notmuch_message_set_header_values (message, date, from, subject);
> >  
> > +_notmuch_message_update_mtime (message);
> 
> Indentation.

Fixed, thanks.

> 
> > +
> > _notmuch_message_index_file (message, filename);
> > } else {
> > ret = NOTMUCH_STATUS_DUPLICATE_MESSAGE_ID;
> > diff --git a/lib/message.cc b/lib/message.cc
> > index 0075425..0c98589 100644
> > --- a/lib/message.cc
> > +++ b/lib/message.cc
> > @@ -830,6 +830,34 @@ _notmuch_message_set_header_values (notmuch_message_t 
> > *message,
> >  message->doc.add_value (NOTMUCH_VALUE_SUBJECT, subject);
> >  }
> >  
> > +/* Get the message mtime, i.e. when it was added or the last time a tag was
> > + * added/removed. */
> > +time_t
> > +notmuch_message_get_mtime (notmuch_message_t *message)
> > +{
> > +std::string value;
> > +
> > +try {
> > +   value = message->doc.get_value (NOTMUCH_VALUE_MTIME);
> > +} catch (Xapian::Error ) {
> > +   INTERNAL_ERROR ("Failed to read mtime value from document.");
> > +   return 0;
> > +}
> 
> For compatibility, this should handle the case when
> NOTMUCH_VALUE_MTIME is missing, probably by just returning 0.  As it
> is, value will be an empty string and sortable_unserialise is
> undefined on strings that weren't produced by sortable_serialise.

Right. I think I rebuilt my DB just after implementing this, which
explains why I did not notice that myself. Thanks!

> > +
> > +return Xapian::sortable_unserialise (value);
> > +}
> > +
> > +/* Set the message mtime to "now". */
> > +void
> > +_notmuch_message_update_mtime (notmuch_message_t *message)
> > +{
> > +time_t time_value;
> > +
> > +time_value = time (NULL);
> > +message->doc.add_value (NOTMUCH_VALUE_MTIME,
> > +Xapian::sortable_serialise (time_value));
> 
> Indentation.

Noted too. It's really time I start using dtrt-indent.

> 
> > +}
> > +
> >  /* Synchronize changes made to message->doc out into the database. */
> >  void
> >  _notmuch_message_sync (notmuch_message_t *message)
> > @@ -994,6 +1022,8 @@ notmuch_message_add_tag (notmuch_message_t *message, 
> > const char *tag)
> > private_status);
> >  }
> >  
> > +_notmuch_message_update_mtime (message);
> > +
> >  if (! message->frozen)
> > _notmuch_message_sync (message);
> >  
> > @@ -1022,6 +1052,8 @@ notmuch_message_remove_tag (notmuch_message_t 
> > *message, const char *tag)
> > private_status);
> >  }
> >  
> > +_notmuch_message_update_mtime (message);
> > +
> >  if (! message->frozen)
> > _notmuch_message_sync (message);
> >  
> > diff --git a/lib/notmuch-private.h b/lib/notmuch-private.h
> > index 60a932f..9859872 100644
> > --- a/lib/notmuch-private.h
> > +++ b/lib/notmuch-private.h
> > @@ -95,7 +95,8 @@ typedef enum {
> >  NOTMUCH_VALUE_TIMESTAMP = 0,
> >  NOTMUCH_VALUE_MESSAGE_ID,
> >  NOTMUCH_VALUE_FROM,
> > -NOTMUCH_VALUE_SUBJECT
> > +NOTMUCH_VALUE_SUBJECT,
> > +NOTMUCH_VALUE_MTIME
> >  } notmuch_value_t;
> >  
> >  /* Xapian (with flint backend) complains if we provide a term longer
> > @@ -276,6 +277,9 @@ _notmuch_message_set_header_values (notmuch_message_t 
> > *message,
> > const char *from,
> > const char *subject);
> >  void
> > +_notmuch_message_update_mtime (notmuch_message_t *message);
> > +
> > +void
> >  _notmuch_message_sync (notmuch_message_t *message);
> >  
> >  notmuch_status_t
> > diff --git a/lib/notmuch.h b/lib/notmuch.h
> > index 9f23a10..643ebce 100644
> > --- a/lib/notmuch.h
> > +++ b/lib/notmuch.h
> > @@ -910,6 +910,10 @@ notmuch_message_set_flag (notmuch_message_t *message,
> >  time_t
> >  notmuch_message_get_date  (notmuch_message_t *message);
> >  
> > +/* Get the mtime of 'message' as a time_t value. */
> > +time_t
> > +notmuch_message_get_mtime (notmuch_message_t *message);
> > +
> >  /* Get the value of the specified header from 'message'.
> >   *
> >   * The value will be read from the actual message file, not from the

-- 
Thomas/Schnouki
-- next part --
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 489 bytes
Desc: not available
URL: 
<http://notmuchmail.org/pipermail/notmuch/attachments/20111221/ff024d42/attachment-0001.pgp>


[PATCH 2/5] lib: Add a MTIME value to every mail document

2011-12-21 Thread Thomas Jost
On Wed, 14 Dec 2011 14:54:10 -0700, Mark Anderson  
wrote:
> On Tue, 13 Dec 2011 11:11:42 -0600, Thomas Jost  
> wrote:
> > This is a time_t value, similar to the message date (TIMESTAMP). It is 
> > first set
> > when the message is added to the database, and is then updated every time a 
> > tag
> > is added or removed. It can thus be used for doing incremental dumps of the
> > database or for synchronizing it between several computers.
> > 
> > This value can be read freely (with notmuch_message_get_mtime()) but for 
> > now it
> > can't be set to an arbitrary value: it can only be set to "now" when 
> > updated.
> > There's no specific reason for this except that I don't really see a real 
> > use
> > case for setting it to an arbitrary value.
> 
> I think it would be easier to write some testcases if the last modified
> time could be touched directly.  Perhaps they aren't in the set of "must
> have", but it's what comes to mind.

Well since I posted this, I found other good reasons to have a set_mtime
function. I'll post an updated series lated which will include it -- and
possibly some tests too :)

Thanks,

-- 
Thomas/Schnouki
-- next part --
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 489 bytes
Desc: not available
URL: 
<http://notmuchmail.org/pipermail/notmuch/attachments/20111221/bcb3fe45/attachment.pgp>


[PATCH v3 3/4] emacs: rename notmuch-decimal-separator to notmuch-thousands-separator

2011-12-21 Thread Thomas Jost
On Fri, 16 Dec 2011 16:34:03 +0400, Dmitry Kurochkin  wrote:
> On Fri, 16 Dec 2011 08:29:00 -0400, David Bremner  
> wrote:
> > On Fri, 16 Dec 2011 04:59:22 +0400, Dmitry Kurochkin  > gmail.com> wrote:
> > > 
> > > What do perople think about making the thousands separator a space by
> > > default?
> > > 
> > 
> > Is that really good for a majority of users? I had never heard of it
> > until now. I know this is hardly scientific, but still...
> > 
> 
> Well, to me "1 000 000 000" looks better than "1,000,000,000".  But I do
> not know about the others.  That is why I was asking :)

That's a complex topic unfortunately. I prefer "1 000 000" too, but many
would prefer "1,000,000", others would prefer "1'000'000", and in India
many would even prefer "1,00,"
(https://en.wikipedia.org/wiki/Thousands_separator#Examples_of_use).

The cleanest solution would be to use something that cares about the
LC_NUMERIC environment variable. sprintf() can do such things, but I'm
not aware of any possibility to do that in elisp.

-- 
Thomas/Schnouki
-- next part --
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 489 bytes
Desc: not available
URL: 
<http://notmuchmail.org/pipermail/notmuch/attachments/20111221/ac588e62/attachment.pgp>


[PATCH] emacs: add notmuch-hello-refresh-hook

2011-12-21 Thread Thomas Jost
This hook is called every time a notmuch-hello buffer is updated.
---
Hi Dmitry,

I like the idea of having a -mode-hook and a -refresh-hook :) Thanks for your
suggestions!

Regards,
Thomas

 emacs/notmuch-hello.el |9 -
 1 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el
index 115f80a..9fa3137 100644
--- a/emacs/notmuch-hello.el
+++ b/emacs/notmuch-hello.el
@@ -143,6 +143,11 @@ Typically \",\" in the US and UK and \".\" or \" \" in 
Europe."
   :group 'notmuch
   :type 'hook)

+(defcustom notmuch-hello-refresh-hook nil
+  "Functions called after updating a `notmuch-hello' buffer."
+  :type 'hook
+  :group notmuch)
+
 (defvar notmuch-hello-url "http://notmuchmail.org;
   "The `notmuch' web site.")

@@ -590,7 +595,9 @@ Complete list of currently available key bindings:
  (widget-forward 1)))

   (unless (widget-at)
-   (notmuch-hello-goto-search)
+   (notmuch-hello-goto-search
+
+  (run-hooks 'notmuch-hello-refresh-hook))

 (defun notmuch-folder ()
   "Deprecated function for invoking notmuch---calling `notmuch' is preferred 
now."
-- 
1.7.8



[PATCH] emacs: create patch filename from subject for inline patch fake parts

2011-12-21 Thread Dmitry Kurochkin
Hi Jani.

On Tue, 20 Dec 2011 22:05:31 +0200, Jani Nikula  wrote:
> 
> Shameless promotion of own patches... I suppose not many use the
> notmuch-wash-convert-inline-patch-to-part option, but with this patch
> I've actually started to like it better. An actual patch name from
> subject instead of "inline patch".
> 
> As I said, the lisp is less than perfect here, but this is still better
> than what's existing.
> 
> Any comments?
> 

I do not use the option but the patch sounds useful to me.  I would try
to review it soon.

I think a simple test would be useful here BTW.

Regards,
  Dmitry

> 
> BR,
> Jani.
> 
> 
> On Sat, 19 Nov 2011 01:02:48 +0200, Jani Nikula  wrote:
> > Use the mail subject line for creating a descriptive filename for the wash
> > generated inline patch fake parts. The names are similar to the ones
> > created by 'git format-patch', just without the leading numbers.
> > 
> > Signed-off-by: Jani Nikula 
> > 
> > ---
> > 
> > I know notmuch-subject-to-patch-filename is totally un-lispy. Suggestions
> > welcome on how to make it lispy and keep it somewhat readable.
> > 
> > If we later want to have a '>' counterpart to '|' to save messages to files
> > rather than pipe, then this could be generalized and re-used for creating
> > the suggested filename for that.
> > 
> > I don't even use the notmuch-wash-convert-inline-patch-to-part option that
> > much, but having it suggest "inline patch" as filename is just ugly...
> > ---
> >  emacs/notmuch-wash.el |   16 +++-
> >  1 files changed, 15 insertions(+), 1 deletions(-)
> > 
> > diff --git a/emacs/notmuch-wash.el b/emacs/notmuch-wash.el
> > index 1f420b2..755d64a 100644
> > --- a/emacs/notmuch-wash.el
> > +++ b/emacs/notmuch-wash.el
> > @@ -290,6 +290,17 @@ When doing so, maintaining citation leaders in the 
> > wrapped text."
> >  
> >  (defvar diff-file-header-re) ; From `diff-mode.el'.
> >  
> > +(defun notmuch-subject-to-patch-filename (str)
> > +  "Convert a typical patch mail subject line into a suitable filename."
> > +  (let ((s str))
> > +(setq s (replace-regexp-in-string "^ *\\(\\[[^]]*\\]\\)? *" "" s))
> > +(setq s (replace-regexp-in-string "[. ]*$" "" s))
> > +(setq s (replace-regexp-in-string "[^A-Za-z0-9._-]+" "-" s))
> > +(setq s (replace-regexp-in-string "\\.+" "." s))
> > +(when (> (length s) 52)
> > +  (setq s (substring s 0 52)))
> > +(concat s ".patch")))
> > +
> >  (defun notmuch-wash-convert-inline-patch-to-part (msg depth)
> >"Convert an inline patch into a fake 'text/x-diff' attachment.
> >  
> > @@ -316,7 +327,10 @@ for error."
> > (setq part (plist-put part :content-type "text/x-diff"))
> > (setq part (plist-put part :content (buffer-string)))
> > (setq part (plist-put part :id -1))
> > -   (setq part (plist-put part :filename "inline patch"))
> > +   (setq part (plist-put part :filename
> > + (notmuch-subject-to-patch-filename
> > +  (plist-get
> > +   (plist-get msg :headers) :Subject
> > (delete-region (point-min) (point-max))
> > (notmuch-show-insert-bodypart nil part depth))
> >  
> > -- 
> > 1.7.5.4
> > 
> ___
> notmuch mailing list
> notmuch at notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch


Re: [afew] announcing afew, an universal tagging solution with some fancy features

2011-12-21 Thread Justus Winter
Hey Jamie :)

Quoting Jameson Graef Rollins (2011-12-19 18:57:00)
On Mon, 19 Dec 2011 15:13:51 +0100, Justus Winter 
4win...@informatik.uni-hamburg.de wrote:
 Is your new tag called 'is:new'? Mine is just called 'new'

is: is a search prefix, synonymous with tag:

Ah, thanks for the clarification.

 That could be a problem since 'new' as tag for new mails is currently
 hardcoded at various locations. I thought it was universally accepted,
 but then again hardcoding these things is obviously a bad practice...

Tags for new messages is configurable with the new.tags config setting.
If you're program needs to know that setting, I suggest it retrieve it
From the notmuch config directly (notmuch config get new.tags).

That's a nice touch, it's implemented now :)

Justus


.signature
Description: Binary data
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH v2 0/2] emacs: trivial defcustom fixes

2011-12-21 Thread David Edmondson
On Tue, 20 Dec 2011 21:53:12 +0200, Jani Nikula j...@nikula.org wrote:
 Hi all, v2 of a couple of defcustom fixes. Now with a default value for 
 Custom
 filter in patch 1/2 as suggested by Dmitry. No other changes.

Looks good.

dme.
-- 
David Edmondson, http://dme.org


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


Re: [afew] announcing afew, an universal tagging solution with some fancy features

2011-12-21 Thread Justus Winter
Hey Pazz,

Quoting Patrick Totzke (2011-12-19 19:17:12)
Also, should i not get some output when calling afew with -vv ?

Yes you should ;). Here's an example run on my box:

teythoon@thinkbox ~/repos/afew (git)-[master] % python3.2 bin/afew -vv --tag 
--new
INFO:root:Tagging spam messages
DEBUG:root:Executing query '(tag:new)'
INFO:root:Committing changes to 0 messages
INFO:root:Tagging via classification
DEBUG:root:Executing query '(tag:new)'
DEBUG:root:executing ['dbacl', '-c', ..., '-n']
INFO:root:Committing changes to 1 messages
INFO:root:Looking for messages in killed threads that are not yet killed
DEBUG:root:Executing query '((tag:new)) AND (NOT tag:killed)'
DEBUG:root:Executing query 'thread:5d6e AND tag:killed'
DEBUG:root:Executing query 'thread:5d6d AND tag:killed'
INFO:root:Committing changes to 0 messages
INFO:root:Tagging mailing list posts
DEBUG:root:Executing query '((tag:new)) AND (NOT tag:lists)'
INFO:root:Committing changes to 0 messages
INFO:root:No message specified for filter
DEBUG:root:Executing query '((tag:new)) AND (subject:[Mafia])'
INFO:root:Committing changes to 0 messages
INFO:root:Archiving all mails sent by myself
DEBUG:root:Executing query '((tag:new)) AND 
(from:4win...@informatik.uni-hamburg.de OR from:teyth...@jade-hamburg.de)'
INFO:root:Committing changes to 0 messages
INFO:root:Retags all messages not tagged as junk or killed as inbox
DEBUG:root:Executing query '((tag:new)) AND ((tag:new))'
DEBUG:root:Removing tags new from Fachschaftsratsvernetzung 
fachschafts...@asta.uni-hamburg.de (new unread) (2011-12-21)
DEBUG:root:Adding tags inbox to Fachschaftsratsvernetzung 
fachschafts...@asta.uni-hamburg.de (new unread) (2011-12-21)
INFO:root:Committing changes to 1 messages

If you don't get any output at all you might try using the strace
hammer again.

Justus


.signature
Description: Binary data
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH] emacs: create patch filename from subject for inline patch fake parts

2011-12-21 Thread David Edmondson
On Tue, 20 Dec 2011 16:52:52 -0500, Austin Clements amdra...@mit.edu wrote:
 Seems like a definite improvement, but perhaps a let* instead of all
 of the setq's?

What would be a lispy approach? I tried:

(defun notmuch-subject-to-patch-filename (subject)
  Convert a typical patch mail subject line into a suitable filename.
  (concat 
   (let ((filename subject)
 (transforms
  '((^ *\\(\\[[^]]*\\]\\)? * . )
([. ]*$ . )
([^A-Za-z0-9._-]+ . -)
(\\.+ . .
 (mapc (lambda (transform)
 (setq filename (replace-regexp-in-string (car transform) (cdr 
transform) filename)))
   transforms)
 (substring filename 0 (min (length filename) 50)))
   .patch))

...but that seems a bit unwieldy. `let*' looks best, but still feels a
bit odd:

(defun notmuch-subject-to-patch-filename (subject)
  Convert a typical patch mail subject line into a suitable filename.
  (concat 
   (let* ((filename (replace-regexp-in-string ^ *\\(\\[[^]]*\\]\\)? *  
subject))
  (filename (replace-regexp-in-string [. ]*$  filename))
  (filename (replace-regexp-in-string [^A-Za-z0-9._-]+ - filename))
  (filename (replace-regexp-in-string \\.+ . filename)))
 (substring filename 0 (min (length filename) 50)))
   .patch))

dme.
-- 
David Edmondson, http://dme.org


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


patchwork link 404s

2011-12-21 Thread Justus Winter
Hi everyone :)

the patchwork instance referenced on notmuchmail.org [0] returns a
404 not found.

Cheers,
Justus

0: http://patchwork.notmuchmail.org/project/notmuch


.signature
Description: Binary data
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


RFC: use the XDG Base Directory Specification for configuration data

2011-12-21 Thread Justus Winter
Hi :)

I'd like to propose to store notmuchs configuration in
$XDG_CONFIG_HOME/notmuch/config as suggested in the XDG Base Directory
Specification [0].

Similarly $XDG_DATA_HOME/nmbug might be a more appropriate location
for nmbugs git checkout than ~/.nmbug.

Cheers,
Justus

0: http://standards.freedesktop.org/basedir-spec/latest/


.signature
Description: Binary data
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: RFC: use the XDG Base Directory Specification for configuration data

2011-12-21 Thread David Bremner
On Wed, 21 Dec 2011 12:19:38 +0100, Justus Winter 
4win...@informatik.uni-hamburg.de wrote:
 Hi :)
 
 I'd like to propose to store notmuchs configuration in
 $XDG_CONFIG_HOME/notmuch/config as suggested in the XDG Base Directory
 Specification [0].

Can you use NOTMUCH_CONFIG to achieve what you want? 

On my machine all of the programs (except nottoomuch ;) ) that use
~/.config are gui based, and a bunch of them store binary blobs (or not
plain text anyway) there. It might be irrational, but I don't really
want notmuch to be associated with that crowd ;).

 Similarly $XDG_DATA_HOME/nmbug might be a more appropriate location
 for nmbugs git checkout than ~/.nmbug.

Similarly the environment variable NMBGIT is available.

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


Re: patchwork link 404s

2011-12-21 Thread David Bremner
On Wed, 21 Dec 2011 12:09:50 +0100, Justus Winter 
4win...@informatik.uni-hamburg.de wrote:
 
 the patchwork instance referenced on notmuchmail.org [0] returns a
 404 not found.
 

I'm not sure, maybe Martin retired the patchwork instance. I know that
neither Carl nor I used it.

If that turns out to be the case, Someone (TM) should update the wiki.

d


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


Re: S/MIME support in notmuch

2011-12-21 Thread Darren McGuicken
On Wed, 07 Dec 2011 21:58:03 -0500, Dan Bryant dan.bry...@jhuapl.edu wrote:
 I'd like to report some success on getting S/MIME signature
 verification working using notmuch and the recently-released GMime
 2.6. I specifically tested with notmuch-0.10.2 and gmime-2.6.1.

[...]

 I don't have submittable patches for #2/#3 yet, but I wanted to share
 what I found about the scope of what actually needs to be done, which
 is fairly small. (The biggest blocker is probably that Debian  other
 distros haven't packaged gmime-2.6.)

Hi Dan, nice find!  As another Fedora user I'd be happy to test out any
patches you come up with.

When you make those changes to the gpg_context are you breaking gpg
signature validation?  Or is the one a superset of the other?


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


Re: [PATCH] emacs: add notmuch-hello-refresh-hook

2011-12-21 Thread David Bremner
On Wed, 21 Dec 2011 02:28:14 +0100, Thomas Jost schno...@schnouki.net wrote:
 This hook is called every time a notmuch-hello buffer is updated.
 ---

pushed

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


Re: [PATCH] notmuch: Quiet buildbot warnings.

2011-12-21 Thread David Bremner
On Tue, 20 Dec 2011 15:20:04 +, David Edmondson d...@dme.org wrote:
 Cast away the result of various *write functions. Provide a default
 value for some variables to avoid use before set warnings.

Pushed. It turns out this doesn't quiet 3 of the warnings. Maybe Tom can
investigate what is different about buildbots environment.

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


Re: [PATCH] emacs: add notmuch-hello-refresh-hook

2011-12-21 Thread David Bremner
On Wed, 21 Dec 2011 02:28:14 +0100, Thomas Jost schno...@schnouki.net wrote:
 This hook is called every time a notmuch-hello buffer is updated.
 ---

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


[PATCH] emacs: Don't prompt the user to choose from zero matching addresses.

2011-12-21 Thread David Edmondson
If the address matching function generates no matches, don't prompt
the user to choose between them (!). Instead, generate a message to
report that there were no matches.
---
 emacs/notmuch-address.el |   21 ++---
 1 files changed, 14 insertions(+), 7 deletions(-)

diff --git a/emacs/notmuch-address.el b/emacs/notmuch-address.el
index 1a7c577..8eba7a0 100644
--- a/emacs/notmuch-address.el
+++ b/emacs/notmuch-address.el
@@ -54,15 +54,22 @@ line.
 (completion-ignore-case t)
 (options (notmuch-address-options orig))
 (num-options (length options))
-(chosen (if (eq num-options 1)
-(car options)
+(chosen (cond
+ ((eq num-options 0)
+  nil)
+ ((eq num-options 1)
+  (car options))
+ (t
   (completing-read (format Address (%s matches):  
num-options)
(cdr options) nil nil (car options)
-   'notmuch-address-history
-(when chosen
-  (push chosen notmuch-address-history)
-  (delete-region beg end)
-  (insert chosen
+   'notmuch-address-history)
+(if chosen
+   (progn
+ (push chosen notmuch-address-history)
+ (delete-region beg end)
+ (insert chosen))
+  (message No matches.)
+  (ding
 
 ;; Copied from `w3m-which-command'.
 (defun notmuch-address-locate-command (command)
-- 
1.7.7.3

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


Re: python: unpythonic result of Message.get_replies()

2011-12-21 Thread Justus Winter
The attached patch series fixes this problem. Note that the wrapping
nature of the notmuch bindings makes it kind of awkward to fix the
behavior.

I've decided to avoid introducing code to the Messages class to
indicate that there are no messages and there is no notmuch object
being wrapped, but to subclass it and change the constructor and
__next__ function.

Well, what do you think?
Justus
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


[PATCH 2/2] python: make the result of Message.get_replies() more pythonic

2011-12-21 Thread Justus Winter
Formerly Message.get_replies() returned an iterator or None forcing
users to check the result before iterating over it leading to strange
looking code at the call site.

Fix this flaw by adding an EmptyMessagesResult class that behaves like
the Messages class but immediatly raises StopIteration if used as an
iterator and returning objects of this type from Message.get_replies()
to indicate that there are no replies.
---
 bindings/python/notmuch/message.py |   22 +++---
 1 files changed, 15 insertions(+), 7 deletions(-)

diff --git a/bindings/python/notmuch/message.py 
b/bindings/python/notmuch/message.py
index cc9fc2a..975db1c 100644
--- a/bindings/python/notmuch/message.py
+++ b/bindings/python/notmuch/message.py
@@ -232,10 +232,10 @@ class Messages(object):
 next_indent = indent + 1
 
 # get replies and print them also out (if there are any)
-replies = msg.get_replies()
-if not replies is None:
+replies = msg.get_replies().format_messages(format, next_indent, 
entire_thread)
+if replies:
 result.append(set_sep)
-result.extend(replies.format_messages(format, next_indent, 
entire_thread))
+result.extend(replies)
 
 result.append(set_end)
 result.append(set_end)
@@ -253,6 +253,15 @@ class Messages(object):
 
 handle.write(''.join(self.format_messages(format, indent, 
entire_thread)))
 
+class EmptyMessagesResult(Messages):
+def __init__(self, parent):
+self._msgs = None
+self._parent = parent
+
+def __next__(self):
+raise StopIteration()
+next = __next__
+
 class Message(object):
 Represents a single Email message
 
@@ -383,10 +392,9 @@ class Message(object):
 number of subsequent calls to :meth:`get_replies`). If this message
 was obtained through some non-thread means, (such as by a call to
 :meth:`Query.search_messages`), then this function will return
-`None`.
+an empty Messages iterator.
 
-:returns: :class:`Messages` or `None` if there are no replies to
-this message.
+:returns: :class:`Messages`.
 :exception: :exc:`NotmuchError` STATUS.NOT_INITIALIZED if the message
 is not initialized.
 
@@ -396,7 +404,7 @@ class Message(object):
 msgs_p = Message._get_replies(self._msg)
 
 if msgs_p is None:
-return None
+return EmptyMessagesResult(self)
 
 return Messages(msgs_p, self)
 
-- 
1.7.7.3

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


[PATCH 1/2] python: refactor print_messages into format_messages and print_messages

2011-12-21 Thread Justus Winter
---
 bindings/python/notmuch/message.py |   37 +--
 1 files changed, 26 insertions(+), 11 deletions(-)

diff --git a/bindings/python/notmuch/message.py 
b/bindings/python/notmuch/message.py
index ce8e718..cc9fc2a 100644
--- a/bindings/python/notmuch/message.py
+++ b/bindings/python/notmuch/message.py
@@ -186,14 +186,17 @@ class Messages(object):
 if self._msgs is not None:
 self._destroy(self._msgs)
 
-def print_messages(self, format, indent=0, entire_thread=False):
-Outputs messages as needed for 'notmuch show' to sys.stdout
+def format_messages(self, format, indent=0, entire_thread=False):
+Formats messages as needed for 'notmuch show'.
 
 :param format: A string of either 'text' or 'json'.
 :param indent: A number indicating the reply depth of these messages.
 :param entire_thread: A bool, indicating whether we want to output
whole threads or only the matching messages.
+:return: a list of lines
 
+result = list()
+
 if format.lower() == text:
 set_start = 
 set_end = 
@@ -207,36 +210,48 @@ class Messages(object):
 
 first_set = True
 
-sys.stdout.write(set_start)
+result.append(set_start)
 
 # iterate through all toplevel messages in this thread
 for msg in self:
 # if not msg:
 # break
 if not first_set:
-sys.stdout.write(set_sep)
+result.append(set_sep)
 first_set = False
 
-sys.stdout.write(set_start)
+result.append(set_start)
 match = msg.is_match()
 next_indent = indent
 
 if (match or entire_thread):
 if format.lower() == text:
-sys.stdout.write(msg.format_message_as_text(indent))
+result.append(msg.format_message_as_text(indent))
 else:
-sys.stdout.write(msg.format_message_as_json(indent))
+result.append(msg.format_message_as_json(indent))
 next_indent = indent + 1
 
 # get replies and print them also out (if there are any)
 replies = msg.get_replies()
 if not replies is None:
-sys.stdout.write(set_sep)
-replies.print_messages(format, next_indent, entire_thread)
+result.append(set_sep)
+result.extend(replies.format_messages(format, next_indent, 
entire_thread))
+
+result.append(set_end)
+result.append(set_end)
 
-sys.stdout.write(set_end)
-sys.stdout.write(set_end)
+return result
 
+def print_messages(self, format, indent=0, entire_thread=False, 
handle=sys.stdout):
+Outputs messages as needed for 'notmuch show' to a file like object.
+
+:param format: A string of either 'text' or 'json'.
+:param handle: A file like object to print to (default is sys.stdout).
+:param indent: A number indicating the reply depth of these messages.
+:param entire_thread: A bool, indicating whether we want to output
+   whole threads or only the matching messages.
+
+handle.write(''.join(self.format_messages(format, indent, 
entire_thread)))
 
 class Message(object):
 Represents a single Email message
-- 
1.7.7.3

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


Re: [PATCH] emacs: Don't prompt the user to choose from zero matching addresses.

2011-12-21 Thread Tomi Ollila
On Wed, 21 Dec 2011 12:35:27 +, David Edmondson d...@dme.org wrote:
 If the address matching function generates no matches, don't prompt
 the user to choose between them (!). Instead, generate a message to
 report that there were no matches.
 ---

LGTM

  emacs/notmuch-address.el |   21 ++---
  1 files changed, 14 insertions(+), 7 deletions(-)
 
 diff --git a/emacs/notmuch-address.el b/emacs/notmuch-address.el
 index 1a7c577..8eba7a0 100644
 --- a/emacs/notmuch-address.el
 +++ b/emacs/notmuch-address.el
 @@ -54,15 +54,22 @@ line.
(completion-ignore-case t)
(options (notmuch-address-options orig))
(num-options (length options))
 -  (chosen (if (eq num-options 1)
 -  (car options)
 +  (chosen (cond
 +   ((eq num-options 0)
 +nil)
 +   ((eq num-options 1)
 +(car options))
 +   (t
  (completing-read (format Address (%s matches):  
 num-options)
   (cdr options) nil nil (car options)
 - 'notmuch-address-history
 -(when chosen
 -  (push chosen notmuch-address-history)
 -  (delete-region beg end)
 -  (insert chosen
 + 'notmuch-address-history)
 +(if chosen
 + (progn
 +   (push chosen notmuch-address-history)
 +   (delete-region beg end)
 +   (insert chosen))
 +  (message No matches.)
 +  (ding
  
  ;; Copied from `w3m-which-command'.
  (defun notmuch-address-locate-command (command)
 -- 
 1.7.7.3

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


[PATCH 1/2] emacs: rename notmuch-decimal-separator to notmuch-hello-thousands-separator

2011-12-21 Thread Thomas Jost
In 123,456.78, . is the decimal separator, but , is the thousands separator.
---
 emacs/notmuch-hello.el |6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el
index f892ff7..ef585ea 100644
--- a/emacs/notmuch-hello.el
+++ b/emacs/notmuch-hello.el
@@ -131,8 +131,8 @@ So:
  (integer :tag Number of characters)
  (float :tag Fraction of window)))
 
-(defcustom notmuch-decimal-separator ,
-  The string used as a decimal separator.
+(defcustom notmuch-hello-thousands-separator ,
+  The string used as a thousands separator.
 
 Typically \,\ in the US and UK and \.\ in Europe.
   :group 'notmuch
@@ -169,7 +169,7 @@ Typically \,\ in the US and UK and \.\ in Europe.
 (apply #'concat
  (number-to-string (car result))
  (mapcar (lambda (elem)
- (format %s%03d notmuch-decimal-separator elem))
+ (format %s%03d notmuch-hello-thousands-separator elem))
 (cdr result)
 
 (defun notmuch-hello-trim (search)
-- 
1.7.8

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


[PATCH 2/2] emacs: Change the default thousands separator to a space

2011-12-21 Thread Thomas Jost
This had been discussed and decided on IRC.

Rationale:
  Therefore the space is recommended in the SI/ISO 31-0 standard, and the
  International Bureau of Weights and Measures states that for numbers with
  many digits the digits may be divided into groups of three by a thin space, in
  order to facilitate reading. Neither dots nor commas are inserted in the
  spaces between groups of three.

(http://en.wikipedia.org/wiki/Decimal_separator#Digit_grouping)
---
 emacs/notmuch-hello.el |6 --
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el
index ef585ea..878d92a 100644
--- a/emacs/notmuch-hello.el
+++ b/emacs/notmuch-hello.el
@@ -131,10 +131,12 @@ So:
  (integer :tag Number of characters)
  (float :tag Fraction of window)))
 
-(defcustom notmuch-hello-thousands-separator ,
+(defcustom notmuch-hello-thousands-separator  
   The string used as a thousands separator.
 
-Typically \,\ in the US and UK and \.\ in Europe.
+Typically \,\ in the US and UK and \.\ or \ \ in Europe.
+The latter is recommended in the SI/ISO 31-0 standard and by the
+International Bureau of Weights and Measures.
   :group 'notmuch
   :type 'string)
 
-- 
1.7.8

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


[PATCH] notmuch-addresses: Match on the full name as well as components.

2011-12-21 Thread David Edmondson
---
 notmuch_addresses.py |7 +--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/notmuch_addresses.py b/notmuch_addresses.py
index bf45151..74a743c 100755
--- a/notmuch_addresses.py
+++ b/notmuch_addresses.py
@@ -164,11 +164,14 @@ class NotmuchAddressMatcher(object):
 addrs.append(v)
 parsed_addrs = email.utils.getaddresses(addrs)
 for addr in parsed_addrs:
-mail = addr[1].lower()
-split_names = addr[0].split( )
+full_name = addr[0]
+split_names = full_name.split( )
+mail = addr[1]
 if (len([name for name in split_names 
  if self.match_function(name)])  0
 or 
+self.match_function(full_name)
+or 
 self.match_function(mail)):
 
 emails.add_email_and_name(mail, addr[0])
-- 
1.7.7.3

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


Re: [PATCH 2/2] emacs: Change the default thousands separator to a space

2011-12-21 Thread Tomi Ollila
On Wed, 21 Dec 2011 14:44:19 +0100, Thomas Jost schno...@schnouki.net wrote:

Both patches LGTM.

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


Re: [PATCH] emacs: create patch filename from subject for inline patch fake parts

2011-12-21 Thread Austin Clements
I would definitely go with the latter.

It might feel less unwieldy with a shorter variable name than
filename, since that has to be repeated so many times.  (It's also
not really a filename in the middle of the replace process.)

This is splitting hairs, but in my original suggestion, I was thinking
something like

  (let* ((s subject)
 (s (replace-regexp-in-string ^ *\\(\\[[^]]*\\]\\)? *  s))
 (s (replace-regexp-in-string [. ]*$  s))
 (s (replace-regexp-in-string [^A-Za-z0-9._-]+ - s))
 (s (replace-regexp-in-string \\.+ . s))
 (s (substring s 0 (min (length s) 50
 (concat s .patch))

Out of curiosity, where'd the regexps come from?  They all seem
reasonable, but some of them seem somewhat arbitrary.

Quoth David Edmondson on Dec 21 at  9:21 am:
 On Tue, 20 Dec 2011 16:52:52 -0500, Austin Clements amdra...@mit.edu wrote:
  Seems like a definite improvement, but perhaps a let* instead of all
  of the setq's?
 
 What would be a lispy approach? I tried:
 
 (defun notmuch-subject-to-patch-filename (subject)
   Convert a typical patch mail subject line into a suitable filename.
   (concat 
(let ((filename subject)
(transforms
 '((^ *\\(\\[[^]]*\\]\\)? * . )
   ([. ]*$ . )
   ([^A-Za-z0-9._-]+ . -)
   (\\.+ . .
  (mapc (lambda (transform)
(setq filename (replace-regexp-in-string (car transform) (cdr 
 transform) filename)))
  transforms)
  (substring filename 0 (min (length filename) 50)))
.patch))
 
 ...but that seems a bit unwieldy. `let*' looks best, but still feels a
 bit odd:
 
 (defun notmuch-subject-to-patch-filename (subject)
   Convert a typical patch mail subject line into a suitable filename.
   (concat 
(let* ((filename (replace-regexp-in-string ^ *\\(\\[[^]]*\\]\\)? *  
 subject))
 (filename (replace-regexp-in-string [. ]*$  filename))
 (filename (replace-regexp-in-string [^A-Za-z0-9._-]+ - filename))
 (filename (replace-regexp-in-string \\.+ . filename)))
  (substring filename 0 (min (length filename) 50)))
.patch))
 
 dme.
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH 1/2] emacs: rename notmuch-decimal-separator to notmuch-hello-thousands-separator

2011-12-21 Thread Dmitry Kurochkin
Both patches look good to me.

Thanks, Thomas!

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


[PATCH 1/2] test: add general Emacs hook counter

2011-12-21 Thread Dmitry Kurochkin
Replace `notmuch-hello-mode-hook-counter' with general `hook-counter'
and `add-hook-counter' functions to allow counting calls for any hook.
---
 test/test-lib.el |   21 +
 1 files changed, 13 insertions(+), 8 deletions(-)

diff --git a/test/test-lib.el b/test/test-lib.el
index 3bca138..83b8a65 100644
--- a/test/test-lib.el
+++ b/test/test-lib.el
@@ -62,11 +62,16 @@ running, quit if it terminated.
   (kill-emacs)
 (run-at-time 1 min nil 'orphan-watchdog pid)))
 
-(defun notmuch-hello-mode-hook-counter ()
-  Count how many times `notmuch-hello-mode-hook' is called.
-Increments `notmuch-hello-mode-hook-counter' variable value if it
-is bound, otherwise does nothing.
-  (if (boundp 'notmuch-hello-mode-hook-counter)
-  (setq notmuch-hello-mode-hook-counter
-   (1+ notmuch-hello-mode-hook-counter
-(add-hook 'notmuch-hello-mode-hook 'notmuch-hello-mode-hook-counter)
+(defun hook-counter (hook)
+  Count how many times a hook is called.  Increments
+`hook'-counter variable value if it is bound, otherwise does
+nothing.
+  (let ((counter (intern (concat (symbol-name hook) -counter
+(if (boundp counter)
+   (set counter (1+ (symbol-value counter))
+
+(defun add-hook-counter (hook)
+  Add hook to count how many times `hook' is called.
+  (add-hook hook (apply-partially 'hook-counter hook)))
+
+(add-hook-counter 'notmuch-hello-mode-hook)
-- 
1.7.7.3

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


[PATCH 2/2] test: add test for `notmuch-hello-refresh-hook'

2011-12-21 Thread Dmitry Kurochkin
Test that `notmuch-hello-refresh-hook' is called once when
`notmuch-hello' is called and twice when calling
`notmuch-hello-update' after that.

The tests are very similar to tests for `notmuch-hello-mode-hook'.
---
 test/emacs   |   19 +++
 test/test-lib.el |1 +
 2 files changed, 20 insertions(+), 0 deletions(-)

diff --git a/test/emacs b/test/emacs
index dffad0f..ca82445 100755
--- a/test/emacs
+++ b/test/emacs
@@ -495,4 +495,23 @@ counter=$(test_emacs \
 )
 test_expect_equal $counter 1
 
+test_begin_subtest notmuch-hello-refresh hook is called
+counter=$(test_emacs \
+'(let ((notmuch-hello-refresh-hook-counter 0))
+   (kill-buffer *notmuch-hello*)
+   (notmuch-hello)
+   notmuch-hello-refresh-hook-counter)'
+)
+test_expect_equal $counter 1
+
+test_begin_subtest notmuch-hello-refresh hook is called on updates
+counter=$(test_emacs \
+'(let ((notmuch-hello-refresh-hook-counter 0))
+   (kill-buffer *notmuch-hello*)
+   (notmuch-hello)
+   (notmuch-hello-update)
+   notmuch-hello-refresh-hook-counter)'
+)
+test_expect_equal $counter 2
+
 test_done
diff --git a/test/test-lib.el b/test/test-lib.el
index 83b8a65..3b817c3 100644
--- a/test/test-lib.el
+++ b/test/test-lib.el
@@ -75,3 +75,4 @@ nothing.
   (add-hook hook (apply-partially 'hook-counter hook)))
 
 (add-hook-counter 'notmuch-hello-mode-hook)
+(add-hook-counter 'notmuch-hello-refresh-hook)
-- 
1.7.7.3

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


Re: [PATCH] test: add tests for `notmuch-hello-refresh-hook'

2011-12-21 Thread Dmitry Kurochkin
Hi Thomas.

I think all hook count tests must be consistent.  We should either add
hook counters in test-lib.el (like it is already done for
`notmuch-hello-mode-hook') or use lambdas in individual test cases (like
you did in the patch).

I believe the former approach is better (that is why I used it in the
first place :)).  So I sent patches [1] that add general hook counter to
test-lib.el and `notmuch-hello-mode-hook' tests that use it.

Regards,
  Dmitry

[1] id:1324491506-1134-1-git-send-email-dmitry.kuroch...@gmail.com
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: patchwork link 404s

2011-12-21 Thread Jameson Graef Rollins
On Wed, 21 Dec 2011 07:46:58 -0400, David Bremner da...@tethera.net wrote:
 I'm not sure, maybe Martin retired the patchwork instance. I know that
 neither Carl nor I used it.

id:20110630090114.ga10...@albatross.gern.madduck.net
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: RFC: use the XDG Base Directory Specification for configuration data

2011-12-21 Thread Jameson Graef Rollins
On Wed, 21 Dec 2011 07:44:16 -0400, David Bremner da...@tethera.net wrote:
 On Wed, 21 Dec 2011 12:19:38 +0100, Justus Winter 
 4win...@informatik.uni-hamburg.de wrote:
  I'd like to propose to store notmuchs configuration in
  $XDG_CONFIG_HOME/notmuch/config as suggested in the XDG Base Directory
  Specification [0].
 
 Can you use NOTMUCH_CONFIG to achieve what you want? 

I think the suggestion is to just look in
$XDG_CONFIG_HOME/notmuch/config (and maybe ~/.config/notmuch/config)
after ~/.notmuch-config if NOTMUCH_CONFIG isn't set.  I think that's
totally reasonable.

 On my machine all of the programs (except nottoomuch ;) ) that use
 ~/.config are gui based, and a bunch of them store binary blobs (or not
 plain text anyway) there. It might be irrational, but I don't really
 want notmuch to be associated with that crowd ;).

It's not all gui applications.  I see multiple non-gui apps storing
their config in there.  I would personally love it if everything
respected that standard.  It would clear up my home directory
significantly.

jamie.


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


Re: [PATCH] emacs: create patch filename from subject for inline patch fake parts

2011-12-21 Thread Jani Nikula
On Wed, 21 Dec 2011 09:40:08 -0500, Austin Clements amdra...@mit.edu wrote:
 I would definitely go with the latter.
 
 It might feel less unwieldy with a shorter variable name than
 filename, since that has to be repeated so many times.  (It's also
 not really a filename in the middle of the replace process.)
 
 This is splitting hairs, but in my original suggestion, I was thinking
 something like
 
   (let* ((s subject)
  (s (replace-regexp-in-string ^ *\\(\\[[^]]*\\]\\)? *  s))
  (s (replace-regexp-in-string [. ]*$  s))
  (s (replace-regexp-in-string [^A-Za-z0-9._-]+ - s))
  (s (replace-regexp-in-string \\.+ . s))
  (s (substring s 0 (min (length s) 50
  (concat s .patch))
 
 Out of curiosity, where'd the regexps come from?  They all seem
 reasonable, but some of them seem somewhat arbitrary.

The regexps should definitely have some explanation. I tried to mimic
the 'git format-patch' behaviour [1] using as simple and straightforward
regexps as possible. For simplicity, there's no creation of patch
sequence numbers. The max length is the same as in git, excluding the
sequence number.

If the patch was sent using git format-patch/send-email, this should
result in re-creation of the same filename as the sender had (apart from
the sequence number, obviously).

I seem to be missing the trimming of any trailing '.' and '-' after
truncating the string to max length, though.


BR,
Jani.

[1] https://github.com/gitster/git/blob/master/pretty.c#L712

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


Re: [PATCH 2/2] test: add test for `notmuch-hello-refresh-hook'

2011-12-21 Thread Thomas Jost
On Wed, 21 Dec 2011 22:18:26 +0400, Dmitry Kurochkin 
dmitry.kuroch...@gmail.com wrote:
 Test that `notmuch-hello-refresh-hook' is called once when
 `notmuch-hello' is called and twice when calling
 `notmuch-hello-update' after that.
 
 The tests are very similar to tests for `notmuch-hello-mode-hook'.

Quite nice, better than what I sent earlier [1] :)

However I'm not sure that notmuch-hello.el is the right place for this
kind of stuff; notmuch-lib.el may be better (so that it can also be used
in other hooks.

Regards,
Thomas

[1] id:1324473189-8622-1-git-send-email-schno...@schnouki.net


 ---
  test/emacs   |   19 +++
  test/test-lib.el |1 +
  2 files changed, 20 insertions(+), 0 deletions(-)
 
 diff --git a/test/emacs b/test/emacs
 index dffad0f..ca82445 100755
 --- a/test/emacs
 +++ b/test/emacs
 @@ -495,4 +495,23 @@ counter=$(test_emacs \
  )
  test_expect_equal $counter 1
  
 +test_begin_subtest notmuch-hello-refresh hook is called
 +counter=$(test_emacs \
 +'(let ((notmuch-hello-refresh-hook-counter 0))
 +   (kill-buffer *notmuch-hello*)
 +   (notmuch-hello)
 +   notmuch-hello-refresh-hook-counter)'
 +)
 +test_expect_equal $counter 1
 +
 +test_begin_subtest notmuch-hello-refresh hook is called on updates
 +counter=$(test_emacs \
 +'(let ((notmuch-hello-refresh-hook-counter 0))
 +   (kill-buffer *notmuch-hello*)
 +   (notmuch-hello)
 +   (notmuch-hello-update)
 +   notmuch-hello-refresh-hook-counter)'
 +)
 +test_expect_equal $counter 2
 +
  test_done
 diff --git a/test/test-lib.el b/test/test-lib.el
 index 83b8a65..3b817c3 100644
 --- a/test/test-lib.el
 +++ b/test/test-lib.el
 @@ -75,3 +75,4 @@ nothing.
(add-hook hook (apply-partially 'hook-counter hook)))
  
  (add-hook-counter 'notmuch-hello-mode-hook)
 +(add-hook-counter 'notmuch-hello-refresh-hook)
 -- 
 1.7.7.3
 
 ___
 notmuch mailing list
 notmuch@notmuchmail.org
 http://notmuchmail.org/mailman/listinfo/notmuch

-- 
Thomas/Schnouki


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


Re: [PATCH 2/2] test: add test for `notmuch-hello-refresh-hook'

2011-12-21 Thread Dmitry Kurochkin
On Wed, 21 Dec 2011 22:49:13 +0100, Thomas Jost schno...@schnouki.net wrote:
 On Wed, 21 Dec 2011 22:18:26 +0400, Dmitry Kurochkin 
 dmitry.kuroch...@gmail.com wrote:
  Test that `notmuch-hello-refresh-hook' is called once when
  `notmuch-hello' is called and twice when calling
  `notmuch-hello-update' after that.
  
  The tests are very similar to tests for `notmuch-hello-mode-hook'.
 
 Quite nice, better than what I sent earlier [1] :)
 
 However I'm not sure that notmuch-hello.el is the right place for this
 kind of stuff; notmuch-lib.el may be better (so that it can also be used
 in other hooks.
 

These patches do not touch notmuch-hello.el.  The functions are added to
test/test-lib.el.

Regards,
  Dmitry

 Regards,
 Thomas
 
 [1] id:1324473189-8622-1-git-send-email-schno...@schnouki.net
 
 
  ---
   test/emacs   |   19 +++
   test/test-lib.el |1 +
   2 files changed, 20 insertions(+), 0 deletions(-)
  
  diff --git a/test/emacs b/test/emacs
  index dffad0f..ca82445 100755
  --- a/test/emacs
  +++ b/test/emacs
  @@ -495,4 +495,23 @@ counter=$(test_emacs \
   )
   test_expect_equal $counter 1
   
  +test_begin_subtest notmuch-hello-refresh hook is called
  +counter=$(test_emacs \
  +'(let ((notmuch-hello-refresh-hook-counter 0))
  +   (kill-buffer *notmuch-hello*)
  +   (notmuch-hello)
  +   notmuch-hello-refresh-hook-counter)'
  +)
  +test_expect_equal $counter 1
  +
  +test_begin_subtest notmuch-hello-refresh hook is called on updates
  +counter=$(test_emacs \
  +'(let ((notmuch-hello-refresh-hook-counter 0))
  +   (kill-buffer *notmuch-hello*)
  +   (notmuch-hello)
  +   (notmuch-hello-update)
  +   notmuch-hello-refresh-hook-counter)'
  +)
  +test_expect_equal $counter 2
  +
   test_done
  diff --git a/test/test-lib.el b/test/test-lib.el
  index 83b8a65..3b817c3 100644
  --- a/test/test-lib.el
  +++ b/test/test-lib.el
  @@ -75,3 +75,4 @@ nothing.
 (add-hook hook (apply-partially 'hook-counter hook)))
   
   (add-hook-counter 'notmuch-hello-mode-hook)
  +(add-hook-counter 'notmuch-hello-refresh-hook)
  -- 
  1.7.7.3
  
  ___
  notmuch mailing list
  notmuch@notmuchmail.org
  http://notmuchmail.org/mailman/listinfo/notmuch
 
 -- 
 Thomas/Schnouki
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH] notmuch: Quiet buildbot warnings.

2011-12-21 Thread Thomas Jost
On Tue, 20 Dec 2011 15:20:04 +, David Edmondson d...@dme.org wrote:
 Cast away the result of various *write functions. Provide a default
 value for some variables to avoid use before set warnings.
 ---
 
 The buildbot complains about these, though my own system (Debian
 testing on amd64) does not.

What's the version of glibc on the buildbot?
http://sourceware.org/bugzilla/show_bug.cgi?id=11959

Regards,

-- 
Thomas/Schnouki


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


Re: [PATCH 2/2] test: add test for `notmuch-hello-refresh-hook'

2011-12-21 Thread Thomas Jost
On Thu, 22 Dec 2011 01:54:21 +0400, Dmitry Kurochkin 
dmitry.kuroch...@gmail.com wrote:
 On Wed, 21 Dec 2011 22:49:13 +0100, Thomas Jost schno...@schnouki.net wrote:
  On Wed, 21 Dec 2011 22:18:26 +0400, Dmitry Kurochkin 
  dmitry.kuroch...@gmail.com wrote:
   Test that `notmuch-hello-refresh-hook' is called once when
   `notmuch-hello' is called and twice when calling
   `notmuch-hello-update' after that.
   
   The tests are very similar to tests for `notmuch-hello-mode-hook'.
  
  Quite nice, better than what I sent earlier [1] :)
  
  However I'm not sure that notmuch-hello.el is the right place for this
  kind of stuff; notmuch-lib.el may be better (so that it can also be used
  in other hooks.
  
 
 These patches do not touch notmuch-hello.el.  The functions are added to
 test/test-lib.el.

Wow. So apparently 22:49 is too late for me to read correctly.

Full ACK for me then!

Regards,
Thomas

 
 Regards,
   Dmitry
 
  Regards,
  Thomas
  
  [1] id:1324473189-8622-1-git-send-email-schno...@schnouki.net
  
  
   ---
test/emacs   |   19 +++
test/test-lib.el |1 +
2 files changed, 20 insertions(+), 0 deletions(-)
   
   diff --git a/test/emacs b/test/emacs
   index dffad0f..ca82445 100755
   --- a/test/emacs
   +++ b/test/emacs
   @@ -495,4 +495,23 @@ counter=$(test_emacs \
)
test_expect_equal $counter 1

   +test_begin_subtest notmuch-hello-refresh hook is called
   +counter=$(test_emacs \
   +'(let ((notmuch-hello-refresh-hook-counter 0))
   +   (kill-buffer *notmuch-hello*)
   +   (notmuch-hello)
   +   notmuch-hello-refresh-hook-counter)'
   +)
   +test_expect_equal $counter 1
   +
   +test_begin_subtest notmuch-hello-refresh hook is called on updates
   +counter=$(test_emacs \
   +'(let ((notmuch-hello-refresh-hook-counter 0))
   +   (kill-buffer *notmuch-hello*)
   +   (notmuch-hello)
   +   (notmuch-hello-update)
   +   notmuch-hello-refresh-hook-counter)'
   +)
   +test_expect_equal $counter 2
   +
test_done
   diff --git a/test/test-lib.el b/test/test-lib.el
   index 83b8a65..3b817c3 100644
   --- a/test/test-lib.el
   +++ b/test/test-lib.el
   @@ -75,3 +75,4 @@ nothing.
  (add-hook hook (apply-partially 'hook-counter hook)))

(add-hook-counter 'notmuch-hello-mode-hook)
   +(add-hook-counter 'notmuch-hello-refresh-hook)
   -- 
   1.7.7.3
   
   ___
   notmuch mailing list
   notmuch@notmuchmail.org
   http://notmuchmail.org/mailman/listinfo/notmuch
  
  -- 
  Thomas/Schnouki

-- 
Thomas/Schnouki


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


[BUG?] Pressing SPACEbar is not doing what's expected.

2011-12-21 Thread Xavier Maillard
Hi,

I recently upgraded my notmuch installation here (passing from 0.6 or
such to latest 0.10.x series).

Problem is now, pressing SPACE in a notmuch-show buffer no longer scroll
in the message as it used to do.

SPC is bound to run command notmuch-show-advance-and-archive and its
docstring says:

This command is intended to be one of the simplest ways to
process a thread of email. It does the following:

If the current message in the thread is not yet fully visible,
scroll by a near screenful to read more of the message.

Otherwise, (the end of the current message is already within the
current window), advance to the next open message.

Finally, if there is no further message to advance to, and this
last message is already read, then archive the entire current
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.

What happens here is just what is described in paragraph 2. Although I
am in situation described in first paragraph, pressing SPC just advance
to next message and never scroll to see the next part of the current
message.

How can I change this behaviour ? Does I need to do something in my
.emacs file ?

Thank you very much.

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


Re: [BUG?] Pressing SPACEbar is not doing what's expected.

2011-12-21 Thread Jameson Graef Rollins
On Thu, 22 Dec 2011 00:08:38 +0100, Xavier Maillard x...@gnu.org wrote:
 What happens here is just what is described in paragraph 2. Although I
 am in situation described in first paragraph, pressing SPC just advance
 to next message and never scroll to see the next part of the current
 message.

Hi, Xavier.  I have noticed this as well, and it's definitely a bug and
not a feature (there's no way to change this behavior).  I think it has
to do with there being hidden text at the end of the current message,
and notmuch somehow assuming that it is at the end of the message when
it's really not.

This issue has actually been addressed once, with a patch in fact [0].
However, somehow my patch to split the and-archive bit out of the
notmuch-show-advance-and-archive function [1] seems to have exposed a
problem.

I've been meaning to give it a look, but I'm hoping Dmitry can look at
it, since he understands this stuff better than I do.

jamie.

[0] id:1320570241-30733-2-git-send-email-dmitry.kuroch...@gmail.com
[1] id:1321219008-11690-2-git-send-email-jroll...@finestructure.net


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


[PATCH] emacs: put the last search on top of recent searches in notmuch-hello

2011-12-21 Thread Dmitry Kurochkin
Notmuch-hello stores a list of recent searches.  Before the change, if
a search from this list is repeated, the recent search list is not
changed.  The patch makes repeated recent searches move to the head of
the list.  I.e. the last search is always on top of the recent search
list, which is what one would expect from a history list.
---
 emacs/notmuch-hello.el |5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el
index f892ff7..2fb0cfc 100644
--- a/emacs/notmuch-hello.el
+++ b/emacs/notmuch-hello.el
@@ -154,8 +154,9 @@ Typically \,\ in the US and UK and \.\ in Europe.
 (defvar notmuch-hello-recent-searches nil)
 
 (defun notmuch-hello-remember-search (search)
-  (if (not (member search notmuch-hello-recent-searches))
-  (push search notmuch-hello-recent-searches))
+  (setq notmuch-hello-recent-searches
+   (delete search notmuch-hello-recent-searches))
+  (push search notmuch-hello-recent-searches)
   (if ( (length notmuch-hello-recent-searches)
 notmuch-recent-searches-max)
   (setq notmuch-hello-recent-searches (butlast 
notmuch-hello-recent-searches
-- 
1.7.7.3

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


Re: have notmuch help call man?

2011-12-21 Thread David Bremner
On Tue, 20 Dec 2011 00:16:47 -0400, David Bremner da...@tethera.net wrote:

 You can also look at the patches in git://pivot.cs.unb.ca/notmuch 
 branch split-man

I made some progress.

The man pages are now installed, a notmuch help (built from this branch)
uses them.

The hacks we added to update and check the versions in the man page need
to be re-done or maybe re-thought; perhaps some simple preprocessing
with m4 or equivalent is in order to embed version numbers.

All going well, I'd like to push these relatively soon after we freeze
0.11, so that future documentation changes can take advantage of doing
it in one place.

I'm not sure if posting the patches make sense; it's up to 74k of diffs,
even using git format-patch -D.  I'm open to suggestions, as always.

d


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


Re: have notmuch help call man?

2011-12-21 Thread Jameson Graef Rollins
On Wed, 21 Dec 2011 23:43:09 -0400, David Bremner da...@tethera.net wrote:
 The man pages are now installed, a notmuch help (built from this branch)
 uses them.

Hey, David this is really great.  Thank you so much for working on this.
This will make things much easier to maintain down the line.

I think what you've done looks great.  A couple small issues:

* There are a couple of formatting issues (notmuch.1, notmuch-config.1,
  notmuch-reply.1).

* The notmuch part command is completely deprecated, so I don't think
  there's really any reason to include a man page for it.

* There's no man page for restore (notmuch-restore.1).

It also occurs to me while looking through this: do we really need a
separate setup command?  Does that ever really get run?  Doesn't
notmuch new run the setup if it doesn't detect a config?  If there's
really reason to run it again at a later point, why don't we just have a
--setup option to notmuch new instead?  It would also make notmuch.1
cleaner if we removed it.

 I'm not sure if posting the patches make sense; it's up to 74k of diffs,
 even using git format-patch -D.  I'm open to suggestions, as always.

While in general I think it's nice to have patches to the list, but I'm
not sure how much benefit there is in this case.  I would be fine to
just see the patch merged directly from your branch.

Again, thanks for the work on this, David.  This 

jamie.


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


Re: [RFC][PATCH] notmuch: Workaround to allow ignoring non-void function return.

2011-12-21 Thread Austin Clements
I must admit I haven't been following the warnings problem very
closely, but perhaps we shouldn't be ignoring these return codes?

Quoth David Edmondson on Dec 21 at  9:38 pm:
 ---
 
 The mechanism used here works for me in an isolated test case and no
 warnings appear when using it as below, but I'm unsure why the
 original warning that it is intended to address didn't appear when I
 build. Any thoughts?
 
  compat/compat.h |6 ++
  notmuch-new.c   |2 +-
  notmuch-show.c  |2 +-
  notmuch-tag.c   |2 +-
  4 files changed, 9 insertions(+), 3 deletions(-)
 
 diff --git a/compat/compat.h b/compat/compat.h
 index 7767fe8..1160301 100644
 --- a/compat/compat.h
 +++ b/compat/compat.h
 @@ -30,6 +30,12 @@
  extern C {
  #endif
  
 +#ifdef __GNUC__
 +#define ignore_result(x) ({ __typeof__(x) z = x; (void) sizeof (z); })
 +#else /* !__GNUC__ */
 +#define ignore_result(x) x
 +#endif /* __GNUC__ */
 +
  #if !HAVE_GETLINE
  #include stdio.h
  #include unistd.h
 diff --git a/notmuch-new.c b/notmuch-new.c
 index 3512de7..0ac04cc 100644
 --- a/notmuch-new.c
 +++ b/notmuch-new.c
 @@ -67,7 +67,7 @@ handle_sigint (unused (int sig))
  {
  static char msg[] = Stopping... \n;
  
 -(void) write(2, msg, sizeof(msg)-1);
 +ignore_result(write(STDERR_FILENO, msg, sizeof(msg)-1));
  interrupted = 1;
  }
  
 diff --git a/notmuch-show.c b/notmuch-show.c
 index 19fb49f..681f778 100644
 --- a/notmuch-show.c
 +++ b/notmuch-show.c
 @@ -866,7 +866,7 @@ do_show_single (void *ctx,
  
   while (!feof (file)) {
   size = fread (buf, 1, sizeof (buf), file);
 - (void) fwrite (buf, size, 1, stdout);
 + ignore_result(fwrite (buf, size, 1, stdout));
   }
  
   fclose (file);
 diff --git a/notmuch-tag.c b/notmuch-tag.c
 index 292c5da..2cbfdc3 100644
 --- a/notmuch-tag.c
 +++ b/notmuch-tag.c
 @@ -26,7 +26,7 @@ static void
  handle_sigint (unused (int sig))
  {
  static char msg[] = Stopping... \n;
 -(void) write(2, msg, sizeof(msg)-1);
 +ignore_result(write(STDERR_FILENO, msg, sizeof(msg)-1));
  interrupted = 1;
  }
  
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: [RFC][PATCH] notmuch: Workaround to allow ignoring non-void function return.

2011-12-21 Thread David Edmondson
On Thu, 22 Dec 2011 02:03:45 -0500, Austin Clements amdra...@mit.edu wrote:
 I must admit I haven't been following the warnings problem very
 closely, but perhaps we shouldn't be ignoring these return codes?

In general I agree, but what would we do if writing an error message to
stderr fails?

dme.
-- 
David Edmondson, http://dme.org


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


Re: [PATCH] emacs: put the last search on top of recent searches in notmuch-hello

2011-12-21 Thread Tomi Ollila
On Thu, 22 Dec 2011 04:23:50 +0400, Dmitry Kurochkin 
dmitry.kuroch...@gmail.com wrote:
 Notmuch-hello stores a list of recent searches.  Before the change, if
 a search from this list is repeated, the recent search list is not
 changed.  The patch makes repeated recent searches move to the head of
 the list.  I.e. the last search is always on top of the recent search
 list, which is what one would expect from a history list.
 ---

+1

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


Re: [BUG?] Pressing SPACEbar is not doing what's expected.

2011-12-21 Thread Xavier Maillard
Hi Jamie,

On Wed, 21 Dec 2011 15:19:24 -0800, Jameson Graef Rollins 
jroll...@finestructure.net wrote:
 On Thu, 22 Dec 2011 00:08:38 +0100, Xavier Maillard x...@gnu.org wrote:
  What happens here is just what is described in paragraph 2. Although I
  am in situation described in first paragraph, pressing SPC just advance
  to next message and never scroll to see the next part of the current
  message.
 
 Hi, Xavier.  I have noticed this as well, and it's definitely a bug and
 not a feature (there's no way to change this behavior).  I think it has
 to do with there being hidden text at the end of the current message,
 and notmuch somehow assuming that it is at the end of the message when
 it's really not.

Well, the good news is that I am not alone :D At the beginning, I
thought it was me.

 This issue has actually been addressed once, with a patch in fact [0].
 However, somehow my patch to split the and-archive bit out of the
 notmuch-show-advance-and-archive function [1] seems to have exposed a
 problem.

I hope you (notmuch hackers) will find a solution to this bug.

Take care guys and thank you for such an awesome tool !

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