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.
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.
Two new internal routines are created _config_get_list and
_config_set_list; the notmuch_config_get_* functions that deal with
lists are simply wrappers for these functions.
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].
Various typo fixes in documentation within the code that can be made
available to the user, (emacs function help strings, "notmuch help"
output, notmuch man page, etc.).
Signed-off-by: Pieter Praet <pieter@praet.org>
Edited-by: Carl Worth <cworth@cworth.org> Restricted to just
documentation and fixed fix of "comman" to "common" rather than
"command".
Fix to check the value returned by sysconf(_SC_GETPW_R_SIZE_MAX)
before using the value.
This fixes a core dump on DragonFlyBSD where this function returns -1.
The intent of "notmuch setup" is that it adds new, documented sections
to configuration files that were created before such sections were
defined. But to make this work, we have to explicitly set an option
in the maildir group if it didn't exist previously.
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).
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.
We might as well be general here, and allow the "notmuch config" command
to query any stored value from the configuration file, (whether or not
the rest of the code actually knows anything about that value).
Since commit f41a35e292 running a command
such as:
NOTMUCH_CONFIG=/new/config/file notmuch setup
would result in a segmentation fault.
The purpose of that commit was to ensure that an attempt to manipulate
a non-standard database would not inadvertently manipulate the default
database only due to a typo in the NOTMUCH_CONFIG environment
variable. That is, a command like:
NOTMUCH_CONFIG=mistyped-config-filename notmuch tag -new tag:new
shouldn't modify the database at ${HOME}/mail, but should instead
simply report that the mistype configuration filename does not exist.
We fix both cases simultaneously by reporting the error message
whenever the function calling notmuch_config_open is not explicitly
prepared for a default configuration file.
I think one configuration group for each top-level command makes a lot
of sense. And this makes the existing naming of set_new_tags and
get_new_tags also very reasonable.
Our intent has always been that when new configuration-file settings
are created by notmuch, that they get created with comments telling
the user how to use them. But this was only working before when the
entire configuration file was created.
We fix this so that when a new group is added, (such as the recently-
added [messages] section) that it gets its documentation.
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.
When there is no configuration file at all, (and none specified),
notmuch works correctly by assuming correct default values. But when
the user specifies a configuration file (with the NOTMUCH_CONFIG
environment variable) and that file doesn't exist, then notmuch should
aboirt and let the user know about the problem.
While talloc is great we need to free the g_error by hand.
Tested-by: Stefan Schmidt <stefan@datenfreihafen.org>
Signed-off-by: Holger Freyther <zecke@selfish.org>
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.
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.