aboutsummaryrefslogtreecommitdiff
path: root/lib/notmuch.h
AgeCommit message (Collapse)Author
2026-02-16lib/config: add config keys for git-remote-notmuch.David Bremner
The precise function will be explained in a future update to notmuch-config(1).
2026-02-16Document that indexing does not sync flagsHugo Osvaldo Barrera
This quirk is somewhat unexpected, since flags won't be updated as expected, but subsequence calls to notmuch-new(1) won't update the index, giving an impression of it being stale.
2026-01-17lib: bump minor versionDavid Bremner
This reflects the addition of a new API functions, notmuch_{messages,threads}_status
2025-08-04lib: add notmuch_threads_status()Anton Khirnov
While a number of errors can happen when iterating over threads (DatabaseModifiedError, memory allocation errors, etc.), the API currently cannot signal them to the caller, and either triggers an internal error (aborting the caller) or returns NULL from notmuch_threads_get() with no information on what actually went wrong. Add a new public function notmuch_threads_status() - similar to previously added notmuch_messages_status() - that allows propagating those errors to the caller. Use this to remove the INTERNAL_ERROR() in _notmuch_thread_create() (triggered by T642). Fixes: https://github.com/pazz/alot/issues/1460 Amended-By: db. Resolved whitespace disagreement between emacs and uncrustify in favour of uncrustify.
2025-07-24lib: handle DatabaseModifiedError in _notmuch_message_createAnton Khirnov
If an open database is modified sufficiently by other callers, the open instance becomes invalid and operations on it throw DatabaseModifiedError. Per Xapian documentation, the caller is then supposed to reopen the database and restart the query. This exception is currently not handled in _notmuch_message_create(), leading to the default handler abort()ing the process. Catch this exception in _notmuch_message_create() and return an error instead of crashing. Since the entire query becomes invalid - including results that have already been read by the caller - this situation cannot be handled by libnotmuch transparently. A new public function - notmuch_messages_status() - is added to allow the callers to check whether the messages iterator was exhausted or terminated early due to a runtime error. This also allows memory allocation failure to be signalled to the caller. Amended-By: David Bremner <david@tethera.net> [replace use of notmuch_messages_valid]
2024-07-26config: allow custom separators in author listsLars Kotthoff
Allow distinguishing between commas separating authors and separating first and last names. Amended by db: reformat NEWS entry and commit message. Tweaked whitespace in lib/thread.cc.
2023-07-09doc/lib: clarify ownership for notmuch_database_get_revisionDavid Bremner
The ownership is implicit in the const declaration (I think!), but that does not show up in the doxygen generated API docs.
2023-04-02lib: add config key INDEX_AS_TEXTDavid Bremner
Higher level processing as a list of regular expressions and documentation will follow.
2023-02-27lib/notmuch: update exampleKevin Boulain
Likely missed in 86cbd215e, when notmuch_query_search_messages_st was renamed to notmuch_query_search_messages.
2023-02-20lib: add better diagnostics for over long filenames.David Bremner
Previously we just crashed with an internal error. With this change, the caller can handle it better. Update notmuch-new so that it doesn't crash with "unknown error code" because of this change.
2022-06-25lib: add NOTMUCH_STATUS_CLOSED_DATABASE, use in _n_d_ensure_writableDavid Bremner
In order for a database to actually be writeable, it must be the case that it is open, not just the correct type of Xapian object. By explicitely checking, we are able to provide better error reporting, in particular for the previously broken test in T566-lib-message.
2022-06-25lib/tag: handle NULL argument to notmuch_tags_validDavid Bremner
Make the behaviour when passed NULL consistent with notmuch_filenames_valid. The library already passes the result of notmuch_message_get_tags without checking for NULL, so it should be handled.
2022-01-29lib: bump minor version to 6.David Bremner
One new status value and one configuration value added.
2022-01-18lib/config: add known config key "show.extra_headers"David Bremner
Used in a following commit to enable including extra headers beyond the default in structured output.
2022-01-15lib/open: no default mail root in split configurationsDavid Bremner
If we know the configuration is split, but there is no mail root defined, this indicates a (lack of) configuration error. Currently this can only arise in XDG configurations.
2021-10-30Merge branch 'release'David Bremner
2021-10-30lib/load_config: document expectations for db on error, add testsDavid Bremner
This is a bit different than n_d_{open,create}_with_config, since there are several non-zero status codes where we do want to return a non-NULL database structure.
2021-10-30lib/create: document expectations for db on error, add testsDavid Bremner
It seems sensible to harmonize the behaviour with n_d_open_with_config. In this commit we just assert the desired behaviour.
2021-10-30lib: document n_o_w_config can return NOTMUCH_STATUS_NO_CONFIGDavid Bremner
This should be treated as fatal by callers, since we didn't succeed in opening a Xapian database.
2021-10-23lib: remove enum names from typedefsJani Nikula
There are some enum typedefs with the enum name: typedef enum _name_t { ... } name_t; We don't need or use the enum names _name_t for anything, and not all of the enum typedefs have them. We have the typedefs specifically to use the typedef name. Use the anonymous enum in the typedefs: typedef enum { ... } name_t;
2021-10-23lib: fix commented out NOTMUCH_DEPRECATED()Jani Nikula
Remove the comment markers from the placeholder NOTMUCH_DEPRECATED(), added in commit e5f3c3ed5024 ("lib: add stub for notmuch_database_open_with_config").
2021-10-15lib: bump lib minor version to 5David Bremner
One new function (and an enum) was added to the API/ABI.
2021-09-04lib: add new status code for query syntax errors.David Bremner
This will help provide more meaningful error messages without special casing on the client side.
2021-09-04lib: define notmuch_query_create_with_syntaxDavid Bremner
Set the parsing syntax when the (notmuch) query object is created. Initially the library always returns a trivial query that matches all messages when using s-expression syntax. It seems better to select the syntax at query creation time because the lazy parsing is an implementation detail.
2021-08-18Merge tag 'debian/0.32.3-1'David Bremner
notmuch release 0.32.3-1 for unstable (sid) [dgit] [dgit distro=debian no-split --quilt=linear]
2021-08-17lib: bump libnotmuch minor versionAustin Ray
Notmuch 0.32 corresponds to libnotmuch 5.4 as indicated by docstrings; however, the minor number wasn't bumped. Any libnotmuch downstream consumer using the LIBNOTMUCH_CHECK_VERSION macro to support multiple versions won't be able to access the new 5.4 functions. Signed-off-by: Austin Ray <austin@austinray.io>
2021-08-17lib: correct deprecated db open functions' docsAustin Ray
Both notmuch_database_open() and notmuch_database_open_verbose()'s documentation state they call notmuch_database_open_with_config() with config_path=NULL; however, their implementations pass an empty string. The empty string is the correct value to maintain their original behavior of not loading the user's configuration so their documentation is incorrect.
2021-06-27lib: update transaction documentationDavid Bremner
Partly this is to recognize the semantics we inherit from Xapian, partly to mention the new autocommit feature.
2021-06-27lib/config: add NOTMUCH_CONFIG_AUTOCOMMITDavid Bremner
This will be used to control how often atomic transactions are committed.
2021-03-27lib: provide notmuch_config_pathDavid Bremner
Since the library searches in several locations for a config file, the caller does not know which of these is chosen in the usual case of passing NULL as a config file. This changes provides an API for the caller to retrieve the name of the config file chosen. It will be tested in a following commit.
2021-03-27lib: add NOTMUCH_STATUS_NO_DATABASEDavid Bremner
This will allow more precise return values from various open related functions.
2021-03-27lib/config: add config_pairs iteratorsDavid Bremner
The layer of shims here seems a bit wasteful compared to just calling the corresponding string map functions directly, but it allows control over the API (calling with notmuch_database_t *) and flexibility for future changes.
2021-03-27lib/config: add notmuch_config_get_values_stringDavid Bremner
This is to support the less common (at least in the notmuch codebase) case of accessing a ;-delimited list config value with an arbitrary string key.
2021-03-27lib: provide notmuch_database_load_configDavid Bremner
This is mainly targetted at notmuch-config.c, or similar applications that don't necessarily need both a configuration file and a database to exist.
2021-03-20lib/config: add configuration variable for backup directoryDavid Bremner
Like the hook directory, we primarily need a way to communicate this directory between various components, but we may as well let the user configure it. Most of the diff is generalizing choose_hook_dir to work for both backup and hook directories.
2021-03-20lib: support splitting mail from database location.David Bremner
Introduce a new configuration value for the mail root, and use it to locate mail messages in preference to the database.path (which previously implied the mail messages were also in this location. Initially only a subset of the CLI is tested in a split configuration. Further changes will be needed for the remainder of the CLI to work in split configurations.
2021-03-18lib: support reopening databases for write access.David Bremner
In the future Xapian will apparently support this more conveniently for the cases other than READ_ONLY => READ_ONLY Conceptually this function seems to fit better in lib/open.cc; database.cc is still large enough that moving the function makes sense.
2021-03-18lib: publish API for notmuch_database_reopenDavid Bremner
Include the (currently unused) mode argument which will specify which mode to re-open the database in. Functionality and docs to be finalized in a followup commit.
2021-03-13lib: run uncrustifyuncrustify
This is the result of running $ uncrustify --replace --config ../devel/uncrustify.cfg *.c *.h *.cc in the lib directory
2021-02-06lib/config: add HOOK_DIRDavid Bremner
The hook directory configuration needs to be kept in synch with the other configuration information, so add scaffolding to support this at database opening time.
2021-02-06lib: introduce notmuch_database_create_with_configDavid Bremner
This takes a config path parameter, and can use that to decide the new database location.
2021-02-06lib: add NOTMUCH_STATUS_DATABASE_EXISTSDavid Bremner
It is desirable to distinguish between attempting to create a database that already exists, and more fatal errors like permission problems.
2021-02-06lib: add NOTMUCH_STATUS_NO_CONFIGDavid Bremner
This will allow client code to provide more meaningful diagnostics. In particular it will enable "notmuch new" to continue suggsting the user run "notmuch setup" to create a config after "notmuch new" is transitioned to the new configuration framework.
2021-02-06lib/config: add NOTMUCH_CONFIG_NEW_IGNOREDavid Bremner
This will be needed by (at least) the conversion of notmuch-new.c to the new config framework
2021-02-06lib: split notmuch_database_compactDavid Bremner
The "back end" function takes an open notmuch database, which should know its own path (i.e. the path needs to be cached in the configuration data).
2021-02-06lib: add notmuch_config_get_boolDavid Bremner
Booleans have no out of band values, so return a status for errors.
2021-02-06lib/config: make values iterators restartableDavid Bremner
This is relatively cheap, and makes it easier to transform existing code which uses arrays of pointers to store configuration lists.
2021-02-06lib/config: add config values iteratorDavid Bremner
This is intended to avoid duplicating the string splitting and traversal code for all clients of the config API.
2021-02-06lib/config: add notmuch_config_key_{get,set}David Bremner
By using an enum we can have better error detection than copy pasting key strings around. The question of what layer this belongs in is a bit tricky. Historically most of the keys are defined by the CLI. On the other hand features like excludes are supported in the library/bindings, and it makes sense to configure them from the library as well. The somewhat long prefix for notmuch_config_t is to avoid collisions with the existing usage in notmuch-client.h.
2021-02-06lib: add stub for notmuch_database_open_with_configDavid Bremner
Initially document the intended API and copy the code from notmuch_database_open_verbose. Most of the documented functionality is not there yet.