Commit graph

77 commits

Author SHA1 Message Date
David Bremner
1df71b5510 cli: factor out config handling code to get/set lists.
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.
2011-12-12 11:16:01 -04:00
David Bremner
61f0a5b8ee cli: change argument parsing convention for subcommands
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].
2011-10-22 19:42:54 -03:00
Pieter Praet
432e091924 fix sum moar typos [user-visible documentation in code]
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".
2011-06-23 15:58:50 -07:00
Matthias Guedemann
3185df17eb Fix check of sysconf return in get_name/username_from_passwd_file
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.
2011-05-26 15:13:46 -07:00
Carl Worth
a68334258a config: Fix confusing of "tag" and "flag" oin documentation.
It has been very difficult to get all of these right. I would not be
surprised if I've still missed some.
2010-11-11 20:39:22 -08:00
Carl Worth
89954b453c notmuch setup: Fix to add maildir group (with comment) to existing file
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.
2010-11-11 04:28:01 -08:00
Carl Worth
28708d2bd3 Enable maildir synchronization by default.
This is a useful feature that most people should want, so enable it by
default, (still allowing customization to disable it of course).
2010-11-11 04:11:21 -08:00
Carl Worth
937ecd5057 notmuch config: Add more documentation for maildir.synchronize_flags
Including details on which actual flags are synchronized with which tags.
2010-11-11 04:06:23 -08: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
Carl Worth
65f2e61f28 notmuch config: Allow for new "notmuch config set" in addition to get
It is now possible to set configuration items from the command-line in
a manner quite similar to the support for querying configuration
items.
2010-10-27 15:38:16 -07:00
Carl Worth
49d90ede87 notmuch config: Provide support for querying non-standard configuration values.
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).
2010-10-27 13:26:32 -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
676d25111e Avoid segmentation fault with NOTMUCH_CONFIG=/new/config/file notmuch setup
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.
2010-07-19 17:16:18 -07:00
Carl Worth
c63b6473ca config: Rename messages.new_tags to just new.tags
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.
2010-04-23 10:29:28 -07:00
Carl Worth
444923e2d0 Clarify the documentation for the new_tags configuration option.
Specifically mentioning that it's a list separated by ';' and use
"will" instead of "should".
2010-04-23 09:28:45 -07:00
Carl Worth
15e71cfda7 notmuch setup: Fix new configuration-file groups to get comments
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.
2010-04-23 09:20:40 -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
Carl Worth
f41a35e292 notmuch: Abort if specified configuration file is not found.
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.
2010-04-21 15:54:03 -07:00
Dirk-Jan C. Binnema
926c71e6b9 * notmuch-config: fix small leak from 'g_key_file_to_data'
Signed-off-by: Dirk-Jan C. Binnema <djcb.bulk@gmail.com>
2009-12-04 11:16:26 -08:00
Alec Berryman
91d1d3f043 Support multiple configuration files via $NOTMUCH_CONFIG
If present, $NOTMUCH_CONFIG will be used as the configuration file
location.
2009-11-23 03:01:57 +01:00
Holger Freyther
6c7ec294bb notmuch-config: Fix memleaks.
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>
2009-11-22 00:14:48 +01:00
Alexander Botero-Lowry
8177dc5d40 Deal with situation where sysconf(_SC_GETPW_R_SIZE_MAX) returns -1 2009-11-17 12:27:49 -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
c884c30c30 notmuch setup: Add some comments when creating a .notmuch-config file.
The "notmuch setup" command is nice and all, but we also want to allow
users to conveniently edit the configuration file directly.
2009-11-11 17:25:42 -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