Bug#703608: [PATCH] debian: tighten notmuch-mutt dependency on notmuch

notmuch version 0.4 is required for the --output=files option.
debian/changelog: stanza for 0.15.2-2

Debian only changes.
emacs:show: separate out handling of application/octet-stream

Currently mime parts are basically handled based on their mime-type
with the exception of application/octet-stream parts. Deal with these
parts at the top level (notmuch-show-insert-bodypart).

This is needed later in the series as we need to put in a part button
for each part (which means knowing its mime type) while deferring the
actual insertion of the part.
emacs: show: handle inline patch fake parts at top level

The inline patch fake part handler also modifies the content-type so
handle this in notmuch-show-insert-bodypart too.
contrib: pick: move save-excursion closer to message insertion

Pick keeps point roughly at the top of the buffer while inserting
messages at the end as they come in (from the async
parser). Previously the save-excursion to do this was done once for
each thread inserted: now it is done for each individual message.

The advantage is that the message insertion code can decide where to
leave point. In the next patch point will be left on the target message.

Note notmuch-pick-insert-msg is unchanged as that is used by the tag
display update code.
contrib: pick: add a target message for pick

This adds a target message for pick which it will jump to when (if) it
appears. It adds the target to notmuch-pick-from-show-current-query so
that pick goes straight to the message that was current in the show
view and it adds target to notmuch-pick-refresh-view so that the
current message is preserved.
devel: add dkg's printmimestructure script to notmuch devel scripts

I find this script pretty useful when figuring out who to blame for
MIME rendering problems.

The notmuch repo will be the new primary home for this script, unless
and until a better home turns up.
ruby: fix missing symbol UINT2FIX()

It has never existed in Ruby (maybe JRuby). Fortunately the symbols are
loaded lazily, so nobody would notice unless they try
'query::count_messages'.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
emacs: Compute build dependencies to fix byte compile issues

Previously, we simply byte compiled each Elisp source file
independently.  This is actually the wrong thing to do and can lead to
issues with macros and performance issues with substitutions because
1) when the byte compiler encounters a (require 'x) form, it will load
x.elc in preference to x.el, even if x.el is newer, and as a result
may load old macro and substitution definitions and 2) if we update a
macro or substitution definition in one file, we currently won't
re-compile other files that depend on the file containing the
definition.

This patch addresses these problems by computing make dependency rules
from the (require 'x) forms in the Elisp source files, which we inject
into make's dependency database.
ruby: use in-tree notmuch library

Currently it simply finds any library available, and if notmuch is
installed in the system, it would give priority to that library.

Let's implement our own helper functions to link directly to the local
library, and give priority to the local header file.

Also, add an option to properly check if there are missing symbols.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
debian: package ruby bindings

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
NEWS: No Emacs 22 support
debian: bump standards version to 3.9.4
Merge branch 'release'

merge back debian-only release into master
NEWS: a bunch of cli news since 0.15
emacs: Don't override mm-show-part in notmuch-show-view-part

Previously, notmuch-show-view-part overrode the function binding of
mm-show-part to redirect it to notmuch-show-save-part to get notmuch's
default file name handling in case mm-display-part decided to fall
back to saving the part.  In addition to being messy, this depended on
the now-deprecated dynamic binding behavior of flet.

This patch removes the mm-show-part override in favor of passing the
file name in to mm-show-part the way it expects, so we get its default
file name handling.  It's not clear why we didn't do this before;
mm-show-part has supported default file names since at least Emacs
23.1.
emacs: add show view bindings to move to previous/next thread

We have most of the plumbing in place, add the bindings M-n and M-p.
build: fix out-of-tree builds

Support for out-of-tree builds was added in
commit 3e4a9d60a9419621b08c647a306843d76c47c2cb
Author: Carl Worth <cworth@cworth.org>
Date:   Wed Mar 9 15:02:42 2011 -0800

    build: Add support for non-source-directory builds.

and broken in
commit 7beeb8c88a014ecbc53d8241f10683b3c4c16228
Author: David Bremner <bremner@debian.org>
Date:   Sat Nov 17 12:28:15 2012 -0400

    test: initial performance testing infrastructure

Fix the build breakage.

Out-of-tree 'make test' has been broken since earlier than the above,
and remains broken, as does out-of-tree perf test, but at least the
build now works.
emacs: Fix trimming regexp in notmuch-check-exit-status

For such a simple regexp, this was broken in a very complicated way.

The intent was to strip the newline (and potentially other whitespace)
off the end of the error string so there wasn't an extra newline in
the error signal.  However, the regexp was deeply dependent on the
active syntax table and the subtleties of $.  We didn't notice this
because all notmuch major modes put ?\n in the whitespace class, which
makes this behaved as intended: the "\\s " matches all newlines, but
by matching the newline character, causes the $ *not* to match
*except* where it matched the empty string at the very end of the
string, which was not followed by a newline.

However, if the syntax table declares ?\n to be non-whitespace
(lisp-mode declares it as endcomment, and is likely to be the mode
you're in when testing functions), then this regexp behaves completely
differently, matching trailing spaces at the end of every line within
the string.

The solution is to say what we mean for whitespace *and* to switch
from $ to \', which matches only the end of the string, rather than
the end of each line.  Both are necessary or this will strip away
interior newlines, which is not what we want.
cli: add global option --stderr=FILE

With this option all writes to stderr are redirected to the specified
FILE (or to stdout on case FILE is '-'). This is immediately useful
in emacs interface as some of its exec intefaces do not provide
separation of stdout and stderr.