From: David Bremner Date: Fri, 25 Jan 2013 02:29:09 +0000 (-0400) Subject: Merge branch 'release' X-Git-Tag: 0.16_rc1~219 X-Git-Url: https://git.cworth.org/git?p=notmuch;a=commitdiff_plain;h=7264732a794b8d59b0aeef395e74381beb4b90f7;hp=79b0829082e62020de6eeb66e0c4f1ad19ded86c Merge branch 'release' Conflicts: NEWS Inserted news from 0.15.1 --- diff --git a/NEWS b/NEWS index 97f23058..9bd7a11e 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,11 @@ +Notmuch 0.16 (2013-MM-DD) +========================= + +Command-Line Interface +---------------------- + +Deprecated commands "part" and "search-tags" are removed. + Notmuch 0.15.1 (2013-01-24) ========================= @@ -191,8 +199,8 @@ Internal test framework changes The emacsclient binary is now user-configurable - The test framework now accepts TEST_EMACSCLIENT in addition to - TEST_EMACS for configuring the emacsclient to use. This is + The test framework now accepts `TEST_EMACSCLIENT` in addition to + `TEST_EMACS` for configuring the emacsclient to use. This is necessary to avoid using an old emacsclient with a new emacs, which can result in buggy behavior. diff --git a/bindings/python/notmuch/database.py b/bindings/python/notmuch/database.py index fe692eb7..7ddf5cfe 100644 --- a/bindings/python/notmuch/database.py +++ b/bindings/python/notmuch/database.py @@ -188,7 +188,7 @@ class Database(object): "already has an open one.") db = NotmuchDatabaseP() - status = Database._create(_str(path), Database.MODE.READ_WRITE, byref(db)) + status = Database._create(_str(path), byref(db)) if status != STATUS.SUCCESS: raise NotmuchError(status) diff --git a/devel/TODO b/devel/TODO index eb757af5..e4f36c2c 100644 --- a/devel/TODO +++ b/devel/TODO @@ -57,11 +57,6 @@ Automatically open a message when navigating to it with N or P. Change 'a' command in thread-view mode to only archive open messages. -Add a binding to open all closed messages. - -Change the 'a'rchive command in the thread view to only archive open -messages. - Completion ---------- Fix bash completion to complete multiple search options (both --first @@ -75,11 +70,6 @@ listing of duplicate messages, (distinct filenames with the same Message-ID). I'm not sure what the option should be named. Perhaps --with-duplicates ? -Add a -0 option to "notmuch search" so that one can safely deal with -any filename with: - - notmuch search --output=files -0 | xargs -0 - "notmuch setup" should use realpath() before replacing the configuration file. The ensures that the final target file of any intermediate symbolic links is what is actually replaced, (rather than @@ -118,13 +108,6 @@ file. Allow configuration for filename patterns that should be ignored when indexing. -Replace the "notmuch part --part=id" command with "notmuch show ---part=id", (David Edmondson wants to rewrite some of "notmuch show" to -provide more MIME-structure information in its output first). - -Replace the "notmuch search-tags" command with "notmuch search ---output=tags". - Fix to avoid this ugly message: (process:17197): gmime-CRITICAL **: g_mime_message_get_mime_part: assertion `GMIME_IS_MESSAGE (message)' failed @@ -163,12 +146,13 @@ vs. tag-when-all-files-flagged (* above)). Add an interface to accept a "key" and a byte stream, rather than a filename. -Provide a sane syntax for date ranges. First, we don't want to require -both endpoints to be specified. For example it would be nice to be -able to say things like "since:2009-01-1" or "until:2009-01-1" and -have the other endpoint be implicit. Second we'd like to support -relative specifications of time such as "since:'2 months ago'". To do -any of this we're probably going to need to break down an write our +Improve syntax for date ranges queries. date:expr should be +interpreted as date:expr..expr so that, for example, "date:2013-01-22" +would cover the whole of the specified day (currently that's not even +recognized as a date range expression). It might be nice to be able to +use things like "since:2013-01-22" and "until:2013-01-22" as synonyms +to "date:2013-01-22.." and "date:..2013-01-22", respectively. To do +any of this we're probably going to need to break down and write our own parser for the query string rather than using Xapian's QueryParser class. diff --git a/devel/release-checks.sh b/devel/release-checks.sh index e1d19f20..d2bbc6a0 100755 --- a/devel/release-checks.sh +++ b/devel/release-checks.sh @@ -53,12 +53,13 @@ fi < ./version readonly VERSION +# In the rest of this file, tests collect list of errors to be fixed + verfail () { echo No. - echo "$@" - echo "Please follow the instructions in RELEASING to choose a version" - exit 1 + append_emsg "$@" + append_emsg " Please follow the instructions in RELEASING to choose a version" } echo -n "Checking that '$VERSION' is good with digits and periods... " @@ -73,8 +74,6 @@ case $VERSION in esac -# In the rest of this file, tests collect list of errors to be fixed - echo -n "Checking that this is Debian package for notmuch... " read deb_notmuch deb_version rest < debian/changelog if [ "$deb_notmuch" = 'notmuch' ] diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el index 6db62a01..00b78e1e 100644 --- a/emacs/notmuch-hello.el +++ b/emacs/notmuch-hello.el @@ -504,7 +504,7 @@ Complete list of currently available key bindings: (notmuch-remove-if-not (lambda (tag) (not (member tag hide-tags))) - (process-lines notmuch-command "search-tags")))) + (process-lines notmuch-command "search" "--output=tags" "*")))) (defun notmuch-hello-insert-header () "Insert the default notmuch-hello header." diff --git a/lib/Makefile.local b/lib/Makefile.local index 77859447..155ac02f 100644 --- a/lib/Makefile.local +++ b/lib/Makefile.local @@ -73,7 +73,7 @@ libnotmuch_modules := $(libnotmuch_c_srcs:.c=.o) $(libnotmuch_cxx_srcs:.cc=.o) $(dir)/libnotmuch.a: $(libnotmuch_modules) $(call quiet,AR) rcs $@ $^ -$(dir)/$(LIBNAME): $(libnotmuch_modules) notmuch.sym +$(dir)/$(LIBNAME): $(libnotmuch_modules) notmuch.sym util/libutil.a parse-time-string/libparse-time-string.a $(call quiet,CXX $(CXXFLAGS)) $(libnotmuch_modules) $(FINAL_LIBNOTMUCH_LDFLAGS) $(LIBRARY_LINK_FLAG) -o $@ util/libutil.a parse-time-string/libparse-time-string.a notmuch.sym: $(srcdir)/$(dir)/notmuch.h $(libnotmuch_modules) diff --git a/man/man1/notmuch.1 b/man/man1/notmuch.1 index 9b25c275..0805be83 100644 --- a/man/man1/notmuch.1 +++ b/man/man1/notmuch.1 @@ -21,7 +21,7 @@ notmuch \- thread-based email index, search, and tagging .SH SYNOPSIS .B notmuch -.IR command " [" args " ...]" +.RI "[" option " ...] " command " [" arg " ...]" .SH DESCRIPTION Notmuch is a command-line based program for indexing, searching, reading, and tagging large collections of email messages. @@ -50,6 +50,26 @@ interfaces to notmuch. The emacs-based interface to notmuch (available under in the Notmuch source distribution) is probably the most widely used at this time. +.SH OPTIONS + +Supported global options for +.B notmuch +include + +.RS 4 +.TP 4 +.B \-\-help + +Print a synopsis of available commands and exit. +.RE + +.RS 4 +.TP 4 +.B \-\-version + +Print the installed version of notmuch, and exit. +.RE + .SH COMMANDS diff --git a/notmuch-tag.c b/notmuch-tag.c index b54c55dd..d9daf8fb 100644 --- a/notmuch-tag.c +++ b/notmuch-tag.c @@ -97,7 +97,7 @@ tag_query (void *ctx, notmuch_database_t *notmuch, const char *query_string, notmuch_query_t *query; notmuch_messages_t *messages; notmuch_message_t *message; - int ret = 0; + int ret = NOTMUCH_STATUS_SUCCESS; /* Optimize the query so it excludes messages that already have * the specified set of tags. */ diff --git a/notmuch.c b/notmuch.c index 4fc0973d..a674481f 100644 --- a/notmuch.c +++ b/notmuch.c @@ -31,18 +31,6 @@ typedef struct command { const char *summary; } command_t; -#define MAX_ALIAS_SUBSTITUTIONS 3 - -typedef struct alias { - const char *name; - const char *substitutions[MAX_ALIAS_SUBSTITUTIONS]; -} alias_t; - -alias_t aliases[] = { - { "part", { "show", "--format=raw"}}, - { "search-tags", {"search", "--output=tags", "*"}} -}; - static int notmuch_help_command (void *ctx, int argc, char *argv[]); @@ -260,9 +248,15 @@ main (int argc, char *argv[]) { void *local; command_t *command; - alias_t *alias; - unsigned int i, j; - const char **argv_local; + unsigned int i; + notmuch_bool_t print_help=FALSE, print_version=FALSE; + int opt_index; + + notmuch_opt_desc_t options[] = { + { NOTMUCH_OPT_BOOLEAN, &print_help, "help", 'h', 0 }, + { NOTMUCH_OPT_BOOLEAN, &print_version, "version", 'v', 0 }, + { 0, 0, 0, 0, 0 } + }; talloc_enable_null_tracking (); @@ -277,56 +271,28 @@ main (int argc, char *argv[]) if (argc == 1) return notmuch (local); - if (strcmp (argv[1], "--help") == 0) + opt_index = parse_arguments (argc, argv, options, 1); + if (opt_index < 0) { + /* diagnostics already printed */ + return 1; + } + + if (print_help) return notmuch_help_command (NULL, argc - 1, &argv[1]); - if (strcmp (argv[1], "--version") == 0) { + if (print_version) { printf ("notmuch " STRINGIFY(NOTMUCH_VERSION) "\n"); return 0; } - for (i = 0; i < ARRAY_SIZE (aliases); i++) { - alias = &aliases[i]; - - if (strcmp (argv[1], alias->name) == 0) - { - int substitutions; - - argv_local = talloc_size (local, sizeof (char *) * - (argc + MAX_ALIAS_SUBSTITUTIONS - 1)); - if (argv_local == NULL) { - fprintf (stderr, "Out of memory.\n"); - return 1; - } - - /* Copy all substution arguments from the alias. */ - argv_local[0] = argv[0]; - for (j = 0; j < MAX_ALIAS_SUBSTITUTIONS; j++) { - if (alias->substitutions[j] == NULL) - break; - argv_local[j+1] = alias->substitutions[j]; - } - substitutions = j; - - /* And copy all original arguments (skipping the argument - * that matched the alias of course. */ - for (j = 2; j < (unsigned) argc; j++) { - argv_local[substitutions+j-1] = argv[j]; - } - - argc += substitutions - 1; - argv = (char **) argv_local; - } - } - for (i = 0; i < ARRAY_SIZE (commands); i++) { command = &commands[i]; - if (strcmp (argv[1], command->name) == 0) { + if (strcmp (argv[opt_index], command->name) == 0) { int ret; char *talloc_report; - ret = (command->function)(local, argc - 1, &argv[1]); + ret = (command->function)(local, argc - opt_index, argv + opt_index); /* in the future support for this environment variable may * be supplemented or replaced by command line arguments