aboutsummaryrefslogtreecommitdiffhomepage
path: root/notmuch-tag.c
Commit message (Collapse)AuthorAge
* lib/cli: Make notmuch_database_open return a status codeGravatar Austin Clements2012-05-05
| | | | | | | | | | | | It has been a long-standing issue that notmuch_database_open doesn't return any indication of why it failed. This patch changes its prototype to return a notmuch_status_t and set an out-argument to the database itself, like other functions that return both a status and an object. In the interest of atomicity, this also updates every use in the CLI so that notmuch still compiles. Since this patch does not update the bindings, the Python bindings test fails.
* Use notmuch_database_destroy instead of notmuch_database_closeGravatar Justus Winter2012-04-28
| | | | | | Adapt the notmuch binaries source to the notmuch_database_close split. Signed-off-by: Justus Winter <4winter@informatik.uni-hamburg.de>
* cli: refactor "notmuch tag" query tagging into a separate functionGravatar Jani Nikula2012-03-30
| | | | | | | Refactor to make tagging code easier to reuse in the future. No functional changes. Signed-off-by: Jani Nikula <jani@nikula.org>
* cli: refactor "notmuch tag" data structures for tagging operationsGravatar Jani Nikula2012-03-30
| | | | | | | | | | | | | | To simplify code, keep all tagging operations in a single array instead of separate add and remove arrays. Apply tag changes in the order specified on the command line, instead of first removing and then adding the tags. This results in a minor functional change: If a tag is both added and removed, the last specified operation is now used. Previously the tag was always added. Change the relevant test to reflect the new behaviour. Signed-off-by: Jani Nikula <jani@nikula.org>
* tag: remove unused attribute from notmuch_tag_command() argumentsGravatar Dmitry Kurochkin2012-02-08
| | | | | Argc and argv arguments are used in notmuch_tag_command() function. So unused attribute is not appropriate for them.
* Silence buildbot warnings about unused resultsGravatar Austin Clements2012-01-21
| | | | | | | | | | | This ignores the results of the two writes in sigint handlers even harder than before. While my libc lacks the declarations that trigger these warnings, this can be tested by adding the following to notmuch.h: __attribute__((warn_unused_result)) ssize_t write(int fd, const void *buf, size_t count);
* notmuch: Quiet buildbot warnings.Gravatar David Edmondson2011-12-21
| | | | | Cast away the result of various *write functions. Provide a default value for some variables to avoid "use before set" warnings.
* tag: Automatically limit to messages whose tags will actually change.Gravatar Austin Clements2011-11-28
| | | | | | | | | | | | | | | This optimizes the user's tagging query to exclude messages that won't be affected by the tagging operation, saving computation and IO for redundant tagging operations. For example, notmuch tag +notmuch to:notmuch@notmuchmail.org will now use the query ( to:notmuch@notmuchmail.org ) and (not tag:"notmuch") In the past, we've often suggested that people do this exact transformation by hand for slow tagging operations. This makes that unnecessary.
* cli: change argument parsing convention for subcommandsGravatar David Bremner2011-10-22
| | | | | | | | | previously we deleted the subcommand name from argv before passing to the subcommand. In this version, the deletion is done in the actual subcommands. Although this causes some duplication of code, it allows us to be more flexible about how we parse command line arguments in the subcommand, including possibly using off-the-shelf routines like getopt_long that expect the name of the command in argv[0].
* Remove some variables which were set but not used.Gravatar Carl Worth2011-05-11
| | | | | | | | | | | | gcc (at least as of version 4.6.0) is kind enough to point these out to us, (when given -Wunused-but-set-variable explicitly or implicitly via -Wunused or -Wall). One of these cases was a legitimately unused variable. Two were simply variables (named ignored) we were assigning only to squelch a warning about unused function return values. I don't seem to be getting those warnings even without setting the ignored variable. And the gcc docs. say that the correct way to squelch that warning is with a cast to (void) anyway.
* lib: Rework interface for maildir_flags synchronizationGravatar Carl Worth2010-11-11
| | | | | | | | | | | | | Instead of having an API for setting a library-wide flag for synchronization (notmuch_database_set_maildir_sync) we instead implement maildir synchronization with two new library functions: notmuch_message_maildir_flags_to_tags and notmuch_message_tags_to_maildir_flags These functions are nicely documented here, (though the implementation does not quite match the documentation yet---as plainly evidenced by the current results of the test suite).
* Avoid abbreviation, preferring notmuch_config_get_maildir_synchronize_flagsGravatar Carl Worth2010-11-11
| | | | | | | | | | | | | 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).
* Make maildir synchronization configurableGravatar Michal Sojka2010-11-10
| | | | | | | 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.
* notmuch-tag: don't sort messages before applying tag changesGravatar Sebastian Spaeth2010-04-21
| | | | | | | | | It's not neccessary to sort the results before we apply tags. Xapian contributor Olly Betts says that savings might be bigger with a cold file cache and (as unsorted implies really sorted by document id) a better cache locality when applying tags to messages. Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
* lib: Rename iterator functions to prepare for reverse iteration.Gravatar Carl Worth2010-03-09
| | | | | | | | We rename 'has_more' to 'valid' so that it can function whether iterating in a forward or reverse direction. We also rename 'advance' to 'move_to_next' to setup parallel naming with the proposed functions 'move_to_first', 'move_to_last', and 'move_to_previous'.
* Avoid compiler warnings due to ignored write return valuesGravatar Dirk-Jan C. Binnema2009-12-01
| | | | | | | | | | | | | Glibc (at least) provides the warn_unused_result attribute on write, (if optimizing and _FORTIFY_SOURCE is defined). So we explicitly ignore the return value in our signal handler, where we couldn't do anything anyway. Compile with: make CFLAGS="-O -D_FORTIFY_SOURCE" before this commit to see the warning.
* lib/query: Drop the first and max_messages arguments from search_messages.Gravatar Carl Worth2009-11-23
| | | | | These only existed to support the chunky-searching hack, but that was recently dropped anyway.
* Rename NOTMUCH_DATABASE_MODE_WRITABLE to NOTMUCH_DATABASE_MODE_READ_WRITEGravatar Carl Worth2009-11-21
| | | | And correspondingly, READONLY to READ_ONLY.
* Permit opening the notmuch database in read-only mode.Gravatar Chris Wilson2009-11-21
| | | | | | | | | We only rarely need to actually open the database for writing, but we always create a Xapian::WritableDatabase. This has the effect of preventing searches and like whilst updating the index. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Acked-by: Carl Worth <cworth@cworth.org>
* Make reply/show/tag all require at least one search termGravatar Keith Packard2009-11-18
| | | | | | | | In particular, notmuch tag -inbox "" tended to take a long time to run, happened if you hit 'a' on a blank line in the search view and probably didn't have the desired effect. Signed-off-by: Keith Packard <keithp@keithp.com>
* notmuch new/tag: Flush all changes to database when interrupted.Gravatar Keith Packard2009-11-13
| | | | | | By installing a signal handler for SIGINT we can ensure that no work that is already complete will be lost if the user interrupts a "notmuch new" run with Control-C.
* libnotmuch: Underlying support for doing partial-results searches.Gravatar Carl Worth2009-11-12
| | | | | | The library interface now allows the caller to do incremental searches, (such as one page of results at a time). Next we'll just need to hook this up to "notmuch search" and the emacs interface.
* Unbreak several notmuch commands after the addition of configuration.Gravatar Carl Worth2009-11-11
| | | | | | | | | | | | | | | | | | | | | | All of the following commands: notmuch dump notmuch reply notmuch restore notmuch search notmuch show notmuch tag were calling notmuch_database_open with an argument of NULL. This was a legitimate call until the recent addition of configuration, after which it is expected that all commands will lookup the correct path in the configuration file. So fix all these commands to do that. Also, while touching all of these commands, we fix them to use the talloc context that is passed in rather than creating a local talloc context. We also switch from using goto for return values, to doing direct returns as soon as an error is detected, (which can be leak free thanks to talloc).
* notmuch: Break notmuch.c up into several smaller files.Gravatar Carl Worth2009-11-10
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.