Commit graph

4974 commits

Author SHA1 Message Date
Austin Clements
30de720ba0 lib: Invalidate message metadata in _notmuch_message_gen_terms
Previously, we invalidated stored message metadata in
_notmuch_message_add_term and _notmuch_message_remove_term, but not in
_notmuch_message_gen_terms.  This doesn't currently result in any bugs
because of our limited uses of _notmuch_message_gen_terms, but it may
could cause trouble in the future.
2014-08-04 18:57:55 -03:00
Mark Oteiza
6c9721a407 config: read database.path from $MAILDIR if set
Try to read the config parameter database.path from $MAILDIR before
falling back to $HOME/mail
2014-07-31 07:13:38 -03:00
Mark Oteiza
488b261964 config: read user.name from $NAME if set
Try to read the config parameter user.name from $NAME before taking the
user name from /etc/passwd.
2014-07-31 07:13:14 -03:00
Austin Clements
a5a47dab87 util: Make string-util.h C++-compatible 2014-07-31 07:11:25 -03:00
Austin Clements
8251d639b2 emacs: Clarify that notmuch-poll-script is deprecated
notmuch-poll-script has long since been deprecated in favor of
post-new hooks, but this wasn't obvious from the documentation.
Update the documentation to make this clear.  Since
notmuch-poll-script could, to some extend, be used to control the path
of the notmuch binary and that use is now clearly discouraged, promote
notmuch-command to a real defcustom instead of just a variable.
2014-07-31 07:10:47 -03:00
Mark Walters
d25c729825 emacs: show: make return value of notmuch-show-get-prop explicit
This makes the fact the notmuch-show-get-prop returns nil if the major
mode is neither show not tree explicit.
2014-07-30 18:25:58 -03:00
Mark Walters
bbbdf0478e dump: make dump take Xapian write lock
Dump currently only takes the read lock. Xapian can cope with some
changes while maintaining a read snapshot but with more changes it
fails. Currently notmuch just gives a xapian error.

To avoid this we take the write lock when dumping. This prevents other
notmuch processes from modifying the xapian database preventing this
error.

Discussion with Olly on irc indicates that this is currently the best
solution: in xapian trunk there may be better possibilities using
snapshots but they need to make it to a release and propogate out to
users before we can switch approach.

Finally, this breaks one use case: pipelines of the form

notmuch dump | ... | notmuch restore

According to Olly this is already very fragile: it will only work on
small databases. One of the tests relies on this behaviour so fix that
to store the dump rather than use a pipe.
2014-07-16 19:33:10 -03:00
W. Trevor King
567aab405b nmbug: Handle missing @upstream in is_unmerged
If we don't have an upstream, there is nothing to merge, so nothing is
unmerged.  This avoids errors like:

  $ nmbug status
  error: No upstream configured for branch 'master'
  error: No upstream configured for branch 'master'
  fatal: ambiguous argument '@{upstream}': unknown revision or path not in the working tree.
  Use '--' to separate paths from revisions, like this:
  'git <command> [<revision>...] -- [<file>...]'
  'git rev-parse @{upstream}' exited with nonzero value

You might not have an upstream if you're only using nmbug locally to
version-control your tags.
2014-07-16 19:31:28 -03:00
Austin Clements
c2bbe9eb6c test: Test thread linking in all possible delivery orders
These tests deliver all possible (single-root) four-message threads in
all possible orders and check that notmuch successfully links them
into threads.  These tests supersede and replace the previous and much
less thorough "T260-thread-order" tests.

There are two variants of the test: one delivers messages that
reference only their immediate parent and the other delivers messages
that reference all of their parents.  The latter test is currently
known-broken.
2014-07-16 07:08:02 -03:00
Wael M. Nasreddine
de37f21e5b Enable Travis-CI as a backup continuous integration service.
You can access the dashboard at https://travis-ci.org/notmuch/notmuch
2014-07-16 06:33:45 -03:00
Mark Walters
ebb58751dc emacs: tree/show remove duplicate function
tree overrides notmuch-show-get-prop so that it can use many of the
utility function directly. Now that tree is in mainline the version
from tree can be moved to show and the original overridden show
version dropped.
2014-07-16 06:33:17 -03:00
W. Trevor King
4697e86a52 nmbug: Add a git_with_status helper function
Sometimes we want to catch Git errors and handle them, instead of
dying with an error message.  This lower-level version of git() allows
us to get the error status when we want it.
2014-07-16 06:31:23 -03:00
Mark Walters
f47eeac0b0 emacs: set default in notmuch-read-query
This adds the current query as a "default value" to
notmuch-read-qeury. The default value is available via a down-arrow as
opposed to history which is available from the up arrow.

Note if a user presses return in the minibuffer this value is not
returned.

The implementation is simple but notmuch-read-query could be called
via notmuch-search/notmuch-tree etc from any buffer so it makes sense
to put the decision of how to extract the current query in
notmuch-read-query rather than in each of the callers.
2014-07-15 20:32:49 -03:00
W. Trevor King
7f2bbe93a5 nmbug-status: Optionally load the header and footer templates from the config
For folks that don't like the default templates for whatever reason.
2014-07-15 20:15:23 -03:00
W. Trevor King
f10024f30d nmbug-status: Add the time to the footer's build-date
Our repository [1] has a post-update hook that rebuilds the status
page after each push.  Since that may happen several times a day, we
might as well show the build time (as well as the date) in the footer.

The trailing 'Z' is the ISO 8601 designator for UTC.  Now that we're
showing times, it's nice to be explicit about the timezone we're
using.

The rename from date -> datetime gives us backward-compatibility for
folks that *do* only want the date.  We keep the old date formatting
to support those folks.

[1]: http://nmbug.tethera.net/git/nmbug-tags.git
2014-07-15 20:08:39 -03:00
W. Trevor King
7832258468 nmbug-status: Factor out header/footer context into a shared dict
Rather than splitting this context into header-only and footer-only
groups, just dump it all in a shared dict.  This will make it easier
to eventually split the header/footer templates out of this script
(e.g. if we want to load them from the config file).
2014-07-15 20:08:24 -03:00
Carl Worth
b70386a4cb Move the generated date from the top of the page to the footer.
It's useful reference information, but anyone who wants it will look
for and find it.  We don't need this front-and-center.  Follow the
pattern set by our header template with a triple-quoted string.

The gray <hr> styling is less agressive.  IE uses 'color' for drawing
the rule, while Gecko and Opera use the border or 'background-color'
[1].

[1]: https://bugzilla.mozilla.org/show_bug.cgi?id=239386
2014-07-15 20:07:18 -03:00
Carl Worth
b5bdf5f4a8 Add a docstring describing the program
Prefer a docstring to a header comment so we can use it as the
ArgumentParser description (formatted with 'nmbug-status --help').
Script readers still have it near the top of the file.  Since it's a
docstring, use PEP 257's summary-line-and-body format [1].

[1]: http://legacy.python.org/dev/peps/pep-0257/#multi-line-docstrings
2014-07-15 20:07:06 -03:00
Carl Worth
d1d84cab1d Add explicit license information
It's nice to have for situations where this script is found outside of
the notmuch source repository (e.g. after being installed).
2014-07-15 20:06:59 -03:00
Mark Walters
ef819eb689 emacs: search archive tweak
notmuch-search-archive-thread moves to the next line after tagging. In
the normal case this makes sense, but if the region is active, it tags
the whole region and then it doesn't really. Thus only move to the
next line if region is not active.
2014-07-15 20:06:41 -03:00
David Bremner
de262a2026 test: redirect gdb output to a file.
It seems that the normal output redirection in the test suite doesn't
work for gdb, but it's nice to have output in a file for debugging.
2014-07-13 12:36:49 -03:00
Tomi Ollila
24b24be151 devel: news2wiki to recognize yyyy-mm-dd or UNRELEASED as release date
The yyyy-mm-dd (actually \d\d\d\d-\d\d-\d\d) for a bit more restrictive
(and self-documentative) than the \w\w\w\w-... that used to be there and
UNRELEASED so that developers can test the latest NEWS converted to mdwn
format before submitting NEWS patches.
2014-07-13 12:35:37 -03:00
Mark Walters
2e1eee3a77 emacs: show: add an update seen function to post-command-hook
Add a function for updating seen messages to the
post-command-hook. This function calls a customizable (by eg
defcustom) function with parameters the start and end of the current
window and that function can decide what to mark read based on that
and the current point.

Since this is in the post-command-hook it should get called after most
user actions (exceptions include user resizing the window) so it
should be possible to make sure the seen status gets updated whether
the user uses notmuch commands like next-message or normal emacs
commands like scroll-up.

It removes all of the old mark read/seen points but introduces a
simple example function that just marks the current message read if it
is open. This function has one small subtlety: it makes sure it
doesn't mark the same message read twice (in the same instance of the
same buffer); otherwise the post-command-hook makes it impossible for
a user to manually mark a message unread.

This fixes the current bugs (imo) that closed messages can be marked
read, and that opening a closed message does not mark it read.

Another advantage of using the post-command-hook any programmatic use
with point passing through a message will not mark it read.
2014-07-13 12:34:02 -03:00
David Bremner
eed6c75556 test: make test_emacs call post-command-hook
The unread/read changes will use the post-command-hook. test_emacs
does not call the post-command-hook. This adds a notmuch-test-progn
which takes a list of commands as argument and executes them in turn
but runs the post-command-hook after each one.

The caller can batch operations (ie to stop post-command-hook from
being interleaved) by wrapping the batch of operations inside a progn.

We also explicitly run the post-command-hook before getting the output
from a test; this makes sense as this will be a place the user would
be seeing the information.
2014-07-13 12:33:53 -03:00
David Edmondson
bc180bd388 emacs: Fix indentation.
Fix the indentation of `notmuch-show-mode-map'.
2014-07-13 12:32:06 -03:00
Charles Celerier
df8885f62c lib: Start all function names in notmuch-private.h with
As noted in devel/STYLE, every private library function should start
with _notmuch. This patch corrects function naming that did not adhere
to this style in lib/notmuch-private.h. In particular, the old function
names that now begin with _notmuch are

    notmuch_sha1_of_file
    notmuch_sha1_of_string
    notmuch_message_file_close
    notmuch_message_file_get_header
    notmuch_message_file_open
    notmuch_message_get_author
    notmuch_message_set_author

Signed-off-by: Charles Celerier <cceleri@cs.stanford.edu>
2014-07-13 12:25:29 -03:00
Jani Nikula
c2d8236b56 test: use sh.config for configuration 2014-07-13 12:16:06 -03:00
Jani Nikula
57540a1952 build: generate sh.config for feeding configure results to shell scripts
Only include the relevant information.

Amended by David Bremner:

	Use a prefix NOTMUCH_ to minimize collisions with other
	variables.
2014-07-13 12:15:47 -03:00
David Bremner
5694d72a83 docs: remove spurious man page generated from doxygen
There is a doxygen bug about these odd files,

      https://bugzilla.gnome.org/show_bug.cgi?id=727796

But it isn't clear if / when a fix will be provided, so just delete it
to avoid e.g. confusing man-to-wiki.pl
2014-07-13 08:59:02 -03:00
David Bremner
b10b5115f8 NEWS: add minimal item for API change to close/destroy 2014-07-09 20:39:26 -03:00
Jani Nikula
ab24e883b0 lib: add return status to database close and destroy
notmuch_database_close may fail in Xapian ->flush() or ->close(), so
report the status. Similarly for notmuch_database_destroy which calls
close.

This is required for notmuch insert to report error status if message
indexing failed.
2014-07-09 20:29:36 -03:00
Tomi Ollila
6721222ea8 build: check .git directory existence in srcdir (for out-of-tree builds)
So that $(VERSION) and version.stamp uses the git-describe -based
version data instead of the content of `version' file.

For consistency also the git commands in Makefile[.local] target
`verify-no-dirty-code' uses the git --git-dir=$srcdir/.git ...
commands (inside ifeq($(IS_GIT),yes)). Attempting to make this
target outside of the tree will fail in any case.
2014-07-09 20:24:28 -03:00
David Bremner
934e333a08 doc: postprocess notmuch.3
Remove excess italics from doxygen output. It seems to make no
sense (and is certainly ugly) to italicize the first argument to the
.RI macro.
2014-07-09 19:32:44 -03:00
David Bremner
c6cdac8ece doc: quiet doxygen warnings
remove some obsolete tags for XML output (which we don't currently
generate in any case)
2014-07-09 19:32:44 -03:00
David Bremner
1022433551 doc: build and install doxygen api docs
In order to support out of tree builds and avoid hardcoding version
number, generate `doc/config.dox` from configure.
2014-07-09 19:32:15 -03:00
Fraser Tweedale
0e50854a7f configure: use cc/c++ instead of gcc/g++
Some systems (e.g. FreeBSD 10) do not ship with the GNU Compiler
Collection.  Use generic cc/c++ instead of gcc/g++ (unless the
CC/CXX environment variables are used).
2014-07-04 08:56:32 -03:00
David Bremner
6ef676aac3 notmuch 0.18.1 release
-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQGcBAABCAAGBQJTqqd6AAoJEPIClx2kp54sQDEL/i9V9jsKyXWSx6wCVxynIzhI
 cI5IO2IqtS5sX/DsU3R581TJNs5zEDv1AVjGtzx0MXD3mP5SY6A04aLkhFH3FZyb
 nAOFWtETQ/ghlULLoWYOz+b63Xj7nleH5ji4QyU28nk0eaXS0wGGJNgotK1Fhvvc
 99vsPo1Ci8OeQeKGjXNE2vDdlefXT5zIYde+QP5ofIdyzOVZMCK1KTb5QBGwQGQ0
 i8DaMyCRQvzXU4WHC/XHJZhcZ62CvrDWfG3wnxREmz5q9G98p86A29MRJkHZdQOv
 3aFguu/zGDSxi/6Y+e8sJb5f4yQBqyX5v83kkkRju3OUSTPLgzHfb+KLuVNhA3/m
 2U/vWdHpUMGgPLBcEd4s4AbjgeVMEY6DGKZ0bexZ68nq0QrxTVCDYtpipPF8ECk2
 zM4rDBqAfTMnXLptzzGwFPtk1G70vRml8uqaHp6YSnltQj1hiGo7U/4RGo6gpL2I
 EKfgOtuO+e8mRFhc+TAN6MNbAI+cCSkZ31e3kWbAog==
 =6Kk+
 -----END PGP SIGNATURE-----

Merge tag '0.18.1'

notmuch 0.18.1 release
2014-06-25 08:01:17 -03:00
David Bremner
4276eba3ca version: bump to 0.18.1
Also add precis of NEWS to debian changelog
2014-06-25 07:30:10 -03:00
Austin Clements
76037ea85f NEWS: Improve and correct "Fix for phrase indexing" entry
This improves the description of the fix, fixes some typos, and
changes "(re)-indexed" to "indexed" because we have no particular
notion of "re-indexing" a message.
2014-06-24 21:36:16 -03:00
David Bremner
efd16bc73b NEWS: quibbles from Tomi
See id:m2vbrsgi7n.fsf@guru.guru-group.fi for details
2014-06-23 06:37:03 -03:00
David Bremner
fea7a41181 notmuch 0.18.1~rc0 release
-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQGcBAABCAAGBQJTp3iwAAoJEPIClx2kp54sbR8MAIXabp2QmfGVaQ5dOvSv7peD
 2GDUpx4+LFEybPL5tJJIc/WQ8Y8AqCytb3UY6wBdrq0j5AhhdVXxc7DPINuG523W
 6PNW3Hd9U1Ot2wiDNvebUjsRnEUYo0vagBptwRizhizQ4SONjYXEP9F9p51XyiTY
 33+TN9AlAcOngfoNhNAHTKWa7lGxIo8EZOqwoivk63xgv/MSD2RZT3kEaiK6HcBU
 GXRK4Lh0rWlbSZfAA30UwBXUHqVc8TjRcqecqAeV68tUlckuOdlfImTAtnGeRNbJ
 U7nfh7UtOyFswK8/L/uwXtLPTjXQhIpUhIuAR6Kvs9nEKhkEFBxUkJi41NA4yhlN
 eqhLMJ+BSZWpbOsTCaW5ZYHO36u1N6vD7A2Eqz839zRaSrOmcnQD974qpdZ67lDN
 A2qORV6WfmZhROvy75h+l8Da2IJmOMU0rzggszM3KQD9Ry8LrwBMktt1dHl5njvQ
 xqqRrHFNjUziqqR4RISjJ0LduTrIKty2Gw+yjgLvlA==
 =EJdx
 -----END PGP SIGNATURE-----

Merge tag '0.18.1_rc0'

notmuch 0.18.1~rc0 release
2014-06-22 22:25:10 -03:00
David Bremner
294f956d86 version: bump to 0.18.1~rc0
Also bump the python bindings version, the NEWS version and the Debian
version.

Since the changelog is (slightly dubiously) metadata, we have to
change it to upload a release candidate.
2014-06-22 21:30:35 -03:00
David Bremner
658e83e3ca NEWS: add news for 0.18.1
This is my summary of the commits from 0.18.
2014-06-22 21:15:53 -03:00
David Edmondson
b732a58a00 emacs: Forwarded messages should not have modified buffers
When the user begins forwarding a message, the resulting composition
buffer should not be marked as modified, in order that it can
immediately be killed without prompting.
2014-06-22 07:41:49 -03:00
David Bremner
cc2722ba9e Merge branch 'release'
Austin's termpos patches and Felipe's zlib.pc workaround
2014-06-22 06:53:21 -03:00
Felipe Contreras
0c698ef037 configure: add workaround for systems without zlib.pc
Some systems (e.g. FreeBSD) might not have installed the appropriate
pkg-config file as they should. We can workaround the issue by creating
the .pc file they should have distributed.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
2014-06-21 16:40:39 -03:00
Austin Clements
dc64ab6720 lib: Separate all phrases indexed by _notmuch_message_gen_terms
This adds a 100 termpos gap between all phrases indexed by
_notmuch_message_gen_terms.  This fixes a bug where terms from the end
of one header and the beginning of another header could match together
in a single phrase and a separate bug where term positions of
un-prefixed terms overlapped.

This fix only affects newly indexed messages.  Messages that are
already indexed won't benefit from this fix without re-indexing, but
the fix won't make things any worse for existing messages.
2014-06-18 18:03:18 -03:00
Austin Clements
c1805576a0 test: Known-broken test for overlapping/adjacent termpos
This adds two known-broken tests and one working test related to the
term positions assigned to terms from different headers or MIME parts.
The first test fails because we don't create a termpos gap between
different headers.  The second test fails because we don't adjust
termpos at all when indexing multiple parts.
2014-06-18 17:56:52 -03:00
Austin Clements
44327ca86d lib: Index name and address of from/to headers as a phrase
Previously, we indexed the name and address parts of from/to headers
with two calls to _notmuch_message_gen_terms.  In general, this
indicates that these parts are separate phrases.  However, because of
an implementation quirk, the two calls to _notmuch_message_gen_terms
generated adjacent term positions for the prefixed terms, which
happens to be the right thing to do in this case, but the wrong thing
to do for all other calls.  Furthermore, _notmuch_message_gen_terms
produced potentially overlapping term positions for the un-prefixed
copies of the terms, which is simply wrong.

This change indexes both the name and address in a single call to
_notmuch_message_gen_terms, indicating that they should be part of a
single phrase.  This masks the problem with the un-prefixed terms
(fixing the two known-broken tests) and puts us in a position to fix
the unintentionally phrases generated by other calls to
_notmuch_message_gen_terms.
2014-06-18 17:55:14 -03:00
Austin Clements
b547830783 test: Add search tests for combined name/address queries
Two of these are currently known-broken.  We index the name and
address parts in two separate calls to _notmuch_message_gen_terms.
Currently this has the effect of placing the term positions of the
prefixed terms from the second call right after those of the first
call, but screws up the term positions of the non-prefixed terms.
2014-06-18 17:54:05 -03:00