]> git.notmuchmail.org Git - notmuch/commitdiff
Merge commit '0.6.1'
authorDavid Bremner <bremner@debian.org>
Mon, 18 Jul 2011 01:18:58 +0000 (22:18 -0300)
committerDavid Bremner <bremner@debian.org>
Mon, 18 Jul 2011 01:20:37 +0000 (22:20 -0300)
Conflicts:
lib/Makefile.local

The conflicts are from three kinds of commits not merged into release:
    - typo fixes
    - removal of debug output
    - fix for CLEAN rule

That were never merged into the release branch.

50 files changed:
.dir-locals.el
.gitignore
TODO
bindings/python/notmuch/database.py
bindings/python/notmuch/tag.py
compat/README
completion/Makefile
configure
emacs/Makefile
emacs/Makefile.local
emacs/notmuch-hello.el
emacs/notmuch-lib.el
emacs/notmuch-maildir-fcc.el
emacs/notmuch-show.el
emacs/notmuch-wash.el
emacs/notmuch.el
gmime-filter-headers.h
lib/Makefile
lib/Makefile.local
lib/database.cc
lib/libsha1.c
lib/libsha1.h
lib/message.cc
lib/notmuch.h
notmuch-config.c
notmuch-new.c
notmuch-reply.c
notmuch-show.c
notmuch.1
notmuch.c
packaging/debian
test/Makefile
test/README
test/basic
test/corpus/cur/51:2, [new file with mode: 0644]
test/crypto
test/emacs
test/emacs-large-search-buffer
test/maildir-sync
test/multipart
test/new
test/search-by-folder
test/search-folder-coherence
test/search-output
test/symbol-hiding
test/test-lib.el
test/test-lib.sh
test/uuencode
vim/README
vim/plugin/notmuch.vim

index cbdb1f9790f9c30419dca5d60aa1c376a3a5994f..aea630bdf3155b26113881e36a45a83d1e82bd4d 100644 (file)
@@ -1,7 +1,23 @@
 ; emacs local configuration settings for notmuch source
 ; surmised by dkg on 2010-11-23 13:43:18-0500
+; amended by amdragon on 2011-06-06
 
-((c-mode . ((indent-tabs-mode . t)
-            (tab-width . 8)
-            (c-basic-offset . 4)
-            (c-file-style . "linux"))))
+((c-mode
+  (indent-tabs-mode . t)
+  (tab-width . 8)
+  (c-basic-offset . 4)
+  (c-file-style . "linux"))
+ (c++-mode
+  (indent-tabs-mode . t)
+  (tab-width . 8)
+  (c-basic-offset . 4)
+  (c-file-style . "linux"))
+ (emacs-lisp-mode
+  (indent-tabs-mode . t)
+  (tab-width . 8))
+ (shell-mode
+  (indent-tabs-mode . t)
+  (tab-width . 8)
+  (sh-basic-offset . 4)
+  (sh-indentation . 4))
+ )
index 217440d50fd2487094d3d769b1f067052c523e0c..02ab00441d67ba9ed47a4e16f628778dea56c766 100644 (file)
@@ -5,6 +5,7 @@ tags
 *cscope*
 .deps
 notmuch
+notmuch.sym
 notmuch-shared
 notmuch.1.gz
 libnotmuch.so*
diff --git a/TODO b/TODO
index 260ffe18b37c778fcb7b13325f78547e76257aaa..4dda6f4654895d5b1aa7edf0b4915bbd20d17156 100644 (file)
--- a/TODO
+++ b/TODO
@@ -15,7 +15,9 @@ result.) This may require removing the outer array from the current
 "notmuch search --format=json" results.
 
 Fix '*' to work by simply calling '+' or '-' on a region consisting of
-the entire buffer.
+the entire buffer, (this would avoid one race condition---while still
+leaving other race conditions---but could also potentially make '*' a
+very expensive operation).
 
 Add a global keybinding table for notmuch, and then view-specific
 tables that add to it.
@@ -29,7 +31,7 @@ Make 'notmuch-show-pipe-message have a private history.
 
 Add support for a delete keybinding that adds a "deleted" tag to the
 current message/thread and make searches not return deleted messages
-by default, (unless the user asks explicitly for deleted messags in
+by default, (unless the user asks explicitly for deleted messages in
 the search query).
 
 Add keybindings for next/previous thread.
@@ -119,7 +121,7 @@ Allow configuration for filename patterns that should be ignored when
 indexing.
 
 Replace the "notmuch part --part=id" command with "notmuch show
---part=id", (David Edmonson wants to rewrite some of "notmuch show" to
+--part=id", (David Edmondson wants to rewrite some of "notmuch show" to
 provide more MIME-structure information in its output first).
 
 Replace the "notmuch search-tags" command with "notmuch search
@@ -265,6 +267,9 @@ large so the detection could be potentially slow). 2. A "notmuch
 search" syntax could be added to allow the user to find these files,
 (and perhaps delete them or move them away as appropriate).
 
+Fix filesystem/notmuch-new race condition by not updating database
+mtime for a directory if it is the same as the current mtime.
+
 Test suite
 ----------
 Achieve 100% test coverage with the test suite.
index 5deb2a5dc06a62cb8d97096b376baf44812c7648..84cf79bbad13f90e8d438bb51d4fac44a818bf4a 100644 (file)
@@ -195,7 +195,7 @@ class Database(object):
         # Raise a NotmuchError if not initialized
         self._verify_initialized_db()
 
-        return notmuch_database_needs_upgrade(self._db) 
+        return nmlib.notmuch_database_needs_upgrade(self._db) 
 
     def upgrade(self):
         """Upgrades the current database
@@ -501,7 +501,7 @@ class Query(object):
         :param db: An open database which we derive the Query from.
         :type db: :class:`Database`
         :param querystr: The query string for the message.
-        :type querystr: str
+        :type querystr: utf-8 encoded str or unicode
         """
         self._db = None
         self._query = None
@@ -517,7 +517,7 @@ class Query(object):
         :param db: Database to create the query from.
         :type db: :class:`Database`
         :param querystr: The query string
-        :type querystr: str
+        :type querystr: utf-8 encoded str or unicode
         :returns: Nothing
         :exception: :exc:`NotmuchError`
 
@@ -529,7 +529,9 @@ class Query(object):
             raise NotmuchError(STATUS.NOT_INITIALIZED)            
         # create reference to parent db to keep it alive
         self._db = db
-        
+        if isinstance(querystr, unicode):
+            # xapian takes utf-8 encoded byte arrays
+            querystr = querystr.encode('utf-8')
         # create query, return None if too little mem available
         query_p = Query._create(db.db_p, querystr)
         if query_p is None:
index e123b0f317059f4429125482a3941f325af9d4f5..65a9118a6ce94d38c825e2f35e62a1a5838a9bef 100644 (file)
@@ -23,10 +23,12 @@ from notmuch.globals import nmlib, STATUS, NotmuchError
 class Tags(object):
     """Represents a list of notmuch tags
 
-    This object provides an iterator over a list of notmuch tags. Do
-    note that the underlying library only provides a one-time iterator
-    (it cannot reset the iterator to the start). Thus iterating over
-    the function will "exhaust" the list of tags, and a subsequent
+    This object provides an iterator over a list of notmuch tags (which
+    are unicode instances). 
+
+    Do note that the underlying library only provides a one-time
+    iterator (it cannot reset the iterator to the start). Thus iterating
+    over the function will "exhaust" the list of tags, and a subsequent
     iteration attempt will raise a :exc:`NotmuchError`
     STATUS.NOT_INITIALIZED. Also note, that any function that uses
     iteration (nearly all) will also exhaust the tags. So both::
@@ -83,7 +85,7 @@ class Tags(object):
             raise NotmuchError(STATUS.NOT_INITIALIZED)
         # No need to call nmlib.notmuch_tags_valid(self._tags);
         # Tags._get safely returns None, if there is no more valid tag.
-        tag = Tags._get (self._tags)
+        tag = Tags._get(self._tags).decode('utf-8')
         if tag is None:
             self._tags = None
             raise StopIteration
index cd32c56fa8d3f679db5d6f900cac91f3c19454fe..38e2e146b07e0d1582677fde256e4a3a8fe1c47d 100644 (file)
@@ -1,4 +1,4 @@
-notmuch/comapt
+notmuch/compat
 
 This directory consists of two things:
 
index b6859eacc7f87c70cae3f2bb320e48158d146af3..de492a7c3fd5a84c7c8e25852fa2427c2f92e4d1 100644 (file)
@@ -1,4 +1,4 @@
-# See Makfefile.local for the list of files to be compiled in this
+# See Makefile.local for the list of files to be compiled in this
 # directory.
 all:
        $(MAKE) -C .. all
index cf525c9f6a0fc6a664d1918d001918c05e12363b..3999ce8f3a80509dda16572a3a92bcbf4035a103 100755 (executable)
--- a/configure
+++ b/configure
@@ -22,7 +22,7 @@ if [ "$srcdir" != "." ]; then
 fi
 
 # Set several defaults (optionally specified by the user in
-# environemnt variables)
+# environment variables)
 CC=${CC:-gcc}
 CXX=${CXX:-g++}
 CFLAGS=${CFLAGS:--O2}
@@ -608,7 +608,7 @@ includedir = ${INCLUDEDIR:=\$(prefix)/include}
 # The directory to which man pages should be installed
 mandir = ${MANDIR:=\$(prefix)/share/man}
 
-# The directory to which read-only (configuration) filesshould be installed
+# The directory to which read-only (configuration) files should be installed
 sysconfdir = ${SYSCONFDIR:=\$(prefix)/etc}
 
 # The directory to which emacs lisp files should be installed
index b6859eacc7f87c70cae3f2bb320e48158d146af3..de492a7c3fd5a84c7c8e25852fa2427c2f92e4d1 100644 (file)
@@ -1,4 +1,4 @@
-# See Makfefile.local for the list of files to be compiled in this
+# See Makefile.local for the list of files to be compiled in this
 # directory.
 all:
        $(MAKE) -C .. all
index 102277778a9902e4f1b978fdc541b3c00b5b4be5..ce0c3f007127e634404c0c540e88eee12cb8c1cb 100644 (file)
@@ -20,7 +20,7 @@ emacs_images := \
 
 emacs_bytecode = $(emacs_sources:.el=.elc)
 
-%.elc: %.el
+%.elc: %.el $(global_deps)
        $(call quiet,EMACS) --directory emacs -batch -f batch-byte-compile $<
 
 ifeq ($(WITH_EMACS),1)
index 916cda1cc5d25b2a51a9e9325f2efb1065ca8241..65fde75a07d3b3ad10179315941c29ab0a26bacb 100644 (file)
@@ -428,7 +428,7 @@ Complete list of currently available key bindings:
     (let ((found-target-pos nil)
          (final-target-pos nil))
       (let* ((saved-alist
-             ;; Filter out empty saved seaches if required.
+             ;; Filter out empty saved searches if required.
              (if notmuch-show-empty-saved-searches
                  notmuch-saved-searches
                (loop for elem in notmuch-saved-searches
index a21dc14558ffa0d982960a80e61cbcaeabc55b13..f93c957d5d72d0cc26704c673341471fc58d20ac 100644 (file)
@@ -88,7 +88,7 @@ the user hasn't set this variable with the old or new value."
   (notmuch-config-get "user.primary_email"))
 
 (defun notmuch-user-other-email ()
-  "Return the user.primary_email value (as a list) from the notmuch configuration."
+  "Return the user.other_email value (as a list) from the notmuch configuration."
   (split-string (notmuch-config-get "user.other_email") "\n"))
 
 (defun notmuch-kill-this-buffer ()
index b6c6e2a74086fe566db37e56fde3cc5b1a8f2b2d..e67886853eeb341989191044241352100c08a56a 100644 (file)
@@ -163,7 +163,7 @@ will NOT be removed or replaced."
         (make-directory (concat path "/new/") t)
         (make-directory (concat path "/tmp/") t))
        ((file-regular-p path)
-        (error "%s is a file. Can't creat maildir." path))
+        (error "%s is a file. Can't create maildir." path))
        (t
         (error "I don't know how to create a maildir here"))))
 
index 452987839270909422d3a6d28e1981a7f27228fa..f96743b08d37b597a856ff1a1803f1d325c8c602 100644 (file)
@@ -110,7 +110,7 @@ any given message."
   "Use external viewers to view all attachments from the current message."
   (interactive)
   (with-current-notmuch-show-message
-   ; We ovverride the mm-inline-media-tests to indicate which message
+   ; We override the mm-inline-media-tests to indicate which message
    ; parts are already sufficiently handled by the original
    ; presentation of the message in notmuch-show mode. These parts
    ; will be inserted directly into the temporary buffer of
@@ -791,7 +791,7 @@ The optional QUERY-CONTEXT is a notmuch search term. Only
 messages from the thread matching this search term are shown if
 non-nil.
 
-The optional BUFFER-NAME provides the neame of the buffer in
+The optional BUFFER-NAME provides the name of the buffer in
 which the message thread is shown. If it is nil (which occurs
 when the command is called interactively) the argument to the
 function is used. "
@@ -909,7 +909,7 @@ more selectively, (such as '\\[notmuch-show-next-message]' and '\\[notmuch-show-
 without removing any tags, and '\\[notmuch-show-archive-thread]' to archive an entire thread
 without scrolling through with \\[notmuch-show-advance-and-archive]).
 
-You can add or remove arbitary tags from the current message with
+You can add or remove arbitrary tags from the current message with
 '\\[notmuch-show-add-tag]' or '\\[notmuch-show-remove-tag]'.
 
 All currently available key bindings:
index 92f07c5000751fb394d45c26cb2593902e594e6b..1f420b25a05d770556cd19e4e737f522b7e18098 100644 (file)
@@ -137,7 +137,7 @@ collapse the remaining lines into a button.")
     (format label-format lines-count)))
 
 (defun notmuch-wash-region-to-button (msg beg end type prefix)
-  "Auxilary function to do the actual making of overlays and buttons
+  "Auxiliary function to do the actual making of overlays and buttons
 
 BEG and END are buffer locations. TYPE should a string, either
 \"citation\" or \"signature\". PREFIX is some arbitrary text to
index 3311fe8b2c9b8b980a93425dacfb8f65a5f9fc90..f11ec24e76111dd813e399ad1ccf15791c4077ca 100644 (file)
@@ -64,7 +64,7 @@
     ("authors" . "%-20s ")
     ("subject" . "%s ")
     ("tags" . "(%s)"))
-  "Search result formating. Supported fields are:
+  "Search result formatting. Supported fields are:
        date, count, authors, subject, tags
 For example:
        (setq notmuch-search-result-format \(\(\"authors\" . \"%-40s\"\)
@@ -493,7 +493,7 @@ the messages that are about to be tagged"
   :group 'notmuch)
 
 (defcustom notmuch-after-tag-hook nil
-  "Hooks that are run before tags of a message are modified.
+  "Hooks that are run after tags of a message are modified.
 
 'tags' will contain the tags that were added or removed as
 a list of strings of the form \"+TAG\" or \"-TAG\".
@@ -836,7 +836,7 @@ non-authors is found, assume that all of the authors match."
 (defun notmuch-search-operate-all (action)
   "Add/remove tags from all matching messages.
 
-Tis command adds or removes tags from all messages matching the
+This command adds or removes tags from all messages matching the
 current search terms. When called interactively, this command
 will prompt for tags to be added or removed. Tags prefixed with
 '+' will be added and tags prefixed with '-' will be removed.
index 47d1d45611696757bd78788d408c2587869f4b0e..1d1a3ebb9984d55fe9cecf59ef8654c0bdf18574 100644 (file)
@@ -39,7 +39,7 @@ typedef struct _GMimeFilterHeadersClass GMimeFilterHeadersClass;
  * @parent_object: parent #GMimeFilter
  * @saw_nl: previous char was a \n
  * @line: temporary buffer for line unfolding
- * @line_size: size of currently allocated nemory for @line
+ * @line_size: size of currently allocated memory for @line
  * @lineptr: pointer to the first unused character in @line
  *
  * A filter to decode rfc2047 encoded headers
index b6859eacc7f87c70cae3f2bb320e48158d146af3..de492a7c3fd5a84c7c8e25852fa2427c2f92e4d1 100644 (file)
@@ -1,4 +1,4 @@
-# See Makfefile.local for the list of files to be compiled in this
+# See Makefile.local for the list of files to be compiled in this
 # directory.
 all:
        $(MAKE) -C .. all
index a6076ab5df19fc38f77741a10ae81c2b70dd80af..9210f0e543f814392f3038777b76a948c5cfe2a5 100644 (file)
@@ -72,7 +72,6 @@ $(dir)/libnotmuch.a: $(libnotmuch_modules)
        $(call quiet,AR) rcs $@ $^
 
 $(dir)/$(LIBNAME): $(libnotmuch_modules) notmuch.sym
-       echo $(libnotmuch_modules)
        $(call quiet,CXX $(CXXFLAGS)) $(libnotmuch_modules) $(FINAL_LIBNOTMUCH_LDFLAGS) $(LIBRARY_LINK_FLAG) -o $@
 
 notmuch.sym: lib/notmuch.h
@@ -86,7 +85,7 @@ $(dir)/$(LINKER_NAME): $(dir)/$(SONAME)
 
 install: install-$(dir)
 
-# The (often-reused) $dir works fine within targets/pre-requisites,
+# The (often-reused) $dir works fine within targets/prerequisites,
 # but cannot be used reliably within commands, so copy its value to a
 # variable that is not reused.
 lib := $(dir)
@@ -100,4 +99,6 @@ install-$(dir): $(dir)/$(LIBNAME)
        $(LIBRARY_INSTALL_POST_COMMAND)
 
 SRCS  := $(SRCS) $(libnotmuch_c_srcs) $(libnotmuch_cxx_srcs)
-CLEAN := $(CLEAN) $(libnotmuch_modules) $(dir)/$(SONAME) $(dir)/$(LINKER_NAME) $(dir)$(LIBNAME) libnotmuch.a notmuch.sym
+CLEAN += $(libnotmuch_modules) $(dir)/$(SONAME) $(dir)/$(LINKER_NAME)
+CLEAN += $(dir)/$(LIBNAME) $(dir)/libnotmuch.a notmuch.sym
+CLEAN += $(dir)/notmuch.h.gch
index 7f79cf47bda767a1463ae418ea5d713f950ac3c4..9c2f4ecdc58ff2bcb6de93eba16b8ddc3dfd0b00 100644 (file)
@@ -69,7 +69,7 @@ typedef struct {
  *
  *    Multiple terms of given prefix:
  *
- *     reference: All message IDs from In-Reply-To and Re ferences
+ *     reference: All message IDs from In-Reply-To and References
  *                headers in the message.
  *
  *     tag:       Any tags associated with this message by the user.
@@ -137,7 +137,7 @@ typedef struct {
  *                     ASCII integer. The initial database version
  *                     was 1, (though a schema existed before that
  *                     were no "version" database value existed at
- *                     all). Succesive versions are allocated as
+ *                     all). Successive versions are allocated as
  *                     changes are made to the database (such as by
  *                     indexing new fields).
  *
@@ -148,7 +148,7 @@ typedef struct {
  *                     incremented for each thread ID.
  *
  *     thread_id_*     A pre-allocated thread ID for a particular
- *                     message. This is actually an arbitarily large
+ *                     message. This is actually an arbitrarily large
  *                     family of metadata name. Any particular name is
  *                     formed by concatenating "thread_id_" with a message
  *                     ID (or the SHA1 sum of a message ID if it is very
@@ -422,7 +422,7 @@ skip_space_and_comments (const char **str)
 }
 
 /* Parse an RFC 822 message-id, discarding whitespace, any RFC 822
- * comments, and the '<' and '>' delimeters.
+ * comments, and the '<' and '>' delimiters.
  *
  * If not NULL, then *next will be made to point to the first character
  * not parsed, (possibly pointing to the final '\0' terminator.
@@ -1149,7 +1149,7 @@ _notmuch_database_filename_to_direntry (void *ctx,
 
 /* Given a legal 'path' for the database, return the relative path.
  *
- * The return value will be a pointer to the originl path contents,
+ * The return value will be a pointer to the original path contents,
  * and will be either the original string (if 'path' was relative) or
  * a portion of the string (if path was absolute and begins with the
  * database path).
@@ -1476,7 +1476,7 @@ _notmuch_database_link_message_to_children (notmuch_database_t *notmuch,
  * In all cases, we assign to the current message the first thread_id
  * found (through either parent or child). We will also merge any
  * existing, distinct threads where this message belongs to both,
- * (which is not uncommon when mesages are processed out of order).
+ * (which is not uncommon when messages are processed out of order).
  *
  * Finally, if no thread ID has been found through parent or child, we
  * call _notmuch_message_generate_thread_id to generate a new thread
index c39a5a174b9c9ea4bf5369ce7fe9af27cf1d52b6..5d16f6ab1a61363dbbcec827496842ba113338fd 100644 (file)
@@ -174,7 +174,7 @@ void sha1_hash(const unsigned char data[], unsigned long len, sha1_ctx ctx[1])
     if((ctx->count[0] += len) < len)
         ++(ctx->count[1]);
 
-    while(len >= space)     /* tranfer whole blocks if possible  */
+    while(len >= space)     /* transfer whole blocks if possible  */
     {
         memcpy(((unsigned char*)ctx->wbuf) + pos, sp, space);
         sp += space; len -= space; space = SHA1_BLOCK_SIZE; pos = 0;
index c1c848fc4431d4e4161f81c1ed17590a91912313..56f445a9ac421bf1446d2df09b8e41c3d2ddd545 100644 (file)
@@ -38,7 +38,7 @@ extern "C"
 {
 #endif
 #if 0
-} /* Appleasing Emacs */
+} /* Appeasing Emacs */
 #endif
 
 #include <stdint.h>
index 2a4954dd59ce1d9c72fc0e2685459b730e79f699..d993cde834a33baa5614ecf66d8272ed87c273c7 100644 (file)
@@ -862,7 +862,7 @@ _notmuch_message_add_term (notmuch_message_t *message,
 
 /* Parse 'text' and add a term to 'message' for each parsed word. Each
  * term will be added both prefixed (if prefix_name is not NULL) and
- * also unprefixed). */
+ * also non-prefixed). */
 notmuch_private_status_t
 _notmuch_message_gen_terms (notmuch_message_t *message,
                            const char *prefix_name,
index e508309ebfcf01c95b52555baa9cc992daab5c3e..974be8d1bec2fb52fb5e8ca8452b9f10a5521479 100644 (file)
@@ -103,7 +103,7 @@ typedef enum _notmuch_status {
 
 /* Get a string representation of a notmuch_status_t value.
  *
- * The result is readonly.
+ * The result is read-only.
  */
 const char *
 notmuch_status_to_string (notmuch_status_t status);
@@ -510,7 +510,7 @@ notmuch_threads_move_to_next (notmuch_threads_t *threads);
  *
  * It's not strictly necessary to call this function. All memory from
  * the notmuch_threads_t object will be reclaimed when the
- * containg query object is destroyed.
+ * containing query object is destroyed.
  */
 void
 notmuch_threads_destroy (notmuch_threads_t *threads);
index 6e4c5c4c0c93738f643b4048152c0d2de826a5f4..485fa72a759b5e61f74dfefb11d4a56f58a3b971 100644 (file)
@@ -69,7 +69,7 @@ static const char maildir_config_comment[] =
     "\tsynchronize_flags      Valid values are true and false.\n"
     "\n"
     "\tIf true, then the following maildir flags (in message filenames)\n"
-    "\twill be syncrhonized with the corresponding notmuch tags:\n"
+    "\twill be synchronized with the corresponding notmuch tags:\n"
     "\n"
     "\t\tFlag  Tag\n"
     "\t\t----  -------\n"
index 744f4ca3396310f6c3ed41e814d654cd64f278f8..7d17793b2f382c5102f092a6e9173966286fa724 100644 (file)
@@ -213,6 +213,7 @@ _entries_resemble_maildir (struct dirent **entries, int count)
  *     information is lost from the database).
  *
  *   o Tell the database to update its time of 'path' to 'fs_mtime'
+ *     if fs_mtime isn't the current wall-clock time.
  */
 static notmuch_status_t
 add_files_recursive (notmuch_database_t *notmuch,
@@ -230,6 +231,7 @@ add_files_recursive (notmuch_database_t *notmuch,
     notmuch_directory_t *directory;
     notmuch_filenames_t *db_files = NULL;
     notmuch_filenames_t *db_subdirs = NULL;
+    time_t stat_time;
     struct stat st;
     notmuch_bool_t is_maildir, new_directory;
     const char **tag;
@@ -239,6 +241,7 @@ add_files_recursive (notmuch_database_t *notmuch,
                 path, strerror (errno));
        return NOTMUCH_STATUS_FILE_ERROR;
     }
+    stat_time = time (NULL);
 
     /* This is not an error since we may have recursed based on a
      * symlink to a regular file, not a directory, and we don't know
@@ -253,6 +256,25 @@ add_files_recursive (notmuch_database_t *notmuch,
 
     new_directory = db_mtime ? FALSE : TRUE;
 
+    /* XXX This is a temporary workaround.  If we don't update the
+     * database mtime until after processing messages in this
+     * directory, then a 0 mtime is *not* sufficient to indicate that
+     * this directory has no messages or subdirs in the database (for
+     * example, if an earlier run skipped the mtime update because
+     * fs_mtime == stat_time, or was interrupted before updating the
+     * mtime at the end).  To address this, we record a (bogus)
+     * non-zero value before processing any child messages so that a
+     * later run won't mistake this for a new directory (and, for
+     * example, fail to detect removed files and subdirs).
+     *
+     * A better solution would be for notmuch_database_get_directory
+     * to indicate if it really created a new directory or not, either
+     * by a new out-argument, or by recording this information and
+     * providing an accessor.
+     */
+    if (new_directory)
+       notmuch_directory_set_mtime (directory, -1);
+
     /* If the database knows about this directory, then we sort based
      * on strcmp to match the database sorting. Otherwise, we can do
      * inode-based sorting for faster filesystem operation. */
@@ -373,7 +395,7 @@ add_files_recursive (notmuch_database_t *notmuch,
        /* If we're looking at a symlink, we only want to add it if it
         * links to a regular file, (and not to a directory, say).
         *
-        * Similarly, if the file is of unknown type (due to filesytem
+        * Similarly, if the file is of unknown type (due to filesystem
         * limitations), then we also need to look closer.
         *
         * In either case, a stat does the trick.
@@ -509,7 +531,12 @@ add_files_recursive (notmuch_database_t *notmuch,
        notmuch_filenames_move_to_next (db_subdirs);
     }
 
-    if (! interrupted) {
+    /* If the directory's mtime is the same as the wall-clock time
+     * when we stat'ed the directory, we skip updating the mtime in
+     * the database because a message could be delivered later in this
+     * same second.  This may lead to unnecessary re-scans, but it
+     * avoids overlooking messages. */
+    if (! interrupted && fs_mtime != stat_time) {
        status = notmuch_directory_set_mtime (directory, fs_mtime);
        if (status && ret == NOTMUCH_STATUS_SUCCESS)
            ret = status;
index 27ef37bd914cd0af1da57f8dd60bf33f1509cfce..362e19872f6061192fbf2280f45ae7fd4eb8019f 100644 (file)
@@ -278,7 +278,7 @@ add_recipients_from_message (GMimeMessage *reply,
      * The munging is easy to detect, because it results in a
      * redundant reply-to header, (with an address that already exists
      * in either To or Cc). So in this case, we ignore the Reply-To
-     * field and use the From header. Thie ensures the original sender
+     * field and use the From header. This ensures the original sender
      * will get the reply even if not subscribed to the list. Note
      * that the address in the Reply-To header will always appear in
      * the reply.
@@ -362,7 +362,7 @@ guess_from_received_header (notmuch_config_t *config, notmuch_message_t *message
      * them indications to which email address this message was
      * delivered.
      * The Received: header is special in our get_header function
-     * and is always concated.
+     * and is always concatenated.
      */
     received = notmuch_message_get_header (message, "received");
     if (received == NULL)
index dda83a10d337fc8f64bbe5bd42a94da2f0891bc6..fb7430081f2600cbf3747652b227c182866553e2 100644 (file)
@@ -454,19 +454,21 @@ format_part_start_text (GMimeObject *part, int *part_count)
 static void
 format_part_content_text (GMimeObject *part)
 {
-    GMimeContentDisposition *disposition = g_mime_object_get_content_disposition (part);
+    const char *cid = g_mime_object_get_content_id (part);
     GMimeContentType *content_type = g_mime_object_get_content_type (GMIME_OBJECT (part));
 
-    printf (", Content-type: %s\n", g_mime_content_type_to_string (content_type));
-
-    if (disposition &&
-       strcmp (disposition->disposition, GMIME_DISPOSITION_ATTACHMENT) == 0)
+    if (GMIME_IS_PART (part))
     {
        const char *filename = g_mime_part_get_filename (GMIME_PART (part));
-       printf ("Attachment: %s (%s)\n", filename,
-               g_mime_content_type_to_string (content_type));
+       if (filename)
+           printf (", Filename: %s", filename);
     }
 
+    if (cid)
+       printf (", Content-id: %s", cid);
+
+    printf (", Content-type: %s\n", g_mime_content_type_to_string (content_type));
+
     if (g_mime_content_type_is_type (content_type, "text", "*") &&
        !g_mime_content_type_is_type (content_type, "text", "html"))
     {
@@ -591,7 +593,6 @@ format_part_content_json (GMimeObject *part)
     GMimeStream *stream_memory = g_mime_stream_mem_new ();
     const char *cid = g_mime_object_get_content_id (part);
     void *ctx = talloc_new (NULL);
-    GMimeContentDisposition *disposition = g_mime_object_get_content_disposition (part);
     GByteArray *part_content;
 
     printf (", \"content-type\": %s",
@@ -600,12 +601,11 @@ format_part_content_json (GMimeObject *part)
     if (cid != NULL)
            printf(", \"content-id\": %s", json_quote_str (ctx, cid));
 
-    if (disposition &&
-       strcmp (disposition->disposition, GMIME_DISPOSITION_ATTACHMENT) == 0)
+    if (GMIME_IS_PART (part))
     {
        const char *filename = g_mime_part_get_filename (GMIME_PART (part));
-
-       printf (", \"filename\": %s", json_quote_str (ctx, filename));
+       if (filename)
+           printf (", \"filename\": %s", json_quote_str (ctx, filename));
     }
 
     if (g_mime_content_type_is_type (content_type, "text", "*") &&
index c1aa4e329c43f0e377539b6ed454b95c1555b2ea..5a8c83dc6b534ba58889708897cbbe23353adba7 100644 (file)
--- a/notmuch.1
+++ b/notmuch.1
@@ -484,7 +484,7 @@ sup calls them).
 
 The
 .B part
-command can used to output a single part of a multi-part MIME message.
+command can used to output a single part of a multipart MIME message.
 
 .RS 4
 .TP 4
@@ -641,13 +641,13 @@ expression).
 Finally, results can be restricted to only messages within a
 particular time range, (based on the Date: header) with a syntax of:
 
-       <intial-timestamp>..<final-timestamp>
+       <initial-timestamp>..<final-timestamp>
 
 Each timestamp is a number representing the number of seconds since
 1970\-01\-01 00:00:00 UTC. This is not the most convenient means of
 expressing date ranges, but until notmuch is fixed to accept a more
 convenient form, one can use the date program to construct
-timestamps. For example, with the bash shell the folowing syntax would
+timestamps. For example, with the bash shell the following syntax would
 specify a date range to return messages from 2009\-10\-01 until the
 current time:
 
index 93f319442c20a24dbf57497de9c4e9d02fc717e5..3973e350d06391935d5829ff9fa171bd091d014e 100644 (file)
--- a/notmuch.c
+++ b/notmuch.c
@@ -48,7 +48,7 @@ static int
 notmuch_help_command (void *ctx, int argc, char *argv[]);
 
 static const char search_terms_help[] =
-    "\tSeveral notmuch commands accept a comman syntax for search\n"
+    "\tSeveral notmuch commands accept a common syntax for search\n"
     "\tterms.\n"
     "\n"
     "\tThe search terms can consist of free-form text (and quoted\n"
index a586660197b63d81abedf226ff0b59daaa8ecb8c..c8e8ddd456a34a652e77acf59a416e9a73fa8390 100644 (file)
@@ -1,2 +1,2 @@
-The debian packaging exists in the top-level "debian" directory within
-this source-code respository.
+The Debian packaging exists in the top-level "debian" directory within
+this source-code repository.
index b6859eacc7f87c70cae3f2bb320e48158d146af3..de492a7c3fd5a84c7c8e25852fa2427c2f92e4d1 100644 (file)
@@ -1,4 +1,4 @@
-# See Makfefile.local for the list of files to be compiled in this
+# See Makefile.local for the list of files to be compiled in this
 # directory.
 all:
        $(MAKE) -C .. all
index 07da480be5f758a2b043d7ce6c1b44b25486c466..f9ac6073d97b4739c80b8ba5ec6da00a88d0e154 100644 (file)
@@ -41,6 +41,15 @@ The following command-line options are available when running tests:
        As the names depend on the tests' file names, it is safe to
        run the tests with this option in parallel.
 
+--root=<dir>::
+       This runs the testsuites specified under a seperate directory.
+       However, caution is advised, as not all tests are maintained
+       with this relocation in mind, so some tests may behave
+       differently.
+
+       Pointing this argument at a tmpfs filesystem can improve the
+       speed of the test suite for some users.
+
 When invoking the test suite via "make test" any of the above options
 can be specified as follows:
 
@@ -147,11 +156,18 @@ library for your script to use.
    will generate a failure and print the difference of the two
    strings.
 
+ test_expect_equal_file <output> <expected>
+
+   Identical to test_exepect_equal, except that <output> and
+   <expected> are files instead of strings.  This is a much more
+   robust method to compare formatted textual information, since it
+   also notices whitespace and closing newline differences.
+
  test_expect_equal_failure <output> <expected>
 
    This works similar to test_expect_equal (see above) but is used to
    mark a test that demonstrates a known breakage, (that is, the
-   author of the test expectes "output" and "expected" to differ until
+   author of the test expects "output" and "expected" to differ until
    the breakage is fixed). See test_expect_failure for details.
 
  test_debug <script>
@@ -181,7 +197,7 @@ writing tests:
   generate_message
 
     Generates a message with an optional template. Most tests will
-    actually prefere to call add_message. See below.
+    actually prefer to call add_message. See below.
 
   add_message
 
@@ -197,6 +213,6 @@ writing tests:
 
     This function should be called at the beginning of a test file
     when a test needs to operate on a non-empty body of messages. It
-    will intialize the mail database to a known state of 50 sample
+    will initialize the mail database to a known state of 50 sample
     messages, (culled from the early history of the notmuch mailing
     list).
index d6e8c100d083b91b6719930344e2c6c7547c3051..33bf711339b96614555818c873ae126f799dcbef 100755 (executable)
@@ -51,9 +51,9 @@ test_expect_code 2 'failure to clean up causes the test to fail' '
 
 # Ensure that all tests are being run
 test_begin_subtest 'Ensure that all available tests will be run by notmuch-test'
-eval $(sed -n -e '/^TESTS="$/,/^"$/p' notmuch-test ../notmuch-test)
+eval $(sed -n -e '/^TESTS="$/,/^"$/p' notmuch-test $TEST_DIRECTORY/notmuch-test)
 tests_in_suite=$(for i in $TESTS; do echo $i; done | sort)
-available=$(ls -1 ../ | \
+available=$(ls -1 $TEST_DIRECTORY/ | \
     sed -r -e "/^(aggregate-results.sh|Makefile|Makefile.local|notmuch-test)/d" \
           -e "/^(README|test-lib.sh|test-lib.el|test-results|tmp.*|valgrind|corpus*)/d" \
           -e "/^(emacs.expected-output|smtp-dummy|smtp-dummy.c|test-verbose|symbol-test.cc)/d" \
@@ -63,19 +63,19 @@ available=$(ls -1 ../ | \
           | sort)
 test_expect_equal "$tests_in_suite" "$available"
 
-EXPECTED=../test.expected-output
+EXPECTED=$TEST_DIRECTORY/test.expected-output
 suppress_diff_date() {
     sed -e 's/\(.*\-\-\- test-verbose\.4\.\expected\).*/\1/' \
        -e 's/\(.*\+\+\+ test-verbose\.4\.\output\).*/\1/'
 }
 
 test_begin_subtest "Ensure that test output is suppressed unless the test fails"
-output=$(cd ..; ./test-verbose 2>&1 | suppress_diff_date)
+output=$(cd $TEST_DIRECTORY; ./test-verbose 2>&1 | suppress_diff_date)
 expected=$(cat $EXPECTED/test-verbose-no | suppress_diff_date)
 test_expect_equal "$output" "$expected"
 
 test_begin_subtest "Ensure that -v does not suppress test output"
-output=$(cd ..; ./test-verbose -v 2>&1 | suppress_diff_date)
+output=$(cd $TEST_DIRECTORY; ./test-verbose -v 2>&1 | suppress_diff_date)
 expected=$(cat $EXPECTED/test-verbose-yes | suppress_diff_date)
 # Do not include the results of test-verbose in totals
 rm $TEST_DIRECTORY/test-results/test-verbose-*
diff --git a/test/corpus/cur/51:2, b/test/corpus/cur/51:2,
new file mode 100644 (file)
index 0000000..f522f69
--- /dev/null
@@ -0,0 +1,12 @@
+From: "Aron Griffis" <agriffis@n01se.net>
+To: notmuch@notmuchmail.org
+Date: Tue, 17 Nov 2009 18:21:38 -0500
+Subject: [notmuch] archive
+Message-ID: <20091117232137.GA7669@griffis1.net>
+
+Just subscribed, I'd like to catch up on the previous postings,
+but the archive link seems to be bogus?
+
+Thanks,
+Aron
+
index 8e92016747e427c3a31fc0fcea073526b61d0a8b..b49a4e0560177385a1025de93356a113faf80436 100755 (executable)
@@ -12,7 +12,7 @@ add_gnupg_home ()
     local output
     [ -d ${GNUPGHOME} ] && return
     mkdir -m 0700 "$GNUPGHOME"
-    gpg --no-tty --import <../gnupg-secret-key.asc >"$GNUPGHOME"/import.log 2>&1
+    gpg --no-tty --import <$TEST_DIRECTORY/gnupg-secret-key.asc >"$GNUPGHOME"/import.log 2>&1
     test_debug "cat $GNUPGHOME/import.log"
     if (gpg --quick-random --version >/dev/null 2>&1) ; then
        echo quick-random >> "$GNUPGHOME"/gpg.conf
@@ -168,8 +168,7 @@ Non-text part: application/pgp-encrypted
 \fpart{ ID: 4, Content-type: text/plain
 This is a test encrypted message.
 \fpart}
-\fattachment{ ID: 5, Content-type: application/octet-stream
-Attachment: TESTATTACHMENT (application/octet-stream)
+\fattachment{ ID: 5, Filename: TESTATTACHMENT, Content-type: application/octet-stream
 Non-text part: application/octet-stream
 \fattachment}
 \fpart}
@@ -318,7 +317,7 @@ test_expect_equal \
     "$expected"
 
 test_begin_subtest "signature verification with revoked key"
-# generate revokation certificate and load it to revoke key
+# generate revocation certificate and load it to revoke key
 echo "y
 1
 Notmuch Test Suite key revocation (automated) $(date '+%F_%T%z')
index 6f82b08e50b7bea4e9073ac8c4564d943dde9123..53f455a34b641dbd8e51610dffbb365e0602a631 100755 (executable)
 #!/usr/bin/env bash
+
+# Note: do not use `setq' for setting variables in Emacs tests because
+# it affects other tests that may run in the same Emacs instance.  Use
+# `let' instead so the scope of the changed variables is limited to a
+# single test.
+
 test_description="emacs interface"
 . test-lib.sh
 
-EXPECTED=../emacs.expected-output
+EXPECTED=$TEST_DIRECTORY/emacs.expected-output
 
 add_email_corpus
 
 test_begin_subtest "Basic notmuch-hello view in emacs"
-test_emacs '(notmuch-hello) (princ (buffer-string))' >OUTPUT
+test_emacs '(notmuch-hello)
+           (test-output)'
 test_expect_equal_file OUTPUT $EXPECTED/notmuch-hello
 
 test_begin_subtest "Saved search with 0 results"
-test_emacs '(setq notmuch-show-empty-saved-searches t) (setq notmuch-saved-searches '\''(("inbox" . "tag:inbox") ("unread" . "tag:unread") ("empty" . "tag:doesnotexist"))) (notmuch-hello) (princ (buffer-string))' >OUTPUT
+test_emacs '(let ((notmuch-show-empty-saved-searches t)
+                 (notmuch-saved-searches
+                  '\''(("inbox" . "tag:inbox")
+                       ("unread" . "tag:unread")
+                       ("empty" . "tag:doesnotexist"))))
+             (notmuch-hello)
+             (test-output))'
 test_expect_equal_file OUTPUT $EXPECTED/notmuch-hello-with-empty
 
 test_begin_subtest "No saved searches displayed (all with 0 results)"
-test_emacs '(setq notmuch-saved-searches '\''(("empty" . "tag:doesnotexist"))) (notmuch-hello) (princ (buffer-string))' >OUTPUT
+test_emacs '(let ((notmuch-saved-searches
+                  '\''(("empty" . "tag:doesnotexist"))))
+             (notmuch-hello)
+             (test-output))'
 test_expect_equal_file OUTPUT $EXPECTED/notmuch-hello-no-saved-searches
 
 test_begin_subtest "Basic notmuch-search view in emacs"
-test_emacs '(notmuch-search "tag:inbox") (notmuch-test-wait) (princ (buffer-string))' >OUTPUT
+test_emacs '(notmuch-search "tag:inbox")
+           (notmuch-test-wait)
+           (test-output)'
 test_expect_equal_file OUTPUT $EXPECTED/notmuch-search-tag-inbox
 
 test_begin_subtest "Navigation of notmuch-hello to search results"
-test_emacs '(notmuch-hello) (goto-char (point-min)) (re-search-forward "inbox") (widget-button-press (point)) (notmuch-test-wait) (princ (buffer-string))' >OUTPUT
+test_emacs '(notmuch-hello)
+           (goto-char (point-min))
+           (re-search-forward "inbox")
+           (widget-button-press (point))
+           (notmuch-test-wait)
+           (test-output)'
 test_expect_equal_file OUTPUT $EXPECTED/notmuch-hello-view-inbox
 
 test_begin_subtest "Basic notmuch-show view in emacs"
 maildir_storage_thread=$(notmuch search --output=threads id:20091117190054.GU3165@dottiness.seas.harvard.edu)
-test_emacs "(notmuch-show \"$maildir_storage_thread\") (princ (buffer-string))" >OUTPUT
+test_emacs "(notmuch-show \"$maildir_storage_thread\")
+           (test-output)"
 test_expect_equal_file OUTPUT $EXPECTED/notmuch-show-thread-maildir-storage
 
 test_begin_subtest "notmuch-show for message with invalid From"
-add_message "[subject]=\"message-with-invalid-from\"" "[from]=\"\\\"Invalid \\\" From\\\" <test_suite@notmuchmail.org>\""
+add_message "[subject]=\"message-with-invalid-from\"" \
+           "[from]=\"\\\"Invalid \\\" From\\\" <test_suite@notmuchmail.org>\""
 thread=$(notmuch search --output=threads subject:message-with-invalid-from)
-output=$(test_emacs "(notmuch-show \"$thread\") (princ (buffer-string))")
-test_expect_equal "$output" \
-'"Invalid " From" <test_suite@notmuchmail.org> (2001-01-05) (inbox)
+test_emacs "(notmuch-show \"$thread\")
+           (test-output)"
+cat <<EOF >EXPECTED
+"Invalid " From" <test_suite@notmuchmail.org> (2001-01-05) (inbox)
 Subject: message-with-invalid-from
 To: Notmuch Test Suite <test_suite@notmuchmail.org>
 Date: Tue, 05 Jan 2001 15:43:57 -0000
 
-This is just a test message (#1)'
+This is just a test message (#1)
+EOF
+test_expect_equal_file OUTPUT EXPECTED
 
 test_begin_subtest "Navigation of notmuch-search to thread view"
-test_emacs '(notmuch-search "tag:inbox") (notmuch-test-wait) (goto-char (point-min)) (re-search-forward "Working with Maildir") (notmuch-search-show-thread) (notmuch-test-wait) (princ (buffer-string))' >OUTPUT
+test_emacs '(notmuch-search "tag:inbox")
+           (notmuch-test-wait)
+           (goto-char (point-min))
+           (re-search-forward "Working with Maildir")
+           (notmuch-search-show-thread)
+           (notmuch-test-wait)
+           (test-output)'
 test_expect_equal_file OUTPUT $EXPECTED/notmuch-show-thread-maildir-storage
 
 test_begin_subtest "Add tag from search view"
 os_x_darwin_thread=$(notmuch search --output=threads id:ddd65cda0911171950o4eea4389v86de9525e46052d3@mail.gmail.com)
-test_emacs "(notmuch-search \"$os_x_darwin_thread\") (notmuch-test-wait) (notmuch-search-add-tag \"tag-from-search-view\")"
+test_emacs "(notmuch-search \"$os_x_darwin_thread\")
+           (notmuch-test-wait)
+           (notmuch-search-add-tag \"tag-from-search-view\")"
 output=$(notmuch search $os_x_darwin_thread | notmuch_search_sanitize)
 test_expect_equal "$output" "thread:XXX   2009-11-18 [4/4] Jjgod Jiang, Alexander Botero-Lowry; [notmuch] Mac OS X/Darwin compatibility issues (inbox tag-from-search-view unread)"
 
 test_begin_subtest "Remove tag from search view"
-test_emacs "(notmuch-search \"$os_x_darwin_thread\") (notmuch-test-wait) (notmuch-search-remove-tag \"tag-from-search-view\")"
+test_emacs "(notmuch-search \"$os_x_darwin_thread\")
+           (notmuch-test-wait)
+           (notmuch-search-remove-tag \"tag-from-search-view\")"
 output=$(notmuch search $os_x_darwin_thread | notmuch_search_sanitize)
 test_expect_equal "$output" "thread:XXX   2009-11-18 [4/4] Jjgod Jiang, Alexander Botero-Lowry; [notmuch] Mac OS X/Darwin compatibility issues (inbox unread)"
 
 test_begin_subtest "Add tag from notmuch-show view"
-test_emacs "(notmuch-show \"$os_x_darwin_thread\") (notmuch-show-add-tag \"tag-from-show-view\")"
+test_emacs "(notmuch-show \"$os_x_darwin_thread\")
+           (notmuch-show-add-tag \"tag-from-show-view\")"
 output=$(notmuch search $os_x_darwin_thread | notmuch_search_sanitize)
 test_expect_equal "$output" "thread:XXX   2009-11-18 [4/4] Jjgod Jiang, Alexander Botero-Lowry; [notmuch] Mac OS X/Darwin compatibility issues (inbox tag-from-show-view unread)"
 
 test_begin_subtest "Remove tag from notmuch-show view"
-test_emacs "(notmuch-show \"$os_x_darwin_thread\") (notmuch-show-remove-tag \"tag-from-show-view\")"
+test_emacs "(notmuch-show \"$os_x_darwin_thread\")
+           (notmuch-show-remove-tag \"tag-from-show-view\")"
 output=$(notmuch search $os_x_darwin_thread | notmuch_search_sanitize)
 test_expect_equal "$output" "thread:XXX   2009-11-18 [4/4] Jjgod Jiang, Alexander Botero-Lowry; [notmuch] Mac OS X/Darwin compatibility issues (inbox unread)"
 
 test_begin_subtest "Message with .. in Message-Id:"
 add_message [id]=123..456@example '[subject]="Message with .. in Message-Id"'
-test_emacs '(notmuch-search "id:\"123..456@example\"") (notmuch-test-wait) (notmuch-search-add-tag "search-add") (notmuch-search-add-tag "search-remove") (notmuch-search-remove-tag "search-remove") (notmuch-show "id:\"123..456@example\"") (notmuch-test-wait) (notmuch-show-add-tag "show-add") (notmuch-show-add-tag "show-remove") (notmuch-show-remove-tag "show-remove")'
+test_emacs '(notmuch-search "id:\"123..456@example\"")
+           (notmuch-test-wait)
+           (notmuch-search-add-tag "search-add")
+           (notmuch-search-add-tag "search-remove")
+           (notmuch-search-remove-tag "search-remove")
+           (notmuch-show "id:\"123..456@example\"")
+           (notmuch-test-wait)
+           (notmuch-show-add-tag "show-add")
+           (notmuch-show-add-tag "show-remove")
+           (notmuch-show-remove-tag "show-remove")'
 output=$(notmuch search 'id:"123..456@example"' | notmuch_search_sanitize)
 test_expect_equal "$output" "thread:XXX   2001-01-05 [1/1] Notmuch Test Suite; Message with .. in Message-Id (inbox search-add show-add)"
 
 test_begin_subtest "Sending a message via (fake) SMTP"
-
-# Before we can send a message, we have to prepare the FCC maildir
-mkdir -p mail/sent/cur
-mkdir -p mail/sent/new
-mkdir -p mail/sent/tmp
-
-../smtp-dummy sent_message &
-smtp_dummy_pid=$!
-test_emacs "(setq message-send-mail-function 'message-smtpmail-send-it) (setq smtpmail-smtp-server \"localhost\") (setq smtpmail-smtp-service \"25025\") (notmuch-hello) (notmuch-mua-mail) (message-goto-to) (insert \"user@example.com\nDate: Fri, 29 Mar 1974 10:00:00 -0000\") (message-goto-subject) (insert \"Testing message sent via SMTP\") (message-goto-body) (insert \"This is a test that messages are sent via SMTP\") (message-send-and-exit)" >/dev/null 2>&1
-wait ${smtp_dummy_pid}
-
+emacs_deliver_message \
+    'Testing message sent via SMTP' \
+    'This is a test that messages are sent via SMTP' \
+    '(message-goto-to)
+     (kill-whole-line)
+     (insert "To: user@example.com\n")'
 sed \
     -e s',^User-Agent: Notmuch/.* Emacs/.*,User-Agent: Notmuch/XXX Emacs/XXX,' \
     -e s',^Message-ID: <.*>$,Message-ID: <XXX>,' < sent_message >OUTPUT
@@ -93,7 +137,7 @@ cat <<EOF >EXPECTED
 From: Notmuch Test Suite <test_suite@notmuchmail.org>
 To: user@example.com
 Subject: Testing message sent via SMTP
-Date: Fri, 29 Mar 1974 10:00:00 -0000
+Date: 01 Jan 2000 12:00:00 -0000
 User-Agent: Notmuch/XXX Emacs/XXX
 Message-ID: <XXX>
 MIME-Version: 1.0
@@ -106,10 +150,12 @@ test_expect_equal_file OUTPUT EXPECTED
 test_begin_subtest "Verify that sent messages are saved/searchable (via FCC)"
 notmuch new > /dev/null
 output=$(notmuch search 'subject:"testing message sent via SMTP"' | notmuch_search_sanitize)
-test_expect_equal "$output" "thread:XXX   1974-03-29 [1/1] Notmuch Test Suite; Testing message sent via SMTP (inbox)"
+test_expect_equal "$output" "thread:XXX   2000-01-01 [1/1] Notmuch Test Suite; Testing message sent via SMTP (inbox)"
 
 test_begin_subtest "notmuch-fcc-dirs set to nil"
-test_emacs "(setq notmuch-fcc-dirs nil) (notmuch-mua-mail) (princ (buffer-string))" > OUTPUT
+test_emacs "(let ((notmuch-fcc-dirs nil))
+             (notmuch-mua-mail)
+             (test-output))"
 cat <<EOF >EXPECTED
 From: Notmuch Test Suite <test_suite@notmuchmail.org>
 To: 
@@ -124,7 +170,9 @@ mkdir -p mail/sent-string/new
 mkdir -p mail/sent-string/tmp
 
 test_begin_subtest "notmuch-fcc-dirs set to a string"
-test_emacs "(setq notmuch-fcc-dirs \"sent-string\") (notmuch-mua-mail) (princ (buffer-string))" > OUTPUT
+test_emacs "(let ((notmuch-fcc-dirs \"sent-string\"))
+             (notmuch-mua-mail)
+             (test-output))"
 cat <<EOF >EXPECTED
 From: Notmuch Test Suite <test_suite@notmuchmail.org>
 To: 
@@ -143,7 +191,11 @@ mkdir -p mail/failure/new
 mkdir -p mail/failure/tmp
 
 test_begin_subtest "notmuch-fcc-dirs set to a list (with match)"
-test_emacs "(setq notmuch-fcc-dirs '((\"notmuchmail.org\" . \"sent-list-match\") (\".*\" . \"failure\"))) (notmuch-mua-mail) (princ (buffer-string))" > OUTPUT
+test_emacs "(let ((notmuch-fcc-dirs
+                  '((\"notmuchmail.org\" . \"sent-list-match\")
+                    (\".*\" . \"failure\"))))
+             (notmuch-mua-mail)
+             (test-output))"
 cat <<EOF >EXPECTED
 From: Notmuch Test Suite <test_suite@notmuchmail.org>
 To: 
@@ -159,7 +211,11 @@ mkdir -p mail/sent-list-catch-all/new
 mkdir -p mail/sent-list-catch-all/tmp
  
 test_begin_subtest "notmuch-fcc-dirs set to a list (catch-all)"
-test_emacs "(setq notmuch-fcc-dirs '((\"example.com\" . \"failure\") (\".*\" . \"sent-list-catch-all\"))) (notmuch-mua-mail) (princ (buffer-string))" > OUTPUT
+test_emacs "(let ((notmuch-fcc-dirs
+                  '((\"example.com\" . \"failure\")
+                    (\".*\" . \"sent-list-catch-all\"))))
+             (notmuch-mua-mail)
+             (test-output))"
 cat <<EOF >EXPECTED
 From: Notmuch Test Suite <test_suite@notmuchmail.org>
 To: 
@@ -170,7 +226,11 @@ EOF
 test_expect_equal_file OUTPUT EXPECTED
 
 test_begin_subtest "notmuch-fcc-dirs set to a list (no match)"
-test_emacs "(setq notmuch-fcc-dirs '((\"example.com\" . \"failure\") (\"nomatchhere.net\" . \"failure\"))) (notmuch-mua-mail) (princ (buffer-string))" > OUTPUT
+test_emacs "(let ((notmuch-fcc-dirs
+                  '((\"example.com\" . \"failure\")
+                    (\"nomatchhere.net\" . \"failure\"))))
+             (notmuch-mua-mail)
+             (test-output))"
 cat <<EOF >EXPECTED
 From: Notmuch Test Suite <test_suite@notmuchmail.org>
 To: 
@@ -180,9 +240,11 @@ EOF
 test_expect_equal_file OUTPUT EXPECTED
 
 test_begin_subtest "Reply within emacs"
-# We sed away everything before the ^From in the output to avoid getting
-# confused by messages such as "Parsing /home/cworth/.mailrc... done"
-test_emacs '(notmuch-search "subject:\"testing message sent via SMTP\"") (notmuch-test-wait) (notmuch-search-reply-to-thread) (princ (buffer-string))' | sed -ne '/^From/,$ p' | sed -e 's/^In-Reply-To: <.*>$/In-Reply-To: <XXX>/' >OUTPUT
+test_emacs '(notmuch-search "subject:\"testing message sent via SMTP\"")
+           (notmuch-test-wait)
+           (notmuch-search-reply-to-thread)
+           (test-output)'
+sed -i -e 's/^In-Reply-To: <.*>$/In-Reply-To: <XXX>/' OUTPUT
 cat <<EOF >EXPECTED
 From: Notmuch Test Suite <test_suite@notmuchmail.org>
 To: user@example.com
@@ -190,24 +252,28 @@ Subject: Re: Testing message sent via SMTP
 In-Reply-To: <XXX>
 Fcc: $(pwd)/mail/sent
 --text follows this line--
-On Fri, 29 Mar 1974 10:00:00 -0000, Notmuch Test Suite <test_suite@notmuchmail.org> wrote:
+On 01 Jan 2000 12:00:00 -0000, Notmuch Test Suite <test_suite@notmuchmail.org> wrote:
 > This is a test that messages are sent via SMTP
 EOF
 test_expect_equal_file OUTPUT EXPECTED
 
 test_begin_subtest "Save attachment from within emacs using notmuch-show-save-attachments"
 # save as archive to test that Emacs does not re-compress .gz
-echo ./attachment1.gz | test_emacs '(notmuch-show "id:cf0c4d610911171136h1713aa59w9cf9aa31f052ad0a@mail.gmail.com") (notmuch-show-save-attachments)' > /dev/null 2>&1
-test_expect_equal_file "$EXPECTED/attachment" attachment1.gz
+test_emacs '(let ((standard-input "\"attachment1.gz\""))
+             (notmuch-show "id:cf0c4d610911171136h1713aa59w9cf9aa31f052ad0a@mail.gmail.com")
+             (notmuch-show-save-attachments))' > /dev/null 2>&1
+test_expect_equal_file attachment1.gz "$EXPECTED/attachment"
 
 test_begin_subtest "Save attachment from within emacs using notmuch-show-save-part"
 # save as archive to test that Emacs does not re-compress .gz
-echo ./attachment2.gz | test_emacs '(notmuch-show-save-part "id:cf0c4d610911171136h1713aa59w9cf9aa31f052ad0a@mail.gmail.com" 5)' > /dev/null 2>&1
-test_expect_equal_file "$EXPECTED/attachment" attachment2.gz
+test_emacs '(let ((standard-input "\"attachment2.gz\""))
+             (notmuch-show-save-part "id:cf0c4d610911171136h1713aa59w9cf9aa31f052ad0a@mail.gmail.com" 5))' > /dev/null 2>&1
+test_expect_equal_file attachment2.gz "$EXPECTED/attachment"
 
 test_begin_subtest "View raw message within emacs"
-first_line=$(head -n1 $EXPECTED/raw-message-cf0c4d-52ad0a)
-test_emacs '(notmuch-show "id:cf0c4d610911171136h1713aa59w9cf9aa31f052ad0a@mail.gmail.com") (notmuch-show-view-raw-message) (princ (buffer-string))' | sed -ne "/$first_line/,\$ p" >OUTPUT
+test_emacs '(notmuch-show "id:cf0c4d610911171136h1713aa59w9cf9aa31f052ad0a@mail.gmail.com")
+           (notmuch-show-view-raw-message)
+           (test-output)'
 test_expect_equal_file OUTPUT $EXPECTED/raw-message-cf0c4d-52ad0a
 
 test_begin_subtest "Hiding/showing signature in notmuch-show view"
@@ -217,7 +283,7 @@ test_emacs "(notmuch-show \"$maildir_storage_thread\")
            (button-activate (button-at (point)))
            (search-backward \"Click/Enter to hide.\")
            (button-activate (button-at (point)))
-           (princ (buffer-string))" >OUTPUT
+           (test-output)"
 test_expect_equal_file OUTPUT $EXPECTED/notmuch-show-thread-maildir-storage
 
 test_begin_subtest "Detection and hiding of top-post quoting of message"
@@ -245,7 +311,7 @@ Q: Why is top-posting such a bad thing?
 A: Top-posting.
 Q: What is the most annoying thing in e-mail?"'
 test_emacs "(notmuch-show \"top-posting\")
-           (princ (visible-buffer-string))" >OUTPUT
+           (test-visible-output)"
 echo "Notmuch Test Suite <test_suite@notmuchmail.org> (2001-01-05) (inbox)
 Subject: The problem with top-posting
 To: Notmuch Test Suite <test_suite@notmuchmail.org>
@@ -268,19 +334,17 @@ Thanks for the advice! I will be sure to put it to good use.
 test_expect_equal_file OUTPUT EXPECTED
 
 test_begin_subtest "Hiding message in notmuch-show view"
-output=$(test_emacs '(notmuch-show "id:f35dbb950911171438k5df6eb56k77b6c0944e2e79ae@mail.gmail.com")
-                    (notmuch-show-toggle-message)
-                    (princ (visible-buffer-string))')
-expected=$(cat $EXPECTED/notmuch-show-thread-with-hidden-messages)
-test_expect_equal "$output" "$expected"
+test_emacs '(notmuch-show "id:f35dbb950911171438k5df6eb56k77b6c0944e2e79ae@mail.gmail.com")
+           (notmuch-show-toggle-message)
+           (test-visible-output)'
+test_expect_equal_file OUTPUT $EXPECTED/notmuch-show-thread-with-hidden-messages
 
 test_begin_subtest "Hiding message with visible citation in notmuch-show view"
-output=$(test_emacs '(notmuch-show "id:f35dbb950911171438k5df6eb56k77b6c0944e2e79ae@mail.gmail.com")
-                    (search-forward "Click/Enter to show.")
-                    (button-activate (button-at (point)))
-                    (notmuch-show-toggle-message)
-                    (princ (visible-buffer-string))')
-expected=$(cat $EXPECTED/notmuch-show-thread-with-hidden-messages)
-test_expect_equal "$output" "$expected"
+test_emacs '(notmuch-show "id:f35dbb950911171438k5df6eb56k77b6c0944e2e79ae@mail.gmail.com")
+           (search-forward "Click/Enter to show.")
+           (button-activate (button-at (point)))
+           (notmuch-show-toggle-message)
+           (test-visible-output)'
+test_expect_equal_file OUTPUT $EXPECTED/notmuch-show-thread-with-hidden-messages
 
 test_done
index c78ce334b95ae9ef923111361ff4810e9f82c4ca..6095e9da85bb9399e9b2568e1a87d0da08e94626 100755 (executable)
@@ -19,16 +19,25 @@ done
 notmuch new > /dev/null
 
 test_begin_subtest "Ensure that emacs doesn't drop results"
-expected="$(notmuch search '*' | sed -e 's/^thread:[0-9a-f]*  //' -e 's/;//' -e  's/xx*/[BLOB]/')
-End of search results."
+notmuch search '*' > EXPEXTED
+sed -i -e 's/^thread:[0-9a-f]*  //' -e 's/;//' -e 's/xx*/[BLOB]/' EXPEXTED
+echo 'End of search results.' >> EXPEXTED
 
-output=$(test_emacs '(notmuch-search "*") (notmuch-test-wait) (princ (buffer-string))' | sed -e s',  *, ,g' -e 's/xxx*/[BLOB]/g')
-test_expect_equal "$output" "$expected"
+test_emacs '(notmuch-search "*")
+           (notmuch-test-wait)
+           (test-output)'
+sed -i -e s',  *, ,g' -e 's/xxx*/[BLOB]/g' OUTPUT
+test_expect_equal_file OUTPUT EXPEXTED
 
 test_begin_subtest "Ensure that emacs doesn't drop error messages"
-output=$(test_emacs '(notmuch-search "--this-option-does-not-exist") (notmuch-test-wait) (princ (buffer-string))')
-test_expect_equal "$output" "Error: Unexpected output from notmuch search:
+test_emacs '(notmuch-search "--this-option-does-not-exist")
+           (notmuch-test-wait)
+           (test-output)'
+cat <<EOF >EXPEXTED
+Error: Unexpected output from notmuch search:
 Unrecognized option: --this-option-does-not-exist
-End of search results. (process returned 1)"
+End of search results. (process returned 1)
+EOF
+test_expect_equal_file OUTPUT EXPEXTED
 
 test_done
index 2b43127e9e74ed62f87f00829630384eb284b520..a60854f8f59f311294effaa3690c80bc50703158 100755 (executable)
@@ -23,7 +23,6 @@ output=$(notmuch search subject:"Adding S flag" | notmuch_search_sanitize)
 output+="
 "
 mv "${gen_msg_filename}" "${gen_msg_filename}S"
-increment_mtime "$(dirname "${gen_msg_filename}")"
 output+=$(NOTMUCH_NEW)
 output+="
 "
@@ -66,7 +65,6 @@ test_expect_equal "$output" '[[[{"id": "adding-replied-tag@notmuch-test-suite",
 test_expect_success 'notmuch reply works with renamed file (without notmuch new)' 'notmuch reply id:${gen_msg_id}'
 
 test_begin_subtest "notmuch new detects no file rename after tag->flag synchronization"
-increment_mtime "$(dirname ${gen_msg_filename})"
 output=$(NOTMUCH_NEW)
 test_expect_equal "$output" "No new mail."
 
@@ -77,7 +75,6 @@ output=$(cd "$MAIL_DIR/cur"; ls message-to-move*)
 test_expect_equal "$output" "message-to-move-to-cur:2,S"
 
 test_begin_subtest "No rename should be detected by notmuch new"
-increment_mtime "$MAIL_DIR/cur"
 output=$(NOTMUCH_NEW)
 test_expect_equal "$output" "No new mail."
 # (*) If notmuch new was not run we've got "Processed 1 file in almost
@@ -85,7 +82,7 @@ test_expect_equal "$output" "No new mail."
 # test created directory document in the database but this document
 # was not linked as subdirectory of $MAIL_DIR. Therefore notmuch new
 # could not reach the cur/ directory and its files in it during
-# recurive traversal.
+# recursive traversal.
 #
 # XXX: The above sounds like a bug that should be fixed. If notmuch is
 # creating new directories in the mail store, then it should be
@@ -97,7 +94,6 @@ output=$(notmuch search subject:"Removing S flag" | notmuch_search_sanitize)
 output+="
 "
 mv "${gen_msg_filename}" "${gen_msg_filename%S}"
-increment_mtime "$(dirname "${gen_msg_filename}")"
 output+=$(NOTMUCH_NEW)
 output+="
 "
@@ -110,7 +106,6 @@ test_begin_subtest "Removing info from filename leaves tags unchanged"
 add_message [subject]='"Message to lose maildir info"' [filename]='message-to-lose-maildir-info' [dir]=cur
 notmuch tag -unread subject:"Message to lose maildir info"
 mv "$MAIL_DIR/cur/message-to-lose-maildir-info:2,S" "$MAIL_DIR/cur/message-without-maildir-info"
-increment_mtime "$MAIL_DIR/cur"
 output=$(NOTMUCH_NEW)
 output+="
 "
@@ -134,7 +129,6 @@ mv $MAIL_DIR/cur/adding-replied-tag:2,RS $MAIL_DIR/cur/adding-replied-tag:2,S
 mv $MAIL_DIR/cur/adding-s-flag:2,S $MAIL_DIR/cur/adding-s-flag:2,
 mv $MAIL_DIR/cur/adding-with-s-flag:2,S $MAIL_DIR/cur/adding-with-s-flag:2,RS
 mv $MAIL_DIR/cur/message-to-move-to-cur:2,S $MAIL_DIR/cur/message-to-move-to-cur:2,DS
-increment_mtime $MAIL_DIR/cur
 notmuch dump dump.txt
 NOTMUCH_NEW >/dev/null
 notmuch restore dump.txt
@@ -144,7 +138,6 @@ test_expect_equal "$output" "$expected"
 test_begin_subtest 'Adding flags to duplicate message tags the mail'
 add_message [subject]='"Duplicated message"' [dir]=cur [filename]='duplicated-message:2,'
 cp "$MAIL_DIR/cur/duplicated-message:2," "$MAIL_DIR/cur/duplicated-message-copy:2,RS"
-increment_mtime $MAIL_DIR/cur
 NOTMUCH_NEW > output
 notmuch search subject:"Duplicated message" | notmuch_search_sanitize >> output
 test_expect_equal "$(< output)" "No new mail.
@@ -152,7 +145,6 @@ thread:XXX   2001-01-05 [1/1] Notmuch Test Suite; Duplicated message (inbox repl
 
 test_begin_subtest "Adding duplicate message without flags does not remove tags"
 cp "$MAIL_DIR/cur/duplicated-message-copy:2,RS" "$MAIL_DIR/cur/duplicated-message-another-copy:2,"
-increment_mtime $MAIL_DIR/cur
 NOTMUCH_NEW > output
 notmuch search subject:"Duplicated message" | notmuch_search_sanitize >> output
 test_expect_equal "$(< output)" "No new mail.
index 0879696e4ca159ae9efefab2a3a02102ba1da996..22c42c6aefc73b8bcda59831bbf2f0f8c615367f 100755 (executable)
@@ -88,7 +88,6 @@ Content-Transfer-Encoding: base64
 7w0K
 --==-=-=--
 EOF
-increment_mtime "$MAIL_DIR"
 notmuch new > /dev/null
 
 test_begin_subtest "--format=text --part=0, full message"
@@ -110,8 +109,7 @@ Date: Tue, 05 Jan 2001 15:43:57 -0000
 Non-text part: text/html
 \fpart}
 \fpart}
-\fattachment{ ID: 5, Content-type: text/plain
-Attachment: attachment (text/plain)
+\fattachment{ ID: 5, Filename: attachment, Content-type: text/plain
 This is a text attachment.
 \fattachment}
 \fpart{ ID: 6, Content-type: text/plain
@@ -148,8 +146,7 @@ Date: Tue, 05 Jan 2001 15:43:57 -0000
 Non-text part: text/html
 \fpart}
 \fpart}
-\fattachment{ ID: 5, Content-type: text/plain
-Attachment: attachment (text/plain)
+\fattachment{ ID: 5, Filename: attachment, Content-type: text/plain
 This is a text attachment.
 \fattachment}
 \fpart{ ID: 6, Content-type: text/plain
@@ -176,8 +173,7 @@ cat <<EOF >EXPECTED
 Non-text part: text/html
 \fpart}
 \fpart}
-\fattachment{ ID: 5, Content-type: text/plain
-Attachment: attachment (text/plain)
+\fattachment{ ID: 5, Filename: attachment, Content-type: text/plain
 This is a text attachment.
 \fattachment}
 \fpart{ ID: 6, Content-type: text/plain
@@ -209,11 +205,10 @@ Non-text part: text/html
 EOF
 test_expect_equal_file OUTPUT EXPECTED
 
-test_begin_subtest "--format=text --part=5, inline attachement"
+test_begin_subtest "--format=text --part=5, inline attachment"
 notmuch show --format=text --part=5 'id:87liy5ap00.fsf@yoom.home.cworth.org' >OUTPUT
 cat <<EOF >EXPECTED
-\fattachment{ ID: 5, Content-type: text/plain
-Attachment: attachment (text/plain)
+\fattachment{ ID: 5, Filename: attachment, Content-type: text/plain
 This is a text attachment.
 \fattachment}
 EOF
index 1b7296e89a2e08a22d6a78603096a6e8d582d921..49f390d61b4a71bf81470f212983ef985f2bdc31 100755 (executable)
--- a/test/new
+++ b/test/new
@@ -52,10 +52,8 @@ generate_message
 tmp_msg_filename=tmp/"$gen_msg_filename"
 mkdir -p "$(dirname "$tmp_msg_filename")"
 mv "$gen_msg_filename" "$tmp_msg_filename"
-increment_mtime "${MAIL_DIR}"
 notmuch new > /dev/null
 mv "$tmp_msg_filename" "$gen_msg_filename"
-increment_mtime "${MAIL_DIR}"
 output=$(NOTMUCH_NEW)
 test_expect_equal "$output" "Added 1 new message to the database."
 
@@ -65,7 +63,6 @@ test_begin_subtest "Renamed message"
 generate_message
 notmuch new > /dev/null
 mv "$gen_msg_filename" "${gen_msg_filename}"-renamed
-increment_mtime "${MAIL_DIR}"
 output=$(NOTMUCH_NEW)
 test_expect_equal "$output" "No new mail. Detected 1 file rename."
 
@@ -73,7 +70,6 @@ test_expect_equal "$output" "No new mail. Detected 1 file rename."
 test_begin_subtest "Deleted message"
 
 rm "${gen_msg_filename}"-renamed
-increment_mtime "${MAIL_DIR}"
 output=$(NOTMUCH_NEW)
 test_expect_equal "$output" "No new mail. Removed 1 message."
 
@@ -87,7 +83,6 @@ generate_message [dir]=dir
 notmuch new > /dev/null
 
 mv "${MAIL_DIR}"/dir "${MAIL_DIR}"/dir-renamed
-increment_mtime "${MAIL_DIR}"
 
 output=$(NOTMUCH_NEW)
 test_expect_equal "$output" "No new mail. Detected 3 file renames."
@@ -96,7 +91,6 @@ test_expect_equal "$output" "No new mail. Detected 3 file renames."
 test_begin_subtest "Deleted directory"
 
 rm -rf "${MAIL_DIR}"/dir-renamed
-increment_mtime "${MAIL_DIR}"
 
 output=$(NOTMUCH_NEW)
 test_expect_equal "$output" "No new mail. Removed 3 messages."
@@ -115,7 +109,6 @@ test_expect_equal "$output" "Added 3 new messages to the database."
 test_begin_subtest "Deleted directory (end of list)"
 
 rm -rf "${MAIL_DIR}"/zzz
-increment_mtime "${MAIL_DIR}"
 
 output=$(NOTMUCH_NEW)
 test_expect_equal "$output" "No new mail. Removed 3 messages."
@@ -139,7 +132,6 @@ external_msg_filename="$PWD"/external/"$(basename "$gen_msg_filename")"
 mkdir -p "$(dirname "$external_msg_filename")"
 mv "$gen_msg_filename" "$external_msg_filename"
 ln -s "$external_msg_filename" "$gen_msg_filename"
-increment_mtime "${MAIL_DIR}"
 output=$(NOTMUCH_NEW)
 test_expect_equal "$output" "Added 1 new message to the database."
 
@@ -157,7 +149,6 @@ test_expect_equal "$output" "Added 3 new messages to the database."
 test_begin_subtest "Deleted two-level directory"
 
 rm -rf "${MAIL_DIR}"/two
-increment_mtime "${MAIL_DIR}"
 
 output=$(NOTMUCH_NEW)
 test_expect_equal "$output" "No new mail. Removed 3 messages."
index 4afa483d157ba7028b856d2580379b46c228111a..5cc2ca8d388a651610ad9d995227fb5e94ebb106 100755 (executable)
@@ -23,14 +23,12 @@ test_expect_equal "$output" "thread:XXX   2001-01-05 [1/1] Notmuch Test Suite; B
 
 test_begin_subtest "After removing duplicate instance of matching path"
 rm -r "${MAIL_DIR}/bad/news"
-increment_mtime "${MAIL_DIR}/bad"
 notmuch new
 output=$(notmuch search folder:bad/news | notmuch_search_sanitize)
 test_expect_equal "$output" "thread:XXX   2001-01-05 [1/1] Notmuch Test Suite; Bears (inbox unread)"
 
 test_begin_subtest "After rename, old path returns nothing"
 mv "${MAIL_DIR}/duplicate/bad/news" "${MAIL_DIR}/duplicate/bad/olds"
-increment_mtime "${MAIL_DIR}/duplicate/bad"
 notmuch new
 output=$(notmuch search folder:bad/news | notmuch_search_sanitize)
 test_expect_equal "$output" ""
index 9c312542a33283f3e6c75c4298907f95992da1c8..f8119cbb4d99be909045e1ddfab500e6813c1940 100755 (executable)
@@ -36,7 +36,6 @@ test_expect_equal "$output" "thread:0000000000000001   2001-01-05 [1/1] Notmuch
 
 test_begin_subtest "Remove folder:spam copy of email"
 rm $dir/spam/$(basename $file_x)
-increment_mtime $dir/spam
 output=$(NOTMUCH_NEW)
 test_expect_equal "$output" "No new mail. Detected 1 file rename."
 
index 3c875cd122a22e5d3fcd3d48dde358ecc26e83d9..10291c3b79d8d711c9fa8206fea601235eed61c2 100755 (executable)
@@ -207,6 +207,7 @@ MAIL_DIR/cur/22:2,
 MAIL_DIR/cur/21:2,
 MAIL_DIR/cur/19:2,
 MAIL_DIR/cur/18:2,
+MAIL_DIR/cur/51:2,
 MAIL_DIR/cur/20:2,
 MAIL_DIR/cur/17:2,
 MAIL_DIR/cur/16:2,
@@ -263,6 +264,7 @@ cat <<EOF >EXPECTED
 "MAIL_DIR/cur/21:2,",
 "MAIL_DIR/cur/19:2,",
 "MAIL_DIR/cur/18:2,",
+"MAIL_DIR/cur/51:2,",
 "MAIL_DIR/cur/20:2,",
 "MAIL_DIR/cur/17:2,",
 "MAIL_DIR/cur/16:2,",
index bb5552450ffebb8bd1ab66fd31bb6f93278aafa6..d0b31aec115ce83b92f37b4fc3e161d9601cadb0 100755 (executable)
@@ -12,13 +12,13 @@ test_description='exception symbol hiding'
 . ./test-lib.sh
 
 run_test(){
-    result=$(LD_LIBRARY_PATH=../../lib ./symbol-test 2>&1)
+    result=$(LD_LIBRARY_PATH=$TEST_DIRECTORY/../lib ./symbol-test 2>&1)
 }
 
 output="A Xapian exception occurred opening database: Couldn't stat 'fakedb/.notmuch/xapian'
 caught No chert database found at path \`./nonexistant'"
 
-g++ -o symbol-test -I../../lib ../symbol-test.cc -L../../lib -lnotmuch -lxapian
+g++ -o symbol-test -I$TEST_DIRECTORY/../lib $TEST_DIRECTORY/symbol-test.cc -L$TEST_DIRECTORY/../lib -lnotmuch -lxapian
 mkdir -p fakedb/.notmuch
 test_expect_success 'running test' run_test
 test_begin_subtest 'checking output'
index 943999622d927265357a984efce409e5a883b3ba..a78393684c4e4b308f3e822e6eae1c593ebfb89a 100644 (file)
 ;;
 ;; Authors: Dmitry Kurochkin <dmitry.kurochkin@gmail.com>
 
+;; avoid crazy 10-column default of --batch
+(set-frame-width (window-frame (get-buffer-window)) 80)
+
+;; `read-file-name' by default uses `completing-read' function to read
+;; user input.  It does not respect `standard-input' variable which we
+;; use in tests to provide user input.  So replace it with a plain
+;; `read' call.
+(setq read-file-name-function (lambda (&rest _) (read)))
+
+(defun notmuch-test-wait ()
+  "Wait for process completion."
+  (while (get-buffer-process (current-buffer))
+    (sleep-for 0.1)))
+
+(defun test-output (&optional filename)
+  "Save current buffer to file FILENAME.  Default FILENAME is OUTPUT."
+  (write-region (point-min) (point-max) (or filename "OUTPUT")))
+
+(defun test-visible-output (&optional filename)
+  "Save visible text in current buffer to file FILENAME.  Default
+FILENAME is OUTPUT."
+  (let ((text (visible-buffer-string)))
+    (with-temp-file (or filename "OUTPUT") (insert text))))
+
 (defun visible-buffer-string ()
   "Same as `buffer-string', but excludes invisible text."
   (visible-buffer-substring (point-min) (point-max)))
          (setq str (concat str (buffer-substring start next-pos))))
        (setq start next-pos)))
     str))
+
+(defun orphan-watchdog (pid)
+  "Periodically check that the process with id PID is still
+running, quit if it terminated."
+  (if (not (process-attributes pid))
+      (kill-emacs)
+    (run-at-time "1 min" nil 'orphan-watchdog pid)))
index a59d1c1363fbc5964bd0946aa8cfbda7b84d64a9..22e387e49d0a8067351de747f8ce2ea90d6f8ceb 100755 (executable)
@@ -213,16 +213,6 @@ remove_cr () {
        tr '\015' Q | sed -e 's/Q$//'
 }
 
-# Notmuch helper functions
-increment_mtime_amount=0
-increment_mtime ()
-{
-    dir="$1"
-
-    increment_mtime_amount=$((increment_mtime_amount + 1))
-    touch -d "+${increment_mtime_amount} seconds" "$dir"
-}
-
 # Generate a new message in the mail directory, with a unique message
 # ID and subject. The message is not added to the index.
 #
@@ -364,9 +354,6 @@ Date: ${template[date]}
 ${additional_headers}
 ${template[body]}
 EOF
-
-    # Ensure that the mtime of the containing directory is updated
-    increment_mtime "$(dirname "${gen_msg_filename}")"
 }
 
 # Generate a new message and add it to the database.
@@ -392,9 +379,22 @@ emacs_deliver_message ()
     shift 2
     # before we can send a message, we have to prepare the FCC maildir
     mkdir -p "$MAIL_DIR"/sent/{cur,new,tmp}
-    ../smtp-dummy sent_message &
+    $TEST_DIRECTORY/smtp-dummy sent_message &
     smtp_dummy_pid=$!
-    test_emacs "(setq message-send-mail-function 'message-smtpmail-send-it) (setq smtpmail-smtp-server \"localhost\") (setq smtpmail-smtp-service \"25025\") (notmuch-hello) (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}\") $@ (message-send-and-exit)" >/dev/null 2>&1
+    test_emacs \
+       "(let ((message-send-mail-function 'message-smtpmail-send-it)
+              (smtpmail-smtp-server \"localhost\")
+              (smtpmail-smtp-service \"25025\"))
+          (notmuch-hello)
+          (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}\")
+          $@
+          (message-send-and-exit))" >/dev/null 2>&1
     wait ${smtp_dummy_pid}
     notmuch new >/dev/null
 }
@@ -408,12 +408,12 @@ emacs_deliver_message ()
 add_email_corpus ()
 {
     rm -rf ${MAIL_DIR}
-    if [ -d ../corpus.mail ]; then
-       cp -a ../corpus.mail ${MAIL_DIR}
+    if [ -d $TEST_DIRECTORY/corpus.mail ]; then
+       cp -a $TEST_DIRECTORY/corpus.mail ${MAIL_DIR}
     else
-       cp -a ../corpus ${MAIL_DIR}
+       cp -a $TEST_DIRECTORY/corpus ${MAIL_DIR}
        notmuch new >/dev/null
-       cp -a ${MAIL_DIR} ../corpus.mail
+       cp -a ${MAIL_DIR} $TEST_DIRECTORY/corpus.mail
     fi
 }
 
@@ -424,7 +424,7 @@ test_begin_subtest ()
        error "bug in test script: Missing test_expect_equal in ${BASH_SOURCE[1]}:${BASH_LINENO[0]}"
     fi
     test_subtest_name="$1"
-    # Remember stdout and stderr file descriptios and redirect test
+    # Remember stdout and stderr file descriptors and redirect test
     # output to the previously prepared file descriptors 3 and 4 (see
     # below)
     if test "$verbose" != "t"; then exec 4>test.output 3>&4; fi
@@ -816,6 +816,8 @@ test_done () {
 
        echo
 
+       [ -n "$EMACS_SERVER" ] && test_emacs '(kill-emacs)'
+
        if [ "$test_failure" = "0" ]; then
            if [ "$test_broken" = "0" ]; then       
                rm -rf "$remove_tmp"
@@ -826,25 +828,17 @@ test_done () {
        fi
 }
 
-test_emacs () {
+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 > run_emacs
+       cat <<EOF >"$TMP_DIRECTORY/run_emacs"
 #!/bin/sh
 export PATH=$PATH
 export NOTMUCH_CONFIG=$NOTMUCH_CONFIG
 
-# We assume that the user will give a command-line argument only if
-# wanting to run in batch mode.
-if [ \$# -gt 0 ]; then
-       BATCH=--batch
-fi
-
 # Here's what we are using here:
 #
-# --batch:             Quit after given commands and print all (messages)
-#
 # --no-init-file       Don't load users ~/.emacs
 #
 # --no-site-file       Don't load the site-wide startup stuff
@@ -852,24 +846,25 @@ fi
 # --directory          Ensure that the local elisp sources are found
 #
 # --load               Force loading of notmuch.el and test-lib.el
-#
-# notmuch-test-wait    Function for tests to use to wait for process completion
-#
-# message-signature    Avoiding appending user's signature on messages
-#
-# set-frame-width      80 columns (avoids crazy 10-column default of --batch)
-
-emacs \$BATCH --no-init-file --no-site-file \
-       --directory ../../emacs --load notmuch.el \
-       --directory .. --load test-lib.el \
-       --eval "(defun notmuch-test-wait ()
-                       (while (get-buffer-process (current-buffer))
-                               (sleep-for 0.1)))" \
-       --eval "(setq message-signature nil)" \
-       --eval "(progn (set-frame-width (window-frame (get-buffer-window)) 80) \$@)"
+
+emacs --no-init-file --no-site-file \
+       --directory "$TEST_DIRECTORY/../emacs" --load notmuch.el \
+       --directory "$TEST_DIRECTORY" --load test-lib.el \
+       "\$@"
 EOF
-       chmod a+x ./run_emacs
-       ./run_emacs "$@"
+       chmod a+x "$TMP_DIRECTORY/run_emacs"
+}
+
+test_emacs () {
+       if [ -z "$EMACS_SERVER" ]; then
+               EMACS_SERVER="notmuch-test-suite-$$"
+               "$TMP_DIRECTORY/run_emacs" \
+                       --daemon \
+                       --eval "(setq server-name \"$EMACS_SERVER\")" \
+                       --eval "(orphan-watchdog $$)" || return
+       fi
+
+       emacsclient --socket-name="$EMACS_SERVER" --eval "(progn $@)"
 }
 
 
@@ -925,11 +920,11 @@ then
                    test ! -d "$symlink_target" &&
                    test "#!" != "$(head -c 2 < "$symlink_target")"
                then
-                       symlink_target=../valgrind.sh
+                       symlink_target=$TEST_DIRECTORY/valgrind.sh
                fi
                case "$base" in
                *.sh|*.perl)
-                       symlink_target=../unprocessed-script
+                       symlink_target=$TEST_DIRECTORY/unprocessed-script
                esac
                # create the link, or replace it if it is out of date
                make_symlink "$symlink_target" "$GIT_VALGRIND/bin/$base" || exit
@@ -997,6 +992,8 @@ primary_email=test_suite@notmuchmail.org
 other_email=test_suite_other@notmuchmail.org;test_suite@otherdomain.org
 EOF
 
+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).
index d0d16bdd224ff6a14101ecc4ed4d31a5267ce3bc..b3e1ac191bba9c8f6d7e60d85b6dc0b5cc3aa8c0 100755 (executable)
@@ -5,11 +5,11 @@ test_description="handling of uuencoded data"
 add_message [subject]=uuencodetest '[date]="Sat, 01 Jan 2000 12:00:00 -0000"' \
 '[body]="This message is used to ensure that notmuch correctly handles a
 message containing a block of uuencoded data. First, we have a marker
-this content beforeuudata . Then we beging the uunencoded data itself:
+this content beforeuudata . Then we begin the uuencoded data itself:
 
 begin 644 bogus-uuencoded-data
 M0123456789012345678901234567890123456789012345678901234567890
-MOBVIOUSLY, THIS IS NOT ANY SORT OF USEFUL UUNECODED DATA.    
+MOBVIOUSLY, THIS IS NOT ANY SORT OF USEFUL UUENCODED DATA.    
 MINSTEAD THIS IS JUST A WAY TO ENSURE THAT THIS BLOCK OF DATA 
 MIS CORRECTLY IGNORED WHEN NOTMUCH CREATES ITS INDEX. SO WE   
 MINCLUDE A DURINGUUDATA MARKER THAT SHOULD NOT RESULT IN ANY  
index 12ad2bb4f1bb3a1229f5537f4df867d5cdb00d56..53f1c4e12acb77ab8f9350a85ccc2cf6e0dc6275 100644 (file)
@@ -7,8 +7,9 @@ Dependencies:
     notmuch:
         Naturally, it expects you have notmuch installed and configured.
 
-    mailx:
-        To send mail, notmuch.vim uses the UNIX mailx command.
+    sendmail:
+        To send mail, notmuch.vim uses sendmail as default.  Most modern MTAs
+        provide a compatibility binary, and so should work well.
 
 
 To install:
@@ -37,7 +38,7 @@ Buffer types:
         You are presented with the search results when you run :NotMuch.
 
         Keybindings:
-            <Space> - show the selected thread colapsing unmatched items
+            <Space> - show the selected thread collapsing unmatched items
             <Enter> - show the entire selected thread
             a       - archive message (remove inbox tag)
             f       - filter the current search terms
index c731c4714da7db18a7d2727e8248b384af7349c6..21985c71a8f8f419dd3fd17d690fcfbff7626323 100644 (file)
@@ -25,7 +25,7 @@
 
 let s:notmuch_defaults = {
         \ 'g:notmuch_cmd':                           'notmuch'                    ,
-        \ 'g:notmuch_sendmail':                      'sendmail'                   ,
+        \ 'g:notmuch_sendmail':                      '/usr/sbin/sendmail'         ,
         \ 'g:notmuch_debug':                         0                            ,
         \
         \ 'g:notmuch_search_newest_first':           1                            ,
@@ -58,7 +58,7 @@ let s:notmuch_defaults = {
         \
         \ 'g:notmuch_compose_insert_mode_start':     1                            ,
         \ 'g:notmuch_compose_header_help':           1                            ,
-        \ 'g:notmuch_compose_temp_file_dir':         '~/.notmuch/compose/'        ,
+        \ 'g:notmuch_compose_temp_file_dir':         '~/.notmuch/compose        ,
         \ }
 
 " defaults for g:notmuch_initial_search_words
@@ -149,7 +149,7 @@ let g:notmuch_show_maps = {
         \ 'b':          ':call <SID>NM_show_fold_toggle(''b'', ''bdy'', !g:notmuch_show_fold_bodies)<CR>',
         \ 'c':          ':call <SID>NM_show_fold_toggle(''c'', ''cit'', !g:notmuch_show_fold_citations)<CR>',
         \ 'h':          ':call <SID>NM_show_fold_toggle(''h'', ''hdr'', !g:notmuch_show_fold_headers)<CR>',
-        \ 'i':          ':call <SID>NM_show_fold_toggle(''s'', ''sig'', !g:notmuch_show_fold_signatures)<CR>',
+        \ 'i':          ':call <SID>NM_show_fold_toggle(''i'', ''sig'', !g:notmuch_show_fold_signatures)<CR>',
         \
         \ 'I':          ':call <SID>NM_show_mark_read_thread()<CR>',
         \ 'a':          ':call <SID>NM_show_archive_thread()<CR>',
@@ -262,12 +262,12 @@ function! s:NM_cmd_search_fmtline(line)
                 return 'ERROR PARSING: ' . a:line
         endif
         let max = g:notmuch_search_from_column_width
-        let flist = []
-        for at in split(m[4], ", ")
-                let p = min([stridx(at, "."), stridx(at, "@")])
-                call insert(flist, tolower(at[0:p - 1]))
+        let flist = {}
+        for at in split(m[4], '[|,] ')
+                let p = split(at, '[@.]')
+                let flist[p[0]] = 1
         endfor
-        let from = join(flist, ", ")
+        let from = join(keys(flist), ", ")
         return printf("%-12s %3s %-20.20s | %s (%s)", m[2], m[3], from, m[5], m[6])
 endfunction
 
@@ -596,7 +596,7 @@ function! s:NM_show_advance_marking_read_and_archiving()
                 let filter = <SID>NM_combine_tags('tag:', advance_tags, 'OR', '()')
                          \ + ['AND']
                          \ + <SID>NM_combine_tags('', ids, 'OR', '()')
-                call map(advance_tags, '"+" . v:val')
+                call map(advance_tags, '"-" . v:val')
                 call <SID>NM_tag(filter, advance_tags)
                 call <SID>NM_show_next(1, 1)
                 return
@@ -747,8 +747,11 @@ function! s:NM_cmd_show_parse(inlines)
                                 elseif mode_type == 'cit'
                                         if part_end || match(line, g:notmuch_show_citation_regexp) == -1
                                                 let outlnum = len(info['disp'])
-                                                let foldinfo = [ mode_type, mode_start, outlnum-1, len(info['msgs']),
-                                                               \ printf('[ %d-line citation.  Press "c" to show. ]', outlnum - mode_start) ]
+                                                if !part_end
+                                                        let outlnum = outlnum - 1
+                                                endif
+                                                let foldinfo = [ mode_type, mode_start, outlnum, len(info['msgs']),
+                                                               \ printf('[ %d-line citation.  Press "c" to show. ]', 1 + outlnum - mode_start) ]
                                                 let mode_type = ''
                                         endif
                                 elseif mode_type == 'sig'
@@ -756,8 +759,8 @@ function! s:NM_cmd_show_parse(inlines)
                                         if (outlnum - mode_start) > g:notmuch_show_signature_lines_max
                                                 let mode_type = ''
                                         elseif part_end
-                                                let foldinfo = [ mode_type, mode_start, outlnum-1, len(info['msgs']),
-                                                               \ printf('[ %d-line signature.  Press "s" to show. ]', outlnum - mode_start) ]
+                                                let foldinfo = [ mode_type, mode_start, outlnum, len(info['msgs']),
+                                                               \ printf('[ %d-line signature.  Press "i" to show. ]', 1 + outlnum - mode_start) ]
                                                 let mode_type = ''
                                         endif
                                 endif
@@ -765,7 +768,7 @@ function! s:NM_cmd_show_parse(inlines)
 
                         if part_end
                                 " FIXME: this is a hack for handling two folds being added for one line
-                                "         we should handle addinga fold in a function
+                                "         we should handle adding a fold in a function
                                 if len(foldinfo) && foldinfo[1] < foldinfo[2]
                                         call add(info['folds'], foldinfo[0:3])
                                         let info['foldtext'][foldinfo[1]] = foldinfo[4]
@@ -796,7 +799,14 @@ function! s:NM_cmd_show_parse(inlines)
                                 endif
                                 call add(info['disp'],
                                          \ printf('--- %s ---', in_part))
-                                let part_start = len(info['disp']) + 1
+                                " We don't yet handle nested parts, so pop
+                                " multipart/* immediately so text/plain
+                                " sub-parts are parsed properly
+                                if match(in_part, '^multipart/') != -1
+                                        let in_part = ''
+                                else
+                                        let part_start = len(info['disp']) + 1
+                                endif
                         endif
 
                 elseif in_header
@@ -1314,7 +1324,7 @@ endfunction
 function! s:NM_tag(filter, tags)
         let filter = len(a:filter) ? a:filter : [<SID>NM_search_thread_id()]
         if !len(filter)
-                throw 'Eeek! I couldn''t find the thead id!'
+                throw 'Eeek! I couldn''t find the thread id!'
         endif
         let args = ['tag']
         call extend(args, a:tags)