Commit graph

4497 commits

Author SHA1 Message Date
David Bremner
447ad6b498 cli: add standard option processing to config, help and setup
In particular this fixes a recently encountered bug where the
"--config" argument to "notmuch setup" is silently ignored, which the
unpleasant consequence of overwriting the users config file.
2015-06-01 07:32:54 +02:00
David Bremner
0018a8d787 cli: define shared options, use for --help and --version
Unfortunately it seems trickier to support --config globally

The non-trivial changes are in notmuch.c; most of the other changes
consists of blindly inserting two lines into every subcommand.
2015-06-01 07:32:54 +02:00
David Bremner
0706e0e3e2 cli: refactor notmuch_help_command
Create a new private entry point _help_for so that we can call help
without simulating a command line invokation to set up the arguments.
2015-06-01 07:32:54 +02:00
David Bremner
1d4321ffa5 cli: ignore config argument of notmuch_help_command
We call it with NULL at one point anyway, so it needs to work with
NULL. Since the only place we use talloc is right before exec, there
is no harm in always using NULL.
2015-06-01 07:32:54 +02:00
J. Lewis Muir
d08af93c65 cli: change "setup" to "set up" where used as a verb
The word "setup" is a noun, not a verb.  Change occurrences of "setup"
where used as a verb to "set up".
2015-05-31 19:14:42 +02:00
Charles Celerier
1896ad9714 emacs: Added "is:<tag>" style completion to notmuch-read-query.
The notmuch-search-terms man page states that "tag:<tag>" is equivalent
to "is:<tag>". Completion for "is:<tag>" style searches is now supported
in the Emacs interface.

Amended by David Bremner: combine lexical-let and let into
lexical-let*
2015-05-31 19:07:02 +02:00
David Bremner
b271763152 notmuch 0.20 release
-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQGcBAABCAAGBQJVataHAAoJEPIClx2kp54sshUL/RHYmmGgUxZdGiP0hnmUj+LB
 a4U4Anx4/23iW8nAwcNuSn0S7U9SKV9i1hIoBgFsuLM1sCL7AAHd6VFjRrsJN5Pi
 zcwPGK4PGgZS5LnhOVG4KCRJPTgCMqmTUozhwbhmvhMJtWwykPHn1PqLCnt4ARAh
 ASu9fkbXyuD64RM1sc9XvKCXsUUdFQX6K0zO8raR4ySJFO2w4j7adCD7UC5ViqJz
 sFENdfLDOpBL3F5G5JabukMsjjvxl0AnWz1tA+tdvLh4zbI8YlFR852L40R/M2qa
 ToVNIXwFYvpv3fC/CB5xdx4lALobRYDifK+gJ3Co9VvS/KAxSfK4JLOKIkRqc5dy
 ptuJvwgKpsE0mjBScfkj+Y/ygM1zSJENgPMpcuTWOmHXFAalss1cL9skCDYAsM9B
 qD/9Rl+pWmzTtlxb98czNcouu0JUMaI/hH/lawddck6n1ylaWia8OFHZnYNhB5xV
 mp9mjiG/8D2VtdztLpQTtPxts2APjn+v6TgivmkDhQ==
 =7ZNV
 -----END PGP SIGNATURE-----

Merge tag '0.20'

notmuch 0.20 release
2015-05-31 12:06:40 +02:00
David Bremner
be8e796fd5 NEWS: bump date 2015-05-31 11:26:41 +02:00
David Bremner
042b3cdd36 debian: changelog stanza for 0.20-1 2015-05-31 11:22:34 +02:00
David Bremner
4bc7fba31b version: bump to 0.20 2015-05-31 11:13:56 +02:00
David Bremner
dc951683c3 drop mention of notmuch-emacs-mua 2015-05-31 11:12:13 +02:00
David Bremner
11de429824 notmuch 0.20~rc2 release
-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQGcBAABCAAGBQJVYM/TAAoJEPIClx2kp54swJoMAJN9KiVObvYUqF/1uRjfYNUD
 mcHm9l+j2AaU7moAsoWqVjYLEn3Kb2ARx4PdkzpWDsf9SnI3YYQC6KEngomyI2HP
 32Brb7D1wwYjjPF/VZ7pdr36ZdbWfwiyEm9LwqGq2HKRqoEk0MtZm4a3ibrHAqzc
 9G0Mlq9n6M7U7tmw6wNYofXweCA8wK3t0YAzKxRjqNjoCriWYES1g+tcptKLlxWE
 yQL/5Szb2g/huq39qy7PfGE8K5vZyCKH9amLnbHEdZ4SHc4WoddLanpx8JvjaPFg
 ZuMgnG6tiosSzpQAz2IsLEgkmi7WVoZyJYaLH8uDzTpl2rDDkbX7OuCnq79GmYMU
 WzMqdTVi4NCzwVA+B7qUp4dI8NElcfcfdaoS953+nvqAjH50ZdPjfvqE72Tu1ewk
 UJLHRCoCW5eH/O71G+xRnKDuT0dA+4GtabMufvxMlPPL8ulBouh/F5tjCT9NmH2N
 gu/v1pWJkzxiaKWsZYvhA8rPj26TMYVa8EMiU2JG0w==
 =QPzY
 -----END PGP SIGNATURE-----

Merge tag '0.20_rc2'

notmuch 0.20~rc2 release
2015-05-23 21:27:41 +02:00
David Bremner
3d81f496a0 debian: changelog stanza for 0.20~rc2-1 2015-05-23 21:05:25 +02:00
David Bremner
4f96b5be63 version: bump to 0.20~rc2 2015-05-23 21:03:30 +02:00
David Bremner
36bf31658c python: use absolute import for SOVERSION
Apparently python3 needs this.
2015-05-23 20:59:42 +02:00
David Bremner
00ee9ca737 docs: initial draft of NEWS for 0.20
This is meant as much to jog people's memory as to be definitive.
2015-05-23 20:59:42 +02:00
David Bremner
ccd7c0b0e6 configure: Add sanity checking for environment variables
Passing in environment variables incompatible with the compiler may
cause other parts of the configure script to fail in hard to
understand ways, so we abort early.
2015-05-23 20:28:06 +02:00
David Bremner
c5ef2dc448 notmuch 0.20~rc1 release
-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQGcBAABCAAGBQJVRy5OAAoJEPIClx2kp54sjzsL/iEw/WXC89RUn5ccq6BFVnJN
 +MDRKnBtP8A9SfAq0X+hqoyRHtLGSd4voff2to8e3/jn4+0qegwf193I7KJZ2r1g
 mQ9ldfohFt4pE06BiixdhrbDhvHgUwWIJb+BIaduD8sXgZ8sHxAwfYOyqr/Pvqf8
 2mTNhoqcLZT5KRCdQ2xSNu+OYsgSVdS6AnIIvgLN4Uf8FmHduiOgsLHa6OmDJZWp
 4jZ9/T2ccS4WZzk1yszGWLdhh+oGyZD+OTIqnhdb5W5R8DdV5u+jUSnhYhcuXJ3I
 68JxI5q355DNtBqK8N6x91dmdgEvhYdChwkkJurEG02xOCQHlVtK3aeRDrnIJnx8
 nQDl8z9ckKRA7Tg6YeSvJq03ib3GYnZQwdMSIuQsUomcdfsZ3/UQpDhYxVFcOiur
 dEfo0Ipxd2SoDfOgvYjFxqwvDK5BIsrcMt6m8e7CwjP6PWx30umfHIRcyywLD6Jn
 Kd37EYYUY/9IV/Y6HQdehXIft/QK6xDiOUznOPqKlg==
 =Hcr2
 -----END PGP SIGNATURE-----

Merge tag '0.20_rc1'

notmuch 0.20~rc1 release
2015-05-04 10:47:22 +02:00
David Bremner
cd29acef4e debian: add new symbols to libnotmuch4.symbols
Since we only add new symbols, no SONAME bump is needed.
2015-05-04 10:18:43 +02:00
David Bremner
93233ba09e debian: call upstream configure script directly
dh defaults for dh_auto_configure are now incompatible with notmuch's
homebrew configure script (at least in debian experimental)
2015-05-04 10:07:44 +02:00
David Bremner
fa11a62de0 version: bump to 0.20~rc1 2015-05-04 08:09:43 +02:00
David Bremner
76b3670202 debian: changelog stanza for 0.20~rc1 2015-05-04 08:08:43 +02:00
Jack Peirce
1ad02d06b5 notmuch-mutt: fix xargs/ln usage for OpenBSD compatibility
- xargs: use -r flag instead of --no-run-if-empty
- ln: use -I flag/3rd form of ln command instead of -t flag/4th form

Signed-off-by: Stefano Zacchiroli <zack@upsilon.cc>
2015-05-04 08:04:38 +02:00
David Bremner
294bb6de20 test: move nonexistent directory to something under notmuch's control.
Apparently some systems actually have a directory called /nonexist[ae]nt.
It's hard to fathom a good reason for that, but oh well. As long as we
don't create such a directory inside the notmuch source tree, the new
version should be more robust.
2015-04-08 23:43:55 +09:00
David Bremner
2e9ecb611a test: be consistent about spelling `nonexistent'
Apparently most of the misspellings are my fault.
2015-04-08 23:43:55 +09:00
Mark Walters
6518f0d2bc emacs: show: hide large text attachments by default
notmuch-show can be slow displaying large attachments so hide them by
default. The default maximum size is 10000 bytes/characters but it is
customizable.

Note that notmuch-show-insert-bodypart is also called from the reply
code so we need to be a little careful.
2015-04-03 09:29:05 +09:00
Tomi Ollila
3d1483df12 test/thread-order: more robust loop exit in case of broken input
When creating $THREADS data it may end of not having 'None' at all
or the numbers in line output yields a loop.

To avoid loop the value in current array index is set to 'None'
so that if the same item is reached again the loop will end.

Also empty string as next array index will end the loop.
2015-04-03 09:27:57 +09:00
Tomi Ollila
0fa9cf75e5 notmuch-emacs-mua: non-forking escape () usage with backslash '\' escape
Use the printf -v convention to give output variable as argument
to escape () function so no subshell needs to be executed for
escaping input. The '-v' option to escape () is just syntactic
sugar for better understanding.

Also, backslash is now escaped with another backslash for emacs. This
ie especially important at the end of string.

`echo` is no longer used to write escaped output -- it might interpret
the escapes itself.
2015-04-03 09:27:35 +09:00
W. Trevor King
244f873954 nmbug-status: Use 'show-ref --heads' for loading configs
When loading configs from Git, the bare branch name (without a
refs/heads/ prefix or similar) matches all branches of that name
(including remote-tracking branches):

  .nmbug $ git show-ref config
  48f3bbf1d1492e5f3d2f01de6ea79a30d3840f20 refs/heads/config
  48f3bbf1d1492e5f3d2f01de6ea79a30d3840f20 refs/remotes/origin/config
  4b6dbd9ffd152e7476f5101eff26747f34497cee refs/remotes/wking/config

Instead of relying on the ordering of the matching references, use
--heads to ensure we only match local branches.
2015-04-01 06:16:06 +02:00
W. Trevor King
a351df1a06 NEWS: fix 'not' -> 'now' typo in 0.19 nmbug section 2015-04-01 06:15:30 +02:00
David Bremner
703c8f9511 test: make one error output test more robust.
Since notmuch_database_status_string can return NULL, passing it
directly to fputs is not a good idea.
2015-03-29 09:50:01 +02:00
David Bremner
6a99505625 test: add more error reporting tests
This second half of the error reporting tests actually uses the function
notmuch_database_status_string to retrieve the last logged error
2015-03-29 00:34:15 +01:00
David Bremner
9d192da683 lib: eliminate fprintf from _notmuch_message_file_open
You may wonder why _notmuch_message_file_open_ctx has two parameters.
This is because we need sometime to use a ctx which is a
notmuch_message_t. While we could get the database from this, there is
no easy way in C to tell type we are getting.
2015-03-29 00:34:15 +01:00
David Bremner
736ac26407 lib: replace almost all fprintfs in library with _n_d_log
This is not supposed to change any functionality from an end user
point of view. Note that it will eliminate some output to stderr. The
query debugging output is left as is; it doesn't really fit with the
current primitive logging model. The remaining "bad" fprintf will need
an internal API change.
2015-03-29 00:34:15 +01:00
David Bremner
9b73a8bcc9 lib: add private function to extract the database for a message.
This is needed by logging in functions outside message.cc that take
only a notmuch_message_t object.
2015-03-29 00:34:15 +01:00
David Bremner
b53e1a2da7 lib: add a log function with output to a string in notmuch_database_t
In principle in the future this could do something fancier than
asprintf.
2015-03-29 00:34:15 +01:00
David Bremner
84d3b15d25 lib: add "verbose" versions of notmuch_database_{open,create}
The compatibility wrapper ensures that clients calling
notmuch_database_open will receive consistent output for now.

The changes to notmuch-{new,search} and test/symbol-test are just to
make the test suite pass.

The use of IGNORE_RESULT is justified by two things. 1) I don't know
what else to do.  2) asprintf guarantees the output string is NULL if
an error occurs, so at least we are not passing garbage back.
2015-03-29 00:34:15 +01:00
David Bremner
83298fa0f8 test: add error reporting tests
This first half of the tests is all that don't need to retrieve the
the error string explicitly from the notmuch database structure.
2015-03-29 00:34:15 +01:00
David Bremner
1e69afe8af test: add support for compiling and running C snippets
This is to limit the copy-pasta involved in running C tests. I decided
to keep things simple and not try to provide an actual C skeleton.

The setting of LD_LIBRARY_PATH is to force using the built libnotmuch
rather than any potential system one.
2015-03-29 00:33:56 +01:00
David Bremner
baf93369f6 test: Add two tests for error output from notmuch_database_open
This is arguably testing the same thing twice, but in the brave new
future where we don't use printf anymore, each subcommand will be
responsible for handling the output on it's own.
2015-03-15 20:27:20 +01:00
W. Trevor King
bed8b6743d nmbug-status: Clarify errors for illegible configs
Carl Worth pointed out that errors like:

  $ ./nmbug-status
  fatal: Not a git repository: '/home/cworth/.nmbug'
  fatal: Not a git repository: '/home/cworth/.nmbug'
  Traceback (most recent call last):
    File "./nmbug-status", line 254, in <module>
      config = read_config(path=args.config)
    File "./nmbug-status", line 73, in read_config
      return json.load(fp)
    File "/usr/lib/python2.7/json/__init__.py", line 290, in load
      **kw)
    File "/usr/lib/python2.7/json/__init__.py", line 338, in loads
      return _default_decoder.decode(s)
    File "/usr/lib/python2.7/json/decoder.py", line 366, in decode
      obj, end = self.raw_decode(s, idx=_w(s, 0).end())
    File "/usr/lib/python2.7/json/decoder.py", line 384, in raw_decode
      raise ValueError("No JSON object could be decoded")
  ValueError: No JSON object could be decoded

are not particularly clear.  With this commit, we'll get output like:

  $ ./nmbug-status
  fatal: Not a git repository: '/home/wking/.nmbug'
  No local branch 'config' in /home/wking/.nmbug.  Checkout a local
  config branch or explicitly set --config.

which is much more accessible.  I've also added user-friendly messages
for a number of other config-parsing errors.
2015-03-15 09:28:15 +01:00
Jani Nikula
6d44e5ac47 lib: make notmuch_query_count_messages explicitely exact
The default is actually exact if no checkatleast parameter is
specified. This change makes that explicit, mainly for documentation,
but also to be safe in the unlikely event of a change of default.

[ commit message rewritten by db based on id:87lho0nlkk.fsf@nikula.org
]
2015-03-13 07:58:55 +01:00
Jani Nikula
76f8498df6 completion: complete addresses in from:/to: search terms
Use the new notmuch address command to do completion for addresses in
from: and to:. Use --output=sender for both for efficiency, even
though --output=recipients would be more accurate for to: prefix
completion.
2015-03-13 07:56:38 +01:00
Jani Nikula
2447f4c119 cli: add support for notmuch command --help
Recognize 'notmuch command --help' at the top level as a special case,
and show help for the command. Note that for simplicity, --help is
only recognized as the first option for the subcommand.
2015-03-11 08:07:55 +01:00
Jani Nikula
c17e4fe629 cli: fix top level --help combined with other options
If the top level --help is combined with other options, help
fails. For example:

    $ notmuch --version --help

    Sorry, --help is not a known command. There's not much I can do to help.

Fix this by adjusting argc and argv appropriately. The help command
ignores argv[0] anyway, so we don't have to set it to "help".
2015-03-11 08:07:41 +01:00
David Bremner
c883e632bf CLI: make gpg binary used by libgmime configurable.
Previously we set up a way for the top level notmuch command to choose
which gpg binary was invoked by libgmime. In this commit we add the
(mostly boilerplate) code to allow the notmuch-config command to read
and write this path, and use it in the appropriate struct.

Update tests for new default variable
2015-03-11 08:04:00 +01:00
David Bremner
21ecd7369a CLI: set up infrastructure to make path to gpg configurable.
GMIME takes a path to gpg, but we hardcode that path.  In this commit
we set up argument passing and option storage to allow this path to
specified in the top level notmuch command.
2015-03-09 08:19:28 +01:00
David Bremner
aed5ec4350 python: replace hardcoding of SONAME version
Failing to update this string in globals.py causes failures when the
SONAME changes.  In order to hopefully reduce the number of such
errors, automate the process of setting the SONAME in the python
bindings.
2015-03-08 08:30:36 +01:00
Jani Nikula
a00b4abc27 man: fix notmuch-emacs-mua environment section
It's emacsclient command, not comment. Document default values. While
at it, format the environment section similarly to other man pages.
2015-03-08 08:27:43 +01:00
Jani Nikula
5240c438f5 notmuch-emacs-mua: remove -C to keep short options compatible with mutt
Notmuch uses long options exclusively all around. The short options in
notmuch-emacs-mua are intentionally just a compatible subset of
mutt(1). Keep it this way, if only to make documenting the fact easy!

The Notmuch style --client long option remains, of course.
2015-03-08 08:27:28 +01:00