notmuch.git
12 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
constructor.

Signed-off-by: Justus Winter <4winter@informatik.uni-hamburg.de>
12 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
separately.

12 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 =".

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

12 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
argument.

12 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
default.

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

12 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
`notmuch-show-refresh-view'.

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.

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

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

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

12 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
result.

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

12 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 <jani@nikula.org>
12 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 <jani@nikula.org>
12 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 <jani@nikula.org>
12 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.

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

12 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 <jani@nikula.org>
12 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.

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

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

12 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 <4winter@informatik.uni-hamburg.de>
12 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 rtfd.org to build the documentation without libnotmuch.

Signed-off-by: Justus Winter <4winter@informatik.uni-hamburg.de>
12 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 <4winter@informatik.uni-hamburg.de>
12 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
consistent:

'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
search.

'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
results.

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

12 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

12 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
`notmuch-search-tag-all'.

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

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

12 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
before.

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

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

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

12 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).

12 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).

12 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

12 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
validation.

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

12 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:"m2vco72tf3.fsf@wal122.wireless-pennnet.upenn.edu"

  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.

12 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:"1328264649-27346-3-git-send-email-pieter@praet.org"

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

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

Conflicts:
NEWS
bindings/python/notmuch/database.py
bindings/python/notmuch/message.py
notmuch.1

NEWS merged by hand, others taken from master.

12 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
  buffer.

The corresponding test is fixed now.

12 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:"1327562380-12894-4-git-send-email-dme@dme.org"

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

12 years agoemacs: More address cleaning.
David Edmondson [Mon, 30 Jan 2012 14:59:54 +0000 (14:59 +0000)]
emacs: More address cleaning.

Remove outer single-quotes from the mailbox part. Allow for multiple
sets of nested single and double quotes.

Add more tests.

12 years agoemacs: Prefer '[No Subject]' to blank subjects.
David Edmondson [Mon, 30 Jan 2012 10:16:01 +0000 (10:16 +0000)]
emacs: Prefer '[No Subject]' to blank subjects.

12 years agoemacs: Stop the `truncate-string-to-width' madness.
David Edmondson [Mon, 30 Jan 2012 10:16:00 +0000 (10:16 +0000)]
emacs: Stop the `truncate-string-to-width' madness.

There's no need to call `truncate-string-to-width' twice in this code
path.

12 years agolib: Use talloc to simplify cleanup in notmuch_database_open
Austin Clements [Sun, 29 Jan 2012 05:50:10 +0000 (00:50 -0500)]
lib: Use talloc to simplify cleanup in notmuch_database_open

Previously, we manually "free"d various pointers in
notmuch_database_open.  Use a local talloc context instead to simplify
cleanup and eliminate various NULL pointer initializations and
conditionals.

12 years agolib: Release resources if notmuch_database_open fails
Austin Clements [Sun, 29 Jan 2012 05:50:09 +0000 (00:50 -0500)]
lib: Release resources if notmuch_database_open fails

Previously, if a Xapian exception occurred in notmuch_database_open,
we failed to clean up the allocated notmuch_database_t object.

12 years agolib: Don't delete uninitialized pointers
Austin Clements [Sun, 29 Jan 2012 05:50:08 +0000 (00:50 -0500)]
lib: Don't delete uninitialized pointers

In the error-handling paths of notmuch_database_open, we call
notmuch_database_close, which "delete"s several objects referenced by
the notmuch_database_t object.  However, some of these pointers may be
uninitialized, resulting in undefined behavior.  Hence, allocate the
notmuch_database_t with talloc_zero to make sure these pointers are
NULL so that "delete"ing them is harmless.

12 years agotest: remove ".sh" extension from the recently added Emacs tests
Dmitry Kurochkin [Sat, 28 Jan 2012 04:47:39 +0000 (08:47 +0400)]
test: remove ".sh" extension from the recently added Emacs tests

All test files, except for the recently added Emacs tests, do not have
".sh" extension.  So remove it from the new test files for consistency.

12 years agoconfigure: update explicit check for glib : >= 2.22
Pieter Praet [Fri, 3 Feb 2012 12:12:25 +0000 (13:12 +0100)]
configure: update explicit check for glib : >= 2.22

As of commit b3caef1f, we're using g_array_unref() in 'lib/query.cc',
which was only introduced in glib 2.22, so update the dependency.

Thanks to datapipe@gmail.com for reporting this [1].

Also see commit b88e6abc.

[1] id:"alpine.DEB.2.02.1201132130220.21970@ltspubuntu4.int.smq.datapipe.net"

12 years agodebian: changelog for 0.11.1 0.11.1 debian/0.11.1-1
David Bremner [Fri, 3 Feb 2012 12:36:58 +0000 (08:36 -0400)]
debian: changelog for 0.11.1

mention the two bugfixes

12 years agoversion: bump to 0.11.1
David Bremner [Fri, 3 Feb 2012 12:32:49 +0000 (08:32 -0400)]
version: bump to 0.11.1

also semi-automatically update man page and python bindings versions.

12 years agoNEWS: set release date for 0.11.1
David Bremner [Fri, 3 Feb 2012 12:30:30 +0000 (08:30 -0400)]
NEWS: set release date for 0.11.1

12 years agoemacs: quote MML tags in replies
Aaron Ecay [Fri, 3 Feb 2012 10:24:08 +0000 (11:24 +0100)]
emacs: quote MML tags in replies

Emacs message-mode uses certain text strings to indicate how to attach
files to outgoing mail.  If these are present in the text of an email,
and a user is tricked into replying to the message, the user’s files
could be exposed.

Edited-by: Pieter Praet <pieter@praet.org>: Rebased to release branch.
12 years agotest: add tests for quoting of MML tags in replies
Aaron Ecay [Fri, 3 Feb 2012 10:24:07 +0000 (11:24 +0100)]
test: add tests for quoting of MML tags in replies

The test is broken at this time; the next commit will introduce a fix.

Edited-by: Pieter Praet <pieter@praet.org>:
  Rebased to release branch, moved expected output into the actual test,
  and fixed "Fcc:" line.

12 years agoemacs: globally replace non-branching "(if COND (progn ..." with "(when ..."
Pieter Praet [Wed, 1 Feb 2012 13:50:00 +0000 (14:50 +0100)]
emacs: globally replace non-branching "(if COND (progn ..." with "(when ..."

Less code, same results, without sacrificing readability.

12 years agoemacs: fix show-previous-message doc string
Jameson Graef Rollins [Wed, 25 Jan 2012 00:06:23 +0000 (16:06 -0800)]
emacs: fix show-previous-message doc string

12 years agoemacs: modify the default show-mode key bindings for archiving
Jameson Graef Rollins [Wed, 25 Jan 2012 00:06:22 +0000 (16:06 -0800)]
emacs: modify the default show-mode key bindings for archiving

This changes the default key bindings for the 'a' key in notmuch-show
mode.  Instead of archiving the entire thread, it now just archives
the current message, and then advance to the next open message
(archive-message-then-next).  'A' is now bound to the previous
archive-thread-then-next function.

12 years agoemacs: use pop-at-end functionality in show-archive-message-then-next function
Jameson Graef Rollins [Wed, 25 Jan 2012 00:06:21 +0000 (16:06 -0800)]
emacs: use pop-at-end functionality in show-archive-message-then-next function

This provides a smoother message processing flow by reducing the
number of key presses needed for these common operations.

12 years agoemacs: add option to show-next-{, open-}message functions to pop out to parent buffer...
Jameson Graef Rollins [Wed, 25 Jan 2012 00:06:20 +0000 (16:06 -0800)]
emacs: add option to show-next-{, open-}message functions to pop out to parent buffer if at end

This will allow for keybindings that achieve a smoother message
processing flow by reducing the number of key presses needed for most
common operations.

12 years agoemacs: add message archiving functions
Jameson Graef Rollins [Wed, 25 Jan 2012 00:06:19 +0000 (16:06 -0800)]
emacs: add message archiving functions

This adds two new message archiving functions that parallel the thread
archiving functions: notmuch-show-archive-message{,-then-next}.  The
former also takes a prefix argument to unarchive the message (ie. put
back in inbox).

12 years agoemacs: break out thread navigation from notmuch-show-archive-thread
Jameson Graef Rollins [Wed, 25 Jan 2012 00:06:18 +0000 (16:06 -0800)]
emacs: break out thread navigation from notmuch-show-archive-thread

This function is now just for archiving the current thread.  A new
function is created to archive-then-next.  The 'a' key binding is
updated accordingly.

This will allow people to bind to the simple thread archiving function
without the extra navigation.  The archive-thread function now also
takes a prefix to unarchive the current thread (ie. put the whole
thread back in the inbox).

12 years agoemacs: break up notmuch-show-archive-thread-internal into two more generally useful...
Jameson Graef Rollins [Wed, 25 Jan 2012 00:06:17 +0000 (16:06 -0800)]
emacs: break up notmuch-show-archive-thread-internal into two more generally useful functions

Break up notmuch-show-archive-thread-internal into two new functions:

notmuch-show-tag-thread-internal: applies a tag to all messages in
thread.  If option remove flag is t, tags will be removed instead of
added.

notmuch-show-next-thread: moves to the next thread in the search
result.  If given a prefix, will show the next result, otherwise will
just move to it in the search view.

Two new interactive functions, notmuch-show-{add,remove}-tag-thread,
are also added.  Together, these provide a better suit of thread
tagging and navigation tools.

The higher level thread archiving functions are modified to use these
new function.

12 years agoemacs: use search-next-thread to move to next thread in show mode
Jameson Graef Rollins [Wed, 25 Jan 2012 00:06:16 +0000 (16:06 -0800)]
emacs: use search-next-thread to move to next thread in show mode

We should always use the dedicated search mode navigation functions,
in case navigation mechanics change down the line.

12 years agomoved _config_(get|set)_list () functions earlier in the file
Tomi Ollila [Mon, 30 Jan 2012 10:31:25 +0000 (12:31 +0200)]
moved _config_(get|set)_list () functions earlier in the file

Moved static functions _config_get_list () and _config_set_list ()
closer to the beginning of file so that their definition is known
(without adding forward declarations) in upcoming changes.

12 years agoemacs: Don't mark messages as "unsaved" when printing.
David Edmondson [Wed, 25 Jan 2012 13:48:33 +0000 (13:48 +0000)]
emacs: Don't mark messages as "unsaved" when printing.

`ps-print-buffer' notes that a buffer is unsaved unless
`buffer-modified-p' returns `nil', so ensure that it does.

12 years agoemacs: Another special case for `notmuch-show-clean-address'.
David Edmondson [Wed, 25 Jan 2012 13:54:00 +0000 (13:54 +0000)]
emacs: Another special case for `notmuch-show-clean-address'.

Remove backslashes.

12 years agotest: Updated expected output for new `notmuch-show-clean-address'.
David Edmondson [Wed, 25 Jan 2012 13:53:59 +0000 (13:53 +0000)]
test: Updated expected output for new `notmuch-show-clean-address'.

12 years agoemacs: Avoid `mail-header-parse-address' in `notmuch-show-clean-address'.
David Edmondson [Wed, 25 Jan 2012 13:53:58 +0000 (13:53 +0000)]
emacs: Avoid `mail-header-parse-address' in `notmuch-show-clean-address'.

`mail-header-parse-address' expects un-decoded mailbox parts, which is
not what we have at this point. Replace it with simple string
deconstruction.

Mark the corresponding test as no longer broken.

Minor whitespace cleanup.

12 years agoemacs: Re-enable line wrapping in `notmuch-show-mode'.
David Edmondson [Thu, 26 Jan 2012 08:17:50 +0000 (08:17 +0000)]
emacs: Re-enable line wrapping in `notmuch-show-mode'.

Turn on `visual-line-mode' via a hook, so that those who so choose can
avoid it.

12 years agoemacs: `notmuch-search-operate-all' code cleanup, no functional changes
Dmitry Kurochkin [Thu, 26 Jan 2012 17:34:49 +0000 (21:34 +0400)]
emacs: `notmuch-search-operate-all' code cleanup, no functional changes

12 years agoemacs: add completion to "tag all" operation ("*" binding)
Dmitry Kurochkin [Thu, 26 Jan 2012 17:34:48 +0000 (21:34 +0400)]
emacs: add completion to "tag all" operation ("*" binding)

The patch adds <tab> completion to "tag all" operation bound to "*"
(`notmuch-search-operate-all' function).

12 years agotest: `notmuch-test-run' should protect against buffer switching.
David Edmondson [Thu, 26 Jan 2012 07:19:38 +0000 (07:19 +0000)]
test: `notmuch-test-run' should protect against buffer switching.

The body of the test may cause the current buffer to change. Ensure
that the output goes to the correct buffer by switching back before
inserting it.

12 years agotest: `visible-buffer-substring' should not return text properties.
David Edmondson [Thu, 26 Jan 2012 07:19:37 +0000 (07:19 +0000)]
test: `visible-buffer-substring' should not return text properties.

When using `visible-buffer-substring' to examine a buffer, the text
properties are not useful, so don't include them.

12 years agoemacs: polish notmuch-hello help text
Dmitry Kurochkin [Wed, 25 Jan 2012 18:24:56 +0000 (22:24 +0400)]
emacs: polish notmuch-hello help text

Make `=' binding description consistent with others.

12 years agoemacs: Fix a notmuch-print.el compiler warning.
David Edmondson [Wed, 25 Jan 2012 08:52:15 +0000 (08:52 +0000)]
emacs: Fix a notmuch-print.el compiler warning.

`notmuch-show-get-prop' should be declared.

12 years agoemacs: Make the part content available to `mm-inlinable-p'.
David Edmondson [Thu, 19 Jan 2012 09:34:07 +0000 (09:34 +0000)]
emacs: Make the part content available to `mm-inlinable-p'.

The `mm-inlinable-p' function works better if it has access to the
data of the relevant part, so load that content before calling it.

Don't load the content for parts that the user has indicated no desire
to inline.

This fixes the display of attached image/jpeg parts, for example.

12 years agoemacs: bind "s" to `notmuch-hello-search' in notmuch-hello buffer
Dmitry Kurochkin [Wed, 25 Jan 2012 01:10:54 +0000 (05:10 +0400)]
emacs: bind "s" to `notmuch-hello-search' in notmuch-hello buffer

`notmuch-hello-search' uses `notmuch-search' function but refreshes
notmuch-hello buffer when the search buffer is closed.

12 years agoemacs: use a single history for all searches
Dmitry Kurochkin [Wed, 25 Jan 2012 01:10:53 +0000 (05:10 +0400)]
emacs: use a single history for all searches

There are two ways to do search in Emacs UI: search widget in
notmuch-hello buffer and `notmuch-search' function bound to "s".
Before the change, these search mechanisms used different history
lists.  The patch makes notmuch-hello search use the same history list
as `notmuch-search' function.

12 years agoemacs: bind "s" to `notmuch-search' in notmuch-hello buffer
Dmitry Kurochkin [Wed, 25 Jan 2012 01:10:52 +0000 (05:10 +0400)]
emacs: bind "s" to `notmuch-search' in notmuch-hello buffer

Before the change, "s" in notmuch-hello buffer would jump to the
search box.  The patch changes the binding to `notmuch-search' which
is consistent with all other notmuch buffers.

12 years agouncrustify.cfg: label indent, some known types, not, # and ##
Tomi Ollila [Tue, 24 Jan 2012 20:55:59 +0000 (22:55 +0200)]
uncrustify.cfg: label indent, some known types, not, # and ##

Adjusted some uncrustify variables to get closer to prevailing style:

* Label indent (for goto) relative to current indentation.
* Registered GMimeObject and mime_node_t being as types.
* Space after ! (not) operator.
* No space after 'stringify' (#) preprosessor token.
* No spacing change around ## (option not versatile enough).

There are at least 3 cases where attention needs to be paid:

* If there is newline between function name and open paren in function
  call, the paren (and args) are indented too far right.
* #define HOUR (60 *MINUTE) -- i.e. no space after star (*).
* void (*foo)(args) -- i.e no space between (name) and (args).

12 years agotest: Add address cleaning tests.
David Edmondson [Tue, 24 Jan 2012 16:14:07 +0000 (16:14 +0000)]
test: Add address cleaning tests.

12 years agotest: Add more helpers for emacs tests.
David Edmondson [Tue, 24 Jan 2012 16:14:06 +0000 (16:14 +0000)]
test: Add more helpers for emacs tests.

12 years agotest: Add `test_emacs_expect_t'.
David Edmondson [Tue, 24 Jan 2012 16:14:05 +0000 (16:14 +0000)]
test: Add `test_emacs_expect_t'.

Add a new test function to allow simpler testing of emacs
functionality.

`test_emacs_expect_t' takes one argument - a lisp expression to
evaluate. The test passes if the expression returns `t', otherwise it
fails and the output is reported to the tester.

12 years agotest: Don't return the result of checking for running emacs to the tester.
David Edmondson [Tue, 24 Jan 2012 16:14:04 +0000 (16:14 +0000)]
test: Don't return the result of checking for running emacs to the tester.

When checking for a running emacs, test_emacs evaluates the empty list
'()'. This returns 'nil' when emacs is running, which is then
prepended to the actual test result. Given that it is not part of the
actual test output the test harness can incorrectly report test
failure (or success).

12 years agoshow: Introduce mime_node formatter callback
Austin Clements [Mon, 23 Jan 2012 23:33:10 +0000 (18:33 -0500)]
show: Introduce mime_node formatter callback

This callback is the gateway to the new mime_node_t-based formatters.
This maintains backwards compatibility so the formatters can be
transitioned one at a time.  Once all formatters are converted, the
formatter structure can be reduced to only message_set_{start,sep,end}
and part, most of show_message can be deleted, and all of
show-message.c can be deleted.

12 years agomime node: Record depth-first part numbers
Austin Clements [Mon, 23 Jan 2012 23:33:09 +0000 (18:33 -0500)]
mime node: Record depth-first part numbers

This makes the part numbers readily accessible to formatters.
Hierarchical part numbering would be a more natural and efficient fit
for MIME and may be the way to go in the future, but depth-first
numbering maintains compatibility with what we currently do.

12 years agoemacs: have notmuch-search-archive-thread use -next-thread function
Jameson Graef Rollins [Tue, 17 Jan 2012 18:54:26 +0000 (10:54 -0800)]
emacs: have notmuch-search-archive-thread use -next-thread function

Use this standard function, to keep thread navigation in one place.

12 years agoNEWS: update "Tag exclusion" section
Pieter Praet [Mon, 23 Jan 2012 05:41:45 +0000 (06:41 +0100)]
NEWS: update "Tag exclusion" section

12 years agosetup: prompt user for search.exclude_tags value
Pieter Praet [Mon, 23 Jan 2012 05:40:33 +0000 (06:40 +0100)]
setup: prompt user for search.exclude_tags value

Allow users to customize the search.exclude_tags option during setup.

12 years agosetup: Create functions for tag list printing and parsing
Austin Clements [Mon, 23 Jan 2012 05:50:45 +0000 (06:50 +0100)]
setup: Create functions for tag list printing and parsing

This refactors the tag list printing and parsing currently used for
new.tags so that both can be reused for the new search.exclude_tags
option.

12 years agoconfig: only exclude messages if 'search.exclude_tags' is explicitly set
Pieter Praet [Mon, 23 Jan 2012 04:22:34 +0000 (05:22 +0100)]
config: only exclude messages if 'search.exclude_tags' is explicitly set

Currently, the 'search.exclude_tags' option is automatically
set to "deleted;spam;" if it's missing from the config file.

This violates the Principle of Least Surprise, so *only* set
'search.exclude_tags' to "deleted;spam;" if we didn't find a
configuration file at all.

This patch is actually Austin Clements' work:
  id:"20120117203211.GQ16740@mit.edu"

12 years agotest: only exclude "deleted" messages from search if explicitly configured
Pieter Praet [Mon, 23 Jan 2012 04:22:33 +0000 (05:22 +0100)]
test: only exclude "deleted" messages from search if explicitly configured

Currently, the 'search.exclude_tags' option is automatically set to
"deleted;spam;" if it's missing from the config file.

This violates the Principle of Least Surprise, so update the tests to
*only* expect the exclusion of messages which are tagged "deleted" if the
'search.exclude_tags' option is explicitly set *and* contains that tag.

12 years agosearch: rename auto_exclude_tags to {search, }exclude_tags
Pieter Praet [Mon, 23 Jan 2012 04:22:32 +0000 (05:22 +0100)]
search: rename auto_exclude_tags to {search, }exclude_tags

All other config-related functions and args include the section
title in their name, so for the sake of consistency, mirror that.

Also, the "auto"matic part is a given, so that was dropped.

12 years agoAdd a NEWS section for 0.11.1 and document the python error handling bugfix
Justus Winter [Mon, 23 Jan 2012 12:15:03 +0000 (13:15 +0100)]
Add a NEWS section for 0.11.1 and document the python error handling bugfix

12 years agopython: fix error handling
Justus Winter [Sun, 22 Jan 2012 13:09:35 +0000 (14:09 +0100)]
python: fix error handling

Before 3434d1940 the return values of libnotmuch functions were
declared as c_void_p and the code checking for errors compared the
returned value to None, which is the ctypes equivalent of a NULL
pointer.

But said commit wrapped all the data types in python classes and the
semantic changed in a subtle way. If a function returns NULL, the
wrapped python value is falsish, but no longer equal to None.

Backported from master to 0.11.

12 years agoshow: Use consistent header ordering in the text format
Austin Clements [Mon, 23 Jan 2012 02:31:12 +0000 (21:31 -0500)]
show: Use consistent header ordering in the text format

Previously, top-level message headers were printed as Subject, From,
To, Date, while embedded message headers were printed From, To,
Subject, Date.  This makes both cases use the former order and updates
the tests accordingly.

Strangely, the raw format also uses this function, so this also fixes
the two raw format tests affected by this change.