3 years agoFix orthography
Daniel Kahn Gillmor [Mon, 17 Jul 2017 22:16:02 +0000 (00:16 +0200)]
Fix orthography

3 years agouse modern debian/copyright
Daniel Kahn Gillmor [Mon, 17 Jul 2017 22:16:06 +0000 (00:16 +0200)]
use modern debian/copyright

3 years agoavoid false lintian warning about "iff"
Daniel Kahn Gillmor [Mon, 17 Jul 2017 22:16:04 +0000 (00:16 +0200)]
avoid false lintian warning about "iff"

3 years agoresolve lintian tag debhelper-but-no-misc-depends notmuch-emacs
Daniel Kahn Gillmor [Mon, 17 Jul 2017 22:16:03 +0000 (00:16 +0200)]
resolve lintian tag debhelper-but-no-misc-depends notmuch-emacs

This is likely not strictly necessary given that notmuch-emacs is a
transitional package.  But having a simple consistency until we
eventually remove the transitional notmuch-emacs package seems ok too,
and fewer arbitrary lintian warnings will make real lintian warnings
more visible.

3 years agofix Python capitalization
Daniel Kahn Gillmor [Mon, 17 Jul 2017 22:16:01 +0000 (00:16 +0200)]
fix Python capitalization

3 years agoexplicitly mark notmuch-emacs as transitional
Daniel Kahn Gillmor [Mon, 17 Jul 2017 22:16:00 +0000 (00:16 +0200)]
explicitly mark notmuch-emacs as transitional

3 years agoBump standards version to 4.0.0 (no changes needed)
Daniel Kahn Gillmor [Mon, 17 Jul 2017 22:15:59 +0000 (00:15 +0200)]
Bump standards version to 4.0.0 (no changes needed)

Some things that might be interesting (and are acceptable and
supported under 4.0.0, though not required) are:

 * supporting DEB_BUILD_OPTIONS tag nodoc wihle tagging build-deps (we
   could put python-sphinx into <!nodoc>, for example)

 * splitting out Build-Depends-Arch from Build-Depends

3 years agoDrop duplicate Section header for notmuch-vim
Daniel Kahn Gillmor [Mon, 17 Jul 2017 22:15:58 +0000 (00:15 +0200)]
Drop duplicate Section header for notmuch-vim

Resolves lintian binary-control-field-duplicates-source

3 years agoNEWS: drop redundant mention of dump fix
David Bremner [Tue, 18 Jul 2017 09:36:31 +0000 (06:36 -0300)]
NEWS: drop redundant mention of dump fix

This actually happened in 0.24.x.

3 years agoMerge tag 'debian/0.25_rc0-2'
David Bremner [Mon, 17 Jul 2017 12:20:10 +0000 (09:20 -0300)]
Merge tag 'debian/0.25_rc0-2'

merge 32 bit compilation fix

3 years agodebian: changelog stanza for 0.25~rc0-2 debian/0.25_rc0-2
David Bremner [Mon, 17 Jul 2017 11:50:08 +0000 (08:50 -0300)]
debian: changelog stanza for 0.25~rc0-2

3 years agoutil: make g_mime_utils_header_decode_date_unix match prototype
David Bremner [Mon, 17 Jul 2017 11:47:18 +0000 (08:47 -0300)]
util: make g_mime_utils_header_decode_date_unix match prototype

The problem shows up on 32 bit architectures where sizeof(time_t) !=
sizeof(gint64).  Upcasting the 32 bit time_t to a 64 bit integer
should hopefully be safe.

3 years agoNEWS: Initial writeup for my contributions to 0.25
David Bremner [Mon, 17 Jul 2017 01:43:11 +0000 (22:43 -0300)]
NEWS: Initial writeup for my contributions to 0.25

3 years agoMerge tag '0.25_rc0'
David Bremner [Sun, 16 Jul 2017 12:08:39 +0000 (09:08 -0300)]
Merge tag '0.25_rc0'

notmuch 0.25~rc0 release

3 years agodebian: note two closed bugs in changelog 0.25_rc0 debian/0.25_rc0-1
David Bremner [Sun, 16 Jul 2017 11:49:06 +0000 (08:49 -0300)]
debian: note two closed bugs in changelog

3 years agodebian: don't create obsolete bash completion dir
David Bremner [Sun, 16 Jul 2017 11:45:55 +0000 (08:45 -0300)]
debian: don't create obsolete bash completion dir

3 years agodebian: set distribution to experimental, finalize changelog
David Bremner [Sun, 16 Jul 2017 11:20:15 +0000 (08:20 -0300)]
debian: set distribution to experimental, finalize changelog

3 years agodebian: add more c++ gunk to symbols file
David Bremner [Sun, 16 Jul 2017 11:18:19 +0000 (08:18 -0300)]
debian: add more c++ gunk to symbols file

3 years agodebian: bump changelog version, mention SONAME bump
David Bremner [Sun, 16 Jul 2017 11:08:18 +0000 (08:08 -0300)]
debian: bump changelog version, mention SONAME bump

3 years agoNEWS: start entry for 0.25
David Bremner [Sun, 16 Jul 2017 11:02:51 +0000 (08:02 -0300)]
NEWS: start entry for 0.25

3 years agoversion: bump version to 0.25~rc0
David Bremner [Sun, 16 Jul 2017 11:01:42 +0000 (08:01 -0300)]
version: bump version to 0.25~rc0

3 years agocrypto: clean up unused definitions in gmime 3.0
David Bremner [Sat, 15 Jul 2017 23:01:46 +0000 (01:01 +0200)]
crypto: clean up unused definitions in gmime 3.0

based on the same patch from dkg as the previous commit.

3 years agocrypto: Avoid explicit handling of GMimeCryptoContext in gmime 3
David Bremner [Sat, 15 Jul 2017 23:01:45 +0000 (01:01 +0200)]
crypto: Avoid explicit handling of GMimeCryptoContext in gmime 3

gmime 3.0 knows how to select the correct GMimeCryptoContext
automatically, so a bunch of the code in notmuch can be dropped in
that case.

The #ifdef removal of the crypto stuff is better than #define aliasing
in gmime-extra.h for this stuff.  When built against gmime 3.0:

    * it reduces compiled code, and
    * it avoids initializing unused gpgme contexts

(based on a patch from dkg)

3 years agocli/crypto: eliminated compiler warnings about unused arguments
David Bremner [Sat, 15 Jul 2017 23:01:44 +0000 (01:01 +0200)]
cli/crypto: eliminated compiler warnings about unused arguments

These are due to (excessively?) fancy macro definitions in gmime-extra.h

3 years agocli/crypto: treat failure to create a crypto context as fatal.
David Bremner [Sat, 15 Jul 2017 23:01:43 +0000 (01:01 +0200)]
cli/crypto: treat failure to create a crypto context as fatal.

Silently ignoring signed/encrypted parts seems like the wrong idea,
and it also complicates future gmime-3.0 compatibility changes.

3 years agoemacs: change default for notmuch-crypto-process-mime to t
David Bremner [Wed, 12 Jul 2017 10:48:18 +0000 (07:48 -0300)]
emacs: change default for notmuch-crypto-process-mime to t

There are some cases like remote usage where this might cause
problems, but those users can easily customize the variable. The
inconvenience seems to be outweighed by the security benefit for most

3 years agoNEWS: a few formatting updates for 0.24 news items (wiki compatibility)
Tomi Ollila [Thu, 13 Jul 2017 17:35:34 +0000 (20:35 +0300)]
NEWS: a few formatting updates for 0.24 news items (wiki compatibility)

- removed 7 trailing dots -- to make those lines subsection headers

- converted some (mime type) text to monospace

- removed one extra space

3 years agoclean up use of constants in g_mime_multipart_ wrappers
Daniel Kahn Gillmor [Fri, 14 Jul 2017 13:12:01 +0000 (15:12 +0200)]
clean up use of constants in g_mime_multipart_ wrappers

When compiling as C code (instead of C++) against gmime 3.0, gcc gives
errors like the following:

    error: invalid conversion from ‘int’ to ‘GMimeDecryptFlags’ [-fpermissive]

so use explicit *_NONE values instead.

3 years agoconfig: deprecate/drop crypto.gpg_path under gmime 2.6/3.0
Daniel Kahn Gillmor [Fri, 14 Jul 2017 13:12:00 +0000 (15:12 +0200)]
config: deprecate/drop crypto.gpg_path under gmime 2.6/3.0

gmime 3.0 no longer offers a means to set the path for gpg.

Users can set $PATH anyway if they want to pick a
differently-installed gpg (e.g. /usr/local/bin/gpg), so this isn't
much of a reduction in functionality.

The one main difference is for people who have tried to use "gpg2" to
make use of gpg 2.1, but that isn't usefully co-installable anyway.

3 years agoAdd additional munged reply-to tests
Daniel Kahn Gillmor [Fri, 14 Jul 2017 20:14:23 +0000 (22:14 +0200)]
Add additional munged reply-to tests

The reply-to munging code might behave differently whether there's an
exact match on the strings or not, or whether the string is a raw
addr-spec instead of an name-addr.  These tests cover those variations
(i also had to tweak json output further below when this new test was

3 years agoEnsure that "notmuch reply" succeeds during testing.
Daniel Kahn Gillmor [Fri, 14 Jul 2017 20:14:22 +0000 (22:14 +0200)]
Ensure that "notmuch reply" succeeds during testing.

In some (bad!) cases, "notmuch reply" might fail, or might even
segfault.  If this happens, it indicates a bug, and the test suite
should notice it.

3 years agocli: wrap getting uid
David Bremner [Sat, 3 Jun 2017 00:19:04 +0000 (21:19 -0300)]
cli: wrap getting uid

Apparently it moved from "name" to "key_id" in gmime-3.0

3 years agocli: make keyid from fingerprint in gmime 3.0
David Bremner [Fri, 2 Jun 2017 23:57:01 +0000 (20:57 -0300)]
cli: make keyid from fingerprint in gmime 3.0

The "key_id" field seems to used for userid in gmime-3.0, while the
keyid is dropped in the fingerprint field if the full fingerprint is
not available.

3 years agolib: paper over allocation difference
David Bremner [Sat, 20 May 2017 12:05:22 +0000 (09:05 -0300)]
lib: paper over allocation difference

In gmime 3.0 this function is "transfer none", so no deallocation is
needed (or permitted)

3 years agolib: add version of _n_m_f_get_combinded_header for gmime 3.0
David Bremner [Wed, 17 May 2017 10:40:09 +0000 (07:40 -0300)]
lib: add version of _n_m_f_get_combinded_header for gmime 3.0

The iterator is gone, so we need a new loop structure.

3 years agolib: refactor _notmuch_messsage_file_get_combined_header
David Bremner [Wed, 17 May 2017 10:18:55 +0000 (07:18 -0300)]
lib: refactor _notmuch_messsage_file_get_combined_header

We need to rewrite the loop for gmime-3.0; move the loop body to its
own function to avoid code duplication.  Keep the common exit via
"goto DONE" to make this pure code movement.  It's important to note
that the existing exit path only deallocates the iterator.

3 years agolib: wrap use of g_mime_utils_header_decode_date
David Bremner [Wed, 17 May 2017 01:59:54 +0000 (22:59 -0300)]
lib: wrap use of g_mime_utils_header_decode_date

This changes return type in gmime 3.0

3 years agocli: hide rename of GMimeCertificateTrust
David Bremner [Sun, 14 May 2017 17:51:38 +0000 (14:51 -0300)]
cli: hide rename of GMimeCertificateTrust

Both the enum and the values are renamed in GMime 3.0.

3 years agocli: generalize use of GMIME_SIGNATURE_{ERROR,STATUS} to gmime-3
David Bremner [Sun, 14 May 2017 17:49:31 +0000 (14:49 -0300)]
cli: generalize use of GMIME_SIGNATURE_{ERROR,STATUS} to gmime-3

The ERROR enum is merged into to the STATUS enum, and the set of flags
is different.

3 years agoutil: fake gmime-2.6 compatible API for gmime-3.0
David Bremner [Sat, 6 May 2017 11:54:32 +0000 (08:54 -0300)]
util: fake gmime-2.6 compatible API for gmime-3.0

Several functions have added arguments which accept NULL and provide
hopefully sensible defaults. Use macros to minimize source changes.

3 years agocli: replace use of g_mime_message_get_recipients
David Bremner [Sat, 6 May 2017 11:41:14 +0000 (08:41 -0300)]
cli: replace use of g_mime_message_get_recipients

This function, and associated enum, have been renamed and generalized
in gmime-3.0.

3 years agolib/cli: replace use of g_mime_message_get_sender
David Bremner [Sat, 6 May 2017 02:26:57 +0000 (23:26 -0300)]
lib/cli: replace use of g_mime_message_get_sender

This function changes semantics in gmime-3.0 so make a new function
that provides the same functionality in both

3 years agocli: replace use of g_mime_message_get_reply_to
David Bremner [Thu, 4 May 2017 18:59:37 +0000 (14:59 -0400)]
cli: replace use of g_mime_message_get_reply_to

This function changes signature in gmime 3.0, so we provide two new
functions, one for each signature.

3 years agocli: replace use of g_mime_message_get_date_as_string
David Bremner [Thu, 4 May 2017 12:48:44 +0000 (08:48 -0400)]
cli: replace use of g_mime_message_get_date_as_string

This function goes away in gmime-3.0. Also, the memory management is
apparently error prone, witness the memory leak in notmuch-reply.

3 years agotest/crypto: mark extra space in userid as a bug in gmime-2.6
David Bremner [Sat, 3 Jun 2017 00:29:25 +0000 (21:29 -0300)]
test/crypto: mark extra space in userid as a bug in gmime-2.6

I can't see the space in the output of gpg -K --with-colons

3 years agocli: add space separator for keyword, string, and int arguments
David Bremner [Sat, 1 Jul 2017 15:18:45 +0000 (12:18 -0300)]
cli: add space separator for keyword, string, and int arguments

Defer the complication of optional boolean arguments for later (never?).

3 years agocli: change api of parse_option
David Bremner [Sat, 1 Jul 2017 15:18:44 +0000 (12:18 -0300)]
cli: change api of parse_option

The idea is to allow it (in a future commit) advance to the next argv
element to get a value

3 years agocli/show: convert keyword options to booleans
David Bremner [Sat, 1 Jul 2017 15:18:43 +0000 (12:18 -0300)]
cli/show: convert keyword options to booleans

There are two keyword options here that impliment boolean options. It
is simpler to use the built-in boolean argument handling, and also
more robust against divergence in parsing boolean and keyword arguments.

3 years agoemacs: tree: drop repeated "of" from docstring
Kyle Meyer [Sat, 8 Jul 2017 01:01:59 +0000 (21:01 -0400)]
emacs: tree: drop repeated "of" from docstring

3 years agodebian: drop notmuch-dbg
David Bremner [Thu, 6 Jul 2017 11:30:09 +0000 (08:30 -0300)]
debian: drop notmuch-dbg

notmuch-dbgsym should be auto generated now.

3 years agotest/crypto: add test for corrupted signatures
David Bremner [Sat, 3 Jun 2017 17:47:40 +0000 (14:47 -0300)]
test/crypto: add test for corrupted signatures

Have an empty list of signatures is not the nicest mechanism to signal
complete failure to verify, but it's the one we currently have.

3 years agotest: add test for modified pgp/mime signed message
David Bremner [Sat, 3 Jun 2017 17:47:39 +0000 (14:47 -0300)]
test: add test for modified pgp/mime signed message

This is a good thing to test in any case, but particularly as we hit
the dark corners of the gmime crypto API.

3 years agotest: mark test as broken in gmime 3.0
David Bremner [Sat, 3 Jun 2017 17:47:37 +0000 (14:47 -0300)]
test: mark test as broken in gmime 3.0

Currently I'm not sure what the intent of this test is, so it's not
clear if the new answer is better or worse than the old one.

3 years agotest: mark inclusion of headers as broken in gmime-2.x
David Bremner [Sat, 3 Jun 2017 17:47:36 +0000 (14:47 -0300)]
test: mark inclusion of headers as broken in gmime-2.x

The output of headers here reflects an underlying bug / quirk of

3 years agotest/multipart: reorganize creation of multipart message
David Bremner [Sat, 3 Jun 2017 17:47:35 +0000 (14:47 -0300)]
test/multipart: reorganize creation of multipart message

We want to have the bodies of the multipart available in a file on
their own for planned modifications to tests.

3 years agocli: implement structured output version 4
David Bremner [Sat, 3 Jun 2017 17:47:34 +0000 (14:47 -0300)]
cli: implement structured output version 4

Since the error field is unused by the emacs front end, no changes are
needed other than bumping the format version number.

As it is, this is a bit overengineered, but it will reduce duplication
when we support gmime 3.0

3 years agodevel/schemata: describe version 4
David Bremner [Sat, 3 Jun 2017 17:47:33 +0000 (14:47 -0300)]
devel/schemata: describe version 4

Replace numeric errors with human readable flags.  Not all sig_error
keys will necessarily be generated with a given version of gmime.

Drop status "none" as it's currrently unused and I don't know what
it's for.

3 years agoemacs: convert to use format-version 3
David Bremner [Sat, 3 Jun 2017 17:47:32 +0000 (14:47 -0300)]
emacs: convert to use format-version 3

Keeping the emacs interface running old format-versions makes it
impossible to test new format-versions or deprecate old ones.

3 years agoMerge branch 'release'
David Bremner [Tue, 4 Jul 2017 00:35:05 +0000 (21:35 -0300)]
Merge branch 'release'

3 years agodebian: upload 0.24.2-2 debian/0.24.2-2
David Bremner [Sun, 2 Jul 2017 15:49:06 +0000 (12:49 -0300)]
debian: upload 0.24.2-2

Just a no-change rebuild.

3 years agoMerge branch 'debian'
David Bremner [Sun, 2 Jul 2017 13:50:17 +0000 (10:50 -0300)]
Merge branch 'debian'

merge in changes from 0.23.7-3 debian upload

3 years agolib/index: add simple html filter
David Bremner [Thu, 8 Jun 2017 02:11:49 +0000 (23:11 -0300)]
lib/index: add simple html filter

The filter just drops all (HTML) tags. As an enabling change, pass the
content type to the filter constructor so we can decide which scanner
to user.

3 years agolib/ generalize filter state machine
David Bremner [Thu, 8 Jun 2017 02:11:48 +0000 (23:11 -0300)]
lib/ generalize filter state machine

To match things more complicated than fixed strings, we need states
with multiple out arrows.

3 years agolib/index: separate state table definition from scanner.
David Bremner [Thu, 8 Jun 2017 02:11:47 +0000 (23:11 -0300)]
lib/index: separate state table definition from scanner.

We want to reuse the scanner definition with a different table.  This
is mainly code movement, and making the state table part of the filter

3 years agolib/index: generalize name of indexing filter
David Bremner [Thu, 8 Jun 2017 02:11:46 +0000 (23:11 -0300)]
lib/index: generalize name of indexing filter

In followup commits we will generalize the functionality of this
filter to deal with other types of non-indexable content.

3 years agoFix minor mistake where indentation width is ignored
Tom Hinton [Thu, 29 Jun 2017 14:08:25 +0000 (14:08 +0000)]
Fix minor mistake where indentation width is ignored

3 years agoAdd indentation to imenu in notmuch-show
Damien Cassou [Sun, 18 Jun 2017 10:04:35 +0000 (12:04 +0200)]
Add indentation to imenu in notmuch-show

3 years agoremove extra space in Emacs prompt
Piotr Trojanek [Fri, 16 Jun 2017 12:57:05 +0000 (13:57 +0100)]
remove extra space in Emacs prompt

Trivial: fix extra space in the "Insert failed" Emacs prompt message.

3 years agofix wrong printf formatting of signed/unsigned integers
Piotr Trojanek [Fri, 16 Jun 2017 22:50:25 +0000 (23:50 +0100)]
fix wrong printf formatting of signed/unsigned integers

3 years agoremove ineffective assignments
Piotr Trojanek [Fri, 16 Jun 2017 22:50:24 +0000 (23:50 +0100)]
remove ineffective assignments

Detected by cppcheck.

3 years agofix leaks due to missing invocations of va_end
Piotr Trojanek [Fri, 16 Jun 2017 22:50:23 +0000 (23:50 +0100)]
fix leaks due to missing invocations of va_end

As the Linux man page states: "Each invocation of va_start() must be
matched by a corresponding invocation of va_end() in the same
function." Detected by cppcheck.

3 years agominor whitespace cleanups
Piotr Trojanek [Fri, 16 Jun 2017 22:50:22 +0000 (23:50 +0100)]
minor whitespace cleanups

3 years agoAdd Emacs' imenu support in notmuch-show and notmuch-search
Damien Cassou [Mon, 12 Jun 2017 13:30:10 +0000 (15:30 +0200)]
Add Emacs' imenu support in notmuch-show and notmuch-search

Emacs' major modes can facilitate navigation in their buffers by
supporting Imenu. In such major modes, launching Imenu (M-x imenu)
makes Emacs display a list of items (e.g., function definitions in a
code buffer). Selecting an item from this list moves point to this

This patch adds Imenu support to both notmuch-show and notmuch-search

* in notmuch-show, Imenu will present a list of all messages in the
  currently visible thread;

* in notmuch-search, Imenu will present a list of all messages in the
  search buffer.

3 years agoMerge branch 'release'
David Bremner [Thu, 1 Jun 2017 10:54:38 +0000 (07:54 -0300)]
Merge branch 'release'

3 years agofixup! NEWS: news for 0.24.2 0.24.2 debian/0.24.2-1
David Bremner [Thu, 1 Jun 2017 10:32:10 +0000 (07:32 -0300)]
fixup! NEWS: news for 0.24.2

3 years agodebian: changelog for 0.24.2-1
David Bremner [Thu, 1 Jun 2017 10:25:56 +0000 (07:25 -0300)]
debian: changelog for 0.24.2-1

3 years agoNEWS: news for 0.24.2
David Bremner [Thu, 1 Jun 2017 10:19:46 +0000 (07:19 -0300)]
NEWS: news for 0.24.2

3 years agoversion: bump to 0.24.2
David Bremner [Thu, 1 Jun 2017 10:13:00 +0000 (07:13 -0300)]
version: bump to 0.24.2

3 years agocli/dump: don't include tags when not asked for
David Bremner [Mon, 8 May 2017 01:44:23 +0000 (22:44 -0300)]
cli/dump: don't include tags when not asked for

Add in the analogous test for tags that is given for properties a few
lines below.

3 years agotest: add known broken test --include=properties
David Bremner [Mon, 8 May 2017 01:44:22 +0000 (22:44 -0300)]
test: add known broken test --include=properties

Reported in [1], --include=properties currently implies
--include=tags, but it should not.


3 years agotest: define GMime version dependant breakage
David Bremner [Sat, 27 May 2017 16:51:18 +0000 (13:51 -0300)]
test: define GMime version dependant breakage

We have some tests where the gmime 3 behaviour seems like a bug fix,
others where it's less clear, so we allow both possibilities.

3 years agoconfigure: add optional support for gmime-3.0
David Bremner [Sat, 27 May 2017 16:51:17 +0000 (13:51 -0300)]
configure: add optional support for gmime-3.0

This is only the changes to make configure work; it won't compile with
gmime-3.0 yet.

3 years agotest/thread-naming: remove excess escaping from sender address.
David Bremner [Sat, 27 May 2017 16:51:16 +0000 (13:51 -0300)]
test/thread-naming: remove excess escaping from sender address.

This is another case where the behaviour of gmime-2.6 and gmime-3.0
seems to differ. It may be that we prefer the more lax parsing of the
previous version, but that should be tested separately.

3 years agocli/reply: fix two memory leaks, document a third
David Bremner [Sat, 27 May 2017 16:51:15 +0000 (13:51 -0300)]
cli/reply: fix two memory leaks, document a third

internet_address_list_to_string returns an allocated string, which
needs to be freed with g_free. g_free can handle a NULL argument, so
we follow the usage elsewhere of calling it unconditionally.

The third leak we leave as it would require restructuring of
add_recipients_from_message, and is fixed by later gmime-3.0 porting.

3 years agoperf-test: add memory test for reply
David Bremner [Sat, 27 May 2017 16:51:14 +0000 (13:51 -0300)]
perf-test: add memory test for reply

Looking at the code for notmuch-reply, there seems to be several gmime
related memory leaks. This test is supposed to help eliminate those.

3 years agocli/show: use single stream for printf / gmime object output
David Bremner [Sat, 27 May 2017 16:51:13 +0000 (13:51 -0300)]
cli/show: use single stream for printf / gmime object output

This is again motivated by the need to transition away from
GMimeStreamFile for output to stdout.

format_part_mbox is left alone for now, as this cannot be mixed in
with output using gmime object output.

3 years agocli/reply: direct all output for text format to gmime stream
David Bremner [Sat, 27 May 2017 16:51:12 +0000 (13:51 -0300)]
cli/reply: direct all output for text format to gmime stream

Interleaving printfs with writes to the gmime stream worked when the
gmime stream was backed by the FILE *stdout, but that is no longer the
case.  Create one stream and pass it into the two functions where
needed, as well well as replacing printfs with g_mime_stream_printf.

3 years agoutil: convenience function to create gmime stream for stdout
David Bremner [Sat, 27 May 2017 16:51:11 +0000 (13:51 -0300)]
util: convenience function to create gmime stream for stdout

It turns out that our use of GMimeStreamPipe has only succeeded
because gmime has been ignoring some seek failures; this will no
longer be the case in gmime 3.0, so we use a GMimeStreamPipe, which
does not assume seekability, wrapped in a buffering stream.

3 years agoemacs: with prefix argument, notmuch-show-stash-date stashes timestamp
Tomi Ollila [Sat, 8 Apr 2017 18:33:43 +0000 (21:33 +0300)]
emacs: with prefix argument, notmuch-show-stash-date stashes timestamp

Using timestamp of a message is useful in many Xapian queries.

3 years agoexit lingering gpg agents at the end of relevant tests
Tomi Ollila [Tue, 23 May 2017 18:54:25 +0000 (21:54 +0300)]
exit lingering gpg agents at the end of relevant tests

Since gnupg 2.1.20, gpg-agent no longer shut itself down when
$GNUPGHOME directory is removed.

Add exit hooks to the test modules which execute `gpgconf --kill all`

Add exit hooks to execute `gpgconf --kill all` in the modules that
create $GNUPGHOME for gpg to work with.

3 years add "atexit" functionality
Tomi Ollila [Tue, 23 May 2017 18:54:24 +0000 (21:54 +0300)] add "atexit" functionality

New function at_exit_function registers given function to be called
at script termination.

Functions so registered are called in the reverse order of their
registration; no arguments are passed.

Function is called only once; re-adding with function name already
registered will remove previous registration.

New function rm_exit_function can be used to remove registration.

Modules (and possibly functions) in future commits will
register such functions.

4 years agoMerge branch 'release'
David Bremner [Sat, 13 May 2017 11:51:10 +0000 (08:51 -0300)]
Merge branch 'release'

Emacs bug fix from Mark

4 years agoemacs: tree: bugfix: specify --format-version
Mark Walters [Sat, 15 Apr 2017 15:49:46 +0000 (16:49 +0100)]
emacs: tree: bugfix: specify --format-version

Previously notmuch tree did not specify the format-version when
calling notmuch. This meant that when the structured output was
slightly changed (in commit 14c60cf168ac3b0f277188c16e6012b7ebdadde7)
stash filename broke. This fixes this breakage by specifying the

4 years agobuild: visibility=default for library structs is no longer needed
Jani Nikula [Wed, 10 May 2017 19:42:12 +0000 (22:42 +0300)]
build: visibility=default for library structs is no longer needed

Commit d5523ead90b6 ("Mark some structures in the library interface
with visibility=default attribute.") fixed some mixed visibility
issues with structs. With the symbol default visibility reversed, this
is no longer a problem.

4 years agobuild: switch to hiding libnotmuch symbols by default
Jani Nikula [Wed, 10 May 2017 19:42:11 +0000 (22:42 +0300)]
build: switch to hiding libnotmuch symbols by default

The dynamic generation of the linker version script for libnotmuch
exports has grown rather complicated.

Reverse the visibility control by hiding symbols by default using
-fvisibility=hidden, and explicitly exporting symbols in notmuch.h
using #pragma GCC visibility. (We could also use __attribute__
((visibility ("default"))) for each exported function, but the pragma
is more convenient.)

The above is not quite enough alone, as it would "leak" a number of
weak symbols from Xapian and C++ standard library. Combine it with a
small static version script that filters out everything except the
notmuch_* symbols that we explicitly exposed, and the C++ RTTI
typeinfo symbols for exception handling.

Finally, as the symbol hiding test can no longer look at the generated
symbol table, switch the test to parse the functions from notmuch.h.

4 years agocompat: don't include compat.h from the feature test source
Jani Nikula [Wed, 10 May 2017 19:42:10 +0000 (22:42 +0300)]
compat: don't include compat.h from the feature test source

The feature test code should test the build environment, and none of
the compat code should interfere with that. Don't include compat.h
from the feature test source. There should be no functional changes
here, but this is just the right thing to do.

4 years agobuild: do not export compat functions from lib
Jani Nikula [Wed, 10 May 2017 19:42:09 +0000 (22:42 +0300)]
build: do not export compat functions from lib

Commits 9db214527213 ("lib/gen-version-script.h: add getline and
getdelim to notmuch.sym if needed") and 3242e29e57ac ("build: add
canonicalize_file_name to symbols exported from")
started exporting compat functions from libnotmuch so that the cli
could use them. But we shouldn't export such functions from the
library. They are not part of our ABI. Instead, the cli should include
its own copies of the compat functions.

4 years agolib: Add regexp expansion for for tags and paths
David Bremner [Wed, 8 Mar 2017 02:32:26 +0000 (22:32 -0400)]
lib: Add regexp expansion for for tags and paths

From a UI perspective this looks similar to what was already provided
for from, subject, and mid, but the implementation is quite
different. It uses the database's list of terms to construct a term
based query equivalent to the passed regular expression.

4 years agolib: Add regexp searching for mid: prefix
David Bremner [Wed, 15 Feb 2017 12:58:28 +0000 (08:58 -0400)]
lib: Add regexp searching for mid: prefix

The bulk of the change is passing in the field options to the regexp
field processor, so that we can properly handle the
fallback (non-regexp case).

4 years agotest: add known broken test for indexing html
David Bremner [Wed, 22 Mar 2017 11:23:00 +0000 (08:23 -0300)]
test: add known broken test for indexing html

'quite' on IRC reported that notmuch new was grinding to a halt during
initial indexing, and we eventually narrowed the problem down to some
html parts with large embedded images. These cause the number of terms
added to the Xapian database to explode (the first 400 messages
generated 4.6M unique terms), and of course the resulting terms are
not much use for searching.

The second test is sanity check for any "improved" indexing of HTML.