[PATCH 1/4] emacs: unify search mechanisms

2012-01-02 Thread Xavier Maillard
On Mon, 02 Jan 2012 15:23:17 +0200, Tomi Ollila  wrote:
> On Sat, 31 Dec 2011 14:42:47 +0200, Jani Nikula  wrote:
> > On Fri, 30 Dec 2011 10:43:37 -0400, David Bremner  
> > wrote:
> > 
> > > Personally I would like to be able to customize the hello screen to
> > > remove the search box. I find it confusing that that 's' jumps to the
> > > search box there, and everywhere else brings up the mini-buffer. That
> > > might be just me, and the fact that I bind "C-c s" globally to
> > > notmuch-search.  I could easily believe that for new users having a
> > > search box is nicer.
> > 
> > Would it be a suitable compromise to bind 's' to notmuch-search (the
> > mini-buffer search) also in notmuch-hello, while leaving the search box
> > there with a common history?
> 
> I like this approach!

+1 but, like David, I'd like to be able to display/to hide the search
box via a keybinding and/or a configuration option.

/Xavier


[PATCH 1/3] pep8 fixes

2012-01-02 Thread Sebastian Spaeth
On Mon,  5 Dec 2011 21:12:33 +, Patrick Totzke  wrote:
> no changes to the code, only fixed stuff denounced by `pep8 *py`

Hi, just tried to apply but it doesn't apply cleanly anymore, can you
update the patch to latest master? 

Sorry for letting this languish for so long.

Sebastian
-- 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/20120102/20941484/attachment.pgp>


Python bindings for adoption

2012-01-02 Thread Sebastian Spaeth
Hi all, a happy new year!

After a few weeks of notmuch abstinence I am being overwhelmed with 750
new notmuch mails, and I really don't have the time or will (nor does my
family approve) to spend enormous amounts of time on notmuch. I am
already neglecting offlineimap, which also needs some attention.

As I have repeatedly stated that I want to hand over the maintainership
of the notmuch python bindings, and I would like to do it asap. I feel
that people like Patrick Totzke, or Justus Winter who generally have
been working on this far more intensely than I recently did are both
very well positioned to take on that role :-). Most importantly, they
actually work with the bindings while I don't use them myself anymore.

I will only merge bug fixes as of now, and not invest time to refactor
the code or add lots of bells and whistles. Let me know if anyone would
volunteer to take them on.

Looking forward to see more cool notmuch, alot, afew, and muchother
development progress.

Sebastian
-- 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/20120102/f3a4b99b/attachment.pgp>


Info about notmuch database

2012-01-02 Thread piutto...@logorroici.org
Hello!
I like notmuch a lot, so I'm writing a (conceptually) similar software
about addressbook: it will scan all your emails, storing email addresses
in a xapian database (you can think of it as little brother database[1] on
steroids)
The part that I'd like to re-implement is "notmuch new": it seems that
in the xapian db there is not only informations about each mail, but
also the mtime of each directory. My impression is this being "chaotic",
but probably I am just missing the point.

So, here's the question: how is the db "structured"? is there any
documentation to look at?

[1] http://www.spinnaker.de/lbdb/


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

2012-01-02 Thread Sebastian Spaeth
On Wed, 21 Dec 2011 14:15:02 +0100, Justus Winter <4winter at 
informatik.uni-hamburg.de> wrote:
> 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.


Makes sense, pushed. It shouldn't cause the breaking of existing
clients... (famous last words)

Sebastian
-- 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/20120102/4f019e40/attachment.pgp>


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

2012-01-02 Thread Sebastian Spaeth
On Wed, 21 Dec 2011 14:15:01 +0100, Justus Winter <4winter at 
informatik.uni-hamburg.de> wrote:
> ---
>  bindings/python/notmuch/message.py |   37 +--
>  1 files changed, 26 insertions(+), 11 deletions(-)

Pushed
-- 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/20120102/303987e7/attachment.pgp>


Possible bug in tests with emacs 23.2.1 (debian stable)

2012-01-02 Thread Tomi Ollila
On Sun, 1 Jan 2012 10:05:59 +, Mark Walters  
wrote:
> Hello
> 
> When I try and run the tests on my (fairly standard) debian stable
> system they hang after "PASS   Search message: json, utf-8". This is
> with latest git (07768fb1bb50e) and emacs 23.2.1.
> 
> As far as I can see emacs is not exiting when sent the "(kill-emacs)"
> command from test-lib.sh (line 931 called from line 869). It seems
> that this version of emacs prompts before exit asking "The current
> server still has clients; delete them? (yes or no) ".
> 
> This seems to have been "fixed" (i.e. emacs does not ask for a prompt
> in emacs revision 100150
> http://bzr.savannah.gnu.org/lh/emacs/emacs-23/revision/100150).
> 
> If I change test-lib.sh line 869 to send "(setq kill-emacs-hook 'nil)
> (kill-emacs)" instead of just (kill-emacs) then the tests work
> correctly (*). But I definitely don't know enough emacs to know if
> this is a sensible solution.

Interesting case... what if we want to use this hook from notmuch in
the future -- and, naturally, provide a test for this functionality.

Perhaps... if we wanted to support workaround for this particular bug,
the (setq kill-emacs-hook nil) could be put after (server-start) in
test-lib.sh...

.. but, I checked code and tested that. In case that hook is disabled,
server shutdown cleanup is not done (at least dangling server socket
file is left behind)...

... so my "vote" is that we don't attempt to work around this bug. Do
we have KNOWN ISSUES file where this kind of things can be documented ?

> Note I get exactly the same behaviour when trying to build the debian
> package from squeeze backports so it could be a bug in my setup in
> which case my apologies for the noise!

It is not a bug in your setup; I tested it with emacs 23.2.1; running
emacs from command line, executing (server-start) there and then executed
emacsclient --eval '(kill-emacs)' in another terminal window.

> Best wishes
> 
> Mark

Tomi


Segmentation fault at gmime-iconv with python binding

2012-01-02 Thread Sebastian Spaeth
On Fri, 30 Dec 2011 10:58:06 -0400, David Bremner  wrote:
> On Thu, 29 Dec 2011 22:57:27 -0200, Kazuo Teramoto  
> wrote:
> 
> > notmuch CLI show the message correct. I know nothing about gmime or
> > notmuch code, but can this be the case of the python bindings not
> > calling g_mime_init() correctly?

The python binding are never calling g_mime_init, as that is not exposed
to the python bindings. So either libnotmuch needs to take care of that
or there needs to be a clear guideline as to when a binding needs to
call what gmime stuff itself.

Sebastian
-- 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/20120102/6b82c5aa/attachment-0001.pgp>


[PATCH 5/7] py3k: the basestring and unicode types are removed in python 3

2012-01-02 Thread Sebastian Spaeth
Happy new year. Pushed patches 1-4 of this series so far. Looking fine,
but ugh, the below seems like a rather ugly hack in a function that is
probably called quite often.

Isn't there a more pretty variant avoiding these sys.version_info checks
all over the place?

> @@ -200,9 +201,9 @@ def _str(value):
>  
>  C++ code expects strings to be well formatted and
>  unicode strings to have no null bytes."""
> -if not isinstance(value, basestring):
> +if not isinstance(value, basestring if sys.version_info[0] == 2 else 
> str):
>  raise TypeError("Expected str or unicode, got %s" % str(type(value)))
> -if isinstance(value, unicode):
> +if sys.version_info[0] == 3 or isinstance(value, unicode):
>  return value.encode('UTF-8')
>  return value
-- 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/20120102/48d967f0/attachment.pgp>


[PATCH 5/5] python: add get_mtime() to the Message class

2012-01-02 Thread Sebastian Spaeth
On Tue, 13 Dec 2011 18:11:45 +0100, Thomas Jost  
wrote:
> ---
>  bindings/python/notmuch/message.py |   20 
>  1 files changed, 20 insertions(+), 0 deletions(-)

The patch looks good, so once this goes into libnotmuch, +1 for also
applying this one.

Sebastian
-- 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/20120102/b6466fdf/attachment.pgp>


[PATCH 1/4] emacs: unify search mechanisms

2012-01-02 Thread Tomi Ollila
On Sat, 31 Dec 2011 14:42:47 +0200, Jani Nikula  wrote:
> On Fri, 30 Dec 2011 10:43:37 -0400, David Bremner  
> wrote:
> 
> > Personally I would like to be able to customize the hello screen to
> > remove the search box. I find it confusing that that 's' jumps to the
> > search box there, and everywhere else brings up the mini-buffer. That
> > might be just me, and the fact that I bind "C-c s" globally to
> > notmuch-search.  I could easily believe that for new users having a
> > search box is nicer.
> 
> Would it be a suitable compromise to bind 's' to notmuch-search (the
> mini-buffer search) also in notmuch-hello, while leaving the search box
> there with a common history?

I like this approach!

> I'm not sure moving the point to search box needs a keybinding (but
> notmuch-hello-goto-search could still be there if the user wants to add
> a keybinding).

yes.

> 
> 
> BR,
> Jani.

Tomi


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

2012-01-02 Thread Tomi Ollila
On Wed, 21 Dec 2011 14:15:02 +0100, Justus Winter <4winter at 
informatik.uni-hamburg.de> wrote:
> 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(-)

LGTM, but does this break any current software using this API ?

Tomi



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

2012-01-02 Thread Tomi Ollila
On Wed, 21 Dec 2011 14:15:01 +0100, Justus Winter <4winter at 
informatik.uni-hamburg.de> wrote:
> ---
>  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

LGTM.


[PATCH 2/2] lib: call g_mime_init from notmuch_database_open

2012-01-02 Thread Tomi Ollila
On Fri, 30 Dec 2011 23:02:39 -0400, David Bremner  wrote:
> On Fri, 30 Dec 2011 19:58:10 -0200, Kazuo Teramoto  
> wrote:
> > We need to call g_mime_init to correct initialize the structures needed
> > by gmime before using it.
> > ---
> >  lib/database.cc |5 +
 > >  1 files changed, 5 insertions(+), 0 deletions(-)
> 
> I can confirm this patch (alone) fixes the segfault for me. and doesn't
> cause in test failures when applied against the release branch.  I'm
> considering pushing it into the 0.11 release. Any comments on that?

Do it. The current implementation does not break anything (in our case
as we don't do g_mime_shutdown() (0, 1 or 2 times)... The usage needs to
be "fixed" soon after...

> d

.. my suggestions how to fix this:

1) just call g_mime_init(0) without checking whether it is initialized
   already. As it't return type is 'void' it can be expected to keep some
   global storage (and reference count...). If it returned something else
   it either returns common (singleton) instance (and keeps reference count)
   or returns new instance each time called Never call g_mime_shutdown();
   just let operating system free resources when program exits. The first
   lines in g_mime_shutdown():

if (--initialized)
return;

   looks a bit suspicious -- what if application happens to call
   g_mime_shutdown() too often and then trying to call g_mime_init() again...

2) create function

  void
  notmuch_g_type_init (void)
  {
static int initialized;
if (initialized++)
return;
g_mime_init(0)
atexit (g_mime_shutdown);
  }

  and use that in place of g_mime_init() always (perhaps use macro trickery
  to disallow g_mime_init (and g_mime_shutdown). 

  Note that although atexit() makes pretty sure that in normal exit 
  g_mime_shutdown() is called due to various reasons that normal exit
  case is not reached (dies by signal, usage of _exit, execve(2)
  hardware failure, lost power etc.)(*). Therefore, IMO, I'd leave this
  (particular) cleanup to be done by the operating system -- less, 
  simpler application code.


Tomi

(*) I recall reading an article about 'design for failure' or 'expect
failure' like 5 years ago but cannot find it anymore. The point on that
article was that software can fail in any point (specially, compare
man 2 rename  and then around lines 580-610 in
http://git.busybox.net/busybox/tree/sysklogd/syslogd.c ). Since then
I've tried to prioritize in finalize things that matter early and leave
operating system to do other cleanpus for me (why do something yourself
that machine can do for you). Did you know that doing full windows
reboot is faster if the machine is just unplugged from power source
for a second and then restarted instead of doing "clean" reboot cycle.
Linux boots so fast I don't know if I'd notice the difference ;)


[PATCH 2/2] python test "compare message ids"

2012-01-02 Thread Patrick Totzke
Introduces a second (trivial) test for the python
bindings that searches for message ids and compares
the output with that of `notmuch search`.
---
 test/python |   13 +
 1 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/test/python b/test/python
index c318cc1..6018c2d 100755
--- a/test/python
+++ b/test/python
@@ -15,4 +15,17 @@ for t in q_new.search_threads():
 EOF
 notmuch search --sort=oldest-first --output=threads tag:inbox | sed 
s/^thread:// > EXPECTED
 test_expect_equal_file OUTPUT EXPECTED
+
+test_begin_subtest "compare message ids"
+test_python < EXPECTED
+test_expect_equal_file OUTPUT EXPECTED
+
 test_done
-- 
1.7.5.4



[PATCH 1/2] clean up "compare thread ids" python test

2012-01-02 Thread Patrick Totzke
This makes the test script open the database in READ_ONLY mode
and use the libraries own sorting methods instead of "sort".
---
 test/python |7 ---
 1 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/test/python b/test/python
index c3aa726..c318cc1 100755
--- a/test/python
+++ b/test/python
@@ -7,11 +7,12 @@ add_email_corpus
 test_begin_subtest "compare thread ids"
 test_python < EXPECTED
-test_expect_equal_file <(sort OUTPUT) EXPECTED
+notmuch search --sort=oldest-first --output=threads tag:inbox | sed 
s/^thread:// > EXPECTED
+test_expect_equal_file OUTPUT EXPECTED
 test_done
-- 
1.7.5.4



[PATCH 1/2] test: add a function to run Python tests

2012-01-02 Thread Patrick Totzke
Quoting Thomas Jost (2011-12-13 17:21:34)
>On Sun, 11 Dec 2011 18:58:18 +0400, Dmitry Kurochkin gmail.com> wrote:
>> Perhaps we should have a test-lib.py for test-specific stuff like this
>> (similar to test-lib.el)?  I think it would be cleaner and makes it easy
>> to add more Python test auxiliary functions later.
>
>Well, right now that would probably be overkill: the stdout-to-file
>redirection takes 3 lines at most. Besides we would still need to set
>some environment variables to run python with the correct directories.
>But of course if we need to add more helper functions for running python
>tests, then a test-lib.py would be nice.

I agree that a test-lib python module that contains some helpers would be 
useful.
Specifically, we could use a "test_expect_success" helper that
wraps a given script into a try/except block.

>Maybe we could even think about using one of Python's unit test libs for
>that: doctest, unittest (both in the standard library) and nose seem to
>be the most popular ones.
never used any of these.

I cleaned up the initial test a bit (see the following messages for the 
patches).
Here are a few suggestions for tests we should implement later:

test_begin_subtest "tag messages" # add_tag/remove_tag 
test_begin_subtest "add messages" # compare msg.get_filename to original 
test_begin_subtest "find message" 
test_begin_subtest "remove messages" 
test_begin_subtest "list tags" # get_all_tags() 
test_begin_subtest "count messages" # count_messages() 
test_begin_subtest "count threads" # MISSING in the bindings!  count_messages() 
test_begin_subtest "count messages in thread" # get_total_messages compare with 
notmuch search messages |wc 
test_begin_subtest "exceptions" # ReadOnlyDatabaseError, XapianError. 
test_begin_subtest "format message content" # format_message_as_text(indent=0)

best,
/p


[PATCH] emacs: fix notmuch-show-indent-messages-width customization variable name

2012-01-02 Thread Jameson Graef Rollins
The name was originally notmuch-indent-messages-width, which is
inconsistent with our variable naming convention.
---
Sorry, I forgot to fix the tests in the original patch.

 emacs/notmuch-show.el |6 +++---
 test/emacs|6 +++---
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index eee4da9..82d11c9 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -91,7 +91,7 @@ any given message."
   :group 'notmuch
   :type 'boolean)

-(defcustom notmuch-indent-messages-width 1
+(defcustom notmuch-show-indent-messages-width 1
   "Width of message indentation in threads.

 Messages are shown indented according to their depth in a thread.
@@ -248,7 +248,7 @@ unchanged ADDRESS if parsing fails."
   "Insert a notmuch style headerline based on HEADERS for a
 message at DEPTH in the current thread."
   (let ((start (point)))
-(insert (notmuch-show-spaces-n (* notmuch-indent-messages-width depth))
+(insert (notmuch-show-spaces-n (* notmuch-show-indent-messages-width 
depth))
(notmuch-show-clean-address (plist-get headers :From))
" ("
date
@@ -739,7 +739,7 @@ current buffer, if possible."
 (setq content-end (point-marker))

 ;; Indent according to the depth in the thread.
-(indent-rigidly content-start content-end (* notmuch-indent-messages-width 
depth))
+(indent-rigidly content-start content-end (* 
notmuch-show-indent-messages-width depth))

 (setq message-end (point-max-marker))

diff --git a/test/emacs b/test/emacs
index ca82445..f36718e 100755
--- a/test/emacs
+++ b/test/emacs
@@ -52,21 +52,21 @@ test_expect_equal_file OUTPUT 
$EXPECTED/notmuch-show-thread-maildir-storage

 test_begin_subtest "Basic notmuch-show view in emacs default indentation"
 maildir_storage_thread=$(notmuch search --output=threads 
id:20091117190054.GU3165 at dottiness.seas.harvard.edu)
-test_emacs "(let ((notmuch-indent-messages-width 1))
+test_emacs "(let ((notmuch-show-indent-messages-width 1))
  (notmuch-show \"$maildir_storage_thread\")
  (test-output))"
 test_expect_equal_file OUTPUT $EXPECTED/notmuch-show-thread-maildir-storage

 test_begin_subtest "Basic notmuch-show view in emacs without indentation"
 maildir_storage_thread=$(notmuch search --output=threads 
id:20091117190054.GU3165 at dottiness.seas.harvard.edu)
-test_emacs "(let ((notmuch-indent-messages-width 0))
+test_emacs "(let ((notmuch-show-indent-messages-width 0))
  (notmuch-show \"$maildir_storage_thread\")
  (test-output))"
 test_expect_equal_file OUTPUT 
$EXPECTED/notmuch-show-thread-maildir-storage-without-indentation

 test_begin_subtest "Basic notmuch-show view in emacs with fourfold indentation"
 maildir_storage_thread=$(notmuch search --output=threads 
id:20091117190054.GU3165 at dottiness.seas.harvard.edu)
-test_emacs "(let ((notmuch-indent-messages-width 4))
+test_emacs "(let ((notmuch-show-indent-messages-width 4))
  (notmuch-show \"$maildir_storage_thread\")
  (test-output))"
 test_expect_equal_file OUTPUT 
$EXPECTED/notmuch-show-thread-maildir-storage-with-fourfold-indentation
-- 
1.7.7.3



[PATCH 2/2] update NEWS

2012-01-02 Thread Jameson Graef Rollins
This change looks slightly larger than it actually is, since I moved
the emacs section below the Performance and Memory Management
sections.
---
 NEWS |   51 ---
 1 files changed, 40 insertions(+), 11 deletions(-)

diff --git a/NEWS b/NEWS
index 6650126..ca8edb9 100644
--- a/NEWS
+++ b/NEWS
@@ -11,6 +11,28 @@ Hooks
   supports "pre-new" and "post-new" hooks that are run before and after
   importing new messages into the database.

+Performance
+---
+
+Automatic tag query optimization
+
+  "notmuch tag" now automatically optimizes the user's query to
+  exclude messages whose tags won't change.  In the past, we've
+  suggested that people do this by hand; this is no longer necessary.
+
+Don't sort messages when creating a dump file
+
+  This speads up tag dumps considerably, without any loss of
+  information.
+
+Memory Management
+-
+
+Reduction of memory leaks
+
+  Two memory leaks when searching and showing messages were identified
+  and fixed in this release.
+
 Emacs Interface
 ---

@@ -34,22 +56,29 @@ Improvements in saved search management
   not inserted in front. It's also possible to define a sort function
   for displaying saved searches; alphabetical sort is provided.

-Performance

+Enable hooks for notmuch-hello-mode and notmuch-hello-refresh

-Automatic tag query optimization
+Customizable message indentation width

-  "notmuch tag" now automatically optimizes the user's query to
-  exclude messages whose tags won't change.  In the past, we've
-  suggested that people do this by hand; this is no longer necessary.
+  notmuch-show-indent-messages-width

-Memory Management
--
+Customizable thousands separator

-Reduction of memory leaks
+  The new configuartion variable is notmuch-hello-thousands-separator.
+  The default is now a space instead of a comma.

-  Two memory leaks when searching and showing messages were identified
-  and fixed in this release.
+Call notmuch-show instead of notmuch-search when clicking on
+buttonized id: links.
+
+New function notmuch-show-advance
+
+  This new function advances through just the current thread, and is
+  less invasive than notmuch-show-advance-and-archive.  It can easily
+  be bound to SPC with:
+
+  (define-key notmuch-show-mode-map " " 'notmuch-show-advance)
+
+Various performance improvements.

 New add-on tool
 ---
-- 
1.7.7.3



[PATCH 1/2] emacs: fix notmuch-show-indent-messages-width customization variable name

2012-01-02 Thread Jameson Graef Rollins
The name was originally notmuch-indent-messages-width, which is
inconsistent with our variable naming convention.
---
 emacs/notmuch-show.el |6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index eee4da9..82d11c9 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -91,7 +91,7 @@ any given message."
   :group 'notmuch
   :type 'boolean)

-(defcustom notmuch-indent-messages-width 1
+(defcustom notmuch-show-indent-messages-width 1
   "Width of message indentation in threads.

 Messages are shown indented according to their depth in a thread.
@@ -248,7 +248,7 @@ unchanged ADDRESS if parsing fails."
   "Insert a notmuch style headerline based on HEADERS for a
 message at DEPTH in the current thread."
   (let ((start (point)))
-(insert (notmuch-show-spaces-n (* notmuch-indent-messages-width depth))
+(insert (notmuch-show-spaces-n (* notmuch-show-indent-messages-width 
depth))
(notmuch-show-clean-address (plist-get headers :From))
" ("
date
@@ -739,7 +739,7 @@ current buffer, if possible."
 (setq content-end (point-marker))

 ;; Indent according to the depth in the thread.
-(indent-rigidly content-start content-end (* notmuch-indent-messages-width 
depth))
+(indent-rigidly content-start content-end (* 
notmuch-show-indent-messages-width depth))

 (setq message-end (point-max-marker))

-- 
1.7.7.3



update NEWS, and fix conf variable name

2012-01-02 Thread Jameson Graef Rollins
On Mon, 02 Jan 2012 07:58:16 -0400, David Bremner  wrote:
>  Austin Clements:
>emacs: Don't record undo information for search or show buffers.
>emacs: Avoid unnecessary markers.
>  
>  Dmitry Kurochkin :
>emacs: do not call notmuch show for non-inlinable parts
>  
>  Gregor Zattler:
>emacs: make message indentation width customisable
>  
>  Ivy Foster:
>emacs: Add notmuch-hello-mode-hook
>  
>  Jameson Graef Rollins (2):
>emacs: breakout notmuch-show-advance functionality from 
> notmuch-show-advance-and-archive
>emacs: call notmuch-show instead of notmuch-search in buttonised id: 
> links
>  
> 
>  Thomas Jost (4):
>emacs: Add a face for crypto parts headers
>emacs: add notmuch-hello-refresh-hook
>emacs: rename notmuch-decimal-separator to 
> notmuch-hello-thousands-separator
>emacs: Change the default thousands separator to a space
>  
>  Thomas Schwinge (1):
>dump: Don't sort the output by message id.

I've added NEWS items for pretty much everything here.

I'm also including a patch to fix the conf variable name for
notmuch-indent-messages-width, which really should have been
notmuch-show-indent-messages-width originally.  The NEWS entry for
this assumes the update.

jamie.




0.11 is frozen, please update NEWS

2012-01-02 Thread David Bremner


I have tagged 0.11_rc2 and uploaded 0.11~rc2-1 to Debian experimental.
This includes only the single non-doc commit, fixing a python bindings
segfault. NEWS items are still solicited.

d


 Austin Clements:
   emacs: Don't record undo information for search or show buffers.
   emacs: Avoid unnecessary markers.

 Dmitry Kurochkin :
   emacs: do not call notmuch show for non-inlinable parts

 Gregor Zattler:
   emacs: make message indentation width customisable

 Ivy Foster:
   emacs: Add notmuch-hello-mode-hook

 Jameson Graef Rollins (2):
   emacs: breakout notmuch-show-advance functionality from 
notmuch-show-advance-and-archive
   emacs: call notmuch-show instead of notmuch-search in buttonised id: 
links


 Thomas Jost (4):
   emacs: Add a face for crypto parts headers
   emacs: add notmuch-hello-refresh-hook
   emacs: rename notmuch-decimal-separator to 
notmuch-hello-thousands-separator
   emacs: Change the default thousands separator to a space

 Thomas Schwinge (1):
   dump: Don't sort the output by message id.


Re: 0.11 is frozen, please update NEWS

2012-01-02 Thread David Bremner


I have tagged 0.11_rc2 and uploaded 0.11~rc2-1 to Debian experimental.
This includes only the single non-doc commit, fixing a python bindings
segfault. NEWS items are still solicited.

d


 Austin Clements:
   emacs: Don't record undo information for search or show buffers.
   emacs: Avoid unnecessary markers.
 
 Dmitry Kurochkin :
   emacs: do not call notmuch show for non-inlinable parts
 
 Gregor Zattler:
   emacs: make message indentation width customisable
 
 Ivy Foster:
   emacs: Add notmuch-hello-mode-hook
 
 Jameson Graef Rollins (2):
   emacs: breakout notmuch-show-advance functionality from 
notmuch-show-advance-and-archive
   emacs: call notmuch-show instead of notmuch-search in buttonised id: 
links
 

 Thomas Jost (4):
   emacs: Add a face for crypto parts headers
   emacs: add notmuch-hello-refresh-hook
   emacs: rename notmuch-decimal-separator to 
notmuch-hello-thousands-separator
   emacs: Change the default thousands separator to a space
 
 Thomas Schwinge (1):
   dump: Don't sort the output by message id.
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH 2/2] lib: call g_mime_init from notmuch_database_open

2012-01-02 Thread Tomi Ollila
On Fri, 30 Dec 2011 23:02:39 -0400, David Bremner da...@tethera.net wrote:
 On Fri, 30 Dec 2011 19:58:10 -0200, Kazuo Teramoto kaz@gmail.com wrote:
  We need to call g_mime_init to correct initialize the structures needed
  by gmime before using it.
  ---
   lib/database.cc |5 +
1 files changed, 5 insertions(+), 0 deletions(-)
 
 I can confirm this patch (alone) fixes the segfault for me. and doesn't
 cause in test failures when applied against the release branch.  I'm
 considering pushing it into the 0.11 release. Any comments on that?

Do it. The current implementation does not break anything (in our case
as we don't do g_mime_shutdown() (0, 1 or 2 times)... The usage needs to
be fixed soon after...

 d

.. my suggestions how to fix this:

1) just call g_mime_init(0) without checking whether it is initialized
   already. As it't return type is 'void' it can be expected to keep some
   global storage (and reference count...). If it returned something else
   it either returns common (singleton) instance (and keeps reference count)
   or returns new instance each time called Never call g_mime_shutdown();
   just let operating system free resources when program exits. The first
   lines in g_mime_shutdown():

if (--initialized)
return;

   looks a bit suspicious -- what if application happens to call
   g_mime_shutdown() too often and then trying to call g_mime_init() again...

2) create function

  void
  notmuch_g_type_init (void)
  {
static int initialized;
if (initialized++)
return;
g_mime_init(0)
atexit (g_mime_shutdown);
  }

  and use that in place of g_mime_init() always (perhaps use macro trickery
  to disallow g_mime_init (and g_mime_shutdown). 

  Note that although atexit() makes pretty sure that in normal exit 
  g_mime_shutdown() is called due to various reasons that normal exit
  case is not reached (dies by signal, usage of _exit, execve(2)
  hardware failure, lost power etc.)(*). Therefore, IMO, I'd leave this
  (particular) cleanup to be done by the operating system -- less, 
  simpler application code.


Tomi

(*) I recall reading an article about 'design for failure' or 'expect
failure' like 5 years ago but cannot find it anymore. The point on that
article was that software can fail in any point (specially, compare
man 2 rename  and then around lines 580-610 in
http://git.busybox.net/busybox/tree/sysklogd/syslogd.c ). Since then
I've tried to prioritize in finalize things that matter early and leave
operating system to do other cleanpus for me (why do something yourself
that machine can do for you). Did you know that doing full windows
reboot is faster if the machine is just unplugged from power source
for a second and then restarted instead of doing clean reboot cycle.
Linux boots so fast I don't know if I'd notice the difference ;)
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


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

2012-01-02 Thread Tomi Ollila
On Wed, 21 Dec 2011 14:15:01 +0100, Justus Winter 
4win...@informatik.uni-hamburg.de wrote:
 ---
  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

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


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

2012-01-02 Thread Tomi Ollila
On Wed, 21 Dec 2011 14:15:02 +0100, Justus Winter 
4win...@informatik.uni-hamburg.de wrote:
 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(-)

LGTM, but does this break any current software using this API ?

Tomi

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


Re: [PATCH 1/4] emacs: unify search mechanisms

2012-01-02 Thread Tomi Ollila
On Sat, 31 Dec 2011 14:42:47 +0200, Jani Nikula j...@nikula.org wrote:
 On Fri, 30 Dec 2011 10:43:37 -0400, David Bremner da...@tethera.net wrote:
 
  Personally I would like to be able to customize the hello screen to
  remove the search box. I find it confusing that that 's' jumps to the
  search box there, and everywhere else brings up the mini-buffer. That
  might be just me, and the fact that I bind C-c s globally to
  notmuch-search.  I could easily believe that for new users having a
  search box is nicer.
 
 Would it be a suitable compromise to bind 's' to notmuch-search (the
 mini-buffer search) also in notmuch-hello, while leaving the search box
 there with a common history?

I like this approach!

 I'm not sure moving the point to search box needs a keybinding (but
 notmuch-hello-goto-search could still be there if the user wants to add
 a keybinding).

yes.

 
 
 BR,
 Jani.

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