aboutsummaryrefslogtreecommitdiffhomepage
path: root/notmuch-config.c
Commit message (Collapse)AuthorAge
* cli: Be more helpful when .notmuch-config does not existGravatar Austin Clements2014-09-07
| | | | | | | | | | | | Previously, if the user ran any subcommand that required a configuration (e.g., notmuch new) but didn't have a configuration, notmuch would give the rather un-friendly and un-actionable message Error reading configuration file .notmuch-config: No such file or directory Since this condition is expected for new users, this patch adds specific handling for the file-not-found case to give a message that is friendly and actionable.
* notmuch-config: talloc_strdup MAILDIR and NAME environment variablesGravatar Tomi Ollila2014-08-07
| | | | | When defined -- the pointer is soon given to talloc_free() which expects it to be allocated by talloc.
* config: read database.path from $MAILDIR if setGravatar Mark Oteiza2014-07-31
| | | | | Try to read the config parameter database.path from $MAILDIR before falling back to $HOME/mail
* config: read user.name from $NAME if setGravatar Mark Oteiza2014-07-31
| | | | | Try to read the config parameter user.name from $NAME before taking the user name from /etc/passwd.
* compat: add canonicalize_file_nameGravatar David Bremner2014-04-08
| | | | | | | | the POSIX 2008 behaviour of realpath is not available everywhere so we provide a simple wrapper function. We use (and provide) the gnu extension canonicalize_file_name to make it cleaner to test for the feature we need; otherwise we have to rely on realpath segfaulting if the second argument is null.
* cli: abstract common config get/set codeGravatar Jani Nikula2014-01-18
| | | | Pretty straightforward abstraction similar to get/set list.
* cli: clean up exit status code returned by the cli commandsGravatar Jani Nikula2014-01-18
| | | | | | Apart from the status codes for format mismatches, the non-zero exit status codes have been arbitrary. Make the cli consistently return either EXIT_SUCCESS or EXIT_FAILURE.
* notmuch-config: use strchr(), not index() (Solaris support)Gravatar Blake Jones2013-08-24
| | | | | | | | | notmuch-config.c has the only use of the function named "index()" in the notmuch source. Several other places use the equivalent function "strchr()"; this patch just fixes notmuch-config.c to use strchr() instead. (Solaris needs to include <strings.h> to get the prototype for index(), and notmuch-config.c was failing to include that header, so it wasn't compiling as-is.)
* cli: config: fix config file save when the file does not existGravatar Jani Nikula2013-05-12
| | | | | | | | | | | | | | The use of realpath(3) in commit 58ed67992d0ec1fa505026105218fa449f7980b0 Author: Jani Nikula <jani@nikula.org> Date: Sun Apr 7 20:15:03 2013 +0300 cli: config: do not overwrite symlinks when saving config file broke config file save when the file does not exist, which results in 'notmuch setup' always failing to create a new config file. Fix by checking ENOENT from realpath(3).
* cli: config: do not overwrite symlinks when saving config fileGravatar Jani Nikula2013-04-14
| | | | | | | Use realpath to canonicalize the config path before writing. Previously 'notmuch setup' and 'notmuch config set' overwrote the config file even if it was a symbolic link.
* cli: config: remove unnecessary braces from if blocksGravatar Jani Nikula2013-03-30
| | | | | Cosmetic change to drop unnecessary braces that don't even conform to the prevailing coding style.
* cli: move config open/close to main() from subcommandsGravatar Jani Nikula2013-03-08
| | | | | | | | | | | | | 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.
* cli: config: make notmuch_config_open() "is new" parameter input onlyGravatar Jani Nikula2013-03-07
| | | | | | | | 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.
* cli: config: keep track of whether the config is newly createdGravatar Jani Nikula2013-03-07
| | | | | | | | 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().
* fix line breaks in one comment paragraph in generated .notmuch-config fileGravatar Tomi Ollila2013-01-06
| | | | | | While one comment in generated .notmuch-config file looked good in the source file notmuch-config.c, the generated output was inconsistently wide -- even breaking the 80-column boundary.
* config: Add 'config list' commandGravatar Peter Wang2012-04-28
| | | | | | | | | | Add a command to list all configuration items with their associated values. One use is as follows: a MUA may prefer to store data in a central notmuch configuration file so that the data is accessible across different machines, e.g. an addressbook. The list command helps to implement features such as tab completion on the keys.
* config: Check 'config get' arity exactlyGravatar Peter Wang2012-04-28
| | | | | | Require that 'config get' is passed exactly one additional argument, instead of silently ignoring extra arguments. As a side-effect, produce more specific error messages for the 'config' command as a whole.
* config: Fix free in 'config get' implementation.Gravatar Peter Wang2012-04-24
| | | | | The array returned by g_key_file_get_string_list() should be freed with g_strfreev(), not free().
* Make exclusion visible againGravatar David Bremner2012-03-03
| | | | | | | | This reverts dfee0f9 man: remove search.exclude_tags from notmuch-config.1 for 0.12 e83409d NEWS: revert NEWS item for exclude tags for 0.12 e77b031 config: disable addition of exclude tags for 0.12
* config: disable addition of exclude tags for 0.12Gravatar Mark Walters2012-03-02
| | | | | This disables the addition of search_exclude_tags in notmuch-setup and notmuch-config.
* cli: update 'new.ignore' config file comment wrt file/directory matchingGravatar Pieter Praet2012-02-27
|
* add support for user-specified files & directories to ignoreGravatar Tomi Ollila2012-02-17
| | | | | | | | | 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"
* moved _config_(get|set)_list () functions earlier in the fileGravatar Tomi Ollila2012-01-30
| | | | | | Moved static functions _config_get_list () and _config_set_list () closer to the beginning of file so that their definition is known (without adding forward declarations) in upcoming changes.
* config: only exclude messages if 'search.exclude_tags' is explicitly setGravatar Pieter Praet2012-01-23
| | | | | | | | | | | | Currently, the 'search.exclude_tags' option is automatically set to "deleted;spam;" if it's missing from the config file. This violates the Principle of Least Surprise, so *only* set 'search.exclude_tags' to "deleted;spam;" if we didn't find a configuration file at all. This patch is actually Austin Clements' work: id:"20120117203211.GQ16740@mit.edu"
* search: rename auto_exclude_tags to {search, }exclude_tagsGravatar Pieter Praet2012-01-23
| | | | | | | 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.
* config: Better formatting for search section commentGravatar Austin Clements2012-01-20
| | | | | Since "auto_exclude_tags" is long and its description is multi-line, start the description on the next line and indent it consistently.
* search: Support automatic tag exclusionsGravatar Austin Clements2012-01-16
| | | | | | 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.
* cli: factor out config handling code to get/set lists.Gravatar David Bremner2011-12-12
| | | | | | 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.
* 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].
* fix sum moar typos [user-visible documentation in code]Gravatar Pieter Praet2011-06-23
| | | | | | | | | | | | 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 check of sysconf return in get_name/username_from_passwd_fileGravatar Matthias Guedemann2011-05-26
| | | | | | | 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.
* config: Fix confusing of "tag" and "flag" oin documentation.Gravatar Carl Worth2010-11-11
| | | | | It has been very difficult to get all of these right. I would not be surprised if I've still missed some.
* notmuch setup: Fix to add maildir group (with comment) to existing fileGravatar Carl Worth2010-11-11
| | | | | | | 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.
* Enable maildir synchronization by default.Gravatar Carl Worth2010-11-11
| | | | | This is a useful feature that most people should want, so enable it by default, (still allowing customization to disable it of course).
* notmuch config: Add more documentation for maildir.synchronize_flagsGravatar Carl Worth2010-11-11
| | | | Including details on which actual flags are synchronized with which tags.
* 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 config: Allow for new "notmuch config set" in addition to getGravatar Carl Worth2010-10-27
| | | | | | It is now possible to set configuration items from the command-line in a manner quite similar to the support for querying configuration items.
* notmuch config: Provide support for querying non-standard configuration values.Gravatar Carl Worth2010-10-27
| | | | | | 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).
* notmuch: Add a new "notmuch config" command for querying configuration.Gravatar Carl Worth2010-10-27
| | | | | So far, we implement only "notmuch config get". It won't be too much work from here to also implement "notmuch config set".
* Avoid segmentation fault with NOTMUCH_CONFIG=/new/config/file notmuch setupGravatar Carl Worth2010-07-19
| | | | | | | | | | | | | | | | | | | | | | | Since commit f41a35e2923b0b3ef2f66e91cd30e20b4c1a336a 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.
* config: Rename messages.new_tags to just new.tagsGravatar Carl Worth2010-04-23
| | | | | | 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.
* Clarify the documentation for the new_tags configuration option.Gravatar Carl Worth2010-04-23
| | | | | Specifically mentioning that it's a list separated by ';' and use "will" instead of "should".
* notmuch setup: Fix new configuration-file groups to get commentsGravatar Carl Worth2010-04-23
| | | | | | | | | | 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.
* Sprinkle some const-correctness around new_tags.Gravatar Carl Worth2010-04-23
| | | | To eliminate a compiler warning.
* notmuch-config: make new message tags configurableGravatar Ben Gamari2010-04-23
| | | | | | 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.
* notmuch: Abort if specified configuration file is not found.Gravatar Carl Worth2010-04-21
| | | | | | | | 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.
* * notmuch-config: fix small leak from 'g_key_file_to_data'Gravatar Dirk-Jan C. Binnema2009-12-04
| | | | Signed-off-by: Dirk-Jan C. Binnema <djcb.bulk@gmail.com>
* Support multiple configuration files via $NOTMUCH_CONFIGGravatar Alec Berryman2009-11-23
| | | | | If present, $NOTMUCH_CONFIG will be used as the configuration file location.
* notmuch-config: Fix memleaks.Gravatar Holger Freyther2009-11-22
| | | | | | | 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>