]> git.notmuchmail.org Git - notmuch/commitdiff
Merge remote-tracking branch 'origin/release'
authorDavid Bremner <david@tethera.net>
Mon, 31 May 2021 23:26:31 +0000 (20:26 -0300)
committerDavid Bremner <david@tethera.net>
Mon, 31 May 2021 23:26:31 +0000 (20:26 -0300)
92 files changed:
Makefile.local
NEWS
bindings/Makefile.local
bindings/ruby/database.c
bindings/ruby/defs.h
bindings/ruby/directory.c
bindings/ruby/filenames.c
bindings/ruby/init.c
bindings/ruby/message.c
bindings/ruby/messages.c
bindings/ruby/query.c
bindings/ruby/tags.c
bindings/ruby/thread.c
bindings/ruby/threads.c
doc/conf.py
doc/man1/notmuch-address.rst
doc/man1/notmuch-compact.rst
doc/man1/notmuch-config.rst
doc/man1/notmuch-count.rst
doc/man1/notmuch-dump.rst
doc/man1/notmuch-emacs-mua.rst
doc/man1/notmuch-insert.rst
doc/man1/notmuch-new.rst
doc/man1/notmuch-reindex.rst
doc/man1/notmuch-reply.rst
doc/man1/notmuch-restore.rst
doc/man1/notmuch-search.rst
doc/man1/notmuch-show.rst
doc/man1/notmuch-tag.rst
doc/man1/notmuch.rst
doc/man5/notmuch-hooks.rst
doc/man7/notmuch-properties.rst
doc/man7/notmuch-search-terms.rst
gmime-filter-reply.c
gmime-filter-reply.h
lib/Makefile.local
lib/add-message.cc
lib/database-private.h
lib/index.cc
lib/init.cc [new file with mode: 0644]
lib/message-file.c
lib/message.cc
lib/notmuch-private.h
lib/open.cc
lib/thread.cc
notmuch-client-init.c [new file with mode: 0644]
notmuch-client.h
notmuch-config.c
notmuch-insert.c
notmuch-new.c
notmuch-reindex.c
notmuch-tag.c
notmuch.c
performance-test/README
performance-test/T03-reindex.sh
performance-test/perf-test-lib.sh
test/T000-basic.sh
test/T070-insert.sh
test/T140-excludes.sh
test/T160-json.sh
test/T170-sexp.sh
test/T190-multipart.sh
test/T300-encoding.sh
test/T310-emacs.sh
test/T320-emacs-large-search-buffer.sh
test/T330-emacs-subject-to-filename.sh
test/T350-crypto.sh
test/T355-smime.sh
test/T357-index-decryption.sh
test/T358-emacs-protected-headers.sh
test/T380-atomicity.sh
test/T395-ruby.sh
test/T420-emacs-test-functions.sh
test/T430-emacs-address-cleaning.sh
test/T440-emacs-hello.sh
test/T450-emacs-show.sh
test/T455-emacs-charsets.sh
test/T460-emacs-tree.sh
test/T490-parse-time-string.sh
test/T510-thread-replies.sh
test/T590-libconfig.sh
test/T590-thread-breakage.sh
test/T630-emacs-draft.sh
test/T700-reindex.sh
test/T720-emacs-attachment-warnings.sh
test/T730-emacs-forwarding.sh
test/T750-user-header.sh
test/export-dirs.sh
test/test-lib-common.sh
test/test-lib-emacs.sh [new file with mode: 0644]
test/test-lib.sh
vim/notmuch.vim

index bbb8f0b61a3fab43819e906ad3a2a9b3195b65f2..e12b94cd6f668bfc830070ec24d924ff8941bebf 100644 (file)
@@ -231,6 +231,7 @@ notmuch_client_srcs =               \
        gmime-filter-reply.c    \
        hooks.c                 \
        notmuch.c               \
+       notmuch-client-init.c   \
        notmuch-compact.c       \
        notmuch-config.c        \
        notmuch-count.c         \
diff --git a/NEWS b/NEWS
index 4bb4779e6ec49e7bd8b1f4041bc41f2300822978..35b57cefc2ff7eb592a4dee1928504cb8005da1f 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,11 @@
+Notmuch 0.33 (UNRELEASED)
+=========================
+
+Vim
+---
+
+Respect excluded tags when showing a thread.
+
 Notmuch 0.32.1 (2021-05-15)
 ===========================
 
index bc960bbceabe592bb75522c25c20bbc2c9c70e10..3672e69ff76af07da05afc0a527355d2c0271941 100644 (file)
@@ -10,7 +10,7 @@ ifeq ($(HAVE_RUBY_DEV),1)
                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)
index 416eb709f19d231bfdf6460c37a8e2262fad24af..bb993d8688848df012f26d4f9a545f31b78c195d 100644 (file)
@@ -23,7 +23,7 @@
 VALUE
 notmuch_rb_database_alloc (VALUE klass)
 {
-    return Data_Wrap_Struct (klass, NULL, NULL, NULL);
+    return Data_Wrap_Notmuch_Object (klass, &notmuch_rb_database_type, NULL);
 }
 
 /*
@@ -74,7 +74,7 @@ notmuch_rb_database_initialize (int argc, VALUE *argv, VALUE self)
        mode = NOTMUCH_DATABASE_MODE_READ_ONLY;
     }
 
-    Check_Type (self, T_DATA);
+    rb_check_typeddata (self, &notmuch_rb_database_type);
     if (create)
        ret = notmuch_database_create (path, &database);
     else
@@ -114,11 +114,7 @@ VALUE
 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, &notmuch_rb_database_type);
     notmuch_rb_status_raise (ret);
 
     return Qnil;
@@ -266,7 +262,7 @@ notmuch_rb_database_get_directory (VALUE self, VALUE pathv)
     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, &notmuch_rb_directory_type, dir);
     return Qnil;
 }
 
@@ -293,7 +289,7 @@ notmuch_rb_database_add_message (VALUE self, VALUE pathv)
 
     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, &notmuch_rb_message_type, message),
         (ret == NOTMUCH_STATUS_DUPLICATE_MESSAGE_ID) ? Qtrue : Qfalse);
 }
 
@@ -344,7 +340,7 @@ notmuch_rb_database_find_message (VALUE self, VALUE idv)
     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, &notmuch_rb_message_type, message);
     return Qnil;
 }
 
@@ -370,7 +366,7 @@ notmuch_rb_database_find_message_by_filename (VALUE self, VALUE pathv)
     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, &notmuch_rb_message_type, message);
     return Qnil;
 }
 
@@ -395,7 +391,7 @@ notmuch_rb_database_get_all_tags (VALUE self)
 
        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, &notmuch_rb_tags_type, tags);
 }
 
 /*
@@ -419,5 +415,5 @@ notmuch_rb_database_query_create (VALUE self, VALUE qstrv)
     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, &notmuch_rb_query_type, query);
 }
index 48544ca2a4acbe57a48630957e9dd059de504f69..9860ee17d9479e1bc1101978585ed986e0e704c1 100644 (file)
@@ -55,77 +55,70 @@ extern ID ID_db_mode;
 # 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), &notmuch_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), &notmuch_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), &notmuch_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), &notmuch_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), &notmuch_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), &notmuch_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), &notmuch_rb_thread_type, (ptr))
+
+#define Data_Get_Notmuch_Message(obj, ptr) \
+    Data_Get_Notmuch_Object ((obj), &notmuch_rb_message_type, (ptr))
+
+#define Data_Get_Notmuch_Tags(obj, ptr) \
+    Data_Get_Notmuch_Object ((obj), &notmuch_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
index 0f37b3910042426219ae7cdf7137ec1b017cfb11..910f0a99f238239f2c5717b2a85b2cbca190bcf5 100644 (file)
 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, &notmuch_rb_directory_type);
 
     return Qnil;
 }
@@ -92,7 +87,7 @@ notmuch_rb_directory_get_child_files (VALUE self)
 
     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, &notmuch_rb_filenames_type, fnames);
 }
 
 /*
@@ -111,5 +106,5 @@ notmuch_rb_directory_get_child_directories (VALUE self)
 
     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, &notmuch_rb_filenames_type, fnames);
 }
index 656c58e6f40dfdc87bcbc86b6dd7b2eb2680ecab..0dec19520b59b0b421df5c7a4cb03826e69d235d 100644 (file)
 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, &notmuch_rb_filenames_type);
 
     return Qnil;
 }
index 819fd1e35dc87a85945b57791149748910134ce3..bedfbf60646cf4d2d4c4ebc209ea0e2c145faece 100644 (file)
@@ -46,6 +46,27 @@ ID ID_call;
 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 = &notmuch_rb_object_type, \
+       .data = &notmuch_ ## 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
  *
@@ -133,6 +154,30 @@ Init_notmuch (void)
      * 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
index 6ea82afa20c5071086883b437054d80613e7a45d..f45c95cc5051d8475920c5a59bf07706e829e0be 100644 (file)
 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, &notmuch_rb_message_type);
 
     return Qnil;
 }
@@ -89,7 +84,7 @@ notmuch_rb_message_get_replies (VALUE self)
 
     messages = notmuch_message_get_replies (message);
 
-    return Data_Wrap_Struct (notmuch_rb_cMessages, NULL, NULL, messages);
+    return Data_Wrap_Notmuch_Object (notmuch_rb_cMessages, &notmuch_rb_messages_type, messages);
 }
 
 /*
@@ -125,7 +120,7 @@ notmuch_rb_message_get_filenames (VALUE self)
 
     fnames = notmuch_message_get_filenames (message);
 
-    return Data_Wrap_Struct (notmuch_rb_cFileNames, NULL, NULL, fnames);
+    return Data_Wrap_Notmuch_Object (notmuch_rb_cFileNames, &notmuch_rb_filenames_type, fnames);
 }
 
 /*
@@ -226,7 +221,7 @@ notmuch_rb_message_get_tags (VALUE 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, &notmuch_rb_tags_type, tags);
 }
 
 /*
index a337feeb499fff177e7f3c6659373eaf0c004a00..ca5b10d04b09702629eddbeb1eb217bef84a4274 100644 (file)
 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, &notmuch_rb_messages_type);
 
     return Qnil;
 }
@@ -53,7 +48,7 @@ notmuch_rb_messages_each (VALUE self)
 
     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, &notmuch_rb_message_type, message));
     }
 
     return self;
@@ -76,5 +71,5 @@ notmuch_rb_messages_collect_tags (VALUE 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, &notmuch_rb_tags_type, tags);
 }
index 8b46d700bdab01554c8944ec7903ea9ce8a3707e..8a2b4d3d48350e6b37ea9de73d86927ddb80e301 100644 (file)
 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, &notmuch_rb_query_type);
 
     return Qnil;
 }
@@ -107,19 +102,21 @@ notmuch_rb_query_add_tag_exclude (VALUE self, VALUE tagv)
 }
 
 /*
- * 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;
 }
@@ -142,7 +139,7 @@ notmuch_rb_query_search_threads (VALUE self)
     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, &notmuch_rb_threads_type, threads);
 }
 
 /*
@@ -163,7 +160,7 @@ notmuch_rb_query_search_messages (VALUE self)
     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, &notmuch_rb_messages_type, messages);
 }
 
 /*
index db8b4cfc86f0b3eaa818ce0d7876862158826862..2af85e36598220f1cb93e806a8080ed2c3a3b862 100644 (file)
 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, &notmuch_rb_tags_type);
 
     return Qnil;
 }
index 9b295981801779e1d970972d595b60eec1c4d5c6..7cb2a3dcc6ebeacdd5c4c37b726a53056c436a5c 100644 (file)
 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, &notmuch_rb_thread_type);
 
     return Qnil;
 }
@@ -88,7 +83,7 @@ notmuch_rb_thread_get_toplevel_messages (VALUE self)
     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, &notmuch_rb_messages_type, messages);
 }
 
 /*
@@ -108,7 +103,7 @@ notmuch_rb_thread_get_messages (VALUE self)
     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, &notmuch_rb_messages_type, messages);
 }
 
 /*
@@ -209,5 +204,5 @@ notmuch_rb_thread_get_tags (VALUE 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, &notmuch_rb_tags_type, tags);
 }
index ed403a8f1f3db30e88d8fd030991ae1b62b1c9e6..50280260a4d3aa9576f4d09c7d9528ed6be6539c 100644 (file)
 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, &notmuch_rb_threads_type);
 
     return Qnil;
 }
@@ -53,7 +48,7 @@ notmuch_rb_threads_each (VALUE self)
 
     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, &notmuch_rb_thread_type, thread));
     }
 
     return self;
index d0f7f66ce83ee8d639ec17869e407dd424053cee..4a4a34212cc3cb816ae7de88e1ce84271dc1fd4a 100644 (file)
@@ -80,6 +80,11 @@ htmlhelp_basename = 'notmuchdoc'
 # 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
index 2a7df6f0d80f21133fee3f58902f907e83d7a34b..7423b62955087462aeefad99efdfaafe5b5e149c 100644 (file)
@@ -1,3 +1,5 @@
+.. _notmuch-address(1):
+
 ===============
 notmuch-address
 ===============
@@ -13,94 +15,102 @@ DESCRIPTION
 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
 ===========
@@ -116,16 +126,16 @@ This command supports the following special exit status codes
 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)`
index b05593ec22134181e9a31d642cfe9c8b4f5dba23..cb1c858b1e4a85af2698d0c8e0b6441e90b4563f 100644 (file)
@@ -1,3 +1,5 @@
+.. _notmuch-compact(1):
+
 ===============
 notmuch-compact
 ===============
@@ -24,37 +26,31 @@ process (which may be quite long) to protect data integrity.
 
 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)`
index 75c59ff971880b198ab4aff499ed4c983d11860c..56f4a1600153517edce62d9094ff37ef1ffb13c1 100644 (file)
@@ -1,3 +1,5 @@
+.. _notmuch-config(1):
+
 ==============
 notmuch-config
 ==============
@@ -17,32 +19,37 @@ DESCRIPTION
 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
@@ -76,7 +83,7 @@ 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.
@@ -103,7 +110,7 @@ paths are presumed relative to `$HOME` for items in section
 
 **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.
@@ -124,7 +131,7 @@ paths are presumed relative to `$HOME` for items in section
     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**
@@ -145,16 +152,18 @@ paths are presumed relative to `$HOME` for items in section
     | 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``.
 
@@ -174,8 +183,8 @@ paths are presumed relative to `$HOME` for items in section
     ``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.
 
@@ -199,7 +208,7 @@ paths are presumed relative to `$HOME` for items in section
 
     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
@@ -217,7 +226,7 @@ paths are presumed relative to `$HOME` for items in section
     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>**
@@ -228,56 +237,56 @@ paths are presumed relative to `$HOME` for items in section
 
 **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)`
index 0eac5dbef4ba09242795cf14abc3de2affe96444..9a7e4bacf4591fa0b2faf8b6220271c490c1214b 100644 (file)
@@ -1,3 +1,5 @@
+.. _notmuch-count(1):
+
 =============
 notmuch-count
 =============
@@ -17,56 +19,63 @@ The number of matching messages (or threads) is output to stdout.
 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)`
index ec6335b2febc97099249c01c02002cf6044192f6..4319c5c312682e767069112b5d007dc0330e1276 100644 (file)
@@ -1,3 +1,5 @@
+.. _notmuch-dump(1):
+
 ============
 notmuch-dump
 ============
@@ -19,97 +21,103 @@ recreated from the messages themselves. The output of notmuch dump is
 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)`
index a0476136f50340f9869d858a079b29e755e2df6a..d8af08bda47a530dac1827a28c55fa976fe96e0a 100644 (file)
@@ -1,3 +1,5 @@
+.. _notmuch-emacs-mua(1):
+
 =================
 notmuch-emacs-mua
 =================
@@ -15,67 +17,86 @@ subject, recipients, and message body, or mailto: URL.
 
 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)`
index 86e2f567348ba5920c972a967b7e936c35e34d82..82c4a7a0b94ea7a328d832591f59128424741923 100644 (file)
@@ -1,3 +1,5 @@
+.. _notmuch-insert(1):
+
 ==============
 notmuch-insert
 ==============
@@ -14,7 +16,7 @@ DESCRIPTION
 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
@@ -25,58 +27,66 @@ If the new message is a duplicate of an existing message in the database
 (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
 ===========
@@ -101,14 +111,14 @@ status of the **insert** command.
 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)`
index 20a1103b3363a85e78d9ec07845ad4ca068eb81d..9cb4a54e75343733e3dfd6fa3ed8e00ad235f5dc 100644 (file)
@@ -1,3 +1,5 @@
+.. _notmuch-new(1):
+
 ===========
 notmuch-new
 ===========
@@ -17,56 +19,64 @@ performing full-text indexing on new messages that are found. Each 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
 ===========
@@ -79,15 +89,15 @@ This command supports the following special exit status code
 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)`
index cd7c91a008ace0009b06b44ad4d67161d7a27bf1..85dad249b5825f8c24e629010a99fbcdcf7c2b96 100644 (file)
@@ -1,3 +1,5 @@
+.. _notmuch-reindex(1):
+
 ===============
 notmuch-reindex
 ===============
@@ -12,7 +14,7 @@ DESCRIPTION
 
 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
@@ -21,28 +23,31 @@ messages using the supplied options.
 
 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
 ========
@@ -84,17 +89,17 @@ https://trac.xapian.org/ticket/742:
 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)`
index 5c64c4a63b106ca5ec60c099de5ca013c0be22fd..4a78a90b2251d51d890a44026ee25dbe03babbd7 100644 (file)
@@ -1,3 +1,5 @@
+.. _notmuch-reply(1):
+
 =============
 notmuch-reply
 =============
@@ -34,64 +36,69 @@ The resulting message template is output to stdout.
 
 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
@@ -116,15 +123,15 @@ This command supports the following special exit status codes
 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)`
index c0f47f261372fdf6f9afb2b7fa6ab5b9ba7b0d23..bd452475768d82db28bf13bb9468ddfbe819304a 100644 (file)
@@ -1,3 +1,5 @@
+.. _notmuch-restore(1):
+
 ===============
 notmuch-restore
 ===============
@@ -10,90 +12,96 @@ SYNOPSIS
 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)`
index ed9ff4e5b96522751b056192bb7eabc5b0da75dd..2d9ca2d5abec09b22a9e47846a08e55ee2c4fd83 100644 (file)
@@ -1,3 +1,5 @@
+.. _notmuch-search(1):
+
 ==============
 notmuch-search
 ==============
@@ -19,123 +21,133 @@ in the thread, the number of matched messages and total messages in the
 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
 =======
@@ -164,16 +176,16 @@ This command supports the following special exit status codes
 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)`
index becd3e79929023b089a9e5542c15380961aae58f..fc6bec62ab263608ee4367e4979deac4c6a630f8 100644 (file)
@@ -1,3 +1,5 @@
+.. _notmuch-show(1):
+
 ============
 notmuch-show
 ============
@@ -12,7 +14,7 @@ DESCRIPTION
 
 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
@@ -23,176 +25,188 @@ post-processor (such as the emacs interface to notmuch).
 
 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
 ===========
@@ -208,15 +222,15 @@ This command supports the following special exit status codes
 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)`
index c2324f5a94ea88b4e40410176347ac41a3f39135..ae311a230f55e5e2a02836c4ebeeefad8770e994 100644 (file)
@@ -1,3 +1,5 @@
+.. _notmuch-tag(1):
+
 ===========
 notmuch-tag
 ===========
@@ -14,7 +16,7 @@ DESCRIPTION
 
 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.
@@ -28,26 +30,31 @@ beginning with '+' or '-' is provided by allowing the user to specify a
 
 **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
 ===============
@@ -100,15 +107,15 @@ of the tag **space in tags**
 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)`,
index 48351588a3eafc7a20ed69161fa2ae44485c7486..e7adcfcd7ff573bbe7b5603642543b1b0a1bdad3 100644 (file)
@@ -1,3 +1,6 @@
+.. _notmuch(1):
+.. _notmuch-setup(1):
+
 =======
 notmuch
 =======
@@ -15,8 +18,9 @@ reading, and tagging large collections of email messages.
 
 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
@@ -39,25 +43,31 @@ OPTIONS
 
 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
@@ -75,7 +85,7 @@ use, (or to reconfigure it later).
 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
@@ -90,7 +100,8 @@ will do its best to detect those and ignore them.
 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.
@@ -99,30 +110,32 @@ OTHER COMMANDS
 --------------
 
 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.
 
@@ -146,38 +159,46 @@ 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
-    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**
 
index c509afb39bb5944c72763769bb582ca89c183c9e..268917cdec981b78c55334a63aaf50f42acdd519 100644 (file)
@@ -1,3 +1,5 @@
+.. _notmuch-hooks(5):
+
 =============
 notmuch-hooks
 =============
@@ -12,35 +14,35 @@ DESCRIPTION
 
 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.
@@ -48,15 +50,15 @@ The currently available hooks are described below.
 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)`
index a7d91d674a89f92e37989e6bb1ca3846839360c2..7f128b5c4f0f9c8a57e07b14bebee9f2f4cc261f 100644 (file)
@@ -1,3 +1,5 @@
+.. _notmuch-properties(7):
+
 ==================
 notmuch-properties
 ==================
@@ -45,7 +47,7 @@ CONVENTIONS
 ===========
 
 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
 ==================
@@ -70,15 +72,15 @@ of its normal activity.
 
     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``.
@@ -97,7 +99,7 @@ of its normal activity.
     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.
 
@@ -136,13 +138,13 @@ of its normal activity.
 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)`
index 28fca7379b7bfb4e84a3e1abe0b79eab88e9fdea..e80cc7d0b3faa76790a38a5e495d3f2b4516e896 100644 (file)
@@ -1,3 +1,5 @@
+.. _notmuch-search-terms(7):
+
 ====================
 notmuch-search-terms
 ====================
@@ -39,7 +41,7 @@ indicate user-supplied values).
 
 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/"'
 
@@ -71,8 +73,9 @@ mimetype:<word>
 
 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
@@ -83,7 +86,7 @@ thread:<thread-id>
     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
@@ -151,21 +154,22 @@ lastmod:<initial-revision>..<final-revision>
     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
@@ -443,17 +447,17 @@ Some time zone codes, e.g. UTC, EET.
 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 2b0676698b8ff7225b164c9db52ab5ad5b5ea314..35349cc8170fdd7abcaa08684e83320eb9f1df08 100644 (file)
@@ -43,29 +43,31 @@ static void filter_reset (GMimeFilter *filter);
 
 
 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;
 }
 
@@ -76,8 +78,6 @@ g_mime_filter_reply_class_init (GMimeFilterReplyClass *klass, unused (void *clas
     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;
index 7cdefcd1f127ff45e5ca9cbd63bf0f541816e1c9..988fe2d6e8c5122fcbc523e8ceefdab4e38bd38e 100644 (file)
@@ -21,6 +21,8 @@
 
 #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 ())
index 01cbb3f2821c8e0a1e0145192e2e3368b625d6c7..e2d4b91dcaf2add44978fa28ed49dbadcbf8eaa3 100644 (file)
@@ -62,7 +62,8 @@ libnotmuch_cxx_srcs =         \
        $(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)
 
index d6e5e73d35f4b4c3183df5642ac251c95ad48641..b16748fda20ebf4128f4e8fd78f4a66f9c9a83c2 100644 (file)
@@ -40,17 +40,14 @@ parse_references (void *ctx,
 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 *
index 0d12ec1efde57b4862f1001facdbfafe3dec54cd..1a73dacc365f563134d123fe09d91668b45a6d1f 100644 (file)
@@ -206,6 +206,10 @@ struct _notmuch_database {
     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
index 55c8372e3aa1c146913222369f7185cb6805531a..728bfb22ab69c4eef52795cf86d7971c7d42e2fe 100644 (file)
@@ -148,8 +148,6 @@ notmuch_filter_discard_non_term_class_init (NotmuchFilterDiscardNonTermClass *kl
     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;
@@ -240,30 +238,33 @@ filter_reset (GMimeFilter *gmime_filter)
  *
  * 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;
diff --git a/lib/init.cc b/lib/init.cc
new file mode 100644 (file)
index 0000000..cf29200
--- /dev/null
@@ -0,0 +1,21 @@
+#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);
+}
index 9e9b387fcc697a8e8b3d13a8bbbd03147714ef58..647ccf3abedaaf52f95bcc44e9a3199de8d4b42d 100644 (file)
@@ -141,7 +141,6 @@ _notmuch_message_file_parse (notmuch_message_file_t *message)
 {
     GMimeParser *parser;
     notmuch_status_t status = NOTMUCH_STATUS_SUCCESS;
-    static int initialized = 0;
     bool is_mbox;
 
     if (message->message)
@@ -149,10 +148,7 @@ _notmuch_message_file_parse (notmuch_message_file_t *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);
index 42d56acb10e4ae80a3f36e92c2f6c644b03afd43..7af6ab82a721699ac7f09153724b9e8038484b2a 100644 (file)
@@ -68,7 +68,7 @@ struct maildir_flag_tag {
 };
 
 /* 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 },
index 10b1b0245b16d12b8caca6f0bb109a6cde3ba89a..093c29b1bbc5384198b90c351046a6a3b19200e1 100644 (file)
@@ -469,11 +469,18 @@ _notmuch_database_link_message_to_parents (notmuch_database_t *notmuch,
                                           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 {
index 3325e72506cb3023911c870056265ef63b305fd5..1ca69665c4e446ce4023b90713a86376c91310ee 100644 (file)
@@ -324,24 +324,6 @@ _set_database_path (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)
 {
@@ -515,7 +497,7 @@ notmuch_database_open_with_config (const char *database_path,
     GKeyFile *key_file = NULL;
     bool split = false;
 
-    _init_libs ();
+    _notmuch_init ();
 
     notmuch = _alloc_notmuch ();
     if (! notmuch) {
@@ -612,7 +594,7 @@ notmuch_database_create_with_config (const char *database_path,
     int err;
     bool split = false;
 
-    _init_libs ();
+    _notmuch_init ();
 
     notmuch = _alloc_notmuch ();
     if (! notmuch) {
@@ -808,7 +790,7 @@ notmuch_database_load_config (const char *database_path,
     GKeyFile *key_file = NULL;
     bool split = false;
 
-    _init_libs ();
+    _notmuch_init ();
 
     notmuch = _alloc_notmuch ();
     if (! notmuch) {
index 46a50e80cb5992729875d7d56698743ddcf8c3c3..60e9a666ec1b348c7b2f413c6da94d4655188831 100644 (file)
@@ -25,7 +25,8 @@
 #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
@@ -400,7 +401,7 @@ _parent_via_in_reply_to (notmuch_thread_t *thread, notmuch_message_t *message)
     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)) &&
@@ -423,31 +424,31 @@ _parent_or_toplevel (notmuch_thread_t *thread, notmuch_message_t *message)
     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);
     }
@@ -482,13 +483,13 @@ _resolve_thread_relationships (notmuch_thread_t *thread)
      */
     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);
        }
diff --git a/notmuch-client-init.c b/notmuch-client-init.c
new file mode 100644 (file)
index 0000000..60db6ba
--- /dev/null
@@ -0,0 +1,18 @@
+#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 ();
+}
index 270553ad7f1cc9d5f79c4a20226301fdb2f49871..8227fea479d4e234da32c4e2f9d26dfd4f60cf41 100644 (file)
@@ -250,6 +250,10 @@ json_quote_chararray (const void *ctx, const char *str, const size_t len);
 char *
 json_quote_str (const void *ctx, const char *str);
 
+/* notmuch-client-init.c */
+
+void notmuch_client_init (void);
+
 /* notmuch-config.c */
 
 typedef enum {
index d9390c4d81ea10ff7e82196a5d034025b4915250..3430a3d35e7fe06052065575f21220457547d070 100644 (file)
@@ -32,7 +32,7 @@ static const char toplevel_config_comment[] =
     "\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 [] = {
@@ -512,14 +512,14 @@ typedef struct config_key {
     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++) {
@@ -583,7 +583,7 @@ notmuch_config_command_set (notmuch_database_t *notmuch,
                            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;
index 00c0046873f50cc788717ebb86ef6a10314bf70a..e3d87e4aed184af827b35e0e5276ff9b6cdc3f4d 100644 (file)
@@ -34,7 +34,7 @@ static volatile sig_atomic_t interrupted;
 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
index 993359d603a9bf75d9e606014741ee9cc6f0d83f..1ee498faaf7c4f79a174adab84c033cb3a8b2fd9 100644 (file)
@@ -81,7 +81,7 @@ static volatile sig_atomic_t interrupted;
 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
@@ -403,8 +403,11 @@ add_file (notmuch_database_t *notmuch, const char *filename,
        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);
index 8904c1f41dca4d880a23708616705b76ede399eb..a7380a4bc197beb60f8140b9c37c5cc06ed8cf3e 100644 (file)
@@ -26,7 +26,7 @@ static volatile sig_atomic_t interrupted;
 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
index 667a75d6b960c3b2cc27b75d08753a813badc037..de428c8e9d99b902701a296a577cba87cb00c99c 100644 (file)
@@ -27,7 +27,7 @@ static volatile sig_atomic_t interrupted;
 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
index 2429999c2694345dd71b556e282b6dbb5a943dbe..d0a94fc2650993ae18bbd1ae6eae0109c3ca249b 100644 (file)
--- a/notmuch.c
+++ b/notmuch.c
@@ -139,7 +139,7 @@ notmuch_process_shared_indexing_options (notmuch_database_t *notmuch)
 }
 
 
-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,
@@ -189,7 +189,7 @@ typedef struct help_topic {
     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",
@@ -198,7 +198,7 @@ static help_topic_t help_topics[] = {
       "Message property conventions and documentation." },
 };
 
-static command_t *
+static const command_t *
 find_command (const char *name)
 {
     size_t i;
@@ -216,8 +216,8 @@ int notmuch_format_version;
 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,
@@ -308,8 +308,8 @@ exec_man (const char *page)
 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) {
@@ -452,7 +452,7 @@ main (int argc, char *argv[])
     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;
@@ -464,15 +464,10 @@ main (int argc, char *argv[])
        { }
     };
 
-    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;
 
index fbc61028d2db4dfdc204cd4a78e2613cadd78c3c..59b37b1b8ff033092591ede74f9b1f7eb551ec62 100644 (file)
@@ -16,6 +16,7 @@ In addition to having notmuch, you need:
 - 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:
 ----------------------------
@@ -56,11 +57,24 @@ supports the following arguments
 
 --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
 -------------
 
index 8db52a33a9e2d8c78ca3720bad83ebfceea07079..b58950d72b606927f36ec116357f8f456b907a98 100755 (executable)
@@ -10,4 +10,32 @@ time_run 'reindex *' "notmuch reindex '*'"
 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
index b70288ccaf316158b5c6ab16a46bff799c1b46a0..e7c502b6ca3d024aab87ab4d60d808fa8cf199df 100644 (file)
@@ -1,6 +1,9 @@
 . $(dirname "$0")/version.sh || exit 1
 
+debug=""
 corpus_size=large
+perf_callgraph=lbr
+use_perf=0
 
 while test "$#" -ne 0
 do
@@ -9,6 +12,15 @@ do
                debug=t;
                shift
                ;;
+       -p|--perf)
+               use_perf=1;
+               shift
+               ;;
+       -c|--call-graph)
+               shift
+               perf_callgraph=$1
+               shift
+               ;;
        -s|--small)
                corpus_size=small;
                shift
@@ -127,10 +139,20 @@ notmuch_new_with_cache ()
     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
@@ -140,9 +162,7 @@ memory_start ()
 {
     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
 }
@@ -193,7 +213,13 @@ time_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
index 7fbdcfa3036cd860b13647a1678efde2063ce621..a2f4d93fd2652a832aad55466c602a51963dfc2f 100755 (executable)
@@ -33,7 +33,7 @@ test_begin_subtest 'failure to clean up causes the test to fail'
 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/'
 }
index b37a9b672bbad63bc34751f14c7363a6e3f5650d..208deb1c210c68b4cbfaa0586c6320da94c7c20f 100755 (executable)
@@ -15,7 +15,7 @@ notmuch new > /dev/null
 # 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\"" \
index acab5381b94334bed54f1453eaf61a1e54807eba..e9cc9cb078d73352539973937ac44eee65b34ac6 100755 (executable)
@@ -5,8 +5,7 @@ test_description='"notmuch search, count and show" with excludes in several vari
 # 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"'"'
@@ -22,7 +21,7 @@ generate_thread ()
     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)
 }
 
 #############################################
index e8b75605fd2a391eaa0c51351d8f8bd6e0d80499..638afb4d5ef80ce50e2a9dc30c18fcf82444f353 100755 (executable)
@@ -1,6 +1,7 @@
 #!/usr/bin/env bash
 test_description="--format=json output"
 . $(dirname "$0")/test-lib.sh || exit 1
+. $(dirname "$0")/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\""
index 24be8351006e3d5bc64e9c4589f238104a9af14f..af8c4b44800decc4392e2fa8d17a9479b900fbc7 100755 (executable)
@@ -1,6 +1,7 @@
 #!/usr/bin/env bash
 test_description="--format=sexp output"
 . $(dirname "$0")/test-lib.sh || exit 1
+. $(dirname "$0")/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\""
index 6f715ff9b42e834b03ef67e1ebc8f25b89756a59..3545a59998e91ef5537ef0473eb876d860260072 100755 (executable)
@@ -725,8 +725,7 @@ EOF
 
 notmuch new > /dev/null
 
-cat_expected_head ()
-{
+cat_expected_head () {
         cat <<EOF
 [[[{"id": "htmlmessage", "match":true, "excluded": false, "date_relative":"2000-01-01",
    "crypto": {},
index 1e9d2a3da010a7c5c5d27fad4e3ddbb4993154cc..6fcd10c5d4197e182c2334fe18a1abdb2b210fec 100755 (executable)
@@ -31,18 +31,18 @@ test_expect_equal "$output" "thread:0000000000000002   2001-01-05 [1/1] Notmuch
 
 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"'                           \
index e648924675f6551a33414d8d70b04e30b4ea1257..b94236fdde1dcdbdddcf7dc7079a7dd339bb8af0 100755 (executable)
@@ -2,9 +2,11 @@
 
 test_description="emacs interface"
 . $(dirname "$0")/test-lib.sh || exit 1
+. $(dirname "$0")/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
@@ -1057,7 +1059,6 @@ End of search results.
 === 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"
index f61e8a973fc58b1cd8a74a623aaa48dc786be06a..d2638c8bf034d7e84b2c15346e5507be39f727f9 100755 (executable)
@@ -1,11 +1,14 @@
 #!/usr/bin/env bash
 test_description="Emacs with large search results buffer"
 . $(dirname "$0")/test-lib.sh || exit 1
+. $(dirname "$0")/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.
index eaf7c980903bed112fc2df81f7af8c7307f1eda1..6e09a0486e802da77189bfaf9b5b5e1ca3e3aee8 100755 (executable)
@@ -2,6 +2,9 @@
 
 test_description="emacs: mail subject to filename"
 . $(dirname "$0")/test-lib.sh || exit 1
+. $(dirname "$0")/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
index 0aada4dfe7023a15384f121fb794f97126d9a30a..4508c984b94c7fcd77d3c88cd71bd69277cba87a 100755 (executable)
@@ -6,9 +6,11 @@
 
 test_description='PGP/MIME signature verification and decryption'
 . $(dirname "$0")/test-lib.sh || exit 1
+. $(dirname "$0")/test-lib-emacs.sh || exit 1
 
 ##################################################
 
+test_require_emacs
 add_gnupg_home
 
 test_begin_subtest "emacs delivery of signed message"
index 8b2b52be032a34ec539ee673ffa8fee23dc8dc3d..69bdcfac13b11fc9cad87c69a23abb549efd0ff8 100755 (executable)
@@ -2,7 +2,9 @@
 
 test_description='S/MIME signature verification and decryption'
 . $(dirname "$0")/test-lib.sh || exit 1
+. $(dirname "$0")/test-lib-emacs.sh || exit 1
 
+test_require_emacs
 test_require_external_prereq openssl
 test_require_external_prereq gpgsm
 
index 1951ef783a36bf0d3d17cfd4d82420d207574b48..0d30e566ec97fa55b9a60c418c76b70fab3bcef2 100755 (executable)
@@ -4,9 +4,11 @@
 
 test_description='indexing decrypted mail'
 . $(dirname "$0")/test-lib.sh || exit 1
+. $(dirname "$0")/test-lib-emacs.sh || exit 1
 
 ##################################################
 
+test_require_emacs
 add_gnupg_home
 
 # create a test encrypted message
index bca78531af616f9258fef8efc964264def92d71a..b25d7ea79e4626950b89fcb2893da195d9f3da92 100755 (executable)
@@ -2,8 +2,10 @@
 
 test_description="protected headers in emacs interface"
 . $(dirname "$0")/test-lib.sh || exit 1
+. $(dirname "$0")/test-lib-emacs.sh || exit 1
 
 # testing protected headers with emacs
+test_require_emacs
 add_gnupg_home
 add_email_corpus protected-headers
 
index 45de22284cb83af03294390bb4d2c52aab20810f..afe49d93d5f005fc57a76cb076814783e895ec6f 100755 (executable)
@@ -67,7 +67,7 @@ if test_require_external_prereq gdb; then
     ${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)
index a0b76eb89ca1ba1da02c861a39f1e280105dbaf6..d36d4affbe6be0c127e490e42d3261a7a1f6063a 100755 (executable)
@@ -8,95 +8,78 @@ fi
 
 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
index bfc10be3b7b5101ee213a620a0628962336f9e09..22e4f01effb52f98a0f93ceb2e27cc9279f7e802 100755 (executable)
@@ -2,6 +2,7 @@
 
 test_description="emacs test function sanity"
 . $(dirname "$0")/test-lib.sh || exit 1
+. $(dirname "$0")/test-lib-emacs.sh || exit 1
 
 test_begin_subtest "emacs test function sanity"
 test_emacs_expect_t 't'
index 02d3b4117b9407f8fed83330681e45ddfa6d9e13..640bff3fe0f1dadb6e975178db7abee2bdf84c20 100755 (executable)
@@ -2,6 +2,9 @@
 
 test_description="emacs address cleaning"
 . $(dirname "$0")/test-lib.sh || exit 1
+. $(dirname "$0")/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)'
index d23c1fca9876bb656065fb7cd9ac77221ee071ca..642aa3cc3b677609c63d056afaec31dc391bfe86 100755 (executable)
@@ -2,9 +2,11 @@
 
 test_description="emacs notmuch-hello view"
 . $(dirname "$0")/test-lib.sh || exit 1
+. $(dirname "$0")/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"
index cca56ca32cd6875e6da4dbcd7b3b90932b3e3bef..31be55f8529a5abe68cd9d508dedf70943fbb802 100755 (executable)
@@ -2,9 +2,11 @@
 
 test_description="emacs notmuch-show view"
 . $(dirname "$0")/test-lib.sh || exit 1
+. $(dirname "$0")/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"
@@ -189,7 +191,6 @@ test_expect_equal "$(notmuch_emacs_error_sanitize notmuch_fail OUTPUT MESSAGES E
 === 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
index cb1297caa5dc3f1421c57de1bbeddea41dd3e194..a0f4dc24e3aa607abfe1f749e0c1f881f0e238d4 100755 (executable)
@@ -2,11 +2,14 @@
 
 test_description="emacs notmuch-show charset handling"
 . $(dirname "$0")/test-lib.sh || exit 1
+. $(dirname "$0")/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
index cb2c90b80991ec4a1bf31529bc1f6e74493eefdd..dfc69049a0ac8414eefb58186761327d92891fad 100755 (executable)
@@ -2,9 +2,11 @@
 
 test_description="emacs tree view interface"
 . $(dirname "$0")/test-lib.sh || exit 1
+. $(dirname "$0")/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"
index d1c70cfaf5d5fca98e66b9e1c6a2709f55fb7731..f89755ed0e42cfe7d87040f85410e77b8002adfd 100755 (executable)
@@ -4,13 +4,11 @@ test_description="date/time parser module"
 
 # 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 "$*"
 }
 
index 2859d29f37f7548c789e10c12311f406528b4bef..cdb4be444ab2dad529dab8e3a8947ce3f916eff6 100755 (executable)
@@ -10,6 +10,7 @@ test_description='test of proper handling of in-reply-to and references headers'
 # non-RFC-compliant headers'
 
 . $(dirname "$0")/test-lib.sh || exit 1
+. $(dirname "$0")/test-lib-emacs.sh || exit 1
 
 test_begin_subtest "Use References when In-Reply-To is broken"
 add_message '[id]="foo@one.com"' \
index 745e1bb4c491ac7f7a2b2fe1e3aa4983d0ec80bd..bc7298f842f5e1bce7f07d7a7e56bfd4c6a768c8 100755 (executable)
@@ -5,6 +5,25 @@ test_description="library config API"
 
 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>
@@ -380,26 +399,26 @@ cat c_head - c_tail <<'EOF' | test_C ${MAIL_DIR} '' %NULL%
         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
@@ -694,23 +713,23 @@ cat c_head2 - c_tail <<'EOF' | test_C ${MAIL_DIR} %NULL% %NULL%
         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
@@ -723,25 +742,26 @@ cat c_head2 - c_tail <<'EOF' | test_C ${MAIL_DIR} /nonexistent %NULL%
         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
index aeb82cf4e3f300b10dfc80b9333fc18f433ce6ac..92a70e3eb12123d4ba5a947f794727cbb7d66899 100755 (executable)
@@ -21,7 +21,7 @@ test_description='thread breakage during reindexing'
 
 . $(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
@@ -35,7 +35,7 @@ Apple
 EOF
 }
 
-message_b() {
+message_b () {
     mkdir -p ${MAIL_DIR}/cur
     cat > ${MAIL_DIR}/cur/b <<EOF
 Subject: Second message
@@ -52,19 +52,19 @@ EOF
 }
 
 
-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"
index d7903ce799da7ac846fce8c50f0c521f70650adc..8553f022e4ade0bfa1999e01a759fc91624465e0 100755 (executable)
@@ -1,7 +1,9 @@
 #!/usr/bin/env bash
 test_description="Emacs Draft Handling"
 . $(dirname "$0")/test-lib.sh || exit 1
+. $(dirname "$0")/test-lib-emacs.sh || exit 1
 
+test_require_emacs
 add_email_corpus
 
 notmuch config set search.exclude_tags deleted
index f51130e8f86d4ed8c4a80698b971305c34b4ae91..bac43dc5e16df214dafb1d3a3698d0033bab741c 100755 (executable)
@@ -6,8 +6,8 @@ add_email_corpus
 
 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'
@@ -83,4 +83,11 @@ notmuch reindex '*'
 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
index c8d2bcc241a6b4f2141bb0001cf36bed80b12c70..4e8c5d260dcdf6be259475b81b1058192a27d572 100755 (executable)
@@ -2,6 +2,9 @@
 
 test_description="emacs attachment warnings"
 . $(dirname "$0")/test-lib.sh || exit 1
+. $(dirname "$0")/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)'
index 45e61568ec62540b03094562dfb3aa1c0def08f8..378067edd5d6321148f17298dabe9b1c362c48f3 100755 (executable)
@@ -2,6 +2,9 @@
 
 test_description="emacs forwarding"
 . $(dirname "$0")/test-lib.sh || exit 1
+. $(dirname "$0")/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
index 05f80885eec5d23360f282187bc62a33acd51f07..03c436561601800983f4a0b059d42181b7d1cce5 100755 (executable)
@@ -4,8 +4,8 @@ test_description='indexing user specified headers'
 
 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"
index 0578b1e50194d308d42f782556c951630a702bf1..0a048e1fe66940b914182c78400ad4dea8a8a94c 100644 (file)
@@ -9,8 +9,7 @@ if [[ -z "${NOTMUCH_SRCDIR}" ]]; then
        export NOTMUCH_SRCDIR="$(cd "$(dirname "$0")"/.. && pwd)"
 fi
 
-find_builddir()
-{
+find_builddir () {
        local dir="$1"
 
        while [[ -n "$dir" ]] && [[ "$dir" != "/" ]]; do
index 2f7950ac75b7b6c61777560bb933d847b9a7e3f7..ebbf4cdfa6fd2e727f78d651fdf31dcb8c3ead7d 100644 (file)
@@ -105,8 +105,7 @@ fi
 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
@@ -225,8 +224,7 @@ EOF
 #
 # 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
 }
diff --git a/test/test-lib-emacs.sh b/test/test-lib-emacs.sh
new file mode 100644 (file)
index 0000000..dde3217
--- /dev/null
@@ -0,0 +1,209 @@
+#
+# 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
index 4c9f2a2103e32a18c2c14dc257669300ecbe4d6f..0bca76df217afbb062ac2157eefd3206b5cb196e 100644 (file)
@@ -112,9 +112,9 @@ unset ALTERNATE_EDITOR
 
 # 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
@@ -134,8 +134,7 @@ add_gnupg_home ()
     printf '%s:6:\n' "$FINGERPRINT" | gpg --quiet --batch --no-tty --import-ownertrust
 }
 
-add_gpgsm_home ()
-{
+add_gpgsm_home () {
     local fpr
     [ -e "$GNUPGHOME/gpgsm.conf" ] && return
     _gnupg_exit () { gpgconf --kill all 2>/dev/null || true; }
@@ -194,56 +193,53 @@ do
 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
 
@@ -267,8 +263,7 @@ then
 fi
 
 test_description_printed=
-print_test_description ()
-{
+print_test_description () {
        test -z "$test_description_printed" || return 0
        echo
        echo $this_test: "Testing ${test_description}"
@@ -342,90 +337,6 @@ export GNUPGHOME="${TEST_TMPDIR}/gnupg"
 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.
@@ -434,8 +345,7 @@ emacs_fcc_message ()
 # 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}
 
@@ -444,8 +354,7 @@ add_email_corpus ()
     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]}"
@@ -465,8 +374,7 @@ test_begin_subtest ()
 # 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
@@ -492,8 +400,7 @@ test_expect_equal ()
 }
 
 # 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
@@ -574,51 +481,16 @@ test_json_nodes () {
        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)
@@ -627,41 +499,39 @@ print(msg.as_string(False))
 ' "$@"
 }
 
-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' \
@@ -671,58 +541,37 @@ notmuch_json_show_sanitize ()
        -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 }'
 }
 
@@ -913,7 +762,7 @@ test_expect_success () {
                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_
@@ -937,7 +786,7 @@ test_expect_code () {
                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_
@@ -977,7 +826,7 @@ test_must_fail () {
 # - 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 "$@"
 }
 
@@ -1031,88 +880,13 @@ test_done () {
        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}"
@@ -1122,7 +896,7 @@ test_C () {
     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 () {
@@ -1195,9 +969,6 @@ TEST_DIRECTORY=$NOTMUCH_BUILDDIR/test
 
 . "$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"
index 541698cdfee7939e05aa3554ff39c91295920940..c1c2f63d20178dab69f92c9ff9aab4631dda6ee5 100644 (file)
@@ -317,6 +317,9 @@ ruby << EOF
        $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)