Commit graph

125 commits

Author SHA1 Message Date
Tomi Ollila
8d863c9e87 revert: Removed top level --stderr= option
While looked good on paper, its attempted use caused confusion, complexity,
and potential for information leak when passed through wrapper scripts.
For slimmer code and to lessen demand for maintenance/support the set of
commits which added top level --stderr= option is now reverted.
2013-06-24 22:52:59 -07:00
Tomi Ollila
8a0e85025a cli: add global option --stderr=FILE
With this option all writes to stderr are redirected to the specified
FILE (or to stdout on case FILE is '-'). This is immediately useful
in emacs interface as some of its exec intefaces do not provide
separation of stdout and stderr.
2013-05-29 20:00:52 -03:00
Jani Nikula
4ef2106792 cli: move config open/close to main() from subcommands
This allows specifying config file as a top level argument to notmuch,
and generally makes it possible to override config file options in
main(), without having to touch the subcommands.

If the config file does not exist, one will be created for the notmuch
main command and setup and help subcommands. Help is special in this
regard; the config is created just to avoid errors about missing
config, but it will not be saved.

This also makes notmuch config the talloc context for subcommands.
2013-03-08 07:54:41 -04:00
Jani Nikula
e76f6517de cli: config: make notmuch_config_open() "is new" parameter input only
We now have a notmuch_config_is_new() function to query whether a
config was created or not. Change the notmuch_config_open() is_new
parameter into boolean create_new to determine whether the function
should create a new config if one doesn't exist. This reduces the
complexity of the API.
2013-03-07 09:39:12 -04:00
Jani Nikula
ca3a4fc022 cli: config: keep track of whether the config is newly created
Keep track of whether the config is newly created, and add
notmuch_config_is_new() accessor function to query this.

This is to support anyone with a config handle to check this, instead
of just whoever called notmuch_config_open().
2013-03-07 09:39:05 -04:00
David Bremner
0cfb8a24dc util: add talloc-extra.[ch]
These are intended to be simple wrappers to provide slightly better
debugging information than what talloc currently provides natively.
2012-12-30 21:12:11 -04:00
Austin Clements
1c6195b9e3 cli: Framework for structured output versioning
Currently there is a period of pain whenever we make
backward-incompatible changes to the structured output format, which
discourages not only backward-incompatible improvements to the format,
but also backwards-compatible additions that may not be "perfect".  In
the end, these problems limit experimentation and innovation.

This series of patches introduces a way for CLI callers to request a
specific format version on the command line and to determine if the
CLI does not supported the requested version (and perhaps present a
useful diagnostic to the user).  Since the caller requests a format
version, it's also possible for the CLI to support multiple
incompatible versions simultaneously, unlike the alternate approach of
including version information in the output.

This patch lays the groundwork by introducing a versioning convention,
standard exit codes, and a utility function to check the requested
version and produce standardized diagnostic messages and exit
statuses.
2012-12-16 17:20:33 -04:00
Peter Feigl
1bf3720b6e Rename the -json printer functions in notmuch-reply and notmuch-show to generic -sprinter functions.
All the structured output functions in notmuch-reply and notmuch-show
are renamed to a generic name (as they do not contain any json-specific
code anyway). This patch is a preparation to actually using the new
S-Expression sprinter in notmuch-reply and notmuch-show.
2012-12-08 09:28:19 -04:00
Austin Clements
1cbaad158e show: Remove now unused fields from notmuch_show_format
The message_set_{begin,sep,end} and null_message fields are no longer
used because we now use the structure printer provided by the format.
2012-08-03 20:40:01 -03:00
Austin Clements
7018fc58b4 show: Convert format_headers_json to use sprinter
This no longer requires a talloc context (not that it really did
before since it didn't return anything), so we remove its context
argument.
2012-08-03 20:30:49 -03:00
Austin Clements
3a08341e50 show: Feed the sprinter down to part formatters
There are several levels of function calls between where we create the
sprinter and the call to the part formatter in show_message. This
feeds the sprinter through all of them and into the part formatters.
2012-08-03 20:27:25 -03:00
Austin Clements
d79b24b98d show: Associate an sprinter with each format
This associates an sprinter constructor with each show format and uses
this to construct the appropriate sprinter.  Currently nothing is done
with this sprinter, but the following patches will weave it through
the layers of notmuch show.
2012-08-03 20:21:50 -03:00
Mark Walters
0e63372efe cli: add --body=true|false option to notmuch-show.c
This option allows the caller to suppress the output of the bodies of
the messages. Currently this is only implemented for format=json.

This is used by notmuch-pick.el (although not needed) because it gives
a speed-up of at least a factor of a two (and in some cases a speed up
of more than a factor of 8); moreover it reduces the memory usage in
emacs hugely.
2012-07-24 15:29:22 -03:00
Mark Walters
4d3bfba983 cli: Let json output "null" messages for non --entire-thread
All formats except Json can output empty messages for non
entire-thread, but in Json format we output "null" to keep the other
elements (e.g. the replies to the omitted message) in the correct
place.
2012-06-29 22:31:53 -03:00
Jameson Graef Rollins
e04b18cf36 cli: use new notmuch_crypto_get_context in mime-node.c
This has the affect of lazily creating the crypto contexts only when
needed.  This removes code duplication from notmuch-show and
notmuch-reply, and should speed up these functions considerably if the
crypto flags are provided but the messages don't have any
cryptographic parts.
2012-06-10 20:09:42 -03:00
Jameson Graef Rollins
b2c8fdee53 cli: new crypto verify flag to handle verification
Use this flag rather than depend on the existence of an initialized
gpgctx, to determine whether we should verify a multipart/signed.  We
will be moving to create the ctx lazily, so we don't want to depend on
it being previously initialized if it's not needed.
2012-06-10 20:09:09 -03:00
Jameson Graef Rollins
429ebf5d20 cli: modify mime_node_open to take new crypto struct as argument
This simplifies the interface considerably.
2012-06-10 20:06:48 -03:00
Jameson Graef Rollins
c3eba1c3f8 cli: modify show and reply to use new crypto struct
notmuch_show_params_t is modified to use the new notmuch_crypto_t, and
notmuch-show and notmuch-reply are modified accordingly.
2012-06-10 20:05:12 -03:00
Jameson Graef Rollins
e3be5afbad cli: new crypto structure to store crypto contexts and parameters, and functions to support it
This new structure, notmuch_crypto_t, keeps all relevant crypto
contexts and parameters together, and will make it easier to pass the
stuff around and clean it up.  The name of the crypto context inside
this new struct will change, to reflect that it is actually a GPG
context, which is a sub type of Crypto context.  There are other types
of Crypto contexts (Pkcs7 in particular, which we hope to support) so
we want to be clear.

The new crypto.c contains functions to return the proper context from
the struct for a given protocol (and initialize it if needed), and to
cleanup a struct by releasing the crypto contexts.
2012-06-10 20:05:02 -03:00
Jameson Graef Rollins
25c3140e13 cli: use new typedef to deal with gmime 2.4/2.6 context incompatibility
gmime 2.4 defines GMimeCipherContext, while 2.6 defines
GMimeCryptoContext.  typedef them both to notmuch_crypto_context_t to
cover this discrepancy and remove a bunch of #ifdefs.
2012-06-10 20:04:50 -03:00
Austin Clements
9070e5cc43 show: Remove unused fields from notmuch_show_format
These fields were only used by old-style formatters.
2012-04-15 09:42:15 -03:00
Austin Clements
ae59f4ab4d Remove show-message.c
There are no more calls to show_message_body.
2012-04-15 09:42:15 -03:00
Mark Walters
903327279c cli: move show to the new --exclude= option naming scheme.
This moves notmuch show to the --exclude=(true|false) naming
scheme. When exclude=false show returns all threads that match
including those that only match in an excluded message. The excluded
messages are flagged.

When exclude=true the behaviour depends on whether --entire-thread is
set. If it is not set then show only returns the messages which match
and are not excluded. If it is set then show returns all messages in
the threads that match in a non-excluded message, flagging the excluded
messages in these threads. The rationale is that it is awkward to use
a thread with some missing messages.
2012-04-07 23:05:56 -03:00
Austin Clements
ea4fd50f45 show/reply: Unify the code that extracts text parts
Previously, show and reply had separate implementations of decoding
and printing text parts.  Now both use show's implementation, which
was more complete.  Show's implementation has been extended with an
option to add reply quoting to the extracted part (this is implemented
as a named flag to avoid naked booleans, even though it's the only
flag it can take).
2012-03-31 08:17:20 -03:00
Adam Wolfe Gordon
1904b01b96 reply: Add a JSON reply format.
This new JSON format for replies includes headers generated for a
reply message as well as the headers of the original message.  Using
this data, a client can intelligently create a reply. For example, the
emacs client will be able to create replies with quoted HTML parts by
parsing the HTML parts.
2012-03-19 21:53:53 -03:00
Austin Clements
6a4df1b796 show: Allow formatters to return errors
Formatter errors are propagated to the exit status of notmuch show.

This isn't used by the JSON or text formatters, but it will be useful
for the raw format, which is pickier.
2012-03-18 09:14:21 -03:00
Tomi Ollila
ce1e720de6 add support for user-specified files & directories to ignore
A new configuration key 'new.ignore' is used to determine which
files and directories user wants not to be scanned as new mails.

Mark the corresponding test as no longer broken.
This work merges my previous attempts and Andreas Amann's work
in id:"ylp7hi23mw8.fsf@tyndall.ie"
2012-02-17 08:04:34 -04:00
Jani Nikula
c9c5a6f70c cli: use notmuch_bool_t for boolean fields in notmuch_show_params_t
Use notmuch_bool_t instead of int for entire_thread, raw, and decrypt
boolean fields in notmuch_show_params_t. No functional changes.

Signed-off-by: Jani Nikula <jani@nikula.org>
2012-02-12 11:58:20 -05:00
Austin Clements
7430a42e23 show: Introduce mime_node formatter callback
This callback is the gateway to the new mime_node_t-based formatters.
This maintains backwards compatibility so the formatters can be
transitioned one at a time.  Once all formatters are converted, the
formatter structure can be reduced to only message_set_{start,sep,end}
and part, most of show_message can be deleted, and all of
show-message.c can be deleted.
2012-01-25 07:21:40 -04:00
Austin Clements
a66e65d604 mime node: Record depth-first part numbers
This makes the part numbers readily accessible to formatters.
Hierarchical part numbering would be a more natural and efficient fit
for MIME and may be the way to go in the future, but depth-first
numbering maintains compatibility with what we currently do.
2012-01-25 07:19:22 -04:00
Pieter Praet
649a9f5f3a search: rename auto_exclude_tags to {search, }exclude_tags
All other config-related functions and args include the section
title in their name, so for the sake of consistency, mirror that.

Also, the "auto"matic part is a given, so that was dropped.
2012-01-23 19:17:16 -04:00
Thomas Jost
00b5623d1a Add compatibility with gmime 2.6
There are lots of API changes in gmime 2.6 crypto handling. By adding
preprocessor directives, it is however possible to add gmime 2.6 compatibility
while preserving compatibility with gmime 2.4 too.

This is mostly based on id:"8762i8hrb9.fsf@bookbinder.fernseed.info".

This was tested against both gmime 2.6.4 and 2.4.31. With gmime 2.4.31, the
crypto tests all work fine (as expected). With gmime 2.6.4, one crypto test is
currently broken (signature verification with signer key unavailable), most
likely because of a bug in gmime which will hopefully be fixed in a future
version.
2012-01-21 08:52:34 -04:00
Austin Clements
42a9079928 search: Support automatic tag exclusions
This adds a "search" section to the config file and an
"auto_tag_exclusions" setting in that section.  The search and count
commands pass tag tags from the configuration to the library.
2012-01-16 21:06:35 -04:00
Austin Clements
5d1ac7d1d3 Utility function to seek in MIME trees in depth-first order.
This function matches how we number parts for the --part argument to
show.  It will allow us to jump directly to the desired part, rather
than traversing the entire tree and carefully tracking whether or not
we're "in the zone".
2011-12-25 22:21:04 -04:00
Austin Clements
bb189220a3 Introduce a generic tree-like abstraction for MIME traversal.
This wraps all of the complex MIME part handling in a single, simple
function that gets part N from *any* MIME object, so traversing a MIME
part tree becomes a two-line for loop.  Furthermore, the MIME node
structure provides easy access to envelopes for message parts as well
as cryptographic information.

This code is directly derived from the current show_message_body code
(much of it is identical), but the control relation is inverted:
instead of show_message_body controlling the traversal of the MIME
structure and invoking callbacks, the caller controls the traversal of
the MIME structure.
2011-12-25 22:19:12 -04:00
Austin Clements
36f7fe5a1c show: Pass notmuch_message_t instead of path to show_message_body.
In addition to simplifying the code, we'll need the notmuch_message_t*
in show_message_body shortly.
2011-12-25 22:17:27 -04:00
Jani Nikula
d399b6b909 cli: introduce the concept of user defined hooks
Add mechanism for running user defined hooks. Hooks are executables or
symlinks to executables stored under the new notmuch hooks directory,
<database-path>/.notmuch/hooks.

No hooks are introduced here, but adding support for a hook is now a simple
matter of calling the new notmuch_run_hook() function at an appropriate
location with the hook name.

Signed-off-by: Jani Nikula <jani@nikula.org>
2011-12-11 13:57:31 -04:00
David Bremner
2cf7b27a0c command-line-arguments.[ch]: new argument parsing framework for notmuch.
As we noticed when Jani kindly converted things to getopt_long, much
of the work in argument parsing in notmuch is due to the the key-value
style arguments like --format=(raw|json|text).

The framework here provides positional arguments, simple switches,
and --key=value style arguments that can take a value being an integer,
a string, or one of a set of keywords.
2011-12-08 20:24:24 -04:00
Jameson Graef Rollins
12de016686 Improve handling of message/rfc822 parts by adding a new header_message_part function to the formating structure.
This new function takes a GMimeMessage as input, and outputs the
formatted headers.  This allows for message/rfc822 parts to be
formatted on output in a similar way to full messages (see previous
patch that overhauls the multipart test for more info).
2011-09-05 22:58:52 -03:00
Daniel Kahn Gillmor
5143e5e840 Use stock GMimeSession by default
Our use of GMimeSession was unneeded boilerplate, and we weren't doing
anything with it.  This simplifies and clarifies that assumption.

If we want to do anything fancier later, the examples in the gmime
source are a reasonable source to work from in defining a new
GMimeSession derivative.

Since GMimeSession is going away in GMime 2.6, though, i don't
recommend using it.
2011-06-03 17:42:54 -07:00
Jameson Graef Rollins
2e653db38f Add decryption of PGP/MIME-encrypted parts with --decrypt.
This adds support for decrypting PGP/MIME-encrypted parts to
notmuch-show and notmuch-reply.  The --decrypt option implies
--verify.  Once decryption (and possibly signature verification) is
done, a new part_encstatus formatter is emitted, the part_sigstatus
formatter is emitted, and the entire multipart/encrypted part is
replaced by the contents of the encrypted part.

At the moment only a json part_encstatus formatting function is
available, even though decryption is done for all formats.  Emacs
support to follow.
2011-05-27 16:22:00 -07:00
Jameson Graef Rollins
8b18efe171 Add signature verification of PGP/MIME-signed parts with --verify.
This is primarily for notmuch-show, although the functionality is
added to show-message.  Once signatures are processed a new
part_sigstatus formatter is emitted, and the entire multipart/signed
part is replaced with the contents of the signed part.

At the moment only a json part_sigstatus formatting function is
available.  Emacs support to follow.

The original work for this patch was done by

  Daniel Kahn Gillmor <dkg@fifthhorseman.net>

whose help with this functionality I greatly appreciate.
2011-05-27 16:22:00 -07:00
Jameson Graef Rollins
d92146d3a6 Break up format->part function into part_start and part_content functions.
Future improvements (eg. crypto support) will require adding new part
header.  By breaking up the output of part headers from the output of
part content, we can easily out new part headers with new formatting
functions.
2011-05-27 16:18:57 -07:00
Jameson Graef Rollins
2f8871df6e New part output handling as option to notmuch-show.
Outputting of single MIME parts is moved to an option of notmuch show,
instead of being handled in it's own sub-command.  The recent rework
of multipart mime allowed for this change but consolidating part
handling into a single recursive function (show_message_part) that
includes formatting.  This allows for far simpler handling single
output of a single part, including formatting.
2011-05-23 15:31:32 -07:00
Jameson Graef Rollins
5a9d5f2f14 rename do_show_raw to do_show_single, and create params.raw for raw message output
We rename here in order to make do_show_single into a generic function
for handling output of just a single message, or which format=raw is a
special case.  The raw case is handled by setting a new parameter,
params.raw, which is used to tell do_show_single to output a single
message as a raw file.

This is mostly in preparation for much improved part handling to
follow imminently.
2011-05-23 14:55:27 -07:00
Jameson Graef Rollins
6c2417cabc add part_sep formatter to replace "first" argument to part format functions
A new field "part_sep" is added to the notmuch_show_format structure,
to be used for part separation.  This is cleaner than the "first"
argument that was being passed around to the part arguments, and
allows the function that handles overall part output formatting
(show_message_part) to directly handle when outputting the separator.
2011-05-23 14:55:27 -07:00
Jameson Graef Rollins
d2177d0b22 create notmuch_show_params_t structure for holding parameters passed to show functions.
This simplifies the passing of arguments to the show functions.  This
will be very useful as we accumulate more parameters that will need to
be passed.  Currently only the entire_thread parameter is passed this
way.
2011-05-23 14:55:27 -07:00
Jameson Graef Rollins
dcdb843094 pass entire format structure to various show_message functions
Various show_message* functions require formatting functions, which
were previously being passed individually as arguments.  Since we will
need to be needing to passing in more formatting function in the
future (ie. for crypto support), we here modify things so that we just
pass in the entire format structure.  This will make things much
simpler down the line as we need to pass in new format functions.

We move the show_format structure into notmuch-client.c as
notmuch_show_format.  This also affects notmuch-reply.c, so we create
a mostly-empty format_reply to pass the reply_part function to
show_message_body.
2011-05-20 12:27:35 -07:00
Carl Worth
362ab047c2 notmuch show: Properly nest MIME parts within mulipart parts
Previously, notmuch show flattened all output, losing information
about the nesting of the MIME hierarchy. Now, the output is properly
nested, (both in the --format=text and --format=json output), so that
clients can analyze the original MIME structure.

Internally, this required splitting the final closing delimiter out of
the various show_part functions and putting it into a new
show_part_end function instead. Also, the show_part function now
accepts a new "first" argument that is set not only for the first MIME
part of a message, but also for each first MIME part within a series
of multipart parts. This "first" argument controls the omission of a
preceding comma when printing a part (for json).

Many thanks to David Edmondson <dme@dme.org> for originally
identifying the lack of nesting in the json output and submitting an
early implementation of this feature. Thanks as well to Jameson Graef
Rollins <jrollins@finestructure.net> for carefully shepherding David's
patches through a remarkably long review process, patiently explaining
them, and providing a cleaned up series that led to this final
implementation. Jameson also provided the new emacs code here.
2011-05-17 15:58:57 -07:00
Carl Worth
4cfb2a0277 Avoid abbreviation, preferring notmuch_config_get_maildir_synchronize_flags
Since the name of the configuration parameter here is:

	maildir.synchronize_flags

the convention is that the functions to get and set this parameter
should match it in name. Hence:

       notmuch_config_get_maildir_synchronize_flags

etc. (as opposed to notmuch_config_get_maildir_sync).
2010-11-11 03:40:19 -08:00
Michal Sojka
d9d3d3e6f0 Make maildir synchronization configurable
This adds group [maildir] and key 'synchronize_flags' to the
configuration file. Its value enables (true) or diables (false) the
synchronization between notmuch tags and maildir flags. By default,
the synchronization is disabled.
2010-11-10 13:09:32 -08:00
Michal Sojka
d39d0e55f0 Add 'cat' subcommand
This command outputs a raw message matched by search term to the
standard output. It allows MUAs to access the messages for piping,
attachment manipulation, etc. by running notmuch cat rather then
directly access the file. This will simplify the MUAs when they need
to operate on a remote database.

Edited-by: Carl Worth <cworth@cworth.org>: Remove trailing whitespace,
add missing "test_done" to new test script to avoid "Unexpected exit"
error.
2010-11-05 17:51:18 -07:00
Carl Worth
b9eac48c22 notmuch: Add a new "notmuch config" command for querying configuration.
So far, we implement only "notmuch config get". It won't be too much
work from here to also implement "notmuch config set".
2010-10-27 13:02:17 -07:00
Carl Worth
65d278afb1 Sprinkle some const-correctness around new_tags.
To eliminate a compiler warning.
2010-04-23 09:19:52 -07:00
Ben Gamari
143d436874 notmuch-config: make new message tags configurable
Add a new_tags option in the [messages] section of the configuration
file to allow the user to specify which tags should be added to new
messages by notmuch new.
2010-04-23 08:41:59 -07:00
David Edmondson
9eb3603299 notmuch: Correctly terminate text/* parts in JSON output
Text parts returned by `g_mime_stream_mem_get_byte_array()' are not
NULL terminated strings - add `json_quote_chararray()' to handle them
correctly.
2010-04-05 10:57:23 -07:00
Carl Worth
44df403ccd Merge remote branch 'dme/dme-for-cworth'
Conflicts:
	notmuch.c (Simply the change in documentation indentation level).
2010-04-02 15:47:27 -07:00
Carl Worth
b2a9fcd5cf notmuch: Add a version (0.1 initially) with a new --version option.
We're planning to do actual releases soon, so we need a version
number to put into the tar file.
2010-04-02 11:55:09 -07:00
David Edmondson
2e9c7aba99 notmuch: Add a 'part' subcommand
A new 'part' subcommand allows the user to extract a single part from
a MIME message. Usage:
  notmuch part --part=<n> <search terms>
The search terms must match only a single message
(e.g. id:foo@bar.com). The part number specified refers to the part
identifiers output by `notmuch show'. The content of the part is
written the stdout with no formatting or identification marks. It is
not JSON formatted.
2010-04-02 09:43:03 +01:00
Scott Robinson
6ce2bf68f5 Add an "--format=(json|text)" command-line option to both notmuch-search and notmuch-show.
In the case of notmuch-show, "--format=json" also implies
"--entire-thread" as the thread structure is implicit in the emitted
document tree.

As a coincidence to the implementation, multipart message ID numbers are
now incremented with each part printed. This changes the previous
semantics, which were unclear and not necessary related to the actual
ordering of the message parts.
2010-02-23 12:01:12 -08:00
Carl Worth
63ef5cd073 Make the add_files function static within notmuch-new.c.
No other files need this function so we don't need it exported in
notmuch-client.h.
2010-01-06 10:32:06 -08:00
Carl Worth
3a9c3ec9e7 notmuch new: Remove hack to ignore read-only directories in mail store.
This was really the last thing keeping the initial run of "notmuch
new" being different from all other runs. And I'm taking a fresh
look at the performance of "notmuch new" anyway, so I think we can
safely drop this optimization.
2010-01-06 10:32:05 -08:00
Carl Worth
880b21a097 Makefile: Incorporate getline implementation into the build.
It's unconditional for a very short time. We expect to soon be
building it only if necessary.
2009-12-01 16:33:17 -08:00
Jan Janak
f8baa02335 notmuch: New command 'search-tags'.
This is a new notmuch command that can be used to search for all tags
found in the database. The resulting list is alphabetically sorted.

The primary use-case for this new command is to provide the tag
completion feature in Emacs (and other interfaces).

Signed-off-by: Jan Janak <jan@ryngle.com>
2009-11-26 07:02:48 -08:00
Keith Packard
53f8cc5651 Add 'notmuch count' command to show the count of matching messages
Getting the count of matching threads or messages is a fairly
expensive operation. Xapian provides a very efficient mechanism that
returns an approximate value, so use that for this new command.

This returns the number of matching messages, not threads, as that is
cheap to compute.

Signed-off-by: Keith Packard <keithp@keithp.com>
2009-11-23 06:33:54 +01:00
Adrian Perez
d024ab4a04 ANSI escapes in "new" only when output is a tty
When running "notmuch new --verbose", ANSI escapes are used. This may not be
desirable when the output of the command is *not* being sent to a terminal
(e.g. when piping output into another command). In that case each file
processed is printed in a new line and ANSI escapes are not used at all.
2009-11-23 06:02:06 +01:00
Adrian Perez
5fdce046a1 Support for printing file paths in new command
For very large mail boxes, it is desirable to know which files are being
processed e.g. when a crash occurs to know which one was the cause. Also,
it may be interesting to have a better idea of how the operation is
progressing when processing mailboxes with big messages.

This patch adds support for printing messages as they are processed by
"notmuch new":

* The "new" command now supports a "--verbose" flag.

* When running in verbose mode, the file path of the message about to be
  processed is printed in the following format:

    current/total: /path/to/message/file

  Where "current" is the number of messages processed so far and "total" is
  the total count of files to be processed.

  The status line is erased using an ANSI sequence "\033[K" (erase current
  line from the cursor to the end of line) each time it is refreshed. This
  should not pose a problem because nearly every terminal supports it.

* The signal handler for SIGALRM and the timer are not enabled when running
  in verbose mode, because we are already printing progress with each file,
  periodical reports are not neccessary.
2009-11-23 01:07:02 +01:00
Chris Wilson
986f6c9824 notmuch-new: Only install SIGALRM if not running under gdb
I felt sorry for Carl trying to step through an exception from xapian
and suffering from the SIGALARMs..

We can detect if the user launched notmuch under a debugger by either
checking our cmdline for the presence of the gdb string or querying if
valgrind is controlling our process. For the latter we need to add a
compile time check for the valgrind development library, and so add the
initial support to build Makefile.config from configure.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Carl Worth <cworth@cworth.org>
[ickle: And do not install the timer when under the debugger]
2009-11-22 05:36:36 +01:00
Carl Worth
533d0f5382 notmuch help: Update documentation (following recent text from notmuch.1)
We take the recently created text from the notmuch manual page and
update the "notmuch help" command to use similar text. In particular,
we add a new "notmuch help search-terms" for documenting the search
syntax that is common to several commands.
2009-11-17 23:37:21 -08:00
Carl Worth
8b23a828c2 Add some const correctness to talloc 'ctx' parameter.
The tentacles of const just keep reaching out.
2009-11-17 19:10:37 -08:00
Carl Worth
fc2053b022 notmuch search: Add --first and --max-threads options for incremental search.
This time, things are actually tested. The current results aren't
exactly the same as previous results since the incremental search
doesn't necessarily see all the new messages that pertain to the
thread. This means that some author names are missing.

I plan to fix this by doing an additional database search for all
messages in each thread. Of course, this will also be different than
before since now the result will display *all* authors in the thread
(rather than only those that matched the search) but that's probably
what we really want to display anyway.
2009-11-12 20:47:12 -08:00
Carl Worth
6bd01e1b34 notmuch: Move welcome messages from "notmuch" to "notmuch setup".
It's quite possible for someone to read the documentation and run
"notmuch setup" rather than just "notmuch". In that case, we don't
want to be any less welcoming.
2009-11-11 17:33:31 -08:00
Carl Worth
305e76bc0a notmuch: Add a configuration system.
This will allow for things like the database path to be specified
without any cheesy NOTMUCH_BASE environment variable. It also will
allow "notmuch reply" to recognize the user's email address when
constructing a reply in order to do the right thing, (that is, to use
the user's address to which mail was sent as From:, and not to reply
to the user's own addresses).

With this change, the "notmuch setup" command is now strictly for
changing the configuration of notmuch. It no longer creates the
database, but instead instructs the user to call "notmuch new" to do
that.
2009-11-11 17:01:55 -08:00
Keith Packard
357aba3ec8 notmuch reply: Add (incomplete) reply command
Reviewed-by: Carl Worth <cworth@cworth.org>

Keith wrote all the code here against notmuch before notmuch.c was
split up into multiple files. So I've pushed the code around in
various ways to match the new code structure, but have generally tried
to avoid making any changes to the behavior of the code.

I did fix one bug---a missing call to g_mime_stream_file_set_owner in
show_part which would cause "notmuch show" to go off into the weeds
when trying to show multiple messages, (since the first stream would
fclose stdout).
2009-11-10 13:32:02 -08:00
Carl Worth
50144f95ca notmuch: Break notmuch.c up into several smaller files.
Now that the client sources are alone here in their own directory,
(with all the library sources down inside the lib directory), we can
break the client up into multiple files without mixing the files up.
The hope is that these smaller files will be easier to manage and
maintain.
2009-11-10 12:03:05 -08:00