notmuch clon
Find a file
craven@gmx.net 41becc0c9d Add support for structured output formatters.
This patch adds a new struct type sprinter_t, which is used for
structured formatting, e.g. JSON or S-Expressions. The structure printer
is heavily based on code from Austin Clements
(id:87d34hsdx8.fsf@awakening.csail.mit.edu).

It includes the following functions:

    /* Start a new map/dictionary structure. This should be followed by
     * a sequence of alternating calls to map_key and one of the
     * value-printing functions until the map is ended by end.
     */
    void (*begin_map) (struct sprinter *);

    /* Start a new list/array structure.
     */
    void (*begin_list) (struct sprinter *);

    /* End the last opened list or map structure.
     */
    void (*end) (struct sprinter *);

    /* Print one string/integer/boolean/null element (possibly inside a
     * list or map, followed or preceded by separators).
     * For string, the char * must be UTF-8 encoded.
     */
    void (*string) (struct sprinter *, const char *);
    void (*integer) (struct sprinter *, int);
    void (*boolean) (struct sprinter *, notmuch_bool_t);
    void (*null) (struct sprinter *);

    /* Print the key of a map's key/value pair. The char * must be UTF-8
     * encoded.
     */
    void (*map_key) (struct sprinter *, const char *);

    /* Insert a separator (usually extra whitespace) for improved
     * readability without affecting the abstract syntax of the
     * structure being printed.
     * For JSON, this could simply be a line break.
     */
    void (*separator) (struct sprinter *);

    /* Set the current string prefix. This only affects the text
     * printer, which will print this string, followed by a colon,
     * before any string. For other printers, this does nothing.
     */
    void (*set_prefix) (struct sprinter *, const char *);

To support the plain text format properly, the following additional
function must also be implemented:

    /* Set the current string prefix. This only affects the text
     * printer, which will print this string, followed by a colon,
     * before any string. For other printers, this does nothing.
     */
    void (*set_prefix) (struct sprinter *, const char *);

The structure also contains a flag that should be set to FALSE in all
custom printers and to TRUE in the plain text formatter.

    /* True if this is the special-cased plain text printer.
     */
    notmuch_bool_t is_text_printer;

The printer can (and should) use internal state to insert delimiters
and syntax at the correct places.

Example:

format->begin_map(format);
format->map_key(format, "foo");
format->begin_list(format);
format->integer(format, 1);
format->integer(format, 2);
format->integer(format, 3);
format->end(format);
format->map_key(format, "bar");
format->begin_map(format);
format->map_key(format, "baaz");
format->string(format, "hello world");
format->end(format);
format->end(format);

would output JSON as follows:

{"foo": [1, 2, 3], "bar": { "baaz": "hello world"}}
2012-07-24 09:26:49 -03:00
bindings ruby: extern linkage portability improvement 2012-06-29 22:24:17 -03:00
compat Silence buildbot warnings about unused results 2012-01-21 08:49:50 -04:00
completion fix sum moar typos [build scripts, Makefiles] 2011-06-23 15:44:59 -07:00
contrib contib/nmbug/nmbug-status: leftover whitespaces, indentation & quoting 2012-07-12 16:02:09 -06:00
debian debian: finalize changelog 2012-07-12 17:49:09 -06:00
devel Add missing "tags" field to search schema 2012-07-09 15:45:37 -06:00
emacs emacs: Fix navigation of multi-line search result formats 2012-07-24 09:23:53 -03:00
lib lib: Treat messages in new/ as maildir messages with no flags set 2012-06-10 20:14:56 -03:00
man manpages: consistent "format" for NAME section 2012-07-09 15:45:13 -06:00
packaging fix sum moar typos [text files] 2011-06-23 15:40:50 -07:00
test emacs: Switch from text to JSON format for search results 2012-07-12 17:39:36 -06:00
util Fix dependency generation for compat, test, and util 2012-01-19 09:19:12 -04:00
vim vim: simplify build 2012-04-21 05:19:30 +03:00
.dir-locals.el .dir-locals.el: changed one-char comment prefix '; ' to two; '; ; ' 2012-01-22 08:41:37 -04:00
.gitignore fix .gitignore for gzipped man pages 2012-01-17 14:52:31 -04:00
AUTHORS Drop date.c file, (use identical function from GMime instead). 2009-11-02 14:36:33 -08:00
command-line-arguments.c cli: command line parsing: allow default for keyword options 2012-06-29 22:31:40 -03:00
command-line-arguments.h command-line-arguments.[ch]: make arrays of keyword descriptors const 2011-12-13 00:00:44 -04:00
configure config: add quoting to fix IFS bug 2012-06-03 13:26:44 -03:00
COPYING Add copy of GNU General Public License (version 3). 2009-10-21 16:25:08 -07:00
COPYING-GPL-3 Add copy of GNU General Public License (version 3). 2009-10-21 16:25:08 -07:00
crypto.c cli: new crypto structure to store crypto contexts and parameters, and functions to support it 2012-06-10 20:05:02 -03:00
debugger.c notmuch-new: Only install SIGALRM if not running under gdb 2009-11-22 05:36:36 +01:00
gmime-filter-headers.c notmuch: Fix off-by-one errors if a header is >200 characters long. 2010-06-01 16:09:29 -07:00
gmime-filter-headers.h fix sum moar typos [comments in source code] 2011-06-23 15:58:39 -07:00
gmime-filter-reply.c Filter out carriage-returns in show and reply output. 2009-11-18 23:34:43 +01:00
gmime-filter-reply.h Typsos 2009-11-18 03:21:36 -08:00
hooks.c cli: introduce the concept of user defined hooks 2011-12-11 13:57:31 -04:00
INSTALL Recommend libgmime-2.6-dev in INSTALL 2012-05-24 21:54:30 -03:00
json.c json_quote_chararray: Always return a newly talloced array 2010-04-20 08:55:31 -07:00
Makefile build-system: update for split man pages 2011-12-31 15:16:32 -04:00
Makefile.local cli: new crypto structure to store crypto contexts and parameters, and functions to support it 2012-06-10 20:05:02 -03:00
mime-node.c cli: use new notmuch_crypto_get_context in mime-node.c 2012-06-10 20:09:42 -03:00
NEWS News for search cleanups 2012-07-24 09:24:29 -03:00
notmuch-client.h cli: Let json output "null" messages for non --entire-thread 2012-06-29 22:31:53 -03:00
notmuch-config.c config: Add 'config list' command 2012-04-28 10:45:31 -03:00
notmuch-count.c lib/cli: Make notmuch_database_open return a status code 2012-05-05 10:11:57 -03:00
notmuch-dump.c lib/cli: Make notmuch_database_open return a status code 2012-05-05 10:11:57 -03:00
notmuch-new.c new: Unify add_files and add_files_recursive 2012-05-24 21:53:38 -03:00
notmuch-reply.c cli: use new notmuch_crypto_get_context in mime-node.c 2012-06-10 20:09:42 -03:00
notmuch-restore.c lib/cli: Make notmuch_database_open return a status code 2012-05-05 10:11:57 -03:00
notmuch-search.c lib/cli: Make notmuch_database_open return a status code 2012-05-05 10:11:57 -03:00
notmuch-setup.c Make exclusion visible again 2012-03-03 11:56:47 -04:00
notmuch-show.c cli: notmuch-show.c fix whitespace error 2012-06-29 22:33:50 -03:00
notmuch-tag.c lib/cli: Make notmuch_database_open return a status code 2012-05-05 10:11:57 -03:00
notmuch-time.c Add some const correctness to talloc 'ctx' parameter. 2009-11-17 19:10:37 -08:00
notmuch.c notmuch: replace built-in help with exec of man 2011-12-31 15:16:32 -04:00
notmuch.desktop notmuch.desktop: Clarify that this is the emacs interface to notmuch. 2010-01-24 07:30:08 +13:00
query-string.c notmuch: Break notmuch.c up into several smaller files. 2009-11-10 12:03:05 -08:00
README INSTALL/README: Clean up the description of how to run the emacs interface. 2010-06-01 10:51:42 -07:00
sprinter.h Add support for structured output formatters. 2012-07-24 09:26:49 -03:00
version version: update to 0.13.2 2012-06-02 18:10:55 -03:00

Notmuch - thread-based email index, search and tagging.

Notmuch is a system for indexing, searching, reading, and tagging
large collections of email messages in maildir or mh format. It uses
the Xapian library to provide fast, full-text search with a convenient
search syntax.

Notmuch is free software, released under the GNU General Public
License version 3 (or later).

Building notmuch
----------------
See the INSTALL file for notes on compiling and installing notmuch.

Running notmuch
---------------
After installing notmuch, start by running "notmuch setup" which will
interactively prompt for configuration information such as your name,
email address, and the directory which contains your mail archive to
be indexed. You can change any answers later by running "notmuch
setup" again or by editing the .notmuch-config file in your home
directory.

With notmuch configured you should next run "notmuch new" which will
index all of your existing mail. This can take a long time, (several
hours) if you have a lot of email, (hundreds of thousands of
files). When new mail is delivered to your mail archive in the future,
you will want to run "notmuch new" again. These runs will be much
faster as they will only index new messages.

Finally, you can prove to yourself that things are working by running
some command-line searches such as "notmuch search
from:someone@example.com" or "notmuch search subject:topic". See
"notmuch help search-terms" for more details on the available search
syntax.

The command-line search output is not expected to be particularly
friendly for day-to-day usage. Instead, it is expected that you will
use an email interface that builds on the notmuch command-line tool or
the libnotmuch library.

Notmuch installs a full-featured email interface for use within
emacs. To use this, first add the following line to your .emacs file:

	(require 'notmuch)

Then, either run "emacs -f notmuch" or execute the command "M-x
notmuch" from within a running emacs.

If you're interested in a non-emacs-based interface to notmuch, then
please join the notmuch community. Various other interfaces are
already in progress, (an interface within vim, a curses interface,
graphical interfaces based on evolution, and various web-based
interfaces). The authors of these interfaces would love further
testing or contribution. See contact information below.

Contacting users and developers
-------------------------------
The website for Notmuch is:

	http://notmuchmail.org

The mailing list address for the notmuch community is:

	notmuch@notmuchmail.org

We welcome any sort of questions, comments, kudos, or code there.

Subscription is not required, (but if you do subscribe you'll avoid
any delay due to moderation). See the website for subscription
information.

There is also an IRC channel dedicated to talk about using and
developing notmuch:

	IRC server:	irc.freenode.net
	Channel:	#notmuch