9 years agoman: add references to maildir flag synchronization
Jani Nikula [Sat, 25 Feb 2012 22:57:23 +0000 (00:57 +0200)]
man: add references to maildir flag synchronization

notmuch new, restore, and tag commands support maildir flag
synchronization with notmuch tags. Reference the notmuch-config(1) man
page about it in the relevant man pages.

9 years agoman: document the notmuch configuration settings in notmuch-config(1)
Jani Nikula [Sat, 25 Feb 2012 22:23:41 +0000 (00:23 +0200)]
man: document the notmuch configuration settings in notmuch-config(1)

At the risk of duplication between the man page and the configuration
file generated by default, document the notmuch configuration options
in the notmuch config man page.

Existing users of notmuch should not be expected to re-generate their
config file in order to get access to the documentation for new
configuration options.

Include some minor fixes and cleanups while at it.

9 years agoemacs: Fix out of date comment
Austin Clements [Sat, 25 Feb 2012 14:50:26 +0000 (09:50 -0500)]
emacs: Fix out of date comment

The behavior of the header line in show-mode changed from showing the
subject of the first open message to showing the subject of the first
message in 4d77f18b.  Update a comment to reflect this.

9 years agoDocument the JSON schemata used by show and search
Austin Clements [Mon, 20 Feb 2012 00:26:23 +0000 (19:26 -0500)]
Document the JSON schemata used by show and search

9 years agoNEWS: sync 'new.ignore' entry with its comment in notmuch-config.c
Pieter Praet [Sun, 19 Feb 2012 20:47:52 +0000 (21:47 +0100)]
NEWS: sync 'new.ignore' entry with its comment in notmuch-config.c

See previous commit.

9 years agocli: update 'new.ignore' config file comment wrt file/directory matching
Pieter Praet [Sun, 19 Feb 2012 20:47:51 +0000 (21:47 +0100)]
cli: update 'new.ignore' config file comment wrt file/directory matching

9 years agoBuild-Depend on libgmime-2.6-dev | libgmime2.4-dev
Daniel Kahn Gillmor [Thu, 9 Feb 2012 23:20:20 +0000 (18:20 -0500)]
Build-Depend on libgmime-2.6-dev | libgmime2.4-dev

libgmime-2.6-dev entered debian unstable today.  If 2.6 is available,
notmuch should build against 2.6 instead of 2.4, as 2.6 is the current
upstream stable version of libgmime.

9 years agoNews for retaining state when refreshing notmuch show
Austin Clements [Tue, 21 Feb 2012 15:42:33 +0000 (10:42 -0500)]
News for retaining state when refreshing notmuch show

9 years agoemacs: Reverse the meaning of notmuch-show-refresh-view's argument
Austin Clements [Tue, 21 Feb 2012 15:42:32 +0000 (10:42 -0500)]
emacs: Reverse the meaning of notmuch-show-refresh-view's argument

Consensus seems to be that people prefer that refreshing show buffers
retains state by default, rather than resetting it by default.  This
turns out to be the case in the code, as well.  In fact, there's even
a test for this that's been marked broken for several months, which
this patch finally gets to mark as fixed.

9 years agoemacs: When refreshing a show buffer, only mark read when resetting state
Austin Clements [Tue, 21 Feb 2012 15:42:31 +0000 (10:42 -0500)]
emacs: When refreshing a show buffer, only mark read when resetting state

If we retain state while refreshing a show buffer, it should not mark
any messages read since it's not a navigation operation (it especially
shouldn't mark the first message matching the query read, which is
what it did previously).  If the user or caller requests that refresh
reset the state of the buffer, then we consider that a navigation
operation, so we do mark the message under point after the refresh

This is implemented by moving responsibility for initial positioning
and read-marking out of notmuch-show-worker and into its caller.
Since notmuch-show-worker is now exclusively about building the show
buffer, we rename it to notmuch-show-build-buffer.

9 years agoemacs: add `notmuch-show-stash-mlarchive-link{, -and-go}'
Pieter Praet [Sun, 19 Feb 2012 20:50:27 +0000 (21:50 +0100)]
emacs: add `notmuch-show-stash-mlarchive-link{, -and-go}'

* emacs/notmuch-show.el

    New defcustom of type `alist' (key = name, value = URI),
    containing Mailing List Archive URI's for searching by Message-Id.

    New defcustom, default MLA to use when `notmuch-show-stash-mlarchive-link'
    received no user input whatsoever.  Available choices are generated using
    the contents of `notmuch-show-stash-mlarchive-link-alist'.

    Added keybinds "l" and "L" for `notmuch-show-stash-mlarchive-link'
    respectively `notmuch-show-stash-mlarchive-link-and-go'.

    New function, stashes a URI pointing to the current message at one
    of the MLAs configured in `notmuch-show-stash-mlarchive-link-alist'.
    Prompts user with `completing-read' if not provided with an MLA key.

    New function, uses `notmuch-show-stash-mlarchive-link' to
    stash a URI, and then visits it using the browser configured
    in `browse-url-browser-function'.

Based on original work [1] by David Edmondson <>.

[1] id:""

9 years agotest: emacs: expand subtest "Stashing in notmuch-show" wrt stashing Mailing List...
Pieter Praet [Sun, 19 Feb 2012 20:50:26 +0000 (21:50 +0100)]
test: emacs: expand subtest "Stashing in notmuch-show" wrt stashing Mailing List Archive URIs

`notmuch-show-stash-mlarchive-link' stashes a URI pointing to the current message
at one of the MLAs configured in `notmuch-show-stash-mlarchive-link-alist'.

Marked as "broken": fixed in next commit.

9 years agoemacs: `notmuch-show-get-message-id': optionally return Message-Id sans prefix
Pieter Praet [Sun, 19 Feb 2012 20:50:25 +0000 (21:50 +0100)]
emacs: `notmuch-show-get-message-id': optionally return Message-Id sans prefix

* emacs/notmuch-show.el

    Add optional arg BARE.  When non-nil, return a Message-Id without
    quotes and prefix, thus obviating the need to strip them off again
    in various places.

    Update wrt changes in `notmuch-show-get-message-id'.

9 years agoNEWS: add entry for the improved unicode handling in the python bindings
Justus Winter [Wed, 22 Feb 2012 19:33:31 +0000 (20:33 +0100)]
NEWS: add entry for the improved unicode handling in the python bindings

Signed-off-by: Justus Winter <>
9 years agoNEWS: add entry for python 3.2 compatibility
Justus Winter [Wed, 22 Feb 2012 19:33:30 +0000 (20:33 +0100)]
NEWS: add entry for python 3.2 compatibility

Signed-off-by: Justus Winter <>
9 years agoemacs: support text/calendar mime type
Jani Nikula [Thu, 9 Feb 2012 14:46:03 +0000 (14:46 +0000)]
emacs: support text/calendar mime type

Replace text/x-vcalendar with text/calendar, while maintaining support
and backwards compatibility for text/x-vcalendar.

Code by David Edmondson <>

9 years agotest: replace occurrences of $PWD with vars that are more stable
Pieter Praet [Wed, 1 Feb 2012 20:37:21 +0000 (21:37 +0100)]
test: replace occurrences of $PWD with vars that are more stable

Thanks to Dmitry Kurochkin <>
for pointing this out:  id:""

9 years agopython: split the documentation
Justus Winter [Fri, 24 Feb 2012 00:34:15 +0000 (01:34 +0100)]
python: split the documentation

Move each classes documentation into its own file and thus into its
own page in the generated documentation.

Signed-off-by: Justus Winter <>
9 years agopython: move the notmuch module section to notes.rst
Justus Winter [Fri, 24 Feb 2012 00:30:04 +0000 (01:30 +0100)]
python: move the notmuch module section to notes.rst

Signed-off-by: Justus Winter <>
9 years agopython: move the usage example to quickstart.rst
Justus Winter [Fri, 24 Feb 2012 00:18:54 +0000 (01:18 +0100)]
python: move the usage example to quickstart.rst

Signed-off-by: Justus Winter <>
9 years agopython: strip module prefix in the sphinx documentation
Justus Winter [Thu, 23 Feb 2012 23:38:47 +0000 (00:38 +0100)]
python: strip module prefix in the sphinx documentation

Remove the notmuch prefix from classes in the documentation. This
change makes the table of contents look much nicer.

Signed-off-by: Justus Winter <>
9 years agopython: mention the exception class refactoring in the docs
Justus Winter [Wed, 22 Feb 2012 23:14:59 +0000 (00:14 +0100)]
python: mention the exception class refactoring in the docs

Signed-off-by: Justus Winter <>
9 years agopython: move the exception classes into
Justus Winter [Wed, 22 Feb 2012 23:11:22 +0000 (00:11 +0100)]
python: move the exception classes into

Signed-off-by: Justus Winter <>
9 years agopython: rename into
Justus Winter [Wed, 22 Feb 2012 21:44:35 +0000 (22:44 +0100)]
python: rename into

Signed-off-by: Justus Winter <>
9 years agopython: move Threads class into its own file
Justus Winter [Wed, 22 Feb 2012 21:39:52 +0000 (22:39 +0100)]
python: move Threads class into its own file

Signed-off-by: Justus Winter <>
9 years agopython: move Messages class into its own file
Justus Winter [Wed, 22 Feb 2012 21:34:40 +0000 (22:34 +0100)]
python: move Messages class into its own file

Signed-off-by: Justus Winter <>
9 years agopython: refactor the python bindings
Justus Winter [Wed, 22 Feb 2012 20:55:59 +0000 (21:55 +0100)]
python: refactor the python bindings

Move the Directory class into its own file, merge the two Filenames
classes into one, deprecate Filenames.as_iterator, update the
documentation accordingly.

Signed-off-by: Justus Winter <>
9 years agopython: work around libnotmuch calling exit(3) in Database.find_message_by_filename
Justus Winter [Wed, 22 Feb 2012 20:14:13 +0000 (21:14 +0100)]
python: work around libnotmuch calling exit(3) in Database.find_message_by_filename

Signed-off-by: Justus Winter <>
9 years agopython: improve the docstring of Database.find_message_by_filename
Justus Winter [Wed, 22 Feb 2012 20:07:18 +0000 (21:07 +0100)]
python: improve the docstring of Database.find_message_by_filename

Signed-off-by: Justus Winter <>
9 years agopython: work around libnotmuch calling exit(3) in Database.get_directory
Justus Winter [Wed, 22 Feb 2012 19:58:44 +0000 (20:58 +0100)]
python: work around libnotmuch calling exit(3) in Database.get_directory

Signed-off-by: Justus Winter <>
9 years agopython: Improve the docstring of Database.get_directory
Justus Winter [Wed, 22 Feb 2012 19:46:42 +0000 (20:46 +0100)]
python: Improve the docstring of Database.get_directory
Signed-off-by: Justus Winter <>
9 years agopython: avoid using a magic value for database mode in Database.__init__
Justus Winter [Wed, 22 Feb 2012 20:01:24 +0000 (21:01 +0100)]
python: avoid using a magic value for database mode in Database.__init__

Signed-off-by: Justus Winter <>
9 years agotest: always report missing prereqs, independent of `--verbose' option
Pieter Praet [Wed, 18 Jan 2012 12:19:41 +0000 (13:19 +0100)]
test: always report missing prereqs, independent of `--verbose' option

When tests are skipped due to missing prereqs, those prereqs are only
displayed when running with the `--verbose' option.  This is essential
information when troubleshooting, so always send to stdout.

9 years agoemacs: Fix out-of-date declare-function
Austin Clements [Sun, 19 Feb 2012 18:02:40 +0000 (13:02 -0500)]
emacs: Fix out-of-date declare-function

The names of the arguments to notmuch-show-refresh-view had gotten out
of sync between the declare-function and the real thing.

9 years agoPrevent segmentation fault in notmuch_database_close
Justus Winter [Sat, 18 Feb 2012 23:56:57 +0000 (00:56 +0100)]
Prevent segmentation fault in notmuch_database_close

Previously opening a notmuch database in read write mode that has been
locked resulted in the notmuch_database_open function executing
notmuch_database_close as a cleanup function. notmuch_database_close
failed to check whether the xapian database has in fact been created.

Add a check whether the xapian database object has actually been
created before trying to call its flush method.

Signed-off-by: Justus Winter <>
9 years agopython: fix the type nonsense of the first parameter of class Directory
Justus Winter [Tue, 21 Feb 2012 00:06:15 +0000 (01:06 +0100)]
python: fix the type nonsense of the first parameter of class Directory

Signed-off-by: Justus Winter <>
9 years agopython: allow an empty path as parameter to Database.get_directory
Justus Winter [Mon, 20 Feb 2012 23:56:07 +0000 (00:56 +0100)]
python: allow an empty path as parameter to Database.get_directory

Signed-off-by: Justus Winter <>
9 years agopython: remove :returns: keywords from functions returning nothing
Justus Winter [Mon, 20 Feb 2012 23:15:59 +0000 (00:15 +0100)]
python: remove :returns: keywords from functions returning nothing

Signed-off-by: Justus Winter <>
9 years agopython: rework Directory.set_mtime
Justus Winter [Mon, 20 Feb 2012 23:13:20 +0000 (00:13 +0100)]
python: rework Directory.set_mtime

Fix the indentation within the docstring, remove useless remarks, do
some trivial refactoring.

Signed-off-by: Justus Winter <>
9 years agopython: harmonize the sphinx keyword for exceptions
Justus Winter [Mon, 20 Feb 2012 23:01:23 +0000 (00:01 +0100)]
python: harmonize the sphinx keyword for exceptions

Signed-off-by: Justus Winter <>
9 years agopython: refactor the error handling machinery
Justus Winter [Mon, 20 Feb 2012 22:49:07 +0000 (23:49 +0100)]
python: refactor the error handling machinery

Raise specific error classes instead of a generic NotmuchError with an
magic status value (e.g. NotmuchError(STATUS.NULL_POINTER) ->
NullPointerError()), update the documentation accordingly.

Signed-off-by: Justus Winter <>
9 years agopython: fix the projects name and update years of the copyright notice in the sphinx...
Justus Winter [Mon, 20 Feb 2012 20:48:35 +0000 (21:48 +0100)]
python: fix the projects name and update years of the copyright notice in the sphinx docs

Signed-off-by: Justus Winter <>
9 years agopython: more error handling fixes
Justus Winter [Sat, 18 Feb 2012 23:36:15 +0000 (00:36 +0100)]
python: more error handling fixes

This is a follow up commit to 221c7e0b38177f5f1dbf0561580c15e8aaa49004
fixing more NULL pointer checks.

Signed-off-by: Justus Winter <>
9 years agopython: remove trailing whitespace within the documentation source files
Justus Winter [Sat, 18 Feb 2012 00:41:23 +0000 (01:41 +0100)]
python: remove trailing whitespace within the documentation source files

Signed-off-by: Justus Winter <>
9 years agopython: improve Query.count_messages docstring
Justus Winter [Sat, 18 Feb 2012 00:38:19 +0000 (01:38 +0100)]
python: improve Query.count_messages docstring

Signed-off-by: Justus Winter <>
9 years agopython: wrap notmuch_query_count_threads as Query.count_threads
Justus Winter [Sat, 18 Feb 2012 00:32:21 +0000 (01:32 +0100)]
python: wrap notmuch_query_count_threads as Query.count_threads

Signed-off-by: Justus Winter <>
9 years agopython: refactor Query class
Justus Winter [Sat, 18 Feb 2012 00:13:06 +0000 (01:13 +0100)]
python: refactor Query class

Put each libnotmuch function reference right in front of the
corresponding python wrapper.

Signed-off-by: Justus Winter <>
9 years agopython: move Query class to its own file
Justus Winter [Sat, 18 Feb 2012 00:10:45 +0000 (01:10 +0100)]
python: move Query class to its own file

Signed-off-by: Justus Winter <>
9 years agopython: remove unused but imported symbol
Justus Winter [Sat, 18 Feb 2012 00:01:33 +0000 (01:01 +0100)]
python: remove unused but imported symbol

Signed-off-by: Justus Winter <>
9 years agopython: remove unused but imported symbol
Justus Winter [Fri, 17 Feb 2012 23:57:59 +0000 (00:57 +0100)]
python: remove unused but imported symbol

Signed-off-by: Justus Winter <>
9 years agoNEWS: add news section for new.ignore
Tomi Ollila [Wed, 15 Feb 2012 09:17:32 +0000 (11:17 +0200)]
NEWS: add news section for new.ignore

Added NEWS section 'Mail store folder/file ignore'.

9 years agoadd support for user-specified files & directories to ignore
Tomi Ollila [Wed, 15 Feb 2012 09:17:31 +0000 (11:17 +0200)]
add support for user-specified files & directories to ignore

A new configuration key 'new.ignore' is used to determine which
files and directories user wants not to be scanned as new mails.

Mark the corresponding test as no longer broken.
This work merges my previous attempts and Andreas Amann's work
in id:""

9 years agotest: add tests wrt ignoring user-specified files and directories
Tomi Ollila [Wed, 15 Feb 2012 09:17:30 +0000 (11:17 +0200)]
test: add tests wrt ignoring user-specified files and directories

Files and directories which are specified in 'new.ignore' in the
config file shouldn't be indexed nor reported by `notmuch new'.

This is basically Pieter's work with Austin's comments addressed.

9 years agoemacs: Fix display of highlighted line in notmuch-search
Michal Sojka [Tue, 14 Feb 2012 17:09:47 +0000 (18:09 +0100)]
emacs: Fix display of highlighted line in notmuch-search

When notmuch-search-line-faces is used to set background color in search
results, the highlight of the current line is not always displayed
correctly. This patch fixes that by increasing the priority property of
the highlight overlay.

9 years agopython: implement the context manager protocol for database objects
Justus Winter [Wed, 15 Feb 2012 21:41:16 +0000 (22:41 +0100)]
python: implement the context manager protocol for database objects

Signed-off-by: Justus Winter <>
9 years agopython: provide a Database.close function
Justus Winter [Wed, 15 Feb 2012 21:25:13 +0000 (22:25 +0100)]
python: provide a Database.close function

Rename Database.__del__ to Database.close, move it just below the open
function and call close() in a newly created destructor just below the

Signed-off-by: Justus Winter <>
9 years agoFree the results of scandir()
Ethan Glasser-Camp [Tue, 7 Feb 2012 10:05:03 +0000 (05:05 -0500)]
Free the results of scandir()

scandir() returns "strings allocated via malloc(3)" which are then
"collected in array namelist which is allocated via
malloc(3)". Currently we just free the array namelist. Instead, free
all the entries of namelist, and then free namelist.

entry only points to elements of namelist, so we don't free it

9 years agoemacs: allow to set RETAIN-STATE for `notmuch-show-refresh-view' interactively
Dmitry Kurochkin [Mon, 13 Feb 2012 11:09:07 +0000 (15:09 +0400)]
emacs: allow to set RETAIN-STATE for `notmuch-show-refresh-view' interactively

The notmuch-show view refresh function (`notmuch-show-refresh-view',
bound to "=") accepts an optional RETAIN-STATE argument.  The patch
allows to set this argument interactively by using "C-u =".

9 years agoemacs: cleanup and simplify `notmuch-show-archive-thread' and related functions
Dmitry Kurochkin [Wed, 8 Feb 2012 16:48:51 +0000 (20:48 +0400)]
emacs: cleanup and simplify `notmuch-show-archive-thread' and related functions

Recent changes in notmuch-show tagging introduced some code
duplication.  The patch cleanups and simplifies
`notmuch-show-archive-thread' function by using
`notmuch-show-tag-all', no longer used function are removed.  After
the change, `notmuch-show-archive-thread' function becomes symmetric
with `notmuch-show-archive-message'.

A side effect of these changes is that `notmuch-show-archive-thread'
no longer calls "notmuch tag" for each message in the thread.

9 years agoemacs: A prefix argument to `notmuch-show' should invert the matching message behaviour.
David Edmondson [Wed, 8 Feb 2012 08:02:19 +0000 (08:02 +0000)]
emacs: A prefix argument to `notmuch-show' should invert the matching message behaviour.

Allow the user to open a thread with inverted
`notmuch-show-only-matching-messages' behaviour using a prefix

9 years agoemacs: Add `notmuch-show-only-matching-messages'.
David Edmondson [Wed, 8 Feb 2012 08:02:18 +0000 (08:02 +0000)]
emacs: Add `notmuch-show-only-matching-messages'.

Allow the user to choose that only matching messages are shown by

9 years agoemacs: Check that the parent buffer is alive before using it.
David Edmondson [Wed, 8 Feb 2012 08:02:17 +0000 (08:02 +0000)]
emacs: Check that the parent buffer is alive before using it.

9 years agoemacs: Optionally retain the state of the buffer during `notmuch-show-refresh-view'.
David Edmondson [Wed, 8 Feb 2012 08:02:16 +0000 (08:02 +0000)]
emacs: Optionally retain the state of the buffer during `notmuch-show-refresh-view'.

With an argument, record and reply the state of the buffer during

In this context, "state" is defined as:
 - the open/closed state of each message,
 - the current message.

Traditional use of refresh with the = key does not retain the
state. The recently introduced toggle commands ($, !, < and >) do
retain the state.

9 years agoemacs: Add a binding (t) to toggle the truncation of long lines.
David Edmondson [Wed, 8 Feb 2012 08:02:15 +0000 (08:02 +0000)]
emacs: Add a binding (t) to toggle the truncation of long lines.

9 years agoemacs: Allow the indentation of content to be toggled.
David Edmondson [Wed, 8 Feb 2012 08:02:14 +0000 (08:02 +0000)]
emacs: Allow the indentation of content to be toggled.

Very deeply indented content is sometimes difficult to
read (particular for something like patches). Allow the indentation of
the content to be toggled with '<'.

Indentation of the header lines is not affected, so it remains
possible to see the structure of the thread.

9 years agoemacs: Allow `notmuch-show-mode' to display only matching messages.
David Edmondson [Wed, 8 Feb 2012 08:02:12 +0000 (08:02 +0000)]
emacs: Allow `notmuch-show-mode' to display only matching messages.

The current behaviour (all messages shown, non-matching collapsed)
is retained as the default. Type '!' to switch to showing only
the matching messages - non-matching messages are not available.
'!' will switch back to showing everything.

9 years agoemacs: Rework crypto switch toggle.
David Edmondson [Wed, 8 Feb 2012 08:02:10 +0000 (08:02 +0000)]
emacs: Rework crypto switch toggle.

Re-work the existing crypto switch toggle to be based on a persistant
buffer-local variable.

To allow this, modify `notmuch-show-refresh-view' to erase and re-draw
in the current buffer rather than killing the current buffer and
creating a new one. (This will also allow more per-buffer behaviour in
future patches.)

Add a binding ('$') to toggle crypto processing of the current buffer
and remove the prefix argument approach that achieves a similar

9 years agoemacs: Ensure that gnupg output goes at the end of the buffer.
David Edmondson [Tue, 7 Feb 2012 17:26:11 +0000 (17:26 +0000)]
emacs: Ensure that gnupg output goes at the end of the buffer.

When showing the user some details of gnupg output, ensure that those
details are shown at the end of the gnupg status buffer
("*notmuch-crypto-gpg-out*"), otherwise it can end up mixed up with
earlier output.

9 years agocli: reach previously unreachable cleanup code in "notmuch show"
Jani Nikula [Mon, 6 Feb 2012 19:57:23 +0000 (21:57 +0200)]
cli: reach previously unreachable cleanup code in "notmuch show"

The last lines of notmuch_show_command() function were
unreachable. Fix it by using a variable for return value.

Signed-off-by: Jani Nikula <>
9 years agocli: convert "notmuch show" to use the new argument parser
Jani Nikula [Mon, 6 Feb 2012 19:57:22 +0000 (21:57 +0200)]
cli: convert "notmuch show" to use the new argument parser

Use the new notmuch argument parser to handle arguments in "notmuch
show". There are three minor functional changes:

1) Also set params.raw = TRUE when defaulting to raw format when part
   is requested but format is not specified. This was a bug, and
   --part=0 without --format=raw did not work previously.

2) Set params.decrypt = FALSE if crypto context creation fails.

3) Only use the parameters for the last --format if specified multiple
   times. Previously this could have resulted in a non-working mixture
   of parameters.

Signed-off-by: Jani Nikula <>
9 years agocli: use notmuch_bool_t for boolean fields in notmuch_show_params_t
Jani Nikula [Mon, 6 Feb 2012 19:57:21 +0000 (21:57 +0200)]
cli: use notmuch_bool_t for boolean fields in notmuch_show_params_t

Use notmuch_bool_t instead of int for entire_thread, raw, and decrypt
boolean fields in notmuch_show_params_t. No functional changes.

Signed-off-by: Jani Nikula <>
9 years agoshow: Simplify new text formatter code
Austin Clements [Sat, 4 Feb 2012 21:24:26 +0000 (16:24 -0500)]
show: Simplify new text formatter code

This makes the text formatter take advantage of the new code
structure.  The previously duplicated header logic is now unified,
several things that we used to compute repeatedly across different
callbacks are now computed once, and the code is simpler overall and
32% shorter.

Unifying the header logic causes this to format some dates slightly
differently, so the two affected test cases are updated.

9 years agoshow: Convert text format to the new self-recursive style
Austin Clements [Sat, 4 Feb 2012 21:24:25 +0000 (16:24 -0500)]
show: Convert text format to the new self-recursive style

This is all code movement and a smidgen of glue.  This moves the
existing text formatter code into one self-recursive function, but
doesn't change any of the logic.  The next patch will actually take
advantage of what the new structure has to offer.

Note that this patch retains format_headers_message_part_text because
it is also used by the raw format.

9 years agoemacs: add default value to notmuch-search-line-faces
Jani Nikula [Thu, 2 Feb 2012 14:58:41 +0000 (16:58 +0200)]
emacs: add default value to notmuch-search-line-faces

Add default value to notmuch-search-line-faces to show "unread"
messages in bold, and "flagged" messages in blue, to have some visual
indication of important messages in search results. This should be
helpful for new users.

"unread" tag is quite obvious, and handled specially both in the lib
and emacs ui. "flagged" is synced to maildir F flag in the lib. If one
syncs the maildir to IMAP, this also translates to corresponding IMAP
flag. (This is "starred" in GMail and Android.)

Signed-off-by: Jani Nikula <>
9 years agotest: remove explicit loading of elisp tests in emacs-address-cleaning
Dmitry Kurochkin [Sun, 29 Jan 2012 03:36:03 +0000 (07:36 +0400)]
test: remove explicit loading of elisp tests in emacs-address-cleaning

It is no longer needed, since elisp tests files are auto loaded now.

9 years agotest: auto load elisp tests file in test_emacs if available
Dmitry Kurochkin [Sun, 29 Jan 2012 03:36:02 +0000 (07:36 +0400)]
test: auto load elisp tests file in test_emacs if available

This allows us to simplify shell part of tests written in elisp.

9 years agoSTYLE: Initial draft of coding style document
David Bremner [Fri, 27 Jan 2012 23:46:58 +0000 (19:46 -0400)]
STYLE: Initial draft of coding style document

This was edited by (at least) Austin, Tomi, and myself.

Amended with Austin's proposed wording for indentation.

9 years agopy3k: Fix decoding of default database name in Database._get_user_default_db
Justus Winter [Fri, 10 Feb 2012 21:34:47 +0000 (22:34 +0100)]
py3k: Fix decoding of default database name in Database._get_user_default_db

Signed-off-by: Justus Winter <>
9 years agopython: mock out the ctypes library
Justus Winter [Fri, 10 Feb 2012 17:53:04 +0000 (18:53 +0100)]
python: mock out the ctypes library

This allows to build the documentation without libnotmuch.

Signed-off-by: Justus Winter <>
9 years agopython: Add a Mock class to the sphinx config that can be used to mock modules
Justus Winter [Fri, 10 Feb 2012 17:52:19 +0000 (18:52 +0100)]
python: Add a Mock class to the sphinx config that can be used to mock modules

Signed-off-by: Justus Winter <>
9 years agoemacs: make show view a/A/x/X key bindings more consistent
Jani Nikula [Tue, 31 Jan 2012 17:29:06 +0000 (19:29 +0200)]
emacs: make show view a/A/x/X key bindings more consistent

Modify the show view key bindings as follows to make them more

'a' = Archive current message, then move to next message, or show next
thread from search if at the last message in thread.

'A' = Archive each message in thread, then show next thread from

'x' = Archive current message, then move to next message, or exit back
to search results if at the last message in thread.

'X' = Archive each message in thread, then exit back to search

The changes make the key bindings more consistent in two ways:
1) 'a'/'A' both advance to the next thread like 'a' used to.
2) 'x' operates on messages and 'X' on threads like 'a'/'A'.

9 years agoNEWS: document Emacs UI tagging operations changes
Dmitry Kurochkin [Sun, 5 Feb 2012 07:13:53 +0000 (11:13 +0400)]
NEWS: document Emacs UI tagging operations changes

9 years agoemacs: s/tags/tag-changes/ for arguments of tagging functions
Dmitry Kurochkin [Sun, 5 Feb 2012 07:13:52 +0000 (11:13 +0400)]
emacs: s/tags/tag-changes/ for arguments of tagging functions

This makes the argument names more consistent and clear.  The
following functions changed: `notmuch-tag',
`notmuch-search-tag-thread', `notmuch-search-tag-region' and

9 years agoemacs: accept empty tag list in `notmuch-tag'
Dmitry Kurochkin [Sun, 5 Feb 2012 07:13:51 +0000 (11:13 +0400)]
emacs: accept empty tag list in `notmuch-tag'

Since `notmuch-tag' is a non-interactive function and hence is meant
to be invoked programmatically, it should accept zero tags.  Also, the
tagging operations (bound to "*", "+", "-") would accept empty input
without an error.

9 years agoemacs: relax tag syntax check in `notmuch-tag' function
Dmitry Kurochkin [Sun, 5 Feb 2012 07:13:50 +0000 (11:13 +0400)]
emacs: relax tag syntax check in `notmuch-tag' function

The tag syntax check in `notmuch-tag' function was too strict and did
not allow nmbug tags with "::".  Since the check is done for all
tagging operations in Emacs UI, this basically means that no nmbug
tags can be changed.  The patch relaxes the tag syntax check to allow
any tag names that do not include whitespace characters.

9 years agoemacs: separate history for operations which accept single and multiple tags
Dmitry Kurochkin [Sun, 5 Feb 2012 07:13:49 +0000 (11:13 +0400)]
emacs: separate history for operations which accept single and multiple tags

Some tag-related operations accept a single tag without prefix
(`notmuch-select-tag-with-completion'), others accept multiple tags
prefixed with '+' or '-' (`notmuch-read-tag-changes').  Before the
change, both functions used a single default minibuffer history.  This
is inconvenient because you have to skip options with incompatible
format when going through the history.  The patch adds separate
history lists for the two functions.  Note that functions that accept
the same input format (e.g. "+", "-", "*") share the history list as

9 years agoemacs: add "*" binding for notmuch-show view
Dmitry Kurochkin [Sun, 5 Feb 2012 07:13:48 +0000 (11:13 +0400)]
emacs: add "*" binding for notmuch-show view

The patch adds `notmuch-show-tag-all' function bound to "*" in
notmuch-show view.  The function is similar to the
`notmuch-search-tag-all' function for the notmuch-search view: it
changes tags for all messages in the current thread.

9 years agoemacs: rename `notmuch-search-operate-all' to `notmuch-search-tag-all'
Dmitry Kurochkin [Sun, 5 Feb 2012 07:13:47 +0000 (11:13 +0400)]
emacs: rename `notmuch-search-operate-all' to `notmuch-search-tag-all'

`Notmuch-search-tag-all' is more clear and consistent with other
tagging function names.

9 years agotest: fix emacs tests after tagging operations changes
Dmitry Kurochkin [Sun, 5 Feb 2012 07:13:46 +0000 (11:13 +0400)]
test: fix emacs tests after tagging operations changes

After the recent tagging operations changes, functions bound to "+"
and "-" in notmuch-search and notmuch-show views always read input
from the minibuffer.  Use kbd macros instead of calling them directly.

9 years agoemacs: make "+" and "-" tagging operations in notmuch-show more flexible
Dmitry Kurochkin [Sun, 5 Feb 2012 07:13:45 +0000 (11:13 +0400)]
emacs: make "+" and "-" tagging operations in notmuch-show more flexible

Before the change, "+" and "-" tagging operations in notmuch-show view
accepted only a single tag.  The patch makes them use the recently
added `notmuch-read-tag-changes' function, which allows to enter
multiple tags with "+" and "-" prefixes.  So after the change, "+" and
"-" bindings in notmuch-show view allow to both add and remove
multiple tags.  The only difference between "+" and "-" is the
minibuffer initial input ("+" and "-" respectively).

9 years agoemacs: make "+" and "-" tagging operations in notmuch-search more flexible
Dmitry Kurochkin [Sun, 5 Feb 2012 07:13:44 +0000 (11:13 +0400)]
emacs: make "+" and "-" tagging operations in notmuch-search more flexible

Before the change, "+" and "-" tagging operations in notmuch-search
view accepted only a single tag.  The patch makes them use the
recently added `notmuch-read-tag-changes' function (renamed
`notmuch-select-tags-with-completion'), which allows to enter multiple
tags with "+" and "-" prefixes.  So after the change, "+" and "-"
bindings in notmuch-search view allow to both add and remove multiple
tags.  The only difference between "+" and "-" is the minibuffer
initial input ("+" and "-" respectively).

9 years agoemacs: remove text properties from `notmuch-search-get-tags' result
Dmitry Kurochkin [Sun, 5 Feb 2012 07:13:43 +0000 (11:13 +0400)]
emacs: remove text properties from `notmuch-search-get-tags' result

9 years agoemacs: move tag format validation to `notmuch-tag' function
Dmitry Kurochkin [Sun, 5 Feb 2012 07:13:42 +0000 (11:13 +0400)]
emacs: move tag format validation to `notmuch-tag' function

Before the change, tag format validation was done in
`notmuch-search-operate-all' function only.  The patch moves it down
to `notmuch-tag', so that all users of that function get input

9 years agotag: remove unused attribute from notmuch_tag_command() arguments
Dmitry Kurochkin [Sat, 28 Jan 2012 08:02:33 +0000 (12:02 +0400)]
tag: remove unused attribute from notmuch_tag_command() arguments

Argc and argv arguments are used in notmuch_tag_command() function.
So unused attribute is not appropriate for them.

9 years agoemacs: use mark instead of point-max in MML quoting.
David Bremner [Sat, 4 Feb 2012 18:40:24 +0000 (13:40 -0500)]
emacs: use mark instead of point-max in MML quoting.

As Aaron explains in id:""

  Using point-max would include the signature in the quoting as well.
  It would probably be fairly odd to want to put an MML tag in one’s
  signature, but that doesn’t mean that we should break that usage.

We had to use point-max in the 0.11.1 bug-fix release, because the
mark functionality was added post 0.11.

9 years agotest: Fix up date in MML quoting tests.
David Bremner [Sat, 4 Feb 2012 18:37:33 +0000 (13:37 -0500)]
test: Fix up date in MML quoting tests.

based on id:""

Commit 66ecd9063 made dates "real", but it hasn't hit release yet.

9 years agoMerge commit '0.11.1'
David Bremner [Sat, 4 Feb 2012 17:01:46 +0000 (12:01 -0500)]
Merge commit '0.11.1'


NEWS merged by hand, others taken from master.

9 years agoemacs: fix `notmuch-wash-region-to-button' to work at beginning of buffer
Dmitry Kurochkin [Sat, 4 Feb 2012 07:36:37 +0000 (11:36 +0400)]
emacs: fix `notmuch-wash-region-to-button' to work at beginning of buffer

`Notmuch-wash-region-to-button' is the function that creates hidden
regions with buttons for signatures, citations and original messages.
Before the change, it did not work correctly if the to-be-hidden
region started at the beginning of a message: the visibility toggle
button was hidden as well.  The patch fixes this.  There are two parts
in the fix:

* Use `insert-before-markers' instead of `insert' for creating the
  button, so that it does not get added to the hidden overlay.

* Stop using PREFIX argument for adding a newline before the button.
  The newline should not be added before a button at the beginning of

The corresponding test is fixed now.

9 years agotest: add test for hiding Original Message region at beginning of a message
Dmitry Kurochkin [Sat, 4 Feb 2012 07:36:36 +0000 (11:36 +0400)]
test: add test for hiding Original Message region at beginning of a message

The test is currently broken and will be fixed by a subsequent patch.

The patch adds a new file for tests of Emacs notmuch-show view.

Based on patch by David Edmondson [1].

[1] id:""

9 years agoemacs: Move the blank line from the bottom of the headers to the top of the body.
David Edmondson [Mon, 30 Jan 2012 16:52:20 +0000 (16:52 +0000)]
emacs: Move the blank line from the bottom of the headers to the top of the body.

The blank line doesn't really change position, but is now considered
to be part of the body rather than part of the headers. This means
that it is visible when the body is visible rather than when the
headers are visible.