Commit graph

2908 commits

Author SHA1 Message Date
Justus Winter
6f7469f547 Use notmuch_database_destroy instead of notmuch_database_close
Adapt the notmuch binaries source to the notmuch_database_close split.

Signed-off-by: Justus Winter <4winter@informatik.uni-hamburg.de>
2012-04-28 09:27:33 -03:00
Justus Winter
2b3e9ff467 NEWS: Document the notmuch_database_close split
Signed-off-by: Justus Winter <4winter@informatik.uni-hamburg.de>
2012-04-28 09:26:25 -03:00
Justus Winter
7864350c93 Split notmuch_database_close into two functions
Formerly notmuch_database_close closed the xapian database and
destroyed the talloc structure associated with the notmuch database
object. Split notmuch_database_close into notmuch_database_close and
notmuch_database_destroy.

This makes it possible for long running programs to close the xapian
database and thus release the lock associated with it without
destroying the data structures obtained from it.

This also makes the api more consistent since every other data
structure has a destructor function.

The comments in notmuch.h are a courtesy of Austin Clements.

Signed-off-by: Justus Winter <4winter@informatik.uni-hamburg.de>
2012-04-28 09:21:13 -03:00
Austin Clements
9429141bb1 emacs: Put notmuch-hello-sections in custom group notmuch-hello 2012-04-24 23:39:19 -03:00
Austin Clements
2e7b649404 new: Fix missing end_atomic in remove_filename on error
Previously, if we failed to find the message by filename in
remove_filename, we would return immediately from the function without
ending its atomic block.  Now this code follows the usual goto DONE
idiom to perform cleanup.
2012-04-24 23:25:52 -03:00
Austin Clements
746fef0aea new: Print final fatal error message to stderr
This was going to stdout.  I removed the newline at the beginning of
printing the fatal error message because it wouldn't make sense if you
were only looking at the stderr stream (e.g., you had redirected
stdout to /dev/null).
2012-04-24 23:25:52 -03:00
Austin Clements
d3b5533123 new: Handle fatal errors in remove_filename and _remove_directory
Previously such errors were simply ignored.  Now they cause an
immediate cleanup and abort.
2012-04-24 23:25:51 -03:00
Austin Clements
e075ee37c9 new: Consistently treat fatal errors as fatal
Previously, fatal errors in add_files_recursive were not treated as
fatal by its callers (including itself!).  This makes
add_files_recursive errors consistently fatal and updates all callers
to treat them as fatal.
2012-04-24 23:25:51 -03:00
Austin Clements
ff53fb468e emacs: Put notmuch-print-mechanism in custom group notmuch-show 2012-04-24 23:25:51 -03:00
Peter Wang
443faa3fcc config: Fix free in 'config get' implementation.
The array returned by g_key_file_get_string_list() should be freed with
g_strfreev(), not free().
2012-04-24 23:25:51 -03:00
Jameson Graef Rollins
5073de34b4 emacs: modify help message for notmuch-search-line-faces to reflect preferred "deleted" tag name.
No functional change here.  The help message previously referred to
the "delete" tag, but "deleted" is now preferred, so hopefully this
will reduce any potential confusion.
2012-04-24 23:25:51 -03:00
Felipe Contreras
85e991affc vim: simplify build
There should be no functional changes, except that you don't need to
make the directories before installing.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
2012-04-21 05:19:30 +03:00
Jakob
ae525b7e5b vim: fix regex after "notmuch show" output change
The new field "excluded" was added to the output and made this regex fail.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
2012-04-21 05:19:30 +03:00
Jani Nikula
de0557477d lib: work around talloc_steal usage from C++ code
Implicit typecast from 'void *' to 'T *' is okay in C, but not in
C++. In talloc_steal, an explicit cast is provided for type safety in
some GCC versions. Otherwise, a cast is required. Provide a template
function for this to maintain type safety, and redefine talloc_steal
to use it.

The template must be outside the extern "C" block (NOTMUCH_BEGIN_DECLS
and NOTMUCH_END_DECLS), but keep it within the GCC visibility #pragma.

No functional changes, apart from making the library build with
compilers other than recent GCC.

Signed-off-by: Jani Nikula <jani@nikula.org>
2012-04-15 09:42:15 -03:00
Austin Clements
cddc270346 Record dependencies during build instead of before
Previously, the makefile created dependency files in a separate, first
pass.  In particular, include-ing the dependency files would cause
make to attempt to rebuild those files using the dependency-generation
rules in the makefile.  Unfortunately, this approach required obtuse
rules and silently delayed the start of the build process (by quite a
bit on a clean tree without any dependency files).  Worse, this
required the dependency files to themselves depend on all of the
headers the source file depended on, which meant that, if a header
file was removed, the depedency file could not be updated because of a
missing dependency (!), which would cause make to silently fail.

This patch eliminates the dependency generation rules and instead
generates dependency files as a side-effect of the regular build rule.
On the first build, we don't need to know the dependencies beforehand;
the object file doesn't exist, so it will be built anyway.  On
subsequent builds, if a header file is updated, the dependency rules
generated by the previous build will force a rebuild.  If a source
file is updated, the dependency rules may be stale, but it doesn't
matter because the updated source file will force a rebuild.

In the final case above, the stale dependency rules may refer to a
header file that no longer exists but is also no longer needed.  In
order to prevent this from breaking the build, we also pass gcc the
-MP option, which generates phony targets for every depended-on header
file, so make won't complain if it can't find them during a later
build.
2012-04-15 09:42:15 -03:00
Austin Clements
2886af551e show: Remove empty message_set_{start,sep,end} fields
Setting these to NULL is equivalent to the empty string now.
2012-04-15 09:42:15 -03:00
Austin Clements
67da35222c show: Support NULL values for message_set_{start, sep, end}
Many formats don't need these, so it's more convenient if they don't
have to set them at all.
2012-04-15 09:42:15 -03:00
Austin Clements
9070e5cc43 show: Remove unused fields from notmuch_show_format
These fields were only used by old-style formatters.
2012-04-15 09:42:15 -03:00
Austin Clements
ae59f4ab4d Remove show-message.c
There are no more calls to show_message_body.
2012-04-15 09:42:15 -03:00
Austin Clements
b92f15d014 show: Remove support for old-style formatters in show_message
show_message used to have a compatibility path for old-style
formatters.  This removes that.
2012-04-15 09:42:15 -03:00
Austin Clements
98cad5a207 Sync schemata with current code structure
The schema itself hasn't changed, but many of the references to
functions in notmuch-show.c were out of date.
2012-04-15 09:42:14 -03:00
Jameson Graef Rollins
6c84116091 emacs: have tag-completion return all tags for nil input
Previously the function would fail if the initial input was nil.  Now
it will return a list of all tags, which obviously makes much more
sense.
2012-04-12 15:34:49 -03:00
Austin Clements
f9ad237273 News for raw format changes 2012-04-12 08:46:44 -03:00
Jameson Graef Rollins
925473e238 debian: add gnupg-agent to notmuch recommends
gnupg-agent is required for message decryption, so this should help
stem some issues encountered by users trying to decrypt messages.
2012-04-12 08:44:38 -03:00
Jameson Graef Rollins
8225ff21ec emacs: include tags from excluded messages in tag tab completion
The new message exclude functionality will hide tags that only exist
on excluded messages.  However, one might very well want to manually
modify excluded tags.  This makes sure tags from excluded messages are
always available in tab completion.
2012-04-12 08:43:22 -03:00
Jameson Graef Rollins
1d4758e21f emacs: update call in tag-completion function
"search-tags" is deprecated, so use the more modern and supported
"search --output=tags".
2012-04-12 08:42:55 -03:00
Dmitry Kurochkin
6409a27b2c emacs: get rid of trailing spaces in notmuch-hello view
This patch removes trailing spaces in notmuch-hello view.

A side effect of this change is that tag/query buttons no longer
include a space at the end.  This means that pressing RET when the
point is at the first character after the tag/query button no longer
works (note that this is the standard behavior for buttons).  We may
change this behavior in the future (without adding trailing spaces
back) if people would find this change inconvenient.
2012-04-12 08:40:33 -03:00
Mark Walters
075d7df01e emacs: make show set --exclude=false
Show has to set --exclude=false to deal with cases where it is asked
to show a single excluded message. It uses JSON so it can easily pass
the exclude information to the user.
2012-04-07 23:06:31 -03:00
Mark Walters
6478e1bc92 test: add some exclude tests
Systematically test the exclude options for search. Also move the
search existing exclude tests into the new test. There is some overlap
between the two sets of tests but many of the existing ones are there
because they triggered bugs in the past so I have kept them to ensure
coverage.
2012-04-07 23:06:21 -03:00
Mark Walters
903327279c cli: move show to the new --exclude= option naming scheme.
This moves notmuch show to the --exclude=(true|false) naming
scheme. When exclude=false show returns all threads that match
including those that only match in an excluded message. The excluded
messages are flagged.

When exclude=true the behaviour depends on whether --entire-thread is
set. If it is not set then show only returns the messages which match
and are not excluded. If it is set then show returns all messages in
the threads that match in a non-excluded message, flagging the excluded
messages in these threads. The rationale is that it is awkward to use
a thread with some missing messages.
2012-04-07 23:05:56 -03:00
Mark Walters
fd62a25f91 cli: move search to the new --exclude= naming scheme.
This commit replaces the --no-exclude option with a
--exclude=(true|false|flag) option. The default is to omit the
excluded messages.

The flag option only makes sense if output=summary (as otherwise there
is nowhere to print the flag). In summary output exclude=false and
exclude=flag give almost identical output:
they differ in that with the exclude=flag option the match count
(i.e., the x in [x/n] in the output) is the number of matching
non-excluded messages rather than the number of matching messages.

Note this changes the default for output=summary when no --exclude=
option is given: it used to default to flag and now defaults to true
(i.e. omit excluded messages). This is neccesary to keep the cli
output uncluttered and for speed reasons.
2012-04-07 23:05:41 -03:00
Mark Walters
785c1e497f cli: move count to the new --exclude=(true|false|flag) naming scheme.
Move the option --no-exclude to the --exclude= scheme. Since there is
no way to flag messages only true and false are implemented. Note
that, for consistency with other commands, this is implemented as a
keyword option rather than a boolean option.
2012-04-07 23:05:18 -03:00
Mark Walters
d6fbef4690 lib: change default for notmuch_query_set_omit_excluded 2012-04-07 22:58:33 -03:00
Jani Nikula
052000f85a emacs: do not modify the alist passed to notmuch-sort-saved-searches
Sort modifies its input as a side effect. Pass it a copy in
notmuch-sort-saved-searches to not modify the notmuch-saved-searches
alist.
2012-04-06 12:34:16 -03:00
David Bremner
6acd61dad9 configure: change gmime version in help message to 2.6
Since GMime 2.6 is now the stable version upstream, and probably the
most tested by notmuch developers, it makes sense to suggest that to
users to install.
2012-04-05 08:01:32 -03:00
Tomi Ollila
3c7d97c3c7 configure: print info about required gmime 2.4 or 2.6 versions
In case required gmime (2.4 or 2.6) version if not found print information
about both alternatives (and currently minimal 2.6 version that is needed).
2012-04-05 07:53:04 -03:00
Tomi Ollila
e8138c522b configure: add empty line after each missing component message
Currently whenever message about missing GMime, Glib or talloc is
printed the message is 2 lines, component info and its http location
in next line. In the future the amount of lines will vary. To ease
reading in these cases newline is added after each message.
2012-04-05 07:50:51 -03:00
Dmitry Kurochkin
1361dd37bc emacs: fix off-by-one error in notmuch-hello column alignment
Expected results for few tests are fixed, the relevant test is
unmarked broken.
2012-04-05 07:40:12 -03:00
Dmitry Kurochkin
818790f7b5 test: add broken test for long names in Emacs notmuch-hello view
Currently, the column alignment in Emacs notmuch-hello is broken for
tags/queries with long names.
2012-04-05 07:37:53 -03:00
Adam Wolfe Gordon
e4844fafec emacs: Fix the References header in reply
In the new reply code, the References header gets inserted by
message.el using a function called message-shorten-references. Unlike
all the other header-inserting functions, it doesn't put a newline
after the header, causing the next header to end up on the same
line. In our case, this header happened to be User-Agent, so it's hard
to notice. This is probably a bug in message.el, but we need to work
around it.

This fixes the problem by wrapping message-shorten-references in a
function that inserts a newline after if necessary. This should
protect against the message.el bug being fixed in the future.
2012-04-02 17:47:04 -03:00
Adam Wolfe Gordon
bc531924e0 test: Show all headers in emacs reply tests
By default, emacs hides the User-Agent and References headers when
composing mail. This is a good thing for users, but a bad thing for
testing, since we can create ugly or invalid headers and not have it
show up in the tests.

By setting message-hidden-headers to an empty list, we force emacs to
show all the headers, so we can check that they're correct. Users
won't see this, but it will let us catch future bugs.

As a side-effect, this breaks all the reply tests, since there is a
bug with the References and User-Agent headers, fixed in the next commit.
2012-04-02 17:45:36 -03:00
Adam Wolfe Gordon
3737ca6e26 emacs: Fix two bugs in reply
Bug 1: Replying from alternate addresses
----------------------------------------

The reply code was inconsistent in its use of symbols and strings for
header names being passed to message.el functions. This caused the
From header to be lookup up incorrectly, causing an additional From
header to be added with the user's primary address instead of the
correct alternate address.

This is fixed by using symbols everywhere, i.e. never using strings
for header names when interacting with message.el.

This change also removes our use of `mail-header`, since we don't use
it anywhere else, and using assq makes it clear how the header lists
are expected to work.

Bug 2: Duplicate headers in emacs 23.2
--------------------------------------

The message.el code in emacs 23.2 assumes that header names will
always be passed as symbols, so our use of strings caused
problems. The symptom was that on 23.2 (and presumably on earlier
versions) the reply message would end up with two of some headers.

Converting everything to symbols also fixes this issue.
2012-04-02 17:45:27 -03:00
Adam Wolfe Gordon
b45b72aa14 test: Tests for reply from alternate addresses in emacs
Since the recent reply changes were pushed, there has been a bug that
causes emacs to always reply from the primary address, even if the
JSON or default CLI reply output uses an alternate address.

This adds two tests to the emacs test library based on the two "Reply
form..." tests in the reply test library. One is currently marked
broken.
2012-04-02 17:45:16 -03:00
Stefano Zacchiroli
f162b19148 notmuch-mutt: fix typo in manpage 2012-03-31 11:33:45 -03:00
Stefano Zacchiroli
84f7ac7fc3 NEWS: document inclusion of contrib/notmuch-mutt 2012-03-31 11:33:40 -03:00
Austin Clements
839a80513a emacs: Fix mis-named argument to notmuch-get-bodypart-internal
Previously, this function took an argument called "message-id", even
though it was a general query, rather than a message ID.  This changes
it to "query".
2012-03-31 08:27:15 -03:00
Austin Clements
4ba18958b5 reply: Move reply citation printing to the recursive MIME walk
This makes more logical sense, since it makes the recursive printer
responsible for the entire reply body and lets it start at the root of
the MIME tree instead of the first child.  (We could move reply header
creation in there, too, but if we ever support proper reply to
multiple messages, we'll want just one set of reply headers computed
from the entire message set and many bodies.)
2012-03-31 08:17:55 -03:00
Austin Clements
4d322fb579 reply: Convert default reply format to self-recursive style
This re-arranges the default reply formatter code to use the
mime_node_t abstraction.  There are no semantic changes.
2012-03-31 08:17:41 -03:00
Austin Clements
ea4fd50f45 show/reply: Unify the code that extracts text parts
Previously, show and reply had separate implementations of decoding
and printing text parts.  Now both use show's implementation, which
was more complete.  Show's implementation has been extended with an
option to add reply quoting to the extracted part (this is implemented
as a named flag to avoid naked booleans, even though it's the only
flag it can take).
2012-03-31 08:17:20 -03:00
Austin Clements
ee1180018e emacs: Escape all message ID queries
This adds a lib function to turn a message ID into a properly escaped
message ID query and uses this function wherever we previously
hand-constructed ID queries.  Wherever this new function is used,
documentation has been clarified to refer to "id: queries" instead of
"message IDs".

This fixes the broken test introduced by the previous patch.
2012-03-30 21:27:03 -03:00