Commit graph

4658 commits

Author SHA1 Message Date
David Bremner
110694b00b lib: note remaining uses of deprecated message search API
The two remaining cases in the lib seem to require more than a simple
replacement of the old call, with the new call plus a check of the
return value.
2015-09-04 08:08:18 -03:00
David Bremner
f16944c3b4 lib: remove use of notmuch_query_search_messages from query.cc
There is not too much point in worrying about the bad error reporting
here, because the count api is due for the same deprecation.
2015-09-04 08:06:08 -03:00
David Bremner
005c2f0df1 cli/lib: remove support for GMime 2.4
It's becoming a maintenance burden to do anything things with the
crypto glue code twice, once for 2.4 and once for 2.6. I don't have
any 2.4 version available to test on my development machine anymore,
so the 2.4 specific code paths are likely not very well tested.
2015-08-26 20:01:45 -03:00
Austin Clements
cb08a2ee01 lib: Add "lastmod:" queries for filtering by last modification
The implementation is essentially the same as the date range search
prior to Jani's fancy date parser.
2015-08-14 18:23:49 +02:00
David Bremner
f76d8f82dd cli: add global option "--uuid"
The function notmuch_exit_if_unmatched_db_uuid is split from
notmuch_process_shared_options because it needs an open notmuch
database.

There are two exceptional cases in uuid handling.

1) notmuch config and notmuch setup don't currently open the database,
   so it doesn't make sense to check the UUID.

2) notmuch compact opens the database inside the library, so we either
   need to open the database just to check uuid, or change the API.
2015-08-14 18:23:49 +02:00
David Bremner
5a3b42fb8c cli/count: add --lastmod
In the short term we need a way to get lastmod information e.g. for
the test suite. In the long term we probably want to add lastmod
information to at least the structured output for several other
clients (e.g. show, search).
2015-08-14 18:07:55 +02:00
Austin Clements
98ee460eaa lib: API to retrieve database revision and UUID
This exposes the committed database revision to library users along
with a UUID that can be used to detect when revision numbers are no
longer comparable (e.g., because the database has been replaced).
2015-08-13 23:52:51 +02:00
Austin Clements
7f57b747b9 lib: Add per-message last modification tracking
This adds a new document value that stores the revision of the last
modification to message metadata, where the revision number increases
monotonically with each database commit.

An alternative would be to store the wall-clock time of the last
modification of each message.  In principle this is simpler and has
the advantage that any process can determine the current timestamp
without support from libnotmuch.  However, even assuming a computer's
clock never goes backward and ignoring clock skew in networked
environments, this has a fatal flaw.  Xapian uses (optimistic)
snapshot isolation, which means reads can be concurrent with writes.
Given this, consider the following time line with a write and two read
transactions:

   write  |-X-A--------------|
   read 1       |---B---|
   read 2                      |---|

The write transaction modifies message X and records the wall-clock
time of the modification at A.  The writer hangs around for a while
and later commits its change.  Read 1 is concurrent with the write, so
it doesn't see the change to X.  It does some query and records the
wall-clock time of its results at B.  Transaction read 2 later starts
after the write commits and queries for changes since wall-clock time
B (say the reads are performing an incremental backup).  Even though
read 1 could not see the change to X, read 2 is told (correctly) that
X has not changed since B, the time of the last read.  In fact, X
changed before wall-clock time A, but the change was not visible until
*after* wall-clock time B, so read 2 misses the change to X.

This is tricky to solve in full-blown snapshot isolation, but because
Xapian serializes writes, we can use a simple, monotonically
increasing database revision number.  Furthermore, maintaining this
revision number requires no more IO than a wall-clock time solution
because Xapian already maintains statistics on the upper (and lower)
bound of each value stream.
2015-08-13 23:52:51 +02:00
Jani Nikula
c9e1c4f1c4 configure: clean up messages around reading libnotmuch version
Clean up punctuation for consistency, and add newline for clean
configure output.
2015-08-10 21:24:40 +02:00
David Bremner
765556c1f1 build: extract library versions from notmuch.h
- Make lib/notmuch.h the canonical location for the library versioning
information.

- Since the release-check should never fail now, remove it to reduce
complexity.

- Make the version numbers in notmuch.h consistent with the (now
  deleted) ones in lib/Makefile.local
2015-08-10 13:53:55 +02:00
Tomi Ollila
02a2eeb427 test: make script exit (1) if it "fails" to source (.) a file
The files (test) scripts source (with builtin command `.`) provides
information which the scripts depend, and without the `source` to
succeed allowing script to continue may lead to dangerous situations
(e.g. rm -rf "${undefined_variable}"/*).

At the end of all source (.) lines construct ' || exit 1' was added;
In our case the script script will exit if it cannot find (or read) the
file to be sourced. Additionally script would also exits if the last
command of the sourced file exited nonzero.
2015-08-07 21:56:39 +02:00
Tomi Ollila
af3eba97fd NEWS: emacs: notmuch-{cli,emacs}-version usage
News for notmuch-emacs-version usage in User-Agent header and
rename of function notmuch-version to notmuch-cli-version.

While at it, made some minor (consistency) punctuation changes
to make news to wiki conversion work as expected.
2015-08-07 21:46:33 +02:00
David Bremner
d02e4dee71 emacs/notmuch-mua.el: whitespace cleanup
M-x whitespace-cleanup in Emacs.
2015-08-07 21:33:57 +02:00
David Bremner
d0553ad524 emacs: make modifications to message Fcc vars buffer-local
Previously we globally modified these variables, which tended to cause
problems for people using message-mode, but not notmuch-mua-mail, to
send mail.

User visible changes:

- Calling notmuch-fcc-header-setup is no longer optional. OTOH, it
  seems to do the right thing if notmuch-fcc-dirs is set to nil.

- The Fcc header is visible during message composition

- The name in the mode line is changed, and no longer matches exactly
  the menu label.

- Previously notmuch-mua-send-and-exit was never called.  Either we
  misunderstood define-mail-user-agent, or it had a bug.  So there was
  no difference if the user called message-send-and-exit directly. Now
  there will be.

- User bindings to C-c C-c and C-c C-s in message-mode-map are
  overridden. The user can override them in notmuch-message-mode-map,
  but then they're on their own for Fcc handling.
2015-08-07 21:18:59 +02:00
David Bremner
03aff8499d emacs: define a notmuch-compose-mode based on message mode.
This is to provide a clean way of overriding e.g. keybindings when
sending mail from notmuch.

This is needed in particular to allow somewhere to dynamically bind
certain message-mode variables which are not respected when buffer-local. See e.g.

     http://debbugs.gnu.org/cgi/bugreport.cgi?bug=21174
2015-08-07 21:17:26 +02:00
David Bremner
ed9ceda623 test: add debugging output to notmuch-new tests, mark 5 as broken
I marked the tests where I really couldn't understand the output as
broken. It could also be that I don't understand how directory removal
is supposed to work.
2015-08-04 21:00:09 +02:00
David Bremner
e4e04bbc32 cli/new: add more debugging output
Try to narrow down what part of the code adds files and directories to
the queue(s) to be deleted.

Update one test. The output is slightly confusing, but I believe it is
correct, resulting from a directory being discovered but containing only ignored files.
2015-08-04 20:59:58 +02:00
David Bremner
e2fb06d369 test: don't claim single message mbox support is going away
We gave up on this.
2015-08-04 20:59:50 +02:00
Tomi Ollila
3c1eea5646 emacs: prefer notmuch-emacs-version in User-Agent: header
Now that we have `notmuch-emacs-version' defined in notmuch emacs MUA
use that as a part of User-Agent: header to provide more accurate
version information when sending emails.

In case some incomplete installation of notmuch emacs MUA is used and
`notmuch-emacs-version' is defined as "unknown" then fall back to ask
version info from cli (as it used to be before this commit).

Requiring notmuch-version[.elc] and if that is missing setting
"fallback" notmuch-emacs-version (to "unknown") was moved from
notmuch.el to notmuch-lib.el as notmuch-mua.el (which provides
User-Agent: information) require's the latter.
2015-08-04 20:56:38 +02:00
Tomi Ollila
0c565fa29f emacs: renamed function notmuch-version to notmuch-cli-version
As it asks `notmuch` binary for its version number.
2015-08-04 20:56:28 +02:00
Tomi Ollila
6d5c7b3ca5 devel/release-checks.sh: made python version check work with python 3
This trivial change consists of just putting print() argument in
parentheses.
2015-08-04 16:27:34 +02:00
David Bremner
23d86773b9 test: use the python interpreter in sh.config
The configure script chooses "python" if both python and python{2,3}
exist exists, so this could change the version of python used to run
the test suite.

The checking for ${NOTMUCH_PYTHON} in the test suite is arguably
over-engineering, since the configure step will fail if it can't find
it.
2015-08-04 09:19:18 +02:00
Mark Walters
2982d70ac6 emacs: add a filter option to show
Show the current thread with a different filter (i.e., open messages
in the thread matching the new query).

Bound to 'l' for "limit".

Note that it is not the same as filter in search mode as it replaces
the existing query rather than ANDing with it (but it does keep the
thread-id part of the query).
2015-08-04 09:15:23 +02:00
Mark Walters
d4053be21a emacs: split notmuch-show-apply-state
Separate out a notmuch-show-goto-msg-id sub-function from
notmuch-show-apply-state. There should be no functional change but the
next patch will call the new function.
2015-08-04 09:15:13 +02:00
David Bremner
6b440a0adf lib: add public accessor for database from query
This is to make it easier for clients of the library to update to the
new error code returning versions of notmuch_query_search_messages
2015-08-04 09:11:34 +02:00
David Bremner
4fed7047b2 lib: deprecate notmuch_query_search_{threads, messages}
The CLI (and bindings) code should really be updated to use the new
status-code-returning versions. Here are some warnings to prod us (and
other clients) to do so.
2015-08-04 09:11:25 +02:00
David Bremner
7e2d0ef105 lib: define NOTMUCH_DEPRECATED macro, document its use.
This has been tested with gcc and clang.
2015-08-04 09:11:17 +02:00
Austin Clements
e6ad3a5dd4 lib: Only sync modified message documents
Previously, we updated the database copy of a message on every call to
_notmuch_message_sync, even if nothing had changed.  In particular,
this always happens on a thaw, so a freeze/thaw pair with no
modifications between still caused a database update.

We only modify message documents in a handful of places, so keep track
of whether the document has been modified and only sync it when
necessary.  This will be particularly important when we add message
revision tracking.
2015-08-04 08:54:46 +02:00
David Bremner
2eb558fd9b configure: support --without-ruby
Apparently some ruby installs are broken in ways that prevent the ruby
bindings from building.
2015-07-30 08:16:29 +02:00
David Bremner
a57b3d4303 configure: support --with-docs=no
Since we promise --with-foo=no is equivalent to --without-foo
2015-07-30 08:08:31 +02:00
David Bremner
a63b5db873 configure: alphabetize --without help
Now that the "without" options seem to be multiplying, try to make it
easier for people to find the one they want.
2015-07-30 08:00:55 +02:00
David Bremner
b4e0c8320a configure: fix typo in comment
Some lazy person, probably me, forgot to press shift.
2015-07-30 07:57:04 +02:00
David Bremner
653190bf2a cli: enable notmuch --help command
This functionality seems to have been undocumented, if it ever
existed. Document it now.
2015-07-30 07:45:26 +02:00
David Bremner
83e9df98a0 doc: whitespace cleanup for notmuch.rst
replace leading spaces with tabs
2015-07-30 07:45:26 +02:00
David Bremner
882ccb7e49 build: add "set -eu" to version script generation
It turns out that on certain systems like FreeBSD, c++filt is not
installed by default. It's basically OK if we fail the build in that
case, but what's really not OK is for the build to continue and
generate bad binaries.
2015-07-28 21:34:01 +02:00
David Bremner
1fef811fd7 configure: whitespace cleanup
This is the result of running M-x whitespace-cleanup in emacs.  In
particular this replaces some spaces at the beginning of lines with
tabs.
2015-07-28 15:29:38 +02:00
Mikhail
edb485e0b9 configure: add --without-docs switch
Previously documentation was build automatically if sphinx/doxygen
executable were found. The switch is used to unconditionally disable
sphinx/doxygen detection and therefor, building of documentation
(including man pages).
2015-07-27 22:34:38 +02:00
David Bremner
82d8d0b062 replace hardcoded "python" with configured python command
Thanks to FreeBSD port maintainer Mikhail for report and the original
the original patch.

This is the right thing (TM) and also apparently fixes the build on
FreeBSD.
2015-07-10 18:13:28 +02:00
Daniel Schoepe
3b348ab1e1 Fix documentation for notmuch--tag-hook functions
The second argument to notmuch-tag is now called tag-changes, but the
documentation for notmuch-before-tag-hook and notmuch-after-tag-hook
still used the old argument name `tags'. This resulted in broken hooks
when following the documentation.
2015-06-30 21:37:25 +02:00
David Bremner
8cca886b10 notmuch 0.20.2 release
-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQGcBAABCAAGBQJVjqAqAAoJEPIClx2kp54sTLYL/iemBYQ2TELiIt8WQiFITKm8
 CZdAXUKR75C+Qmh462lRnilbGVzLrYC9opYXUfFH4IUu/1jf4iKYQmd37Qn+cSAG
 p3/SjFbh6FX0FIqxYegjKFByZju47OtAp+BbPMWyOOEXDASOjwmxMAnm5yzm9At/
 xnKV+5nxmN8KqVDvtF/TBtHM9wZ+ASt9yc4ncKgnAaxyWfWeaSTm0EKwTgHwKcKb
 JZy8XvE9J022Y2r7AWUHjdIyaX5/9cQXtVQg8w238Gp/5FazBN+4yu0Py73nN+pB
 nb0M9IzHHHolbQd89RYOVyqsZ/uka6gl60wduW5ILGYgG2So9qRcHMLJIHKDigF8
 e7j5yGDV6JS6Ub/jMiqKVOPpQv1G7euGqeA9PmQI1UvHEiEoy2kEbPdoyuuKJVbM
 QxG56SsTy85Irj/o1PeW0+ScxP1y6sQA5E1/YB1BRcgW1uwA2XkiZ+JC1IcqRFvZ
 ktJxZOIxYqhhYuXTbzd8KL75cvg1cwKVmmgFMunHcg==
 =m+4D
 -----END PGP SIGNATURE-----

Merge tag '0.20.2'

notmuch 0.20.2 release

Conflicts:
	NEWS
2015-06-27 15:29:52 +02:00
David Bremner
c66e0d4bc2 version: update to 0.20.2
As usual, bump python version at same time.
2015-06-27 15:05:31 +02:00
David Bremner
1c036cca99 debian: update changelog for 20.2-1
Actual changes are documented in the bug.
2015-06-27 15:04:16 +02:00
David Bremner
a732e8e1a2 NEWS for 0.20.2
Just the one bug fix
2015-06-27 14:47:38 +02:00
Mark Walters
5e37568841 emacs: tree: mark read change
The mark read code for tree mode did not get updated in the recent
changes. This updates it to match. Since the user can customize the
mark read logic we just call the show logic in the message pane.
2015-06-23 22:17:53 +02:00
David Bremner
d9567dd5b5 test: add initial ruby tests
This is pretty much a line by line translation of the existing python
tests, with two new tests for the count API.
2015-06-14 18:00:52 +02:00
David Bremner
233b5528cd build/ruby: use notmuch configure script values for shared lib
This is supposed to help build on systems like MacOS with different
conventions for naming shared libraries. We have already computed the
relevant names, so doing it again in ruby seems like a bad idea.
2015-06-14 08:23:55 +02:00
David Bremner
53035dafe0 lib, ruby: make use of -Wl,--no-undefined configurable
In particular this is supposed to help build on systems (presumably
using a non-gnu ld) where this flag is not available.
2015-06-13 17:52:48 +02:00
Mark Walters
4e79903449 emacs search: stash query
Add keybinding c q to stash the current query in search mode.
2015-06-13 08:16:56 +02:00
David Bremner
d038b93209 build: integrate building ruby bindings into notmuch build process
Because ruby generates a Makefile, we have to use recursive make.
Because mkmf.rb hardcodes the name Makefile, put our Makefile{.local}
in the parent directory.
2015-06-12 09:12:28 +02:00
David Bremner
32fd74b7aa lib: reject relative paths in n_d_{create,open}_verbose
There are many places in the notmuch code where the path is assumed to be absolute. If someone (TM) wants a project, one could remove these assumptions. In the mean time, prevent users from shooting themselves in the foot.

Update test suite mark tests for this error as no longer broken, and
also convert some tests that used relative paths for nonexistent
directories.
2015-06-12 07:34:50 +02:00