gmime-filter-reply.c \
hooks.c \
notmuch.c \
+ notmuch-client-init.c \
notmuch-compact.c \
notmuch-config.c \
notmuch-count.c \
+Notmuch 0.33 (UNRELEASED)
+=========================
+
+Emacs
+-----
+
+`notmuch` no longer sets `mail-user-agent` on load. To restore the
+previous behaviour of using notmuch to send mail by default, customize
+`mail-user-agent` to `notmuch-user-agent`.
+
+Vim
+---
+
+Respect excluded tags when showing a thread.
+
Notmuch 0.32.2 (UNRELEASED)
===========================
LIBNOTMUCH="../../lib/$(LINKER_NAME)" \
NOTMUCH_SRCDIR='$(NOTMUCH_SRCDIR)' \
$(RUBY) extconf.rb --vendor
- $(MAKE) -C $(dir)/ruby
+ $(MAKE) -C $(dir)/ruby CFLAGS="$(CFLAGS) -pipe -fno-plt -fPIC"
endif
python-cffi-bindings: lib/$(LINKER_NAME)
VALUE
notmuch_rb_database_alloc (VALUE klass)
{
- return Data_Wrap_Struct (klass, NULL, NULL, NULL);
+ return Data_Wrap_Notmuch_Object (klass, ¬much_rb_database_type, NULL);
}
/*
mode = NOTMUCH_DATABASE_MODE_READ_ONLY;
}
- Check_Type (self, T_DATA);
+ rb_check_typeddata (self, ¬much_rb_database_type);
if (create)
ret = notmuch_database_create (path, &database);
else
notmuch_rb_database_close (VALUE self)
{
notmuch_status_t ret;
- notmuch_database_t *db;
-
- Data_Get_Notmuch_Database (self, db);
- ret = notmuch_database_destroy (db);
- DATA_PTR (self) = NULL;
+ ret = notmuch_rb_object_destroy (self, ¬much_rb_database_type);
notmuch_rb_status_raise (ret);
return Qnil;
ret = notmuch_database_get_directory (db, path, &dir);
notmuch_rb_status_raise (ret);
if (dir)
- return Data_Wrap_Struct (notmuch_rb_cDirectory, NULL, NULL, dir);
+ return Data_Wrap_Notmuch_Object (notmuch_rb_cDirectory, ¬much_rb_directory_type, dir);
return Qnil;
}
ret = notmuch_database_index_file (db, path, NULL, &message);
notmuch_rb_status_raise (ret);
- return rb_assoc_new (Data_Wrap_Struct (notmuch_rb_cMessage, NULL, NULL, message),
+ return rb_assoc_new (Data_Wrap_Notmuch_Object (notmuch_rb_cMessage, ¬much_rb_message_type, message),
(ret == NOTMUCH_STATUS_DUPLICATE_MESSAGE_ID) ? Qtrue : Qfalse);
}
notmuch_rb_status_raise (ret);
if (message)
- return Data_Wrap_Struct (notmuch_rb_cMessage, NULL, NULL, message);
+ return Data_Wrap_Notmuch_Object (notmuch_rb_cMessage, ¬much_rb_message_type, message);
return Qnil;
}
notmuch_rb_status_raise (ret);
if (message)
- return Data_Wrap_Struct (notmuch_rb_cMessage, NULL, NULL, message);
+ return Data_Wrap_Notmuch_Object (notmuch_rb_cMessage, ¬much_rb_message_type, message);
return Qnil;
}
rb_raise (notmuch_rb_eBaseError, "%s", msg);
}
- return Data_Wrap_Struct (notmuch_rb_cTags, NULL, NULL, tags);
+ return Data_Wrap_Notmuch_Object (notmuch_rb_cTags, ¬much_rb_tags_type, tags);
}
/*
if (!query)
rb_raise (notmuch_rb_eMemoryError, "Out of memory");
- return Data_Wrap_Struct (notmuch_rb_cQuery, NULL, NULL, query);
+ return Data_Wrap_Notmuch_Object (notmuch_rb_cQuery, ¬much_rb_query_type, query);
}
# define RSTRING_PTR(v) (RSTRING((v))->ptr)
#endif /* !defined (RSTRING_PTR) */
-#define Data_Get_Notmuch_Database(obj, ptr) \
- do { \
- Check_Type ((obj), T_DATA); \
- if (DATA_PTR ((obj)) == NULL) \
- rb_raise (rb_eRuntimeError, "database closed"); \
- Data_Get_Struct ((obj), notmuch_database_t, (ptr)); \
+extern const rb_data_type_t notmuch_rb_object_type;
+extern const rb_data_type_t notmuch_rb_database_type;
+extern const rb_data_type_t notmuch_rb_directory_type;
+extern const rb_data_type_t notmuch_rb_filenames_type;
+extern const rb_data_type_t notmuch_rb_query_type;
+extern const rb_data_type_t notmuch_rb_threads_type;
+extern const rb_data_type_t notmuch_rb_thread_type;
+extern const rb_data_type_t notmuch_rb_messages_type;
+extern const rb_data_type_t notmuch_rb_message_type;
+extern const rb_data_type_t notmuch_rb_tags_type;
+
+#define Data_Get_Notmuch_Object(obj, type, ptr) \
+ do { \
+ (ptr) = rb_check_typeddata ((obj), (type)); \
+ if (RB_UNLIKELY (!(ptr))) { \
+ VALUE cname = rb_class_name (CLASS_OF ((obj))); \
+ rb_raise (rb_eRuntimeError, "%"PRIsVALUE" object destroyed", cname); \
+ } \
} while (0)
-#define Data_Get_Notmuch_Directory(obj, ptr) \
- do { \
- Check_Type ((obj), T_DATA); \
- if (DATA_PTR ((obj)) == NULL) \
- rb_raise (rb_eRuntimeError, "directory destroyed"); \
- Data_Get_Struct ((obj), notmuch_directory_t, (ptr)); \
- } while (0)
+#define Data_Wrap_Notmuch_Object(klass, type, ptr) \
+ TypedData_Wrap_Struct ((klass), (type), (ptr))
-#define Data_Get_Notmuch_FileNames(obj, ptr) \
- do { \
- Check_Type ((obj), T_DATA); \
- if (DATA_PTR ((obj)) == NULL) \
- rb_raise (rb_eRuntimeError, "filenames destroyed"); \
- Data_Get_Struct ((obj), notmuch_filenames_t, (ptr)); \
- } while (0)
+#define Data_Get_Notmuch_Database(obj, ptr) \
+ Data_Get_Notmuch_Object ((obj), ¬much_rb_database_type, (ptr))
-#define Data_Get_Notmuch_Query(obj, ptr) \
- do { \
- Check_Type ((obj), T_DATA); \
- if (DATA_PTR ((obj)) == NULL) \
- rb_raise (rb_eRuntimeError, "query destroyed"); \
- Data_Get_Struct ((obj), notmuch_query_t, (ptr)); \
- } while (0)
+#define Data_Get_Notmuch_Directory(obj, ptr) \
+ Data_Get_Notmuch_Object ((obj), ¬much_rb_directory_type, (ptr))
-#define Data_Get_Notmuch_Threads(obj, ptr) \
- do { \
- Check_Type ((obj), T_DATA); \
- if (DATA_PTR ((obj)) == NULL) \
- rb_raise (rb_eRuntimeError, "threads destroyed"); \
- Data_Get_Struct ((obj), notmuch_threads_t, (ptr)); \
- } while (0)
+#define Data_Get_Notmuch_FileNames(obj, ptr) \
+ Data_Get_Notmuch_Object ((obj), ¬much_rb_filenames_type, (ptr))
-#define Data_Get_Notmuch_Messages(obj, ptr) \
- do { \
- Check_Type ((obj), T_DATA); \
- if (DATA_PTR ((obj)) == NULL) \
- rb_raise (rb_eRuntimeError, "messages destroyed"); \
- Data_Get_Struct ((obj), notmuch_messages_t, (ptr)); \
- } while (0)
+#define Data_Get_Notmuch_Query(obj, ptr) \
+ Data_Get_Notmuch_Object ((obj), ¬much_rb_query_type, (ptr))
-#define Data_Get_Notmuch_Thread(obj, ptr) \
- do { \
- Check_Type ((obj), T_DATA); \
- if (DATA_PTR ((obj)) == NULL) \
- rb_raise (rb_eRuntimeError, "thread destroyed"); \
- Data_Get_Struct ((obj), notmuch_thread_t, (ptr)); \
- } while (0)
+#define Data_Get_Notmuch_Threads(obj, ptr) \
+ Data_Get_Notmuch_Object ((obj), ¬much_rb_threads_type, (ptr))
-#define Data_Get_Notmuch_Message(obj, ptr) \
- do { \
- Check_Type ((obj), T_DATA); \
- if (DATA_PTR ((obj)) == NULL) \
- rb_raise (rb_eRuntimeError, "message destroyed"); \
- Data_Get_Struct ((obj), notmuch_message_t, (ptr)); \
- } while (0)
+#define Data_Get_Notmuch_Messages(obj, ptr) \
+ Data_Get_Notmuch_Object ((obj), ¬much_rb_messages_type, (ptr))
-#define Data_Get_Notmuch_Tags(obj, ptr) \
- do { \
- Check_Type ((obj), T_DATA); \
- if (DATA_PTR ((obj)) == NULL) \
- rb_raise (rb_eRuntimeError, "tags destroyed"); \
- Data_Get_Struct ((obj), notmuch_tags_t, (ptr)); \
- } while (0)
+#define Data_Get_Notmuch_Thread(obj, ptr) \
+ Data_Get_Notmuch_Object ((obj), ¬much_rb_thread_type, (ptr))
+
+#define Data_Get_Notmuch_Message(obj, ptr) \
+ Data_Get_Notmuch_Object ((obj), ¬much_rb_message_type, (ptr))
+
+#define Data_Get_Notmuch_Tags(obj, ptr) \
+ Data_Get_Notmuch_Object ((obj), ¬much_rb_tags_type, (ptr))
+
+static inline notmuch_status_t
+notmuch_rb_object_destroy (VALUE rb_object, const rb_data_type_t *type)
+{
+ void *nm_object;
+ notmuch_status_t ret;
+
+ Data_Get_Notmuch_Object (rb_object, type, nm_object);
+
+ /* Call the corresponding notmuch_*_destroy function */
+ ret = ((notmuch_status_t (*)(void *)) type->data) (nm_object);
+ DATA_PTR (rb_object) = NULL;
+
+ return ret;
+}
/* status.c */
void
VALUE
notmuch_rb_directory_destroy (VALUE self)
{
- notmuch_directory_t *dir;
-
- Data_Get_Struct (self, notmuch_directory_t, dir);
-
- notmuch_directory_destroy (dir);
- DATA_PTR (self) = NULL;
+ notmuch_rb_object_destroy (self, ¬much_rb_directory_type);
return Qnil;
}
fnames = notmuch_directory_get_child_files (dir);
- return Data_Wrap_Struct (notmuch_rb_cFileNames, NULL, NULL, fnames);
+ return Data_Wrap_Notmuch_Object (notmuch_rb_cFileNames, ¬much_rb_filenames_type, fnames);
}
/*
fnames = notmuch_directory_get_child_directories (dir);
- return Data_Wrap_Struct (notmuch_rb_cFileNames, NULL, NULL, fnames);
+ return Data_Wrap_Notmuch_Object (notmuch_rb_cFileNames, ¬much_rb_filenames_type, fnames);
}
VALUE
notmuch_rb_filenames_destroy (VALUE self)
{
- notmuch_filenames_t *fnames;
-
- Data_Get_Notmuch_FileNames (self, fnames);
-
- notmuch_filenames_destroy (fnames);
- DATA_PTR (self) = NULL;
+ notmuch_rb_object_destroy (self, ¬much_rb_filenames_type);
return Qnil;
}
ID ID_db_create;
ID ID_db_mode;
+const rb_data_type_t notmuch_rb_object_type = {
+ .wrap_struct_name = "notmuch_object",
+};
+
+#define define_type(id) \
+ const rb_data_type_t notmuch_rb_ ## id ## _type = { \
+ .wrap_struct_name = "notmuch_" #id, \
+ .parent = ¬much_rb_object_type, \
+ .data = ¬much_ ## id ## _destroy, \
+ }
+
+define_type (database);
+define_type (directory);
+define_type (filenames);
+define_type (query);
+define_type (threads);
+define_type (thread);
+define_type (messages);
+define_type (message);
+define_type (tags);
+
/*
* Document-module: Notmuch
*
* Maximum allowed length of a tag
*/
rb_define_const (mod, "TAG_MAX", INT2FIX (NOTMUCH_TAG_MAX));
+ /*
+ * Document-const: Notmuch::EXCLUDE_FLAG
+ *
+ * Only flag excluded results
+ */
+ rb_define_const (mod, "EXCLUDE_FLAG", INT2FIX (NOTMUCH_EXCLUDE_FLAG));
+ /*
+ * Document-const: Notmuch::EXCLUDE_TRUE
+ *
+ * Exclude messages from the results
+ */
+ rb_define_const (mod, "EXCLUDE_TRUE", INT2FIX (NOTMUCH_EXCLUDE_TRUE));
+ /*
+ * Document-const: Notmuch::EXCLUDE_FALSE
+ *
+ * Don't exclude anything
+ */
+ rb_define_const (mod, "EXCLUDE_FALSE", INT2FIX (NOTMUCH_EXCLUDE_FALSE));
+ /*
+ * Document-const: Notmuch::EXCLUDE_ALL
+ *
+ * Exclude all results
+ */
+ rb_define_const (mod, "EXCLUDE_ALL", INT2FIX (NOTMUCH_EXCLUDE_ALL));
/*
* Document-class: Notmuch::BaseError
VALUE
notmuch_rb_message_destroy (VALUE self)
{
- notmuch_message_t *message;
-
- Data_Get_Notmuch_Message (self, message);
-
- notmuch_message_destroy (message);
- DATA_PTR (self) = NULL;
+ notmuch_rb_object_destroy (self, ¬much_rb_message_type);
return Qnil;
}
messages = notmuch_message_get_replies (message);
- return Data_Wrap_Struct (notmuch_rb_cMessages, NULL, NULL, messages);
+ return Data_Wrap_Notmuch_Object (notmuch_rb_cMessages, ¬much_rb_messages_type, messages);
}
/*
fnames = notmuch_message_get_filenames (message);
- return Data_Wrap_Struct (notmuch_rb_cFileNames, NULL, NULL, fnames);
+ return Data_Wrap_Notmuch_Object (notmuch_rb_cFileNames, ¬much_rb_filenames_type, fnames);
}
/*
if (!tags)
rb_raise (notmuch_rb_eMemoryError, "Out of memory");
- return Data_Wrap_Struct (notmuch_rb_cTags, NULL, NULL, tags);
+ return Data_Wrap_Notmuch_Object (notmuch_rb_cTags, ¬much_rb_tags_type, tags);
}
/*
VALUE
notmuch_rb_messages_destroy (VALUE self)
{
- notmuch_messages_t *messages;
-
- Data_Get_Notmuch_Messages (self, messages);
-
- notmuch_messages_destroy (messages);
- DATA_PTR (self) = NULL;
+ notmuch_rb_object_destroy (self, ¬much_rb_messages_type);
return Qnil;
}
for (; notmuch_messages_valid (messages); notmuch_messages_move_to_next (messages)) {
message = notmuch_messages_get (messages);
- rb_yield (Data_Wrap_Struct (notmuch_rb_cMessage, NULL, NULL, message));
+ rb_yield (Data_Wrap_Notmuch_Object (notmuch_rb_cMessage, ¬much_rb_message_type, message));
}
return self;
if (!tags)
rb_raise (notmuch_rb_eMemoryError, "Out of memory");
- return Data_Wrap_Struct (notmuch_rb_cTags, NULL, NULL, tags);
+ return Data_Wrap_Notmuch_Object (notmuch_rb_cTags, ¬much_rb_tags_type, tags);
}
VALUE
notmuch_rb_query_destroy (VALUE self)
{
- notmuch_query_t *query;
-
- Data_Get_Notmuch_Query (self, query);
-
- notmuch_query_destroy (query);
- DATA_PTR (self) = NULL;
+ notmuch_rb_object_destroy (self, ¬much_rb_query_type);
return Qnil;
}
}
/*
- * call-seq: QUERY.omit_excluded=(boolean) => nil
+ * call-seq: QUERY.omit_excluded=(fixnum) => nil
*
* Specify whether to omit excluded results or simply flag them.
- * By default, this is set to +true+.
+ * By default, this is set to +Notmuch::EXCLUDE_TRUE+.
*/
VALUE
notmuch_rb_query_set_omit_excluded (VALUE self, VALUE omitv)
{
notmuch_query_t *query;
+ notmuch_exclude_t value;
Data_Get_Notmuch_Query (self, query);
- notmuch_query_set_omit_excluded (query, RTEST (omitv));
+ value = FIXNUM_P (omitv) ? FIX2UINT (omitv) : RTEST(omitv);
+ notmuch_query_set_omit_excluded (query, value);
return Qnil;
}
if (status)
notmuch_rb_status_raise (status);
- return Data_Wrap_Struct (notmuch_rb_cThreads, NULL, NULL, threads);
+ return Data_Wrap_Notmuch_Object (notmuch_rb_cThreads, ¬much_rb_threads_type, threads);
}
/*
if (status)
notmuch_rb_status_raise (status);
- return Data_Wrap_Struct (notmuch_rb_cMessages, NULL, NULL, messages);
+ return Data_Wrap_Notmuch_Object (notmuch_rb_cMessages, ¬much_rb_messages_type, messages);
}
/*
VALUE
notmuch_rb_tags_destroy (VALUE self)
{
- notmuch_tags_t *tags;
-
- Data_Get_Notmuch_Tags (self, tags);
-
- notmuch_tags_destroy (tags);
- DATA_PTR (self) = NULL;
+ notmuch_rb_object_destroy (self, ¬much_rb_tags_type);
return Qnil;
}
VALUE
notmuch_rb_thread_destroy (VALUE self)
{
- notmuch_thread_t *thread;
-
- Data_Get_Notmuch_Thread (self, thread);
-
- notmuch_thread_destroy (thread);
- DATA_PTR (self) = NULL;
+ notmuch_rb_object_destroy (self, ¬much_rb_thread_type);
return Qnil;
}
if (!messages)
rb_raise (notmuch_rb_eMemoryError, "Out of memory");
- return Data_Wrap_Struct (notmuch_rb_cMessages, NULL, NULL, messages);
+ return Data_Wrap_Notmuch_Object (notmuch_rb_cMessages, ¬much_rb_messages_type, messages);
}
/*
if (!messages)
rb_raise (notmuch_rb_eMemoryError, "Out of memory");
- return Data_Wrap_Struct (notmuch_rb_cMessages, NULL, NULL, messages);
+ return Data_Wrap_Notmuch_Object (notmuch_rb_cMessages, ¬much_rb_messages_type, messages);
}
/*
if (!tags)
rb_raise (notmuch_rb_eMemoryError, "Out of memory");
- return Data_Wrap_Struct (notmuch_rb_cTags, NULL, NULL, tags);
+ return Data_Wrap_Notmuch_Object (notmuch_rb_cTags, ¬much_rb_tags_type, tags);
}
VALUE
notmuch_rb_threads_destroy (VALUE self)
{
- notmuch_threads_t *threads;
-
- Data_Get_Struct (self, notmuch_threads_t, threads);
-
- notmuch_threads_destroy (threads);
- DATA_PTR (self) = NULL;
+ notmuch_rb_object_destroy (self, ¬much_rb_threads_type);
return Qnil;
}
for (; notmuch_threads_valid (threads); notmuch_threads_move_to_next (threads)) {
thread = notmuch_threads_get (threads);
- rb_yield (Data_Wrap_Struct (notmuch_rb_cThread, NULL, NULL, thread));
+ rb_yield (Data_Wrap_Notmuch_Object (notmuch_rb_cThread, ¬much_rb_thread_type, thread));
}
return self;
# Despite the name, this actually affects manual pages as well.
html_use_smartypants = False
+# See:
+# - https://www.sphinx-doc.org/en/master/usage/configuration.html#confval-manpages_url
+# - https://manpages.debian.org/
+manpages_url = 'https://manpages.debian.org/{page}.{section}.html'
+
# -- Options for manual page output ---------------------------------------
# One entry per manual page. List of tuples
+.. _notmuch-address(1):
+
===============
notmuch-address
===============
Search for messages matching the given search terms, and display the
addresses from them. Duplicate addresses are filtered out.
-See **notmuch-search-terms(7)** for details of the supported syntax for
+See :any:`notmuch-search-terms(7)` for details of the supported syntax for
<search-terms>.
Supported options for **address** include
-``--format=``\ (**json**\ \|\ **sexp**\ \|\ **text**\ \|\ **text0**)
- Presents the results in either JSON, S-Expressions, newline
- character separated plain-text (default), or null character
- separated plain-text (compatible with **xargs(1)** -0 option where
- available).
-
-``--format-version=N``
- Use the specified structured output format version. This is
- intended for programs that invoke **notmuch(1)** internally. If
- omitted, the latest supported version will be used.
-
-``--output=(sender|recipients|count|address)``
- Controls which information appears in the output. This option can
- be given multiple times to combine different outputs. When
- neither ``--output=sender`` nor ``--output=recipients`` is
- given, ``--output=sender`` is implied.
-
- **sender**
- Output all addresses from the *From* header.
-
- Note: Searching for **sender** should be much faster than
- searching for **recipients**, because sender addresses are
- cached directly in the database whereas other addresses need
- to be fetched from message files.
-
- **recipients**
- Output all addresses from the *To*, *Cc* and *Bcc* headers.
-
- **count**
- Print the count of how many times was the address encountered
- during search.
-
- Note: With this option, addresses are printed only after the
- whole search is finished. This may take long time.
-
- **address**
- Output only the email addresses instead of the full mailboxes
- with names and email addresses. This option has no effect on
- the JSON or S-Expression output formats.
-
-``--deduplicate=(no|mailbox|address)``
- Control the deduplication of results.
-
- **no**
- Output all occurrences of addresses in the matching
- messages. This is not applicable with ``--output=count``.
-
- **mailbox**
- Deduplicate addresses based on the full, case sensitive name
- and email address, or mailbox. This is effectively the same as
- piping the ``--deduplicate=no`` output to **sort | uniq**, except
- for the order of results. This is the default.
-
- **address**
- Deduplicate addresses based on the case insensitive address
- part of the mailbox. Of all the variants (with different name
- or case), print the one occurring most frequently among the
- matching messages. If ``--output=count`` is specified, include all
- variants in the count.
-
-``--sort=``\ (**newest-first**\ \|\ **oldest-first**)
- This option can be used to present results in either chronological
- order (**oldest-first**) or reverse chronological order
- (**newest-first**).
-
- By default, results will be displayed in reverse chronological
- order, (that is, the newest results will be displayed first).
-
- However, if either ``--output=count`` or ``--deduplicate=address`` is
- specified, this option is ignored and the order of the results is
- unspecified.
-
-``--exclude=(true|false)``
- A message is called "excluded" if it matches at least one tag in
- search.exclude\_tags that does not appear explicitly in the search
- terms. This option specifies whether to omit excluded messages in
- the search process.
-
- The default value, **true**, prevents excluded messages from
- matching the search terms.
-
- **false** allows excluded messages to match search terms and
- appear in displayed results.
+.. program:: address
+
+.. option:: --format=(json|sexp|text|text0)
+
+ Presents the results in either JSON, S-Expressions, newline
+ character separated plain-text (default), or null character
+ separated plain-text (compatible with :manpage:`xargs(1)` -0
+ option where available).
+
+.. option:: --format-version=N
+
+ Use the specified structured output format version. This is
+ intended for programs that invoke :any:`notmuch(1)` internally. If
+ omitted, the latest supported version will be used.
+
+.. option:: --output=(sender|recipients|count|address)
+
+ Controls which information appears in the output. This option can
+ be given multiple times to combine different outputs. When
+ neither ``--output=sender`` nor ``--output=recipients`` is
+ given, ``--output=sender`` is implied.
+
+ **sender**
+ Output all addresses from the *From* header.
+
+ Note: Searching for **sender** should be much faster than
+ searching for **recipients**, because sender addresses are
+ cached directly in the database whereas other addresses need
+ to be fetched from message files.
+
+ **recipients**
+ Output all addresses from the *To*, *Cc* and *Bcc* headers.
+
+ **count**
+ Print the count of how many times was the address encountered
+ during search.
+
+ Note: With this option, addresses are printed only after the
+ whole search is finished. This may take long time.
+
+ **address**
+ Output only the email addresses instead of the full mailboxes
+ with names and email addresses. This option has no effect on
+ the JSON or S-Expression output formats.
+
+.. option:: --deduplicate=(no|mailbox|address)
+
+ Control the deduplication of results.
+
+ **no**
+ Output all occurrences of addresses in the matching
+ messages. This is not applicable with ``--output=count``.
+
+ **mailbox**
+ Deduplicate addresses based on the full, case sensitive name
+ and email address, or mailbox. This is effectively the same as
+ piping the ``--deduplicate=no`` output to **sort | uniq**, except
+ for the order of results. This is the default.
+
+ **address**
+ Deduplicate addresses based on the case insensitive address
+ part of the mailbox. Of all the variants (with different name
+ or case), print the one occurring most frequently among the
+ matching messages. If ``--output=count`` is specified, include all
+ variants in the count.
+
+.. option:: --sort=(newest-first|oldest-first)
+
+ This option can be used to present results in either chronological
+ order (**oldest-first**) or reverse chronological order
+ (**newest-first**).
+
+ By default, results will be displayed in reverse chronological
+ order, (that is, the newest results will be displayed first).
+
+ However, if either ``--output=count`` or ``--deduplicate=address`` is
+ specified, this option is ignored and the order of the results is
+ unspecified.
+
+.. option:: --exclude=(true|false)
+
+ A message is called "excluded" if it matches at least one tag in
+ search.exclude\_tags that does not appear explicitly in the search
+ terms. This option specifies whether to omit excluded messages in
+ the search process.
+
+ The default value, **true**, prevents excluded messages from
+ matching the search terms.
+
+ **false** allows excluded messages to match search terms and
+ appear in displayed results.
EXIT STATUS
===========
SEE ALSO
========
-**notmuch(1)**,
-**notmuch-config(1)**,
-**notmuch-count(1)**,
-**notmuch-dump(1)**,
-**notmuch-hooks(5)**,
-**notmuch-insert(1)**,
-**notmuch-new(1)**,
-**notmuch-reply(1)**,
-**notmuch-restore(1)**,
-**notmuch-search-terms(7)**,
-**notmuch-show(1)**,
-**notmuch-tag(1)**,
-**notmuch-search(1)**
+:any:`notmuch(1)`,
+:any:`notmuch-config(1)`,
+:any:`notmuch-count(1)`,
+:any:`notmuch-dump(1)`,
+:any:`notmuch-hooks(5)`,
+:any:`notmuch-insert(1)`,
+:any:`notmuch-new(1)`,
+:any:`notmuch-reply(1)`,
+:any:`notmuch-restore(1)`,
+:any:`notmuch-search(1)`,
+:any:`notmuch-search-terms(7)`,
+:any:`notmuch-show(1)`,
+:any:`notmuch-tag(1)`
+.. _notmuch-compact(1):
+
===============
notmuch-compact
===============
Supported options for **compact** include
-``--backup=``\ <directory>
- Save the current database to the given directory before replacing
- it with the compacted database. The backup directory must not
- exist and it must reside on the same mounted filesystem as the
- current database.
+.. program:: compact
-``--quiet``
- Do not report database compaction progress to stdout.
+.. option:: --backup=<directory>
-ENVIRONMENT
-===========
+ Save the current database to the given directory before replacing
+ it with the compacted database. The backup directory must not
+ exist and it must reside on the same mounted filesystem as the
+ current database.
-The following environment variables can be used to control the behavior
-of notmuch.
+.. option:: --quiet
-**NOTMUCH\_CONFIG**
- Specifies the location of the notmuch configuration file. Notmuch
- will use ${HOME}/.notmuch-config if this variable is not set.
+ Do not report database compaction progress to stdout.
SEE ALSO
========
-**notmuch(1)**,
-**notmuch-count(1)**,
-**notmuch-dump(1)**,
-**notmuch-hooks(5)**,
-**notmuch-insert(1)**,
-**notmuch-new(1)**,
-**notmuch-reply(1)**,
-**notmuch-restore(1)**,
-**notmuch-search(1)**,
-**notmuch-search-terms(7)**,
-**notmuch-show(1)**,
-**notmuch-tag(1)**
+:any:`notmuch(1)`,
+:any:`notmuch-count(1)`,
+:any:`notmuch-dump(1)`,
+:any:`notmuch-hooks(5)`,
+:any:`notmuch-insert(1)`,
+:any:`notmuch-new(1)`,
+:any:`notmuch-reply(1)`,
+:any:`notmuch-restore(1)`,
+:any:`notmuch-search(1)`,
+:any:`notmuch-search-terms(7)`,
+:any:`notmuch-show(1)`,
+:any:`notmuch-tag(1)`
+.. _notmuch-config(1):
+
==============
notmuch-config
==============
The **config** command can be used to get or set settings in the notmuch
configuration file and corresponding database.
-**get**
- The value of the specified configuration item is printed to
- stdout. If the item has multiple values (it is a list), each value
- is separated by a newline character.
+.. program:: config
+
+.. option:: get
+
+ The value of the specified configuration item is printed to
+ stdout. If the item has multiple values (it is a list), each value
+ is separated by a newline character.
+
+.. option:: set
-**set**
- The specified configuration item is set to the given value. To
- specify a multiple-value item (a list), provide each value as a
- separate command-line argument.
+ The specified configuration item is set to the given value. To
+ specify a multiple-value item (a list), provide each value as a
+ separate command-line argument.
- If no values are provided, the specified configuration item will
- be removed from the configuration file.
+ If no values are provided, the specified configuration item will
+ be removed from the configuration file.
- With the `--database` option, updates configuration metadata
- stored in the database, rather than the default (text)
- configuration file.
+ With the `--database` option, updates configuration metadata
+ stored in the database, rather than the default (text)
+ configuration file.
-**list**
- Every configuration item is printed to stdout, each on a separate
- line of the form::
+.. option:: list
- section.item=value
+ Every configuration item is printed to stdout, each on a separate
+ line of the form::
- No additional whitespace surrounds the dot or equals sign
- characters. In a multiple-value item (a list), the values are
- separated by semicolon characters.
+ section.item=value
+
+ No additional whitespace surrounds the dot or equals sign
+ characters. In a multiple-value item (a list), the values are
+ separated by semicolon characters.
The available configuration items are described below. Non-absolute
paths are presumed relative to `$HOME` for items in section
**database.hook_dir**
Directory containing hooks run by notmuch commands. See
- **notmuch-hooks(5)**.
+ :any:`notmuch-hooks(5)`.
**user.name**
Your full name.
**new.ignore**
A list to specify files and directories that will not be searched
- for messages by **notmuch new**. Each entry in the list is either:
+ for messages by :any:`notmuch-new(1)`. Each entry in the list is either:
A file or a directory name, without path, that will be ignored,
regardless of the location in the mail store directory hierarchy.
default. Using an excluded tag in a query will override that
exclusion.
- Default: empty list. Note that **notmuch-setup(1)** puts
+ Default: empty list. Note that :any:`notmuch-setup(1)` puts
``deleted;spam`` here when creating new configuration file.
**maildir.synchronize\_flags**
| S | unread (added when 'S' flag is not present) |
+--------+-----------------------------------------------+
- The **notmuch new** command will notice flag changes in filenames
- and update tags, while the **notmuch tag** and **notmuch restore**
- commands will notice tag changes and update flags in filenames.
+ The :any:`notmuch-new(1)` command will notice flag changes in
+ filenames and update tags, while the :any:`notmuch-tag(1)` and
+ :any:`notmuch-restore(1)` commands will notice tag changes and
+ update flags in filenames.
If there have been any changes in the maildir (new messages added,
old ones removed or renamed, maildir flags changed, etc.), it is
- advisable to run **notmuch new** before **notmuch tag** or
- **notmuch restore** commands to ensure the tag changes are
- properly synchronized to the maildir flags, as the commands expect
- the database and maildir to be in sync.
+ advisable to run :any:`notmuch-new(1)` before
+ :any:`notmuch-tag(1)` or :any:`notmuch-restore(1)` commands to
+ ensure the tag changes are properly synchronized to the maildir
+ flags, as the commands expect the database and maildir to be in
+ sync.
Default: ``true``.
``nostash`` is the same as ``true`` except that it will not stash
newly-discovered session keys in the database.
- From the command line (i.e. during **notmuch-new(1)**,
- **notmuch-insert(1)**, or **notmuch-reindex(1)**), the user can
+ From the command line (i.e. during :any:`notmuch-new(1)`,
+ :any:`notmuch-insert(1)`, or :any:`notmuch-reindex(1)`), the user can
override the database's stored decryption policy with the
``--decrypt=`` option.
Stashed session keys are kept in the database as properties
associated with the message. See ``session-key`` in
- **notmuch-properties(7)** for more details about how they can be
+ :any:`notmuch-properties(7)` for more details about how they can be
useful.
Be aware that the notmuch index is likely sufficient (and a
prefix ``List:`` that searches the ``List-Id`` field. User
defined prefixes must not start with 'a'...'z'; in particular
adding a prefix with same name as a predefined prefix is not
- supported. See **notmuch-search-terms(7)** for a list of existing
+ supported. See :any:`notmuch-search-terms(7)` for a list of existing
prefixes, and an explanation of probabilistic prefixes.
**built_with.<name>**
**query.<name>**
Expansion for named query called <name>. See
- **notmuch-search-terms(7)** for more information about named
+ :any:`notmuch-search-terms(7)` for more information about named
queries.
-ENVIRONMENT
-===========
-
-The following environment variables can be used to control the behavior
-of notmuch.
-
-**NOTMUCH\_CONFIG**
- Specifies the location of the notmuch configuration file.
-
-**NOTMUCH_PROFILE**
- Selects among notmuch configurations.
-
FILES
=====
CONFIGURATION
-------------
-If ``NOTMUCH_CONFIG`` is unset, notmuch tries (in order)
+Notmuch configuration file search order:
+
+1. File specified by :option:`notmuch --config` global option; see
+ :any:`notmuch(1)`.
+
+2. File specified by :envvar:`NOTMUCH_CONFIG` environment variable.
-- ``$XDG_CONFIG_HOME/notmuch/<profile>/config`` where ``<profile>`` is
- defined by ``$NOTMUCH_PROFILE`` or "default"
-- ``${HOME}/.notmuch-config<profile>`` where ``<profile>`` is
- ``.$NOTMUCH_PROFILE`` or ""
+3. ``$XDG_CONFIG_HOME/notmuch/<profile>/config`` where ``<profile>``
+ is defined by :envvar:`NOTMUCH_PROFILE` environment variable if
+ set, ``$XDG_CONFIG_HOME/notmuch/default/config`` otherwise.
+
+4. ``$HOME/.notmuch-config.<profile>`` where ``<profile>`` is defined
+ by :envvar:`NOTMUCH_PROFILE` environment variable if set,
+ ``$HOME/.notmuch-config`` otherwise.
Hooks
-----
-If ``database.hook_dir`` is unset, notmuch tries (in order)
+Notmuch hook directory search order:
+
+1. Directory specified by ``database.hook_dir`` configuration option.
+
+2. ``$XDG_CONFIG_HOME/notmuch/<profile>/hooks`` where ``<profile>``
+ is defined by :envvar:`NOTMUCH_PROFILE` environment variable if
+ set, ``$XDG_CONFIG_HOME/notmuch/default/hooks`` otherwise.
-- ``$XDG_CONFIG_HOME/notmuch/<profile>/hooks`` where ``<profile>`` is
- defined by ``$NOTMUCH_PROFILE`` or "default"
-- ``<database.path>/.notmuch/hooks``
+3. ``<database.path>/.notmuch/hooks``
SEE ALSO
========
-**notmuch(1)**,
-**notmuch-count(1)**,
-**notmuch-dump(1)**,
-**notmuch-hooks(5)**,
-**notmuch-insert(1)**,
-**notmuch-new(1)**,
-**notmuch-reply(1)**,
-**notmuch-restore(1)**,
-**notmuch-search(1)**,
-**notmuch-search-terms(7)**,
-**notmuch-properties(7)**,
-**notmuch-show(1)**,
-**notmuch-tag(1)**
+:any:`notmuch(1)`,
+:any:`notmuch-count(1)`,
+:any:`notmuch-dump(1)`,
+:any:`notmuch-hooks(5)`,
+:any:`notmuch-insert(1)`,
+:any:`notmuch-new(1)`,
+:any:`notmuch-properties(7)`,
+:any:`notmuch-reply(1)`,
+:any:`notmuch-restore(1)`,
+:any:`notmuch-search(1)`,
+:any:`notmuch-search-terms(7)`,
+:any:`notmuch-show(1)`,
+:any:`notmuch-tag(1)`
+.. _notmuch-count(1):
+
=============
notmuch-count
=============
With no search terms, a count of all messages (or threads) in the
database will be displayed.
-See **notmuch-search-terms(7)** for details of the supported syntax for
+See :any:`notmuch-search-terms(7)` for details of the supported syntax for
<search-terms>.
Supported options for **count** include
-``--output=(messages|threads|files)``
- **messages**
- Output the number of matching messages. This is the default.
+.. program:: count
+
+.. option:: --output=(messages|threads|files)
+
+ **messages**
+ Output the number of matching messages. This is the default.
+
+ **threads**
+ Output the number of matching threads.
+
+ **files**
+ Output the number of files associated with matching
+ messages. This may be bigger than the number of matching
+ messages due to duplicates (i.e. multiple files having the
+ same message-id).
+
+.. option:: --exclude=(true|false)
+
+ Specify whether to omit messages matching search.exclude\_tags from
+ the count (the default) or not.
- **threads**
- Output the number of matching threads.
+.. option:: --batch
- **files**
- Output the number of files associated with matching
- messages. This may be bigger than the number of matching
- messages due to duplicates (i.e. multiple files having the
- same message-id).
+ Read queries from a file (stdin by default), one per line, and
+ output the number of matching messages (or threads) to stdout, one
+ per line. On an empty input line the count of all messages (or
+ threads) in the database will be output. This option is not
+ compatible with specifying search terms on the command line.
-``--exclude=(true|false)``
- Specify whether to omit messages matching search.exclude\_tags from
- the count (the default) or not.
+.. option:: --lastmod
-``--batch``
- Read queries from a file (stdin by default), one per line, and
- output the number of matching messages (or threads) to stdout, one
- per line. On an empty input line the count of all messages (or
- threads) in the database will be output. This option is not
- compatible with specifying search terms on the command line.
+ Append lastmod (counter for number of database updates) and UUID
+ to the output. lastmod values are only comparable between
+ databases with the same UUID.
-``--lastmod``
- Append lastmod (counter for number of database updates) and UUID
- to the output. lastmod values are only comparable between
- databases with the same UUID.
+.. option:: --input=<filename>
-``--input=``\ <filename>
- Read input from given file, instead of from stdin. Implies
- ``--batch``.
+ Read input from given file, instead of from stdin. Implies
+ ``--batch``.
SEE ALSO
========
-**notmuch(1)**,
-**notmuch-config(1)**,
-**notmuch-dump(1)**,
-**notmuch-hooks(5)**,
-**notmuch-insert(1)**,
-**notmuch-new(1)**,
-**notmuch-reply(1)**,
-**notmuch-restore(1)**,
-**notmuch-search(1)**,
-**notmuch-search-terms(7)**,
-**notmuch-show(1)**,
-**notmuch-tag(1)**
+:any:`notmuch(1)`,
+:any:`notmuch-config(1)`,
+:any:`notmuch-dump(1)`,
+:any:`notmuch-hooks(5)`,
+:any:`notmuch-insert(1)`,
+:any:`notmuch-new(1)`,
+:any:`notmuch-reply(1)`,
+:any:`notmuch-restore(1)`,
+:any:`notmuch-search(1)`,
+:any:`notmuch-search-terms(7)`,
+:any:`notmuch-show(1)`,
+:any:`notmuch-tag(1)`
+.. _notmuch-dump(1):
+
============
notmuch-dump
============
therefore the only critical thing to backup (and much more friendly to
incremental backup than the native database files.)
-See **notmuch-search-terms(7)** for details of the supported syntax
+See :any:`notmuch-search-terms(7)` for details of the supported syntax
for <search-terms>. With no search terms, a dump of all messages in
the database will be generated. A ``--`` argument instructs notmuch that
the remaining arguments are search terms.
Supported options for **dump** include
-``--gzip``
- Compress the output in a format compatible with **gzip(1)**.
-
-``--format=(sup|batch-tag)``
- Notmuch restore supports two plain text dump formats, both with
- one message-id per line, followed by a list of tags.
-
- **batch-tag**
- The default **batch-tag** dump format is intended to more
- robust against malformed message-ids and tags containing
- whitespace or non-\ **ascii(7)** characters. Each line has the
- form::
-
- +<*encoded-tag*\ > +<*encoded-tag*\ > ... -- id:<*quoted-message-id*\ >
-
- Tags are hex-encoded by replacing every byte not matching the
- regex **[A-Za-z0-9@=.,\_+-]** with **%nn** where nn is the two
- digit hex encoding. The message ID is a valid Xapian query,
- quoted using Xapian boolean term quoting rules: if the ID
- contains whitespace or a close paren or starts with a double
- quote, it must be enclosed in double quotes and double quotes
- inside the ID must be doubled. The astute reader will notice
- this is a special case of the batch input format for
- **notmuch-tag(1)**; note that the single message-id query is
- mandatory for **notmuch-restore(1)**.
-
- **sup**
- The **sup** dump file format is specifically chosen to be
- compatible with the format of files produced by sup-dump. So
- if you've previously been using sup for mail, then the
- **notmuch restore** command provides you a way to import all
- of your tags (or labels as sup calls them). Each line has the
- following form::
-
- <*message-id*\ > **(** <*tag*\ > ... **)**
-
- with zero or more tags are separated by spaces. Note that
- (malformed) message-ids may contain arbitrary non-null
- characters. Note also that tags with spaces will not be
- correctly restored with this format.
-
-``--include=(config|properties|tags)``
- Control what kind of metadata is included in the output.
-
- **config**
- Output configuration data stored in the database. Each line
- starts with "#@ ", followed by a space separated key-value
- pair. Both key and value are hex encoded if needed.
-
- **properties**
- Output per-message (key,value) metadata. Each line starts
- with "#= ", followed by a message id, and a space separated
- list of key=value pairs. Ids, keys and values are hex encoded
- if needed. See **notmuch-properties(7)** for more details.
-
- **tags**
- Output per-message boolean metadata, namely tags. See *format* above
- for description of the output.
-
- The default is to include all available types of data. The option
- can be specified multiple times to select some subset. As of
- version 3 of the dump format, there is a header line of the
- following form::
-
- #notmuch-dump <*format*>:<*version*> <*included*>
-
- where <*included*> is a comma separated list of the above options.
-
-``--output=``\ <filename>
- Write output to given file instead of stdout.
+.. program:: dump
+
+.. option:: --gzip
+
+ Compress the output in a format compatible with :manpage:`gzip(1)`.
+
+.. option:: --format=(sup|batch-tag)
+
+ Notmuch restore supports two plain text dump formats, both with
+ one message-id per line, followed by a list of tags.
+
+ **batch-tag**
+ The default **batch-tag** dump format is intended to more
+ robust against malformed message-ids and tags containing
+ whitespace or non-\ :manpage:`ascii(7)` characters. Each line
+ has the form::
+
+ +<*encoded-tag*\ > +<*encoded-tag*\ > ... -- id:<*quoted-message-id*\ >
+
+ Tags are hex-encoded by replacing every byte not matching the
+ regex **[A-Za-z0-9@=.,\_+-]** with **%nn** where nn is the two
+ digit hex encoding. The message ID is a valid Xapian query,
+ quoted using Xapian boolean term quoting rules: if the ID
+ contains whitespace or a close paren or starts with a double
+ quote, it must be enclosed in double quotes and double quotes
+ inside the ID must be doubled. The astute reader will notice
+ this is a special case of the batch input format for
+ :any:`notmuch-tag(1)`; note that the single message-id query is
+ mandatory for :any:`notmuch-restore(1)`.
+
+ **sup**
+ The **sup** dump file format is specifically chosen to be
+ compatible with the format of files produced by
+ :manpage:`sup-dump(1)`. So if you've previously been using sup
+ for mail, then the :any:`notmuch-restore(1)` command provides
+ you a way to import all of your tags (or labels as sup calls
+ them). Each line has the following form::
+
+ <*message-id*\ > **(** <*tag*\ > ... **)**
+
+ with zero or more tags are separated by spaces. Note that
+ (malformed) message-ids may contain arbitrary non-null
+ characters. Note also that tags with spaces will not be
+ correctly restored with this format.
+
+.. option:: --include=(config|properties|tags)
+
+ Control what kind of metadata is included in the output.
+
+ **config**
+ Output configuration data stored in the database. Each line
+ starts with "#@ ", followed by a space separated key-value
+ pair. Both key and value are hex encoded if needed.
+
+ **properties**
+ Output per-message (key,value) metadata. Each line starts
+ with "#= ", followed by a message id, and a space separated
+ list of key=value pairs. Ids, keys and values are hex encoded
+ if needed. See :any:`notmuch-properties(7)` for more details.
+
+ **tags**
+ Output per-message boolean metadata, namely tags. See *format* above
+ for description of the output.
+
+ The default is to include all available types of data. The option
+ can be specified multiple times to select some subset. As of
+ version 3 of the dump format, there is a header line of the
+ following form::
+
+ #notmuch-dump <*format*>:<*version*> <*included*>
+
+ where <*included*> is a comma separated list of the above options.
+
+.. option:: --output=<filename>
+
+ Write output to given file instead of stdout.
SEE ALSO
========
-**notmuch(1)**,
-**notmuch-config(1)**,
-**notmuch-count(1)**,
-**notmuch-hooks(5)**,
-**notmuch-insert(1)**,
-**notmuch-new(1)**,
-**notmuch-properties(7)**,
-**notmuch-reply(1)**,
-**notmuch-restore(1)**,
-**notmuch-search(1)**,
-**notmuch-search-terms(7)**,
-**notmuch-show(1)**,
-**notmuch-tag(1)**
+:any:`notmuch(1)`,
+:any:`notmuch-config(1)`,
+:any:`notmuch-count(1)`,
+:any:`notmuch-hooks(5)`,
+:any:`notmuch-insert(1)`,
+:any:`notmuch-new(1)`,
+:any:`notmuch-properties(7)`,
+:any:`notmuch-reply(1)`,
+:any:`notmuch-restore(1)`,
+:any:`notmuch-search(1)`,
+:any:`notmuch-search-terms(7)`,
+:any:`notmuch-show(1)`,
+:any:`notmuch-tag(1)`
+.. _notmuch-emacs-mua(1):
+
=================
notmuch-emacs-mua
=================
Supported options for **emacs-mua** include
-``-h, --help``
- Display help.
+.. program:: emacs-mua
+
+.. option:: -h, --help
+
+ Display help.
+
+.. option:: -s, --subject=<subject>
+
+ Specify the subject of the message.
+
+.. option:: --to=<to-address>
+
+ Specify a recipient (To).
+
+.. option:: -c, --cc=<cc-address>
-``-s, --subject=``\ <subject>
- Specify the subject of the message.
+ Specify a carbon-copy (Cc) recipient.
-``--to=``\ <to-address>
- Specify a recipient (To).
+.. option:: -b, --bcc=<bcc-address>
-``-c, --cc=``\ <cc-address>
- Specify a carbon-copy (Cc) recipient.
+ Specify a blind-carbon-copy (Bcc) recipient.
-``-b, --bcc=``\ <bcc-address>
- Specify a blind-carbon-copy (Bcc) recipient.
+.. option:: -i, --body=<file>
-``-i, --body=``\ <file>
- Specify a file to include into the body of the message.
+ Specify a file to include into the body of the message.
-``--hello``
- Go to the Notmuch hello screen instead of the message composition
- window if no message composition parameters are given.
+.. option:: --hello
-``--no-window-system``
- Even if a window system is available, use the current terminal.
+ Go to the Notmuch hello screen instead of the message composition
+ window if no message composition parameters are given.
-``--client``
- Use **emacsclient**, rather than **emacs**. For **emacsclient** to
- work, you need an already running Emacs with a server, or use
- ``--auto-daemon``.
+.. option:: --no-window-system
-``--auto-daemon``
- Automatically start Emacs in daemon mode, if the Emacs server is
- not running. Applicable with ``--client``. Implies
- ``--create-frame``.
+ Even if a window system is available, use the current terminal.
-``--create-frame``
- Create a new frame instead of trying to use the current Emacs
- frame. Applicable with ``--client``. This will be required when
- Emacs is running (or automatically started with ``--auto-daemon``)
- in daemon mode.
+.. option:: --client
-``--print``
- Output the resulting elisp to stdout instead of evaluating it.
+ Use :manpage:`emacsclient(1)`, rather than
+ :manpage:`emacs(1)`. For :manpage:`emacsclient(1)` to work, you
+ need an already running Emacs with a server, or use
+ ``--auto-daemon``.
+
+.. option:: --auto-daemon
+
+ Automatically start Emacs in daemon mode, if the Emacs server is
+ not running. Applicable with ``--client``. Implies
+ ``--create-frame``.
+
+.. option:: --create-frame
+
+ Create a new frame instead of trying to use the current Emacs
+ frame. Applicable with ``--client``. This will be required when
+ Emacs is running (or automatically started with ``--auto-daemon``)
+ in daemon mode.
+
+.. option:: --print
+
+ Output the resulting elisp to stdout instead of evaluating it.
The supported positional parameters and short options are a compatible
-subset of the **mutt** MUA command-line options. The options and
-positional parameters modifying the message can't be combined with the
-mailto: URL.
+subset of the :manpage:`mutt(1)` MUA command-line options. The options
+and positional parameters modifying the message can't be combined with
+the mailto: URL.
Options may be specified multiple times.
ENVIRONMENT VARIABLES
=====================
-**EMACS**
- Name of emacs command to invoke. Defaults to "emacs".
+.. envvar:: EMACS
+
+ Name of emacs command to invoke. Defaults to "emacs".
+
+.. envvar:: EMACSCLIENT
-**EMACSCLIENT**
- Name of emacsclient command to invoke. Defaults to "emacsclient".
+ Name of emacsclient command to invoke. Defaults to "emacsclient".
SEE ALSO
========
-**notmuch(1)**, **emacsclient(1)**, **mutt(1)**
+:any:`notmuch(1)`,
+:manpage:`emacsclient(1)`,
+:manpage:`mutt(1)`
+.. _notmuch-insert(1):
+
==============
notmuch-insert
==============
into the maildir directory given by configuration option
**database.path**, then incorporates the message into the notmuch
database. It is an alternative to using a separate tool to deliver the
-message then running **notmuch new** afterwards.
+message then running :any:`notmuch-new(1)` afterwards.
The new message will be tagged with the tags specified by the
**new.tags** configuration option, then by operations specified on the
(it has same Message-ID), it will be added to the maildir folder and
notmuch database, but the tags will not be changed.
-The **insert** command supports hooks. See **notmuch-hooks(5)** for
+The **insert** command supports hooks. See :any:`notmuch-hooks(5)` for
more details on hooks.
Option arguments must appear before any tag operation arguments.
Supported options for **insert** include
-``--folder=<``\ folder\ **>**
- Deliver the message to the specified folder, relative to the
- top-level directory given by the value of **database.path**. The
- default is the empty string, which means delivering to the
- top-level directory.
-
-``--create-folder``
- Try to create the folder named by the ``--folder`` option, if it
- does not exist. Otherwise the folder must already exist for mail
- delivery to succeed.
-
-``--keep``
- Keep the message file if indexing fails, and keep the message
- indexed if applying tags or maildir flag synchronization
- fails. Ignore these errors and return exit status 0 to indicate
- successful mail delivery.
-
-``--no-hooks``
- Prevent hooks from being run.
-
-``--world-readable``
- When writing mail to the mailbox, allow it to be read by users
- other than the current user. Note that this does not override
- umask. By default, delivered mail is only readable by the current
- user.
-
-``--decrypt=(true|nostash|auto|false)``
- If ``true`` and the message is encrypted, try to decrypt the
- message while indexing, stashing any session keys discovered. If
- ``auto``, and notmuch already knows about a session key for the
- message, it will try decrypting using that session key but will
- not try to access the user's secret keys. If decryption is
- successful, index the cleartext itself. Either way, the message
- is always stored to disk in its original form (ciphertext).
-
- ``nostash`` is the same as ``true`` except that it will not stash
- newly-discovered session keys in the database.
-
- Be aware that the index is likely sufficient (and a stashed
- session key is certainly sufficient) to reconstruct the cleartext
- of the message itself, so please ensure that the notmuch message
- index is adequately protected. DO NOT USE ``--decrypt=true`` or
- ``--decrypt=nostash`` without considering the security of your
- index.
-
- See also ``index.decrypt`` in **notmuch-config(1)**.
+.. program:: insert
+
+.. option:: --folder=<folder>
+
+ Deliver the message to the specified folder, relative to the
+ top-level directory given by the value of **database.path**. The
+ default is the empty string, which means delivering to the
+ top-level directory.
+
+.. option:: --create-folder
+
+ Try to create the folder named by the ``--folder`` option, if it
+ does not exist. Otherwise the folder must already exist for mail
+ delivery to succeed.
+
+.. option:: --keep
+
+ Keep the message file if indexing fails, and keep the message
+ indexed if applying tags or maildir flag synchronization
+ fails. Ignore these errors and return exit status 0 to indicate
+ successful mail delivery.
+
+.. option:: --no-hooks
+
+ Prevent hooks from being run.
+
+.. option:: --world-readable
+
+ When writing mail to the mailbox, allow it to be read by users
+ other than the current user. Note that this does not override
+ umask. By default, delivered mail is only readable by the current
+ user.
+
+.. option:: --decrypt=(true|nostash|auto|false)
+
+ If ``true`` and the message is encrypted, try to decrypt the
+ message while indexing, stashing any session keys discovered. If
+ ``auto``, and notmuch already knows about a session key for the
+ message, it will try decrypting using that session key but will
+ not try to access the user's secret keys. If decryption is
+ successful, index the cleartext itself. Either way, the message
+ is always stored to disk in its original form (ciphertext).
+
+ ``nostash`` is the same as ``true`` except that it will not stash
+ newly-discovered session keys in the database.
+
+ Be aware that the index is likely sufficient (and a stashed
+ session key is certainly sufficient) to reconstruct the cleartext
+ of the message itself, so please ensure that the notmuch message
+ index is adequately protected. DO NOT USE ``--decrypt=true`` or
+ ``--decrypt=nostash`` without considering the security of your
+ index.
+
+ See also ``index.decrypt`` in :any:`notmuch-config(1)`.
EXIT STATUS
===========
SEE ALSO
========
-**notmuch(1)**,
-**notmuch-config(1)**,
-**notmuch-count(1)**,
-**notmuch-dump(1)**,
-**notmuch-hooks(5)**,
-**notmuch-reply(1)**,
-**notmuch-restore(1)**,
-**notmuch-search(1)**,
-**notmuch-search-terms(7)**,
-**notmuch-show(1)**,
-**notmuch-tag(1)**
+:any:`notmuch(1)`,
+:any:`notmuch-config(1)`,
+:any:`notmuch-count(1)`,
+:any:`notmuch-dump(1)`,
+:any:`notmuch-hooks(5)`,
+:any:`notmuch-reply(1)`,
+:any:`notmuch-restore(1)`,
+:any:`notmuch-search(1)`,
+:any:`notmuch-search-terms(7)`,
+:any:`notmuch-show(1)`,
+:any:`notmuch-tag(1)`
+.. _notmuch-new(1):
+
===========
notmuch-new
===========
message will automatically be tagged with both the **inbox** and
**unread** tags.
-You should run **notmuch new** once after first running **notmuch
-setup** to create the initial database. The first run may take a long
-time if you have a significant amount of mail (several hundred thousand
-messages or more). Subsequently, you should run **notmuch new** whenever
-new mail is delivered and you wish to incorporate it into the database.
-These subsequent runs will be much quicker than the initial run.
+You should run **notmuch new** once after first running
+:any:`notmuch-setup(1)` to create the initial database. The first run
+may take a long time if you have a significant amount of mail (several
+hundred thousand messages or more). Subsequently, you should run
+**notmuch new** whenever new mail is delivered and you wish to
+incorporate it into the database. These subsequent runs will be much
+quicker than the initial run.
Invoking ``notmuch`` with no command argument will run **new** if
-**notmuch setup** has previously been completed, but **notmuch new** has
-not previously been run.
+:any:`notmuch-setup(1)` has previously been completed, but **notmuch
+new** has not previously been run.
**notmuch new** updates tags according to maildir flag changes if the
**maildir.synchronize\_flags** configuration option is enabled. See
-**notmuch-config(1)** for details.
+:any:`notmuch-config(1)` for details.
-The **new** command supports hooks. See **notmuch-hooks(5)** for more
+The **new** command supports hooks. See :any:`notmuch-hooks(5)` for more
details on hooks.
Supported options for **new** include
-``--no-hooks``
- Prevents hooks from being run.
+.. program:: new
+
+.. option:: --no-hooks
+
+ Prevents hooks from being run.
+
+.. option:: --quiet
+
+ Do not print progress or results.
+
+.. option:: --verbose
+
+ Print file names being processed. Ignored when combined with
+ ``--quiet``.
-``--quiet``
- Do not print progress or results.
+.. option:: --decrypt=(true|nostash|auto|false)
-``--verbose``
- Print file names being processed. Ignored when combined with
- ``--quiet``.
+ If ``true``, when encountering an encrypted message, try to
+ decrypt it while indexing, and stash any discovered session keys.
+ If ``auto``, try to use any session key already known to belong to
+ this message, but do not attempt to use the user's secret keys.
+ If decryption is successful, index the cleartext of the message.
-``--decrypt=(true|nostash|auto|false)``
- If ``true``, when encountering an encrypted message, try to
- decrypt it while indexing, and stash any discovered session keys.
- If ``auto``, try to use any session key already known to belong to
- this message, but do not attempt to use the user's secret keys.
- If decryption is successful, index the cleartext of the message.
+ Be aware that the index is likely sufficient (and the session key
+ is certainly sufficient) to reconstruct the cleartext of the
+ message itself, so please ensure that the notmuch message index is
+ adequately protected. DO NOT USE ``--decrypt=true`` or
+ ``--decrypt=nostash`` without considering the security of your
+ index.
- Be aware that the index is likely sufficient (and the session key
- is certainly sufficient) to reconstruct the cleartext of the
- message itself, so please ensure that the notmuch message index is
- adequately protected. DO NOT USE ``--decrypt=true`` or
- ``--decrypt=nostash`` without considering the security of your
- index.
+ See also ``index.decrypt`` in :any:`notmuch-config(1)`.
- See also ``index.decrypt`` in **notmuch-config(1)**.
+.. option:: --full-scan
-``--full-scan``
- By default notmuch-new uses directory modification times (mtimes)
- to optimize the scanning of directories for new mail. This option turns
- that optimization off.
+ By default notmuch-new uses directory modification times (mtimes)
+ to optimize the scanning of directories for new mail. This option turns
+ that optimization off.
EXIT STATUS
===========
SEE ALSO
========
-**notmuch(1)**,
-**notmuch-config(1)**,
-**notmuch-count(1)**,
-**notmuch-dump(1)**,
-**notmuch-hooks(5)**,
-**notmuch-insert(1)**,
-**notmuch-reply(1)**,
-**notmuch-restore(1)**,
-**notmuch-search(1)**,
-**notmuch-search-terms(7)**,
-**notmuch-show(1)**,
-**notmuch-tag(1)**
+:any:`notmuch(1)`,
+:any:`notmuch-config(1)`,
+:any:`notmuch-count(1)`,
+:any:`notmuch-dump(1)`,
+:any:`notmuch-hooks(5)`,
+:any:`notmuch-insert(1)`,
+:any:`notmuch-reply(1)`,
+:any:`notmuch-restore(1)`,
+:any:`notmuch-search(1)`,
+:any:`notmuch-search-terms(7)`,
+:any:`notmuch-show(1)`,
+:any:`notmuch-tag(1)`
+.. _notmuch-reindex(1):
+
===============
notmuch-reindex
===============
Re-index all messages matching the search terms.
-See **notmuch-search-terms(7)** for details of the supported syntax for
+See :any:`notmuch-search-terms(7)` for details of the supported syntax for
<*search-term*\ >.
The **reindex** command searches for all messages matching the
Supported options for **reindex** include
-``--decrypt=(true|nostash|auto|false)``
- If ``true``, when encountering an encrypted message, try to
- decrypt it while reindexing, stashing any session keys discovered.
- If ``auto``, and notmuch already knows about a session key for the
- message, it will try decrypting using that session key but will
- not try to access the user's secret keys. If decryption is
- successful, index the cleartext itself.
+.. program:: reindex
+
+.. option:: --decrypt=(true|nostash|auto|false)
+
+ If ``true``, when encountering an encrypted message, try to
+ decrypt it while reindexing, stashing any session keys discovered.
+ If ``auto``, and notmuch already knows about a session key for the
+ message, it will try decrypting using that session key but will
+ not try to access the user's secret keys. If decryption is
+ successful, index the cleartext itself.
- ``nostash`` is the same as ``true`` except that it will not stash
- newly-discovered session keys in the database.
+ ``nostash`` is the same as ``true`` except that it will not stash
+ newly-discovered session keys in the database.
- If ``false``, notmuch reindex will also delete any stashed session
- keys for all messages matching the search terms.
+ If ``false``, notmuch reindex will also delete any stashed session
+ keys for all messages matching the search terms.
- Be aware that the index is likely sufficient (and a stashed
- session key is certainly sufficient) to reconstruct the cleartext
- of the message itself, so please ensure that the notmuch message
- index is adequately protected. DO NOT USE ``--decrypt=true`` or
- ``--decrypt=nostash`` without considering the security of your
- index.
+ Be aware that the index is likely sufficient (and a stashed
+ session key is certainly sufficient) to reconstruct the cleartext
+ of the message itself, so please ensure that the notmuch message
+ index is adequately protected. DO NOT USE ``--decrypt=true`` or
+ ``--decrypt=nostash`` without considering the security of your
+ index.
- See also ``index.decrypt`` in **notmuch-config(1)**.
+ See also ``index.decrypt`` in :any:`notmuch-config(1)`.
EXAMPLES
========
SEE ALSO
========
-**notmuch(1)**,
-**notmuch-compact(1)**,
-**notmuch-config(1)**,
-**notmuch-count(1)**,
-**notmuch-dump(1)**,
-**notmuch-hooks(5)**,
-**notmuch-insert(1)**,
-**notmuch-new(1)**,
-**notmuch-reply(1)**,
-**notmuch-restore(1)**,
-**notmuch-search(1)**,
-**notmuch-search-terms(7)**,
-**notmuch-show(1)**,
-**notmuch-tag(1)**
+:any:`notmuch(1)`,
+:any:`notmuch-compact(1)`,
+:any:`notmuch-config(1)`,
+:any:`notmuch-count(1)`,
+:any:`notmuch-dump(1)`,
+:any:`notmuch-hooks(5)`,
+:any:`notmuch-insert(1)`,
+:any:`notmuch-new(1)`,
+:any:`notmuch-reply(1)`,
+:any:`notmuch-restore(1)`,
+:any:`notmuch-search(1)`,
+:any:`notmuch-search-terms(7)`,
+:any:`notmuch-show(1)`,
+:any:`notmuch-tag(1)`
+.. _notmuch-reply(1):
+
=============
notmuch-reply
=============
Supported options for **reply** include
-``--format=``\ (**default**\ \|\ **json**\ \|\ **sexp**\ \|\ **headers-only**)
- **default**
- Includes subject and quoted message body as an RFC 2822
- message.
+.. program:: reply
+
+.. option:: --format=(default|json|sexp|headers-only)
+
+ **default**
+ Includes subject and quoted message body as an RFC 2822
+ message.
+
+ **json**
+ Produces JSON output containing headers for a reply message
+ and the contents of the original message. This output can be
+ used by a client to create a reply message intelligently.
+
+ **sexp**
+ Produces S-Expression output containing headers for a reply
+ message and the contents of the original message. This output
+ can be used by a client to create a reply message
+ intelligently.
- **json**
- Produces JSON output containing headers for a reply message
- and the contents of the original message. This output can be
- used by a client to create a reply message intelligently.
+ **headers-only**
+ Only produces In-Reply-To, References, To, Cc, and Bcc
+ headers.
- **sexp**
- Produces S-Expression output containing headers for a reply
- message and the contents of the original message. This output
- can be used by a client to create a reply message
- intelligently.
+.. option:: --format-version=N
- **headers-only**
- Only produces In-Reply-To, References, To, Cc, and Bcc
- headers.
+ Use the specified structured output format version. This is
+ intended for programs that invoke :any:`notmuch(1)` internally. If
+ omitted, the latest supported version will be used.
-``--format-version=N``
- Use the specified structured output format version. This is
- intended for programs that invoke **notmuch(1)** internally. If
- omitted, the latest supported version will be used.
+.. option:: --reply-to=(all|sender)
-``--reply-to=``\ (**all**\ \|\ **sender**)
- **all** (default)
- Replies to all addresses.
+ **all** (default)
+ Replies to all addresses.
- **sender**
- Replies only to the sender. If replying to user's own message
- (Reply-to: or From: header is one of the user's configured
- email addresses), try To:, Cc:, and Bcc: headers in this
- order, and copy values from the first that contains something
- other than only the user's addresses.
+ **sender**
+ Replies only to the sender. If replying to user's own message
+ (Reply-to: or From: header is one of the user's configured
+ email addresses), try To:, Cc:, and Bcc: headers in this
+ order, and copy values from the first that contains something
+ other than only the user's addresses.
-``--decrypt=(false|auto|true)``
+.. option:: --decrypt=(false|auto|true)
- If ``true``, decrypt any MIME encrypted parts found in the
- selected content (i.e., "multipart/encrypted" parts). Status
- of the decryption will be reported (currently only supported
- with ``--format=json`` and ``--format=sexp``), and on successful
- decryption the multipart/encrypted part will be replaced by
- the decrypted content.
+ If ``true``, decrypt any MIME encrypted parts found in the
+ selected content (i.e., "multipart/encrypted" parts). Status
+ of the decryption will be reported (currently only supported
+ with ``--format=json`` and ``--format=sexp``), and on successful
+ decryption the multipart/encrypted part will be replaced by
+ the decrypted content.
- If ``auto``, and a session key is already known for the
- message, then it will be decrypted, but notmuch will not try
- to access the user's secret keys.
+ If ``auto``, and a session key is already known for the
+ message, then it will be decrypted, but notmuch will not try
+ to access the user's secret keys.
- Use ``false`` to avoid even automatic decryption.
+ Use ``false`` to avoid even automatic decryption.
- Non-automatic decryption expects a functioning
- **gpg-agent(1)** to provide any needed credentials. Without
- one, the decryption will likely fail.
+ Non-automatic decryption expects a functioning
+ :manpage:`gpg-agent(1)` to provide any needed credentials. Without
+ one, the decryption will likely fail.
- Default: ``auto``
+ Default: ``auto``
-See **notmuch-search-terms(7)** for details of the supported syntax for
+See :any:`notmuch-search-terms(7)` for details of the supported syntax for
<search-terms>.
Note: It is most common to use **notmuch reply** with a search string
SEE ALSO
========
-**notmuch(1)**,
-**notmuch-config(1)**,
-**notmuch-count(1)**,
-**notmuch-dump(1)**,
-**notmuch-hooks(5)**,
-**notmuch-insert(1)**,
-**notmuch-new(1)**,
-**notmuch-restore(1)**,
-**notmuch-search(1)**,
-**notmuch-search-terms(7)**,
-**notmuch-show(1)**,
-**notmuch-tag(1)**
+:any:`notmuch(1)`,
+:any:`notmuch-config(1)`,
+:any:`notmuch-count(1)`,
+:any:`notmuch-dump(1)`,
+:any:`notmuch-hooks(5)`,
+:any:`notmuch-insert(1)`,
+:any:`notmuch-new(1)`,
+:any:`notmuch-restore(1)`,
+:any:`notmuch-search(1)`,
+:any:`notmuch-search-terms(7)`,
+:any:`notmuch-show(1)`,
+:any:`notmuch-tag(1)`
+.. _notmuch-restore(1):
+
===============
notmuch-restore
===============
DESCRIPTION
===========
-Restores the tags from the given file (see **notmuch dump**).
+Restores the tags from the given file (see :any:`notmuch-dump(1)`).
The input is read from the given filename, if any, or from stdin.
Supported options for **restore** include
-``--accumulate``
- The union of the existing and new tags is applied, instead of
- replacing each message's tags as they are read in from the dump
- file.
-
-``--format=(sup|batch-tag|auto)``
- Notmuch restore supports two plain text dump formats, with each
- line specifying a message-id and a set of tags. For details of the
- actual formats, see **notmuch-dump(1)**.
-
- **sup**
- The **sup** dump file format is specifically chosen to be
- compatible with the format of files produced by sup-dump. So
- if you've previously been using sup for mail, then the
- **notmuch restore** command provides you a way to import all
- of your tags (or labels as sup calls them).
-
- **batch-tag**
- The **batch-tag** dump format is intended to more robust
- against malformed message-ids and tags containing whitespace
- or non-\ **ascii(7)** characters. See **notmuch-dump(1)** for
- details on this format.
-
- **notmuch restore** updates the maildir flags according to tag
- changes if the **maildir.synchronize\_flags** configuration
- option is enabled. See **notmuch-config(1)** for details.
-
- **auto**
- This option (the default) tries to guess the format from the
- input. For correctly formed input in either supported format,
- this heuristic, based the fact that batch-tag format contains
- no parentheses, should be accurate.
-
-``--include=(config|properties|tags)``
- Control what kind of metadata is restored.
-
- **config**
- Restore configuration data to the database. Each configuration
- line starts with "#@ ", followed by a space separated
- key-value pair. Both key and value are hex encoded if needed.
-
- **properties**
- Restore per-message (key,value) metadata. Each line starts
- with "#= ", followed by a message id, and a space separated
- list of key=value pairs. Ids, keys and values are hex encoded
- if needed. See **notmuch-properties(7)** for more details.
-
- **tags**
- Restore per-message metadata, namely tags. See *format* above
- for more details.
-
- The default is to restore all available types of data. The option
- can be specified multiple times to select some subset.
-
-``--input=``\ <filename>
- Read input from given file instead of stdin.
+.. program:: restore
+
+.. option:: --accumulate
+
+ The union of the existing and new tags is applied, instead of
+ replacing each message's tags as they are read in from the dump
+ file.
+
+.. option:: --format=(sup|batch-tag|auto)
+
+ Notmuch restore supports two plain text dump formats, with each
+ line specifying a message-id and a set of tags. For details of the
+ actual formats, see :any:`notmuch-dump(1)`.
+
+ **sup**
+ The **sup** dump file format is specifically chosen to be
+ compatible with the format of files produced by sup-dump. So
+ if you've previously been using sup for mail, then the
+ **notmuch restore** command provides you a way to import all
+ of your tags (or labels as sup calls them).
+
+ **batch-tag**
+ The **batch-tag** dump format is intended to more robust
+ against malformed message-ids and tags containing whitespace
+ or non-\ **ascii(7)** characters. See :any:`notmuch-dump(1)` for
+ details on this format.
+
+ **notmuch restore** updates the maildir flags according to tag
+ changes if the **maildir.synchronize\_flags** configuration
+ option is enabled. See :any:`notmuch-config(1)` for details.
+
+ **auto**
+ This option (the default) tries to guess the format from the
+ input. For correctly formed input in either supported format,
+ this heuristic, based the fact that batch-tag format contains
+ no parentheses, should be accurate.
+
+.. option:: --include=(config|properties|tags)
+
+ Control what kind of metadata is restored.
+
+ **config**
+ Restore configuration data to the database. Each configuration
+ line starts with "#@ ", followed by a space separated
+ key-value pair. Both key and value are hex encoded if needed.
+
+ **properties**
+ Restore per-message (key,value) metadata. Each line starts
+ with "#= ", followed by a message id, and a space separated
+ list of key=value pairs. Ids, keys and values are hex encoded
+ if needed. See :any:`notmuch-properties(7)` for more details.
+
+ **tags**
+ Restore per-message metadata, namely tags. See *format* above
+ for more details.
+
+ The default is to restore all available types of data. The option
+ can be specified multiple times to select some subset.
+
+.. option:: --input=<filename>
+
+ Read input from given file instead of stdin.
GZIPPED INPUT
=============
\ **notmuch restore** will detect if the input is compressed in
-**gzip(1)** format and automatically decompress it while reading. This
-detection does not depend on file naming and in particular works for
-standard input.
+:manpage:`gzip(1)` format and automatically decompress it while
+reading. This detection does not depend on file naming and in
+particular works for standard input.
SEE ALSO
========
-**notmuch(1)**,
-**notmuch-config(1)**,
-**notmuch-count(1)**,
-**notmuch-dump(1)**,
-**notmuch-hooks(5)**,
-**notmuch-insert(1)**,
-**notmuch-new(1)**,
-**notmuch-properties(7)**,
-**notmuch-reply(1)**,
-**notmuch-search(1)**,
-**notmuch-search-terms(7)**,
-**notmuch-show(1)**,
-**notmuch-tag(1)**
+:any:`notmuch(1)`,
+:any:`notmuch-config(1)`,
+:any:`notmuch-count(1)`,
+:any:`notmuch-dump(1)`,
+:any:`notmuch-hooks(5)`,
+:any:`notmuch-insert(1)`,
+:any:`notmuch-new(1)`,
+:any:`notmuch-properties(7)`,
+:any:`notmuch-reply(1)`,
+:any:`notmuch-search(1)`,
+:any:`notmuch-search-terms(7)`,
+:any:`notmuch-show(1)`,
+:any:`notmuch-tag(1)`
+.. _notmuch-search(1):
+
==============
notmuch-search
==============
thread, the names of all participants in the thread, and the subject of
the newest (or oldest) message.
-See **notmuch-search-terms(7)** for details of the supported syntax for
+See :any:`notmuch-search-terms(7)` for details of the supported syntax for
<search-terms>.
Supported options for **search** include
-``--format=``\ (**json**\ \|\ **sexp**\ \|\ **text**\ \|\ **text0**)
- Presents the results in either JSON, S-Expressions, newline
- character separated plain-text (default), or null character
- separated plain-text (compatible with **xargs(1)** -0 option where
- available).
-
-``--format-version=N``
- Use the specified structured output format version. This is
- intended for programs that invoke **notmuch(1)** internally. If
- omitted, the latest supported version will be used.
-
-``--output=(summary|threads|messages|files|tags)``
- **summary**
- Output a summary of each thread with any message matching the
- search terms. The summary includes the thread ID, date, the
- number of messages in the thread (both the number matched and
- the total number), the authors of the thread and the
- subject. In the case where a thread contains multiple files
- for some messages, the total number of files is printed in
- parentheses (see below for an example).
-
- **threads**
- Output the thread IDs of all threads with any message matching
- the search terms, either one per line (``--format=text``),
- separated by null characters (``--format=text0``), as a JSON array
- (``--format=json``), or an S-Expression list (``--format=sexp``).
-
- **messages**
- Output the message IDs of all messages matching the search
- terms, either one per line (``--format=text``), separated by null
- characters (``--format=text0``), as a JSON array (``--format=json``),
- or as an S-Expression list (``--format=sexp``).
-
- **files**
- Output the filenames of all messages matching the search
- terms, either one per line (``--format=text``), separated by null
- characters (``--format=text0``), as a JSON array (``--format=json``),
- or as an S-Expression list (``--format=sexp``).
-
- Note that each message may have multiple filenames associated
- with it. All of them are included in the output (unless
- limited with the ``--duplicate=N`` option). This may be
- particularly confusing for **folder:** or **path:** searches
- in a specified directory, as the messages may have duplicates
- in other directories that are included in the output, although
- these files alone would not match the search.
-
- **tags**
- Output all tags that appear on any message matching the search
- terms, either one per line (``--format=text``), separated by null
- characters (``--format=text0``), as a JSON array (``--format=json``),
- or as an S-Expression list (``--format=sexp``).
-
-``--sort=``\ (**newest-first**\ \|\ **oldest-first**)
- This option can be used to present results in either chronological
- order (**oldest-first**) or reverse chronological order
- (**newest-first**).
-
- Note: The thread order will be distinct between these two options
- (beyond being simply reversed). When sorting by **oldest-first**
- the threads will be sorted by the oldest message in each thread,
- but when sorting by **newest-first** the threads will be sorted by
- the newest message in each thread.
-
- By default, results will be displayed in reverse chronological
- order, (that is, the newest results will be displayed first).
-
-``--offset=[-]N``
- Skip displaying the first N results. With the leading '-', start
- at the Nth result from the end.
-
-``--limit=N``
- Limit the number of displayed results to N.
-
-``--exclude=(true|false|all|flag)``
- A message is called "excluded" if it matches at least one tag in
- search.exclude\_tags that does not appear explicitly in the search
- terms. This option specifies whether to omit excluded messages in
- the search process.
-
- **true** (default)
- Prevent excluded messages from matching the search terms.
-
- **all**
- Additionally prevent excluded messages from appearing in
- displayed results, in effect behaving as though the excluded
- messages do not exist.
-
- **false**
- Allow excluded messages to match search terms and appear in
- displayed results. Excluded messages are still marked in the
- relevant outputs.
-
- **flag**
- Only has an effect when ``--output=summary``. The output is
- almost identical to **false**, but the "match count" is the
- number of matching non-excluded messages in the thread, rather
- than the number of matching messages.
-
-``--duplicate=N``
- For ``--output=files``, output the Nth filename associated with
- each message matching the query (N is 1-based). If N is greater
- than the number of files associated with the message, don't print
- anything.
-
- For ``--output=messages``, only output message IDs of messages
- matching the search terms that have at least N filenames
- associated with them.
-
- Note that this option is orthogonal with the **folder:** search
- prefix. The prefix matches messages based on filenames. This
- option filters filenames of the matching messages.
+.. program:: search
+
+.. option:: --format=(json|sexp|text|text0)
+
+ Presents the results in either JSON, S-Expressions, newline
+ character separated plain-text (default), or null character
+ separated plain-text (compatible with :manpage:`xargs(1)` -0
+ option where available).
+
+.. option:: --format-version=N
+
+ Use the specified structured output format version. This is
+ intended for programs that invoke :any:`notmuch(1)` internally. If
+ omitted, the latest supported version will be used.
+
+.. option:: --output=(summary|threads|messages|files|tags)
+
+ **summary**
+ Output a summary of each thread with any message matching the
+ search terms. The summary includes the thread ID, date, the
+ number of messages in the thread (both the number matched and
+ the total number), the authors of the thread and the
+ subject. In the case where a thread contains multiple files
+ for some messages, the total number of files is printed in
+ parentheses (see below for an example).
+
+ **threads**
+ Output the thread IDs of all threads with any message matching
+ the search terms, either one per line (``--format=text``),
+ separated by null characters (``--format=text0``), as a JSON array
+ (``--format=json``), or an S-Expression list (``--format=sexp``).
+
+ **messages**
+ Output the message IDs of all messages matching the search
+ terms, either one per line (``--format=text``), separated by null
+ characters (``--format=text0``), as a JSON array (``--format=json``),
+ or as an S-Expression list (``--format=sexp``).
+
+ **files**
+ Output the filenames of all messages matching the search
+ terms, either one per line (``--format=text``), separated by null
+ characters (``--format=text0``), as a JSON array (``--format=json``),
+ or as an S-Expression list (``--format=sexp``).
+
+ Note that each message may have multiple filenames associated
+ with it. All of them are included in the output (unless
+ limited with the ``--duplicate=N`` option). This may be
+ particularly confusing for **folder:** or **path:** searches
+ in a specified directory, as the messages may have duplicates
+ in other directories that are included in the output, although
+ these files alone would not match the search.
+
+ **tags**
+ Output all tags that appear on any message matching the search
+ terms, either one per line (``--format=text``), separated by null
+ characters (``--format=text0``), as a JSON array (``--format=json``),
+ or as an S-Expression list (``--format=sexp``).
+
+.. option:: --sort=(newest-first|oldest-first)
+
+ This option can be used to present results in either chronological
+ order (**oldest-first**) or reverse chronological order
+ (**newest-first**).
+
+ Note: The thread order will be distinct between these two options
+ (beyond being simply reversed). When sorting by **oldest-first**
+ the threads will be sorted by the oldest message in each thread,
+ but when sorting by **newest-first** the threads will be sorted by
+ the newest message in each thread.
+
+ By default, results will be displayed in reverse chronological
+ order, (that is, the newest results will be displayed first).
+
+.. option:: --offset=[-]N
+
+ Skip displaying the first N results. With the leading '-', start
+ at the Nth result from the end.
+
+.. option:: --limit=N
+
+ Limit the number of displayed results to N.
+
+.. option:: --exclude=(true|false|all|flag)
+
+ A message is called "excluded" if it matches at least one tag in
+ search.exclude\_tags that does not appear explicitly in the search
+ terms. This option specifies whether to omit excluded messages in
+ the search process.
+
+ **true** (default)
+ Prevent excluded messages from matching the search terms.
+
+ **all**
+ Additionally prevent excluded messages from appearing in
+ displayed results, in effect behaving as though the excluded
+ messages do not exist.
+
+ **false**
+ Allow excluded messages to match search terms and appear in
+ displayed results. Excluded messages are still marked in the
+ relevant outputs.
+
+ **flag**
+ Only has an effect when ``--output=summary``. The output is
+ almost identical to **false**, but the "match count" is the
+ number of matching non-excluded messages in the thread, rather
+ than the number of matching messages.
+
+.. option:: --duplicate=N
+
+ For ``--output=files``, output the Nth filename associated with
+ each message matching the query (N is 1-based). If N is greater
+ than the number of files associated with the message, don't print
+ anything.
+
+ For ``--output=messages``, only output message IDs of messages
+ matching the search terms that have at least N filenames
+ associated with them.
+
+ Note that this option is orthogonal with the **folder:** search
+ prefix. The prefix matches messages based on filenames. This
+ option filters filenames of the matching messages.
EXAMPLE
=======
SEE ALSO
========
-**notmuch(1)**,
-**notmuch-config(1)**,
-**notmuch-count(1)**,
-**notmuch-dump(1)**,
-**notmuch-hooks(5)**,
-**notmuch-insert(1)**,
-**notmuch-new(1)**,
-**notmuch-reply(1)**,
-**notmuch-restore(1)**,
-**notmuch-search-terms(7)**,
-**notmuch-show(1)**,
-**notmuch-tag(1)**
-**notmuch-address(1)**
+:any:`notmuch(1)`,
+:any:`notmuch-address(1)`
+:any:`notmuch-config(1)`,
+:any:`notmuch-count(1)`,
+:any:`notmuch-dump(1)`,
+:any:`notmuch-hooks(5)`,
+:any:`notmuch-insert(1)`,
+:any:`notmuch-new(1)`,
+:any:`notmuch-reply(1)`,
+:any:`notmuch-restore(1)`,
+:any:`notmuch-search-terms(7)`,
+:any:`notmuch-show(1)`,
+:any:`notmuch-tag(1)`
+.. _notmuch-show(1):
+
============
notmuch-show
============
Shows all messages matching the search terms.
-See **notmuch-search-terms(7)** for details of the supported syntax for
+See :any:`notmuch-search-terms(7)` for details of the supported syntax for
<search-terms>.
The messages will be grouped and sorted based on the threading (all
Supported options for **show** include
-``--entire-thread=(true|false)``
- If true, **notmuch show** outputs all messages in the thread of
- any message matching the search terms; if false, it outputs only
- the matching messages. For ``--format=json`` and ``--format=sexp``
- this defaults to true. For other formats, this defaults to false.
-
-``--format=(text|json|sexp|mbox|raw)``
- **text** (default for messages)
- The default plain-text format has all text-content MIME parts
- decoded. Various components in the output, (**message**,
- **header**, **body**, **attachment**, and MIME **part**), will
- be delimited by easily-parsed markers. Each marker consists of
- a Control-L character (ASCII decimal 12), the name of the
- marker, and then either an opening or closing brace, ('{' or
- '}'), to either open or close the component. For a multipart
- MIME message, these parts will be nested.
-
- **json**
- The output is formatted with Javascript Object Notation
- (JSON). This format is more robust than the text format for
- automated processing. The nested structure of multipart MIME
- messages is reflected in nested JSON output. By default JSON
- output includes all messages in a matching thread; that is, by
- default, ``--format=json`` sets ``--entire-thread``. The
- caller can disable this behaviour by setting
- ``--entire-thread=false``. The JSON output is always encoded
- as UTF-8 and any message content included in the output will
- be charset-converted to UTF-8.
-
- **sexp**
- The output is formatted as the Lisp s-expression (sexp)
- equivalent of the JSON format above. Objects are formatted as
- property lists whose keys are keywords (symbols preceded by a
- colon). True is formatted as ``t`` and both false and null are
- formatted as ``nil``. As for JSON, the s-expression output is
- always encoded as UTF-8.
-
- **mbox**
- All matching messages are output in the traditional, Unix mbox
- format with each message being prefixed by a line beginning
- with "From " and a blank line separating each message. Lines
- in the message content beginning with "From " (preceded by
- zero or more '>' characters) have an additional '>' character
- added. This reversible escaping is termed "mboxrd" format and
- described in detail here:
-
- http://homepage.ntlworld.com/jonathan.deboynepollard/FGA/mail-mbox-formats.html
-
- **raw** (default if ``--part`` is given)
- Write the raw bytes of the given MIME part of a message to
- standard out. For this format, it is an error to specify a
- query that matches more than one message.
-
- If the specified part is a leaf part, this outputs the body of
- the part after performing content transfer decoding (but no
- charset conversion). This is suitable for saving attachments,
- for example.
-
- For a multipart or message part, the output includes the part
- headers as well as the body (including all child parts). No
- decoding is performed because multipart and message parts
- cannot have non-trivial content transfer encoding. Consumers
- of this may need to implement MIME decoding and similar
- functions.
-
-``--format-version=N``
- Use the specified structured output format version. This is
- intended for programs that invoke **notmuch(1)** internally. If
- omitted, the latest supported version will be used.
-
-``--part=N``
- Output the single decoded MIME part N of a single message. The
- search terms must match only a single message. Message parts are
- numbered in a depth-first walk of the message MIME structure, and
- are identified in the 'json', 'sexp' or 'text' output formats.
-
- Note that even a message with no MIME structure or a single body
- part still has two MIME parts: part 0 is the whole message
- (headers and body) and part 1 is just the body.
-
-``--verify``
- Compute and report the validity of any MIME cryptographic
- signatures found in the selected content (e.g., "multipart/signed"
- parts). Status of the signature will be reported (currently only
- supported with ``--format=json`` and ``--format=sexp``), and the
- multipart/signed part will be replaced by the signed data.
-
-``--decrypt=(false|auto|true|stash)``
- If ``true``, decrypt any MIME encrypted parts found in the
- selected content (e.g., "multipart/encrypted" parts). Status of
- the decryption will be reported (currently only supported
- with ``--format=json`` and ``--format=sexp``) and on successful
- decryption the multipart/encrypted part will be replaced by
- the decrypted content.
-
- ``stash`` behaves like ``true``, but upon successful decryption it
- will also stash the message's session key in the database, and
- index the cleartext of the message, enabling automatic decryption
- in the future.
-
- If ``auto``, and a session key is already known for the
- message, then it will be decrypted, but notmuch will not try
- to access the user's keys.
-
- Use ``false`` to avoid even automatic decryption.
-
- Non-automatic decryption (``stash`` or ``true``, in the absence of
- a stashed session key) expects a functioning **gpg-agent(1)** to
- provide any needed credentials. Without one, the decryption will
- fail.
-
- Note: setting either ``true`` or ``stash`` here implies
- ``--verify``.
-
- Here is a table that summarizes each of these policies:
-
- +------------------------+-------+------+------+-------+
- | | false | auto | true | stash |
- +========================+=======+======+======+=======+
- | Show cleartext if | | X | X | X |
- | session key is | | | | |
- | already known | | | | |
- +------------------------+-------+------+------+-------+
- | Use secret keys to | | | X | X |
- | show cleartext | | | | |
- +------------------------+-------+------+------+-------+
- | Stash any newly | | | | X |
- | recovered session keys,| | | | |
- | reindexing message if | | | | |
- | found | | | | |
- +------------------------+-------+------+------+-------+
-
- Note: ``--decrypt=stash`` requires write access to the database.
- Otherwise, ``notmuch show`` operates entirely in read-only mode.
-
- Default: ``auto``
-
-``--exclude=(true|false)``
- Specify whether to omit threads only matching search.exclude\_tags
- from the search results (the default) or not. In either case the
- excluded message will be marked with the exclude flag (except when
- output=mbox when there is nowhere to put the flag).
-
- If ``--entire-thread`` is specified then complete threads are returned
- regardless (with the excluded flag being set when appropriate) but
- threads that only match in an excluded message are not returned
- when ``--exclude=true.``
-
- The default is ``--exclude=true.``
-
-``--body=(true|false)``
- If true (the default) **notmuch show** includes the bodies of the
- messages in the output; if false, bodies are omitted.
- ``--body=false`` is only implemented for the text, json and sexp
- formats and it is incompatible with ``--part > 0.``
-
- This is useful if the caller only needs the headers as body-less
- output is much faster and substantially smaller.
-
-``--include-html``
- Include "text/html" parts as part of the output (currently
- only supported with ``--format=text``, ``--format=json`` and
- ``--format=sexp``). By default, unless ``--part=N`` is used to
- select a specific part or ``--include-html`` is used to include all
- "text/html" parts, no part with content type "text/html" is included
- in the output.
-
-A common use of **notmuch show** is to display a single thread of email
-messages. For this, use a search term of "thread:<thread-id>" as can be
-seen in the first column of output from the **notmuch search** command.
+.. program:: show
+
+.. option:: --entire-thread=(true|false)
+
+ If true, **notmuch show** outputs all messages in the thread of
+ any message matching the search terms; if false, it outputs only
+ the matching messages. For ``--format=json`` and ``--format=sexp``
+ this defaults to true. For other formats, this defaults to false.
+
+.. option:: --format=(text|json|sexp|mbox|raw)
+
+ **text** (default for messages)
+ The default plain-text format has all text-content MIME parts
+ decoded. Various components in the output, (**message**,
+ **header**, **body**, **attachment**, and MIME **part**), will
+ be delimited by easily-parsed markers. Each marker consists of
+ a Control-L character (ASCII decimal 12), the name of the
+ marker, and then either an opening or closing brace, ('{' or
+ '}'), to either open or close the component. For a multipart
+ MIME message, these parts will be nested.
+
+ **json**
+ The output is formatted with Javascript Object Notation
+ (JSON). This format is more robust than the text format for
+ automated processing. The nested structure of multipart MIME
+ messages is reflected in nested JSON output. By default JSON
+ output includes all messages in a matching thread; that is, by
+ default, ``--format=json`` sets ``--entire-thread``. The
+ caller can disable this behaviour by setting
+ ``--entire-thread=false``. The JSON output is always encoded
+ as UTF-8 and any message content included in the output will
+ be charset-converted to UTF-8.
+
+ **sexp**
+ The output is formatted as the Lisp s-expression (sexp)
+ equivalent of the JSON format above. Objects are formatted as
+ property lists whose keys are keywords (symbols preceded by a
+ colon). True is formatted as ``t`` and both false and null are
+ formatted as ``nil``. As for JSON, the s-expression output is
+ always encoded as UTF-8.
+
+ **mbox**
+ All matching messages are output in the traditional, Unix mbox
+ format with each message being prefixed by a line beginning
+ with "From " and a blank line separating each message. Lines
+ in the message content beginning with "From " (preceded by
+ zero or more '>' characters) have an additional '>' character
+ added. This reversible escaping is termed "mboxrd" format and
+ described in detail here:
+
+ http://homepage.ntlworld.com/jonathan.deboynepollard/FGA/mail-mbox-formats.html
+
+ **raw** (default if ``--part`` is given)
+ Write the raw bytes of the given MIME part of a message to
+ standard out. For this format, it is an error to specify a
+ query that matches more than one message.
+
+ If the specified part is a leaf part, this outputs the body of
+ the part after performing content transfer decoding (but no
+ charset conversion). This is suitable for saving attachments,
+ for example.
+
+ For a multipart or message part, the output includes the part
+ headers as well as the body (including all child parts). No
+ decoding is performed because multipart and message parts
+ cannot have non-trivial content transfer encoding. Consumers
+ of this may need to implement MIME decoding and similar
+ functions.
+
+.. option:: --format-version=N
+
+ Use the specified structured output format version. This is
+ intended for programs that invoke :any:`notmuch(1)` internally. If
+ omitted, the latest supported version will be used.
+
+.. option:: --part=N
+
+ Output the single decoded MIME part N of a single message. The
+ search terms must match only a single message. Message parts are
+ numbered in a depth-first walk of the message MIME structure, and
+ are identified in the 'json', 'sexp' or 'text' output formats.
+
+ Note that even a message with no MIME structure or a single body
+ part still has two MIME parts: part 0 is the whole message
+ (headers and body) and part 1 is just the body.
+
+.. option:: --verify
+
+ Compute and report the validity of any MIME cryptographic
+ signatures found in the selected content (e.g., "multipart/signed"
+ parts). Status of the signature will be reported (currently only
+ supported with ``--format=json`` and ``--format=sexp``), and the
+ multipart/signed part will be replaced by the signed data.
+
+.. option:: --decrypt=(false|auto|true|stash)
+
+ If ``true``, decrypt any MIME encrypted parts found in the
+ selected content (e.g., "multipart/encrypted" parts). Status of
+ the decryption will be reported (currently only supported
+ with ``--format=json`` and ``--format=sexp``) and on successful
+ decryption the multipart/encrypted part will be replaced by
+ the decrypted content.
+
+ ``stash`` behaves like ``true``, but upon successful decryption it
+ will also stash the message's session key in the database, and
+ index the cleartext of the message, enabling automatic decryption
+ in the future.
+
+ If ``auto``, and a session key is already known for the
+ message, then it will be decrypted, but notmuch will not try
+ to access the user's keys.
+
+ Use ``false`` to avoid even automatic decryption.
+
+ Non-automatic decryption (``stash`` or ``true``, in the absence of
+ a stashed session key) expects a functioning :manpage:`gpg-agent(1)` to
+ provide any needed credentials. Without one, the decryption will
+ fail.
+
+ Note: setting either ``true`` or ``stash`` here implies
+ ``--verify``.
+
+ Here is a table that summarizes each of these policies:
+
+ +------------------------+-------+------+------+-------+
+ | | false | auto | true | stash |
+ +========================+=======+======+======+=======+
+ | Show cleartext if | | X | X | X |
+ | session key is | | | | |
+ | already known | | | | |
+ +------------------------+-------+------+------+-------+
+ | Use secret keys to | | | X | X |
+ | show cleartext | | | | |
+ +------------------------+-------+------+------+-------+
+ | Stash any newly | | | | X |
+ | recovered session keys,| | | | |
+ | reindexing message if | | | | |
+ | found | | | | |
+ +------------------------+-------+------+------+-------+
+
+ Note: ``--decrypt=stash`` requires write access to the database.
+ Otherwise, ``notmuch show`` operates entirely in read-only mode.
+
+ Default: ``auto``
+
+.. option:: --exclude=(true|false)
+
+ Specify whether to omit threads only matching search.exclude\_tags
+ from the search results (the default) or not. In either case the
+ excluded message will be marked with the exclude flag (except when
+ output=mbox when there is nowhere to put the flag).
+
+ If ``--entire-thread`` is specified then complete threads are returned
+ regardless (with the excluded flag being set when appropriate) but
+ threads that only match in an excluded message are not returned
+ when ``--exclude=true.``
+
+ The default is ``--exclude=true.``
+
+.. option:: --body=(true|false)
+
+ If true (the default) **notmuch show** includes the bodies of the
+ messages in the output; if false, bodies are omitted.
+ ``--body=false`` is only implemented for the text, json and sexp
+ formats and it is incompatible with ``--part > 0.``
+
+ This is useful if the caller only needs the headers as body-less
+ output is much faster and substantially smaller.
+
+.. option:: --include-html
+
+ Include "text/html" parts as part of the output (currently
+ only supported with ``--format=text``, ``--format=json`` and
+ ``--format=sexp``). By default, unless ``--part=N`` is used to
+ select a specific part or ``--include-html`` is used to include all
+ "text/html" parts, no part with content type "text/html" is included
+ in the output.
+
+A common use of **notmuch show** is to display a single thread of
+email messages. For this, use a search term of "thread:<thread-id>" as
+can be seen in the first column of output from the
+:any:`notmuch-search(1)` command.
EXIT STATUS
===========
SEE ALSO
========
-**notmuch(1)**,
-**notmuch-config(1)**,
-**notmuch-count(1)**,
-**notmuch-dump(1)**,
-**notmuch-hooks(5)**,
-**notmuch-insert(1)**,
-**notmuch-new(1)**,
-**notmuch-reply(1)**,
-**notmuch-restore(1)**,
-**notmuch-search(1)**,
-**notmuch-search-terms(7)**,
-**notmuch-tag(1)**
+:any:`notmuch(1)`,
+:any:`notmuch-config(1)`,
+:any:`notmuch-count(1)`,
+:any:`notmuch-dump(1)`,
+:any:`notmuch-hooks(5)`,
+:any:`notmuch-insert(1)`,
+:any:`notmuch-new(1)`,
+:any:`notmuch-reply(1)`,
+:any:`notmuch-restore(1)`,
+:any:`notmuch-search(1)`,
+:any:`notmuch-search-terms(7)`,
+:any:`notmuch-tag(1)`
+.. _notmuch-tag(1):
+
===========
notmuch-tag
===========
Add/remove tags for all messages matching the search terms.
-See **notmuch-search-terms(7)** for details of the supported syntax for
+See :any:`notmuch-search-terms(7)` for details of the supported syntax for
<*search-term*\ >.
Tags prefixed by '+' are added while those prefixed by '-' are removed.
**notmuch tag** updates the maildir flags according to tag changes if
the **maildir.synchronize\_flags** configuration option is enabled. See
-**notmuch-config(1)** for details.
+:any:`notmuch-config(1)` for details.
Supported options for **tag** include
-``--remove-all``
- Remove all tags from each message matching the search terms before
- applying the tag changes appearing on the command line. This
- means setting the tags of each message to the tags to be added. If
- there are no tags to be added, the messages will have no tags.
+.. program:: tag
+
+.. option:: --remove-all
+
+ Remove all tags from each message matching the search terms before
+ applying the tag changes appearing on the command line. This
+ means setting the tags of each message to the tags to be added. If
+ there are no tags to be added, the messages will have no tags.
+
+.. option:: --batch
+
+ Read batch tagging operations from a file (stdin by default).
+ This is more efficient than repeated **notmuch tag**
+ invocations. See `TAG FILE FORMAT <#tag_file_format>`__ below for
+ the input format. This option is not compatible with specifying
+ tagging on the command line.
-``--batch``
- Read batch tagging operations from a file (stdin by default).
- This is more efficient than repeated **notmuch tag**
- invocations. See `TAG FILE FORMAT <#tag_file_format>`__ below for
- the input format. This option is not compatible with specifying
- tagging on the command line.
+.. option:: --input=<filename>
-``--input=``\ <filename>
- Read input from given file, instead of from stdin. Implies
- ``--batch``.
+ Read input from given file, instead of from stdin. Implies
+ ``--batch``.
TAG FILE FORMAT
===============
SEE ALSO
========
-**notmuch(1)**,
-**notmuch-config(1)**,
-**notmuch-count(1)**,
-**notmuch-dump(1)**,
-**notmuch-hooks(5)**,
-**notmuch-insert(1)**,
-**notmuch-new(1)**,
-**notmuch-reply(1)**,
-**notmuch-restore(1)**,
-**notmuch-search(1)**,
-**notmuch-search-terms(7)**,
-**notmuch-show(1)**,
+:any:`notmuch(1)`,
+:any:`notmuch-config(1)`,
+:any:`notmuch-count(1)`,
+:any:`notmuch-dump(1)`,
+:any:`notmuch-hooks(5)`,
+:any:`notmuch-insert(1)`,
+:any:`notmuch-new(1)`,
+:any:`notmuch-reply(1)`,
+:any:`notmuch-restore(1)`,
+:any:`notmuch-search(1)`,
+:any:`notmuch-search-terms(7)`,
+:any:`notmuch-show(1)`,
+.. _notmuch(1):
+.. _notmuch-setup(1):
+
=======
notmuch
=======
This page describes how to get started using notmuch from the command
line, and gives a brief overview of the commands available. For more
-information on e.g. **notmuch show** consult the **notmuch-show(1)** man
-page, also accessible via **notmuch help show**
+information on e.g. **notmuch show** consult the
+:any:`notmuch-show(1)` man page, also accessible via **notmuch help
+show**
The quickest way to get started with Notmuch is to simply invoke the
``notmuch`` command with no arguments, which will interactively guide
Supported global options for ``notmuch`` include
-``--help`` [command-name]
- Print a synopsis of available commands and exit. With an optional
- command name, show the man page for that subcommand.
+.. program:: notmuch
+
+.. option:: --help [command-name]
+
+ Print a synopsis of available commands and exit. With an optional
+ command name, show the man page for that subcommand.
+
+.. option:: --version
+
+ Print the installed version of notmuch, and exit.
+
+.. option:: --config=FILE
-``--version``
- Print the installed version of notmuch, and exit.
+ Specify the configuration file to use. This overrides any
+ configuration file specified by :envvar:`NOTMUCH_CONFIG`. The empty
+ string is a permitted and sometimes useful value of *FILE*, which
+ tells ``notmuch`` to use only configuration metadata from the database.
-``--config=FILE``
- Specify the configuration file to use. This overrides any
- configuration file specified by ${NOTMUCH\_CONFIG}. The empty
- string is a permitted and sometimes useful value of *FILE*, which
- tells ``notmuch`` to use only configuration metadata from the database.
+.. option:: --uuid=HEX
-``--uuid=HEX``
- Enforce that the database UUID (a unique identifier which persists
- until e.g. the database is compacted) is HEX; exit with an error
- if it is not. This is useful to detect rollover in modification
- counts on messages. You can find this UUID using e.g. ``notmuch
- count --lastmod``
+ Enforce that the database UUID (a unique identifier which persists
+ until e.g. the database is compacted) is HEX; exit with an error
+ if it is not. This is useful to detect rollover in modification
+ counts on messages. You can find this UUID using e.g. ``notmuch
+ count --lastmod``
All global options except ``--config`` can also be specified after the
command. For example, ``notmuch subcommand --uuid=HEX`` is equivalent
The setup command will prompt for your full name, your primary email
address, any alternate email addresses you use, and the directory
containing your email archives. Your answers will be written to a
-configuration file in ${NOTMUCH\_CONFIG} (if set) or
+configuration file in :envvar:`NOTMUCH_CONFIG` (if set) or
${HOME}/.notmuch-config . This configuration file will be created with
descriptive comments, making it easy to edit by hand later to change the
configuration. Or you can run **notmuch setup** again to change the
Mail storage that uses mbox format, (where one mbox file contains many
messages), will not work with notmuch. If that's how your mail is
currently stored, it is recommended you first convert it to maildir
-format with a utility such as mb2md before running **notmuch setup .**
+format with a utility such as :manpage:`mb2md(1)` before running
+**notmuch setup**.
Invoking ``notmuch`` with no command argument will run **setup** if the
setup command has not previously been completed.
--------------
Several of the notmuch commands accept search terms with a common
-syntax. See **notmuch-search-terms**\ (7) for more details on the
+syntax. See :any:`notmuch-search-terms(7)` for more details on the
supported syntax.
-The **search**, **show**, **address** and **count** commands are used
-to query the email database.
+The :any:`notmuch-search(1)`, :any:`notmuch-show(1)`,
+:any:`notmuch-address(1)` and :any:`notmuch-count(1)` commands are
+used to query the email database.
-The **reply** command is useful for preparing a template for an email
-reply.
+The :any:`notmuch-reply(1)` command is useful for preparing a template
+for an email reply.
-The **tag** command is the only command available for manipulating
-database contents.
+The :any:`notmuch-tag(1)` command is the only command available for
+manipulating database contents.
-The **dump** and **restore** commands can be used to create a textual
-dump of email tags for backup purposes, and to restore from that dump.
+The :any:`notmuch-dump(1)` and :any:`notmuch-restore(1)` commands can
+be used to create a textual dump of email tags for backup purposes,
+and to restore from that dump.
-The **config** command can be used to get or set settings in the notmuch
-configuration file.
+The :any:`notmuch-config(1)` command can be used to get or set
+settings in the notmuch configuration file.
CUSTOM COMMANDS
---------------
If the given command is not known to notmuch, notmuch tries to execute
-the external **notmuch-<subcommand>** in ${PATH} instead. This allows
-users to have their own notmuch related tools to be run via the
+the external **notmuch-<subcommand>** in :envvar:`PATH` instead. This
+allows users to have their own notmuch related tools to be run via the
notmuch command. By design, this does not allow notmuch's own commands
to be overridden using external commands.
The following environment variables can be used to control the behavior
of notmuch.
-**NOTMUCH\_CONFIG**
- Specifies the location of the notmuch configuration file. Notmuch
- will use ${HOME}/.notmuch-config if this variable is not set.
+.. envvar:: NOTMUCH_CONFIG
+
+ Specifies the location of the notmuch configuration file. See
+ :any:`notmuch-config(1)` for details.
+
+.. envvar:: NOTMUCH_PROFILE
+
+ Selects among notmuch configurations. See :any:`notmuch-config(1)`
+ for details.
+
+.. envvar:: NOTMUCH_TALLOC_REPORT
+
+ Location to write a talloc memory usage report. See
+ **talloc\_enable\_leak\_report\_full** in :manpage:`talloc(3)` for more
+ information.
-**NOTMUCH\_TALLOC\_REPORT**
- Location to write a talloc memory usage report. See
- **talloc\_enable\_leak\_report\_full** in **talloc(3)** for more
- information.
+.. envvar:: NOTMUCH_DEBUG_QUERY
-**NOTMUCH\_DEBUG\_QUERY**
- If set to a non-empty value, the notmuch library will print (to
- stderr) Xapian queries it constructs.
+ If set to a non-empty value, the notmuch library will print (to
+ stderr) Xapian queries it constructs.
SEE ALSO
========
-**notmuch-address(1)**,
-**notmuch-compact(1)**,
-**notmuch-config(1)**,
-**notmuch-count(1)**,
-**notmuch-dump(1)**,
-**notmuch-hooks(5)**,
-**notmuch-insert(1)**,
-**notmuch-new(1)**,
-**notmuch-properties(7)**,
-**notmuch-reindex(1)**,
-**notmuch-reply(1)**,
-**notmuch-restore(1)**,
-**notmuch-search(1)**,
-**notmuch-search-terms(7)**,
-**notmuch-show(1)**,
-**notmuch-tag(1)**
+:any:`notmuch-address(1)`,
+:any:`notmuch-compact(1)`,
+:any:`notmuch-config(1)`,
+:any:`notmuch-count(1)`,
+:any:`notmuch-dump(1)`,
+:any:`notmuch-hooks(5)`,
+:any:`notmuch-insert(1)`,
+:any:`notmuch-new(1)`,
+:any:`notmuch-properties(7)`,
+:any:`notmuch-reindex(1)`,
+:any:`notmuch-reply(1)`,
+:any:`notmuch-restore(1)`,
+:any:`notmuch-search(1)`,
+:any:`notmuch-search-terms(7)`,
+:any:`notmuch-show(1)`,
+:any:`notmuch-tag(1)`
The notmuch website: **https://notmuchmail.org**
+.. _notmuch-hooks(5):
+
=============
notmuch-hooks
=============
Hooks are scripts (or arbitrary executables or symlinks to such) that
notmuch invokes before and after certain actions. These scripts reside
-in a directory defined as described in **notmuch-config(1)**. They
+in a directory defined as described in :any:`notmuch-config(1)`. They
must have executable permissions.
The currently available hooks are described below.
**pre-new**
- This hook is invoked by the **new** command before scanning or
- importing new messages into the database. If this hook exits with
- a non-zero status, notmuch will abort further processing of the
- **new** command.
+ This hook is invoked by the :any:`notmuch-new(1)` command before
+ scanning or importing new messages into the database. If this hook
+ exits with a non-zero status, notmuch will abort further
+ processing of the :any:`notmuch-new(1)` command.
Typically this hook is used for fetching or delivering new mail to
be imported into the database.
**post-new**
- This hook is invoked by the **new** command after new messages
- have been imported into the database and initial tags have been
- applied. The hook will not be run if there have been any errors
- during the scan or import.
+ This hook is invoked by the :any:`notmuch-new(1)` command after
+ new messages have been imported into the database and initial tags
+ have been applied. The hook will not be run if there have been any
+ errors during the scan or import.
Typically this hook is used to perform additional query-based
tagging on the imported messages.
**post-insert**
- This hook is invoked by the **insert** command after the message
- has been delivered, added to the database, and initial tags have
- been applied. The hook will not be run if there have been any
- errors during the message delivery; what is regarded as successful
- delivery depends on the ``--keep`` option.
+ This hook is invoked by the :any:`notmuch-insert(1)` command after
+ the message has been delivered, added to the database, and initial
+ tags have been applied. The hook will not be run if there have
+ been any errors during the message delivery; what is regarded as
+ successful delivery depends on the ``--keep`` option.
Typically this hook is used to perform additional query-based
tagging on the delivered messages.
SEE ALSO
========
-**notmuch(1)**,
-**notmuch-config(1)**,
-**notmuch-count(1)**,
-**notmuch-dump(1)**,
-**notmuch-insert(1)**,
-**notmuch-new(1)**,
-**notmuch-reply(1)**,
-**notmuch-restore(1)**,
-**notmuch-search(1)**,
-**notmuch-search-terms(7)**,
-**notmuch-show(1)**,
-**notmuch-tag(1)**
+:any:`notmuch(1)`,
+:any:`notmuch-config(1)`,
+:any:`notmuch-count(1)`,
+:any:`notmuch-dump(1)`,
+:any:`notmuch-insert(1)`,
+:any:`notmuch-new(1)`,
+:any:`notmuch-reply(1)`,
+:any:`notmuch-restore(1)`,
+:any:`notmuch-search(1)`,
+:any:`notmuch-search-terms(7)`,
+:any:`notmuch-show(1)`,
+:any:`notmuch-tag(1)`
+.. _notmuch-properties(7):
+
==================
notmuch-properties
==================
===========
Any property with a key that starts with "index." will be removed (and
-possibly re-set) upon reindexing (see **notmuch-reindex(1)**).
+possibly re-set) upon reindexing (see :any:`notmuch-reindex(1)`).
MESSAGE PROPERTIES
==================
If notmuch never tried to decrypt an encrypted message during
indexing (which is the default, see ``index.decrypt`` in
- **notmuch-config(1)**), then this property will not be set on that
+ :any:`notmuch-config(1)`), then this property will not be set on that
message.
**session-key**
- When **notmuch-show(1)** or **nomtuch-reply** encounters a message
- with an encrypted part, if notmuch finds a ``session-key``
- property associated with the message, it will try that stashed
- session key for decryption.
+ When :any:`notmuch-show(1)` or :any:`notmuch-reply(1)` encounters
+ a message with an encrypted part, if notmuch finds a
+ ``session-key`` property associated with the message, it will try
+ that stashed session key for decryption.
If you do not want to use any stashed session keys that might be
present, you should pass those programs ``--decrypt=false``.
message. This includes attachments, cryptographic signatures, and
other material that cannot be reconstructed from the index alone.
- See ``index.decrypt`` in **notmuch-config(1)** for more
+ See ``index.decrypt`` in :any:`notmuch-config(1)` for more
details about how to set notmuch's policy on when to store session
keys.
SEE ALSO
========
-**notmuch(1)**,
-**notmuch-config(1)**,
-**notmuch-dump(1)**,
-**notmuch-insert(1)**,
-**notmuch-new(1)**,
-**notmuch-reindex(1)**,
-**notmuch-reply(1)**,
-**notmuch-restore(1)**,
-**notmuch-show(1)**,
-***notmuch-search-terms(7)**
+:any:`notmuch(1)`,
+:any:`notmuch-config(1)`,
+:any:`notmuch-dump(1)`,
+:any:`notmuch-insert(1)`,
+:any:`notmuch-new(1)`,
+:any:`notmuch-reindex(1)`,
+:any:`notmuch-reply(1)`,
+:any:`notmuch-restore(1)`,
+:any:`notmuch-search-terms(7)`,
+:any:`notmuch-show(1)`
+.. _notmuch-search-terms(7):
+
====================
notmuch-search-terms
====================
Some of the prefixes with <regex> forms can be also used to restrict
the results to those whose value matches a regular expression (see
-**regex(7)**) delimited with //, for example::
+:manpage:`regex(7)`) delimited with //, for example::
notmuch search 'from:"/bob@.*[.]example[.]com/"'
tag:<tag> or tag:/<regex>/ or is:<tag> or is:/<regex>/
For **tag:** and **is:** valid tag values include **inbox** and
- **unread** by default for new messages added by **notmuch new** as
- well as any other tag values added manually with **notmuch tag**.
+ **unread** by default for new messages added by
+ :any:`notmuch-new(1)` as well as any other tag values added
+ manually with :any:`notmuch-tag(1)`.
id:<message-id> or mid:<message-id> or mid:/<regex>/
For **id:** and **mid:**, message ID values are the literal
The **thread:** prefix can be used with the thread ID values that
are generated internally by notmuch (and do not appear in email
messages). These thread ID values can be seen in the first column
- of output from **notmuch search**
+ of output from :any:`notmuch-search(1)`
thread:{<notmuch query>}
Threads may be searched for indirectly by providing an arbitrary
The **lastmod:** prefix can be used to restrict the result by the
database revision number of when messages were last modified (tags
were added/removed or filenames changed). This is usually used in
- conjunction with the ``--uuid`` argument to **notmuch search** to
- find messages that have changed since an earlier query.
+ conjunction with the ``--uuid`` argument to
+ :any:`notmuch-search(1)` to find messages that have changed since
+ an earlier query.
query:<name>
The **query:** prefix allows queries to refer to previously saved
- queries added with **notmuch-config(1)**.
+ queries added with :any:`notmuch-config(1)`.
property:<key>=<value>
The **property:** prefix searches for messages with a particular
<key>=<value> property pair. Properties are used internally by
notmuch (and extensions) to add metadata to messages. A given key
can be present on a given message with several different values.
- See **notmuch-properties(7)** for more details.
+ See :any:`notmuch-properties(7)` for more details.
-User defined prefixes are also supported, see **notmuch-config(1)** for
+User defined prefixes are also supported, see :any:`notmuch-config(1)` for
details.
Operators
SEE ALSO
========
-**notmuch(1)**,
-**notmuch-config(1)**,
-**notmuch-count(1)**,
-**notmuch-dump(1)**,
-**notmuch-hooks(5)**,
-**notmuch-insert(1)**,
-**notmuch-new(1)**,
-**notmuch-reindex(1)**,
-**notmuch-properties(1)**,
-***notmuch-reply(1)**,
-**notmuch-restore(1)**,
-**notmuch-search(1)**,
-***notmuch-show(1)**,
-**notmuch-tag(1)**
+:any:`notmuch(1)`,
+:any:`notmuch-config(1)`,
+:any:`notmuch-count(1)`,
+:any:`notmuch-dump(1)`,
+:any:`notmuch-hooks(5)`,
+:any:`notmuch-insert(1)`,
+:any:`notmuch-new(1)`,
+:any:`notmuch-properties(7)`,
+:any:`notmuch-reindex(1)`,
+:any:`notmuch-reply(1)`,
+:any:`notmuch-restore(1)`,
+:any:`notmuch-search(1)`,
+:any:`notmuch-show(1)`,
+:any:`notmuch-tag(1)`
:index:`notmuch-poll-script`
|docstring::notmuch-poll-script|
+Sending Mail
+------------
+
+:index:`mail-user-agent`
+
+ Emacs consults the variable :ref:`mail-user-agent` to choose a mail
+ sending package for commands like :ref:`report-emacs-bug` and
+ :ref:`compose-mail`. To use ``notmuch`` for this, customize this
+ variable to the symbol :ref:`notmuch-user-agent`.
+
Init File
---------
(require 'notmuch-mua)
(declare-function notmuch-search "notmuch"
- (&optional query oldest-first target-thread target-line continuation))
-(declare-function notmuch-poll "notmuch" ())
+ (&optional query oldest-first target-thread target-line
+ no-display))
+(declare-function notmuch-poll "notmuch-lib" ())
(declare-function notmuch-tree "notmuch-tree"
- (&optional query query-context target buffer-name open-target unthreaded))
-(declare-function notmuch-unthreaded
- (&optional query query-context target buffer-name open-target))
+ (&optional query query-context target buffer-name
+ open-target unthreaded parent-buffer))
+(declare-function notmuch-unthreaded "notmuch-tree"
+ (&optional query query-context target buffer-name
+ open-target))
;;; Options
(require 'notmuch-print)
(require 'notmuch-draft)
-(declare-function notmuch-call-notmuch-process "notmuch" (&rest args))
+(declare-function notmuch-call-notmuch-process "notmuch-lib" (&rest args))
(declare-function notmuch-search-next-thread "notmuch" nil)
(declare-function notmuch-search-previous-thread "notmuch" nil)
-(declare-function notmuch-search-show-thread "notmuch" nil)
+(declare-function notmuch-search-show-thread "notmuch")
(declare-function notmuch-foreach-mime-part "notmuch" (function mm-handle))
(declare-function notmuch-count-attachments "notmuch" (mm-handle))
(declare-function notmuch-save-attachments "notmuch" (mm-handle &optional queryp))
(declare-function notmuch-tree "notmuch-tree"
(&optional query query-context target buffer-name
- open-target unthreaded))
+ open-target unthreaded parent-buffer))
(declare-function notmuch-tree-get-message-properties "notmuch-tree" nil)
-(declare-function notmuch-unthreaded
- (&optional query query-context target buffer-name open-target))
+(declare-function notmuch-unthreaded "notmuch-tree"
+ (&optional query query-context target buffer-name
+ open-target))
(declare-function notmuch-read-query "notmuch" (prompt))
(declare-function notmuch-draft-resume "notmuch-draft" (id))
;;; Options
(defcustom notmuch-show-stash-mlarchive-link-alist
- '(("Gmane" . "https://mid.gmane.org/")
- ("MARC" . "https://marc.info/?i=")
+ '(("MARC" . "https://marc.info/?i=")
("Mail Archive, The" . "https://mid.mail-archive.com/")
- ("LKML" . "https://lkml.kernel.org/r/")
+ ("Lore" . "https://lore.kernel.org/r/")
+ ("Notmuch" . "https://nmbug.notmuchmail.org/nmweb/show/")
;; FIXME: can these services be searched by `Message-Id' ?
;; ("MarkMail" . "http://markmail.org/")
;; ("Nabble" . "http://nabble.com/")
(function :tag "Function returning the URL")))
:group 'notmuch-show)
-(defcustom notmuch-show-stash-mlarchive-link-default "Gmane"
+(defcustom notmuch-show-stash-mlarchive-link-default "MARC"
"Default Mailing List Archive to use when stashing links.
This is used when `notmuch-show-stash-mlarchive-link' isn't
(require 'notmuch-jump)
(declare-function notmuch-search "notmuch"
- (&optional query oldest-first target-thread target-line))
-(declare-function notmuch-call-notmuch-process "notmuch" (&rest args))
+ (&optional query oldest-first target-thread target-line
+ no-display))
+(declare-function notmuch-call-notmuch-process "notmuch-lib" (&rest args))
(declare-function notmuch-read-query "notmuch" (prompt))
(declare-function notmuch-search-find-thread-id "notmuch" (&optional bare))
(declare-function notmuch-search-find-subject "notmuch" ())
")")
notmuch-tree-basic-query))
-(defun notmuch-tree (&optional query query-context target buffer-name open-target unthreaded parent-buffer)
+(defun notmuch-tree (&optional query query-context target buffer-name
+ open-target unthreaded parent-buffer)
"Display threads matching QUERY in tree view.
The arguments are:
(setq notmuch-tree-parent-buffer parent-buffer)
(setq truncate-lines t))
-(defun notmuch-unthreaded (&optional query query-context target buffer-name open-target)
+(defun notmuch-unthreaded (&optional query query-context target buffer-name
+ open-target)
(interactive)
(notmuch-tree query query-context target buffer-name open-target t))
(put 'notmuch-search 'notmuch-doc "Search for messages.")
;;;###autoload
-(defun notmuch-search (&optional query oldest-first target-thread target-line no-display)
+(defun notmuch-search (&optional query oldest-first target-thread target-line
+ no-display)
"Display threads matching QUERY in a notmuch-search buffer.
If QUERY is nil, it is read interactively from the minibuffer.
;;; _
-(setq mail-user-agent 'notmuch-user-agent)
-
(provide 'notmuch)
;; After provide to avoid loops if notmuch was require'd via notmuch-init-file.
static GMimeFilterClass *parent_class = NULL;
+static GType type = 0;
+static const GTypeInfo info = {
+ .class_size = sizeof (GMimeFilterReplyClass),
+ .base_init = NULL,
+ .base_finalize = NULL,
+ .class_init = (GClassInitFunc) g_mime_filter_reply_class_init,
+ .class_finalize = NULL,
+ .class_data = NULL,
+ .instance_size = sizeof (GMimeFilterReply),
+ .n_preallocs = 0,
+ .instance_init = (GInstanceInitFunc) g_mime_filter_reply_init,
+ .value_table = NULL,
+};
+
+
+void
+g_mime_filter_reply_module_init (void)
+{
+ type = g_type_register_static (GMIME_TYPE_FILTER, "GMimeFilterReply", &info, (GTypeFlags) 0);
+ parent_class = (GMimeFilterClass *) g_type_class_ref (GMIME_TYPE_FILTER);
+}
GType
g_mime_filter_reply_get_type (void)
{
- static GType type = 0;
-
- if (! type) {
- static const GTypeInfo info = {
- .class_size = sizeof (GMimeFilterReplyClass),
- .base_init = NULL,
- .base_finalize = NULL,
- .class_init = (GClassInitFunc) g_mime_filter_reply_class_init,
- .class_finalize = NULL,
- .class_data = NULL,
- .instance_size = sizeof (GMimeFilterReply),
- .n_preallocs = 0,
- .instance_init = (GInstanceInitFunc) g_mime_filter_reply_init,
- .value_table = NULL,
- };
-
- type = g_type_register_static (GMIME_TYPE_FILTER, "GMimeFilterReply", &info, (GTypeFlags) 0);
- }
-
return type;
}
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GMimeFilterClass *filter_class = GMIME_FILTER_CLASS (klass);
- parent_class = (GMimeFilterClass *) g_type_class_ref (GMIME_TYPE_FILTER);
-
object_class->finalize = g_mime_filter_reply_finalize;
filter_class->copy = filter_copy;
#include <gmime/gmime-filter.h>
+void g_mime_filter_reply_module_init (void);
+
G_BEGIN_DECLS
#define GMIME_TYPE_FILTER_REPLY (g_mime_filter_reply_get_type ())
$(dir)/thread-fp.cc \
$(dir)/features.cc \
$(dir)/prefix.cc \
- $(dir)/open.cc
+ $(dir)/open.cc \
+ $(dir)/init.cc
libnotmuch_modules := $(libnotmuch_c_srcs:.c=.o) $(libnotmuch_cxx_srcs:.cc=.o)
static const char *
_notmuch_database_generate_thread_id (notmuch_database_t *notmuch)
{
- /* 16 bytes (+ terminator) for hexadecimal representation of
- * a 64-bit integer. */
- static char thread_id[17];
notmuch->last_thread_id++;
- sprintf (thread_id, "%016" PRIx64, notmuch->last_thread_id);
+ sprintf (notmuch->thread_id_str, "%016" PRIx64, notmuch->last_thread_id);
- notmuch->writable_xapian_db->set_metadata ("last_thread_id", thread_id);
+ notmuch->writable_xapian_db->set_metadata ("last_thread_id", notmuch->thread_id_str);
- return thread_id;
+ return notmuch->thread_id_str;
}
static char *
enum _notmuch_features features;
unsigned int last_doc_id;
+
+ /* 16 bytes (+ terminator) for hexadecimal representation of
+ * a 64-bit integer. */
+ char thread_id_str[17];
uint64_t last_thread_id;
/* error reporting; this value persists only until the
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GMimeFilterClass *filter_class = GMIME_FILTER_CLASS (klass);
- parent_class = (GMimeFilterClass *) g_type_class_ref (GMIME_TYPE_FILTER);
-
object_class->finalize = notmuch_filter_discard_non_term_finalize;
filter_class->copy = filter_copy;
*
* Returns: a new #NotmuchFilterDiscardNonTerm filter.
**/
+static GType type = 0;
+
+static const GTypeInfo info = {
+ .class_size = sizeof (NotmuchFilterDiscardNonTermClass),
+ .base_init = NULL,
+ .base_finalize = NULL,
+ .class_init = (GClassInitFunc) notmuch_filter_discard_non_term_class_init,
+ .class_finalize = NULL,
+ .class_data = NULL,
+ .instance_size = sizeof (NotmuchFilterDiscardNonTerm),
+ .n_preallocs = 0,
+ .instance_init = NULL,
+ .value_table = NULL,
+};
+
+void
+_notmuch_filter_init () {
+ type = g_type_register_static (GMIME_TYPE_FILTER, "NotmuchFilterDiscardNonTerm", &info,
+ (GTypeFlags) 0);
+ parent_class = (GMimeFilterClass *) g_type_class_ref (GMIME_TYPE_FILTER);
+}
+
static GMimeFilter *
notmuch_filter_discard_non_term_new (GMimeContentType *content_type)
{
- static GType type = 0;
NotmuchFilterDiscardNonTerm *filter;
- if (! type) {
- static const GTypeInfo info = {
- .class_size = sizeof (NotmuchFilterDiscardNonTermClass),
- .base_init = NULL,
- .base_finalize = NULL,
- .class_init = (GClassInitFunc) notmuch_filter_discard_non_term_class_init,
- .class_finalize = NULL,
- .class_data = NULL,
- .instance_size = sizeof (NotmuchFilterDiscardNonTerm),
- .n_preallocs = 0,
- .instance_init = NULL,
- .value_table = NULL,
- };
-
- type = g_type_register_static (GMIME_TYPE_FILTER, "NotmuchFilterDiscardNonTerm", &info,
- (GTypeFlags) 0);
- }
-
filter = (NotmuchFilterDiscardNonTerm *) g_object_new (type, NULL);
filter->content_type = content_type;
filter->state = 0;
--- /dev/null
+#include "notmuch-private.h"
+
+#include <mutex>
+
+static void do_init ()
+{
+ /* Initialize the GLib type system and threads */
+#if ! GLIB_CHECK_VERSION (2, 35, 1)
+ g_type_init ();
+#endif
+
+ g_mime_init ();
+ _notmuch_filter_init ();
+}
+
+void
+_notmuch_init ()
+{
+ static std::once_flag initialized;
+ std::call_once (initialized, do_init);
+}
{
GMimeParser *parser;
notmuch_status_t status = NOTMUCH_STATUS_SUCCESS;
- static int initialized = 0;
bool is_mbox;
if (message->message)
is_mbox = _is_mbox (message->stream);
- if (! initialized) {
- g_mime_init ();
- initialized = 1;
- }
+ _notmuch_init ();
message->headers = g_hash_table_new_full (strcase_hash, strcase_equal,
free, g_free);
};
/* ASCII ordered table of Maildir flags and associated tags */
-static struct maildir_flag_tag flag2tag[] = {
+static const struct maildir_flag_tag flag2tag[] = {
{ 'D', "draft", false },
{ 'F', "flagged", false },
{ 'P', "passed", false },
doc_id = _notmuch_database_generate_doc_id (notmuch);
} catch (const Xapian::Error &error) {
- _notmuch_database_log (notmuch_message_get_database (message),
+ _notmuch_database_log (notmuch,
"A Xapian exception occurred creating message: %s\n",
error.get_msg ().c_str ());
notmuch->exception_reported = true;
* properties, along with any automatic tags*/
/* According to Xapian API docs, none of these calls throw
* exceptions */
-notmuch_private_status_t
+static notmuch_private_status_t
_notmuch_message_remove_indexed_terms (notmuch_message_t *message)
{
Xapian::TermIterator i;
const char **thread_id);
/* index.cc */
+void
+_notmuch_filter_init ();
+
notmuch_status_t
_notmuch_message_index_file (notmuch_message_t *message,
notmuch_indexopts_t *indexopts,
notmuch_message_file_t *message_file);
+/* init.cc */
+void
+_notmuch_init ();
+
/* messages.c */
typedef struct _notmuch_message_node {
return NOTMUCH_STATUS_SUCCESS;
}
-notmuch_database_t *
+static notmuch_database_t *
_alloc_notmuch ()
{
notmuch_database_t *notmuch;
_notmuch_config_cache (notmuch, NOTMUCH_CONFIG_DATABASE_PATH, path);
}
-static void
-_init_libs ()
-{
-
- static int initialized = 0;
-
- /* Initialize the GLib type system and threads */
-#if ! GLIB_CHECK_VERSION (2, 35, 1)
- g_type_init ();
-#endif
-
- /* Initialize gmime */
- if (! initialized) {
- g_mime_init ();
- initialized = 1;
- }
-}
-
static void
_load_database_state (notmuch_database_t *notmuch)
{
GKeyFile *key_file = NULL;
bool split = false;
- _init_libs ();
+ _notmuch_init ();
notmuch = _alloc_notmuch ();
if (! notmuch) {
int err;
bool split = false;
- _init_libs ();
+ _notmuch_init ();
notmuch = _alloc_notmuch ();
if (! notmuch) {
return NOTMUCH_STATUS_SUCCESS;
}
-notmuch_status_t
+static notmuch_status_t
_maybe_load_config_from_database (notmuch_database_t *notmuch,
GKeyFile *key_file,
const char *database_path,
GKeyFile *key_file = NULL;
bool split = false;
- _init_libs ();
+ _notmuch_init ();
notmuch = _alloc_notmuch ();
if (! notmuch) {
#include <glib.h> /* GHashTable */
#ifdef DEBUG_THREADING
-#define THREAD_DEBUG(format, ...) fprintf (stderr, format " (%s).\n", ##__VA_ARGS__, __location__)
+#define THREAD_DEBUG(format, ...) fprintf (stderr, "DT: " format " (%s).\n", ##__VA_ARGS__, \
+ __location__)
#else
#define THREAD_DEBUG(format, ...) do {} while (0) /* ignored */
#endif
const char *in_reply_to;
in_reply_to = _notmuch_message_get_in_reply_to (message);
- THREAD_DEBUG ("checking message = %s in_reply_to=%s\n",
+ THREAD_DEBUG ("checking message = %s in_reply_to=%s",
notmuch_message_get_message_id (message), in_reply_to);
if (in_reply_to && (! EMPTY_STRING (in_reply_to)) &&
const notmuch_string_list_t *references =
_notmuch_message_get_references (message);
- THREAD_DEBUG ("trying to reparent via references: %s\n",
+ THREAD_DEBUG ("trying to reparent via references: %s",
notmuch_message_get_message_id (message));
for (notmuch_string_node_t *ref_node = references->head;
ref_node; ref_node = ref_node->next) {
- THREAD_DEBUG ("checking reference=%s\n", ref_node->string);
+ THREAD_DEBUG ("checking reference=%s", ref_node->string);
if ((g_hash_table_lookup_extended (thread->message_hash,
ref_node->string, NULL,
(void **) &new_parent))) {
size_t new_depth = _notmuch_message_get_thread_depth (new_parent);
- THREAD_DEBUG ("got depth %lu\n", new_depth);
+ THREAD_DEBUG ("got depth %lu", new_depth);
if (new_depth > max_depth || ! parent) {
- THREAD_DEBUG ("adding at depth %lu parent=%s\n", new_depth, ref_node->string);
+ THREAD_DEBUG ("adding at depth %lu parent=%s", new_depth, ref_node->string);
max_depth = new_depth;
parent = new_parent;
}
}
}
if (parent) {
- THREAD_DEBUG ("adding reply %s to parent=%s\n",
+ THREAD_DEBUG ("adding reply %s to parent=%s",
notmuch_message_get_message_id (message),
notmuch_message_get_message_id (parent));
_notmuch_message_add_reply (parent, message);
} else {
- THREAD_DEBUG ("adding as toplevel %s\n",
+ THREAD_DEBUG ("adding as toplevel %s",
notmuch_message_get_message_id (message));
_notmuch_message_list_add_message (thread->toplevel_list, message);
}
*/
if (first_node) {
message = first_node->message;
- THREAD_DEBUG ("checking first message %s\n",
+ THREAD_DEBUG ("checking first message %s",
notmuch_message_get_message_id (message));
if (_notmuch_message_list_empty (maybe_toplevel_list) ||
! _parent_via_in_reply_to (thread, message)) {
- THREAD_DEBUG ("adding first message as toplevel = %s\n",
+ THREAD_DEBUG ("adding first message as toplevel = %s",
notmuch_message_get_message_id (message));
_notmuch_message_list_add_message (maybe_toplevel_list, message);
}
--- /dev/null
+#include "notmuch-client.h"
+#include "gmime-filter-reply.h"
+
+/* Caller is responsible for only calling this once */
+
+void
+notmuch_client_init (void)
+{
+#if ! GLIB_CHECK_VERSION (2, 35, 1)
+ g_type_init ();
+#endif
+
+ g_mime_init ();
+
+ g_mime_filter_reply_module_init ();
+
+ talloc_enable_null_tracking ();
+}
char *
json_quote_str (const void *ctx, const char *str);
+/* notmuch-client-init.c */
+
+void notmuch_client_init (void);
+
/* notmuch-config.c */
typedef enum {
"\n"
" For more information about notmuch, see https://notmuchmail.org";
-struct config_group {
+static const struct config_group {
const char *group_name;
const char *comment;
} group_comment_table [] = {
bool (*validate)(const char *);
} config_key_info_t;
-static struct config_key
+static const struct config_key
config_key_table[] = {
{ "index.decrypt", false, NULL },
{ "index.header.", true, validate_field_name },
{ "query.", true, NULL },
};
-static config_key_info_t *
+static const config_key_info_t *
_config_key_info (const char *item)
{
for (size_t i = 0; i < ARRAY_SIZE (config_key_table); i++) {
int argc, char *argv[])
{
char *group, *key;
- config_key_info_t *key_info;
+ const config_key_info_t *key_info;
notmuch_conffile_t *config;
bool update_database = false;
int opt_index, ret;
static void
handle_sigint (unused (int sig))
{
- static char msg[] = "Stopping... \n";
+ static const char msg[] = "Stopping... \n";
/* This write is "opportunistic", so it's okay to ignore the
* result. It is not required for correctness, and if it does
static void
handle_sigint (unused (int sig))
{
- static char msg[] = "Stopping... \n";
+ static const char msg[] = "Stopping... \n";
/* This write is "opportunistic", so it's okay to ignore the
* result. It is not required for correctness, and if it does
break;
/* Non-fatal issues (go on to next file). */
case NOTMUCH_STATUS_DUPLICATE_MESSAGE_ID:
- if (state->synchronize_flags)
- notmuch_message_maildir_flags_to_tags (message);
+ if (state->synchronize_flags) {
+ status = notmuch_message_maildir_flags_to_tags (message);
+ if (print_status_message ("add_file", message, status))
+ goto DONE;
+ }
break;
case NOTMUCH_STATUS_FILE_NOT_EMAIL:
fprintf (stderr, "Note: Ignoring non-mail file: %s\n", filename);
static void
handle_sigint (unused (int sig))
{
- static char msg[] = "Stopping... \n";
+ static const char msg[] = "Stopping... \n";
/* This write is "opportunistic", so it's okay to ignore the
* result. It is not required for correctness, and if it does
static void
handle_sigint (unused (int sig))
{
- static char msg[] = "Stopping... \n";
+ static const char msg[] = "Stopping... \n";
/* This write is "opportunistic", so it's okay to ignore the
* result. It is not required for correctness, and if it does
}
-static command_t commands[] = {
+static const command_t commands[] = {
{ NULL, notmuch_command, NOTMUCH_COMMAND_CONFIG_CREATE | NOTMUCH_COMMAND_CONFIG_LOAD,
"Notmuch main command." },
{ "setup", notmuch_setup_command, NOTMUCH_COMMAND_CONFIG_CREATE | NOTMUCH_COMMAND_CONFIG_LOAD,
const char *summary;
} help_topic_t;
-static help_topic_t help_topics[] = {
+static const help_topic_t help_topics[] = {
{ "search-terms",
"Common search term syntax." },
{ "hooks",
"Message property conventions and documentation." },
};
-static command_t *
+static const command_t *
find_command (const char *name)
{
size_t i;
static void
usage (FILE *out)
{
- command_t *command;
- help_topic_t *topic;
+ const command_t *command;
+ const help_topic_t *topic;
unsigned int i;
fprintf (out,
static int
_help_for (const char *topic_name)
{
- command_t *command;
- help_topic_t *topic;
+ const command_t *command;
+ const help_topic_t *topic;
unsigned int i;
if (! topic_name) {
void *local;
char *talloc_report;
const char *command_name = NULL;
- command_t *command;
+ const command_t *command;
const char *config_file_name = NULL;
notmuch_database_t *notmuch = NULL;
int opt_index;
{ }
};
- talloc_enable_null_tracking ();
+ notmuch_client_init ();
local = talloc_new (NULL);
- g_mime_init ();
-#if ! GLIB_CHECK_VERSION (2, 35, 1)
- g_type_init ();
-#endif
-
/* Globally default to the current output format version. */
notmuch_format_version = NOTMUCH_FORMAT_CUR;
- xz. Some speedup can be gotten by installing "pixz", but this is
probably only worthwhile if you are debugging the tests.
- valgrind (for the memory tests)
+- perf (optional, for more fine-grained timing)
Getting set up to run tests:
----------------------------
--small / --medium / --large Choose corpus size.
--debug Enable debugging. In particular don't delete
- temporary directories.
+ temporary directories.
+--perf Run perf record in place of /usr/bin/time. Perf output can be
+ found in a log directory.
+--call-graph {fp,lbr,dwarf} Call graph option for perf record. Default is 'lbr'.
When using the make targets, you can pass arguments to all test
scripts by defining the make variable OPTIONS.
+Log Directory
+-------------
+
+The memory tests, and the time tests when option '--perf' is given
+save their output in a directory named as follows
+
+ log.$test_name-$corpus_size-$timestamp
+
+These directories are removed by "make clean".
+
Writing tests
-------------
time_run 'reindex *' "notmuch reindex '*'"
time_run 'reindex *' "notmuch reindex '*'"
+manifest=$(mktemp manifestXXXXXX)
+
+find mail -type f ! -path 'mail/.notmuch/*' | sed -n '1~4 p' > $manifest
+# arithmetic context is to eat extra whitespace on e.g. some BSDs
+count=$((`wc -l < $manifest`))
+
+xargs tar uf backup.tar < $manifest
+
+perl -nle 'rename $_, "$_.renamed"' $manifest
+
+time_run "reindex ($count mv)" "notmuch reindex '*'"
+
+perl -nle 'rename "$_.renamed", $_' $manifest
+
+time_run "reindex ($count mv back)" "notmuch reindex '*'"
+
+perl -nle 'unlink $_; unlink $_.copy' $manifest
+
+time_run "reindex ($count rm)" "notmuch reindex '*'"
+
+tar xf backup.tar
+
+time_run "reindex ($count restore)" "notmuch reindex '*'"
+
+perl -nle 'link $_, "$_.copy"' $manifest
+
+time_run "reindex ($count cp)" "notmuch reindex '*'"
+
time_done
. $(dirname "$0")/version.sh || exit 1
+debug=""
corpus_size=large
+perf_callgraph=lbr
+use_perf=0
while test "$#" -ne 0
do
debug=t;
shift
;;
+ -p|--perf)
+ use_perf=1;
+ shift
+ ;;
+ -c|--call-graph)
+ shift
+ perf_callgraph=$1
+ shift
+ ;;
-s|--small)
corpus_size=small;
shift
fi
}
+make_log_dir () {
+ local timestamp=$(date +%Y%m%dT%H%M%S)
+ log_dir=${TEST_DIRECTORY}/log.$(basename $0)-$corpus_size-${timestamp}
+ mkdir -p "${log_dir}"
+}
+
time_start ()
{
add_email_corpus
+ if [[ "$use_perf" = 1 ]]; then
+ make_log_dir
+ fi
+
print_header
notmuch_new_with_cache time_run
{
add_email_corpus
- local timestamp=$(date +%Y%m%dT%H%M%S)
- log_dir="${TEST_DIRECTORY}/log.$(basename $0)-$corpus_size-${timestamp}"
- mkdir -p ${log_dir}
+ make_log_dir
notmuch_new_with_cache memory_run
}
printf " %-22s" "$1"
test_count=$(($test_count+1))
if test "$verbose" != "t"; then exec 4>test.output 3>&4; fi
- if ! eval >&3 "/usr/bin/time -f '%e\t%U\t%S\t%M\t%I/%O' $2" ; then
+ if [[ "$use_perf" = 1 ]]; then
+ command_str="perf record --call-graph=${perf_callgraph} -o ${log_dir}/${test_count}.perf $2"
+ else
+ command_str="/usr/bin/time -f '%e\t%U\t%S\t%M\t%I/%O' $2"
+ fi
+
+ if ! eval >&3 "$command_str" ; then
test_failure=$(($test_failure + 1))
return 1
fi
test_expect_code 2 'test_when_finished "(exit 2)"'
EXPECTED=$NOTMUCH_SRCDIR/test/test.expected-output
-suppress_diff_date() {
+suppress_diff_date () {
sed -e 's/\(.*\-\-\- test-verbose\.4\.\expected\).*/\1/' \
-e 's/\(.*\+\+\+ test-verbose\.4\.\output\).*/\1/'
}
notmuch config set new.tags $OLDCONFIG
+test_begin_subtest "RFC822 group names are indexed"
+test_subtest_known_broken
+generate_message [to]="undisclosed-recipients:"
+NOTMUCH_NEW > OUTPUT
+output=$(notmuch search --output=messages to:undisclosed-recipients)
+test_expect_equal "${output}" "${gen_msg_id}"
+
test_begin_subtest "Long directory names don't cause rescan"
test_subtest_known_broken
printf -v name 'z%.0s' {1..234}
# They happen to be in the mail directory already but that is okay
# since we do not call notmuch new hereafter.
-gen_insert_msg() {
+gen_insert_msg () {
generate_message \
"[subject]=\"insert-subject\"" \
"[date]=\"Sat, 01 Jan 2000 12:00:00 -0000\"" \
# Generates a thread consisting of a top level message and 'length'
# replies. The subject of the top message 'subject: top message"
# and the subject of the nth reply in the thread is "subject: reply n"
-generate_thread ()
-{
+generate_thread () {
local subject="$1"
local length="$2"
generate_message '[subject]="'"${subject}: top message"'"' '[body]="'"body of top message"'"'
done
notmuch new > /dev/null
# We cannot retrieve the thread_id until after we have run notmuch new.
- gen_thread_id=`notmuch search --output=threads id:${gen_thread_msg_id[0]}`
+ gen_thread_id=$(notmuch search --output=threads id:${gen_thread_msg_id[0]} 2>/dev/null)
}
#############################################
#!/usr/bin/env bash
test_description="--format=json output"
. $(dirname "$0")/test-lib.sh || exit 1
+. $NOTMUCH_SRCDIR/test/test-lib-emacs.sh || exit 1
test_begin_subtest "Show message: json"
add_message "[subject]=\"json-show-subject\"" "[date]=\"Sat, 01 Jan 2000 12:00:00 -0000\"" "[bcc]=\"test_suite+bcc@notmuchmail.org\"" "[reply-to]=\"test_suite+replyto@notmuchmail.org\"" "[body]=\"json-show-message\""
#!/usr/bin/env bash
test_description="--format=sexp output"
. $(dirname "$0")/test-lib.sh || exit 1
+. $NOTMUCH_SRCDIR/test/test-lib-emacs.sh || exit 1
test_begin_subtest "Show message: sexp"
add_message "[subject]=\"sexp-show-subject\"" "[date]=\"Sat, 01 Jan 2000 12:00:00 -0000\"" "[bcc]=\"test_suite+bcc@notmuchmail.org\"" "[reply-to]=\"test_suite+replyto@notmuchmail.org\"" "[body]=\"sexp-show-message\""
notmuch new > /dev/null
-cat_expected_head ()
-{
+cat_expected_head () {
cat <<EOF
[[[{"id": "htmlmessage", "match":true, "excluded": false, "date_relative":"2000-01-01",
"crypto": {},
test_begin_subtest "RFC 2047 encoded word with spaces"
add_message '[subject]="=?utf-8?q?encoded word with spaces?="'
-output=$(notmuch search id:${gen_msg_id} 2>&1 | notmuch_show_sanitize)
-test_expect_equal "$output" "thread:0000000000000003 2001-01-05 [1/1] Notmuch Test Suite; encoded word with spaces (inbox unread)"
+output=$(notmuch search id:${gen_msg_id} 2>&1 | notmuch_search_sanitize)
+test_expect_equal "$output" "thread:XXX 2001-01-05 [1/1] Notmuch Test Suite; encoded word with spaces (inbox unread)"
test_begin_subtest "RFC 2047 encoded words back to back"
add_message '[subject]="=?utf-8?q?encoded-words-back?==?utf-8?q?to-back?="'
-output=$(notmuch search id:${gen_msg_id} 2>&1 | notmuch_show_sanitize)
-test_expect_equal "$output" "thread:0000000000000004 2001-01-05 [1/1] Notmuch Test Suite; encoded-words-backto-back (inbox unread)"
+output=$(notmuch search id:${gen_msg_id} 2>&1 | notmuch_search_sanitize)
+test_expect_equal "$output" "thread:XXX 2001-01-05 [1/1] Notmuch Test Suite; encoded-words-backto-back (inbox unread)"
test_begin_subtest "RFC 2047 encoded words without space before or after"
add_message '[subject]="=?utf-8?q?encoded?=word without=?utf-8?q?space?=" '
-output=$(notmuch search id:${gen_msg_id} 2>&1 | notmuch_show_sanitize)
-test_expect_equal "$output" "thread:0000000000000005 2001-01-05 [1/1] Notmuch Test Suite; encodedword withoutspace (inbox unread)"
+output=$(notmuch search id:${gen_msg_id} 2>&1 | notmuch_search_sanitize)
+test_expect_equal "$output" "thread:XXX 2001-01-05 [1/1] Notmuch Test Suite; encodedword withoutspace (inbox unread)"
test_begin_subtest "Mislabeled Windows-1252 encoding"
add_message '[content-type]="text/plain; charset=iso-8859-1"' \
test_description="emacs interface"
. $(dirname "$0")/test-lib.sh || exit 1
+. $NOTMUCH_SRCDIR/test/test-lib-emacs.sh || exit 1
EXPECTED=$NOTMUCH_SRCDIR/test/emacs.expected-output
+test_require_emacs
add_email_corpus
# syntax errors in test-lib.el cause mysterious failures
(notmuch-show-stash-message-id-stripped)
(notmuch-show-stash-tags)
(notmuch-show-stash-filename)
- (notmuch-show-stash-mlarchive-link "Gmane")
+ (notmuch-show-stash-mlarchive-link "Notmuch")
(notmuch-show-stash-mlarchive-link "MARC")
(notmuch-show-stash-mlarchive-link "Mail Archive, The")
(switch-to-buffer
bought
inbox,stashtest
${gen_msg_filename}
-https://mid.gmane.org/bought
+https://nmbug.notmuchmail.org/nmweb/show/bought
https://marc.info/?i=bought
https://mid.mail-archive.com/bought
EOF
=== MESSAGES ===
YYY/notmuch_fail exited with status 1 (see *Notmuch errors* for more details)
=== ERROR ===
-[XXX]
YYY/notmuch_fail exited with status 1
command: YYY/notmuch_fail search --format\=sexp --format-version\=4 --sort\=newest-first tag\:inbox
exit status: 1"
#!/usr/bin/env bash
test_description="Emacs with large search results buffer"
. $(dirname "$0")/test-lib.sh || exit 1
+. $NOTMUCH_SRCDIR/test/test-lib-emacs.sh || exit 1
x=xxxxxxxxxx # 10
x=$x$x$x$x$x$x$x$x$x$x # 100
x=$x$x$x$x$x$x$x$x$x # 900
+test_require_emacs
+
# We generate a long subject here (over 900 bytes) so that the emacs
# search results get large quickly. With 30 such messages we should
# cross several 4kB page boundaries and see the bug.
test_description="emacs: mail subject to filename"
. $(dirname "$0")/test-lib.sh || exit 1
+. $NOTMUCH_SRCDIR/test/test-lib-emacs.sh || exit 1
+
+test_require_emacs
# emacs server can't be started in a child process with $(test_emacs ...)
test_emacs '(ignore)' > /dev/null
test_description='PGP/MIME signature verification and decryption'
. $(dirname "$0")/test-lib.sh || exit 1
+. $NOTMUCH_SRCDIR/test/test-lib-emacs.sh || exit 1
##################################################
+test_require_emacs
add_gnupg_home
test_begin_subtest "emacs delivery of signed message"
test_description='S/MIME signature verification and decryption'
. $(dirname "$0")/test-lib.sh || exit 1
+. $NOTMUCH_SRCDIR/test/test-lib-emacs.sh || exit 1
+test_require_emacs
test_require_external_prereq openssl
test_require_external_prereq gpgsm
test_description='indexing decrypted mail'
. $(dirname "$0")/test-lib.sh || exit 1
+. $NOTMUCH_SRCDIR/test/test-lib-emacs.sh || exit 1
##################################################
+test_require_emacs
add_gnupg_home
# create a test encrypted message
test_description="protected headers in emacs interface"
. $(dirname "$0")/test-lib.sh || exit 1
+. $NOTMUCH_SRCDIR/test/test-lib-emacs.sh || exit 1
# testing protected headers with emacs
+test_require_emacs
add_gnupg_home
add_email_corpus protected-headers
${TEST_GDB} -tty /dev/null -batch -x $NOTMUCH_SRCDIR/test/atomicity.py notmuch 1>gdb.out 2>&1
# Get the final, golden output
- notmuch search '*' > expected
+ notmuch search '*' 2>/dev/null > expected
# Check output against golden output
outcount=$(cat outcount)
add_email_corpus
+test_ruby() {
+ (
+ cat <<-EOF
+ require 'notmuch'
+ db = Notmuch::Database.new('$MAIL_DIR')
+ EOF
+ cat
+ ) | $NOTMUCH_RUBY -I "$NOTMUCH_BUILDDIR/bindings/ruby"> OUTPUT
+ test_expect_equal_file EXPECTED OUTPUT
+}
+
test_begin_subtest "compare thread ids"
+notmuch search --sort=oldest-first --output=threads tag:inbox > EXPECTED
test_ruby <<"EOF"
-require 'notmuch'
-$maildir = ENV['MAIL_DIR']
-if not $maildir then
- abort('environment variable MAIL_DIR must be set')
-end
-@db = Notmuch::Database.new($maildir)
-@q = @db.query('tag:inbox')
-@q.sort = Notmuch::SORT_OLDEST_FIRST
-for t in @q.search_threads do
- print t.thread_id, "\n"
+q = db.query('tag:inbox')
+q.sort = Notmuch::SORT_OLDEST_FIRST
+q.search_threads.each do |t|
+ puts 'thread:%s' % t.thread_id
end
EOF
-notmuch search --sort=oldest-first --output=threads tag:inbox | sed s/^thread:// > EXPECTED
-test_expect_equal_file EXPECTED OUTPUT
test_begin_subtest "compare message ids"
+notmuch search --sort=oldest-first --output=messages tag:inbox > EXPECTED
test_ruby <<"EOF"
-require 'notmuch'
-$maildir = ENV['MAIL_DIR']
-if not $maildir then
- abort('environment variable MAIL_DIR must be set')
-end
-@db = Notmuch::Database.new($maildir)
-@q = @db.query('tag:inbox')
-@q.sort = Notmuch::SORT_OLDEST_FIRST
-for m in @q.search_messages do
- print m.message_id, "\n"
+q = db.query('tag:inbox')
+q.sort = Notmuch::SORT_OLDEST_FIRST
+q.search_messages.each do |m|
+ puts 'id:%s' % m.message_id
end
EOF
-notmuch search --sort=oldest-first --output=messages tag:inbox | sed s/^id:// > EXPECTED
-test_expect_equal_file EXPECTED OUTPUT
test_begin_subtest "get non-existent file"
+echo nil > EXPECTED
test_ruby <<"EOF"
-require 'notmuch'
-$maildir = ENV['MAIL_DIR']
-if not $maildir then
- abort('environment variable MAIL_DIR must be set')
-end
-@db = Notmuch::Database.new($maildir)
-result = @db.find_message_by_filename('i-dont-exist')
-print (result == nil)
+p db.find_message_by_filename('i-dont-exist')
EOF
-test_expect_equal "$(cat OUTPUT)" "true"
test_begin_subtest "count messages"
+notmuch count --output=messages tag:inbox > EXPECTED
test_ruby <<"EOF"
-require 'notmuch'
-$maildir = ENV['MAIL_DIR']
-if not $maildir then
- abort('environment variable MAIL_DIR must be set')
-end
-@db = Notmuch::Database.new($maildir)
-@q = @db.query('tag:inbox')
-print @q.count_messages(),"\n"
+puts db.query('tag:inbox').count_messages()
EOF
-notmuch count --output=messages tag:inbox > EXPECTED
-test_expect_equal_file EXPECTED OUTPUT
test_begin_subtest "count threads"
+notmuch count --output=threads tag:inbox > EXPECTED
test_ruby <<"EOF"
-require 'notmuch'
-$maildir = ENV['MAIL_DIR']
-if not $maildir then
- abort('environment variable MAIL_DIR must be set')
-end
-@db = Notmuch::Database.new($maildir)
-@q = @db.query('tag:inbox')
-print @q.count_threads(),"\n"
+puts db.query('tag:inbox').count_threads()
EOF
-notmuch count --output=threads tag:inbox > EXPECTED
-test_expect_equal_file EXPECTED OUTPUT
test_begin_subtest "get all tags"
+notmuch search --output=tags '*' > EXPECTED
test_ruby <<"EOF"
-require 'notmuch'
-$maildir = ENV['MAIL_DIR']
-if not $maildir then
- abort('environment variable MAIL_DIR must be set')
+db.all_tags.each do |tag|
+ puts tag
end
-@db = Notmuch::Database.new($maildir)
-@t = @db.all_tags()
-for tag in @t do
- print tag,"\n"
+EOF
+
+notmuch config set search.exclude_tags deleted
+generate_message '[subject]="Good"'
+generate_message '[subject]="Bad"' "[in-reply-to]=\<$gen_msg_id\>"
+notmuch new > /dev/null
+notmuch tag +deleted id:$gen_msg_id
+
+test_begin_subtest "omit excluded all"
+notmuch search --output=threads --exclude=all tag:inbox > EXPECTED
+test_ruby <<"EOF"
+q = db.query('tag:inbox')
+q.add_tag_exclude('deleted')
+q.omit_excluded = Notmuch::EXCLUDE_ALL
+q.search_threads.each do |t|
+ puts 'thread:%s' % t.thread_id
end
EOF
-notmuch search --output=tags '*' > EXPECTED
-test_expect_equal_file EXPECTED OUTPUT
test_done
test_description="emacs test function sanity"
. $(dirname "$0")/test-lib.sh || exit 1
+. $NOTMUCH_SRCDIR/test/test-lib-emacs.sh || exit 1
test_begin_subtest "emacs test function sanity"
test_emacs_expect_t 't'
test_description="emacs address cleaning"
. $(dirname "$0")/test-lib.sh || exit 1
+. $NOTMUCH_SRCDIR/test/test-lib-emacs.sh || exit 1
+
+test_require_emacs
test_begin_subtest "notmuch-test-address-clean part 1"
test_emacs_expect_t '(notmuch-test-address-cleaning-1)'
test_description="emacs notmuch-hello view"
. $(dirname "$0")/test-lib.sh || exit 1
+. $NOTMUCH_SRCDIR/test/test-lib-emacs.sh || exit 1
EXPECTED=$NOTMUCH_SRCDIR/test/emacs.expected-output
+test_require_emacs
add_email_corpus
test_begin_subtest "User-defined section with inbox tag"
test_description="emacs notmuch-show view"
. $(dirname "$0")/test-lib.sh || exit 1
+. $NOTMUCH_SRCDIR/test/test-lib-emacs.sh || exit 1
EXPECTED=$NOTMUCH_SRCDIR/test/emacs-show.expected-output
+test_require_emacs
add_email_corpus
test_begin_subtest "Hiding Original Message region at beginning of a message"
=== MESSAGES ===
This is an error (see *Notmuch errors* for more details)
=== ERROR ===
-[XXX]
This is an error
command: YYY/notmuch_fail show --format\\=sexp --format-version\\=4 --decrypt\\=true --exclude\\=false \\' \\* \\'
exit status: 1
test_description="emacs notmuch-show charset handling"
. $(dirname "$0")/test-lib.sh || exit 1
+. $NOTMUCH_SRCDIR/test/test-lib-emacs.sh || exit 1
UTF8_YEN=$'\xef\xbf\xa5'
BIG5_YEN=$'\xa2\x44'
+test_require_emacs
+
# Add four messages with unusual encoding requirements:
#
# 1) text/plain in quoted-printable big5
test_description="emacs tree view interface"
. $(dirname "$0")/test-lib.sh || exit 1
+. $NOTMUCH_SRCDIR/test/test-lib-emacs.sh || exit 1
EXPECTED=$NOTMUCH_SRCDIR/test/emacs-tree.expected-output
+test_require_emacs
add_email_corpus
test_begin_subtest "Basic notmuch-tree view in emacs"
# Sanity/smoke tests for the date/time parser independent of notmuch
-_date ()
-{
+_date () {
date -d "$*" +%s
}
-_parse_time ()
-{
+_parse_time () {
${TEST_DIRECTORY}/parse-time --format=%s "$*"
}
# non-RFC-compliant headers'
. $(dirname "$0")/test-lib.sh || exit 1
+. $NOTMUCH_SRCDIR/test/test-lib-emacs.sh || exit 1
test_begin_subtest "Use References when In-Reply-To is broken"
add_message '[id]="foo@one.com"' \
add_email_corpus
+_libconfig_sanitize() {
+ ${NOTMUCH_PYTHON} /dev/fd/3 3<<'EOF'
+import os, sys, pwd, socket
+
+pw = pwd.getpwuid(os.getuid())
+user = pw.pw_name
+name = pw.pw_gecos.partition(",")[0]
+fqdn = socket.getaddrinfo(socket.gethostname(), 0, 0,
+ socket.SOCK_STREAM, 0, socket.AI_CANONNAME)[0][3]
+for l in sys.stdin:
+ if l[:4] == "08: ":
+ l = l.replace(user, "USERNAME", 1).replace("@" + fqdn, "@FQDN", 1)
+ l = l.replace(".(none)", "", 1).replace(".localdomain", "", 1)
+ elif l[:4] == "10: ":
+ l = l.replace("'" + name, "'USER_FULL_NAME", 1)
+ sys.stdout.write(l)
+EOF
+}
+
cat <<EOF > c_head
#include <string.h>
#include <stdlib.h>
key < NOTMUCH_CONFIG_LAST;
key = (notmuch_config_key_t)(key + 1)) {
const char *val = notmuch_config_get (db, key);
- printf("%s\n", val ? val : "NULL" );
+ printf("%02d: '%s'\n", key, val ? val : "NULL" );
}
}
EOF
-notmuch_passwd_sanitize < OUTPUT > OUTPUT.clean
+_libconfig_sanitize < OUTPUT > OUTPUT.clean
cat <<'EOF' >EXPECTED
== stdout ==
-MAIL_DIR
-MAIL_DIR
-MAIL_DIR/.notmuch/hooks
-MAIL_DIR/.notmuch/backups
-
-unread;inbox
-
-true
-USERNAME@FQDN
-NULL
-USER_FULL_NAME
+00: 'MAIL_DIR'
+01: 'MAIL_DIR'
+02: 'MAIL_DIR/.notmuch/hooks'
+03: 'MAIL_DIR/.notmuch/backups'
+04: ''
+05: 'unread;inbox'
+06: ''
+07: 'true'
+08: 'USERNAME@FQDN'
+09: 'NULL'
+10: 'USER_FULL_NAME'
== stderr ==
EOF
unset MAILDIR
key < NOTMUCH_CONFIG_LAST;
key = (notmuch_config_key_t)(key + 1)) {
const char *val = notmuch_config_get (db, key);
- printf("%s\n", val ? val : "NULL" );
+ printf("%x: '%s'\n", key, val ? val : "NULL" );
}
}
EOF
cat <<'EOF' >EXPECTED
== stdout ==
-MAIL_DIR
-MAIL_DIR
-MAIL_DIR/.notmuch/hooks
-MAIL_DIR/.notmuch/backups
-foo;bar;fub
-unread;inbox
-sekrit_junk
-true
-test_suite@notmuchmail.org
-test_suite_other@notmuchmail.org;test_suite@otherdomain.org
-Notmuch Test Suite
+0: 'MAIL_DIR'
+1: 'MAIL_DIR'
+2: 'MAIL_DIR/.notmuch/hooks'
+3: 'MAIL_DIR/.notmuch/backups'
+4: 'foo;bar;fub'
+5: 'unread;inbox'
+6: 'sekrit_junk'
+7: 'true'
+8: 'test_suite@notmuchmail.org'
+9: 'test_suite_other@notmuchmail.org;test_suite@otherdomain.org'
+a: 'Notmuch Test Suite'
== stderr ==
EOF
test_expect_equal_file EXPECTED OUTPUT
key < NOTMUCH_CONFIG_LAST;
key = (notmuch_config_key_t)(key + 1)) {
const char *val = notmuch_config_get (db, key);
- printf("%s\n", val ? val : "NULL" );
+ printf("%02d: '%s'\n", key, val ? val : "NULL" );
}
}
EOF
-notmuch_passwd_sanitize < OUTPUT > OUTPUT.clean
+_libconfig_sanitize < OUTPUT > OUTPUT.clean
+
cat <<'EOF' >EXPECTED
== stdout ==
-MAIL_DIR
-MAIL_DIR
-MAIL_DIR/.notmuch/hooks
-MAIL_DIR/.notmuch/backups
-
-unread;inbox
-
-true
-USERNAME@FQDN
-NULL
-USER_FULL_NAME
+00: 'MAIL_DIR'
+01: 'MAIL_DIR'
+02: 'MAIL_DIR/.notmuch/hooks'
+03: 'MAIL_DIR/.notmuch/backups'
+04: ''
+05: 'unread;inbox'
+06: ''
+07: 'true'
+08: 'USERNAME@FQDN'
+09: 'NULL'
+10: 'USER_FULL_NAME'
== stderr ==
EOF
test_expect_equal_file EXPECTED OUTPUT.clean
. $(dirname "$0")/test-lib.sh || exit 1
-message_a() {
+message_a () {
mkdir -p ${MAIL_DIR}/cur
cat > ${MAIL_DIR}/cur/a <<EOF
Subject: First message
EOF
}
-message_b() {
+message_b () {
mkdir -p ${MAIL_DIR}/cur
cat > ${MAIL_DIR}/cur/b <<EOF
Subject: Second message
}
-test_content_count() {
+test_content_count () {
test_begin_subtest "${3:-looking for $2 instance of '$1'}"
count=$(notmuch count --output=threads "$1")
test_expect_equal "$count" "$2"
}
-test_thread_count() {
+test_thread_count () {
test_begin_subtest "${2:-Expecting $1 thread(s)}"
count=$(notmuch count --output=threads)
test_expect_equal "$count" "$1"
}
-test_ghost_count() {
+test_ghost_count () {
test_begin_subtest "${2:-Expecting $1 ghosts(s)}"
ghosts=$($NOTMUCH_BUILDDIR/test/ghost-report ${MAIL_DIR}/.notmuch/xapian)
test_expect_equal "$ghosts" "$1"
#!/usr/bin/env bash
test_description="Emacs Draft Handling"
. $(dirname "$0")/test-lib.sh || exit 1
+. $NOTMUCH_SRCDIR/test/test-lib-emacs.sh || exit 1
+test_require_emacs
add_email_corpus
notmuch config set search.exclude_tags deleted
notmuch tag +usertag1 '*'
-notmuch search '*' | notmuch_search_sanitize > initial-threads
-notmuch search --output=messages '*' > initial-message-ids
+notmuch search '*' 2>1 | notmuch_search_sanitize > initial-threads
+notmuch search --output=messages '*' 2>/dev/null > initial-message-ids
notmuch dump > initial-dump
test_begin_subtest 'reindex preserves threads'
notmuch search '*' | notmuch_search_sanitize > OUTPUT
test_expect_equal_file EXPECTED OUTPUT
+
+test_begin_subtest "reindex after removing corpus"
+tar cf backup.tar mail/cur
+find mail/cur -type f -delete
+test_expect_success "notmuch reindex '*'"
+tar xf backup.tar
+
test_done
test_description="emacs attachment warnings"
. $(dirname "$0")/test-lib.sh || exit 1
+. $NOTMUCH_SRCDIR/test/test-lib-emacs.sh || exit 1
+
+test_require_emacs
test_begin_subtest "notmuch-test-attachment-warning part 1"
test_emacs_expect_t '(notmuch-test-attachment-warning-1)'
test_description="emacs forwarding"
. $(dirname "$0")/test-lib.sh || exit 1
+. $NOTMUCH_SRCDIR/test/test-lib-emacs.sh || exit 1
+
+test_require_emacs
test_begin_subtest "Forward setting the correct references header"
# Check that, when forwarding a message, the new message has
add_email_corpus
-notmuch search '*' | notmuch_search_sanitize > initial-threads
-notmuch search --output=messages '*' > initial-message-ids
+notmuch search '*' 2>1 | notmuch_search_sanitize > initial-threads
+notmuch search --output=messages '*' 2>/dev/null > initial-message-ids
notmuch dump > initial-dump
test_begin_subtest "adding illegal prefix name, bad utf8"
broken=0
total=0
all_skipped=0
+rep_failed=0
for file
do
+ if [ ! -f "$file" ]; then
+ echo "'$file' does not exist!"
+ rep_failed=$((rep_failed + 1))
+ continue
+ fi
+ has_total=0
while read type value
do
case $type in
broken=$((broken + value)) ;;
total)
total=$((total + value))
+ has_total=1
if [ "$value" -eq 0 ]; then
all_skipped=$((all_skipped + 1))
fi
esac
done <"$file"
+ if [ "$has_total" -eq 0 ]; then
+ echo "'$file' lacks 'total ...'; results may be inconsistent."
+ failed=$((failed + 1))
+ fi
done
pluralize_s () { [ "$1" -eq 1 ] && s='' || s='s'; }
echo "Notmuch test suite complete."
-if [ "$fixed" -eq 0 ] && [ "$failed" -eq 0 ]; then
+if [ "$fixed" -eq 0 ] && [ "$failed" -eq 0 ] && [ "$rep_failed" -eq 0 ]; then
pluralize_s "$total"
printf "All $total test$s "
if [ "$broken" -eq 0 ]; then
echo "All tests in $all_skipped file$s skipped."
fi
+if [ "$rep_failed" -ne 0 ]; then
+ pluralize_s "$rep_failed"
+ echo "$rep_failed test$s failed to report results."
+fi
+
# Note that we currently do not consider skipped tests as failing the
# build.
-if [ "$success" -gt 0 ] && [ "$fixed" -eq 0 ] && [ "$failed" -eq 0 ]
+if [ "$success" -gt 0 ] && [ "$fixed" -eq 0 ] &&
+ [ "$failed" -eq 0 ] && [ "$rep_failed" -eq 0 ]
then
exit 0
else
export NOTMUCH_SRCDIR="$(cd "$(dirname "$0")"/.. && pwd)"
fi
-find_builddir()
-{
+find_builddir () {
local dir="$1"
while [[ -n "$dir" ]] && [[ "$dir" != "/" ]]; do
# Ensure NOTMUCH_SRCDIR and NOTMUCH_BUILDDIR are set.
. $(dirname "$0")/export-dirs.sh || exit 1
+set -eu
+
TESTS=
-for test in $NOTMUCH_TESTS; do
+for test in ${NOTMUCH_TESTS-}; do
TESTS="$TESTS $NOTMUCH_SRCDIR/test/$test"
done
-if [[ -z "$TESTS" ]]; then
+if [ -z "$TESTS" ]; then
TESTS="$NOTMUCH_SRCDIR/test/T[0-9][0-9][0-9]-*.sh"
fi
TEST_TIMEOUT_CMD=""
fi
-trap 'e=$?; kill $!; exit $e' HUP INT TERM
-
META_FAILURE=
+RES=0
# Run the tests
-if test -z "$NOTMUCH_TEST_SERIALIZE" && command -v parallel >/dev/null ; then
+if test -z "${NOTMUCH_TEST_SERIALIZE-}" && command -v parallel >/dev/null ; then
test -t 1 && export COLORS_WITHOUT_TTY=t || :
if parallel --version 2>&1 | grep -q GNU ; then
echo "INFO: running tests with GNU parallel"
- printf '%s\n' $TESTS | $TEST_TIMEOUT_CMD parallel
+ printf '%s\n' $TESTS | $TEST_TIMEOUT_CMD parallel || RES=$?
else
echo "INFO: running tests with moreutils parallel"
- $TEST_TIMEOUT_CMD parallel -- $TESTS
+ $TEST_TIMEOUT_CMD parallel -- $TESTS || RES=$?
fi
- RES=$?
- if [[ $RES != 0 ]]; then
+ if [ $RES != 0 ]; then
META_FAILURE="parallel test suite returned error code $RES"
fi
else
+ trap 'e=$?; trap - 0; kill ${!-}; exit $e' 0 HUP INT TERM
for test in $TESTS; do
$TEST_TIMEOUT_CMD $test "$@" &
- wait $!
- # If the test failed without producing results, then it aborted,
- # so we should abort, too.
- RES=$?
- testname=$(basename $test .sh)
- if [[ $RES != 0 && ! -e "$NOTMUCH_BUILDDIR/test/test-results/$testname" ]]; then
- META_FAILURE="Aborting on $testname (returned $RES)"
- break
- fi
+ wait $! && ev=0 || ev=$?
+ test $ev = 0 || RES=$ev
done
+ trap - 0 HUP INT TERM
+ if [ $RES != 0 ]; then
+ META_FAILURE="some tests failed; first failed returned error code $RES"
+ fi
fi
-trap - HUP INT TERM
# Report results
+RESULT_FILES=
+for file in $TESTS
+do
+ file=${file##*/} # drop leading path components
+ file=${file%.sh} # drop trailing '.sh'
+ RESULT_FILES="$RESULT_FILES $NOTMUCH_BUILDDIR/test/test-results/$file"
+done
+
echo
-$NOTMUCH_SRCDIR/test/aggregate-results.sh $NOTMUCH_BUILDDIR/test/test-results/*
-ev=$?
+$NOTMUCH_SRCDIR/test/aggregate-results.sh $RESULT_FILES && ev=0 || ev=$?
+
if [ -n "$META_FAILURE" ]; then
printf 'ERROR: %s\n' "$META_FAILURE"
if [ $ev = 0 ]; then
gen_msg_cnt=0
gen_msg_filename=""
gen_msg_id=""
-generate_message ()
-{
+generate_message () {
# This is our (bash-specific) magic for doing named parameters
local -A template="($@)"
local additional_headers
#
# All of the arguments and return values supported by generate_message
# are also supported here, so see that function for details.
-add_message ()
-{
+add_message () {
generate_message "$@" &&
notmuch new > /dev/null
}
--- /dev/null
+#
+# Copyright (c) 2010-2020 Notmuch Developers
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see https://www.gnu.org/licenses/ .
+
+test_require_emacs () {
+ local ret=0
+ test_require_external_prereq "$TEST_EMACS" || ret=1
+ test_require_external_prereq "$TEST_EMACSCLIENT" || ret=1
+ test_require_external_prereq dtach || ret=1
+ return $ret
+}
+
+# Deliver a message with emacs and add it to the database
+#
+# Uses emacs to generate and deliver a message to the mail store.
+# Accepts arbitrary extra emacs/elisp functions to modify the message
+# before sending, which is useful to doing things like attaching files
+# to the message and encrypting/signing.
+emacs_deliver_message () {
+ local subject body smtp_dummy_pid smtp_dummy_port
+ subject="$1"
+ body="$2"
+ shift 2
+ # before we can send a message, we have to prepare the FCC maildir
+ mkdir -p "$MAIL_DIR"/sent/{cur,new,tmp}
+ # eval'ing smtp-dummy --background will set smtp_dummy_pid and -_port
+ smtp_dummy_pid= smtp_dummy_port=
+ eval `$TEST_DIRECTORY/smtp-dummy --background sent_message`
+ test -n "$smtp_dummy_pid" || return 1
+ test -n "$smtp_dummy_port" || return 1
+
+ test_emacs \
+ "(let ((message-send-mail-function 'message-smtpmail-send-it)
+ (mail-host-address \"example.com\")
+ (smtpmail-smtp-server \"localhost\")
+ (smtpmail-smtp-service \"${smtp_dummy_port}\"))
+ (notmuch-mua-mail)
+ (message-goto-to)
+ (insert \"test_suite@notmuchmail.org\nDate: 01 Jan 2000 12:00:00 -0000\")
+ (message-goto-subject)
+ (insert \"${subject}\")
+ (message-goto-body)
+ (insert \"${body}\")
+ $*
+ (notmuch-mua-send-and-exit))"
+
+ # In case message was sent properly, client waits for confirmation
+ # before exiting and resuming control here; therefore making sure
+ # that server exits by sending (KILL) signal to it is safe.
+ kill -9 $smtp_dummy_pid
+ notmuch new >/dev/null
+}
+
+# Pretend to deliver a message with emacs. Really save it to a file
+# and add it to the database
+#
+# Uses emacs to generate and deliver a message to the mail store.
+# Accepts arbitrary extra emacs/elisp functions to modify the message
+# before sending, which is useful to doing things like attaching files
+# to the message and encrypting/signing.
+#
+# If any GNU-style long-arguments (like --quiet or --decrypt=true) are
+# at the head of the argument list, they are sent directly to "notmuch
+# new" after message delivery
+emacs_fcc_message () {
+ local nmn_args subject body
+ nmn_args=''
+ while [[ "$1" =~ ^-- ]]; do
+ nmn_args="$nmn_args $1"
+ shift
+ done
+ subject="$1"
+ body="$2"
+ shift 2
+ # before we can send a message, we have to prepare the FCC maildir
+ mkdir -p "$MAIL_DIR"/sent/{cur,new,tmp}
+
+ test_emacs \
+ "(let ((message-send-mail-function (lambda () t))
+ (mail-host-address \"example.com\"))
+ (notmuch-mua-mail)
+ (message-goto-to)
+ (insert \"test_suite@notmuchmail.org\nDate: 01 Jan 2000 12:00:00 -0000\")
+ (message-goto-subject)
+ (insert \"${subject}\")
+ (message-goto-body)
+ (insert \"${body}\")
+ $*
+ (let ((mml-secure-smime-sign-with-sender t)
+ (mml-secure-openpgp-sign-with-sender t))
+ (notmuch-mua-send-and-exit)))" || return 1
+ notmuch new $nmn_args >/dev/null
+}
+
+test_emacs_expect_t () {
+ local result
+ test "$#" = 1 ||
+ error "bug in the test script: not 1 parameter to test_emacs_expect_t"
+ if [ -z "$inside_subtest" ]; then
+ error "bug in the test script: test_emacs_expect_t without test_begin_subtest"
+ fi
+
+ # Run the test.
+ if ! test_skip "$test_subtest_name"
+ then
+ test_emacs "(notmuch-test-run $1)" >/dev/null
+
+ # Restore state after the test.
+ exec 1>&6 2>&7 # Restore stdout and stderr
+ inside_subtest=
+
+ # test_emacs may update missing external prerequisites
+ test_check_missing_external_prereqs_ "$test_subtest_name" && return
+
+ # Report success/failure.
+ result=$(cat OUTPUT)
+ if [ "$result" = t ]
+ then
+ test_ok_
+ else
+ test_failure_ "${result}"
+ fi
+ else
+ # Restore state after the (non) test.
+ exec 1>&6 2>&7 # Restore stdout and stderr
+ inside_subtest=
+ fi
+}
+
+emacs_generate_script () {
+ # Construct a little test script here for the benefit of the user,
+ # (who can easily run "run_emacs" to get the same emacs environment
+ # for investigating any failures).
+ cat <<EOF >"$TMP_DIRECTORY/run_emacs"
+#!/bin/sh
+export PATH=$PATH
+export NOTMUCH_CONFIG=$NOTMUCH_CONFIG
+
+# Here's what we are using here:
+#
+# --quick Use minimal customization. This implies --no-init-file,
+# --no-site-file and (emacs 24) --no-site-lisp
+#
+# --directory Ensure that the local elisp sources are found
+#
+# --load Force loading of notmuch.el and test-lib.el
+
+exec ${TEST_EMACS} --quick \
+ --directory "$NOTMUCH_BUILDDIR/emacs" --load notmuch.el \
+ --directory "$NOTMUCH_SRCDIR/test" --load test-lib.el \
+ "\$@"
+EOF
+ chmod a+x "$TMP_DIRECTORY/run_emacs"
+}
+
+test_emacs () {
+ # test dependencies beforehand to avoid the waiting loop below
+ test_require_emacs || return
+
+ if [ -z "$EMACS_SERVER" ]; then
+ emacs_tests="$NOTMUCH_SRCDIR/test/${this_test_bare}.el"
+ if [ -f "$emacs_tests" ]; then
+ load_emacs_tests="--eval '(load \"$emacs_tests\")'"
+ else
+ load_emacs_tests=
+ fi
+ server_name="notmuch-test-suite-$$"
+ # start a detached session with an emacs server
+ # user's TERM (or 'vt100' in case user's TERM is known dumb
+ # or unknown) is given to dtach which assumes a minimally
+ # VT100-compatible terminal -- and emacs inherits that
+ TERM=$SMART_TERM dtach -n "$TEST_TMPDIR/emacs-dtach-socket.$$" \
+ sh -c "stty rows 24 cols 80; exec '$TMP_DIRECTORY/run_emacs' \
+ --no-window-system \
+ $load_emacs_tests \
+ --eval '(setq server-name \"$server_name\")' \
+ --eval '(server-start)' \
+ --eval '(orphan-watchdog $$)'" || return
+ EMACS_SERVER="$server_name"
+ # wait until the emacs server is up
+ until test_emacs '()' >/dev/null 2>/dev/null; do
+ sleep 1
+ done
+ fi
+
+ # Clear test-output output file. Most Emacs tests end with a
+ # call to (test-output). If the test code fails with an
+ # exception before this call, the output file won't get
+ # updated. Since we don't want to compare against an output
+ # file from another test, so start out with an empty file.
+ rm -f OUTPUT
+ touch OUTPUT
+
+ ${TEST_EMACSCLIENT} --socket-name="$EMACS_SERVER" --eval "(notmuch-test-progn $*)"
+}
+
+emacs_generate_script
# for reproducibility
unset EMAIL
+unset NAME
-add_gnupg_home ()
-{
+add_gnupg_home () {
[ -e "${GNUPGHOME}/gpg.conf" ] && return
_gnupg_exit () { gpgconf --kill all 2>/dev/null || true; }
at_exit_function _gnupg_exit
printf '%s:6:\n' "$FINGERPRINT" | gpg --quiet --batch --no-tty --import-ownertrust
}
-add_gpgsm_home ()
-{
+add_gpgsm_home () {
test_require_external_prereq openssl
local fpr
done
if test -n "$debug"; then
- print_subtest () {
- printf " %-4s" "[$((test_count - 1))]"
- }
+ fmt_subtest () {
+ printf -v $1 " %-4s" "[$((test_count - 1))]"
+ }
else
- print_subtest () {
- true
- }
+ fmt_subtest () {
+ printf -v $1 ''
+ }
fi
test -n "$COLORS_WITHOUT_TTY" || [ -t 1 ] || color=
-if [ -n "$color" ] && [ "$ORIGINAL_TERM" != 'dumb' ] && (
- TERM=$ORIGINAL_TERM &&
- export TERM &&
- tput bold
- tput setaf
- tput sgr0
- ) >/dev/null 2>&1
+if [ -n "$color" ] && [ "$ORIGINAL_TERM" != 'dumb' ] &&
+ tput -T "$ORIGINAL_TERM" -S <<<$'bold\nsetaf\nsgr0\n' >/dev/null 2>&1
then
color=t
else
color=
fi
-if test -n "$color"; then
+if test -n "$color"
+then
+ # _tput run in subshell (``) only
+ _tput () { exec tput -T "$ORIGINAL_TERM" "$@"; }
+ unset BOLD RED GREEN BROWN SGR0
say_color () {
- (
- TERM=$ORIGINAL_TERM
- export TERM
case "$1" in
- error) tput bold; tput setaf 1;; # bold red
- skip) tput bold; tput setaf 2;; # bold green
- pass) tput setaf 2;; # green
- info) tput setaf 3;; # brown
- *) test -n "$quiet" && return;;
+ error) b=${BOLD=`_tput bold`}
+ c=${RED=`_tput setaf 1`} ;; # bold red
+ skip) b=${BOLD=`_tput bold`}
+ c=${GREEN=`_tput setaf 2`} ;; # bold green
+ pass) b= c=${GREEN=`_tput setaf 2`} ;; # green
+ info) b= c=${BROWN=`_tput setaf 3`} ;; # brown
+ *) b= c=; test -n "$quiet" && return ;;
esac
- shift
- printf " "
- printf "$@"
- tput sgr0
- print_subtest
- )
+ f=$2
+ shift 2
+ sgr0=${SGR0=`_tput sgr0`}
+ fmt_subtest st
+ printf " ${b}${c}${f}${sgr0}${st}" "$@"
}
else
say_color() {
test -z "$1" && test -n "$quiet" && return
- shift
- printf " "
- printf "$@"
- print_subtest
+ f=$2
+ shift 2
+ fmt_subtest st
+ printf " ${f}${st}" "$@"
}
fi
fi
test_description_printed=
-print_test_description ()
-{
+print_test_description () {
test -z "$test_description_printed" || return 0
echo
echo $this_test: "Testing ${test_description}"
trap 'trap_exit' EXIT
trap 'trap_signal' HUP INT TERM
-# Deliver a message with emacs and add it to the database
-#
-# Uses emacs to generate and deliver a message to the mail store.
-# Accepts arbitrary extra emacs/elisp functions to modify the message
-# before sending, which is useful to doing things like attaching files
-# to the message and encrypting/signing.
-emacs_deliver_message ()
-{
- local subject body smtp_dummy_pid smtp_dummy_port
- subject="$1"
- body="$2"
- shift 2
- # before we can send a message, we have to prepare the FCC maildir
- mkdir -p "$MAIL_DIR"/sent/{cur,new,tmp}
- # eval'ing smtp-dummy --background will set smtp_dummy_pid and -_port
- smtp_dummy_pid= smtp_dummy_port=
- eval `$TEST_DIRECTORY/smtp-dummy --background sent_message`
- test -n "$smtp_dummy_pid" || return 1
- test -n "$smtp_dummy_port" || return 1
-
- test_emacs \
- "(let ((message-send-mail-function 'message-smtpmail-send-it)
- (mail-host-address \"example.com\")
- (smtpmail-smtp-server \"localhost\")
- (smtpmail-smtp-service \"${smtp_dummy_port}\"))
- (notmuch-mua-mail)
- (message-goto-to)
- (insert \"test_suite@notmuchmail.org\nDate: 01 Jan 2000 12:00:00 -0000\")
- (message-goto-subject)
- (insert \"${subject}\")
- (message-goto-body)
- (insert \"${body}\")
- $*
- (notmuch-mua-send-and-exit))"
-
- # In case message was sent properly, client waits for confirmation
- # before exiting and resuming control here; therefore making sure
- # that server exits by sending (KILL) signal to it is safe.
- kill -9 $smtp_dummy_pid
- notmuch new >/dev/null
-}
-
-# Pretend to deliver a message with emacs. Really save it to a file
-# and add it to the database
-#
-# Uses emacs to generate and deliver a message to the mail store.
-# Accepts arbitrary extra emacs/elisp functions to modify the message
-# before sending, which is useful to doing things like attaching files
-# to the message and encrypting/signing.
-#
-# If any GNU-style long-arguments (like --quiet or --decrypt=true) are
-# at the head of the argument list, they are sent directly to "notmuch
-# new" after message delivery
-emacs_fcc_message ()
-{
- local nmn_args subject body
- nmn_args=''
- while [[ "$1" =~ ^-- ]]; do
- nmn_args="$nmn_args $1"
- shift
- done
- subject="$1"
- body="$2"
- shift 2
- # before we can send a message, we have to prepare the FCC maildir
- mkdir -p "$MAIL_DIR"/sent/{cur,new,tmp}
-
- test_emacs \
- "(let ((message-send-mail-function (lambda () t))
- (mail-host-address \"example.com\"))
- (notmuch-mua-mail)
- (message-goto-to)
- (insert \"test_suite@notmuchmail.org\nDate: 01 Jan 2000 12:00:00 -0000\")
- (message-goto-subject)
- (insert \"${subject}\")
- (message-goto-body)
- (insert \"${body}\")
- $*
- (let ((mml-secure-smime-sign-with-sender t)
- (mml-secure-openpgp-sign-with-sender t))
- (notmuch-mua-send-and-exit)))" || return 1
- notmuch new $nmn_args >/dev/null
-}
-
# Add an existing, fixed corpus of email to the database.
#
# $1 is the corpus dir under corpora to add, using "default" if unset.
# history of the notmuch mailing list, which allows for reliably
# testing commands that need to operate on a not-totally-trivial
# number of messages.
-add_email_corpus ()
-{
+add_email_corpus () {
local corpus
corpus=${1:-default}
notmuch new >/dev/null || die "'notmuch new' failed while adding email corpus"
}
-test_begin_subtest ()
-{
+test_begin_subtest () {
if [ -n "$inside_subtest" ]; then
exec 1>&6 2>&7 # Restore stdout and stderr
error "bug in test script: Missing test_expect_equal in ${BASH_SOURCE[1]}:${BASH_LINENO[0]}"
# not accept a test name. Instead, the caller should call
# test_begin_subtest before calling this function in order to set the
# name.
-test_expect_equal ()
-{
+test_expect_equal () {
local output expected testname
exec 1>&6 2>&7 # Restore stdout and stderr
if [ -z "$inside_subtest" ]; then
}
# Like test_expect_equal, but takes two filenames.
-test_expect_equal_file ()
-{
+test_expect_equal_file () {
local file1 file2 testname basename1 basename2
exec 1>&6 2>&7 # Restore stdout and stderr
if [ -z "$inside_subtest" ]; then
fi
}
-test_emacs_expect_t () {
- local result
- test "$#" = 1 ||
- error "bug in the test script: not 1 parameter to test_emacs_expect_t"
- if [ -z "$inside_subtest" ]; then
- error "bug in the test script: test_emacs_expect_t without test_begin_subtest"
- fi
-
- # Run the test.
- if ! test_skip "$test_subtest_name"
- then
- test_emacs "(notmuch-test-run $1)" >/dev/null
-
- # Restore state after the test.
- exec 1>&6 2>&7 # Restore stdout and stderr
- inside_subtest=
-
- # Report success/failure.
- result=$(cat OUTPUT)
- if [ "$result" = t ]
- then
- test_ok_
- else
- test_failure_ "${result}"
- fi
- else
- # Restore state after the (non) test.
- exec 1>&6 2>&7 # Restore stdout and stderr
- inside_subtest=
- fi
-}
-
-NOTMUCH_NEW ()
-{
+NOTMUCH_NEW () {
notmuch new "${@}" | grep -v -E -e '^Processed [0-9]*( total)? file|Found [0-9]* total file'
}
-NOTMUCH_DUMP_TAGS ()
-{
+NOTMUCH_DUMP_TAGS () {
# this relies on the default format being batch-tag, otherwise some tests will break
notmuch dump --include=tags "${@}" | sed '/^#/d' | sort
}
-notmuch_drop_mail_headers ()
-{
+notmuch_drop_mail_headers () {
$NOTMUCH_PYTHON -c '
import email, sys
msg = email.message_from_file(sys.stdin)
' "$@"
}
-notmuch_exception_sanitize ()
-{
+notmuch_debug_sanitize () {
+ grep -v '^D.:'
+}
+
+notmuch_exception_sanitize () {
perl -pe 's/(A Xapian exception occurred at .*[.]cc?):([0-9]*)/\1:XXX/'
}
-notmuch_search_sanitize ()
-{
- perl -pe 's/("?thread"?: ?)("?)................("?)/\1\2XXX\3/'
+notmuch_search_sanitize () {
+ notmuch_debug_sanitize | perl -pe 's/("?thread"?: ?)("?)................("?)/\1\2XXX\3/'
}
-notmuch_search_files_sanitize ()
-{
+notmuch_search_files_sanitize () {
notmuch_dir_sanitize
}
-notmuch_dir_sanitize ()
-{
+notmuch_dir_sanitize () {
sed -e "s,$MAIL_DIR,MAIL_DIR," -e "s,${PWD},CWD,g" "$@"
}
NOTMUCH_SHOW_FILENAME_SQUELCH='s,filename:.*/mail,filename:/XXX/mail,'
-notmuch_show_sanitize ()
-{
+notmuch_show_sanitize () {
sed -e "$NOTMUCH_SHOW_FILENAME_SQUELCH"
}
-notmuch_show_sanitize_all ()
-{
+notmuch_show_sanitize_all () {
+ notmuch_debug_sanitize | \
sed \
-e 's| filename:.*| filename:XXXXX|' \
-e 's| id:[^ ]* | id:XXXXX |' | \
notmuch_date_sanitize
}
-notmuch_json_show_sanitize ()
-{
+notmuch_json_show_sanitize () {
sed \
-e 's|"id": "[^"]*",|"id": "XXXXX",|g' \
-e 's|"Date": "Fri, 05 Jan 2001 [^"]*0000"|"Date": "GENERATED_DATE"|g' \
-e 's|"content-length": [1-9][0-9]*|"content-length": "NONZERO"|g'
}
-notmuch_emacs_error_sanitize ()
-{
+notmuch_emacs_error_sanitize () {
local command
command=$1
shift
for file in "$@"; do
echo "=== $file ==="
- cat "$file"
+ notmuch_debug_sanitize < "$file"
done | sed \
- -e 's/^\[.*\]$/[XXX]/' \
+ -e '/^$/d' \
+ -e '/^\[.*\]$/d' \
-e "s|^\(command: \)\{0,1\}/.*/$command|\1YYY/$command|"
}
-notmuch_date_sanitize ()
-{
+notmuch_date_sanitize () {
sed \
-e 's/^Date: Fri, 05 Jan 2001 .*0000/Date: GENERATED_DATE/'
}
-notmuch_uuid_sanitize ()
-{
+notmuch_uuid_sanitize () {
sed 's/[0-9a-f]\{8\}-[0-9a-f]\{4\}-[0-9a-f]\{4\}-[0-9a-f]\{4\}-[0-9a-f]\{12\}/UUID/g'
}
-notmuch_built_with_sanitize ()
-{
+notmuch_built_with_sanitize () {
sed 's/^built_with[.]\(.*\)=.*$/built_with.\1=something/'
}
-notmuch_passwd_sanitize()
-{
- ${NOTMUCH_PYTHON} -c'
-import os, sys, pwd, socket
-
-pw = pwd.getpwuid(os.getuid())
-user = pw.pw_name
-name = pw.pw_gecos.partition(",")[0]
-fqdn = socket.getfqdn()
-
-for l in sys.stdin:
- l = l.replace(user, "USERNAME").replace(fqdn, "FQDN").replace(".(none)","").replace(name, "USER_FULL_NAME")
- sys.stdout.write(l)
-'
-}
-
-notmuch_config_sanitize ()
-{
+notmuch_config_sanitize () {
notmuch_dir_sanitize | notmuch_built_with_sanitize
}
-notmuch_show_part ()
-{
+notmuch_show_part () {
awk '/^\014part}/{ f=0 }; { if (f) { print $0 } } /^\014part{ ID: '"$1"'/{ f=1 }'
}
test_run_ "$1"
run_ret="$?"
# test_run_ may update missing external prerequisites
- test_check_missing_external_prereqs_ "$@" ||
+ test_check_missing_external_prereqs_ "$test_subtest_name" ||
if [ "$run_ret" = 0 -a "$eval_ret" = 0 ]
then
test_ok_
test_run_ "$2"
run_ret="$?"
# test_run_ may update missing external prerequisites,
- test_check_missing_external_prereqs_ "$@" ||
+ test_check_missing_external_prereqs_ "$test_subtest_name" ||
if [ "$run_ret" = 0 -a "$eval_ret" = "$1" ]
then
test_ok_
# - cmp's output is not nearly as easy to read as diff -u
# - not all diff versions understand "-u"
-test_cmp() {
+test_cmp () {
$GIT_TEST_CMP "$@"
}
test_done () {
GIT_EXIT_OK=t
test_results_dir="$TEST_DIRECTORY/test-results"
- mkdir -p "$test_results_dir"
+ test -d "$test_results_dir" || mkdir "$test_results_dir"
test_results_path="$test_results_dir/$this_test"
- echo "total $test_count" >> $test_results_path
- echo "success $test_success" >> $test_results_path
- echo "fixed $test_fixed" >> $test_results_path
- echo "broken $test_broken" >> $test_results_path
- echo "failed $test_failure" >> $test_results_path
- echo "" >> $test_results_path
+ printf %s\\n \
+ "success $test_success" \
+ "fixed $test_fixed" \
+ "broken $test_broken" \
+ "failed $test_failure" \
+ "total $test_count" \
+ > $test_results_path
[ -n "$EMACS_SERVER" ] && test_emacs '(kill-emacs)'
fi
}
-emacs_generate_script () {
- # Construct a little test script here for the benefit of the user,
- # (who can easily run "run_emacs" to get the same emacs environment
- # for investigating any failures).
- cat <<EOF >"$TMP_DIRECTORY/run_emacs"
-#!/bin/sh
-export PATH=$PATH
-export NOTMUCH_CONFIG=$NOTMUCH_CONFIG
-
-# Here's what we are using here:
-#
-# --quick Use minimal customization. This implies --no-init-file,
-# --no-site-file and (emacs 24) --no-site-lisp
-#
-# --directory Ensure that the local elisp sources are found
-#
-# --load Force loading of notmuch.el and test-lib.el
-
-exec ${TEST_EMACS} --quick \
- --directory "$NOTMUCH_BUILDDIR/emacs" --load notmuch.el \
- --directory "$NOTMUCH_SRCDIR/test" --load test-lib.el \
- "\$@"
-EOF
- chmod a+x "$TMP_DIRECTORY/run_emacs"
-}
-
-test_emacs () {
- # test dependencies beforehand to avoid the waiting loop below
- missing_dependencies=
- test_require_external_prereq dtach || missing_dependencies=1
- test_require_external_prereq emacs || missing_dependencies=1
- test_require_external_prereq ${TEST_EMACSCLIENT} || missing_dependencies=1
- test -z "$missing_dependencies" || return
-
- if [ -z "$EMACS_SERVER" ]; then
- emacs_tests="$NOTMUCH_SRCDIR/test/${this_test_bare}.el"
- if [ -f "$emacs_tests" ]; then
- load_emacs_tests="--eval '(load \"$emacs_tests\")'"
- else
- load_emacs_tests=
- fi
- server_name="notmuch-test-suite-$$"
- # start a detached session with an emacs server
- # user's TERM (or 'vt100' in case user's TERM is known dumb
- # or unknown) is given to dtach which assumes a minimally
- # VT100-compatible terminal -- and emacs inherits that
- TERM=$SMART_TERM dtach -n "$TEST_TMPDIR/emacs-dtach-socket.$$" \
- sh -c "stty rows 24 cols 80; exec '$TMP_DIRECTORY/run_emacs' \
- --no-window-system \
- $load_emacs_tests \
- --eval '(setq server-name \"$server_name\")' \
- --eval '(server-start)' \
- --eval '(orphan-watchdog $$)'" || return
- EMACS_SERVER="$server_name"
- # wait until the emacs server is up
- until test_emacs '()' >/dev/null 2>/dev/null; do
- sleep 1
- done
- fi
-
- # Clear test-output output file. Most Emacs tests end with a
- # call to (test-output). If the test code fails with an
- # exception before this call, the output file won't get
- # updated. Since we don't want to compare against an output
- # file from another test, so start out with an empty file.
- rm -f OUTPUT
- touch OUTPUT
-
- ${TEST_EMACSCLIENT} --socket-name="$EMACS_SERVER" --eval "(notmuch-test-progn $*)"
-}
-
-test_python() {
+test_python () {
# Note: if there is need to print debug information from python program,
# use stdout = os.fdopen(6, 'w') or stderr = os.fdopen(7, 'w')
PYTHONPATH="$NOTMUCH_SRCDIR/bindings/python${PYTHONPATH:+:$PYTHONPATH}" \
$NOTMUCH_PYTHON -B - > OUTPUT
}
-test_ruby() {
- MAIL_DIR=$MAIL_DIR $NOTMUCH_RUBY -I "$NOTMUCH_BUILDDIR/bindings/ruby"> OUTPUT
-}
-
test_C () {
local exec_file test_file
exec_file="test${test_count}"
echo "== stdout ==" > OUTPUT.stdout
echo "== stderr ==" > OUTPUT.stderr
./${exec_file} "$@" 1>>OUTPUT.stdout 2>>OUTPUT.stderr
- notmuch_dir_sanitize OUTPUT.stdout OUTPUT.stderr | notmuch_exception_sanitize > OUTPUT
+ notmuch_dir_sanitize OUTPUT.stdout OUTPUT.stderr | notmuch_exception_sanitize | notmuch_debug_sanitize > OUTPUT
}
make_shim () {
. "$NOTMUCH_SRCDIR/test/test-lib-common.sh" || exit 1
-emacs_generate_script
-
-
# Use -P to resolve symlinks in our working directory so that the cwd
# in subprocesses like git equals our $PWD (for pathname comparisons).
cd -P "$TMP_DIRECTORY" || error "Cannot set up test environment"
$curbuf.render do |b|
q = $curbuf.query(get_cur_view)
q.sort = Notmuch::SORT_OLDEST_FIRST
+ $exclude_tags.each { |t|
+ q.add_tag_exclude(t)
+ }
msgs = q.search_messages
msgs.each do |msg|
m = Mail.read(msg.filename)