notmuch
6 years agolib: fix byte order test in libsha1.c
David Bremner [Sun, 24 Nov 2013 21:29:42 +0000 (17:29 -0400)]
lib: fix byte order test in libsha1.c

Previously PLATFORM_BYTE_ORDER and IS_LITTLE_ENDIAN were not defined,
so the little endian code was always compiled in.

This will have the effect that the "SHA1s" on big endian architectures
will change (i.e. become actual sha1s). So someone re-indexing their
database could conceivable lose tags on messages without a message-id
header.

6 years agodebian: disable gdb as a build-dependency on s390x
David Bremner [Sun, 24 Nov 2013 22:51:37 +0000 (18:51 -0400)]
debian: disable gdb as a build-dependency on s390x

Gdb is currently broken on s390x buildd's and porterboxes (see #728705).
By removing it as a build-dep, we disable the (failing) atomicity test on this
architecture

6 years agoAdd NEWS entry for notmuch-compact
Ben Gamari [Wed, 20 Nov 2013 14:05:07 +0000 (09:05 -0500)]
Add NEWS entry for notmuch-compact

Signed-off-by: Ben Gamari <bgamari.foss@gmail.com>
6 years agodebian: add notmuch_database_compact to symbols file. 0.17_rc1 debian/0.17_rc1-1
David Bremner [Thu, 21 Nov 2013 00:06:36 +0000 (20:06 -0400)]
debian: add notmuch_database_compact to symbols file.

This change does not require an SONAME bump because it only adds a symbol.

6 years agodebian: changelog stanza for release candidate
David Bremner [Wed, 20 Nov 2013 23:43:34 +0000 (19:43 -0400)]
debian: changelog stanza for release candidate

6 years agoversion: bump to 0.17~rc1
David Bremner [Wed, 20 Nov 2013 23:42:00 +0000 (19:42 -0400)]
version: bump to 0.17~rc1

Various other files are synched using "make update-versions".  NEWS
has to be hand edited.

6 years agoNEWS: remove blank line.
David Bremner [Wed, 20 Nov 2013 23:39:37 +0000 (19:39 -0400)]
NEWS: remove blank line.

Tomi says I have to.

6 years agotest: replace $PWD with YYY in emacs & emacs-show tests
David Bremner [Sat, 23 Nov 2013 11:01:16 +0000 (07:01 -0400)]
test: replace $PWD with YYY in emacs & emacs-show tests

When executed command line is written to *Notmuch errors* buffer,
shell-quote-argument will backslash-escape any char that is not in
"POSIX filename characters" (i.e. matching "[^-0-9a-zA-Z_./\n]").

Currently in two emacs tests shell has expanded $PWD as part of
emacs variable, which will later be fed to #'shell-quote-argument
and finally written to ERROR file. If $PWD contained non-POSIX
filename characters, data in ERROR file will not match $PWD when
later comparing in shell. Therefore, in these two particular cases
the escaped $PWD is replaced with YYY in ERROR file and expected
content is adjusted accordingly.

6 years agoemacs: show: stop stderr appearing in buffer
Mark Walters [Mon, 18 Nov 2013 21:10:33 +0000 (21:10 +0000)]
emacs: show: stop stderr appearing in buffer

In emacs 24.3+ the stdout/stderr from externally displaying an
attachment gets inserted into the show buffer. This is caused by
changes in mm-display-external in mm-decode.el.

Ideally, we would put this output in the notmuch errors buffer but the
handler is called asynchronously so we don't know when the output will
appear. Thus if we put it straight into the errors buffer it could get
interleaved with other errors. Also we can't easily tell when we
have got all the error output so can't wait until the process is complete.

One solution would be to create a new buffer for the stderr of each
attachment viewed. Again, since we can't tell when the process has
finished, we can't close these buffers automatically so this will
leave lots of buffers around.

Thus we add a debug variable notmuch-show-attachment-debug: it this is
non-nil we create a new buffer for each viewer; if this variable is
nil we just use a temp buffer which means all error output is
discarded (this is the same behaviour as with emacs pre 24.3).

6 years agovim: add help file
Felipe Contreras [Sat, 2 Nov 2013 13:47:12 +0000 (07:47 -0600)]
vim: add help file

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
6 years agovim: check compose is done on delete
Felipe Contreras [Sat, 2 Nov 2013 10:40:01 +0000 (04:40 -0600)]
vim: check compose is done on delete

Not on unload, which happens when we switch buffers.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
6 years agovim: remove unnecessary buffer queue
Felipe Contreras [Sat, 2 Nov 2013 10:38:33 +0000 (04:38 -0600)]
vim: remove unnecessary buffer queue

Vim handles the buffers just fine: when one is deleted, we go to the
previous one.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
6 years agovim: add wrapper for old variable names
Felipe Contreras [Sat, 2 Nov 2013 06:49:53 +0000 (00:49 -0600)]
vim: add wrapper for old variable names

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
6 years agovim: move default sets to set_defaults()
Felipe Contreras [Sat, 2 Nov 2013 06:52:22 +0000 (00:52 -0600)]
vim: move default sets to set_defaults()

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
6 years agovim: rename public notmuch_rb variables
Felipe Contreras [Sat, 2 Nov 2013 06:44:40 +0000 (00:44 -0600)]
vim: rename public notmuch_rb variables

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
6 years agovim: rename internal notmuch_rb variables
Felipe Contreras [Sat, 2 Nov 2013 06:42:53 +0000 (00:42 -0600)]
vim: rename internal notmuch_rb variables

Now we are the official one.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
6 years agovim: add option to compose new messages
Felipe Contreras [Mon, 14 Oct 2013 06:58:20 +0000 (01:58 -0500)]
vim: add option to compose new messages

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
6 years agovim: refactor open_reply()
Felipe Contreras [Mon, 14 Oct 2013 06:57:28 +0000 (01:57 -0500)]
vim: refactor open_reply()

In preparation for composing new messages.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
6 years agovim: trivial cleanup
Felipe Contreras [Mon, 14 Oct 2013 05:54:13 +0000 (00:54 -0500)]
vim: trivial cleanup

Using $email_address is more straight forward.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
6 years agovim: don't execute search if it's cancelled
Felipe Contreras [Mon, 14 Oct 2013 06:19:50 +0000 (01:19 -0500)]
vim: don't execute search if it's cancelled

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
6 years agovim: generate custom message-id
Felipe Contreras [Mon, 14 Oct 2013 06:19:05 +0000 (01:19 -0500)]
vim: generate custom message-id

Using Mail as a reference.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
6 years agovim: split $email_address
Felipe Contreras [Mon, 14 Oct 2013 05:52:51 +0000 (00:52 -0500)]
vim: split $email_address

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
6 years agovim: allow calling with arguments
Felipe Contreras [Mon, 14 Oct 2013 04:25:44 +0000 (23:25 -0500)]
vim: allow calling with arguments

For example:

  :NotMuch date:today

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
6 years agovim: add option to save the patches of a patch series
Felipe Contreras [Mon, 14 Oct 2013 03:38:38 +0000 (22:38 -0500)]
vim: add option to save the patches of a patch series

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
6 years agovim: use much clearer sort constant
Felipe Contreras [Sat, 12 Oct 2013 09:33:30 +0000 (04:33 -0500)]
vim: use much clearer sort constant

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
6 years agovim: show first message of the thread
Felipe Contreras [Sat, 12 Oct 2013 09:33:06 +0000 (04:33 -0500)]
vim: show first message of the thread

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
6 years agovim: refactor database handling
Felipe Contreras [Mon, 30 Sep 2013 21:06:48 +0000 (16:06 -0500)]
vim: refactor database handling

To minimize memory usage we need to destroy the queries and the
databases, so we should keep track of them.

Each buffer gets a database connection that is destroyed when the buffer
is destroyed, and all the queries along with it.

Ideally notmuch should destroy the queries when the database is
destroyed, but it's not doing that at the moment.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
6 years agovim: use notmuch fields
Felipe Contreras [Sun, 29 Sep 2013 18:20:37 +0000 (13:20 -0500)]
vim: use notmuch fields

They are better encoded than Ruby's Mail.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
6 years agovim: don't automatically refresh after tagging
Felipe Contreras [Sun, 29 Sep 2013 18:17:58 +0000 (13:17 -0500)]
vim: don't automatically refresh after tagging

This operation might take a while, and even if it only takes fractions
of a second, that's not what the user might want.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
6 years agovim: run mutt in default term
Charlie Allom [Mon, 21 May 2012 09:06:26 +0000 (10:06 +0100)]
vim: run mutt in default term

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
6 years agoNEWS: insert quotable parts in reply as they are displayed in show view
Jani Nikula [Sun, 17 Nov 2013 13:38:17 +0000 (15:38 +0200)]
NEWS: insert quotable parts in reply as they are displayed in show view

News for
commit 5c19eb46a906819744a022463ee3fd7cdfaabbb9
Author: Jani Nikula <jani@nikula.org>
Date:   Sun Sep 1 20:59:53 2013 +0300

    emacs: insert quotable parts in reply as they are displayed in show view

6 years agoemacs: do not put quoted reply in primary selection
Mark Walters [Sun, 17 Nov 2013 12:04:09 +0000 (12:04 +0000)]
emacs: do not put quoted reply in primary selection

In current emacs (24.3) select-active-regions is set to t by
default. The reply insertion code sets the region to the quoted
message to make it easy to delete (kill-region or C-w). These two
things combine to put the quoted message in the primary selection.

This is not what the user wanted and is a privacy risk (accidental
pasting of the quoted message). We can avoid some of the problems
by let-binding select-active-regions to nil. This fixes if the
primary selection was previously in a non-emacs window but not if
it was in an emacs window. To avoid the problem in the latter case
we deactivate mark.

One key test (which fails under many simpler "fixes") is: open emacs
24.3 with notmuch, open 2 windows (viewing different notmuch buffers),
highlight some text in one, and then reply to a message in the
other. In many of my earlier attempts to fix this big this test fails.

6 years agocompact: improve error messages on failures after compaction
Tomi Ollila [Thu, 14 Nov 2013 22:03:27 +0000 (00:03 +0200)]
compact: improve error messages on failures after compaction

The error messages written during the steps replacing old
database with new now includes relevant paths and strerror.

6 years agocompact: unconditionally remove old wip database compact directory
Tomi Ollila [Thu, 14 Nov 2013 22:03:26 +0000 (00:03 +0200)]
compact: unconditionally remove old wip database compact directory

In case previous notmuch compact has been interrupted there is old
work-in-progress database compact directory partially filled. Remove
it just before starting to fill the directory with new files.

6 years agocompact: preserve backup database until compacted database is in place
Tomi Ollila [Thu, 14 Nov 2013 22:03:25 +0000 (00:03 +0200)]
compact: preserve backup database until compacted database is in place

It is less error prone and window of failure opportunity is smaller
if the old (backup) database is always renamed (instead of sometimes
rmtree'd) before new (compacted) database is put into its place.
Finally rmtree() old database in case old database backup is not kept.

6 years agocompact: catch Xapian::Error consistently
Tomi Ollila [Wed, 13 Nov 2013 17:02:44 +0000 (19:02 +0200)]
compact: catch Xapian::Error consistently

catch Xapian::Error in compact code in lib/database.cc to be consistent
with other code in addition to not making software crash on uncaught
other Xapian error.

6 years agocompact: tidy formatting
Tomi Ollila [Wed, 13 Nov 2013 17:02:43 +0000 (19:02 +0200)]
compact: tidy formatting

Notmuch compact code whitespace changes to match devel/STYLE.

6 years agoNews for tree-view
Mark Walters [Sat, 16 Nov 2013 08:05:16 +0000 (08:05 +0000)]
News for tree-view

6 years agoemacs: tree: use remap for the over-ridden global bindings
Mark Walters [Tue, 12 Nov 2013 20:10:59 +0000 (20:10 +0000)]
emacs: tree: use remap for the over-ridden global bindings

Following a suggestion by Austin in id:20130915153642.GY1426@mit.edu
we use remap for the over-riding bindings in pick. This means that if
the user modifies the global keymap these modifications will happen in
the tree-view versions of them too.

[tree-view overrides these to do things like close the message pane
before doing the action, so the functionality is very close to the
original common keymap function.]

6 years agoemacs: help: add a special function to deal with remaps
Mark Walters [Tue, 12 Nov 2013 20:10:58 +0000 (20:10 +0000)]
emacs: help: add a special function to deal with remaps

remaps are a rather unusual keymap consisting of "first key" 'remap
and then "second-key" the remapped-function. Thus we do the
documentation for it separately.

6 years agoemacs: help: add base-keymap
Mark Walters [Tue, 12 Nov 2013 20:10:57 +0000 (20:10 +0000)]
emacs: help: add base-keymap

To support key remapping in emacs help we need to know the base keymap
when looking at the remapping. keep track of this while we recurse
down the sub-keymaps in help.

6 years agoemacs: help: split out notmuch-describe-key as a function
Mark Walters [Tue, 12 Nov 2013 20:10:56 +0000 (20:10 +0000)]
emacs: help: split out notmuch-describe-key as a function

The actual documentation function notmuch-describe-keymap was getting
rather complicated so split out the code for a single key into its own
function notmuch-describe-key.

6 years agoemacs: help: remove duplicate bindings
Mark Walters [Tue, 12 Nov 2013 20:10:55 +0000 (20:10 +0000)]
emacs: help: remove duplicate bindings

If the user (or a mode) overrides a keybinding from the common keymap
in one of the modes then both help lines appear in the help screen
even though only one of them is applicable.

Fix this by checking if we already have that key binding. We do this
by constructing an list of (key . docstring) pairs so it is easy to
check if we have already had that binding. Then the actual print help
routine changes these pairs into strings "key \t docstring"

6 years agoemacs: help: save-match-data
Mark Walters [Tue, 12 Nov 2013 20:10:54 +0000 (20:10 +0000)]
emacs: help: save-match-data

The routines that construct the help page in notmuch-lib rely on
match-data being preserved across some fairly complicated code. This
is currently valid but will not be when this series is finished. Thus
place everything between the string-match and replace-match inside a
save-match-data.

6 years agoemacs: help: check for nil key binding
Mark Walters [Tue, 12 Nov 2013 20:10:53 +0000 (20:10 +0000)]
emacs: help: check for nil key binding

A standard way to unset a key binding is local-unset-key which is equivalent to
  (define-key (current-local-map) key nil)

Currently notmuch-help gives an error and fails if a user has done this.

To fix this we only add a help line if the binding is non-nil.

6 years agoemacs: Correct documentation of `notmuch-poll-script'
Austin Clements [Wed, 13 Nov 2013 03:49:53 +0000 (22:49 -0500)]
emacs: Correct documentation of `notmuch-poll-script'

The functions referred to in the documentation for this variable were
replaced by the unified `notmuch-poll-and-refresh-this-buffer' in
21474f0e.  Update the documentation to reflect the new function.

6 years agoNEWS: emacs: fix notmuch-mua-reply point placement
Tomi Ollila [Wed, 13 Nov 2013 22:39:24 +0000 (00:39 +0200)]
NEWS: emacs: fix notmuch-mua-reply point placement

News for commit 4ceeaf8038ff241f438ad2a5d0bbda1c78aee385

Minor grammar edit by db.

6 years agoremove notmuch-pick
Mark Walters [Wed, 13 Nov 2013 12:51:27 +0000 (12:51 +0000)]
remove notmuch-pick

6 years agoAccumulated news for Austin's changes
Austin Clements [Tue, 12 Nov 2013 22:44:12 +0000 (17:44 -0500)]
Accumulated news for Austin's changes

6 years agocompletion: update bash completion
Jani Nikula [Wed, 6 Nov 2013 19:25:37 +0000 (21:25 +0200)]
completion: update bash completion

Update bash completion to cover new commands and options:

notmuch compact --quiet --backup=DIR
notmuch count --output=files --batch --input=FILE
notmuch insert --folder=DIR --create-folder
notmuch search --exclude=all --duplicate=N
notmuch show --include-html
notmuch tag --batch --input=FILE --remove-all

6 years agodevel/release-checks.sh: check NOTMUCH_(MAJOR|MINOR|MICRO)_VERSION
Tomi Ollila [Fri, 8 Nov 2013 17:30:56 +0000 (19:30 +0200)]
devel/release-checks.sh: check NOTMUCH_(MAJOR|MINOR|MICRO)_VERSION

New defines NOTMUCH_MAJOR_VERSION, NOTMUCH_MINOR_VERSION and
NOTMUCH_MICRO_VERSION were added to lib/notmuch.h.
Check that these match the current value defined in ./version.

6 years agoemacs: Fix search tagging races
Austin Clements [Thu, 24 Oct 2013 15:19:11 +0000 (11:19 -0400)]
emacs: Fix search tagging races

This fixes races in thread-local and global tagging in notmuch-search
(e.g., "+", "-", "a", "*", etc.).  Previously, these would modify tags
of new messages that arrived after the search.  Now they only operate
on the messages that were in the threads when the search was
performed.  This prevents surprises like archiving messages that
arrived in a thread after the search results were shown.

This eliminates `notmuch-search-find-thread-id-region(-search)'
because these functions strongly encouraged racy usage.

This fixes the two broken tests added by the previous patch.

6 years agoemacs: Add known-broken tests for search tagging races
Austin Clements [Thu, 24 Oct 2013 15:19:10 +0000 (11:19 -0400)]
emacs: Add known-broken tests for search tagging races

These tests check that both thread-local and global search tagging
operations are race-free.  They are currently known-broken because
they aren't race-free.

6 years agoAdd TODO about more efficient stable thread queries
Austin Clements [Thu, 24 Oct 2013 15:19:09 +0000 (11:19 -0400)]
Add TODO about more efficient stable thread queries

6 years agosearch: Add stable queries to thread search results
Austin Clements [Thu, 24 Oct 2013 15:19:08 +0000 (11:19 -0400)]
search: Add stable queries to thread search results

These queries will match exactly the set of messages currently in the
thread, even if more messages later arrive.  Two queries are provided:
one for matched messages and one for unmatched messages.

This can be used to fix race conditions with tagging threads from
search results.  While tagging based on a thread: query can affect
messages that arrived after the search, tagging based on stable
queries affects only the messages the user was shown in the search UI.

Since we want clients to be able to depend on the presence of these
queries, this ushers in schema version 2.

6 years agoemacs: Use notmuch tag --batch for large tag queries
Austin Clements [Thu, 24 Oct 2013 15:19:07 +0000 (11:19 -0400)]
emacs: Use notmuch tag --batch for large tag queries

(Unfortunately, it's difficult to first demonstrate this problem with
a known-broken test because modern Linux kernels have argument length
limits in the megabytes, which makes Emacs really slow!)

6 years agoemacs: Support passing input via `notmuch-call-notmuch-*'
Austin Clements [Thu, 24 Oct 2013 15:19:06 +0000 (11:19 -0400)]
emacs: Support passing input via `notmuch-call-notmuch-*'

This adds support for passing a string to write to notmuch's stdin to
`notmuch-call-notmuch-process' and `notmuch-call-notmuch-sexp'.  Since
this makes both interfaces a little more complicated, it also unifies
their documentation better.

6 years agoemacs: Move `notmuch-call-notmuch-process' to notmuch-lib
Austin Clements [Thu, 24 Oct 2013 15:19:05 +0000 (11:19 -0400)]
emacs: Move `notmuch-call-notmuch-process' to notmuch-lib

Previously, this was in notmuch.el, but all of the other notmuch call
wrappers were in notmuch-lib.el.  Move `notmuch-call-notmuch-process'
to live with its friends.  This happens to fix a missing dependency
from notmuch-tag.el, which required notmuch-lib, but not notmuch.

6 years agotest: Fix missing erase-buffer in emacs test
Austin Clements [Thu, 24 Oct 2013 15:19:04 +0000 (11:19 -0400)]
test: Fix missing erase-buffer in emacs test

The first subprocess error exit code test assumed the *Notmuch errors*
buffer would be empty.  Rather than assuming, make it so.

6 years agolib: Document extent of some return values
Austin Clements [Thu, 24 Oct 2013 15:19:03 +0000 (11:19 -0400)]
lib: Document extent of some return values

This documents the extent of the notmuch_messages_t* pointers returned
by notmuch_thread_get_toplevel_messages and
notmuch_thread_get_messages.

6 years agocli: Separate current and deprecated format version
Austin Clements [Thu, 24 Oct 2013 15:19:02 +0000 (11:19 -0400)]
cli: Separate current and deprecated format version

Previously, the CLI would print a deprecation warning if a client
requested any format version other than the current one.  However, if
we add fields that are backwards-compatible, but want clients to be
able to depend on, we need to bump the version, but that doesn't make
the older version deprecated.

Hence, separate out the "minimum active" version and only print a
warning for requests below this version number.

6 years agoschemata: Disambiguate non-terminal names
Austin Clements [Thu, 24 Oct 2013 15:19:01 +0000 (11:19 -0400)]
schemata: Disambiguate non-terminal names

Previously, the show schema and the search schema used different
"thread" non-terminals.  While these schemata don't interact, this is
still confusing, so rename search's "thread" to "thread_summary".  To
further limit confusion, prefix all top-level search non-terminals now
begin with "search_".

6 years agoman: document notmuch compact --quiet and --backup=DIRECTORY options
Jani Nikula [Wed, 6 Nov 2013 16:38:56 +0000 (18:38 +0200)]
man: document notmuch compact --quiet and --backup=DIRECTORY options

6 years agocli: add compact --quiet option and silence output with it
Jani Nikula [Wed, 6 Nov 2013 16:38:55 +0000 (18:38 +0200)]
cli: add compact --quiet option and silence output with it

Provide a way to silence the output.

6 years agolib: add library version check macro
Jani Nikula [Wed, 6 Nov 2013 19:01:41 +0000 (21:01 +0200)]
lib: add library version check macro

There have been some plans for making build incompatible changes to
the library API. This is inconvenient, but it is much more so without
a way to easily conditional build against multiple versions of
notmuch.

The macro has been lifted from glib.

6 years agoemacs: move the show entry to tree into show.el
Mark Walters [Fri, 1 Nov 2013 09:23:45 +0000 (09:23 +0000)]
emacs: move the show entry to tree into show.el

Move the keybinding and show specific helper from tree.el to show.el

6 years agoemacs: add z to common keymap
Mark Walters [Fri, 1 Nov 2013 09:23:44 +0000 (09:23 +0000)]
emacs: add z to common keymap

Add the main entry "z" to notmuch-tree to the common keymap.

6 years agoemacs: move search based tree functions to notmuch.el
Mark Walters [Fri, 1 Nov 2013 09:23:43 +0000 (09:23 +0000)]
emacs: move search based tree functions to notmuch.el

Move a couple of the search mode specifc caller helpers for tree from
tree into notmuch.el.

6 years agotest: tree: remove require from tests
Mark Walters [Fri, 1 Nov 2013 09:23:42 +0000 (09:23 +0000)]
test: tree: remove require from tests

Now tree is included by default we don't need to "require it" in the
test.

6 years agoemacs: minimal change to load notmuch-tree by default
Mark Walters [Fri, 1 Nov 2013 09:23:41 +0000 (09:23 +0000)]
emacs: minimal change to load notmuch-tree by default

We want to load notmuch-tree when notmuch is loaded, so include it as
a require in notmuch.el. To avoid circular dependency we need to move
one keybinding from notmuch-tree.el to notmuch.el: it makes sense for
it to be defined there anyway.

Since tree is now loaded by default there is no need to print a
message when it is loaded.

6 years agoemacs: tree: remove test for emacs from tree test
Mark Walters [Tue, 29 Oct 2013 22:55:33 +0000 (22:55 +0000)]
emacs: tree: remove test for emacs from tree test

Now the test is in mainline we can remove the check that emacs exists.

6 years agotest: move emacs-tree test into mainline
Mark Walters [Tue, 29 Oct 2013 22:55:32 +0000 (22:55 +0000)]
test: move emacs-tree test into mainline

We move the emacs-tree test and associated files into the main test
directory and add the test to the list in notmuch-test.

6 years agoemacs: add tree to the makefile
Mark Walters [Tue, 29 Oct 2013 22:55:31 +0000 (22:55 +0000)]
emacs: add tree to the makefile

6 years agoemacs: move notmuch-tree from contrib to mainline
Mark Walters [Tue, 29 Oct 2013 22:55:30 +0000 (22:55 +0000)]
emacs: move notmuch-tree from contrib to mainline

6 years agoemacs: tree: remove unneeded declarations
Mark Walters [Tue, 29 Oct 2013 22:55:29 +0000 (22:55 +0000)]
emacs: tree: remove unneeded declarations

There are some crufty declare-functions and requires in notmuch-tree:
since it requires notmuch.el itself this all works but in preparation
for the move to mainline tidy this up.

6 years agoemacs: move notmuch-help to lib
Mark Walters [Tue, 29 Oct 2013 22:55:28 +0000 (22:55 +0000)]
emacs: move notmuch-help to lib

notmuch-help is in notmuch.el not notmuch-lib.el and this is
incovenient for the way pick/tree uses it. I think lib makes more
sense anyway so move it there.

6 years agocli: add compact --backup=DIRECTORY option, don't backup by default
Jani Nikula [Sun, 3 Nov 2013 12:24:49 +0000 (14:24 +0200)]
cli: add compact --backup=DIRECTORY option, don't backup by default

It's the user's decision. The recommended way is to do a database dump
anyway. Clean up the relevant printfs too.

6 years agocli: return error status if compaction fails
Jani Nikula [Sun, 3 Nov 2013 12:24:48 +0000 (14:24 +0200)]
cli: return error status if compaction fails

As is customary for any tool.

6 years agolib: use the compaction backup path provided by the caller
Jani Nikula [Sun, 3 Nov 2013 12:24:47 +0000 (14:24 +0200)]
lib: use the compaction backup path provided by the caller

The extra path component added by the lib is a magic value that the
caller just has to know. This is demonstrated by the current code,
which indeed has "xapian.old" both sides of the interface. Use the
backup path provided by the lib caller verbatim, without adding
anything to it.

6 years agolib: update documentation of callback functions for database_compact and database_upg...
David Bremner [Sun, 3 Nov 2013 12:24:46 +0000 (14:24 +0200)]
lib: update documentation of callback functions for database_compact and database_upgrade.

Compact was missing callback documentation entirely, and upgrade did not discuss the
closure parameter.

6 years agolib: add closure parameter to compact status update callback
Jani Nikula [Sun, 3 Nov 2013 12:24:45 +0000 (14:24 +0200)]
lib: add closure parameter to compact status update callback

This provides much more flexibility for the caller.

6 years agolib: do not leak the database in compaction
Jani Nikula [Sun, 3 Nov 2013 12:24:44 +0000 (14:24 +0200)]
lib: do not leak the database in compaction

Destroy instead of close the database after compaction, and also on
error path, to not leak the database.

6 years agolib: check talloc success in compact
Jani Nikula [Sun, 3 Nov 2013 12:24:43 +0000 (14:24 +0200)]
lib: check talloc success in compact

In line with the allocation checks all around.

6 years agolib: construct compactor within try block to catch any exceptions
Jani Nikula [Sun, 3 Nov 2013 12:24:42 +0000 (14:24 +0200)]
lib: construct compactor within try block to catch any exceptions

Constructors may also throw exceptions. Catch them.

6 years agotest: fix compact backup / restore test
David Bremner [Sun, 3 Nov 2013 12:24:41 +0000 (14:24 +0200)]
test: fix compact backup / restore test

It was looking in completely the wrong place for the backup and the
(test) xapian database. Unfortunately test_begin_subtest hides the
relevant errors.

6 years agoquery: bind queries to database objects
Felipe Contreras [Mon, 30 Sep 2013 16:04:21 +0000 (11:04 -0500)]
query: bind queries to database objects

The queries don't really work after a database is closed, and we would
like them to be freed if the database is destroyed.

Acknowledged-by: David Bremner <david@tethera.net>
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
6 years agotest: Add compact test
Ben Gamari [Thu, 31 Oct 2013 04:10:08 +0000 (00:10 -0400)]
test: Add compact test

Signed-off-by: Ben Gamari <bgamari.foss@gmail.com>
6 years agolib: fix build on !HAVE_XAPIAN_COMPACT
Jani Nikula [Mon, 28 Oct 2013 14:09:19 +0000 (15:09 +0100)]
lib: fix build on !HAVE_XAPIAN_COMPACT

Minimal change to build notmuch against xapian that doesn't have
compaction support.

6 years agopick: rename test emacs-pick to emacs-tree
Mark Walters [Sat, 26 Oct 2013 22:02:08 +0000 (23:02 +0100)]
pick: rename test emacs-pick to emacs-tree

Also fixup run-tests.sh

6 years agopick: rename test outputs from pick to tree
Mark Walters [Sat, 26 Oct 2013 22:02:07 +0000 (23:02 +0100)]
pick: rename test outputs from pick to tree

Rename all the test output files to tree rather than pick, move the
containing directory to a tree.expected-output and fix up the
references in the test.

6 years agopick: Change the test names and print out for pick tests
Mark Walters [Sat, 26 Oct 2013 22:02:06 +0000 (23:02 +0100)]
pick: Change the test names and print out for pick tests

Change from the pick name to the tree name

6 years agocontrib: pick: move lisp names from pick to tree
Mark Walters [Sat, 26 Oct 2013 22:02:05 +0000 (23:02 +0100)]
contrib: pick: move lisp names from pick to tree

This changes all the lisp names from pick to tree (variables,
functions etc). It also changes the lisp in the emacs-pick test files
to match the new names.

6 years agonew: Don't scan unchanged directories with no sub-directories
Austin Clements [Thu, 24 Oct 2013 21:38:59 +0000 (17:38 -0400)]
new: Don't scan unchanged directories with no sub-directories

This can substantially reduce the cost of notmuch new in some
situations, such as when the file system cache is cold or when the
Maildir is on NFS.

6 years agoemacs: Add a space after completed tag operations
Austin Clements [Thu, 24 Oct 2013 21:30:27 +0000 (17:30 -0400)]
emacs: Add a space after completed tag operations

Previously, when a user fully completed a tag operation, they had to
press space to begin entering another tag operation.  This is
different from, say, shell file name completion, which typically
inserts a space after an unambiguous completion under the assumption
that the user will want to enter more input.

This patch tweaks `notmuch-read-tag-changes' to act more like shell
file name completion: after an unambiguous tag completion, it now
inserts a space, ready and waiting for another tagging operation from
the user.  This is backwards-compatible with old habits, since there's
no harm in putting an extra space.

6 years agoemacs: Sanitize authors and subjects in search and show
Austin Clements [Fri, 11 Oct 2013 13:53:39 +0000 (09:53 -0400)]
emacs: Sanitize authors and subjects in search and show

Authors and subjects can contain embedded, encoded control characters
like "\n" and "\t" that mess up display.  Transform control characters
into spaces everywhere we display them in search and show.

6 years agoemacs: Remove interactive behavior of `notmuch-tag'
Austin Clements [Wed, 23 Oct 2013 00:22:01 +0000 (20:22 -0400)]
emacs: Remove interactive behavior of `notmuch-tag'

We no longer use this, since we've lifted all interactive behavior to
the appropriate interactive entry points.  Because of this,
`notmuch-tag' also no longer needs to return the tag changes list,
since the caller always passes it in.

6 years agopick: Use interactive specifications for tag changes
Austin Clements [Wed, 23 Oct 2013 00:22:00 +0000 (20:22 -0400)]
pick: Use interactive specifications for tag changes

6 years agopick: Use list form of tag-changes in test
Austin Clements [Wed, 23 Oct 2013 00:21:59 +0000 (20:21 -0400)]
pick: Use list form of tag-changes in test

Currently we support both string and list forms of tag-changes for
historical reasons.  This is about to change, so fix pick's tests that
use the legacy string form of tag-changes.

6 years agopick: Fix incorrect use of `notmuch-pick-tag'
Austin Clements [Wed, 23 Oct 2013 00:21:58 +0000 (20:21 -0400)]
pick: Fix incorrect use of `notmuch-pick-tag'

`notmuch-pick-tag' takes a list of tag changes, but
`notmuch-pick-archive-message' passes it a &rest argument.  This
happens to work if `notmuch-archive-tags' contains a single tag (which
it usually does), but will break if it does not.

6 years agoemacs: Use interactive specifications for tag changes in search
Austin Clements [Wed, 23 Oct 2013 00:21:57 +0000 (20:21 -0400)]
emacs: Use interactive specifications for tag changes in search

This is similar to the previous commit, but applies to search.

Search is somewhat more complicated because its tagging operations can
also apply to a region.  Hence, this lifts interactive prompting into
a helper function.  This also takes advantage of the new ability to
provide a prompt to distinguish tagging a single thread from tagging a
region of threads.