Feature proposal: OUTPUT_AUTHOR format

Austin Clements amdragon at MIT.EDU
Tue Aug 27 06:47:24 PDT 2013


Quoth Johannes Kulick on Aug 27 at  1:50 pm:
> Hi David,
>       
> Quoting David Bremner (2013-08-27 02:27:00)
> > I'm not sure I understand your goal completely here, but the obvious
> > thing UI wise would be
> >
> >   notmuch search --output=authors --format=(json|text|sexp)  $search_terms
> >
> > Perhaps you're already aware of this, but alot doesn't use the CLI, so
> > that wouldn't be directly helpful to having a new view in alot.
> 
> Do you mean, that this output=authors option is already available? Then I'm not
> aware. If it is not available it's exactly what I meant. So it would look

No, --output=authors isn't currently available.

> something like:
> 
> $ notmuch search --output=authors from:Johannes
> Johannes Kulick (1234 msgs)
> Johannes Doe (123 msgs)
> Johannes Mueller (12 msgs)
> ...
> 
> I'd sketch the way to implement it like this:
> 
> - add notmuch_authors_t and notmuch_author_t structs
> - add a notmuch_database_get_all_authors (notmuch_database_t *db)
> - add the functions around that to actually get an option for the ui
> - add bindings for the other languages

What's the advantage to adding this to the library?  Why not just
notmuch_query_search_messages, iterate over the messages and use
notmuch_message_get_header(msg, "from") to accumulate the author
information, and then output that?  Unless I'm overlooking something
(which is possible), there are no algorithmic advantages to doing this
in the library.

As David pointed out, for alot you could do this right away, since it
uses the library directly.  For notmuch-emacs you would have to extend
the CLI along the lines you're imagining.

> (- implement the view in the clients)
> 
> Cheers,
> Johannes
> 


More information about the notmuch mailing list