Looking for the perfect mail client

2014-10-22 Thread Peter Feigl
> I'm unable to solve the icon problem. This gtk message is stupid. I couldn't
> find out what's going wrong.

Similar warnings happened to me often in different applications. This is
almost certainly just a warning and not the real problem. Try strace or
gdb to find out what really crashes notmuch.


Looking for the perfect mail client

2014-10-22 Thread Sepp Tannhuber
I'm unable to solve the icon problem. This gtk message is stupid. I couldn't
find out what's going wrong.


Looking for the perfect mail client

2014-10-22 Thread Gaute Hope
Excerpts from Sepp Tannhuber's message of October 22, 2014 16:48:
> Gaute Hope  schrieb am 15:49 Mittwoch, 22.Oktober 2014:
> 
>> Do you have libgpg-error installed?
> No, this was exactly the point. Now, I've compiled it and linked successfully.
> 
>> What distro do you run?
> Debian stable with many backports from unstable.
> 
> 
> 
> 
> The next problem is that astroid doesn't start:
> 
> (astroid:12459): Gtk-WARNING **: Could not find the icon 
> 'mail-send-symbolic'. The 'hicolor' theme
> was not found either, perhaps you need to install it.
> You can get a copy from:
>  http://icon-theme.freedesktop.org/releases
> terminate called after throwing an instance of 'Gtk::IconThemeError'
> 
> I've tried hicolor-icon-theme from debian stable and unstable as well as from
> the sources from icon-theme.freedesktop.org. The icon ?mail-send-symbolic?
> doesn't exist there. However, I've found it on my PC at other locations:
> 
> /usr/share/icons/Adwaita/scalable/actions/mail-send-symbolic.svg
> /usr/share/icons/mate/scalable/actions/mail-send-symbolic.svg
> /usr/share/icons/gnome/scalable/actions/mail-send-symbolic.svg
> 
> So my next question is, why doesn't astroid find it?
> 

I have had some problems with Gtk 3.14 (3.12 works great) in how rows
are rendered, so I am anxious to see how that works on debian.

- gaute



Looking for the perfect mail client

2014-10-22 Thread Sepp Tannhuber
Gaute Hope  schrieb am 15:49 Mittwoch, 22.Oktober 2014:

> Do you have libgpg-error installed?
No, this was exactly the point. Now, I've compiled it and linked successfully.

> What distro do you run?
Debian stable with many backports from unstable.




The next problem is that astroid doesn't start:

(astroid:12459): Gtk-WARNING **: Could not find the icon 'mail-send-symbolic'. 
The 'hicolor' theme
was not found either, perhaps you need to install it.
You can get a copy from:
 http://icon-theme.freedesktop.org/releases
terminate called after throwing an instance of 'Gtk::IconThemeError'

I've tried hicolor-icon-theme from debian stable and unstable as well as from
the sources from icon-theme.freedesktop.org. The icon ?mail-send-symbolic?
doesn't exist there. However, I've found it on my PC at other locations:

/usr/share/icons/Adwaita/scalable/actions/mail-send-symbolic.svg
/usr/share/icons/mate/scalable/actions/mail-send-symbolic.svg
/usr/share/icons/gnome/scalable/actions/mail-send-symbolic.svg

So my next question is, why doesn't astroid find it?


Looking for the perfect mail client

2014-10-22 Thread Gaute Hope
Excerpts from Sepp Tannhuber's message of October 22, 2014 16:48:
> Gaute Hope  schrieb am 15:49 Mittwoch, 22.Oktober 2014:
> The next problem is that astroid doesn't start:
> 
> (astroid:12459): Gtk-WARNING **: Could not find the icon 
> 'mail-send-symbolic'. The 'hicolor' theme
> was not found either, perhaps you need to install it.
> You can get a copy from:
>  http://icon-theme.freedesktop.org/releases
> terminate called after throwing an instance of 'Gtk::IconThemeError'
> 
> I've tried hicolor-icon-theme from debian stable and unstable as well as from
> the sources from icon-theme.freedesktop.org. The icon ?mail-send-symbolic?
> doesn't exist there. However, I've found it on my PC at other locations:
> 
> /usr/share/icons/Adwaita/scalable/actions/mail-send-symbolic.svg
> /usr/share/icons/mate/scalable/actions/mail-send-symbolic.svg
> /usr/share/icons/gnome/scalable/actions/mail-send-symbolic.svg
> 
> So my next question is, why doesn't astroid find it?

Maybe it is an issue with the icon cache? Reboot?

Cheers, Gaute



Looking for the perfect mail client

2014-10-22 Thread Gaute Hope
Excerpts from Sepp Tannhuber's message of October 22, 2014 14:23:
> Hi Gaute
>
>
> Gaute Hope  schrieb am 8:57 Mittwoch, 22.Oktober 2014:
>> You need a newer version of GTK+, I think at least version 3.10 (I am
>> using 3.12 on Arch Linux) [0].
>
>
>
>
> Thanks for your support. Now the linker fails:
>
> linking Program ==> astroid
> //lib/i386-linux-gnu/libgcrypt.so.20: undefined reference to `gpg_strsource 
> at GPG_ERROR_1.0'
> //lib/i386-linux-gnu/libgcrypt.so.20: undefined reference to 
> `gpg_err_code_from_syserror at GPG_ERROR_1.0'
> //lib/i386-linux-gnu/libgcrypt.so.20: undefined reference to 
> `gpg_err_set_errno at GPG_ERROR_1.0'
> //lib/i386-linux-gnu/libgcrypt.so.20: undefined reference to `gpg_strerror at 
> GPG_ERROR_1.0'
> //lib/i386-linux-gnu/libgcrypt.so.20: undefined reference to 
> `gpg_err_code_from_errno at GPG_ERROR_1.0'
> collect2: error: ld returned 1 exit status
> scons: *** [astroid] Error 1
> scons: building terminated because of errors.

This seems to be an error in one of the libraries used by astroid, I am
guessing gmime -> ... -> libgcrypt > libgpg-error. Do you have
libgpg-error installed? What distro do you run? There seems to be a
package dependency inconsistency somewhere.

What is the output of:

  $ scons --verbose

Cheers, Gaute



Looking for the perfect mail client

2014-10-22 Thread Sepp Tannhuber
Hi Gaute


Gaute Hope  schrieb am 8:57 Mittwoch, 22.Oktober 2014:
> You need a newer version of GTK+, I think at least version 3.10 (I am
> using 3.12 on Arch Linux) [0].




Thanks for your support. Now the linker fails:

linking Program ==> astroid
//lib/i386-linux-gnu/libgcrypt.so.20: undefined reference to `gpg_strsource at 
GPG_ERROR_1.0'
//lib/i386-linux-gnu/libgcrypt.so.20: undefined reference to 
`gpg_err_code_from_syserror at GPG_ERROR_1.0'
//lib/i386-linux-gnu/libgcrypt.so.20: undefined reference to `gpg_err_set_errno 
at GPG_ERROR_1.0'
//lib/i386-linux-gnu/libgcrypt.so.20: undefined reference to `gpg_strerror at 
GPG_ERROR_1.0'
//lib/i386-linux-gnu/libgcrypt.so.20: undefined reference to 
`gpg_err_code_from_errno at GPG_ERROR_1.0'
collect2: error: ld returned 1 exit status
scons: *** [astroid] Error 1
scons: building terminated because of errors.



[PATCH v3 3/4] cli: Extend the search command for --output={sender, recipients}

2014-10-22 Thread Mark Walters
On Sun, 12 Oct 2014, Michal Sojka  wrote:
> The new outputs allow printing senders, recipients or both of matching
> messages. The --output option is converted from "keyword" argument to
> "flags" argument, which means that the user can use --output=sender and
> --output=recipients simultaneously, to print both. Other combinations
> produce an error.
>
> This code based on a patch from Jani Nikula.
> ---
>  completion/notmuch-completion.bash |   2 +-
>  completion/notmuch-completion.zsh  |   3 +-
>  doc/man1/notmuch-search.rst|  22 +++-
>  notmuch-search.c   | 110 
> ++---
>  test/T090-search-output.sh |  64 +
>  5 files changed, 189 insertions(+), 12 deletions(-)
>
> diff --git a/completion/notmuch-completion.bash 
> b/completion/notmuch-completion.bash
> index 0571dc9..cfbd389 100644
> --- a/completion/notmuch-completion.bash
> +++ b/completion/notmuch-completion.bash
> @@ -294,7 +294,7 @@ _notmuch_search()
>   return
>   ;;
>   --output)
> - COMPREPLY=( $( compgen -W "summary threads messages files tags" -- 
> "${cur}" ) )
> + COMPREPLY=( $( compgen -W "summary threads messages files tags 
> sender recipients" -- "${cur}" ) )
>   return
>   ;;
>   --sort)
> diff --git a/completion/notmuch-completion.zsh 
> b/completion/notmuch-completion.zsh
> index 67a9aba..3e52a00 100644
> --- a/completion/notmuch-completion.zsh
> +++ b/completion/notmuch-completion.zsh
> @@ -52,7 +52,8 @@ _notmuch_search()
>_arguments -s : \
>  '--max-threads=[display only the first x threads from the search 
> results]:number of threads to show: ' \
>  '--first=[omit the first x threads from the search results]:number of 
> threads to omit: ' \
> -'--sort=[sort results]:sorting:((newest-first\:"reverse chronological 
> order" oldest-first\:"chronological order"))'
> +'--sort=[sort results]:sorting:((newest-first\:"reverse chronological 
> order" oldest-first\:"chronological order"))' \
> +'--output=[select what to output]:output:((summary threads messages 
> files tags sender recipients))'
>  }
>  
>  _notmuch()
> diff --git a/doc/man1/notmuch-search.rst b/doc/man1/notmuch-search.rst
> index 90160f2..c9d38b1 100644
> --- a/doc/man1/notmuch-search.rst
> +++ b/doc/man1/notmuch-search.rst
> @@ -35,7 +35,7 @@ Supported options for **search** include
>  intended for programs that invoke **notmuch(1)** internally. If
>  omitted, the latest supported version will be used.
>  
> -``--output=(summary|threads|messages|files|tags)``
> +``--output=(summary|threads|messages|files|tags|sender|recipients)``
>  
>  **summary**
>  Output a summary of each thread with any message matching
> @@ -78,6 +78,26 @@ Supported options for **search** include
>  by null characters (--format=text0), as a JSON array
>  (--format=json), or as an S-Expression list (--format=sexp).
>  
> + **sender**
> +Output all addresses from the *From* header that appear on
> +any message matching the search terms, either one per line
> +(--format=text), separated by null characters
> +(--format=text0), as a JSON array (--format=json), or as
> +an S-Expression list (--format=sexp).
> +
> + Note: Searching for **sender** should be much faster than
> + searching for **recipients**, because sender addresses are
> + cached directly in the database whereas other addresses
> + need to be fetched from message files.
> +
> + **recipients**
> +Like **sender** but for addresses from *To*, *Cc* and
> + *Bcc* headers.
> +
> + This option can be given multiple times to combine different
> + outputs. Curently, this is only supported for **sender** and
> + **recipients** outputs.
> +
>  ``--sort=``\ (**newest-first**\ \|\ **oldest-first**)
>  This option can be used to present results in either
>  chronological order (**oldest-first**) or reverse chronological
> diff --git a/notmuch-search.c b/notmuch-search.c
> index 5ac2a26..74588f8 100644
> --- a/notmuch-search.c
> +++ b/notmuch-search.c
> @@ -23,11 +23,14 @@
>  #include "string-util.h"
>  
>  typedef enum {
> -OUTPUT_SUMMARY,
> -OUTPUT_THREADS,
> -OUTPUT_MESSAGES,
> -OUTPUT_FILES,
> -OUTPUT_TAGS
> +OUTPUT_SUMMARY   = 1 << 0,
> +OUTPUT_THREADS   = 1 << 1,
> +OUTPUT_MESSAGES  = 1 << 2,
> +OUTPUT_FILES = 1 << 3,
> +OUTPUT_TAGS  = 1 << 4,
> +OUTPUT_SENDER= 1 << 5,
> +OUTPUT_RECIPIENTS= 1 << 6,
> +OUTPUT_ADDRESSES = OUTPUT_SENDER | OUTPUT_RECIPIENTS,

I think I would drop the OUTPUT_ADDRESSES enum as the parser no longer
uses it (and replace the one use by OUTPUT_SENDER | OUTPUT_RECIPIENTS below).

>  } output_t;
>  
>  typedef struct {
> @@ -220,6 +223,67 @@ do_search_threads 

[PATCH v3 1/4] cli: Refactor option passing in the search command

2014-10-22 Thread Mark Walters
On Sun, 12 Oct 2014, Michal Sojka  wrote:
> Many functions that implement the search command need to access command
> line options. Instead of passing each option in a separate variable, put
> them in a structure and pass only this structure.
>
> This will become handy in the following patches.

Hi

This basically looks good to me. I have some style queries/preferences
mentioned below but am happy to be overruled by you or others.

> ---
>  notmuch-search.c | 122 
> ---
>  1 file changed, 62 insertions(+), 60 deletions(-)
>
> diff --git a/notmuch-search.c b/notmuch-search.c
> index bc9be45..5ac2a26 100644
> --- a/notmuch-search.c
> +++ b/notmuch-search.c
> @@ -30,6 +30,16 @@ typedef enum {
>  OUTPUT_TAGS
>  } output_t;
>  
> +typedef struct {
> +sprinter_t *format;
> +notmuch_query_t *query;
> +notmuch_sort_t sort;
> +output_t output;
> +int offset;
> +int limit;
> +int dupe;
> +} search_options_t;
> +

I don't think of format as being a "search option", whereas I do think
of all the others as search options. So I would prefer to omit format
from search_options_t and pass it explicitly.

>  /* Return two stable query strings that identify exactly the matched
>   * and unmatched messages currently in thread.  If there are no
>   * matched or unmatched messages, the returned buffers will be
> @@ -70,46 +80,42 @@ get_thread_query (notmuch_thread_t *thread,
>  }
>  
>  static int
> -do_search_threads (sprinter_t *format,
> -notmuch_query_t *query,
> -notmuch_sort_t sort,
> -output_t output,
> -int offset,
> -int limit)
> +do_search_threads (search_options_t *o)

Personally, I prefer longer variable names (and names which aren't 'o'):
even just opt would be a definite improvement in my opinion.

>  {
>  notmuch_thread_t *thread;
>  notmuch_threads_t *threads;
>  notmuch_tags_t *tags;
> +sprinter_t *format = o->format;
>  time_t date;
>  int i;
>  
> -if (offset < 0) {
> - offset += notmuch_query_count_threads (query);
> - if (offset < 0)
> - offset = 0;
> +if (o->offset < 0) {
> + o->offset += notmuch_query_count_threads (o->query);
> + if (o->offset < 0)
> + o->offset = 0;
>  }
>  
> -threads = notmuch_query_search_threads (query);
> +threads = notmuch_query_search_threads (o->query);
>  if (threads == NULL)
>   return 1;
>  
>  format->begin_list (format);
>  
>  for (i = 0;
> -  notmuch_threads_valid (threads) && (limit < 0 || i < offset + limit);
> +  notmuch_threads_valid (threads) && (o->limit < 0 || i < o->offset + 
> o->limit);
>notmuch_threads_move_to_next (threads), i++)
>  {
>   thread = notmuch_threads_get (threads);
>  
> - if (i < offset) {
> + if (i < o->offset) {
>   notmuch_thread_destroy (thread);
>   continue;
>   }
>  
> - if (output == OUTPUT_THREADS) {
> + if (o->output == OUTPUT_THREADS) {
>   format->set_prefix (format, "thread");
>   format->string (format,
> - notmuch_thread_get_thread_id (thread));
> +notmuch_thread_get_thread_id (thread));
>   format->separator (format);
>   } else { /* output == OUTPUT_SUMMARY */
>   void *ctx_quote = talloc_new (thread);
> @@ -123,7 +129,7 @@ do_search_threads (sprinter_t *format,
>  
>   format->begin_map (format);
>  
> - if (sort == NOTMUCH_SORT_OLDEST_FIRST)
> + if (o->sort == NOTMUCH_SORT_OLDEST_FIRST)
>   date = notmuch_thread_get_oldest_date (thread);
>   else
>   date = notmuch_thread_get_newest_date (thread);
> @@ -215,40 +221,36 @@ do_search_threads (sprinter_t *format,
>  }
>  
>  static int
> -do_search_messages (sprinter_t *format,
> - notmuch_query_t *query,
> - output_t output,
> - int offset,
> - int limit,
> - int dupe)
> +do_search_messages (search_options_t *o)
>  {
>  notmuch_message_t *message;
>  notmuch_messages_t *messages;
>  notmuch_filenames_t *filenames;
> +sprinter_t *format = o->format;
>  int i;
>  
> -if (offset < 0) {
> - offset += notmuch_query_count_messages (query);
> - if (offset < 0)
> - offset = 0;
> +if (o->offset < 0) {
> + o->offset += notmuch_query_count_messages (o->query);
> + if (o->offset < 0)
> + o->offset = 0;
>  }
>  
> -messages = notmuch_query_search_messages (query);
> +messages = notmuch_query_search_messages (o->query);
>  if (messages == NULL)
>   return 1;
>  
>  format->begin_list (format);
>  
>  for (i = 0;
> -  notmuch_messages_valid (messages) && (limit < 0 || i < offset + limit);
> +  notmuch_messages_valid (messages) && (o->limit < 0 || i < o->offset + 
> 

Looking for the perfect mail client

2014-10-22 Thread Sepp Tannhuber
Gaute Hope  schrieb am 13:19 Dienstag, 21.Oktober 2014:


> I am working on something called 'astroid' which is a GTK+ and WebKit
> based email client for notmuch.

That's really interesting. From your description, it's exactly what
I would like to have. At the moment, compilation fails:

compiling ==> src/astroid.cc
In file included from src/main_window.hh:7:0,
 from src/astroid.cc:22:
src/command_bar.hh:23:44: error: expected class-name before '{' token
   class CommandBar : public Gtk::SearchBar {
^
src/command_bar.hh:38:12: error: 'SearchEntry' in namespace 'Gtk' does not name 
a type
   Gtk::SearchEntry entry;
^
In file included from src/main_window.hh:8:0,
 from src/astroid.cc:22:
src/modes/mode.hh:35:12: error: 'Revealer' in namespace 'Gtk' does not name a 
type
   Gtk::Revealer * rev_yes_no;
^
scons: *** [src/astroid.o] Error 1
scons: building terminated because of errors.


[PATCH v1] emacs: notmuch-jump.el should provide.

2014-10-22 Thread David Edmondson
To ease loading, notmuch-jump.el should provide 'notmuch-jump.
---
 emacs/notmuch-jump.el | 4 
 1 file changed, 4 insertions(+)

diff --git a/emacs/notmuch-jump.el b/emacs/notmuch-jump.el
index 05ec57e..20e24b2 100644
--- a/emacs/notmuch-jump.el
+++ b/emacs/notmuch-jump.el
@@ -170,3 +170,7 @@ buffer."
   (setq notmuch-jump--action ',(third action))
   (exit-minibuffer
 map))
+
+;;
+
+(provide 'notmuch-jump)
-- 
2.1.1



Looking for the perfect mail client

2014-10-22 Thread Gaute Hope
Excerpts from Sepp Tannhuber's message of October 22, 2014 8:46:
> Gaute Hope  schrieb am 13:19 Dienstag, 21.Oktober 2014:
>
>
>> I am working on something called 'astroid' which is a GTK+ and WebKit
>> based email client for notmuch.
>
> That's really interesting. From your description, it's exactly what
> I would like to have. At the moment, compilation fails:
>
> compiling ==> src/astroid.cc
> In file included from src/main_window.hh:7:0,
>  from src/astroid.cc:22:
> src/command_bar.hh:23:44: error: expected class-name before '{' token
>class CommandBar : public Gtk::SearchBar {
> ^
> src/command_bar.hh:38:12: error: 'SearchEntry' in namespace 'Gtk' does not 
> name a type
>Gtk::SearchEntry entry;
> ^
> In file included from src/main_window.hh:8:0,
>  from src/astroid.cc:22:
> src/modes/mode.hh:35:12: error: 'Revealer' in namespace 'Gtk' does not name a 
> type
>Gtk::Revealer * rev_yes_no;
> ^
> scons: *** [src/astroid.o] Error 1
> scons: building terminated because of errors.
>

Thanks for trying!

You need a newer version of GTK+, I think at least version 3.10 (I am
using 3.12 on Arch Linux) [0].

Cheers, Gaute

[0] https://help.gnome.org/misc/release-notes/3.10/developers.html.en



[PATCH 00/12] Add ghost messages and fix thread linking

2014-10-22 Thread Mark Walters

On Tue, 07 Oct 2014, Austin Clements  wrote:
> This is v2 of the
> id:1412345958-8278-1-git-send-email-aclements at csail.mit.edu.  This
> adds some comments and clarifies some code as suggested by David.
> Patch 6 is new in v2 and adds some bit-twiddling macros for clarity
> and robustness in later patches.

Ok I have now been through the whole series and am basically happy with
it (I sent some trivial comments separately). The tests pass, and my
database still seems to work.

So +1 from me but it is code I am not very familiar with so it's a
slightly more cautious +1 than usual.

Best wishes

Mark


>
> The diff from v1 is below.
>
> diff --git a/lib/database.cc b/lib/database.cc
> index 4655f59..6e51a72 100644
> --- a/lib/database.cc
> +++ b/lib/database.cc
> @@ -1277,6 +1277,8 @@ notmuch_database_upgrade (notmuch_database_t *notmuch,
>   ++total;
>  }
>  if (new_features & NOTMUCH_FEATURE_GHOSTS) {
> + /* The ghost message upgrade converts all thread_id_*
> +  * metadata values into ghost message documents. */
>   t_end = db->metadata_keys_end ("thread_id_");
>   for (t = db->metadata_keys_begin ("thread_id_"); t != t_end; ++t)
>   ++total;
> diff --git a/lib/message.cc b/lib/message.cc
> index ad832cf..a7a13cc 100644
> --- a/lib/message.cc
> +++ b/lib/message.cc
> @@ -344,15 +344,17 @@ _notmuch_message_ensure_metadata (notmuch_message_t 
> *message)
>  
>  /* Get document type */
>  assert (strcmp (id_prefix, type_prefix) < 0);
> -if (! (message->lazy_flags & (1 << NOTMUCH_MESSAGE_FLAG_GHOST))) {
> +if (! NOTMUCH_TEST_BIT (message->lazy_flags, 
> NOTMUCH_MESSAGE_FLAG_GHOST)) {
>   i.skip_to (type_prefix);
> + /* "T" is the prefix "type" fields.  See
> +  * BOOLEAN_PREFIX_INTERNAL. */
>   if (*i == "Tmail")
> - message->flags &= ~(1 << NOTMUCH_MESSAGE_FLAG_GHOST);
> + NOTMUCH_CLEAR_BIT (>flags, NOTMUCH_MESSAGE_FLAG_GHOST);
>   else if (*i == "Tghost")
> - message->flags |= (1 << NOTMUCH_MESSAGE_FLAG_GHOST);
> + NOTMUCH_SET_BIT (>flags, NOTMUCH_MESSAGE_FLAG_GHOST);
>   else
>   INTERNAL_ERROR ("Message without type term");
> - message->lazy_flags |= (1 << NOTMUCH_MESSAGE_FLAG_GHOST);
> + NOTMUCH_SET_BIT (>lazy_flags, NOTMUCH_MESSAGE_FLAG_GHOST);
>  }
>  
>  /* Get filename list.  Here we get only the terms.  We lazily
> @@ -390,8 +392,8 @@ _notmuch_message_invalidate_metadata (notmuch_message_t 
> *message,
>  }
>  
>  if (strcmp ("type", prefix_name) == 0) {
> - message->flags &= ~(1 << NOTMUCH_MESSAGE_FLAG_GHOST);
> - message->lazy_flags &= ~(1 << NOTMUCH_MESSAGE_FLAG_GHOST);
> + NOTMUCH_CLEAR_BIT (>flags, NOTMUCH_MESSAGE_FLAG_GHOST);
> + NOTMUCH_CLEAR_BIT (>lazy_flags, NOTMUCH_MESSAGE_FLAG_GHOST);
>  }
>  
>  if (strcmp ("file-direntry", prefix_name) == 0) {
> @@ -893,10 +895,10 @@ notmuch_message_get_flag (notmuch_message_t *message,
> notmuch_message_flag_t flag)
>  {
>  if (flag == NOTMUCH_MESSAGE_FLAG_GHOST &&
> - ! (message->lazy_flags & (1 << flag)))
> + ! NOTMUCH_TEST_BIT (message->lazy_flags, flag))
>   _notmuch_message_ensure_metadata (message);
>  
> -return message->flags & (1 << flag);
> +return NOTMUCH_TEST_BIT (message->flags, flag);
>  }
>  
>  void
> @@ -904,10 +906,10 @@ notmuch_message_set_flag (notmuch_message_t *message,
> notmuch_message_flag_t flag, notmuch_bool_t enable)
>  {
>  if (enable)
> - message->flags |= (1 << flag);
> + NOTMUCH_SET_BIT (>flags, flag);
>  else
> - message->flags &= ~(1 << flag);
> -message->lazy_flags |= (1 << flag);
> + NOTMUCH_CLEAR_BIT (>flags, flag);
> +NOTMUCH_SET_BIT (>lazy_flags, flag);
>  }
>  
>  time_t
> diff --git a/lib/notmuch-private.h b/lib/notmuch-private.h
> index 2fbd38e..2f43c1d 100644
> --- a/lib/notmuch-private.h
> +++ b/lib/notmuch-private.h
> @@ -63,6 +63,17 @@ NOTMUCH_BEGIN_DECLS
>  #define STRNCMP_LITERAL(var, literal) \
>  strncmp ((var), (literal), sizeof (literal) - 1)
>  
> +/* Robust bit test/set/reset macros */
> +#define NOTMUCH_TEST_BIT(val, bit) \
> +((bit < 0 || bit >= CHAR_BIT * sizeof (unsigned long long)) ? 0  \
> + : !!((val) & (1ull << bit)))
> +#define NOTMUCH_SET_BIT(valp, bit) \
> +((bit < 0 || bit >= CHAR_BIT * sizeof (unsigned long long)) ? *(valp) \
> + : (*(valp) |= (1ull << bit)))
> +#define NOTMUCH_CLEAR_BIT(valp,  bit) \
> +((bit < 0 || bit >= CHAR_BIT * sizeof (unsigned long long)) ? *(valp) \
> + : (*(valp) &= ~(1ull << bit)))
> +
>  #define unused(x) x __attribute__ ((unused))
>  
>  #ifdef __cplusplus
>
>
> ___
> notmuch mailing list
> notmuch at notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch


[PATCH v2 12/12] lib: Remove unnecessary thread linking steps when using ghost messages

2014-10-22 Thread Mark Walters
On Tue, 07 Oct 2014, Austin Clements  wrote:
> From: Austin Clements 
>
> Previously, it was necessary to link new messages to children to work
> around some (though not all) problems with the old metadata-based
> approach to stored thread IDs.  With ghost messages, this is no longer
> necessary, so don't bother with child linking when ghost messages are
> in use.
> ---
>  lib/database.cc | 21 +
>  1 file changed, 17 insertions(+), 4 deletions(-)
>
> diff --git a/lib/database.cc b/lib/database.cc
> index 1316529..6e51a72 100644
> --- a/lib/database.cc
> +++ b/lib/database.cc
> @@ -2169,10 +2169,23 @@ _notmuch_database_link_message (notmuch_database_t 
> *notmuch,
>  if (status)
>   goto DONE;
>  
> -status = _notmuch_database_link_message_to_children (notmuch, message,
> -  _id);
> -if (status)
> - goto DONE;
> +if (! (notmuch->features & NOTMUCH_FEATURE_GHOSTS)) {
> + /* In general, it shouldn't be necessary to link children,
> +  * since the earlier indexing of those children will have
> +  * stored a thread ID for the missing parent.  However, prior
> +  * to ghost messages, these stored thread IDs were NOT
> +  * rewritten during thread merging (and there was no
> +  * performant way to do so), so if indexed children were
> +  * pulled into a different thread ID by a merge, it was
> +  * necessary to pull them *back* into the stored thread ID of
> +  * the parent.  With ghost messages, we just rewrite the
> +  * stored thread IDs during merging, so this workaround isn't
> +  * necessary. */
> + status = _notmuch_database_link_message_to_children (notmuch, message,
> +  _id);
> + if (status)
> + goto DONE;
> +}

Ok so this basically answers my earlier comment. It might be worth
updating the big comment at the start of the function to match the new
code though.

Best wishes

Mark

>  
>  /* If not part of any existing thread, generate a new thread ID. */
>  if (thread_id == NULL) {
> -- 
> 2.1.0
>
> ___
> notmuch mailing list
> notmuch at notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch


[PATCH v2 08/12] lib: Implement ghost-based thread linking

2014-10-22 Thread Mark Walters
On Tue, 07 Oct 2014, Austin Clements  wrote:
> From: Austin Clements 
>
> This updates the thread linking code to use ghost messages instead of
> user metadata to link messages into threads.
>
> In contrast with the old approach, this is actually correct.
> Previously, thread merging updated only the thread IDs of message
> documents, not thread IDs stored in user metadata.  As originally
> diagnosed by Mark Walters [1] and as demonstrated by the broken
> T260-thread-order test, this can cause notmuch to fail to link
> messages even though they're in the same thread.  In principle the old
> approach could have been fixed by updating the user metadata thread
> IDs as well, but these are not indexed and hence this would have
> required a full scan of all stored thread IDs.  Ghost messages solve
> this problem naturally by reusing the exact same thread ID and message
> ID representation and indexing as regular messages.
>
> Furthermore, thanks to this greater symmetry, ghost messages are also
> algorithmically simpler.  We continue to support the old user metadata
> format, so this patch can't delete any code, but when we do remove
> support for the old format, several functions can simply be deleted.
>
> [1] id:8738h7kv2q.fsf at qmul.ac.uk
> ---
>  lib/database.cc | 86 
> +
>  1 file changed, 75 insertions(+), 11 deletions(-)
>
> diff --git a/lib/database.cc b/lib/database.cc
> index c641bcd..fdcc526 100644
> --- a/lib/database.cc
> +++ b/lib/database.cc
> @@ -1752,6 +1752,12 @@ _get_metadata_thread_id_key (void *ctx, const char 
> *message_id)
>   message_id);
>  }
>  
> +static notmuch_status_t
> +_resolve_message_id_to_thread_id_old (notmuch_database_t *notmuch,
> +   void *ctx,
> +   const char *message_id,
> +   const char **thread_id_ret);
> +
>  /* Find the thread ID to which the message with 'message_id' belongs.
>   *
>   * Note: 'thread_id_ret' must not be NULL!
> @@ -1760,9 +1766,9 @@ _get_metadata_thread_id_key (void *ctx, const char 
> *message_id)
>   *
>   * Note: If there is no message in the database with the given
>   * 'message_id' then a new thread_id will be allocated for this
> - * message and stored in the database metadata, (where this same
> + * message ID and stored in the database metadata so that the
>   * thread ID can be looked up if the message is added to the database
> - * later).
> + * later.
>   */
>  static notmuch_status_t
>  _resolve_message_id_to_thread_id (notmuch_database_t *notmuch,
> @@ -1770,6 +1776,49 @@ _resolve_message_id_to_thread_id (notmuch_database_t 
> *notmuch,
> const char *message_id,
> const char **thread_id_ret)
>  {
> +notmuch_private_status_t status;
> +notmuch_message_t *message;
> +
> +if (! (notmuch->features & NOTMUCH_FEATURE_GHOSTS))
> + return _resolve_message_id_to_thread_id_old (notmuch, ctx, message_id,
> +  thread_id_ret);
> +
> +/* Look for this message (regular or ghost) */
> +message = _notmuch_message_create_for_message_id (
> + notmuch, message_id, );
> +if (status == NOTMUCH_PRIVATE_STATUS_SUCCESS) {
> + /* Message exists */
> + *thread_id_ret = talloc_steal (
> + ctx, notmuch_message_get_thread_id (message));
> +} else if (status == NOTMUCH_PRIVATE_STATUS_NO_DOCUMENT_FOUND) {
> + /* Message did not exist.  Give it a fresh thread ID and
> +  * populate this message as a ghost message. */
> + *thread_id_ret = talloc_strdup (
> + ctx, _notmuch_database_generate_thread_id (notmuch));
> + if (! *thread_id_ret) {
> + status = NOTMUCH_PRIVATE_STATUS_OUT_OF_MEMORY;
> + } else {
> + status = _notmuch_message_initialize_ghost (message, 
> *thread_id_ret);
> + if (status == 0)
> + /* Commit the new ghost message */
> + _notmuch_message_sync (message);
> + }
> +} else {
> + /* Create failed. Fall through. */
> +}
> +
> +notmuch_message_destroy (message);
> +
> +return COERCE_STATUS (status, "Error creating ghost message");
> +}
> +
> +/* Pre-ghost messages _resolve_message_id_to_thread_id */
> +static notmuch_status_t
> +_resolve_message_id_to_thread_id_old (notmuch_database_t *notmuch,
> +   void *ctx,
> +   const char *message_id,
> +   const char **thread_id_ret)
> +{
>  notmuch_status_t status;
>  notmuch_message_t *message;
>  string thread_id_string;
> @@ -2007,7 +2056,7 @@ _consume_metadata_thread_id (void *ctx, 
> notmuch_database_t *notmuch,
>  }
>  }
>  
> -/* Given a (mostly empty) 'message' and its corresponding
> +/* Given a blank or ghost 'message' and its corresponding
>   * 

[PATCH v2 07/12] lib: Internal support for querying and creating ghost messages

2014-10-22 Thread Mark Walters

Hi 

I am slowly working my way through this series: only two trivial queries
so far.

On Tue, 07 Oct 2014, Austin Clements  wrote:
> From: Austin Clements 
>
> This updates the message abstraction to support ghost messages: it
> adds a message flag that distinguishes regular messages from ghost
> messages, and an internal function for initializing a newly created
> (blank) message as a ghost message.
> ---
>  lib/message.cc| 52 
> +--
>  lib/notmuch-private.h |  4 
>  lib/notmuch.h |  9 -
>  3 files changed, 62 insertions(+), 3 deletions(-)
>
> diff --git a/lib/message.cc b/lib/message.cc
> index 55d2ff6..a7a13cc 100644
> --- a/lib/message.cc
> +++ b/lib/message.cc
> @@ -39,6 +39,9 @@ struct visible _notmuch_message {
>  notmuch_message_file_t *message_file;
>  notmuch_message_list_t *replies;
>  unsigned long flags;
> +/* For flags that are initialized on-demand, lazy_flags indicates
> + * if each flag has been initialized. */
> +unsigned long lazy_flags;

I wonder if valid_flags might be better here as, as far as I can see,
the reason for these is so we can invalidate a flag more than an
optimisation (which is what I thought the lazy implied).

>  
>  Xapian::Document doc;
>  Xapian::termcount termpos;
> @@ -99,6 +102,7 @@ _notmuch_message_create_for_document (const void 
> *talloc_owner,
>  
>  message->frozen = 0;
>  message->flags = 0;
> +message->lazy_flags = 0;
>  
>  /* Each of these will be lazily created as needed. */
>  message->message_id = NULL;
> @@ -192,7 +196,7 @@ _notmuch_message_create (const void *talloc_owner,
>   *
>   * There is already a document with message ID 'message_id' in the
>   * database. The returned message can be used to query/modify the
> - * document.
> + * document. The message may be a ghost message.
>   *
>   *   NOTMUCH_PRIVATE_STATUS_NO_DOCUMENT_FOUND:
>   *
> @@ -305,6 +309,7 @@ _notmuch_message_ensure_metadata (notmuch_message_t 
> *message)
>  const char *thread_prefix = _find_prefix ("thread"),
>   *tag_prefix = _find_prefix ("tag"),
>   *id_prefix = _find_prefix ("id"),
> + *type_prefix = _find_prefix ("type"),
>   *filename_prefix = _find_prefix ("file-direntry"),
>   *replyto_prefix = _find_prefix ("replyto");
>  
> @@ -337,10 +342,25 @@ _notmuch_message_ensure_metadata (notmuch_message_t 
> *message)
>   message->message_id =
>   _notmuch_message_get_term (message, i, end, id_prefix);
>  
> +/* Get document type */
> +assert (strcmp (id_prefix, type_prefix) < 0);
> +if (! NOTMUCH_TEST_BIT (message->lazy_flags, 
> NOTMUCH_MESSAGE_FLAG_GHOST)) {
> + i.skip_to (type_prefix);
> + /* "T" is the prefix "type" fields.  See
> +  * BOOLEAN_PREFIX_INTERNAL. */
> + if (*i == "Tmail")
> + NOTMUCH_CLEAR_BIT (>flags, NOTMUCH_MESSAGE_FLAG_GHOST);
> + else if (*i == "Tghost")
> + NOTMUCH_SET_BIT (>flags, NOTMUCH_MESSAGE_FLAG_GHOST);
> + else
> + INTERNAL_ERROR ("Message without type term");
> + NOTMUCH_SET_BIT (>lazy_flags, NOTMUCH_MESSAGE_FLAG_GHOST);
> +}
> +
>  /* Get filename list.  Here we get only the terms.  We lazily
>   * expand them to full file names when needed in
>   * _notmuch_message_ensure_filename_list. */
> -assert (strcmp (id_prefix, filename_prefix) < 0);
> +assert (strcmp (type_prefix, filename_prefix) < 0);
>  if (!message->filename_term_list && !message->filename_list)
>   message->filename_term_list =
>   _notmuch_database_get_terms_with_prefix (message, i, end,
> @@ -371,6 +391,11 @@ _notmuch_message_invalidate_metadata (notmuch_message_t 
> *message,
>   message->tag_list = NULL;
>  }
>  
> +if (strcmp ("type", prefix_name) == 0) {
> + NOTMUCH_CLEAR_BIT (>flags, NOTMUCH_MESSAGE_FLAG_GHOST);
> + NOTMUCH_CLEAR_BIT (>lazy_flags, NOTMUCH_MESSAGE_FLAG_GHOST);
> +}
> +
>  if (strcmp ("file-direntry", prefix_name) == 0) {
>   talloc_free (message->filename_term_list);
>   talloc_free (message->filename_list);
> @@ -869,6 +894,10 @@ notmuch_bool_t
>  notmuch_message_get_flag (notmuch_message_t *message,
> notmuch_message_flag_t flag)
>  {
> +if (flag == NOTMUCH_MESSAGE_FLAG_GHOST &&
> + ! NOTMUCH_TEST_BIT (message->lazy_flags, flag))
> + _notmuch_message_ensure_metadata (message);
> +
>  return NOTMUCH_TEST_BIT (message->flags, flag);
>  }
>  
> @@ -880,6 +909,7 @@ notmuch_message_set_flag (notmuch_message_t *message,
>   NOTMUCH_SET_BIT (>flags, flag);
>  else
>   NOTMUCH_CLEAR_BIT (>flags, flag);
> +NOTMUCH_SET_BIT (>lazy_flags, flag);
>  }
>  
>  time_t
> @@ -989,6 +1019,24 @@ _notmuch_message_delete (notmuch_message_t *message)
>  return NOTMUCH_STATUS_SUCCESS;
>  }
>  
> +/* Transform a blank message into a ghost message.  The caller must
> + * _notmuch_message_sync the 

[PATCH v1] emacs: notmuch-jump.el should provide.

2014-10-22 Thread David Edmondson
To ease loading, notmuch-jump.el should provide 'notmuch-jump.
---
 emacs/notmuch-jump.el | 4 
 1 file changed, 4 insertions(+)

diff --git a/emacs/notmuch-jump.el b/emacs/notmuch-jump.el
index 05ec57e..20e24b2 100644
--- a/emacs/notmuch-jump.el
+++ b/emacs/notmuch-jump.el
@@ -170,3 +170,7 @@ buffer.
   (setq notmuch-jump--action ',(third action))
   (exit-minibuffer
 map))
+
+;;
+
+(provide 'notmuch-jump)
-- 
2.1.1

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


Re: Looking for the perfect mail client

2014-10-22 Thread Sepp Tannhuber
Gaute Hope e...@gaute.vetsj.com schrieb am 13:19 Dienstag, 21.Oktober 2014:


 I am working on something called 'astroid' which is a GTK+ and WebKit
 based email client for notmuch.

That's really interesting. From your description, it's exactly what
I would like to have. At the moment, compilation fails:

compiling == src/astroid.cc
In file included from src/main_window.hh:7:0,
 from src/astroid.cc:22:
src/command_bar.hh:23:44: error: expected class-name before '{' token
   class CommandBar : public Gtk::SearchBar {
^
src/command_bar.hh:38:12: error: 'SearchEntry' in namespace 'Gtk' does not name 
a type
   Gtk::SearchEntry entry;
^
In file included from src/main_window.hh:8:0,
 from src/astroid.cc:22:
src/modes/mode.hh:35:12: error: 'Revealer' in namespace 'Gtk' does not name a 
type
   Gtk::Revealer * rev_yes_no;
^
scons: *** [src/astroid.o] Error 1
scons: building terminated because of errors.
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: Looking for the perfect mail client

2014-10-22 Thread Gaute Hope

Excerpts from Sepp Tannhuber's message of October 22, 2014 8:46:

Gaute Hope e...@gaute.vetsj.com schrieb am 13:19 Dienstag, 21.Oktober 2014:



I am working on something called 'astroid' which is a GTK+ and WebKit
based email client for notmuch.


That's really interesting. From your description, it's exactly what
I would like to have. At the moment, compilation fails:

compiling == src/astroid.cc
In file included from src/main_window.hh:7:0,
 from src/astroid.cc:22:
src/command_bar.hh:23:44: error: expected class-name before '{' token
   class CommandBar : public Gtk::SearchBar {
^
src/command_bar.hh:38:12: error: 'SearchEntry' in namespace 'Gtk' does not name 
a type
   Gtk::SearchEntry entry;
^
In file included from src/main_window.hh:8:0,
 from src/astroid.cc:22:
src/modes/mode.hh:35:12: error: 'Revealer' in namespace 'Gtk' does not name a 
type
   Gtk::Revealer * rev_yes_no;
^
scons: *** [src/astroid.o] Error 1
scons: building terminated because of errors.



Thanks for trying!

You need a newer version of GTK+, I think at least version 3.10 (I am
using 3.12 on Arch Linux) [0].

Cheers, Gaute

[0] https://help.gnome.org/misc/release-notes/3.10/developers.html.en

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


Re: [PATCH v3 1/4] cli: Refactor option passing in the search command

2014-10-22 Thread Mark Walters
On Sun, 12 Oct 2014, Michal Sojka sojk...@fel.cvut.cz wrote:
 Many functions that implement the search command need to access command
 line options. Instead of passing each option in a separate variable, put
 them in a structure and pass only this structure.

 This will become handy in the following patches.

Hi

This basically looks good to me. I have some style queries/preferences
mentioned below but am happy to be overruled by you or others.

 ---
  notmuch-search.c | 122 
 ---
  1 file changed, 62 insertions(+), 60 deletions(-)

 diff --git a/notmuch-search.c b/notmuch-search.c
 index bc9be45..5ac2a26 100644
 --- a/notmuch-search.c
 +++ b/notmuch-search.c
 @@ -30,6 +30,16 @@ typedef enum {
  OUTPUT_TAGS
  } output_t;
  
 +typedef struct {
 +sprinter_t *format;
 +notmuch_query_t *query;
 +notmuch_sort_t sort;
 +output_t output;
 +int offset;
 +int limit;
 +int dupe;
 +} search_options_t;
 +

I don't think of format as being a search option, whereas I do think
of all the others as search options. So I would prefer to omit format
from search_options_t and pass it explicitly.

  /* Return two stable query strings that identify exactly the matched
   * and unmatched messages currently in thread.  If there are no
   * matched or unmatched messages, the returned buffers will be
 @@ -70,46 +80,42 @@ get_thread_query (notmuch_thread_t *thread,
  }
  
  static int
 -do_search_threads (sprinter_t *format,
 -notmuch_query_t *query,
 -notmuch_sort_t sort,
 -output_t output,
 -int offset,
 -int limit)
 +do_search_threads (search_options_t *o)

Personally, I prefer longer variable names (and names which aren't 'o'):
even just opt would be a definite improvement in my opinion.

  {
  notmuch_thread_t *thread;
  notmuch_threads_t *threads;
  notmuch_tags_t *tags;
 +sprinter_t *format = o-format;
  time_t date;
  int i;
  
 -if (offset  0) {
 - offset += notmuch_query_count_threads (query);
 - if (offset  0)
 - offset = 0;
 +if (o-offset  0) {
 + o-offset += notmuch_query_count_threads (o-query);
 + if (o-offset  0)
 + o-offset = 0;
  }
  
 -threads = notmuch_query_search_threads (query);
 +threads = notmuch_query_search_threads (o-query);
  if (threads == NULL)
   return 1;
  
  format-begin_list (format);
  
  for (i = 0;
 -  notmuch_threads_valid (threads)  (limit  0 || i  offset + limit);
 +  notmuch_threads_valid (threads)  (o-limit  0 || i  o-offset + 
 o-limit);
notmuch_threads_move_to_next (threads), i++)
  {
   thread = notmuch_threads_get (threads);
  
 - if (i  offset) {
 + if (i  o-offset) {
   notmuch_thread_destroy (thread);
   continue;
   }
  
 - if (output == OUTPUT_THREADS) {
 + if (o-output == OUTPUT_THREADS) {
   format-set_prefix (format, thread);
   format-string (format,
 - notmuch_thread_get_thread_id (thread));
 +notmuch_thread_get_thread_id (thread));
   format-separator (format);
   } else { /* output == OUTPUT_SUMMARY */
   void *ctx_quote = talloc_new (thread);
 @@ -123,7 +129,7 @@ do_search_threads (sprinter_t *format,
  
   format-begin_map (format);
  
 - if (sort == NOTMUCH_SORT_OLDEST_FIRST)
 + if (o-sort == NOTMUCH_SORT_OLDEST_FIRST)
   date = notmuch_thread_get_oldest_date (thread);
   else
   date = notmuch_thread_get_newest_date (thread);
 @@ -215,40 +221,36 @@ do_search_threads (sprinter_t *format,
  }
  
  static int
 -do_search_messages (sprinter_t *format,
 - notmuch_query_t *query,
 - output_t output,
 - int offset,
 - int limit,
 - int dupe)
 +do_search_messages (search_options_t *o)
  {
  notmuch_message_t *message;
  notmuch_messages_t *messages;
  notmuch_filenames_t *filenames;
 +sprinter_t *format = o-format;
  int i;
  
 -if (offset  0) {
 - offset += notmuch_query_count_messages (query);
 - if (offset  0)
 - offset = 0;
 +if (o-offset  0) {
 + o-offset += notmuch_query_count_messages (o-query);
 + if (o-offset  0)
 + o-offset = 0;
  }
  
 -messages = notmuch_query_search_messages (query);
 +messages = notmuch_query_search_messages (o-query);
  if (messages == NULL)
   return 1;
  
  format-begin_list (format);
  
  for (i = 0;
 -  notmuch_messages_valid (messages)  (limit  0 || i  offset + limit);
 +  notmuch_messages_valid (messages)  (o-limit  0 || i  o-offset + 
 o-limit);
notmuch_messages_move_to_next (messages), i++)
  {
 - if (i  offset)
 + if (i  o-offset)
   continue;
  
   message = notmuch_messages_get 

Re: [PATCH v3 3/4] cli: Extend the search command for --output={sender, recipients}

2014-10-22 Thread Mark Walters
On Sun, 12 Oct 2014, Michal Sojka sojk...@fel.cvut.cz wrote:
 The new outputs allow printing senders, recipients or both of matching
 messages. The --output option is converted from keyword argument to
 flags argument, which means that the user can use --output=sender and
 --output=recipients simultaneously, to print both. Other combinations
 produce an error.

 This code based on a patch from Jani Nikula.
 ---
  completion/notmuch-completion.bash |   2 +-
  completion/notmuch-completion.zsh  |   3 +-
  doc/man1/notmuch-search.rst|  22 +++-
  notmuch-search.c   | 110 
 ++---
  test/T090-search-output.sh |  64 +
  5 files changed, 189 insertions(+), 12 deletions(-)

 diff --git a/completion/notmuch-completion.bash 
 b/completion/notmuch-completion.bash
 index 0571dc9..cfbd389 100644
 --- a/completion/notmuch-completion.bash
 +++ b/completion/notmuch-completion.bash
 @@ -294,7 +294,7 @@ _notmuch_search()
   return
   ;;
   --output)
 - COMPREPLY=( $( compgen -W summary threads messages files tags -- 
 ${cur} ) )
 + COMPREPLY=( $( compgen -W summary threads messages files tags 
 sender recipients -- ${cur} ) )
   return
   ;;
   --sort)
 diff --git a/completion/notmuch-completion.zsh 
 b/completion/notmuch-completion.zsh
 index 67a9aba..3e52a00 100644
 --- a/completion/notmuch-completion.zsh
 +++ b/completion/notmuch-completion.zsh
 @@ -52,7 +52,8 @@ _notmuch_search()
_arguments -s : \
  '--max-threads=[display only the first x threads from the search 
 results]:number of threads to show: ' \
  '--first=[omit the first x threads from the search results]:number of 
 threads to omit: ' \
 -'--sort=[sort results]:sorting:((newest-first\:reverse chronological 
 order oldest-first\:chronological order))'
 +'--sort=[sort results]:sorting:((newest-first\:reverse chronological 
 order oldest-first\:chronological order))' \
 +'--output=[select what to output]:output:((summary threads messages 
 files tags sender recipients))'
  }
  
  _notmuch()
 diff --git a/doc/man1/notmuch-search.rst b/doc/man1/notmuch-search.rst
 index 90160f2..c9d38b1 100644
 --- a/doc/man1/notmuch-search.rst
 +++ b/doc/man1/notmuch-search.rst
 @@ -35,7 +35,7 @@ Supported options for **search** include
  intended for programs that invoke **notmuch(1)** internally. If
  omitted, the latest supported version will be used.
  
 -``--output=(summary|threads|messages|files|tags)``
 +``--output=(summary|threads|messages|files|tags|sender|recipients)``
  
  **summary**
  Output a summary of each thread with any message matching
 @@ -78,6 +78,26 @@ Supported options for **search** include
  by null characters (--format=text0), as a JSON array
  (--format=json), or as an S-Expression list (--format=sexp).
  
 + **sender**
 +Output all addresses from the *From* header that appear on
 +any message matching the search terms, either one per line
 +(--format=text), separated by null characters
 +(--format=text0), as a JSON array (--format=json), or as
 +an S-Expression list (--format=sexp).
 +
 + Note: Searching for **sender** should be much faster than
 + searching for **recipients**, because sender addresses are
 + cached directly in the database whereas other addresses
 + need to be fetched from message files.
 +
 + **recipients**
 +Like **sender** but for addresses from *To*, *Cc* and
 + *Bcc* headers.
 +
 + This option can be given multiple times to combine different
 + outputs. Curently, this is only supported for **sender** and
 + **recipients** outputs.
 +
  ``--sort=``\ (**newest-first**\ \|\ **oldest-first**)
  This option can be used to present results in either
  chronological order (**oldest-first**) or reverse chronological
 diff --git a/notmuch-search.c b/notmuch-search.c
 index 5ac2a26..74588f8 100644
 --- a/notmuch-search.c
 +++ b/notmuch-search.c
 @@ -23,11 +23,14 @@
  #include string-util.h
  
  typedef enum {
 -OUTPUT_SUMMARY,
 -OUTPUT_THREADS,
 -OUTPUT_MESSAGES,
 -OUTPUT_FILES,
 -OUTPUT_TAGS
 +OUTPUT_SUMMARY   = 1  0,
 +OUTPUT_THREADS   = 1  1,
 +OUTPUT_MESSAGES  = 1  2,
 +OUTPUT_FILES = 1  3,
 +OUTPUT_TAGS  = 1  4,
 +OUTPUT_SENDER= 1  5,
 +OUTPUT_RECIPIENTS= 1  6,
 +OUTPUT_ADDRESSES = OUTPUT_SENDER | OUTPUT_RECIPIENTS,

I think I would drop the OUTPUT_ADDRESSES enum as the parser no longer
uses it (and replace the one use by OUTPUT_SENDER | OUTPUT_RECIPIENTS below).

  } output_t;
  
  typedef struct {
 @@ -220,6 +223,67 @@ do_search_threads (search_options_t *o)
  return 0;
  }
  
 +static void
 +print_address_list (const search_options_t *o, InternetAddressList *list)
 +{
 

Re: Looking for the perfect mail client

2014-10-22 Thread Sepp Tannhuber
Hi Gaute


Gaute Hope e...@gaute.vetsj.com schrieb am 8:57 Mittwoch, 22.Oktober 2014:
 You need a newer version of GTK+, I think at least version 3.10 (I am
 using 3.12 on Arch Linux) [0].




Thanks for your support. Now the linker fails:

linking Program == astroid
//lib/i386-linux-gnu/libgcrypt.so.20: undefined reference to 
`gpg_strsource@GPG_ERROR_1.0'
//lib/i386-linux-gnu/libgcrypt.so.20: undefined reference to 
`gpg_err_code_from_syserror@GPG_ERROR_1.0'
//lib/i386-linux-gnu/libgcrypt.so.20: undefined reference to 
`gpg_err_set_errno@GPG_ERROR_1.0'
//lib/i386-linux-gnu/libgcrypt.so.20: undefined reference to 
`gpg_strerror@GPG_ERROR_1.0'
//lib/i386-linux-gnu/libgcrypt.so.20: undefined reference to 
`gpg_err_code_from_errno@GPG_ERROR_1.0'
collect2: error: ld returned 1 exit status
scons: *** [astroid] Error 1
scons: building terminated because of errors.

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


Re: Looking for the perfect mail client

2014-10-22 Thread Gaute Hope

Excerpts from Sepp Tannhuber's message of October 22, 2014 14:23:

Hi Gaute


Gaute Hope e...@gaute.vetsj.com schrieb am 8:57 Mittwoch, 22.Oktober 2014:

You need a newer version of GTK+, I think at least version 3.10 (I am
using 3.12 on Arch Linux) [0].





Thanks for your support. Now the linker fails:

linking Program == astroid
//lib/i386-linux-gnu/libgcrypt.so.20: undefined reference to 
`gpg_strsource@GPG_ERROR_1.0'
//lib/i386-linux-gnu/libgcrypt.so.20: undefined reference to 
`gpg_err_code_from_syserror@GPG_ERROR_1.0'
//lib/i386-linux-gnu/libgcrypt.so.20: undefined reference to 
`gpg_err_set_errno@GPG_ERROR_1.0'
//lib/i386-linux-gnu/libgcrypt.so.20: undefined reference to 
`gpg_strerror@GPG_ERROR_1.0'
//lib/i386-linux-gnu/libgcrypt.so.20: undefined reference to 
`gpg_err_code_from_errno@GPG_ERROR_1.0'
collect2: error: ld returned 1 exit status
scons: *** [astroid] Error 1
scons: building terminated because of errors.


This seems to be an error in one of the libraries used by astroid, I am
guessing gmime - ... - libgcrypt  libgpg-error. Do you have
libgpg-error installed? What distro do you run? There seems to be a
package dependency inconsistency somewhere.

What is the output of:

 $ scons --verbose

Cheers, Gaute

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


Re: Looking for the perfect mail client

2014-10-22 Thread Sepp Tannhuber
Gaute Hope e...@gaute.vetsj.com schrieb am 15:49 Mittwoch, 22.Oktober 2014:

 Do you have libgpg-error installed?
No, this was exactly the point. Now, I've compiled it and linked successfully.

 What distro do you run?
Debian stable with many backports from unstable.




The next problem is that astroid doesn't start:

(astroid:12459): Gtk-WARNING **: Could not find the icon 'mail-send-symbolic'. 
The 'hicolor' theme
was not found either, perhaps you need to install it.
You can get a copy from:
 http://icon-theme.freedesktop.org/releases
terminate called after throwing an instance of 'Gtk::IconThemeError'

I've tried hicolor-icon-theme from debian stable and unstable as well as from
the sources from icon-theme.freedesktop.org. The icon »mail-send-symbolic«
doesn't exist there. However, I've found it on my PC at other locations:

/usr/share/icons/Adwaita/scalable/actions/mail-send-symbolic.svg
/usr/share/icons/mate/scalable/actions/mail-send-symbolic.svg
/usr/share/icons/gnome/scalable/actions/mail-send-symbolic.svg

So my next question is, why doesn't astroid find it?
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: Looking for the perfect mail client

2014-10-22 Thread Gaute Hope

Excerpts from Sepp Tannhuber's message of October 22, 2014 16:48:

Gaute Hope e...@gaute.vetsj.com schrieb am 15:49 Mittwoch, 22.Oktober 2014:
The next problem is that astroid doesn't start:

(astroid:12459): Gtk-WARNING **: Could not find the icon 'mail-send-symbolic'. 
The 'hicolor' theme
was not found either, perhaps you need to install it.
You can get a copy from:
 http://icon-theme.freedesktop.org/releases
terminate called after throwing an instance of 'Gtk::IconThemeError'

I've tried hicolor-icon-theme from debian stable and unstable as well as from
the sources from icon-theme.freedesktop.org. The icon »mail-send-symbolic«
doesn't exist there. However, I've found it on my PC at other locations:

/usr/share/icons/Adwaita/scalable/actions/mail-send-symbolic.svg
/usr/share/icons/mate/scalable/actions/mail-send-symbolic.svg
/usr/share/icons/gnome/scalable/actions/mail-send-symbolic.svg

So my next question is, why doesn't astroid find it?


Maybe it is an issue with the icon cache? Reboot?

Cheers, Gaute

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


Re: Looking for the perfect mail client

2014-10-22 Thread Gaute Hope

Excerpts from Sepp Tannhuber's message of October 22, 2014 16:48:

Gaute Hope e...@gaute.vetsj.com schrieb am 15:49 Mittwoch, 22.Oktober 2014:


Do you have libgpg-error installed?

No, this was exactly the point. Now, I've compiled it and linked successfully.


What distro do you run?

Debian stable with many backports from unstable.




The next problem is that astroid doesn't start:

(astroid:12459): Gtk-WARNING **: Could not find the icon 'mail-send-symbolic'. 
The 'hicolor' theme
was not found either, perhaps you need to install it.
You can get a copy from:
 http://icon-theme.freedesktop.org/releases
terminate called after throwing an instance of 'Gtk::IconThemeError'

I've tried hicolor-icon-theme from debian stable and unstable as well as from
the sources from icon-theme.freedesktop.org. The icon »mail-send-symbolic«
doesn't exist there. However, I've found it on my PC at other locations:

/usr/share/icons/Adwaita/scalable/actions/mail-send-symbolic.svg
/usr/share/icons/mate/scalable/actions/mail-send-symbolic.svg
/usr/share/icons/gnome/scalable/actions/mail-send-symbolic.svg

So my next question is, why doesn't astroid find it?



I have had some problems with Gtk 3.14 (3.12 works great) in how rows
are rendered, so I am anxious to see how that works on debian.

- gaute

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


Re: Looking for the perfect mail client

2014-10-22 Thread Sepp Tannhuber
I'm unable to solve the icon problem. This gtk message is stupid. I couldn't
find out what's going wrong.
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: Looking for the perfect mail client

2014-10-22 Thread Peter Feigl
 I'm unable to solve the icon problem. This gtk message is stupid. I couldn't
 find out what's going wrong.

Similar warnings happened to me often in different applications. This is
almost certainly just a warning and not the real problem. Try strace or
gdb to find out what really crashes notmuch.
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch