]> git.notmuchmail.org Git - notmuch/log
notmuch
10 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.

10 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.

10 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.

10 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.

10 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>
10 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>
10 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.

10 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

10 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.

10 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

10 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.

10 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.

10 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.

10 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.

10 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.

10 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

10 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.

10 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.

10 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.

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

This modifies all tagging operations in show to call
`notmuch-read-tag-changes' in their interactive specification to input
tag changes, rather than depending on lower-level functions to prompt
for tag changes regardless of their calling context.

Besides being more Elispy and providing a more consistent programmatic
API, this enables callers to provide two call site-specific pieces of
information: an appropriate prompt, and the set of visible tags.  The
prompt lets us differentiate * from +/-.  Providing visible tags
enables a more consistent user experience than retrieving the
(potentially different) tags from the database, and avoids a
round-trip to the CLI and database.

10 years agoemacs: Take prompt and current tags in `notmuch-read-tag-changes'
Austin Clements [Wed, 23 Oct 2013 00:21:55 +0000 (20:21 -0400)]
emacs: Take prompt and current tags in `notmuch-read-tag-changes'

This modifies the interface of `notmuch-read-tag-changes' to take an
optional prompt string as well as a list of existing tags instead of a
query.  This list of tags is used to populate the tag removal
completions and lets the caller compute these in a more
efficient/consistent manner than performing a potentially large or
complex query.  This patch also updates the sole current caller of
`notmuch-read-tag-changes'.

10 years agoemacs: Fix misuse of `notmuch-tag'
Austin Clements [Wed, 23 Oct 2013 00:21:54 +0000 (20:21 -0400)]
emacs: Fix misuse of `notmuch-tag'

The calling convention for `notmuch-tag' changed in commit 97aa3c06 to
take a list of tag changes instead of a &rest argument, but the call
from `notmuch-search-tag-all' still passed a &rest argument.  This
happened to work for interactive calls because tag-changes would be
nil, so the `apply' call would pass only the query string to
`notmuch-tag' and simply omit the &optional tag-changes argument.

10 years agoperf: Clean corpus and caches in distclean, not clean
Austin Clements [Tue, 22 Oct 2013 00:55:38 +0000 (20:55 -0400)]
perf: Clean corpus and caches in distclean, not clean

Previously, we cleaned the downloaded performance corpus and the
cached indexes on 'make clean'.  This seems heavy-handed, since these
take a long time to download, unpack, and index.  They also aren't
make targets to begin with.  Move cleaning these to 'make distclean'.
This isn't exactly the right meaning of "distclean", but it's closer.

10 years agoPlace extra_cflags before CONFIGURE_CFLAGS
Moritz Wilhelmy [Tue, 15 Oct 2013 07:30:45 +0000 (09:30 +0200)]
Place extra_cflags before CONFIGURE_CFLAGS

This ensures that the build will not attempt to use an existing notmuch.h when
an older version of notmuch is already installed elsewhere (e.g. in /usr/local)
and /usr/local/include is added to CONFIGURE_CFLAGS by one of the libraries
(talloc, in my case)

10 years agoemacs: show: use interactive instead of current-prefix-arg
Mark Walters [Sun, 13 Oct 2013 07:39:12 +0000 (08:39 +0100)]
emacs: show: use interactive instead of current-prefix-arg

Currently notmuch-show looks at the prefix-arg directly via
current-prefix-arg. This changes it to use the interactive
specification.

One test (for elide-toggle functionality) set the prefix arg
directly. Update this test to set the new argument directly.

10 years agocontrib: pick: update notmuch-show calls
Mark Walters [Sun, 13 Oct 2013 07:49:00 +0000 (08:49 +0100)]
contrib: pick: update notmuch-show calls

Remove some unneeded nil arguments in notmuch-show calls.

10 years agotest: set mail host in emacs_deliver
Mark Walters [Sat, 12 Oct 2013 07:36:30 +0000 (08:36 +0100)]
test: set mail host in emacs_deliver

One test (reply to encrypted message in the crypto test) recently
started failing on some systems. The failure I saw were two extra
lines of the form
<87d2nbc5xg.fsf@host.i-did-not-set--mail-host-address--so-tickle-me>

The test pipes the output through

grep -v -e '^In-Reply-To:' -e '^References:'

which would normally these two ids but it does not, in this case,
because they are so long they get put on a separate line in the output.

To fix this we set mail-host-address for emacs deliver. example.com
seems a sensible address to use. This is short enough that we don't
get the line breaks above and the tests then all pass.

10 years agoemacs: distinguish tag `flagged' on terminal
Gregor Zattler [Wed, 4 Sep 2013 17:06:55 +0000 (19:06 +0200)]
emacs: distinguish tag `flagged' on terminal

Change foreground color to `blue' like lines representing threads
with flagged messages in notmuch-search.  Before tag `flagged' was
shown in notmuch-show buffers as image star on graphical frames while
there was no visible distinction to other flags on terminal frames.

10 years agoemacs: Improved `notmuch-describe-keymap' documentation
Austin Clements [Mon, 7 Oct 2013 22:48:51 +0000 (18:48 -0400)]
emacs: Improved `notmuch-describe-keymap' documentation

10 years agonotmuch-compact: Add man page
Ben Gamari [Wed, 2 Oct 2013 20:30:48 +0000 (16:30 -0400)]
notmuch-compact: Add man page

Signed-off-by: Ben Gamari <bgamari.foss@gmail.com>
10 years agonotmuch-compact: Initial commit of CLI
Ben Gamari [Wed, 2 Oct 2013 20:30:47 +0000 (16:30 -0400)]
notmuch-compact: Initial commit of CLI

Introduce the user command exposing the new compaction facility.

Signed-off-by: Ben Gamari <bgamari.foss@gmail.com>
10 years agodatabase: Add notmuch_database_compact_close
Ben Gamari [Wed, 2 Oct 2013 20:30:46 +0000 (16:30 -0400)]
database: Add notmuch_database_compact_close

This function uses Xapian's Compactor machinery to compact the notmuch
database. The compacted database is built in a temporary directory and
later moved into place while the original uncompacted database is
preserved.

Signed-off-by: Ben Gamari <bgamari.foss@gmail.com>
10 years agoNews for Emacs help improvements
Austin Clements [Sun, 6 Oct 2013 03:22:48 +0000 (23:22 -0400)]
News for Emacs help improvements

10 years agoemacs: Improve interactive use documentation
Austin Clements [Sun, 6 Oct 2013 03:22:47 +0000 (23:22 -0400)]
emacs: Improve interactive use documentation

This improves the function documentation for many interactive
commands, either by improving their documentation string where the
improvement also makes sense for programmatic use or by adding a
'notmuch-doc property where it doesn't.

For nearly all commands that support a prefix argument, this adds a
'notmuch-prefix-doc property to document their prefixed behavior This
omits prefix documentation for a few commands where I thought the
prefixed behavior was too obscure (or too complex to fit in one line).

10 years agoemacs: Support overriding help and describing prefix action
Austin Clements [Sun, 6 Oct 2013 03:22:46 +0000 (23:22 -0400)]
emacs: Support overriding help and describing prefix action

Traditionally, function documentation strings are intended primarily
for programmers, rather than users.  They're written from the
perspective of calling the function, not interactively invoking it.
They're only ever displayed along with the function prototype (and
often refer to argument names).  And built-in help commands like
`describe-bindings' show the name of the command, not its
documentation.

The notmuch help system is like `describe-bindings', but tries to be
more user-friendly by displaying documentation strings, rather than
Elisp command names.  For most commands, this is fine, but for some
the "programmer description" is inappropriate for interactive use.
This is particularly noticeable for commands that take an optional
prefix argument.

This patch adds support for two symbol properties: notmuch-doc and
notmuch-prefix-doc, which let a command override its interactive
documentation and provide separate documentation for its prefixed
invocation.  If notmuch-prefix-doc is present, we add an extra line to
the help giving the prefixed key sequence along with the documentation
for the prefixed command.

10 years agoemacs: Clean up a few documentation strings
Austin Clements [Sun, 6 Oct 2013 03:22:45 +0000 (23:22 -0400)]
emacs: Clean up a few documentation strings

Correct some grammatical errors, fix some violations of standard
documentation string formatting conventions, and be more precise.

10 years agoemacs: `notmuch-mua-new-reply' is also not interactive
Austin Clements [Sun, 6 Oct 2013 03:22:44 +0000 (23:22 -0400)]
emacs: `notmuch-mua-new-reply' is also not interactive

Like `notmuch-mua-new-forward-message', this is meant to be invoked
programmatically by something that can provide a reasonable query
string.

In fact, `notmuch-mua-new-reply's interactive specification didn't
match its arguments, so it wouldn't have worked interactively.

10 years agoemacs: `notmuch-mua-new-forward-message' is not interactive
Austin Clements [Sun, 6 Oct 2013 03:22:43 +0000 (23:22 -0400)]
emacs: `notmuch-mua-new-forward-message' is not interactive

`notmuch-mua-new-forward-message' must be called from a buffer
containing a raw RFC2822-formatted message to forward.  Hence, it's
intended to be invoked programmatically through something else that
sets up this buffer (like `notmuch-show-forward-message'), not
interactively.

Remove its interactive specification and update the documentation
string to mention the requirements on the current buffer.

10 years agocontrib: pick: remove temporary keybinding
Mark Walters [Mon, 23 Sep 2013 19:52:59 +0000 (20:52 +0100)]
contrib: pick: remove temporary keybinding

We would like to bind prefix-arg RET in search view to "pick show this
thread" (i.e. notmuch-pick-from-search-thread). It is not easy to do
this cleanly from contrib so I have been using M-RET instead.

Temporarily remove this functionality in preparation for entering
mainline and binding to prefix-arg RET.

10 years agocontrib: pick: move M-RET to prefix-arg RET
Mark Walters [Mon, 23 Sep 2013 19:52:58 +0000 (20:52 +0100)]
contrib: pick: move M-RET to prefix-arg RET

In pick the user has the option of showing the selected message in a
subpane (the message pane) or in the full frame. This is customisable
using the variable notmuch-pick-show-out. At the moment RET is bound
to the default option and M-RET the other option. This is
messy and involves tricks to make sure the keymap is setup at the
right time.

This changes this to prefix-arg RET for the other option which
simplifies the code and makes things cleaner.

10 years agocontrib: pick: tidy up pick-format-field
Mark Walters [Sun, 15 Sep 2013 08:41:17 +0000 (09:41 +0100)]
contrib: pick: tidy up pick-format-field

Previously this function used a temporary variable to store the return
value but we can just use the return value of the cond statement
directly.

The only tiny subtlety is that in one case (subject) we need to
slightly reorder the logic to make sure the formatted-field is the
last thing computed.

10 years agocontrib: pick: remove unused notmuch-pick-from-hello
Mark Walters [Sun, 15 Sep 2013 14:35:06 +0000 (15:35 +0100)]
contrib: pick: remove unused notmuch-pick-from-hello

This function was used for pick entry from hello but isn't needed
anymore. It was modelled on notmuch-hello-search which is now only
used non-interactively (and notmuch-pick does now add to the
recent-search history correctly).

10 years agocontrib: pick: use the new notmuch-common-keymap for pick entry
Mark Walters [Sun, 15 Sep 2013 14:35:05 +0000 (15:35 +0100)]
contrib: pick: use the new notmuch-common-keymap for pick entry

Austin recently added a global keymap: use this for pick
entry.

10 years agocontrib: pick: remove some superfluous quotes
Mark Walters [Sun, 15 Sep 2013 14:35:04 +0000 (15:35 +0100)]
contrib: pick: remove some superfluous quotes

Pick adds some keybindings to keymaps for other modes (for entry to
pick). These quoted the keymaps which appears to be unnecessary and to
rely on the fact that these keymaps have the same entry in the
function cell as the value cell (perhaps for historical reasons?)

Remove these quotes.

10 years agocontrib: pick: make the tree graphics a proper part of the format
Mark Walters [Mon, 2 Sep 2013 03:28:08 +0000 (04:28 +0100)]
contrib: pick: make the tree graphics a proper part of the format

Previously the box graphics in the pick view were always attached to
the subject. Make them a field in their own right. We use the
recursive insert to change the default notmuch-pick-result-format so
that the user view does not change. (The subject touches the tree box
graphics but the next column (tags) is still vertically aligned.)

10 years agocontrib: pick: allow recursive message field formats
Mark Walters [Mon, 2 Sep 2013 03:28:07 +0000 (04:28 +0100)]
contrib: pick: allow recursive message field formats

Previously, the message format was fixed: each part had to be a
certain width and either left or right justified. This allows the user
to specify that two parts can be variable width but that combined they
should be some fixed width. We do this by allowing the user to set as
a "field" a list of the normal result-format form which is formatted
and then itself inserted according to the format string specified.

This means all existing formats work but allows more general things
too. This will be used in the next patch to allow the user to specify
where the tree box graphics are drawn but allow, e.g., the total width
of the tree box graphics and subject to be specified.

10 years agocontrib: pick: move the insertion of fields up a level
Mark Walters [Mon, 2 Sep 2013 03:28:06 +0000 (04:28 +0100)]
contrib: pick: move the insertion of fields up a level

This moves the actual insertion of message fields up from the field
formatting function into the message insertion function. This will be
useful in the next patch as we can apply further formatting to the
insertion string before inserting.

10 years agocontrib: pick: print () for a message with no tags
Mark Walters [Mon, 2 Sep 2013 03:28:05 +0000 (04:28 +0100)]
contrib: pick: print () for a message with no tags

Dating back to the earliest notmuch-pick we have not printed anything
for the tag field for a message with no tags. This is inconsistent
with search and show both of which print "()". Change pick to be
consistent.

10 years agocontrib: pick: use global keymap
Mark Walters [Sun, 15 Sep 2013 08:17:48 +0000 (09:17 +0100)]
contrib: pick: use global keymap

Austin recently introduced a new global keymap. This makes pick use
this global map.

In most cases pick needs to override this global map because
it wants to close the message pane before doing the action. However,
this documents the over-rides and makes it less likely that the pick
bindings will get out of sync with the main bindings.

10 years agocontrib: pick: bugfix use of mini-buffer history
Mark Walters [Sun, 15 Sep 2013 08:19:33 +0000 (09:19 +0100)]
contrib: pick: bugfix use of mini-buffer history

pick was meant to use the same mini-buffer history but this failed
because the interactive definition took place before the use search
mini-buffer history part. Remove the interactive prompt to ensure the
correct history is used.

10 years agoemacs: bugfix unquoted symbol
Mark Walters [Sat, 14 Sep 2013 20:17:07 +0000 (21:17 +0100)]
emacs: bugfix unquoted symbol

In the recent changes for search order handling the default-value of
notmuch-search-oldest-first was used. However, default-value needs a
symbol so the symbol-name needs to be quoted.

This missing quote was causing strange sort-orders in some cases.

10 years agolib/cli: pass GMIME_ENABLE_RFC2047_WORKAROUNDS to g_mime_init()
Jani Nikula [Wed, 11 Sep 2013 17:36:43 +0000 (20:36 +0300)]
lib/cli: pass GMIME_ENABLE_RFC2047_WORKAROUNDS to g_mime_init()

As explained by Jeffrey Stedfast, the author of GMime, quoted in [1]:

> Passing the GMIME_ENABLE_RFC2047_WORKAROUNDS flag to g_mime_init()
> *should* solve the decoding problem mentioned in the thread. This
> flag should be safe to pass into g_mime_init() without any bad side
> effects and my unit tests do test that code-path.

The thread being referred to is [2].

[1] id:87bo56viyo.fsf@nikula.org
[2] id:08cb1dcd-c5db-4e33-8b09-7730cb3d59a2@gmail.com

10 years agotest: add known broken tests for known broken RFC 2047 encodings
Jani Nikula [Wed, 11 Sep 2013 17:36:42 +0000 (20:36 +0300)]
test: add known broken tests for known broken RFC 2047 encodings

Some common broken RFC 2047 encodings that we currently let gmime
parse strictly. We could tell gmime to be forgiving in what it accepts
as RFC 2047 encoding, making these tests pass.

10 years agoemacs: Move ?, q, s, m, =, and G to the common keymap
Austin Clements [Tue, 3 Sep 2013 21:45:25 +0000 (17:45 -0400)]
emacs: Move ?, q, s, m, =, and G to the common keymap

The only user-visible effect of this should be that "G" now works in
show mode (previously it was unbound for no apparent reason).

This shared keymap gives us one place to put global commands, which
both forces us to think about what commands should be global, and
ensures their bindings can't diverge (like the missing "G" in show).

10 years agoemacs: Define a common shared keymap for all of notmuch
Austin Clements [Tue, 3 Sep 2013 21:45:24 +0000 (17:45 -0400)]
emacs: Define a common shared keymap for all of notmuch

This defines a single, currently empty keymap that all other notmuch
mode maps inherit from.

10 years agoemacs: Make notmuch-help work with arbitrary keymaps
Austin Clements [Tue, 3 Sep 2013 21:45:23 +0000 (17:45 -0400)]
emacs: Make notmuch-help work with arbitrary keymaps

This converts notmuch-help to use map-keymap for all keymap traversal.
This generally cleans up and simplifies construction of keymap
documentation, and also makes notmuch-help support anything that can
be in a keymap, including more esoteric stuff like multiple
inheritance.

10 years agoemacs: Add unified refresh-this-buffer function
Austin Clements [Tue, 3 Sep 2013 21:45:22 +0000 (17:45 -0400)]
emacs: Add unified refresh-this-buffer function

This unifies the various refresh and poll-and-refresh functions we
have for different modes.  Now all modes bind "=" and "G" (except
show, which doesn't bind "G" for some reason) to
`notmuch-refresh-this-buffer' and
`notmuch-poll-and-refresh-this-buffer', respectively.

10 years agoemacs: Move `notmuch-poll' to notmuch-lib
Austin Clements [Tue, 3 Sep 2013 21:45:21 +0000 (17:45 -0400)]
emacs: Move `notmuch-poll' to notmuch-lib

10 years agoemacs: Remove notmuch-search quit continuation
Austin Clements [Tue, 3 Sep 2013 21:45:20 +0000 (17:45 -0400)]
emacs: Remove notmuch-search quit continuation

Since notmuch-hello doesn't need this any more, we can remove this
hack.  This also eliminates `notmuch-search-quit', so now all modes
bind "q" to `notmuch-kill-this-buffer'.

10 years agoemacs: Bind "s" to notmuch-search in hello-mode
Austin Clements [Tue, 3 Sep 2013 21:45:19 +0000 (17:45 -0400)]
emacs: Bind "s" to notmuch-search in hello-mode

Since there is now no difference between notmuch-hello-search and
notmuch-search when called interactively, bind "s" to notmuch-search
in notmuch-hello-mode-map.  Now all modes bind "s" this way.

10 years agoemacs: Refresh hello whenever the user switches to the buffer
Austin Clements [Tue, 3 Sep 2013 21:45:18 +0000 (17:45 -0400)]
emacs: Refresh hello whenever the user switches to the buffer

Previously, we refreshed hello when the user quit a search that was
started from hello.  This is fine assuming purely stack-oriented
buffer use, but is quite fragile and requires hacks to search.

This replaces that logic with a new approach that refreshes hello
whenever the user switches to the hello buffer, regardless of how this
happens.

10 years agoemacs: Consistently use configured sort order
Austin Clements [Tue, 3 Sep 2013 21:45:17 +0000 (17:45 -0400)]
emacs: Consistently use configured sort order

Previously, if `notmuch-search' was called interactively (bound to "s"
in search and show, but not hello), it would always use newest-first.
However, `notmuch-hello-search' (bound to "s" in hello) and
`notmuch-hello-widget-search` would call it with the user-configured
sort order.  This inconsistency seems unintentional, so change
`notmuch-search' to use the user-configured sort order when called
interactively.

10 years agoemacs: add buttons for all multipart/related parts
Istvan Marko [Fri, 16 Aug 2013 20:24:23 +0000 (13:24 -0700)]
emacs: add buttons for all multipart/related parts

When text/html parts include images as multipart/related and the
text/plain alternative is used these images can be completely hidden
with no easy way to access them or even find out that they are there.

Make notmuch-show-insert-part-multipart/related add buttons for all
parts, the first one visible the rest hidden.

10 years agoemacs: show: lazy part handling bugfix
Mark Walters [Fri, 6 Sep 2013 23:28:45 +0000 (00:28 +0100)]
emacs: show: lazy part handling bugfix

The lazy part handler had a bug that it allowed the button to be
toggled to be specified. During toggling it needs to save and restore
the text-properties for the button but it actually saved the text
properties at point rather than from the button.

In almost all cases this didn't matter as as point had the same text
properties as the button. However, it is a bug and did cause incorrect
behaviour in some cases: see id:87txhz14z6.fsf@qmul.ac.uk for details.

10 years agonotmuch-mutt: Fix tagging issues
Kevin J. McCarthy [Sat, 7 Sep 2013 17:07:57 +0000 (10:07 -0700)]
notmuch-mutt: Fix tagging issues

This patch fixes three issues with "notmuch-mutt tag":

1. The message_id was not shell quoted.
   Thanks to Jason Miller for the bug report and patch.

2. The tags passed into tag_action() were not being properly quoted.
   The "join before shell_quote" was combining multiple tags into a
   single argument to notmuch tag: '+one -two -three' instead of
   '+one' '-two' '-three'.

3. A "--" was added between the tags and search-term as shown in the
   current notmuch-tag man page.

Thanks to Tomi Ollila for suggesting the simple fix of using
the list form of system(), which bypasses the shell.

10 years agotest: unset 'xpg_echo' bash shell option
Tomi Ollila [Tue, 20 Aug 2013 16:16:43 +0000 (19:16 +0300)]
test: unset 'xpg_echo' bash shell option

When 'xpg_echo' bash shell option is unset (usually the default)
echo builtin does not expand backslash-escape sequences by default
(i.e. '\n' is echoed as '\n' instead of newline). Not all bash
installations have this feature we depend on activated by default.

Note that the feature is bash (and GNU /bin/echo) specific. It is used
as it is convenient. If portability is needed (elsewhere) use printf(1)
(also often available as a shell builtin).

10 years agodebian: remove unneeded notmuch-mutt dependencies
Kevin McCarthy [Thu, 5 Sep 2013 02:05:51 +0000 (19:05 -0700)]
debian: remove unneeded notmuch-mutt dependencies

Switching away from fdupes removes the dependency on libfile-which-perl
and the need to recommend fdupes.

10 years agonotmuch-mutt: use notmuch --duplicate flag
Kevin McCarthy [Thu, 5 Sep 2013 02:05:50 +0000 (19:05 -0700)]
notmuch-mutt: use notmuch --duplicate flag

Change notmuch-mutt to use the new --duplicate=1 flag for duplicate
removal.  This will remove duplicates based on message-id at the
notmuch level.  Previously we were using fdupes or generating sha sums
after the search.

This version will be faster, but will enable the possibility of hiding
search results due to accidental/malicious duplicate message-ids.

10 years agoemacs: fix notmuch-mua-reply point placement when signature involved
Tomi Ollila [Fri, 6 Sep 2013 14:32:18 +0000 (17:32 +0300)]
emacs: fix notmuch-mua-reply point placement when signature involved

When composing a reply, notmuch-mua-reply attempts to  cite the
the original message by inserting it before the user signature, if
one is present. The existing method used to search the signature
separator backward from the end of the buffer and then move one
line up. In case of variable `message-signature-insert-empty-line'
being nil this caused point to go to the beginning of
'--text follows this line--'
separator line, and citation was inserted there.
This change checks the value of `message-signature-insert-empty-line'
and doesn't move point if that is nil. Additional narrowing to
the body region ensures that point never goes to the separator line
(or beyond).
`message-signature-setup-hook' or `message-setup-hook' may already have
added some other content to the message body, therefore using simply
(message-goto-body) to move point to the beginning of body might lead
to unexpected results.

Original patch from "Geoffrey H. Ferrari", continued with iterations
from Jani and Mark.

10 years agotest: exit with nonzero value when not all tests completed successfully
Tomi Ollila [Sun, 8 Sep 2013 15:53:30 +0000 (18:53 +0300)]
test: exit with nonzero value when not all tests completed successfully

If any of the tests in our test system is not passing the execution
of the test suite completes with nonzero exit value.

It is better to rely on the exit value of the test system instead
of some arbitrary strings in test output (or use both).

10 years agoemacs: insert quotable parts in reply as they are displayed in show view
Jani Nikula [Sun, 1 Sep 2013 17:59:53 +0000 (20:59 +0300)]
emacs: insert quotable parts in reply as they are displayed in show view

In reply, insert quotable parts using notmuch-show-insert-bodypart
instead of calling notmuch-mm-display-part-inline directly to render
the quoted parts as they are rendered in show view.

We use a temp buffer to not leak text properties from the show
renderer into the reply. This way we also don't need to worry about
narrowing or point placement. Credits to Mark Walters
<markwalters1009@gmail.com> and Austin Clements <amdragon@MIT.EDU> for
getting this part straight.

The notable change is that replies to text/calendar parts quote the
pretty printed output of icalendar-import-buffer rather than the ugly
raw vcalendar.

10 years agocontrib: pick: test: buffer movement
Mark Walters [Tue, 3 Sep 2013 14:05:00 +0000 (15:05 +0100)]
contrib: pick: test: buffer movement

10 years agocontrib: pick: test: stash message id
Mark Walters [Tue, 3 Sep 2013 14:04:59 +0000 (15:04 +0100)]
contrib: pick: test: stash message id

This is important to test as lots of subsequent tests will fail if this fails.

10 years agocontrib: pick: test: tag/untag whole thread
Mark Walters [Tue, 3 Sep 2013 14:04:58 +0000 (15:04 +0100)]
contrib: pick: test: tag/untag whole thread

10 years agocontrib: pick: test: tag/untag single message
Mark Walters [Tue, 3 Sep 2013 14:04:57 +0000 (15:04 +0100)]
contrib: pick: test: tag/untag single message

10 years agotest: improve insert test reliability by checking message-id instead of count
Jani Nikula [Tue, 3 Sep 2013 05:19:03 +0000 (08:19 +0300)]
test: improve insert test reliability by checking message-id instead of count

There isn't a reported issue this would fix. Spotted by reading the
test.

10 years agotest: add more maildir flag syncing related tests to insert
Jani Nikula [Tue, 3 Sep 2013 05:19:02 +0000 (08:19 +0300)]
test: add more maildir flag syncing related tests to insert

Specifically test maildir flag syncing with insert.

10 years agotags_to_maildir_flags: Don't rename if no flags change
Louis Rilling [Wed, 19 Dec 2012 21:32:27 +0000 (22:32 +0100)]
tags_to_maildir_flags: Don't rename if no flags change

notmuch_message_tags_to_maildir_flags() unconditionally moves messages from
maildir directory "new/" to maildir directory "cur/", which makes messages lose
their "new" status in the MUA. However some users want to keep this "new"
status after, for instance, an auto-tagging of new messages.

However, as Austin mentioned and according to the maildir specification,
messages living in "new/" are not allowed to have flags, even if mutt allows it
to happen. For this reason, this patch prevents moving messages from "new/" to
"cur/", only if no flags have to be changed. It's hopefully enough to satisfy
mutt (and maybe other MUAs showing the "new" status) users checking the "new"
status.

Changelog:
* v2: Fix bool type as well as NULL returned despite having no errors (Austin
      Clements)
* v4: Tag the related test (contributed by Michal Sojka) as working

Signed-off-by: Louis Rilling <l.rilling@av7.net>
[Condition for keeping messages in new/ was extended to satisfy all
 tests from the previous patch. -Michal Sojka]

[Added by David Bremner, to keep the tests passing at each commit]

update insert tests for new maildir synchronization rules

As of id:1355952747-27350-4-git-send-email-sojkam1@fel.cvut.cz
we are more conservative about moving messages from ./new to ./cur.
This updates the insert tests to match

10 years agotest: Add some missing maildir synchronization tests
Michal Sojka [Wed, 19 Dec 2012 21:32:26 +0000 (22:32 +0100)]
test: Add some missing maildir synchronization tests

As mentioned by Jani Nikula in id:87vcccp4y3.fsf@nikula.org, some cases
of maildir synchronization are not covered by our tests. Let's add the
missing tests.

10 years agotest: Adding non-maildir tags does not move message from new to cur
Michal Sojka [Wed, 19 Dec 2012 21:32:25 +0000 (22:32 +0100)]
test: Adding non-maildir tags does not move message from new to cur

Some MUA's like mutt show the difference between "new" emails living in maildir
directory new/, and "old" emails living in maildir directory cur/. However
notmuch tag unconditionally moves selected messages from new/ to cur/, even if
no maildir synchronized tag is changed.

While maildir specification forbids messages with tags living in new/, there is
no need to move messages to cur/ when no maildir synchronized tag is changed.
Thus notmuch can remain transparent with respect to other MUA's.

[ Edited commit log to better describe the intended changes, and tag the
  test as broken until the actual changes are implemented -- Louis Rilling ]

Signed-off-by: Louis Rilling <l.rilling@av7.net>
[ Converted to use test_subtest_known_broken, David Bremner ]

10 years agocontrib: pick: test: refresh view
Mark Walters [Mon, 2 Sep 2013 20:15:14 +0000 (21:15 +0100)]
contrib: pick: test: refresh view

A recent proposed patch was buggy when refreshing the view. Add a test
for refresh so that this does not reoccur.

10 years agocontrib: pick: add docstring for notmuch-pick-worker
Mark Walters [Mon, 2 Sep 2013 20:15:13 +0000 (21:15 +0100)]
contrib: pick: add docstring for notmuch-pick-worker

10 years agocontrib: pick: remove unneeded variable notmuch-pick-buffer-name
Mark Walters [Mon, 2 Sep 2013 20:15:12 +0000 (21:15 +0100)]
contrib: pick: remove unneeded variable notmuch-pick-buffer-name

This variable is essentially unused: it was only used for making sure
it itself got reset after a refresh of the buffer.

It did this by passing an unnecessary argument to notmuch-pick-worker
so remove that too.

10 years agocontrib: pick: bind M-p and M-n to prev/next thread
Mark Walters [Sun, 25 Aug 2013 19:55:34 +0000 (20:55 +0100)]
contrib: pick: bind M-p and M-n to prev/next thread

This adds functions to go to the previous or next thread to
pick. Prev-thread behaves similarly to prev-message in show: if you
are on the top line of a thread it will go to the top of the previous
thread, otherwise it will go to the top of the current thread. Next
thread will always go to the top of the next thread (or the end of
buffer). These are bound to "M-p" and "M-n" by default (matching the
bindings in show).

10 years agocontrib: pick: thread tagging (including archiving) implemented
Mark Walters [Sun, 25 Aug 2013 19:55:33 +0000 (20:55 +0100)]
contrib: pick: thread tagging (including archiving) implemented

Previously pick had no actions based on the entire thread: this adds
some. Note in this version '*' is bound to `tag thread' which is not
consistent with search or show. However it still might be the most
natural thing (as it is similar to running * in the show pane).

10 years agocontrib: pick: add thread based utility functions
Mark Walters [Sun, 25 Aug 2013 19:55:32 +0000 (20:55 +0100)]
contrib: pick: add thread based utility functions

Previously notmuch-pick had no thread based functionality. This adds a
macro to iterate through all messages in a thread. To simplify this it
adds a text-property marker to the first message of each thread.

10 years agolib: fix clang build
Jani Nikula [Sat, 17 Aug 2013 21:30:01 +0000 (00:30 +0300)]
lib: fix clang build

Long story short, fix build on recent (3.2+) clang.

The long story for posterity follows.

gcc 4.6 added new warnings about structs with greater visibility than
their fields. The warnings were silenced by adjusting visibility in

commit d5523ead90b6be2b07d4af745b8ed9b980a6b9f1
Author: Carl Worth <cworth@cworth.org>
Date:   Wed May 11 13:23:13 2011 -0700

    Mark some structures in the library interface with visibility=default attribute.

Later on,

commit 3b76adf9e2c026dd03b820f4c6eab50e25444113
Author: Austin Clements <amdragon@MIT.EDU>
Date:   Sat Jan 14 19:17:33 2012 -0500

    lib: Add support for automatically excluding tags from queries

changed visibility of struct _notmuch_string_list for the same reason, and

commit 1a53f9f116fa7c460cda3df532be921baaafb082
Author: Mark Walters <markwalters1009@gmail.com>
Date:   Thu Mar 1 22:30:38 2012 +0000

    lib: Add the exclude flag to notmuch_query_search_threads

split the struct _notmuch_string_list and its typedef
notmuch_string_list_t as a way to make a forward declaration for
_notmuch_thread_create().

The subtle difference was that the struct definition now had 'visible'
in it, while the typedef didn't, and it was within the #pragma GCC
visibility push(hidden) block. This went unnoticed, as the then common
versions of clang didn't care about this.

A later change in clang (I did not dig into when this change was
introduced) caused the following error:

CXX  -O2 lib/database.o
In file included from lib/database.cc:21:
In file included from ./lib/database-private.h:33:
./lib/notmuch-private.h:479:8: error: visibility does not match previous declaration
struct visible _notmuch_string_list {
       ^
./lib/notmuch-private.h:67:33: note: expanded from macro 'visible'
                                ^
./lib/notmuch-private.h:52:13: note: previous attribute is here
            ^
1 error generated.
make: *** [lib/database.o] Error 1

This is slightly misleading due to the reference to the #pragma. The
real culprit is the typedef within the #pragma.

We could just add 'visible' to the typedef, or move the typedef
outside of the #pragma, and be done with it, but juggle the
declarations a bit to accommodate moving the typedef back with the
struct, and keep the visibility attribute in one place.

The problem was originally reported by Simonas Kazlauskas
<s@kazlauskas.me> in id:20130418102507.GA23688@godbox but I was only
able to reproduce and investigate now that I upgraded clang.

10 years agocontrib: pick: remove sync tests
Mark Walters [Mon, 26 Aug 2013 19:57:23 +0000 (20:57 +0100)]
contrib: pick: remove sync tests

Since the previous commit removed the sync parser we may as well
remove its tests too.

10 years agocontrib: pick: remove sync parser
Mark Walters [Mon, 26 Aug 2013 19:57:22 +0000 (20:57 +0100)]
contrib: pick: remove sync parser

Previously pick had the option of using an async parser like search or
a sync parser like show. The async parser has always been the default
and it seems fine so we can remove the sync one and the corresponding
defcustom.

10 years agotest: test notmuch show --include-html option
Tomi Ollila [Sat, 24 Aug 2013 15:29:30 +0000 (18:29 +0300)]
test: test notmuch show --include-html option

Test new --include-html option added to notmuch show command with
json output message parts containing text in latin1 and utf8 format.

10 years agocli: add --include-html option to notmuch show
John Lenz [Tue, 2 Jul 2013 00:19:42 +0000 (19:19 -0500)]
cli: add --include-html option to notmuch show

For my client, the largest bottleneck for displaying large threads is
exporting each html part individually since by default notmuch will not
show the json parts.  For large threads there can be quite a few parts and
each must be exported and decoded one by one.  Also, I then have to deal
with all the crazy charsets which I can do through a library but is a
pain.

Therefore, this patch adds an --include-html option that causes the
text/html parts to be included as part of the output of show.

diff man/man1/notmuch-show.1

10 years agoemacs: removed 3 duplicate functions from notmuch-show.el
Tomi Ollila [Mon, 26 Aug 2013 20:21:57 +0000 (23:21 +0300)]
emacs: removed 3 duplicate functions from notmuch-show.el

notmuch-show.el and notmuch.el had 3 duplicate, identical functions:
notmuch-foreach-mime-part, notmuch-count-attachments and
notmuch-save-attachments. Now these functions in notmuch-show.el
are replaced with declare-functions pointing to "notmuch"(.el).

10 years agoman: clarify folder: prefix regarding duplicate files
Jani Nikula [Sat, 17 Aug 2013 12:11:33 +0000 (15:11 +0300)]
man: clarify folder: prefix regarding duplicate files

The results for folder: prefix are a source of recurring confusion.

10 years agoNEWS: cli options for improved duplicate message handling
Jani Nikula [Sun, 18 Aug 2013 12:52:28 +0000 (15:52 +0300)]
NEWS: cli options for improved duplicate message handling

10 years agoman: document notmuch count --output=files
Jani Nikula [Sat, 17 Aug 2013 12:11:31 +0000 (15:11 +0300)]
man: document notmuch count --output=files

Document the notmuch count --output=files option.

10 years agotest: test notmuch count --output=files
Jani Nikula [Sat, 17 Aug 2013 12:11:30 +0000 (15:11 +0300)]
test: test notmuch count --output=files

Add tests for notmuch count --output=files option.

10 years agocli: add --output=files option to notmuch count
Jani Nikula [Sat, 17 Aug 2013 12:11:29 +0000 (15:11 +0300)]
cli: add --output=files option to notmuch count

Add support for querying the total number of files associated with the
messages matching the search. This is mostly useful with an
id:<message-id> query for a single message.

10 years agoman: document notmuch search --duplicate=N
Jani Nikula [Sat, 17 Aug 2013 12:11:28 +0000 (15:11 +0300)]
man: document notmuch search --duplicate=N

Document the notmuch search --duplicate=N option.

10 years agotest: test notmuch search --duplicate=N
Jani Nikula [Sat, 17 Aug 2013 12:11:27 +0000 (15:11 +0300)]
test: test notmuch search --duplicate=N

Add test for notmuch search --duplicate=N option.

10 years agocli: add --duplicate=N option to notmuch search
Jani Nikula [Sat, 17 Aug 2013 12:11:26 +0000 (15:11 +0300)]
cli: add --duplicate=N option to notmuch search

Effective with --output=files, output the Nth filename associated with
each message matching the query (N is 1-based). If N is greater than
the number of files associated with the message, don't print anything.