Commit graph

5207 commits

Author SHA1 Message Date
David Bremner
e042a25a3f CLI: add optional config data to dump output.
Note that it changes the default dump output format, but doesn't break
existing notmuch-restore. It might break user scripts though.
2016-05-25 07:07:56 -03:00
David Bremner
92e59568fa lib: config list iterators
Since xapian provides the ability to restrict the iterator to a given
prefix, we expose this ability to the user. Otherwise we mimic the other
iterator interfances in notmuch (e.g. tags.c).
2016-05-25 06:51:16 -03:00
David Bremner
3458e3c89c lib: provide config API
This is a thin wrapper around the Xapian metadata API. The job of this
layer is to keep the config key value pairs from colliding with other
metadata by transparently prefixing the keys, along with the usual glue
to provide a C interface.

The split of _get_config into two functions is to allow returning of the
return value with different memory ownership semantics.
2016-05-24 08:53:03 -03:00
Ludovic LANGE
7e6e23c36e ruby: add bindings for notmuch_database_get_all_tags
The Ruby bindings were missing a way to get all the tags of the
database. Now you should be able to access this with the public
instance method `all_tags` of your database object.

Example of use:
    notmuchdb = Notmuch::Database.new path, { :create => false,
    	:mode => Notmuch::MODE_READ_ONLY }

    my_tags = notmuchdb.all_tags

    my_tags.each { |tag|
      print tag
    }

    my_tags.destroy!

Amended by db: improve error reporting, add test
2016-05-19 08:02:43 -03:00
Tomi Ollila
b183f2635e test: copyright information updates
Files in test directories had only copyright of a single individual,
of which code was adapted here as a base of the test system.
Since then many Notmuch Developers have contributed to the test
system, which is now acknowledged with a constant string in some
of the test files.

The README file in test directory instructed new files contain a
copyright notice, but that has never been done (and it is also not
needed). To simplify things a bit (and lessen confusion) this
instruction is now removed.

As a side enchangement, all of the 3 entries in the whole source
tree cd'ing to `dirname` of "$0" now uses syntax cd "$(dirname "$0")".
This makes these particular lines work when current working directory
is e.g. /c/Program Files/notmuch/test/.
(Probably it would fail elsewhere, though.)
2016-05-19 07:56:58 -03:00
Tomi Ollila
fd3503e99e emacs: bind notmuch-show-resend-message to 'b' in notmuch-show mode
This binding is similar to mutt's, which is

bind {mode} b   "bounce-message"    # remail a message to another user

where {mode} is 'index', 'pager' or 'attach'.
2016-05-19 07:53:51 -03:00
Tomi Ollila
c13ff402c4 emacs: add function to resend message to new recipients
The new function notmuch-show-message-resend re-sends
message to new recipients using #'message-resend.

Recipients are read from minibuffer as a comma-separated
string (with some keyboard support including tab completion).

Final confirmation before sending is asked.
2016-05-19 07:53:40 -03:00
Tomi Ollila
eac2976389 cli: tell how many messages were precisely matched when expected 1 match
In case of notmuch reply and notmuch show --part=N it is required that
search terms match to one message. If match count was != 1, error
message "Error: search term did not match precisely one message"
was too vague to explain what happened.

By appending (matched <num> messages) to the error message it
makes the problem more understandable (e.g when <num> is '0'
user reckons the query had a typo in it).
2016-05-19 07:49:03 -03:00
Tomi Ollila
2ee9351224 configure: combine common parts of CONFIGURE_C{,XX}FLAGS
By combining the common parts of CONFIGURE_CFLAGS and CONFIGURE_CXXFLAGS
to a separate make variable and using that as part of their
definitions makes setting of these easier, DRYer and less error prone
(especially as we cannot check potential typing errors there).
2016-05-19 07:45:09 -03:00
David Bremner
1aa6f90a10 configure: check directly for xapian compaction API
This is consistent with the check for FieldProcessor, and probably a bit
more robust.
2016-05-13 20:50:49 -03:00
David Bremner
792bea5aff lib/cli: add library API / CLI for compile time options
This is intentionally low tech; if we have more than two options it may
make sense to build up what infrastructure is provided.
2016-05-13 07:29:12 -03:00
David Bremner
bbf6069252 lib: optionally support single argument date: queries
This relies on the FieldProcessor API, which is only present in xapian
>= 1.3.
2016-05-08 08:17:07 -03:00
David Bremner
1871be319a configure: detect Xapian:FieldProcessor
Rather than check versions, it seems more robust to do a test compile.
2016-05-08 08:17:07 -03:00
Tomi Ollila
124a67e96e configure: add set -u
In case of any unset variable, make ./configure exit with nonzero value;
an attempt to expand an unset variable is a bug in the script
(usually a spelling mistake) and those should not pass through
unnoticed.
2016-05-07 14:40:14 -03:00
Tomi Ollila
43eb32527b configure: replace ${CXXLAGS} with ${CXXFLAGS_for_sh}
Variable CXXLAGS expands to nothing, CXXFLAGS something unusable
here; CXXFLAGS_for_sh expands to what we expect here.
2016-05-07 14:38:01 -03:00
Jani Nikula
73339ade99 cli: remove leftover dir variable
No functional changes.
2016-05-02 07:33:13 -03:00
Jani Nikula
2c1a7321e9 configure: SC2016: Expressions don't expand in single quotes
Fix shellcheck warnings. Use double quotes but escape $ to make it
look more intentional.
2016-05-01 21:21:53 -03:00
Jani Nikula
b191de511e configure: SC2034: glib_cflags and glib_ldflags appear unused.
Fix shellcheck warnings.
2016-05-01 21:21:39 -03:00
Jani Nikula
8a75fcfa7b configure: SC2059: Don't use variables in the printf format string.
Fix shellcheck warnings. Use printf "..%s.." "$foo".
2016-05-01 21:20:54 -03:00
Jani Nikula
2b7b32fc47 configure: SC2006: Use $(..) instead of legacy ..
Fix shellcheck warnings.
2016-05-01 21:20:05 -03:00
David Bremner
0777828745 Merge emacs bug fixes from release 2016-05-01 21:11:45 -03:00
David Edmondson
64b0d21da0 emacs: Tell `message-mode' that outgoing messages are email.
When composing messages (including replies, etc.), indicate to
`message-mode' definitively that the message is email (as opposed to
Usenet news) rather than having it attempt to determine this for itself.

This causes `message-mode' to observe such variables as
`message-default-mail-headers', which previously happened haphazardly.
2016-05-01 08:06:24 -03:00
David Edmondson
fdce7eb545 emacs: Observe the charset of MIME parts when reading them.
`notmuch--get-bodypart-raw' previously assumed that all non-binary MIME
parts could be successfully read by assuming that they were UTF-8
encoded. This was demonstrated to be wrong, specifically when a part was
marked as ISO8859-1 and included accented characters (which were
incorrectly rendered as a result).

Rather than assuming UTF-8, attempt to use the part's declared charset
when reading it, falling back to US-ASCII if the declared charset is
unknown, unsupported or invalid.
2016-05-01 08:04:07 -03:00
Stefano Zacchiroli
e3e03fb718 notmuch-mutt: use env to locate perl for increased portability
Note: this patch drops -w from the shebang line, but we still have
"use warnings" in the script, which is superior anyhow.

Thanks Andreas Tolfsen for the suggestion.
2016-04-30 07:34:00 -03:00
David Bremner
ea5caecec5 debian: add versioned depends on dpkg-dev
This is needed to support build profiles (e.g. nocheck)
2016-04-26 21:40:40 -03:00
David Bremner
3646eb17ae debian: add changelog stanza for 0.22 2016-04-26 21:38:15 -03:00
David Bremner
e6e395435d bump version and NEWS date for 0.22 release 2016-04-26 21:36:53 -03:00
Tomi Ollila
1819d03c27 NEWS: mention try-emacs-mua
A non-technical introduction for users who read NEWS to have better
chance to find ./devel/notmuch-emacs-mua when they test or experiment
with notmuch emacs MUA next time.
2016-04-25 07:39:37 -03:00
David Bremner
2434ecfba3 debian: changelog stanza for 0.22~rc1-1 2016-04-24 18:03:54 -03:00
David Bremner
0a58d534a5 version: bump to 0.22~rc1 2016-04-24 18:02:05 -03:00
David Bremner
15a529b1f6 NEWS: entry for emacs mua address completion 2016-04-24 17:56:15 -03:00
David Bremner
ce2ead0be9 NEWS: document some bug fixes 2016-04-24 17:56:15 -03:00
David Bremner
1bea126908 NEWS: document S/MIME support 2016-04-24 17:56:15 -03:00
David Bremner
e22cf5f49c NEWS: note no-op-ness of notmuch-message-address-insinuate 2016-04-24 17:56:15 -03:00
David Bremner
85e1513bc1 NEWS: note dropping "pkg-config emacs" 2016-04-24 17:56:15 -03:00
David Bremner
f0345dd351 NEWS: add note about xapian 1.3 support 2016-04-24 17:56:15 -03:00
David Bremner
b194340ecc doc: change copyright date
Yes, it is 2016
2016-04-24 17:49:18 -03:00
David Edmondson
a26a4c5283 Emacs related NEWS for 0.22. 2016-04-18 08:17:42 -03:00
David Edmondson
bfd8100cff emacs: Don't indent multipart sub-parts during reply.
When generating cited messages for replay, override any existing
setting for `notmuch-show-indent-multipart' to ensure that no
indentation occurs.
2016-04-16 09:40:14 -03:00
David Bremner
6cf9ac9933 debian: minimal changelog for 0.22~rc0-1 2016-04-16 08:45:56 -03:00
David Bremner
73334f403c version: bump to 0.22~rc0 2016-04-16 08:44:39 -03:00
Jani Nikula
8a433aad99 bindings: drop build time message on missing ruby dependency
The usual make message on everything being up to date is:

	make: Nothing to be done for 'all'.

However, since

commit d038b93209
Author: David Bremner <david@tethera.net>
Date:   Mon Jun 1 09:08:59 2015 +0200

    build: integrate building ruby bindings into notmuch build process

if one doesn't have the ruby dependencies installed, the message has
been:

	Missing dependency, skipping ruby bindings

Restore the usual behaviour by dropping the message. It's redundant
during build anyway, since the configure script already outputs:

	Checking for ruby development files... No (skipping ruby bindings)
2016-04-16 08:26:40 -03:00
Chunyang Xu
e5548d52b9 emacs: Add notmuch homepage to package header
So user can find out notmuch's homepage with:

  C-h P ('describe-package') notmuch
2016-04-16 08:25:10 -03:00
Chunyang Xu
0cf457b73b emacs: Fix packaging
Refer to (info "(elisp) Library Headers") for package conventions.
2016-04-16 08:24:42 -03:00
Daniel Kahn Gillmor
e366bb2227 complete ghost-on-removal-when-shared-thread-exists
To fully complete the ghost-on-removal-when-shared-thread-exists
proposal, we need to clear all ghost messages when the last active
message is removed from a thread.

Amended by db: Remove the last test of T530, as it no longer makes sense
if we are garbage collecting ghost messages.
2016-04-15 07:13:49 -03:00
Daniel Kahn Gillmor
1695415039 On deletion, replace with ghost when other active messages in thread
There is no need to add a ghost message upon deletion if there are no
other active messages in the thread.

Also, if the message being deleted was a ghost already, we can just go
ahead and delete it.
2016-04-15 07:07:23 -03:00
Daniel Kahn Gillmor
9eebae3da4 Introduce _notmuch_message_has_term()
It can be useful to easily tell if a given message has a given term
associated with it.
2016-04-15 07:07:23 -03:00
Daniel Kahn Gillmor
011fc41d4d Add internal functions to search for alternate doc types
Publicly we are only exposing the non-ghost documents (of "type"
"mail").  But internally we might want to inspect the ghost messages
as well.

This changeset adds two new private interfaces to queries to recover
information about alternate document types.
2016-04-15 07:07:23 -03:00
Daniel Kahn Gillmor
604d1e0977 fix thread breakage via ghost-on-removal
implement ghost-on-removal, the solution to T590-thread-breakage.sh
that just adds a ghost message after removing each message.

It leaks information about whether we've ever seen a given message id,
but it's a fairly simple implementation.

Note that _resolve_message_id_to_thread_id already introduces new
message_ids to the database, so i think just searching for a given
message ID may introduce the same metadata leakage.
2016-04-15 07:07:23 -03:00
Daniel Kahn Gillmor
92559ee347 test thread breakage when messages are removed and re-added
This test (T590-thread-breakage.sh) has known-broken subtests.

If you have a two-message thread where message "B" is in-reply-to "A",
notmuch rightly sees this as a single thread.

But if you:

 * remove "A" from the message store
 * run "notmuch new"
 * add "A" back into the message store
 * re-run "notmuch new"

Then notmuch sees the messages as distinct threads.

This happens because if you insert "B" initially (before anything is
known about "A"), then a "ghost message" gets added to the database in
reference to "A" that is in the same thread, which "A" takes over when
it appears.

But if "A" is subsequently removed, no ghost message is retained, so
when "A" appears, it is treated as a new thread.

I see a few options to fix this:

ghost-on-removal
----------------

We could unilaterally add a ghost upon message removal.  This has a
few disadvantages: the message index would leak information about what
messages the user has ever been exposed to, and we also create a
perpetually-growing dataset -- the ghosts can never be removed.

ghost-on-removal-when-shared-thread-exists
------------------------------------------

We could add a ghost upon message removal iff there are other
non-ghost messages with the same thread ID.

We'd also need to remove all ghost messages that share a thread when
the last non-ghost message in that thread is removed.

This still has a bit of information leakage, though: the message index
would reveal that i've seen a newer message in a thread, even if i had
deleted it from my message store

track-dependencies
------------------

rather than a simple "ghost-message" we could store all the (A,B)
message-reference pairs internally, showing which messages A reference
which other messages B.

Then removal of message X would require deleting all message-reference
pairs (X,B), and only deleting a ghost message if no (A,X) reference
pair exists.

This requires modifying the database by adding a new and fairly weird
table that would need to be indexed by both columns.  I don't know
whether xapian has nice ways to do that.

scan-dependencies
-----------------

Without modifying the database, we could do something less efficient.

Upon removal of message X, we could scan the headers of all non-ghost
messages that share a thread with X.  If any of those messages refers
to X, we would add a ghost message.  If none of them do, then we would
just drop X entirely from the table.

---------------------

One risk of attempted fixes to this problem is that we could fail to
remove the search term indexes entirely.  This test contains
additional subtests to guard against that.

This test also ensures that the right number of ghost messages exist
in each situation; this will help us ensure we don't accumulate ghosts
indefinitely or leak too much information about what messages we've
seen or not seen, while still making it easy to reassemble threads
when messages come in out-of-order.
2016-04-15 07:07:23 -03:00