Commit graph

2111 commits

Author SHA1 Message Date
David Edmondson
45ad21fba1 emacs: Re-arrange message sending code
Define a new `mail-user-agent' (`notmuch-user-agent') and use it by
default. Re-arrange various routines that send mail to use this
(compose, reply, forward). Insert a `User-Agent:' header by default.

This is the real commit for this functionality this time. The
previous attempt to merge this code:

	commit 57926bc7b0

was botched (by Carl Worth, not David) to include only the Makefile
change. So the build was broken until this commit that actually adds
the new file.
2010-04-23 15:41:33 -07:00
Michal Sojka
f106db3e9b test: Set fixed time zone
When the test suite is run in a different time zone that where Carl
lives, some tests may fail depending on the time when the test suite is
run. For example, just now I get:

     Search for all messages ("*"):...			FAIL
    --- test-031.expected	2010-04-23 09:33:47.898634822 +0200
    +++ test-031.output	2010-04-23 09:33:47.898634822 +0200
    @@ -1,5 +1,5 @@
    -thread:XXX   2001-01-05 [1/1] Notmuch Test Suite; Test message #6 (inbox unread)
    -thread:XXX   2001-01-05 [1/1] Notmuch Test Suite; Test message #14 (inbox unread)
    +thread:XXX   2001-01-06 [1/1] Notmuch Test Suite; Test message #6 (inbox unread)
    +thread:XXX   2001-01-06 [1/1] Notmuch Test Suite; Test message #14 (inbox unread)
     thread:XXX   2000-01-01 [1/1] Notmuch Test Suite; body search (inbox unread)
     thread:XXX   2000-01-01 [1/1] searchbyfrom; search by from (inbox unread)
     thread:XXX   2000-01-01 [1/1] Notmuch Test Suite; search by to (inbox unread)

By setting a fixed time zone in the test script, these problems should
be eliminated.

Signed-off-by: Michal Sojka <sojkam1@fel.cvut.cz>
2010-04-23 13:28:33 -07:00
David Edmondson
7135a8bcbf emacs: Push the cursor to point-max on n' or N' at the end of a thread
Sebastian pointed out that the pre-JSON UI would move the cursor to
the end of the buffer if `n' or `N' is hit when on the last (unread)
message. Mimic that behaviour in the new UI.
2010-04-23 13:26:32 -07:00
David Edmondson
57926bc7b0 emacs: Re-arrange message sending code
Define a new `mail-user-agent' (`notmuch-user-agent') and use it by
default. Re-arrange various routines that send mail to use this
(compose, reply, forward). Insert a `User-Agent:' header by default.
2010-04-23 13:18:13 -07:00
Carl Worth
4b0994dd25 emacs: Fix some compilation warnings.
Fix missing argumen in declaration of notmuch-search function and add
a definition of notmuch-search-continuation to avoid warning about
assignment to a free variable.
2010-04-23 12:57:22 -07:00
David Edmondson
e9394932f7 emacs: Add notmuch-hello.el, a friendly frontend to notmuch
This is based on the prototype that Carl Worth described in the TODO
file. It provides a search bar as well as support for recent searches,
saved searches, and a list of all tags in the database (as well as the
number of messages with each tag).
2010-04-23 12:50:18 -07:00
David Edmondson
b65bcb5f8f emacs: Remove notmuch-search-authors-width' and fix the use of notmuch-search-result-format' accordingly
The width of the authors field in search output was previously
specified in two places:
 - `notmuch-search-authors-width': the limit beyond which the authors
   names are truncated,
 - `notmuch-search-result-format': the layout of the search results.

Changing the configuration of one of these may have required the user
to know about and adapt the other accordingly. This led to confusion.

Instead, remove `notmuch-search-authors-width' and perform truncation
based on the relevant field in `notmuch-search-result-format'.

Approved-By: Jameson Rollins <jrollins@finestructure.net>
2010-04-23 12:14:17 -07:00
Jesse Rosenthal
44982ab332 Reintroduce patch to quote args in notmuch-show to facilitate remote use
This reintroduces the patch committed in 9193455fa1, which was
reverted during the upgrade to the JSON emacs UI.
2010-04-23 11:59:47 -07:00
Carl Worth
14fb9f3c55 notmuch setup: Prompt for tags to set on new messages.
Our "notmuch setup" command is only really helpful if it guides the
user through all the possible options. So add this one.
2010-04-23 10:30:40 -07:00
Carl Worth
c63b6473ca config: Rename messages.new_tags to just new.tags
I think one configuration group for each top-level command makes a lot
of sense. And this makes the existing naming of set_new_tags and
get_new_tags also very reasonable.
2010-04-23 10:29:28 -07:00
Carl Worth
444923e2d0 Clarify the documentation for the new_tags configuration option.
Specifically mentioning that it's a list separated by ';' and use
"will" instead of "should".
2010-04-23 09:28:45 -07:00
Carl Worth
15e71cfda7 notmuch setup: Fix new configuration-file groups to get comments
Our intent has always been that when new configuration-file settings
are created by notmuch, that they get created with comments telling
the user how to use them. But this was only working before when the
entire configuration file was created.

We fix this so that when a new group is added, (such as the recently-
added [messages] section) that it gets its documentation.
2010-04-23 09:20:40 -07:00
Carl Worth
65d278afb1 Sprinkle some const-correctness around new_tags.
To eliminate a compiler warning.
2010-04-23 09:19:52 -07:00
Ben Gamari
143d436874 notmuch-config: make new message tags configurable
Add a new_tags option in the [messages] section of the configuration
file to allow the user to specify which tags should be added to new
messages by notmuch new.
2010-04-23 08:41:59 -07:00
Sebastian Spaeth
af8664689a python: Add UNSORTED as Query.SORT option
Keep up to date with the libnotmuch.so API.

Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
2010-04-23 13:40:38 +02:00
Sebastian Spaeth
be7b24eb21 python: Delete unused files
No more .hg files needed in the git repo.
No stock notmuch-test suite needed in a subdirectory.
We have the real one in this repository

Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
2010-04-23 13:40:29 +02:00
Carl Worth
ec6d78acf1 test: Put the json tests into their own section.
Not that the sections actually mean anything yet, but it makes for
clean output.
2010-04-22 17:17:11 -07:00
Carl Worth
e6e0cb942c notmuch search: Fix timezone of timestamp in --format=json output
This is one of those cases that I move love. Deleting code fixes
a bug, (test suite now passes again).
2010-04-22 17:12:07 -07:00
Gregor Hoffleit
08deef5f75 First tests for JSON output and UTF-8 in mail body and subject
The test suite doesn't yet cover --format=json output nor UTF-8 in
subject or body.

This patch starts with test cases for 'search --format=json' and
'show --format=json'.

Furthermore, it has test cases for a search for a UTF-8 string in a mail
body for a UTF-8 string in a mail subject.

Finally, it has a test case for --format=json with UTF-8 messages,
demonstrating the fix in 1267697893-sup-4538@sam.mediasupervision.de.

Reviewed-by: Carl Worth <cworth@cworth.org>
Updated tests to current implementation of the test suite.
These tests demonstrate a bug in the current implementation
of "notmuch show --format=json", (timestamp output is changed
depending on current timezone).
2010-04-22 17:10:23 -07:00
Carl Worth
e31aa92a4c test: Make existing "notmuch show" test more resilient
If future updates to the test suite add more messages to the database
before this "notmuch show" test, then the message-ID numbers in the
expected output will all change. But we can at least compute the
numbers so that this test will continue to pass.
2010-04-22 17:08:08 -07:00
David Edmondson
afb8c9ca62 json: Replace date_unix' with timestamp' in show output
Search output was already using `timestamp' for a very similar field,
so follow that.
2010-04-22 14:52:32 -07:00
Carl Worth
0b2cf3527e emacs: Add customize treatment and rename refresh-script to notmuch-poll-script
With defcustom the user can easily find this variable (and its
documentation) within "M-x customize-group" "notmuch" (though finding
*that* is still tricky).

The new name of notmuch-poll-script is also easier to remember, (for
me at least).
2010-04-22 14:46:15 -07:00
Carl Worth
577a6906ce emacs: Use consistent naming for the two new poll functions.
Emacs scoping rules strongly encourage us to have fully-namespaced
function names. A prefix like "notmuch-search" is a pretty ugly
namespace name, but it's what we have for now.
2010-04-22 14:24:37 -07:00
Dirk Hohndel
f373ed0792 Add 'G' keybinding to folder and search view that triggers external poll
The new functions first check if an external poll script has been defined in
the variable 'notmuch-external-refresh-script and if yes, runs that script
before executing the existing refresh function (which is bound to '=')

This can be used to have 'G' mimic the mutt behavior of polling an external
mail server - or if the mail polling is already automatic, it can trigger
the call to notmuch new and any necessary automatic tagging of new email.

Signed-off-by: Dirk Hohndel <hohndel@infradead.org>
2010-04-22 14:22:09 -07:00
Carl Worth
21965718a5 Revert "thread: Simplify code for assigning the subject."
This reverts commit 36e4459a32.

With the two previous reverts, this fixes the recent message-sorting
regression, so the test suite now passes again.
2010-04-22 14:01:41 -07:00
Carl Worth
a109966080 Revert "thread: Fix sort of search when constructing threads."
This reverts commit f43990ce13.
2010-04-22 14:00:33 -07:00
Carl Worth
6a0cba4ae0 Revert "thread: Removed unsed sort argument from _thread_add_matched_message"
This reverts commit 7fb56f9dc5.
2010-04-22 14:00:17 -07:00
Carl Worth
5106df9f6b test: Add a test to demonstrate message-sorting regression.
In the recent change to rename threads based on changing subject
lines, I broke message ordering within "notmuch show" output. But our
test suite didn't catch that regressions, because we didn't have any
tests of "notmuch show".

This adds one "notmuch show" test along with the thread-naming
tests. It's not a whole suite of "notmuch show" testing, but it does
catch this regression at least.
2010-04-22 13:26:37 -07:00
Carl Worth
01f03cf098 test: When a test fails, show diff only (save complete output to a file)
We're starting to get test output that's fairly long, so it's much
kinder to just show a diff rather than displaying the complete
expected and actual output. To allow the user to investigate things
after the fact, we save the expected and actual output to files named
test-${test_number}.expected and test-${test_number}.output .
2010-04-22 13:22:08 -07:00
Carl Worth
9a3d4a0f2a test: Improve grammar in test-message subjects.
Before codifying these in any expected test output, I'd like them to
at least resemble English.
2010-04-22 13:21:15 -07:00
Jameson Rollins
419b88059d Fix help message for "show"
Help message for "show" mistakenly refers to '--output' instead of
'--format'.
2010-04-21 17:45:39 -07:00
Carl Worth
8cbb5114a2 Merge Sebastian Spaeth's python bindings into bindings/python
Sebastian offered to maintain these bindings within the notmuch
repository and offered them in the following repository:

	git://github.com/spaetz/python-notmuch.git

These are the bindings formerly known as "cnotmuch" and now known
simply as "notmuch" from within python.

The bindings are not yet integrated into the build system and
packaging of the primary ntomuch repository.
2010-04-21 17:30:11 -07:00
Carl Worth
3b558de781 Move everything down into a bindings/python directory.
In preparation for merging the python bindings into the notmuch
repository.
2010-04-21 17:29:34 -07:00
Carl Worth
7fb56f9dc5 thread: Removed unsed sort argument from _thread_add_matched_message
The reworked solution for naming a thread based on the subject of
oldest/newest matching message no longer needs this argument.
2010-04-21 17:05:16 -07:00
Carl Worth
38c595738f emacs: Move definition of notmuch-folders to earlier in the file.
To avoid a warning about a free variable from the emacs compiler.
2010-04-21 17:04:36 -07:00
Servilio Afre Puentes
3bf27d6c58 emacs: Try to name search buffers using info in notmuch-folders
As the user has already defined aliases for certain searches in
notmuch-folders, search buffer names that use these aliases will
be easier to identify.
2010-04-21 16:58:46 -07:00
Sebastian Spaeth
40ff2ab62a notmuch-tag: don't sort messages before applying tag changes
It's not neccessary to sort the results before we apply tags. Xapian
contributor Olly Betts says that savings might be bigger with a cold
file cache and (as unsorted implies really sorted by document id) a better
cache locality when applying tags to messages.

Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
2010-04-21 16:06:09 -07:00
Sebastian Spaeth
aadb15a002 query.cc: allow to return query results unsorted
Previously, we always sorted the returned results by some string value,
(newest-to-oldest by default), however in some cases (as when applying
tags to a search result) we are not interested in any special order.

This introduces a NOTMUCH_SORT_UNSORTED value that does just that. It is
not used at the moment anywhere in the code.

Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
2010-04-21 16:06:05 -07:00
Carl Worth
f41a35e292 notmuch: Abort if specified configuration file is not found.
When there is no configuration file at all, (and none specified),
notmuch works correctly by assuming correct default values. But when
the user specifies a configuration file (with the NOTMUCH_CONFIG
environment variable) and that file doesn't exist, then notmuch should
aboirt and let the user know about the problem.
2010-04-21 15:54:03 -07:00
Carl Worth
f43990ce13 thread: Fix sort of search when constructing threads.
The thread-naming feature depends on the matched messages being passed
down in a precise order, (the order of the top-level search). We fix
the feature by passing that sort order down.
2010-04-21 15:52:28 -07:00
Carl Worth
2a1a4f0551 test: Add tests for naming threads with changing subjects.
We recently added a feature to name threads based on the messages that
actually matched the search, (as opposed to simply the oldest or
newest message in the thread whether it matched or not). So add tests
for that, and (surprise, surprise!) the feature does not entirely
work.
2010-04-21 15:50:33 -07:00
Carl Worth
36e4459a32 thread: Simplify code for assigning the subject.
We know that matched messages are always added in order, so we can
always just grab the subject from the first message. This is the same
approach that was used previously in _thread_add_message. That is, the
recent feature of renaming a thread based on the subject of the
"first" matched message is as simple as moving the subject assignment
from _thread_add_message to _thread_add_matched_message.
2010-04-21 15:06:02 -07:00
Jesse Rosenthal
4971b85641 Name thread based on matching msgs instead of first msg.
At the moment all threads are named based on the name of the first message
in the thread. However, this can cause problems if people either start
new threads by replying-all (as unfortunately, many out there do) or
change the subject of their mails to reflect a shift in a thread on a
list.

This patch names threads based on (a) matches for the query, and (b) the
search order. If the search order is oldest-first (as in the default
inbox) it chooses the oldest matching message as the subject. If the
search order is newest-first it chooses the newest one.

Reply prefixes ("Re: ", "Aw: ", "Sv: ", "Vs: ") are ignored
(case-insensitively) so a Re: won't change the subject.

Note that this adds a "sort" argument to _notmuch_thread_create and
_thread_add_matched_message, so that when constructing the thread we can
be aware of the sort order.

Signed-off-by: Jesse Rosenthal <jrosenthal@jhu.edu>
2010-04-21 14:56:53 -07:00
Carl Worth
2186cac8e7 configure: Print version of Xapian found during configure check.
This might be handy to know, (since there are important performance
considerations that depend on the Xapian version).
2010-04-21 14:18:56 -07:00
Carl Worth
cbcc3454ae configure: Generalize the GMime configure checks.
This way when GMime 2.8 comes out we can simply add it to the list
rather than adding an additional block of conditional code for it.
Also GMime 2.6 is now preferred over GMime 2.4.
2010-04-21 14:17:14 -07:00
Adrien Bustany
65b634145a configure: Add support for GMime 2.6
Notmuch compiles just fine with GMime 2.6, so accept it in the configure
script.
2010-04-21 14:17:14 -07:00
Carl Worth
8981842ff6 emacs: Fix notmuch-search-authors-width declaration.
Our defcustom call was missing the 'notmuch group, which emacs was
nice enough to warn about during compilation.
2010-04-21 14:17:14 -07:00
David Edmondson
8cee113819 emacs: Support for customizing search result display
This patch helps in customizing search result display similar to
mutt's index_format. The customization is done by defining an alist as
below:

(setq notmuch-search-result-format '(("date" . "%s ")
				     ("authors" . "%-40s ")
				     ("subject" . "%s ")))

The supported keywords are date, count, authors, subject and tags.

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@gmail.com>
Signed-off-by: David Edmondson <dme@dme.org>
2010-04-21 13:37:14 -07:00
Carl Worth
6157fe0bfd emacs/notmuch-show.el: Part headers are real buttons that save the part
Convert the part headers into buttons that save the part when
activated.
2010-04-21 13:19:19 -07:00
David Edmondson
c579c8201f emacs: Display all body parts using `notmuch part --part=<n>'
Use the `notmuch part' command to access body parts not currently
included in the JSON output and display those body parts
appropriately.
2010-04-21 13:14:46 -07:00