]> git.notmuchmail.org Git - notmuch/log
notmuch
7 years agotest: make it possible to have multiple corpora
Jani Nikula [Tue, 13 Sep 2016 17:14:08 +0000 (20:14 +0300)]
test: make it possible to have multiple corpora

We largely use the corpus under test/corpus for
testing. Unfortunately, many of our tests have grown to depend on
having exactly this set of messages, making it hard to add new message
files for testing specific cases.

We do use a lot of add_message from within the tests, but it's not
possible to use that for adding broken messages, and adding several
messages at once can get unwieldy.

Move the basic corpus under tests/corpora/default, and make it
possible to add new, independent corpora along its side. This means
tons of renames with a few tweaks to add_email_corpus function in
test-lib.sh to let tests specify which corpus to use.

7 years agoclean up spelling
Daniel Kahn Gillmor [Mon, 12 Sep 2016 02:23:48 +0000 (04:23 +0200)]
clean up spelling

7 years agoemacs: make the remaining faces configurable.
Matt Armstrong [Sun, 14 Aug 2016 22:17:42 +0000 (15:17 -0700)]
emacs: make the remaining faces configurable.

I believe this moves all "anonymous" face specifications in notmuch
code into a configurable defface.

7 years agoemacs: implement notmuch-search-color-line with dolist.
Matt Armstrong [Sun, 14 Aug 2016 22:13:00 +0000 (15:13 -0700)]
emacs: implement notmuch-search-color-line with dolist.

While passing a lambda to mapc is idiomatic elisp, dolist is easier
to understand, and there are a few other calls to it in this file.

7 years agoemacs: wash: make word-wrap bound message width
Mark Walters [Sat, 6 Aug 2016 15:29:34 +0000 (16:29 +0100)]
emacs: wash: make word-wrap bound message width

Previously if notmuch-wash-wrap-lines-length was set then all messages
would be wrapped at this value (or window-width if that is
smaller). This was done regardless of the message's depth in a thread --
for example, if the n.w.w.l.l is 80 and the messages depth is 20
(so indented 20 by default) the messages text only got 60 characters
of space.

This commit changes that so a message always gets the full n.w.w.l.l
of width regardless of its indentation (unless that goes over
window-width of course).

7 years agoemacs: show: let the user override the mime-type of an attachment
Mark Walters [Mon, 11 Jul 2016 07:49:19 +0000 (08:49 +0100)]
emacs: show: let the user override the mime-type of an attachment

This allows the user to override the mime-type of a part in the show
buffer. This takes the simple option of displaying the part with the
specified mime-type in its own buffer (in view mode). This avoids
further complicating the part handling code.

Bound to ". m" (i.e., m in the part map). Then the user can either
enter a mime-type (with completion to all mime types that mailcap (and
thus notmuch) knows about, or press return for the default choice of
text/plain.

7 years agoemacs: use define-derived-mode for defining modes.
Steven Allen [Sun, 28 Aug 2016 18:41:22 +0000 (14:41 -0400)]
emacs: use define-derived-mode for defining modes.

This sets up and runs all the correct hooks and reduces some redundancy.

7 years agoMerge branch 'release'
David Bremner [Fri, 9 Sep 2016 01:18:37 +0000 (22:18 -0300)]
Merge branch 'release'

hand fixed conflicts with NEWS

7 years agoNEWS: add news for 0.22.2 0.22.2 debian/0.22.2-1
David Bremner [Thu, 8 Sep 2016 22:22:12 +0000 (19:22 -0300)]
NEWS: add news for 0.22.2

7 years agodebian: add changelog stanza for 0.22.2-1
David Bremner [Thu, 8 Sep 2016 22:11:26 +0000 (19:11 -0300)]
debian: add changelog stanza for 0.22.2-1

7 years agoversion: bump to 0.22.2
David Bremner [Thu, 8 Sep 2016 22:05:12 +0000 (19:05 -0300)]
version: bump to 0.22.2

7 years agotest/crypto: hard code fingerprint
David Bremner [Thu, 8 Sep 2016 12:03:15 +0000 (09:03 -0300)]
test/crypto: hard code fingerprint

Originally the intent was to make the test more robust against changing
test keys. It turns out that (unscientifically) gpg --with-colons output
changes more often than our test key. Rather than making the script more
complex, just hard code the fingerprint.

This fixes Debian bug #847013; I expect similar test failures as other
distros adopt gnupg 2.1.15

7 years agoemacs: maildir: add the actual insert code
Mark Walters [Sat, 3 Sep 2016 22:59:43 +0000 (23:59 +0100)]
emacs: maildir: add the actual insert code

With all the preparation it is now simple to add the actual insert
code. Since insert can fail for many reasons we let the user decide
interactively deal with it.

We modify test-lib.el to set file fcc, so that all the old tests and
emacs_fcc_message from test-lib.sh still work

7 years agoModify our local copy of message-do-fcc
Mark Walters [Sat, 3 Sep 2016 22:59:42 +0000 (23:59 +0100)]
Modify our local copy of message-do-fcc

Since we also need to use this code for the draft handling we split
message-do-fcc into convenient sub-chunks (functions or macros as
appropriate).

7 years agoemacs: simplify our local copy of message-do-fcc
Mark Walters [Sat, 3 Sep 2016 22:59:41 +0000 (23:59 +0100)]
emacs: simplify our local copy of message-do-fcc

message-do-fcc has lots of functionality we don't need, so remove it.

7 years agoemacs: maildir import message-do-fcc
Mark Walters [Sat, 3 Sep 2016 22:59:40 +0000 (23:59 +0100)]
emacs: maildir import message-do-fcc

We will need our own local copy of message-do-fcc so this commit just
copies the code straight from message.el so that it is easier to see
our local changes coming in the next commit.

7 years agoemacs: maildir-fcc: prepare for use of notmuch insert
Mark Walters [Sat, 3 Sep 2016 22:59:39 +0000 (23:59 +0100)]
emacs: maildir-fcc: prepare for use of notmuch insert

We move some code around in preparation for the use of notmuch
insert. In particular, we move the check for a valid maildir for the
fcc to when the message is sent rather than when the fcc header is
inserted. The main motivation is consistency with the insert version
(coming later) where we cannot check the validity until send.

We allow the user some chance to correct the header; the choice here
is intended to be consistent with the insert version to come.

7 years agoemacs: notmuch-check-exit-status bugfix
Mark Walters [Sat, 3 Sep 2016 22:59:38 +0000 (23:59 +0100)]
emacs: notmuch-check-exit-status bugfix

This function prints diagnostic information in the event of an
error. However, one of the callers has an optional :stdin-string
keyword argument. This causes the error printing routine to error
itself.

Rather than reach notmuch-check-exit-status about the possible keyword
arguments (currently only one but could be more in the future) this
commit just tells notmuch-check-exit-status how to print non-string arguments.

7 years agoMakefile.local: use $(wildcard) to check existence of ${srcdir}/.git
Tomi Ollila [Wed, 25 May 2016 21:04:32 +0000 (00:04 +0300)]
Makefile.local: use $(wildcard) to check existence of ${srcdir}/.git

With this GNU Make construct one shell invocation can be skipped
and code looks shorter (narrower). This would now match to .git
being other file type than regular file or directory (or symlink
to those), but that is not a use case anyone should expect users
to do.

7 years agoMakefile.local: make IS_GIT simply expanded
Tomi Ollila [Wed, 25 May 2016 21:04:31 +0000 (00:04 +0300)]
Makefile.local: make IS_GIT simply expanded

By using ':=' while setting IS_GIT it is expanded to 'yes' or 'no' at
that point (and not every time when $(IS_GIT) is referenced).

7 years agoemacs: address: allow internal completion on an individual basis
Mark Walters [Fri, 20 May 2016 20:13:03 +0000 (21:13 +0100)]
emacs: address: allow internal completion on an individual basis

This commit makes two changes. The first allows the user to override
an external completion method with the internal notmuch address based
completion for an individual buffer.

Secondly, if the user has company-mode enabled then it sets up company
mode (based on internal completion) but disables the automatic timeout
completion -- the user can still activate it in when desired with
standard company commands such as company-complete.

7 years agoemacs: address completion, allow sender/recipient and filters
Mark Walters [Fri, 20 May 2016 20:13:02 +0000 (21:13 +0100)]
emacs: address completion, allow sender/recipient and filters

This commit lets the user customize the address completion. It makes
two changes.

The first change controls whether to build the address completion list
based on messages you have sent or you have received (the latter is
much faster).

The second change add a possible filter query to limit the messages
used -- for example, setting this to date:1y..  would limit the
address completions to addresses used in the last year. This speeds up
the address harvest and may also make the search less cluttered as old
addresses may well no longer be valid.

7 years agoNEWS: fix go bindings NEWS
David Bremner [Sun, 4 Sep 2016 11:04:48 +0000 (08:04 -0300)]
NEWS: fix go bindings NEWS

Move to correct release. Mention moving to contrib. Drop mention of
formatting fixes, as those are not yet applied.

7 years agoupdated NEWS
laochailan [Sun, 31 May 2015 12:02:15 +0000 (14:02 +0200)]
updated NEWS

7 years agofixed wrong constant values
laochailan [Sun, 31 May 2015 12:02:12 +0000 (14:02 +0200)]
fixed wrong constant values

before, they were both zero, so getting a read-writeable handle was
impossible.

7 years agoAdded thread bindings to go bindings
laochailan [Sun, 31 May 2015 12:02:11 +0000 (14:02 +0200)]
Added thread bindings to go bindings

7 years agobindings: move go bindings to contrib
David Bremner [Tue, 23 Aug 2016 23:50:05 +0000 (20:50 -0300)]
bindings: move go bindings to contrib

This signals two things, an intent to be more liberal about accepting
patches, and an intent to stop distributing the bindings if maintenance
doesn't pick up.

7 years agocontrib: remove old copy of vim front end
David Bremner [Tue, 23 Aug 2016 23:40:51 +0000 (20:40 -0300)]
contrib: remove old copy of vim front end

Having two in the tree is just confusing. And the viml one is even more
out of date than the ruby one.

7 years agolib: update cached mtime in notmuch_directory_set_mtime
David Bremner [Mon, 27 Jun 2016 20:43:04 +0000 (22:43 +0200)]
lib: update cached mtime in notmuch_directory_set_mtime

Without this change, the following code fails

  notmuch_directory_set_mtime(dir, 12345);
  assert(notmuch_directory_get_mtime(dir) == 12345);

7 years agodoc: update cross references for notmuch.1
David Bremner [Wed, 29 Jun 2016 19:39:11 +0000 (21:39 +0200)]
doc: update cross references for notmuch.1

In particular add notmuch-compact(1) (Debian bug #825884)

7 years agolib: reword comment about XFOLDER: prefix
David Bremner [Thu, 18 Aug 2016 08:06:54 +0000 (05:06 -0300)]
lib: reword comment about XFOLDER: prefix

I believe the current one is misleading, because in my experiments
Xapian did not add : when prefix and term were both upper case. Indeed,
it's hard to see how it could, because prefixes are added at a layer
above Xapian in our code. See _notmuch_message_add_term for an example.

Also try to explain why this is a good idea.  As far as I can ascertain,
this is more of an issue for a system trying to work with an unknown set
of prefixes. Since notmuch has a fixed set of prefixes, and we can
hopefully be trusted not to add XGOLD and XGOLDEN as prefixes, it is
harder for problems to arise.

7 years agodebian: changelog stanza for 0.22.1-3 debian/0.22.1-3
David Bremner [Sun, 14 Aug 2016 04:31:25 +0000 (13:31 +0900)]
debian: changelog stanza for 0.22.1-3

7 years agotest: make gdb even quieter
David Bremner [Tue, 28 Jun 2016 21:08:54 +0000 (23:08 +0200)]
test: make gdb even quieter

gdb sometimes writes warnings to stdout, which we don't need/want, and
for some reason --batch-silent isn't enough to hide. So in this commit
we write them to a log file, which is probably better for debugging
anyway. To see an illustrative test failure before this change, run

% make
% touch notmuch-count.c
% cd test && ./T060-count.sh

(cherry picked from commit f45fa5bdd397d52473f7092f7ae3e2ffb9b7aee5)

7 years agoOmit User-Agent: header by default
Daniel Kahn Gillmor [Mon, 8 Aug 2016 23:35:17 +0000 (19:35 -0400)]
Omit User-Agent: header by default

The User-Agent: header can be fun and interesting, but it also leaks
quite a bit of information about the user and their software stack.

This represents a potential security risk (attackers can target the
particular stack) and also an anonymity risk (a user trying to
preserve their anonymity by sending mail from a non-associated account
might reveal quite a lot of information if their choice of mail user
agent is exposed).

This change also avoids hiding the User-Agent header by default, so
that people who decide they want to send it will at least see it (and
can edit it if they want to) before sending.

It makes sense to have safer defaults.

7 years agoconfigure: add --without-api-docs option
Mikhail [Wed, 10 Aug 2016 13:02:35 +0000 (16:02 +0300)]
configure: add --without-api-docs option

Add option to explicitly disable API man page build even if doxygen
binary is available. --without-docs also implies not building API
manpage.

This change intended to add more distinctness into build system and
allow user not to build unwanted man pages.

7 years agoemacs: wash: word-wrap bugfix
Mark Walters [Sat, 6 Aug 2016 15:29:33 +0000 (16:29 +0100)]
emacs: wash: word-wrap bugfix

Previously notmuch-wash made the width of the text (approximately) the
window-width minus the depth in thread. This is correct for the
default indentation of 1 per message depth, but is incorrect for any
other setting of notmuch-show-indent-messages-width.

As notmuch-show-indent-messages-width is customisable, and notmuch-tree
sets it to zero to avoid indenting messages in the message pane, this
bug can show up in real use.

Two of the tests had to be updated: when
notmuch-show-indent-messages-width is 0, then the new (correct) word
wrapping happens later, when notmuch-show-indent-messages-width is 4,
then the new word wrapping happens sooner.

7 years agolib: provide _notmuch_database_log_append
David Bremner [Fri, 15 Jul 2016 10:25:41 +0000 (07:25 -0300)]
lib: provide _notmuch_database_log_append

_notmuch_database_log clears the log buffer each time. Rather than
introducing more complicated semantics about for this function, provide
a second function that does not clear the buffer. This is mainly a
convenience function for callers constructing complex or multi-line log
messages.

The changes to query.cc are to make sure that the common code path of
the new function is tested.

7 years agotest: make gdb even quieter
David Bremner [Tue, 28 Jun 2016 21:08:54 +0000 (23:08 +0200)]
test: make gdb even quieter

gdb sometimes writes warnings to stdout, which we don't need/want, and
for some reason --batch-silent isn't enough to hide. So in this commit
we write them to a log file, which is probably better for debugging
anyway. To see an illustrative test failure before this change, run

% make
% touch notmuch-count.c
% cd test && ./T060-count.sh

7 years agoemacs: express n-search-line-faces in terms of two new faces
Matt Armstrong [Thu, 21 Jul 2016 21:30:33 +0000 (14:30 -0700)]
emacs: express n-search-line-faces in terms of two new faces

The two new faces (notmuch-search-flagged-face and
notmuch-search-unread-face) make it easier to find the relevant face by
customizing notmuch-faces.  I plan to do the same to the other alists of
faces found elsewhere.

7 years agocreate .mailmap file (for git shortlog/blame)
David Bremner [Fri, 22 Jul 2016 12:47:34 +0000 (09:47 -0300)]
create .mailmap file (for git shortlog/blame)

Recently it was suggested on the list that we add a contributor to
AUTHORS. This file has been unmodified for 7 years, and is somewhat out
of date. It would potentially make sense to automagically update this
file during the release process using the output from git shortlog. This
file helps clean up some inconsistencies in author data in the history.

7 years agoFix typo in Message.maildir_flags_to_tags
Jaime Velasco Juan [Mon, 4 Jul 2016 18:49:31 +0000 (19:49 +0100)]
Fix typo in Message.maildir_flags_to_tags

It has been calling _tags_to_maildir_flags instead since the beginning,

7 years agoMerge branch 'release'
David Bremner [Tue, 19 Jul 2016 12:03:19 +0000 (09:03 -0300)]
Merge branch 'release'

7 years agodebian: changelog stanza for 0.22.1-2 debian/0.22.1-2
David Bremner [Tue, 19 Jul 2016 11:51:33 +0000 (08:51 -0300)]
debian: changelog stanza for 0.22.1-2

7 years agodebian: add explicit build-depends on gnupg
David Bremner [Tue, 19 Jul 2016 11:47:47 +0000 (08:47 -0300)]
debian: add explicit build-depends on gnupg

apt dropped it's depends on gnupg, so we can't rely on it being present
in the build env anymore

7 years agodebian: changelog stanza for 0.22.1-1 0.22.1
David Bremner [Tue, 19 Jul 2016 09:43:20 +0000 (06:43 -0300)]
debian: changelog stanza for 0.22.1-1

Basically copy upstream NEWS

7 years agoNEWS: set date of point release
David Bremner [Tue, 19 Jul 2016 09:36:15 +0000 (06:36 -0300)]
NEWS: set date of point release

7 years agoversion: bump to 0.22
David Bremner [Tue, 19 Jul 2016 09:33:37 +0000 (06:33 -0300)]
version: bump to 0.22

7 years agoNEWS: initial NEWS for 0.22.1
David Bremner [Wed, 13 Jul 2016 22:48:13 +0000 (19:48 -0300)]
NEWS: initial NEWS for 0.22.1

7 years agodebian: add changelog stanza for 0.22.1~rc0-1 0.22.1_rc0 debian/0.22.1_rc0-1
David Bremner [Thu, 30 Jun 2016 19:28:31 +0000 (21:28 +0200)]
debian: add changelog stanza for 0.22.1~rc0-1

No actual changes discussed, because the NEWS file is yet to be
created.

7 years agoversion: bump to 0.21.1~rc0
David Bremner [Thu, 30 Jun 2016 15:52:42 +0000 (17:52 +0200)]
version: bump to 0.21.1~rc0

Getting ready for the point release

7 years agonotmuch-mutt: use env to locate perl for increased portability
Stefano Zacchiroli [Thu, 21 Apr 2016 18:10:25 +0000 (14:10 -0400)]
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.

7 years agolib: fix definition of LIBNOTMUCH_CHECK_VERSION
David Bremner [Tue, 7 Jun 2016 10:37:57 +0000 (07:37 -0300)]
lib: fix definition of LIBNOTMUCH_CHECK_VERSION

Fix bug reported in id:20160606124522.g2y2eazhhrwjsa4h@flatcap.org

Although the C99 standard 6.10 is a little non-obvious on this point,
the docs for e.g. gcc are unambiguous. And indeed in practice with the
extra space, this code fails

#include <stdio.h>
#define foo (x) (x+1)

int main(int argc, char **argv){
  printf("%d\n",foo(1));
}

7 years agodoc: forbid further operations on a closed database
David Bremner [Mon, 27 Jun 2016 18:38:40 +0000 (20:38 +0200)]
doc: forbid further operations on a closed database

We could add many null pointer checks, but currently I don't see a use
case that justifies it.

7 years agotest: don't use dump and restore in a pipeline
David Bremner [Tue, 28 Jun 2016 08:24:07 +0000 (10:24 +0200)]
test: don't use dump and restore in a pipeline

This has been wrong since bbbdf0478ea, but the race condition was not
previously been (often?) triggered in the tests. With the DB_RETRY_LOCK
patches, it manifests itself as a deadlock.

7 years agolib: add built_with handling for XAPIAN_DB_RETRY_LOCK
David Bremner [Sun, 26 Jun 2016 15:29:45 +0000 (17:29 +0200)]
lib: add built_with handling for XAPIAN_DB_RETRY_LOCK

This support will be present only if the appropriate version of xapian
is available _and_ the user did not disable the feature when
building. So there really needs to be some way for the user to check.

7 years agotest: initial tests for locking retry
David Bremner [Sun, 26 Jun 2016 15:29:44 +0000 (17:29 +0200)]
test: initial tests for locking retry

Currently there's not much to test, so we simulate contention, and check
that the modifications to the database are serialized.

7 years agoUse the Xapian::DB_RETRY_LOCK flag when available
Istvan Marko [Sun, 26 Jun 2016 15:29:43 +0000 (17:29 +0200)]
Use the Xapian::DB_RETRY_LOCK flag when available

Xapian 1.3 has introduced the DB_RETRY_LOCK flag (Xapian bug
275). Detect it in configure and optionally use it. With this flag
commands that need the write lock will wait for their turn instead of
aborting when it's not immediately available.

Amended by db: allow disabling in configure

7 years agotest: don't use dump and restore in a pipeline
David Bremner [Tue, 28 Jun 2016 08:24:07 +0000 (10:24 +0200)]
test: don't use dump and restore in a pipeline

This has been wrong since bbbdf0478ea, but the race condition was not
previously been (often?) triggered in the tests. With the DB_RETRY_LOCK
patches, it manifests itself as a deadlock.

7 years agodoc: forbid further operations on a closed database
David Bremner [Mon, 27 Jun 2016 18:38:40 +0000 (20:38 +0200)]
doc: forbid further operations on a closed database

We could add many null pointer checks, but currently I don't see a use
case that justifies it.

7 years agotest/notmuch-test: simple streamlining
Tomi Ollila [Thu, 9 Jun 2016 19:20:56 +0000 (22:20 +0300)]
test/notmuch-test: simple streamlining

A few simple things that applies well to test/notmuch-test.sh

- Shell does pathname expansion also without doing `echo ...` in subshell.

- Redirections >/dev/null 2>/dev/null hide (improbable but) potential
  serious errors; adding -f to rm instead.

- Inter-file capitalization consistency in comments.

- Unnecesary space removal.

7 years agoemacs: show: improve handling of mark read tagging errors
Mark Walters [Thu, 9 Jun 2016 09:54:10 +0000 (10:54 +0100)]
emacs: show: improve handling of mark read tagging errors

Previously if a marking read tag change (i.e., removing the unread
tag) failed for some reason, such as a locked database, then no more
mark read tag changes would be attempted in that buffer.

This handles the error more gracefully. There is not much we can do
yet about dealing with the error itself, and marking read is probably
not important enough to warrant keeping a queue of pending changes or
anything.

However this commit changes it so that

- we do try and make future mark read tag changes.

- we display the tag state correctly: i.e. we don't display the tag as
  deleted (no strike through)

- and since we know the tag change failed we can try to mark this
  message read in the future. Indeed, since the code uses the
  post-command hook we will try again on the next keypress (unless the
  user has left the message).

We indicate to the user that these mark read tag changes may have
failed in the header-line.

7 years agotest: factor out some boilerplate from C tests
David Bremner [Sat, 4 Jun 2016 12:29:14 +0000 (09:29 -0300)]
test: factor out some boilerplate from C tests

The trick of having a common header file doesn't work to share between
test scripts, so make an include file in the test directory.

The use of #include <notmuch-test.h> looks slightly pretentious, but
the include file is not actually in the current (temporary) directory.

7 years agoMakefile.local: set IS_GIT = yes when regular file $srcdir/.git exists
Tomi Ollila [Wed, 25 May 2016 21:04:30 +0000 (00:04 +0300)]
Makefile.local: set IS_GIT = yes when regular file $srcdir/.git exists

$srcdir/.git may also be file. E.g. `git worktree` creates .git file
while new working tree is populated.

7 years agotest: test_python: set PYTHONPATH to the python execution environment
Tomi Ollila [Wed, 25 May 2016 21:37:41 +0000 (00:37 +0300)]
test: test_python: set PYTHONPATH to the python execution environment

Place PYTHONPATH to the environment when python is executed in a way
that current shell environment is not affected. This also allows adding
the old value of PYTHONPATH to the end of the new value (otherwise it
would have been appended again and again when test_python is called).

At the same time, use -B option to avoid writing .pyc files to
bindings/python/* (which are not cleared out by distclean).

Drop the (unused) prefix code which preserved the original stdout of the
python program and opened sys.stdout to OUTPUT. In place of that there
is now note how (debug) information can be printed to original stdout.

7 years agotest: set LD_LIBRARY_PATH early and keep its old contents
Tomi Ollila [Wed, 25 May 2016 21:37:40 +0000 (00:37 +0300)]
test: set LD_LIBRARY_PATH early and keep its old contents

Previously LD_LIBRARY_PATH was exported (and environment changed)
in the middle of test case execution, when a function setting it
was called.

Previously the old contents of LD_LIBRARY_PATH was lost (if any)
when it was re-set and exported. In some systems the old contents of
LD_LIBRARY_PATH was needed to e.g. locate suitable gmime library.

7 years agonotmuch-emacs-mua: escape $PWD (and cd always)
Tomi Ollila [Sat, 28 May 2016 11:06:04 +0000 (14:06 +0300)]
notmuch-emacs-mua: escape $PWD (and cd always)

Escaping $PWD makes this work in directories like 'foo"bar'...

Cd'ing always makes the working directory to be consistent whether
--body option was used or not (when using emacsclient, but cd'ing
when using emacs does not cause any harm).

Note that documentation of `insert-file` expects programs to
call `insert-file-contents` instead. In our simple case
`insert-file` works better as it does some good checks that we'd
have to implement ourselves. Look lisp/files.el in emacs sources
for more information.

7 years agonotmuch-emacs-mua: use message-add-actions
Tomi Ollila [Sat, 28 May 2016 11:06:03 +0000 (14:06 +0300)]
notmuch-emacs-mua: use message-add-actions

Use message.el -provided function message-add-actions to
set(/add) #'save-buffers-kill-terminal into the message-exit-actions
list.

7 years agotest: fix die() in test-lib-common.sh
Tomi Ollila [Sat, 28 May 2016 12:39:30 +0000 (15:39 +0300)]
test: fix die() in test-lib-common.sh

In scripts that include test-lib-common.sh but not test-lib.sh
the die() implementation needs to be a bit different due to
fd redirection differences. test-lib-common.sh implements die()
only if it was not implemented already.

7 years agotest: add function die () and have use of it in add_email_corpus ()
Tomi Ollila [Sat, 28 May 2016 12:39:29 +0000 (15:39 +0300)]
test: add function die () and have use of it in add_email_corpus ()

Added die() function to test-lib.sh with the following first use of it:

If notmuch new fails during email corpus addition the database is
most probably inexistent or broken and the added corpus would be
unusable while running single tests, giving misleading failures
("only" full 'make test' cleans out old corpus).

7 years agotest-lib.sh: renamed die...()s to trap...()s and exit...()
Tomi Ollila [Sat, 28 May 2016 12:39:28 +0000 (15:39 +0300)]
test-lib.sh: renamed die...()s to trap...()s and exit...()

Now the function names more accurately describes what the functions do.

7 years agodoc/notmuch-emacs.rst: update notmuch-hello buffer help text
Tomi Ollila [Sun, 5 Jun 2016 20:38:05 +0000 (23:38 +0300)]
doc/notmuch-emacs.rst: update notmuch-hello buffer help text

To look the same as commit b8a136187a3b changed it in emacs MUA code.

7 years agolib: fix definition of LIBNOTMUCH_CHECK_VERSION
David Bremner [Tue, 7 Jun 2016 10:37:57 +0000 (07:37 -0300)]
lib: fix definition of LIBNOTMUCH_CHECK_VERSION

Fix bug reported in id:20160606124522.g2y2eazhhrwjsa4h@flatcap.org

Although the C99 standard 6.10 is a little non-obvious on this point,
the docs for e.g. gcc are unambiguous. And indeed in practice with the
extra space, this code fails

#include <stdio.h>
#define foo (x) (x+1)

int main(int argc, char **argv){
  printf("%d\n",foo(1));
}

7 years agodevel/man-to-mdwn.pl: portable locale environment variable setting
Tomi Ollila [Thu, 9 Jun 2016 19:35:12 +0000 (22:35 +0300)]
devel/man-to-mdwn.pl: portable locale environment variable setting

Setting locale environment variables (LC_* and LANG) to e.g.
en_US.utf8 works fine on Linux, and that is what locale -a
returns (in Linux). However this does not work e.g. in some *BSD
systems.
In these systems, en_US.UTF-8 works. This also works in Linux
systems (which may look like a surprising thing on the first sight(*)).
But that *UTF-8 format seems to be widely used in the Linux system:
Grep it through the files in /etc/, for example.

Easy way to test: Run the following command lines. First should
complain about setting locale failed, and second should not.

$ LC_ALL=en_US.UTF-1 perl -e ''
$ LC_ALL=en_US.UTF-8 perl -e ''

(*) and who knows what the "standard" is...

7 years agolib: fix memory leak of field processor objects
David Bremner [Fri, 10 Jun 2016 02:35:27 +0000 (23:35 -0300)]
lib: fix memory leak of field processor objects

The field processor objects need to be deallocated explicitly just like
the range processors (or a talloc destructor defined).

7 years agodoc: clean up boolean vs. probabilistic prefixes
Daniel Kahn Gillmor [Thu, 2 Jun 2016 16:01:27 +0000 (12:01 -0400)]
doc: clean up boolean vs. probabilistic prefixes

sphinx-build emits a minor warning:

[...]doc/man7/notmuch-search-terms.rst:223: WARNING: Block quote ends without a blank line; unexpected unindent.

And the tabular representation of boolean or probabilistic prefixes
currently renders like this when i view it in man:

       ┌───────────────────────────┬────────────────────────────┐
       │Boolean                    │ Probabilistic              │
       └───────────────────────────┴────────────────────────────┘

       │          tag: id:         │           from: to:        │
       │                           │                            │
       │       thread:     folder: │        subject:    attach‐ │
       │       path:               │        ment: mimetype:     │
       └───────────────────────────┴────────────────────────────┘

This isn't just ugly: it's confusing, because it seems to imply that
some of the prefixes in the left-hand column are somehow related to
specific other prefixes in the right-hand column.

The Definition List representation introduced by this patch should be
simpler for readers to understand, and doesn't have the warning.

7 years agodoc: document notmuch-dump header line
David Bremner [Sun, 5 Jun 2016 22:23:58 +0000 (19:23 -0300)]
doc: document notmuch-dump header line

This was introduced with the libconfig changes, but not documented then.

7 years agolib: document config metadata
David Bremner [Sat, 4 Jun 2016 22:17:41 +0000 (19:17 -0300)]
lib: document config metadata

This probably should have been part of 3458e3c89c, but I missed it.

7 years agoUse https instead of http where possible
Daniel Kahn Gillmor [Thu, 2 Jun 2016 16:26:14 +0000 (12:26 -0400)]
Use https instead of http where possible

Many of the external links found in the notmuch source can be resolved
using https instead of http.  This changeset addresses as many as i
could find, without touching the e-mail corpus or expected outputs
found in tests.

7 years agonmbug: updated to modern URL for PEP 343
Daniel Kahn Gillmor [Thu, 2 Jun 2016 16:26:13 +0000 (12:26 -0400)]
nmbug: updated to modern URL for PEP 343

7 years agoupdate link to Chip Rosenthal article about reply-to munging
Daniel Kahn Gillmor [Thu, 2 Jun 2016 16:26:12 +0000 (12:26 -0400)]
update link to Chip Rosenthal article about reply-to munging

The original link is currently returning an internal server error :(

7 years agocompletion: update the location of the bash-completion project
Daniel Kahn Gillmor [Thu, 2 Jun 2016 16:26:11 +0000 (12:26 -0400)]
completion: update the location of the bash-completion project

Alioth currently redirects to github, so point there instead.

7 years agoNEWS, python: update pointer to online documentation
Daniel Kahn Gillmor [Thu, 2 Jun 2016 16:26:10 +0000 (12:26 -0400)]
NEWS, python: update pointer to online documentation

Currently, http://packages.python.org/notmuch/ goes through a series
of redirections and ends up pointing to readthedocs.  Since we're
using readthedocs directly anyway, just point to it directly.

readthedocs are also now sensibly using a separate domain
(readthedocs.io) for their hosted documentation as distinct from their
own domain (readthedocs.org), so use the correct tld.

7 years agodoc: include notmuch-emacs-mua in documentation ToC
Daniel Kahn Gillmor [Thu, 2 Jun 2016 16:01:28 +0000 (12:01 -0400)]
doc: include notmuch-emacs-mua in documentation ToC

Without this patch, i'm seeing sphinx-build emit:

 [...]doc/man1/notmuch-emacs-mua.rst:: WARNING: document isn't included in any toctree

7 years agolib: whitespace cleanup
Tomi Ollila [Sat, 28 May 2016 17:45:31 +0000 (20:45 +0300)]
lib: whitespace cleanup

Cleaned the following whitespace in lib/* files:

lib/index.cc:              1 line:  trailing whitespace
lib/database.cc            5 lines: 8 spaces at the beginning of line
lib/notmuch-private.h:     4 lines: 8 spaces at the beginning of line
lib/message.cc:            1 line:  trailing whitespace
lib/sha1.c:                1 line:  empty lines at the end of file
lib/query.cc:              2 lines: 8 spaces at the beginning of line
lib/gen-version-script.sh: 1 line:  trailing whitespace

7 years agolib: add support for named queries
David Bremner [Tue, 22 Mar 2016 10:54:54 +0000 (07:54 -0300)]
lib: add support for named queries

This relies on the optional presense of xapian field processors, and the
library config API.

7 years agolib: make a global constant for query parser flags
David Bremner [Tue, 22 Mar 2016 10:54:53 +0000 (07:54 -0300)]
lib: make a global constant for query parser flags

It's already kindof gross that this is hardcoded in two different
places. We will also need these later in field processors calling back
into the query parser.

7 years agoCLI: add notmuch-config support for named queries
David Bremner [Tue, 22 Mar 2016 10:54:52 +0000 (07:54 -0300)]
CLI: add notmuch-config support for named queries

Most of the infrastructure here is general, only the validation/dispatch
is hardcoded to a particular prefix.

A notable change in behaviour is that notmuch-config now opens the
database e.g. on every call to list, which fails with an error message
if the database doesn't exit yet.

7 years agoCLI: optionally restore config data.
David Bremner [Tue, 22 Mar 2016 10:54:51 +0000 (07:54 -0300)]
CLI: optionally restore config data.

The default to restore config data seems safest, especially since
currently we have no config data to mess up.

7 years agoCLI: add optional config data to dump output.
David Bremner [Tue, 22 Mar 2016 10:54:50 +0000 (07:54 -0300)]
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.

7 years agolib: config list iterators
David Bremner [Tue, 22 Mar 2016 10:54:48 +0000 (07:54 -0300)]
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).

7 years agolib: provide config API
David Bremner [Tue, 22 Mar 2016 10:54:47 +0000 (07:54 -0300)]
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.

7 years agoruby: add bindings for `notmuch_database_get_all_tags`
Ludovic LANGE [Sun, 6 Mar 2016 11:56:28 +0000 (07:56 -0400)]
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

7 years agotest: copyright information updates
Tomi Ollila [Fri, 6 May 2016 15:41:57 +0000 (18:41 +0300)]
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.)

7 years agoemacs: bind notmuch-show-resend-message to 'b' in notmuch-show mode
Tomi Ollila [Sat, 7 May 2016 19:03:12 +0000 (22:03 +0300)]
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'.

7 years agoemacs: add function to resend message to new recipients
Tomi Ollila [Sat, 7 May 2016 19:03:11 +0000 (22:03 +0300)]
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.

7 years agocli: tell how many messages were precisely matched when expected 1 match
Tomi Ollila [Sat, 7 May 2016 19:24:18 +0000 (22:24 +0300)]
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).

7 years agoconfigure: combine common parts of CONFIGURE_C{,XX}FLAGS
Tomi Ollila [Fri, 13 May 2016 21:29:45 +0000 (00:29 +0300)]
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).

7 years agoconfigure: check directly for xapian compaction API
David Bremner [Tue, 22 Mar 2016 10:54:46 +0000 (07:54 -0300)]
configure: check directly for xapian compaction API

This is consistent with the check for FieldProcessor, and probably a bit
more robust.

7 years agolib/cli: add library API / CLI for compile time options
David Bremner [Tue, 22 Mar 2016 10:54:45 +0000 (07:54 -0300)]
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.

7 years agolib: optionally support single argument date: queries
David Bremner [Tue, 22 Mar 2016 10:54:44 +0000 (07:54 -0300)]
lib: optionally support single argument date: queries

This relies on the FieldProcessor API, which is only present in xapian
>= 1.3.