]> git.notmuchmail.org Git - notmuch/log
notmuch
9 years agoemacs: Remove redundant NTH argument from `notmuch-get-bodypart-content'.
Austin Clements [Mon, 21 Apr 2014 18:37:38 +0000 (14:37 -0400)]
emacs: Remove redundant NTH argument from `notmuch-get-bodypart-content'.

This can be derived from the PART argument (which is arguably
canonical), so there's no sense in giving the caller an extra foot
gun.

9 years agotest/emacs: globally force the html renderer to html2text
David Bremner [Sat, 20 Sep 2014 05:41:35 +0000 (07:41 +0200)]
test/emacs: globally force the html renderer to html2text

Previously we did this for a single test, but some other proposed
tests ( id:1398105468-14317-3-git-send-email-amdragon@mit.edu ) show
similar breakage when switching renderers.

9 years agodebian: re-enable atomicity test on arm64
David Bremner [Sat, 20 Sep 2014 07:51:48 +0000 (09:51 +0200)]
debian: re-enable atomicity test on arm64

according to

   https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=757454

the kernel problem which caused this test to fail should be
fixed now

9 years agodebian: bump SONAME
David Bremner [Tue, 16 Sep 2014 19:02:50 +0000 (21:02 +0200)]
debian: bump SONAME

Note that this is one of those cases where an ABI change is not
obvious from the symbols file. Several previously void functions now
have return codes.

9 years agopython: bump SONAME
David Bremner [Tue, 16 Sep 2014 18:50:57 +0000 (20:50 +0200)]
python: bump SONAME

This should have happened in commit 6754ad9f9, but oops.

This was not caught by our test suite because it uses an installed
notmuch library of it cannot find the just built one.

9 years agocli: refactor insert
Peter Wang [Wed, 16 Apr 2014 12:59:21 +0000 (22:59 +1000)]
cli: refactor insert

Change insert_message into write_message and move its responsibilities
for indexing the message into the main function, to simplify the control
flow.

9 years agoruby: handle return status of database close
Peter Wang [Wed, 16 Apr 2014 12:59:20 +0000 (22:59 +1000)]
ruby: handle return status of database close

Throw an exception if notmuch_database_destroy fails.

9 years agogo: add return status to database close method
Peter Wang [Wed, 16 Apr 2014 12:59:19 +0000 (22:59 +1000)]
go: add return status to database close method

Add return status to the Database.Close() method that calls
notmuch_database_destroy.

9 years agopython: handle return status of database close and destroy
Peter Wang [Wed, 16 Apr 2014 12:59:18 +0000 (22:59 +1000)]
python: handle return status of database close and destroy

Throw an exception if notmuch_database_close or notmuch_database_destroy
fail.

9 years agolib: bump soname
Peter Wang [Wed, 16 Apr 2014 12:59:17 +0000 (22:59 +1000)]
lib: bump soname

Adding return values to notmuch_database_close and
notmuch_database_destroy may require bumping the soname.

9 years agotest: simplify T360-symbol-hiding, use nm instead of objdump
David Bremner [Wed, 10 Sep 2014 06:41:11 +0000 (08:41 +0200)]
test: simplify T360-symbol-hiding, use nm instead of objdump

After yet another variation in objdump output caused this test to fail
(on a Debian port, no less), I decided whatever putative benefit we
get from looking at the object files instead of the library isn't
worth the maintenence headache.

This version uses nm -P. nm -P should be portable, and fixed format.
It purposely doesn't use the -D argument, since that is non-POSIX and
nm on GNU/Linux seems do the right thing without it.

It still won't work out of the box on e.g. Mac OS/X. I think the right
thing to do there is to move some more configuration information into
sh.config.

9 years agonotmuch_thread_get_authors: document match grouping with |
Gaute Hope [Wed, 10 Sep 2014 07:24:18 +0000 (09:24 +0200)]
notmuch_thread_get_authors: document match grouping with |

as stated in thread.cc:115

/* Construct an authors string from matched_authors_array and
 * authors_array. The string contains matched authors first, then
 * non-matched authors (with the two groups separated by '|'). Within
 * each group, authors are listed in date order. */

this is, however, not reflected in the public API documentation in
notmuch.h:970. This patch a paragraph explaining how | separates the
group of authors of messages matching the query and those of messages
that do not, but are still contained in the thread.

9 years agoemacs: jump: sort-order bugfix
Mark Walters [Tue, 2 Sep 2014 18:56:04 +0000 (19:56 +0100)]
emacs: jump: sort-order bugfix

default-value needs its argument to be quoted.

Slightly strangely default-value of 't or nil is 't or nil
respectively so the code

(default-value notmuch-search-oldest-first)

just gives the current value of notmuch-search-oldest-first rather
than intended default-value of this variable.

The symptom is that if you are in a search buffer and use notmuch jump
to run a saved search which does not have an explicitly set sort order
then the sort order of the saved-search is inherited from the current
search buffer rather than being the default search order.

Thanks to Jani for finding the bug.

9 years agocli: Be more helpful when .notmuch-config does not exist
Austin Clements [Wed, 3 Sep 2014 15:28:34 +0000 (11:28 -0400)]
cli: Be more helpful when .notmuch-config does not exist

Previously, if the user ran any subcommand that required a
configuration (e.g., notmuch new) but didn't have a configuration,
notmuch would give the rather un-friendly and un-actionable message

  Error reading configuration file .notmuch-config: No such file or directory

Since this condition is expected for new users, this patch adds
specific handling for the file-not-found case to give a message that
is friendly and actionable.

9 years agodoc: 'rm -f' potential doxygen temporary output file
Tomi Ollila [Mon, 1 Sep 2014 18:44:59 +0000 (21:44 +0300)]
doc: 'rm -f' potential doxygen temporary output file

Some (older) Doxygen versions do not create such a temporary file.

9 years agolib: Fix endless upgrade problem
Austin Clements [Mon, 1 Sep 2014 22:49:07 +0000 (18:49 -0400)]
lib: Fix endless upgrade problem

48db8c8 introduced a disagreement between when
notmuch_database_needs_upgrade returned TRUE and when
notmuch_database_upgrade actually performed an upgrade.  As a result,
if a database had a version less than 3, but no new features were
required, notmuch new would call notmuch_database_upgrade to perform
an upgrade, but notmuch_database_upgrade would return immediately
without updating the database version.  Hence, the next notmuch new
would do the same, and so on.

Fix this by ensuring that the upgrade-required logic is identical
between the two.

9 years agolib: Update doc of notmuch_database_{needs_upgrade,upgrade}
Austin Clements [Mon, 25 Aug 2014 17:26:09 +0000 (13:26 -0400)]
lib: Update doc of notmuch_database_{needs_upgrade,upgrade}

Clients are no longer required to call these functions after opening a
database in read/write mode (which is good, because almost none of
them do!).

9 years agolib: Return an error from operations that require an upgrade
Austin Clements [Mon, 25 Aug 2014 17:26:08 +0000 (13:26 -0400)]
lib: Return an error from operations that require an upgrade

Previously, there was no protection against a caller invoking an
operation on an old database version that would effectively corrupt
the database by treating it like a newer version.

According to notmuch.h, any caller that opens the database in
read/write mode is supposed to check if the database needs upgrading
and perform an upgrade if it does.  This would protect against this,
but nobody (even the CLI) actually does this.

However, with features, it's easy to protect against incompatible
operations on a fine-grained basis.  This lightweight change allows
callers to safely operate on old database versions, while preventing
specific operations that would corrupt the database with an
informative error message.

9 years agolib: Support empty header values in database
Austin Clements [Mon, 25 Aug 2014 17:26:07 +0000 (13:26 -0400)]
lib: Support empty header values in database

Commit 567bcbc2 introduced support for storing various headers in
document values.  However, doing so in a backwards-compatible way
meant that genuinely empty header values could not be distinguished
from the old behavior of not storing the headers at all, so these
required parsing the original message.

Now that we have database features, new databases can declare that all
messages have header values, so if we have this feature flag, we can
use the stored header value even if it's the empty string.

This requires slight cleanup to notmuch_message_get_header, since the
code previously couldn't distinguish between empty headers and headers
that are never stored in the database (previously this distinction
didn't matter).

9 years agolib: Report progress for combined upgrade operation
Austin Clements [Mon, 25 Aug 2014 17:26:06 +0000 (13:26 -0400)]
lib: Report progress for combined upgrade operation

Previously, some parts of upgrade didn't report progress and for
others it was possible for the progress meter to restart at 0 part way
through the upgrade because each stage was reported separately.

Fix this by computing the total amount of work that needs to be done
up-front and updating completed work monotonically.

9 years agolib: Reorganize upgrade around document types
Austin Clements [Mon, 25 Aug 2014 17:26:05 +0000 (13:26 -0400)]
lib: Reorganize upgrade around document types

Rather than potentially making multiple passes over the same type of
data in the database, reorganize upgrade around each type of data that
may be upgraded.  This eliminates code duplication, will make
multi-version upgrades faster, and will let us improve progress
reporting.

9 years agolib: Use database features to drive upgrade
Austin Clements [Mon, 25 Aug 2014 17:26:04 +0000 (13:26 -0400)]
lib: Use database features to drive upgrade

Previously, we had database version information hard-coded in the
upgrade code.  Slightly re-organize the upgrade process around the set
of new database features to be enabled by the upgrade.

9 years agolib: Simplify upgrade code using a transaction
Austin Clements [Mon, 25 Aug 2014 17:26:03 +0000 (13:26 -0400)]
lib: Simplify upgrade code using a transaction

Previously, the upgrade was organized as two passes -- an upgrade
pass, and a separate cleanup pass -- so the database was always in a
valid state.  This change substantially simplifies this code by
performing the upgrade in a transaction and combining both passes in
to one.  This 1) eliminates a lot of duplicate code between the
passes, 2) speeds up the upgrade process, 3) makes progress reporting
more accurate, 4) eliminates the potential for stale data if the
upgrade is interrupted during the cleanup pass, and 5) makes it easier
to reason about the safety of the upgrade code.

9 years agotest: Tests for future version and unknown feature handling
Austin Clements [Mon, 25 Aug 2014 17:26:02 +0000 (13:26 -0400)]
test: Tests for future version and unknown feature handling

9 years agotest: Tool to build DB with specific version and features
Austin Clements [Mon, 25 Aug 2014 17:26:01 +0000 (13:26 -0400)]
test: Tool to build DB with specific version and features

This will let us test basic version and feature handling.

9 years agolib: Database version 3: Introduce fine-grained "features"
Austin Clements [Mon, 25 Aug 2014 17:26:00 +0000 (13:26 -0400)]
lib: Database version 3: Introduce fine-grained "features"

Previously, our database schema was versioned by a single number.
Each database schema change had to occur "atomically" in Notmuch's
development history: before some commit, Notmuch used version N, after
that commit, it used version N+1.  Hence, each new schema version
could introduce only one change, the task of developing a schema
change fell on a single person, and it all had to happen and be
perfect in a single commit series.  This made introducing a new schema
version hard.  We've seen only two schema changes in the history of
Notmuch.

This commit introduces database schema version 3; hopefully the last
schema version we'll need for a while.  With this version, we switch
from a single version number to "features": a set of named,
independent aspects of the database schema.

Features should make backwards compatibility easier.  For many things,
it should be easy to support databases both with and without a
feature, which will allow us to make upgrades optional and will enable
"unstable" features that can be developed and tested over time.

Features also make forwards compatibility easier.  The features
recorded in a database include "compatibility flags," which can
indicate to an older version of Notmuch when it must support a given
feature to open the database for read or for write.  This lets us
replace the old vague "I don't recognize this version, so something
might go wrong, but I promise to try my best" warnings upon opening a
database with an unknown version with precise errors.  If a database
is safe to open for read/write despite unknown features, an older
version will know that and issue no message at all.  If the database
is not safe to open for read/write because of unknown features, an
older version will know that, too, and can tell the user exactly which
required features it lacks support for.

9 years agonew: Don't report version after upgrade
Austin Clements [Mon, 25 Aug 2014 17:25:59 +0000 (13:25 -0400)]
new: Don't report version after upgrade

The version number has always been pretty meaningless to the user and
it's about to become even more meaningless with the introduction of
"features".  Hopefully, the database will remain on version 3 for some
time to come; however, the introduction of new features over time in
version 3 will necessitate upgrades within version 3.  It would be
confusing if we always tell the user they've been "upgraded to version
3".  If the user wants to know what's new, they should read the news.

9 years agocompletion: fail silently if _init_completion is not found
Jani Nikula [Mon, 18 Aug 2014 16:33:21 +0000 (19:33 +0300)]
completion: fail silently if _init_completion is not found

The completion script depends on bash-completion 1.90 or later, with
_init_completion function. If that's not present, for some reason, the
completion currently fails with an ugly message, messing up user's
command line:

$ notmuch -bash: _init_completion: command not found

It's better to just not complete

9 years agoMake parsing of References and In-Reply-To header less error prone
Michal Sojka [Mon, 26 May 2014 14:05:57 +0000 (16:05 +0200)]
Make parsing of References and In-Reply-To header less error prone

According to RFC2822 References and In-Reply-To headers are supposed
to contain one or more Message-IDs, however older RFC822 allowed
almost any content. When both References and In-Reply-To headers ends
with something else that a Message-ID (see e.g. [1]), the thread
structure presented by notmuch is incorrect. The reason is that
notmuch treats this case as if the email contained no "replyto"
information (see _notmuch_database_link_message_to_parents).

This patch changes the parse_references() function to return the last
valid Message-ID encountered rather than NULL resulting from the last
hunk of text not being the Message-ID.

[1] https://lkml.org/lkml/headers/2014/5/19/864

9 years agoAdd test for incorrect threading of messages
Michal Sojka [Mon, 26 May 2014 14:05:56 +0000 (16:05 +0200)]
Add test for incorrect threading of messages

This happens when there is some garbage after the last Message-ID in
the References header. See for example
https://lkml.org/lkml/headers/2014/5/19/864.

9 years agoemacs: Improved compatibility for window-body-width in Emacs < 24
Austin Clements [Fri, 8 Aug 2014 17:06:05 +0000 (13:06 -0400)]
emacs: Improved compatibility for window-body-width in Emacs < 24

Fix byte compiler warning "Warning: the function `window-body-width'
is not known to be defined." by moving our compatibility wrapper
before its use and simplify the definition to a defalias for the old
name of the function.

9 years agoMerge tag 'debian/0.18.1-2'
David Bremner [Sat, 9 Aug 2014 16:21:57 +0000 (13:21 -0300)]
Merge tag 'debian/0.18.1-2'

uploaded to Debian unstable

9 years agodebian: re-enable atomicity tests on armhf debian/0.18.1-2
David Bremner [Sat, 9 Aug 2014 15:02:30 +0000 (12:02 -0300)]
debian: re-enable atomicity tests on armhf

Commit a33ec9c seems to have fixed the problem on the armhf
porterbox (harris.debian.org).

9 years agodebian: build with emacs24 by default, disable gdb on arm64
David Bremner [Sat, 9 Aug 2014 12:42:04 +0000 (09:42 -0300)]
debian: build with emacs24 by default, disable gdb on arm64

From wookey@debian.org

     id:20140808012130.GT7605@stoneboat.aleph1.co.uk

Fixes for the port in progress of debian to arm64.

9 years agonotmuch-config: talloc_strdup MAILDIR and NAME environment variables
Tomi Ollila [Thu, 7 Aug 2014 15:19:50 +0000 (18:19 +0300)]
notmuch-config: talloc_strdup MAILDIR and NAME environment variables

When defined -- the pointer is soon given to talloc_free() which
expects it to be allocated by talloc.

9 years agoutil: Const version of strtok_len
Austin Clements [Fri, 1 Aug 2014 02:09:52 +0000 (22:09 -0400)]
util: Const version of strtok_len

Because of limitations in the C type system, we can't a strtok_len
that can work on both const string and non-const strings.  The C
library solves this by taking a const char* and returning a char*
in functions like this (e.g., strchr), but that's not const-safe.
Solve it by introducing strtok_len_c, a version of strtok_len for
const strings.

9 years agotest: Include generated dependencies for test sources
Austin Clements [Fri, 1 Aug 2014 02:09:51 +0000 (22:09 -0400)]
test: Include generated dependencies for test sources

Previously the build system was generating automatic header
dependencies for test sources, but only smtp-dummy was in SRCS, so
only its dependencies were being included.  Add all of the test
sources to SRCS so that the root Makefile.local includes their
dependencies.

9 years agonew: Report and abort on upgrade failure
Austin Clements [Tue, 5 Aug 2014 14:33:43 +0000 (10:33 -0400)]
new: Report and abort on upgrade failure

Previously the return status of notmuch_database_upgrade went
completely unchecked.

9 years agolib: Improve documentation of _notmuch_message_create_for_message_id
Austin Clements [Tue, 5 Aug 2014 01:29:16 +0000 (21:29 -0400)]
lib: Improve documentation of _notmuch_message_create_for_message_id

Clarify the state of the returned message when
_notmuch_message_create_for_message_id returns
NOTMUCH_PRIVATE_STATUS_NO_DOCUMENT_FOUND.

9 years agoemacs: Expand default saved searches and add shortcut keys
Austin Clements [Tue, 5 Aug 2014 01:45:21 +0000 (21:45 -0400)]
emacs: Expand default saved searches and add shortcut keys

This should help new users off to a better start with the addition of
more sensible saved searches and default shortcut keys.  Most existing
users have probably customized this variable and won't be affected.

9 years agoemacs: Introduce notmuch-jump: shortcut keys to saved searches
Austin Clements [Tue, 5 Aug 2014 01:45:20 +0000 (21:45 -0400)]
emacs: Introduce notmuch-jump: shortcut keys to saved searches

This introduces notmuch-jump, which is like a user-friendly,
user-configurable global prefix map for saved searches.  This provides
a non-modal and much faster way to access saved searches than
notmuch-hello.

A user configures shortcut keys in notmuch-saved-searches, which are
immediately accessible from anywhere in Notmuch under the "j" key (for
"jump").  When the user hits "j", the minibuffer immediately shows a
helpful table of bindings reminiscent of a completions buffer.

This code is a combination of work from myself (originally,
"notmuch-go"), David Edmondson, and modifications from Mark Walters.

9 years agotravis: Only notify IRC on success if the previous build failed
Austin Clements [Tue, 5 Aug 2014 01:57:48 +0000 (21:57 -0400)]
travis: Only notify IRC on success if the previous build failed

Without this, Travis is rather spammy.  Travis will continue to notify
the IRC channel on each build failure, which seems desirable.

9 years agolib: Fix slight misinformation in the database schema doc
Austin Clements [Fri, 1 Aug 2014 02:59:13 +0000 (22:59 -0400)]
lib: Fix slight misinformation in the database schema doc

The database schema documentation made it sound like each mail
document had exactly one on-disk message file, which hasn't been true
for a long time.

9 years agolib: Invalidate message metadata in _notmuch_message_gen_terms
Austin Clements [Fri, 1 Aug 2014 02:59:27 +0000 (22:59 -0400)]
lib: Invalidate message metadata in _notmuch_message_gen_terms

Previously, we invalidated stored message metadata in
_notmuch_message_add_term and _notmuch_message_remove_term, but not in
_notmuch_message_gen_terms.  This doesn't currently result in any bugs
because of our limited uses of _notmuch_message_gen_terms, but it may
could cause trouble in the future.

9 years agoconfig: read database.path from $MAILDIR if set
Mark Oteiza [Mon, 21 Jul 2014 23:05:12 +0000 (19:05 -0400)]
config: read database.path from $MAILDIR if set

Try to read the config parameter database.path from $MAILDIR before
falling back to $HOME/mail

9 years agoconfig: read user.name from $NAME if set
Mark Oteiza [Mon, 21 Jul 2014 03:06:28 +0000 (23:06 -0400)]
config: read user.name from $NAME if set

Try to read the config parameter user.name from $NAME before taking the
user name from /etc/passwd.

9 years agoutil: Make string-util.h C++-compatible
Austin Clements [Tue, 29 Jul 2014 16:48:00 +0000 (12:48 -0400)]
util: Make string-util.h C++-compatible

9 years agoemacs: Clarify that notmuch-poll-script is deprecated
Austin Clements [Thu, 24 Jul 2014 21:19:31 +0000 (17:19 -0400)]
emacs: Clarify that notmuch-poll-script is deprecated

notmuch-poll-script has long since been deprecated in favor of
post-new hooks, but this wasn't obvious from the documentation.
Update the documentation to make this clear.  Since
notmuch-poll-script could, to some extend, be used to control the path
of the notmuch binary and that use is now clearly discouraged, promote
notmuch-command to a real defcustom instead of just a variable.

9 years agoemacs: show: make return value of notmuch-show-get-prop explicit
Mark Walters [Wed, 16 Jul 2014 18:03:16 +0000 (19:03 +0100)]
emacs: show: make return value of notmuch-show-get-prop explicit

This makes the fact the notmuch-show-get-prop returns nil if the major
mode is neither show not tree explicit.

9 years agodump: make dump take Xapian write lock
Mark Walters [Mon, 23 Jun 2014 20:12:29 +0000 (21:12 +0100)]
dump: make dump take Xapian write lock

Dump currently only takes the read lock. Xapian can cope with some
changes while maintaining a read snapshot but with more changes it
fails. Currently notmuch just gives a xapian error.

To avoid this we take the write lock when dumping. This prevents other
notmuch processes from modifying the xapian database preventing this
error.

Discussion with Olly on irc indicates that this is currently the best
solution: in xapian trunk there may be better possibilities using
snapshots but they need to make it to a release and propogate out to
users before we can switch approach.

Finally, this breaks one use case: pipelines of the form

notmuch dump | ... | notmuch restore

According to Olly this is already very fragile: it will only work on
small databases. One of the tests relies on this behaviour so fix that
to store the dump rather than use a pipe.

9 years agonmbug: Handle missing @upstream in is_unmerged
W. Trevor King [Sun, 6 Jul 2014 20:40:20 +0000 (13:40 -0700)]
nmbug: Handle missing @upstream in is_unmerged

If we don't have an upstream, there is nothing to merge, so nothing is
unmerged.  This avoids errors like:

  $ nmbug status
  error: No upstream configured for branch 'master'
  error: No upstream configured for branch 'master'
  fatal: ambiguous argument '@{upstream}': unknown revision or path not in the working tree.
  Use '--' to separate paths from revisions, like this:
  'git <command> [<revision>...] -- [<file>...]'
  'git rev-parse @{upstream}' exited with nonzero value

You might not have an upstream if you're only using nmbug locally to
version-control your tags.

9 years agotest: Test thread linking in all possible delivery orders
Austin Clements [Wed, 9 Jul 2014 21:15:38 +0000 (17:15 -0400)]
test: Test thread linking in all possible delivery orders

These tests deliver all possible (single-root) four-message threads in
all possible orders and check that notmuch successfully links them
into threads.  These tests supersede and replace the previous and much
less thorough "T260-thread-order" tests.

There are two variants of the test: one delivers messages that
reference only their immediate parent and the other delivers messages
that reference all of their parents.  The latter test is currently
known-broken.

9 years agoEnable Travis-CI as a backup continuous integration service.
Wael M. Nasreddine [Fri, 23 May 2014 17:51:48 +0000 (10:51 -0700)]
Enable Travis-CI as a backup continuous integration service.

You can access the dashboard at https://travis-ci.org/notmuch/notmuch

9 years agoemacs: tree/show remove duplicate function
Mark Walters [Sat, 7 Jun 2014 09:51:08 +0000 (10:51 +0100)]
emacs: tree/show remove duplicate function

tree overrides notmuch-show-get-prop so that it can use many of the
utility function directly. Now that tree is in mainline the version
from tree can be moved to show and the original overridden show
version dropped.

9 years agonmbug: Add a git_with_status helper function
W. Trevor King [Sun, 6 Jul 2014 20:40:19 +0000 (13:40 -0700)]
nmbug: Add a git_with_status helper function

Sometimes we want to catch Git errors and handle them, instead of
dying with an error message.  This lower-level version of git() allows
us to get the error status when we want it.

9 years agoemacs: set default in notmuch-read-query
Mark Walters [Mon, 23 Jun 2014 21:06:46 +0000 (22:06 +0100)]
emacs: set default in notmuch-read-query

This adds the current query as a "default value" to
notmuch-read-qeury. The default value is available via a down-arrow as
opposed to history which is available from the up arrow.

Note if a user presses return in the minibuffer this value is not
returned.

The implementation is simple but notmuch-read-query could be called
via notmuch-search/notmuch-tree etc from any buffer so it makes sense
to put the decision of how to extract the current query in
notmuch-read-query rather than in each of the callers.

9 years agonmbug-status: Optionally load the header and footer templates from the config
W. Trevor King [Sat, 31 May 2014 22:20:27 +0000 (15:20 -0700)]
nmbug-status: Optionally load the header and footer templates from the config

For folks that don't like the default templates for whatever reason.

9 years agonmbug-status: Add the time to the footer's build-date
W. Trevor King [Sat, 31 May 2014 22:20:26 +0000 (15:20 -0700)]
nmbug-status: Add the time to the footer's build-date

Our repository [1] has a post-update hook that rebuilds the status
page after each push.  Since that may happen several times a day, we
might as well show the build time (as well as the date) in the footer.

The trailing 'Z' is the ISO 8601 designator for UTC.  Now that we're
showing times, it's nice to be explicit about the timezone we're
using.

The rename from date -> datetime gives us backward-compatibility for
folks that *do* only want the date.  We keep the old date formatting
to support those folks.

[1]: http://nmbug.tethera.net/git/nmbug-tags.git

9 years agonmbug-status: Factor out header/footer context into a shared dict
W. Trevor King [Sat, 31 May 2014 22:20:25 +0000 (15:20 -0700)]
nmbug-status: Factor out header/footer context into a shared dict

Rather than splitting this context into header-only and footer-only
groups, just dump it all in a shared dict.  This will make it easier
to eventually split the header/footer templates out of this script
(e.g. if we want to load them from the config file).

9 years agoMove the generated date from the top of the page to the footer.
Carl Worth [Sat, 31 May 2014 22:20:24 +0000 (15:20 -0700)]
Move the generated date from the top of the page to the footer.

It's useful reference information, but anyone who wants it will look
for and find it.  We don't need this front-and-center.  Follow the
pattern set by our header template with a triple-quoted string.

The gray <hr> styling is less agressive.  IE uses 'color' for drawing
the rule, while Gecko and Opera use the border or 'background-color'
[1].

[1]: https://bugzilla.mozilla.org/show_bug.cgi?id=239386

9 years agoAdd a docstring describing the program
Carl Worth [Sat, 31 May 2014 22:20:23 +0000 (15:20 -0700)]
Add a docstring describing the program

Prefer a docstring to a header comment so we can use it as the
ArgumentParser description (formatted with 'nmbug-status --help').
Script readers still have it near the top of the file.  Since it's a
docstring, use PEP 257's summary-line-and-body format [1].

[1]: http://legacy.python.org/dev/peps/pep-0257/#multi-line-docstrings

9 years agoAdd explicit license information
Carl Worth [Sat, 31 May 2014 22:20:22 +0000 (15:20 -0700)]
Add explicit license information

It's nice to have for situations where this script is found outside of
the notmuch source repository (e.g. after being installed).

9 years agoemacs: search archive tweak
Mark Walters [Fri, 6 Jun 2014 12:48:33 +0000 (13:48 +0100)]
emacs: search archive tweak

notmuch-search-archive-thread moves to the next line after tagging. In
the normal case this makes sense, but if the region is active, it tags
the whole region and then it doesn't really. Thus only move to the
next line if region is not active.

9 years agotest: redirect gdb output to a file.
David Bremner [Tue, 6 May 2014 13:06:28 +0000 (22:06 +0900)]
test: redirect gdb output to a file.

It seems that the normal output redirection in the test suite doesn't
work for gdb, but it's nice to have output in a file for debugging.

9 years agodevel: news2wiki to recognize yyyy-mm-dd or UNRELEASED as release date
Tomi Ollila [Wed, 7 May 2014 19:33:38 +0000 (22:33 +0300)]
devel: news2wiki to recognize yyyy-mm-dd or UNRELEASED as release date

The yyyy-mm-dd (actually \d\d\d\d-\d\d-\d\d) for a bit more restrictive
(and self-documentative) than the \w\w\w\w-... that used to be there and
UNRELEASED so that developers can test the latest NEWS converted to mdwn
format before submitting NEWS patches.

9 years agoemacs: show: add an update seen function to post-command-hook
Mark Walters [Fri, 9 May 2014 00:20:08 +0000 (01:20 +0100)]
emacs: show: add an update seen function to post-command-hook

Add a function for updating seen messages to the
post-command-hook. This function calls a customizable (by eg
defcustom) function with parameters the start and end of the current
window and that function can decide what to mark read based on that
and the current point.

Since this is in the post-command-hook it should get called after most
user actions (exceptions include user resizing the window) so it
should be possible to make sure the seen status gets updated whether
the user uses notmuch commands like next-message or normal emacs
commands like scroll-up.

It removes all of the old mark read/seen points but introduces a
simple example function that just marks the current message read if it
is open. This function has one small subtlety: it makes sure it
doesn't mark the same message read twice (in the same instance of the
same buffer); otherwise the post-command-hook makes it impossible for
a user to manually mark a message unread.

This fixes the current bugs (imo) that closed messages can be marked
read, and that opening a closed message does not mark it read.

Another advantage of using the post-command-hook any programmatic use
with point passing through a message will not mark it read.

9 years agotest: make test_emacs call post-command-hook
David Bremner [Fri, 9 May 2014 00:20:07 +0000 (01:20 +0100)]
test: make test_emacs call post-command-hook

The unread/read changes will use the post-command-hook. test_emacs
does not call the post-command-hook. This adds a notmuch-test-progn
which takes a list of commands as argument and executes them in turn
but runs the post-command-hook after each one.

The caller can batch operations (ie to stop post-command-hook from
being interleaved) by wrapping the batch of operations inside a progn.

We also explicitly run the post-command-hook before getting the output
from a test; this makes sense as this will be a place the user would
be seeing the information.

9 years agoemacs: Fix indentation.
David Edmondson [Fri, 9 May 2014 08:22:21 +0000 (09:22 +0100)]
emacs: Fix indentation.

Fix the indentation of `notmuch-show-mode-map'.

9 years agolib: Start all function names in notmuch-private.h with
Charles Celerier [Tue, 13 May 2014 09:44:05 +0000 (05:44 -0400)]
lib: Start all function names in notmuch-private.h with

As noted in devel/STYLE, every private library function should start
with _notmuch. This patch corrects function naming that did not adhere
to this style in lib/notmuch-private.h. In particular, the old function
names that now begin with _notmuch are

    notmuch_sha1_of_file
    notmuch_sha1_of_string
    notmuch_message_file_close
    notmuch_message_file_get_header
    notmuch_message_file_open
    notmuch_message_get_author
    notmuch_message_set_author

Signed-off-by: Charles Celerier <cceleri@cs.stanford.edu>
9 years agotest: use sh.config for configuration
Jani Nikula [Fri, 30 May 2014 07:43:05 +0000 (10:43 +0300)]
test: use sh.config for configuration

9 years agobuild: generate sh.config for feeding configure results to shell scripts
Jani Nikula [Fri, 30 May 2014 07:43:04 +0000 (10:43 +0300)]
build: generate sh.config for feeding configure results to shell scripts

Only include the relevant information.

Amended by David Bremner:

Use a prefix NOTMUCH_ to minimize collisions with other
variables.

9 years agodocs: remove spurious man page generated from doxygen
David Bremner [Sat, 12 Jul 2014 21:04:52 +0000 (18:04 -0300)]
docs: remove spurious man page generated from doxygen

There is a doxygen bug about these odd files,

      https://bugzilla.gnome.org/show_bug.cgi?id=727796

But it isn't clear if / when a fix will be provided, so just delete it
to avoid e.g. confusing man-to-wiki.pl

9 years agoNEWS: add minimal item for API change to close/destroy
David Bremner [Wed, 9 Jul 2014 23:39:26 +0000 (20:39 -0300)]
NEWS: add minimal item for API change to close/destroy

9 years agolib: add return status to database close and destroy
Jani Nikula [Wed, 16 Apr 2014 12:59:16 +0000 (22:59 +1000)]
lib: add return status to database close and destroy

notmuch_database_close may fail in Xapian ->flush() or ->close(), so
report the status. Similarly for notmuch_database_destroy which calls
close.

This is required for notmuch insert to report error status if message
indexing failed.

9 years agobuild: check .git directory existence in srcdir (for out-of-tree builds)
Tomi Ollila [Tue, 6 May 2014 19:35:28 +0000 (22:35 +0300)]
build: check .git directory existence in srcdir (for out-of-tree builds)

So that $(VERSION) and version.stamp uses the git-describe -based
version data instead of the content of `version' file.

For consistency also the git commands in Makefile[.local] target
`verify-no-dirty-code' uses the git --git-dir=$srcdir/.git ...
commands (inside ifeq($(IS_GIT),yes)). Attempting to make this
target outside of the tree will fail in any case.

9 years agodoc: postprocess notmuch.3
David Bremner [Tue, 1 Jul 2014 19:13:03 +0000 (16:13 -0300)]
doc: postprocess notmuch.3

Remove excess italics from doxygen output. It seems to make no
sense (and is certainly ugly) to italicize the first argument to the
.RI macro.

9 years agodoc: quiet doxygen warnings
David Bremner [Sun, 6 Jul 2014 14:23:42 +0000 (11:23 -0300)]
doc: quiet doxygen warnings

remove some obsolete tags for XML output (which we don't currently
generate in any case)

9 years agodoc: build and install doxygen api docs
David Bremner [Tue, 1 Jul 2014 16:40:33 +0000 (13:40 -0300)]
doc: build and install doxygen api docs

In order to support out of tree builds and avoid hardcoding version
number, generate `doc/config.dox` from configure.

9 years agoconfigure: use cc/c++ instead of gcc/g++
Fraser Tweedale [Thu, 22 May 2014 10:10:06 +0000 (20:10 +1000)]
configure: use cc/c++ instead of gcc/g++

Some systems (e.g. FreeBSD 10) do not ship with the GNU Compiler
Collection.  Use generic cc/c++ instead of gcc/g++ (unless the
CC/CXX environment variables are used).

9 years agoMerge tag '0.18.1'
David Bremner [Wed, 25 Jun 2014 11:01:17 +0000 (08:01 -0300)]
Merge tag '0.18.1'

notmuch 0.18.1 release

9 years agoversion: bump to 0.18.1 0.18.1 debian/0.18.1-1
David Bremner [Wed, 25 Jun 2014 10:24:57 +0000 (07:24 -0300)]
version: bump to 0.18.1

Also add precis of NEWS to debian changelog

9 years agoNEWS: Improve and correct "Fix for phrase indexing" entry
Austin Clements [Mon, 23 Jun 2014 14:25:28 +0000 (10:25 -0400)]
NEWS: Improve and correct "Fix for phrase indexing" entry

This improves the description of the fix, fixes some typos, and
changes "(re)-indexed" to "indexed" because we have no particular
notion of "re-indexing" a message.

9 years agoNEWS: quibbles from Tomi
David Bremner [Mon, 23 Jun 2014 09:36:30 +0000 (06:36 -0300)]
NEWS: quibbles from Tomi

See id:m2vbrsgi7n.fsf@guru.guru-group.fi for details

9 years agoMerge tag '0.18.1_rc0'
David Bremner [Mon, 23 Jun 2014 01:25:10 +0000 (22:25 -0300)]
Merge tag '0.18.1_rc0'

notmuch 0.18.1~rc0 release

9 years agoversion: bump to 0.18.1~rc0
David Bremner [Mon, 23 Jun 2014 00:23:22 +0000 (21:23 -0300)]
version: bump to 0.18.1~rc0

Also bump the python bindings version, the NEWS version and the Debian
version.

Since the changelog is (slightly dubiously) metadata, we have to
change it to upload a release candidate.

9 years agoNEWS: add news for 0.18.1
David Bremner [Sat, 21 Jun 2014 20:09:01 +0000 (17:09 -0300)]
NEWS: add news for 0.18.1

This is my summary of the commits from 0.18.

9 years agoemacs: Forwarded messages should not have modified buffers
David Edmondson [Mon, 16 Jun 2014 05:30:11 +0000 (06:30 +0100)]
emacs: Forwarded messages should not have modified buffers

When the user begins forwarding a message, the resulting composition
buffer should not be marked as modified, in order that it can
immediately be killed without prompting.

9 years agoMerge branch 'release'
David Bremner [Sun, 22 Jun 2014 09:53:21 +0000 (06:53 -0300)]
Merge branch 'release'

Austin's termpos patches and Felipe's zlib.pc workaround

9 years agoconfigure: add workaround for systems without zlib.pc
Felipe Contreras [Mon, 12 May 2014 03:09:32 +0000 (22:09 -0500)]
configure: add workaround for systems without zlib.pc

Some systems (e.g. FreeBSD) might not have installed the appropriate
pkg-config file as they should. We can workaround the issue by creating
the .pc file they should have distributed.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
9 years agolib: Separate all phrases indexed by _notmuch_message_gen_terms
Austin Clements [Mon, 16 Jun 2014 02:40:34 +0000 (22:40 -0400)]
lib: Separate all phrases indexed by _notmuch_message_gen_terms

This adds a 100 termpos gap between all phrases indexed by
_notmuch_message_gen_terms.  This fixes a bug where terms from the end
of one header and the beginning of another header could match together
in a single phrase and a separate bug where term positions of
un-prefixed terms overlapped.

This fix only affects newly indexed messages.  Messages that are
already indexed won't benefit from this fix without re-indexing, but
the fix won't make things any worse for existing messages.

9 years agotest: Known-broken test for overlapping/adjacent termpos
Austin Clements [Mon, 16 Jun 2014 02:40:33 +0000 (22:40 -0400)]
test: Known-broken test for overlapping/adjacent termpos

This adds two known-broken tests and one working test related to the
term positions assigned to terms from different headers or MIME parts.
The first test fails because we don't create a termpos gap between
different headers.  The second test fails because we don't adjust
termpos at all when indexing multiple parts.

9 years agolib: Index name and address of from/to headers as a phrase
Austin Clements [Mon, 16 Jun 2014 02:40:32 +0000 (22:40 -0400)]
lib: Index name and address of from/to headers as a phrase

Previously, we indexed the name and address parts of from/to headers
with two calls to _notmuch_message_gen_terms.  In general, this
indicates that these parts are separate phrases.  However, because of
an implementation quirk, the two calls to _notmuch_message_gen_terms
generated adjacent term positions for the prefixed terms, which
happens to be the right thing to do in this case, but the wrong thing
to do for all other calls.  Furthermore, _notmuch_message_gen_terms
produced potentially overlapping term positions for the un-prefixed
copies of the terms, which is simply wrong.

This change indexes both the name and address in a single call to
_notmuch_message_gen_terms, indicating that they should be part of a
single phrase.  This masks the problem with the un-prefixed terms
(fixing the two known-broken tests) and puts us in a position to fix
the unintentionally phrases generated by other calls to
_notmuch_message_gen_terms.

9 years agotest: Add search tests for combined name/address queries
Austin Clements [Mon, 16 Jun 2014 02:40:31 +0000 (22:40 -0400)]
test: Add search tests for combined name/address queries

Two of these are currently known-broken.  We index the name and
address parts in two separate calls to _notmuch_message_gen_terms.
Currently this has the effect of placing the term positions of the
prefixed terms from the second call right after those of the first
call, but screws up the term positions of the non-prefixed terms.

9 years agotest: Fix from/to search test queries
Austin Clements [Mon, 16 Jun 2014 02:40:30 +0000 (22:40 -0400)]
test: Fix from/to search test queries

Two of the search tests for "from" and "to" queries were clearly
trying to search for prefixed phrases, but forgot to shell quote the
phrases.  Fix this by quoting them correctly.

9 years agoMerge branch 'release'
David Bremner [Sun, 15 Jun 2014 18:52:18 +0000 (15:52 -0300)]
Merge branch 'release'

still painfully slowly assembling 0.18.1

9 years agoemacs install: make sure all components to be installed are there
Tomi Ollila [Sat, 10 May 2014 21:36:43 +0000 (00:36 +0300)]
emacs install: make sure all components to be installed are there

`make install-emacs` will copy $(emacs_sources), $(emacs_images) and
$(emacs_bytecode) to their target directories. $(emacs_bytecode) was
already a prerequisite of make install-emacs as these obviously needed
to be build. Until a while ago all of $(emacs_sources) was available
in the repository, but now it includes `notmuch-version.el` which
is generated. In the future we may have generated emacs images too.

9 years agodebian: update notmuch-emacs for emacsen-common 2.0.8
David Bremner [Sat, 14 Jun 2014 10:50:52 +0000 (07:50 -0300)]
debian: update notmuch-emacs for emacsen-common 2.0.8

- redo install/remove scripts from new samples
- symlink .el files properly
- add depends instead of conflicts

9 years agodebian: tighten dependency of python packages on libnotmuch.
David Bremner [Sat, 14 Jun 2014 10:20:56 +0000 (07:20 -0300)]
debian: tighten dependency of python packages on libnotmuch.

Using (>= ${source:Version}) allows newer versions of the library with
the same SONAME.

9 years agoMerge branch 'release'
David Bremner [Sat, 14 Jun 2014 02:03:49 +0000 (23:03 -0300)]
Merge branch 'release'

Merge in a few more commits towards 0.18.1

9 years agolib: resurrect support for single-message mbox files
Jani Nikula [Thu, 5 Jun 2014 06:34:09 +0000 (08:34 +0200)]
lib: resurrect support for single-message mbox files

This is effectively a revert of

commit 6812136bf576d894591606d9e10096719054d1f9
Author: Jani Nikula <jani@nikula.org>
Date:   Mon Mar 31 00:21:48 2014 +0300

    lib: drop support for single-message mbox files

The intention was to drop support for indexing new single-message mbox
files (and whether that was a good idea in the first place is
arguable). However this inadvertently broke support for reading
headers from previously indexed single-message mbox files, which is
far worse.

Distinguishing between the two cases would require more code than
simply bringing back support for single-message mbox files.