Commit graph

4452 commits

Author SHA1 Message Date
David Bremner
3d991261a4 doc: add notmuch-address.rst to sphinx config
This is needed so that the rst docs are converted to man and info
pages.
2014-11-05 23:52:17 +01:00
Michal Sojka
a5a6859197 cli: address: Add --output=count
This output prints how many times was each address encountered during
search.
2014-11-05 23:25:05 +01:00
Michal Sojka
4176e527fc cli: address: Do not output duplicate addresses
This filters out duplicate addresses from address command output.

It also also adds tests for the address command.

The code here is an extended version of a patch from Jani Nikula.
2014-11-05 23:23:01 +01:00
Michal Sojka
5c32365d87 cli: search: Convert --output to keyword argument
Now, when address related outputs are in a separate command, it makes
no sense to combine multiple --output options in search command line.
Using switch statement to handle different outputs is more readable
than a series of if statements.
2014-11-05 23:20:17 +01:00
Michal Sojka
5c27136e64 cli: Introduce "notmuch address" command
This moves address-related functionality from search command to the
new address command. The implementation shares almost all code and
some command line options.

Options --offset and --limit were intentionally not included in the
address command, because they refer to messages numbers, which users
do not see in the output. This could confuse users because, for
example, they could see more addresses in the output that what was
specified with --limit. This functionality can be correctly
reimplemented for address subcommand later.

Also useless values of --exclude flag were not included in the address
command.

This was inspired by a patch from Jani Nikula.
2014-11-05 23:19:12 +01:00
Jani Nikula
4387112de0 cli: add support for hierarchical command line option arrays
NOTMUCH_OPT_INHERIT expects a notmuch_opt_desc_t * pointer in
output_var.

The "Unrecognized option" message was moved out of parse_option() to
not be emitted twice or when parsing a non-inherited option.
2014-11-05 23:17:00 +01:00
Michal Sojka
f0dfceaf90 cli: search: Split notmuch_search_command to smaller functions
In a subsequent commit, these functions will be used to share some
functionality between search and address commands.
2014-11-05 23:14:24 +01:00
Michal Sojka
5e16b94a23 cli: search: Convert ctx. to ctx->
In the next commit, notmuch_search_command will be refactored to
several smaller functions. In order to simplify the next commit to
verbatim move of several lines to new functions with search_context_t*
argument, we convert all references to this structure to pointer
dereferences. To do so we rename the context variable and use the
original name ctx as the pointer to the renamed structure.
2014-11-05 23:11:20 +01:00
Michal Sojka
33f9109fd3 cli: search: Move more variables into search_context_t
In order to share some command line options between search and address
subcommands we need to add corresponding variables to the context
structure. While we are at it, we also add notmuch_database_t to unify
parameters of all do_search_* functions and to simplify subsequent
commits.

Otherwise, there are no functional changes.
2014-11-05 23:11:09 +01:00
Michal Sojka
15d39e424e cli: search: Rename options to context
In the next commit the options structure will be extended by
non-option variables. Therefore we need a more generic name.

Just text replacement, no other changes.
2014-11-05 23:09:49 +01:00
Tomi Ollila
34d2c62b82 devel: man-to-mdwn.pl: add GPLv3+ notice to manpages.mdwn
Make the generated head manual page (in the notmuchmail wiki)
display the licence information the whole notmuch software is licenced
under.
2014-11-02 19:46:17 +01:00
Tomi Ollila
f7be8f4ebf devel: make man-to-mdwn.pl to work with generated manual pages
The new manual pages converted from rst using sphinx or rst2man
has somewhat different syntax. man-to-mdwn.pl is now adjusted
to produce even better output from this syntax. The changes also
include using utf-8 locale (e.g. for tables and generated hypens)
and and quite a few bugs fixes.
This tool still produces better results than just using the
html pages generated using sphinx / rst2html. For example those
tools don't create inter-page hyperlinks -- and the preformatted
pages written by man-to-mdwn.pl just works well with manual page
content.
2014-11-02 19:46:06 +01:00
Jesse Rosenthal
0d40b37954 test: Make gen-threads work with python3
python3 doesn't allow dictionaries to be initialized with non-string
keywords. This presents problems on systems in which "python" means
"python3". We instead initalize the dictionary using the dict
comprehension and then update it with the values from the tree. This
will work with both python2 and python3.
2014-11-02 19:43:39 +01:00
Jani Nikula
207f3bf821 test: add tests for --output=messages --duplicate=N
Basic smoke tests for the feature, nothing fancy.
2014-11-02 19:42:28 +01:00
Jani Nikula
4366b9b88c cli: add support for notmuch search --duplicate=N with --output=messages
Print the message IDs of all messages matching the search terms that
have at least N files associated with them.
2014-11-02 19:42:12 +01:00
Tomi Ollila
96988e35c7 configure: move make {,install} instructions to the end
There was theorical possibility that writing the config files could
have skipped (by interruption) after the instructions how to make
notmuch was printed out.
2014-11-02 19:40:05 +01:00
Michal Sojka
3cc8ed5978 cli: search: Add --output={sender,recipients}
The new outputs allow printing senders, recipients or both of matching
messages. To print both, the user can use --output=sender and
--output=recipients simultaneously.

Currently, the same address can appear multiple times in the output.
The next commit will change this. For this reason, tests are
introduced there.

We use mailbox_t rather than InternetAddressMailbox because we will
need to extend it in a following commit.

This code is based on a patch from Jani Nikula.
2014-11-01 08:02:58 +01:00
Michal Sojka
db307459fb cli: search: Convert --output to keyword-flag argument
This converts "notmuch search" to use the recently introduced
keyword-flag argument parser. At this point, it only makes the code
slightly less readable but following commits that add new --output
keywords will profit from this.
2014-11-01 08:02:35 +01:00
Jani Nikula
ecc4a9a644 cli: Add support for parsing keyword-flag arguments
This allows having multiple --foo=bar --foo=baz options on the command
line, with the corresponding values OR'd together.

[Test added by Michal Sojka]
2014-11-01 08:02:21 +01:00
Michal Sojka
dc39811948 cli: search: Refactor passing of command line options
Many functions that implement the search command need to access command
line options. Instead of passing each option in a separate variable, put
them in a structure and pass only this structure.

This will become handy in the following commits.
2014-11-01 08:01:59 +01:00
David Edmondson
28d121955c NEWS: Improved q binding. 2014-11-01 08:01:23 +01:00
David Edmondson
30f1c43efe emacs: Improve the behaviour of the 'q' binding.
When a user hits 'q' in a notmuch buffer, kill the buffer only if
there are no other windows currently showing it.
2014-10-31 17:54:21 +01:00
Jani Nikula
0f35ddcdfc test: use LDFLAGS in test/Makefile.local
Apparently the test binaries are built with minimal LDFLAGS, only
adding dependency specific LDFLAGS as needed. However because some of
the test binaries incorporate notmuch object files, it is necessary to
use the same link flags as notmuch. For example user provided
CFLAGS/CXXFLAGS/LDFLAGS with -fsanitize=undefined fails to build the
test binaries if the flags differ.
2014-10-31 17:51:22 +01:00
David Bremner
7d32b01d78 test: add simple tests for post-insert hook
Most of the existing tests for pre/post-new hook don't seem to apply.
2014-10-28 19:22:00 +01:00
Jani Nikula
19c09d870f cli/insert: add post-insert hook
The post-new hook might no longer be needed or run very often if
notmuch insert is being used. Therefore a post-insert hook is needed
(arguably pre-insert not so much, so don't add one). Also add the
--no-hooks option to skip hooks.
2014-10-28 19:19:30 +01:00
Jani Nikula
50eedb48ec gitignore: ignore sh.config and doc/config.dox 2014-10-28 12:12:33 +01:00
Jani Nikula
0bb1f26a26 cli: cast timeval fields to long for format
This hides platform differences between struct timeval field types.
2014-10-28 12:12:10 +01:00
David Edmondson
961937988e emacs: notmuch-jump.el should provide.
To ease loading, notmuch-jump.el should provide 'notmuch-jump.
2014-10-25 19:55:16 +02:00
Austin Clements
70f15b37fb lib: Remove unnecessary thread linking steps when using ghost messages
Previously, it was necessary to link new messages to children to work
around some (though not all) problems with the old metadata-based
approach to stored thread IDs.  With ghost messages, this is no longer
necessary, so don't bother with child linking when ghost messages are
in use.
2014-10-25 19:46:19 +02:00
Austin Clements
4e2c351c58 test: Test upgrade to ghost messages feature 2014-10-25 19:42:47 +02:00
Austin Clements
ee476f1e76 lib: Enable ghost messages feature
This fixes the broken thread order test.
2014-10-25 19:31:27 +02:00
Austin Clements
d1e8c80b72 lib: Implement upgrade to ghost messages feature
Somehow this is the first upgrade pass that actually does *any* error
checking, so this also adds the bit of necessary infrastructure to
handle that.
2014-10-25 19:30:08 +02:00
Austin Clements
58a4277d3b lib: Implement ghost-based thread linking
This updates the thread linking code to use ghost messages instead of
user metadata to link messages into threads.

In contrast with the old approach, this is actually correct.
Previously, thread merging updated only the thread IDs of message
documents, not thread IDs stored in user metadata.  As originally
diagnosed by Mark Walters [1] and as demonstrated by the broken
T260-thread-order test, this can cause notmuch to fail to link
messages even though they're in the same thread.  In principle the old
approach could have been fixed by updating the user metadata thread
IDs as well, but these are not indexed and hence this would have
required a full scan of all stored thread IDs.  Ghost messages solve
this problem naturally by reusing the exact same thread ID and message
ID representation and indexing as regular messages.

Furthermore, thanks to this greater symmetry, ghost messages are also
algorithmically simpler.  We continue to support the old user metadata
format, so this patch can't delete any code, but when we do remove
support for the old format, several functions can simply be deleted.

[1] id:8738h7kv2q.fsf@qmul.ac.uk
2014-10-25 19:27:07 +02:00
Austin Clements
bc9c50602d lib: Internal support for querying and creating ghost messages
This updates the message abstraction to support ghost messages: it
adds a message flag that distinguishes regular messages from ghost
messages, and an internal function for initializing a newly created
(blank) message as a ghost message.
2014-10-25 19:26:54 +02:00
Austin Clements
d99491f274 lib: Introduce macros for bit operations
These macros help clarify basic bit-twiddling code and are written to
be robust against C undefined behavior of shift operators.
2014-10-25 19:26:43 +02:00
Austin Clements
d9f5da00bb lib: Update database schema doc for ghost messages
This describes the structure of ghost mail documents.  Ghost messages
are not yet implemented.
2014-10-25 19:26:03 +02:00
Austin Clements
1cdb96d3c4 lib: Add a ghost messages database feature
This will be implemented over the next several patches.  The feature
is not yet "enabled" (this does not add it to
NOTMUCH_FEATURES_CURRENT).
2014-10-25 19:25:54 +02:00
David Bremner
f5db7ad7d2 notmuch 0.18.2 release
-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQGcBAABCAAGBQJUS9DZAAoJEPIClx2kp54s604L/0QXEH2twR9qYKvrc2CHFR7e
 9OX1yVx9A/mq5lFk9Inb6xfIJEcnFnAWkSEAkRwMYgL2705fd+No+UnAdC0HxBYo
 1EoabYGbMiVMbGN0+y/6byqq1YmRDKfRvZFF1WneZyugWyX2lYDjQmRW/g5EdKGb
 TZS2RhY4U18QV/L1ZaherO9yy9Ct0XXvxx+Tio6g5Xx4Hn0jEx0SH+B0gXmqDCwj
 fdy/5nQK7H+0NSD8W7y6z2DCd3SZ72gm8pVyScOZ3CvTaE8K9rIE5F2xpF/rtyra
 Gp+ST9i/hCLwV8YnVfMWhajHjXuZamV75vANgSKWdHGZHuIG9i+ocf0cKdbmhDUK
 6GJtnUMsNENbq1emKu/12lpMGZU5XBh4lg1whX9g5QvFQ6S8FcETFuqbaOTLio91
 d9wy/D+QzJZ/gLijQu/cEFi5pCbKCcaHfUeI48VwoORfdpKxIG007k5wDOwpBbAy
 9g7hte1d9cQquwZyDKyt65CicbJEu8v5ROT+81zBbg==
 =wMbd
 -----END PGP SIGNATURE-----

Merge tag '0.18.2'

notmuch 0.18.2 release
2014-10-25 18:55:25 +02:00
David Bremner
d53f759456 debian: add changelog stanza for 0.18.2-1 2014-10-25 18:23:33 +02:00
David Bremner
e842030893 version: bump to 0.18.2
No non-documentation changes
2014-10-25 18:23:06 +02:00
David Bremner
3370f14bf1 NEWS: give real entry for 0.18.2
Expand out what the actual test suite changes are, so people have a
better idea if the release is relevant to them.
2014-10-25 12:10:05 +02:00
David Bremner
ce44657c9e notmuch 0.18.2~rc1 release
-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQGcBAABCAAGBQJUS2vpAAoJEPIClx2kp54svhoL/1kCYjeONhccqb1cyjCVPsC7
 NBGZ48JZNqmDnxrjjz4PgrA9R7h/4R4ViWboCNGFJEbQaPqh89klLa+XiOpaNoyZ
 Y2oP/GrZNXg2TtThehywwWY2w/Q2+bfpyI8C1RnXDuLzvtS6fTpSfGX9+yr7KfUE
 fT56r2V68HHTaTUSFvywKpnRMNnExoa1HT/0EdDRV3v3LqlqALZwgyJAv7hb7EfX
 0a7Q5JChVhQyq+BRq4tKJA2g/n3s54dy3cIBXmSjo8CvOar+GVgrceZ5i1al7Z7x
 D2BDpMfr2qV4fJYapsH+n3fsUhr0LmG651A5A2GdaGUNhLtP28hGPUZpT+ejzTAW
 GOWdlF+PzDCMhdZzqjYQUqN3ROgQsDUcGrwXv+tVv2AoZepSbxyhIeIzU71dD/vx
 5JEP3EVJMwgWbDHKeOzv1+nwzQpMWk8/vxSA9SPN9MBUMkNjaKyrY1YBrX6xtUn0
 l3iglBOdTcqr0uZSVSTU4sODcKtd/w2TlSOSWWnRNA==
 =KuiR
 -----END PGP SIGNATURE-----

Merge tag '0.18.2_rc1'

notmuch 0.18.2~rc1 release

Conflicts:
	NEWS
	debian/changelog
2014-10-25 11:38:18 +02:00
David Bremner
26e857b712 debian: build depend on dh-python
The build log asked me nicely, so I did.
2014-10-25 11:20:57 +02:00
David Bremner
5aeb28be2a debian: add changelog stanza for 0.18.2~rc-1 2014-10-25 11:03:05 +02:00
David Bremner
47b477faad NEWS: add minimal news item for 0.18.2
The less said, the less typos to make.
2014-10-25 11:03:05 +02:00
David Bremner
60bbc06ac0 version: bump to 0.18.2~rc1 2014-10-25 11:03:05 +02:00
David Bremner
e32bb20099 test: kill '"filename": "signature.asc"' from json output
This starts to appear with emacs24.4, so we can't easily have it in
our expected output.
2014-10-25 10:39:07 +02:00
David Bremner
1de97ee586 test/emacs: force *Messages* buffer to be writable
In emacs 24.4 the messages buffer starts being read-only, which kills
these tests.  This seems to be the point of the variable
inihibit-read-only, which has existed at least since emacs 21.
2014-10-25 10:39:07 +02:00
David Bremner
b4278d4e8e test: simplify T360-symbol-hiding, use nm instead of objdump
After yet another variation in objdump output caused this test to fail
(on a Debian port, no less), I decided whatever putative benefit we
get from looking at the object files instead of the library isn't
worth the maintenence headache.

This version uses nm -P. nm -P should be portable, and fixed format.
It purposely doesn't use the -D argument, since that is non-POSIX and
nm on GNU/Linux seems do the right thing without it.

It still won't work out of the box on e.g. Mac OS/X. I think the right
thing to do there is to move some more configuration information into
sh.config.

(cherry picked from commit c34d6bad0f)
2014-10-25 10:39:07 +02:00
Austin Clements
776684c7b6 test: Port atomicity test to Python
Previously, this was implemented using a horrible GDB script (because
there is no such thing as a non-horrible GDB script).  This GDB script
often broke with newer versions of GDB for mysterious reasons.  Port
the test script to GDB's Python API, which makes the code much cleaner
and, hopefully, more stable.

(cherry picked from commit cbbda62258)

Conflicts:
	test/T380-atomicity.sh
2014-10-25 08:57:20 +02:00