Commit graph

4555 commits

Author SHA1 Message Date
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
Trevor Jim
05b27ee0dd go: add binding for notmuch_message_get_date 2015-03-08 08:25:44 +01:00
David Bremner
90886f3640 lib: bump library minor version
This should have happened in commit 326e18856, but it didn't.
2015-03-07 20:15:06 +01:00
Jani Nikula
6aeef2ee15 parse-time-string: fix setting and rounding of seconds
If seconds are not specified in the string to be parsed, they're not
set according to the reference time (in the no rounding case) nor
rounded properly (in the rounding up cases). Fix this.

The bug caused searches such as date:10:30..10:30 to match messages
with date exactly 10:30:00 only, and not in range 10:30:00..10:30:59
(inclusive) as documented.

Note that date searches referring "noon" or "5pm" will still be
interpreted as exact to the second.
2015-03-07 10:20:33 +01:00
Jani Nikula
952f46fedc test: extract and flag second rounding tests as broken
Extract and add some more tests relating to rounding seconds into a
separate subtest, and flag it as broken. If seconds are not specified,
the time is not set or rounded according to the interface defined in
parse-time-string/parse-time-string.h. Instead, seconds are always set
to 00 in reality, which is broken.
2015-03-06 21:36:20 +01:00
Jani Nikula
65dee41fb6 test: add some more time tests
Ensure the seconds are set properly.
2015-03-06 21:36:11 +01:00
Jani Nikula
fd80a9cac1 test: improve the time parsing tests
Set the reference time to 12:13:14 instead of 11:11:00 to ensure hours
and minutes are not mixed up, and seconds are really set instead of
defaulted to 00.
2015-03-06 21:35:58 +01:00
David Bremner
35e49601c4 completion: update list of commands in zsh completion.
This is actually generated by the script in

     id:1420289900-29717-2-git-send-email-david@tethera.net

We may as well update the list of commands while we decide if it's
worth automating the process. Note that there is a bit more noise than
expected because it alphabetizes all of the commands with their own
man pages.
2015-03-06 08:02:33 +01:00
Jani Nikula
f4a5a534c8 cli: add a tool for starting new message in the emacs ui
Add a tool to start composing an email in the Notmuch Emacs UI with
the specified subject, recipients, and message body.
2015-03-06 08:02:08 +01:00
J. Lewis Muir
ee2d490280 lib: make notmuch shared library install_name be full path on Mac OS X
The install_name of libnotmuch.dylib on Mac OS X is what is written
into a program that links against it.  If it is just the name of the
shared library file, as opposed to the full path, the program won't be
able to find it when it runs and will abort.  Instead, the install_name
should be the full path to the shared library (in its final installed
location).

Why does Notmuch work without this patch when installed via Homebrew?
The answer is twofold.  One, /usr/local/lib is a special location in
which the dynamic linker will look by default to find shared libraries.
Homebrew highly recommends installing to /usr/local, and, assuming it
has been configured this way, the Notmuch library will end up installed
in /usr/local/lib, and the dynamic linker will find it.  Two, Homebrew
globally corrects all install names in dynamically shared libraries and
binaries for each package it installs.  So, even if the install names in
a package's binaries and libraries are incorrect, Homebrew corrects them
automatically, and no one ever knows.

Why does Notmuch work without this patch when installed via MacPorts?
The answer is that MacPorts applies a patch just like this patch to fix
the same problem.
2015-03-06 08:00:18 +01:00
David Bremner
326e188564 lib: bump SONAME minor version
This indicates upwardly compatible changes, namely adding new symbols.

Although we don't formally need to do this until the next release,
there is no hard in doing it now, as long as we don't bump the minor
version for every addition between now and the release.
2015-03-01 08:49:14 +01:00
David Bremner
7a0fc10367 lib: add new status reporting API for notmuch_query_search_{m,t}
This at least allows distinguishing between out of memory and Xapian
exceptions. Adding finer grained status codes would allow different
Xapian exceptions to be preserved.

Adding wrappers allows people to transition gradually to the new API,
at the cost of bloating the library API a bit.
2015-03-01 08:49:14 +01:00
Jani Nikula
a9e0786f72 cli: fix clang build warnings
Fix the following warning produced by clang 3.5.0:

notmuch-search.c:730:25: warning: initializing 'void *' with an
expression of type 'const notmuch_opt_desc_t (*)[4]' discards
qualifiers [-Wincompatible-pointer-types-discards-qualifiers]
        { NOTMUCH_OPT_INHERIT, &common_options, NULL, 0, 0 },
                               ^~~~~~~~~~~~~~~
1 warning generated.
2015-02-25 23:11:08 +01:00
Jani Nikula
08757767de lib: fix clang build warnings
Fix the following warning produced by clang 3.5.0:

lib/message.cc:899:4: warning: comparison of constant 64 with expression of type 'notmuch_message_flag_t' (aka '_notmuch_message_flag') is always true [-Wtautological-constant-out-of-range-compare]
        ! NOTMUCH_TEST_BIT (message->lazy_flags, flag))
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./lib/notmuch-private.h:70:6: note: expanded from macro 'NOTMUCH_TEST_BIT'
    (_NOTMUCH_VALID_BIT(bit) ? !!((val) & (1ull << (bit))) : 0)
     ^~~~~~~~~~~~~~~~~~~~~~~
./lib/notmuch-private.h:68:26: note: expanded from macro '_NOTMUCH_VALID_BIT'
    ((bit) >= 0 && (bit) < CHAR_BIT * sizeof (unsigned long long))
                   ~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2015-02-25 23:09:39 +01:00
Jani Nikula
41b870fba5 lib: abstract bit validity check in bit test/set/clear macros
Reduce duplication in the bit test/set/clear macros. No functional
changes.
2015-02-25 23:08:35 +01:00
David Bremner
d7b6e0cae7 doc: update list of prefixes
'attachement' missed a colon, and 'mimetype' was not added to this table
at all.
2015-02-24 08:29:01 +01:00
David Bremner
682a362c85 doc: typo fix for prefix discussion. 2015-02-24 08:29:01 +01:00
David Bremner
4313be0a0c doc: add more information on operators.
More material borrowed from the wiki page on "searching"
2015-02-24 08:29:01 +01:00
David Bremner
7fa58b792c doc: add material on stemming and wildcards
This is lightly massaged from the searching page on the wiki.
2015-02-24 08:29:01 +01:00
Jani Nikula
647c0b0692 completion: complete notmuch dump --gzip option 2015-02-23 21:49:08 +01:00
Jani Nikula
45038b44b7 doc: document notmuch-restore --input=filename option
Document all options for completeness.
2015-02-23 21:47:55 +01:00
Jani Nikula
1e5b4b72c9 doc: document notmuch-dump --output=filename option
Document all options for completeness.
2015-02-23 21:47:46 +01:00
Jani Nikula
6cc1c8d149 doc: bring notmuch-dump manual page in line with the rest
Fix indentation of options. Move search terms description before
options. Fix synopsis.
2015-02-23 21:47:32 +01:00
David Bremner
625401eb2f doc: remove reference to sender,recipients from notmuch-search.1
Apparently these were missed when notmuch-address was split to it's
own subcommand.
2015-02-22 19:52:42 +01:00
Tomi Ollila
91ef2ae524 configure: consistent command -v usage
When the shell builtin `command -v` operates normally, it either
prints the path of the arg given to it and returns zero -- or it
returns nonzero and prints nothing.
In abnormal situations something might be printed to stderr and
in that case we want to know about it; therefore the used
command -v stderr redirections to /dev/null have been removed.

The `hash` (builtin) command in ksh returns zero even the arg
given to is is not found in path. For that and for consistency
the one appearance of it has been converted to `command -v`.
2015-02-19 19:14:29 +01:00
Stefano Zacchiroli
1722ea2c95 notmuch-mutt: support for messages that lack Message-ID headers
For those messages, compute a synthetic Message-ID based on the SHA1
of the whole message, in the same way that notmuch would do. See:
http://git.notmuchmail.org/git/notmuch/blob/HEAD:/lib/sha1.c

To do the above, rewrite get_message_id() to accumulate header lines,
parse them to check for Message-ID, and fallback to SHA1 computation
if it is not present.

Thanks to:
- Jan N. Klug for preliminary versions of this patch
- Tomi Ollila for suggesting an elegant implementation
2015-02-16 08:58:13 -04:00
Stefano Zacchiroli
02b554c896 notmuch-mutt README: use metacpn.org/* as deps homepages 2015-02-16 08:57:49 -04:00
Stefano Zacchiroli
f755fd1bda notmuch-mutt: bump copyright year 2015-02-16 08:57:42 -04:00
Jinwoo Lee
2049205e09 emacs: Add a defcustom that specifies regexp for blocked remote images.
It's default value is ".", meaning all remote images will be blocked
by default.
2015-02-02 23:07:01 +01:00
Austin Clements
b74ed1cfad emacs: Support cid: references with shr renderer
shr has really nice support for inline image rendering, but previously
we only had the hooks for w3m cid: references.
2015-01-25 18:39:13 +01:00
Austin Clements
f84cbb1d4d emacs: Rewrite content ID handling
Besides generally cleaning up the code and separating the general
content ID handling from the w3m-specific code, this fixes several
problems.

Foremost is that, previously, the code roughly assumed that referenced
parts would be in the same multipart/related as the reference.
According to RFC 2392, nothing could be further from the truth:
content IDs are supposed to be globally unique and globally
addressable.  This is nonsense, but this patch at least fixes things
so content IDs can be anywhere in the same message.

As a side-effect of the above, this handles multipart/alternate
content-IDs more in line with RFC 2046 section 5.1.2 (not that I've
ever seen this in the wild).  This also properly URL-decodes cid:
URLs, as per RFC 2392 (the previous code did not), and applies crypto
settings from the show buffer (the previous code used the global
crypto settings).
2015-01-25 18:39:13 +01:00
Austin Clements
b0b5ced82b emacs: Use generalized content caching in w3m CID code
Previously this did its own caching, but this is now supported by more
generally by `notmuch-get-bodypart-binary'.
2015-01-25 18:39:13 +01:00
Austin Clements
3687418526 emacs: Support caching in notmuch-get-bodypart-{binary,text}
(The actual code change here is small, but requires re-indenting
existing code.)
2015-01-25 18:39:13 +01:00
Austin Clements
9d19f325f5 emacs: Return unibyte strings for binary part data
Unibyte strings are meant for representing binary data.  In practice,
using unibyte versus multibyte strings affects *almost* nothing.  It
does happen to matter if we use the binary data in an image descriptor
(which is, helpfully, not documented anywhere and getting it wrong
results in opaque errors like "Not a PNG image: <giant binary spew
that is, in fact, a PNG image>").
2015-01-25 18:39:13 +01:00
Austin Clements
991efcded8 emacs: Remove broken `notmuch-get-bodypart-content' API
`notmuch-get-bodypart-content' could do two very different things,
depending on conditions: for text/* parts other than text/html, it
would return the part content as a multibyte Lisp string *after*
charset conversion, while for other parts (including text/html), it
would return binary part content without charset conversion.

This commit completes the split of `notmuch-get-bodypart-content' into
two different and explicit APIs: `notmuch-get-bodypart-binary' and
`notmuch-get-bodypart-text'.  It updates all callers to use one or the
other depending on what's appropriate.
2015-01-25 18:39:13 +01:00
Austin Clements
021906d6ec emacs: Create an API for fetching parts as undecoded binary
The new function, `notmuch-get-bodypart-binary', replaces
`notmuch-get-bodypart-internal'.  Whereas the old function was really
meant for internal use in `notmuch-get-bodypart-content', it was used
in a few other places.  Since the difference between
`notmuch-get-bodypart-content' and `notmuch-get-bodypart-internal' was
unclear, these other uses were always confusing and potentially
inconsistent.  The new call clearly requests the part as undecoded
binary.

This is step 1 of 2 in separating `notmuch-get-bodypart-content' into
two APIs for retrieving either undecoded binary or decoded text.
2015-01-25 18:39:13 +01:00
Austin Clements
c67a04de60 emacs: Track full message and part descriptor in w3m CID store
This will simplify later changes.
2015-01-25 18:39:12 +01:00
David Bremner
4d5477a3d5 doc: add details about Xapian search syntax
Questions related to the way that probabilistic prefixes and phrases
are handled come up quite often and it is nicer to have the documentation self contained.  Hopefully putting it in subsections prevents it from being overwhelming.
2015-01-25 18:36:47 +01:00
David Bremner
b9e7b8e8f0 doc: gzipped notmuch.3 before trying to install notmuch.3.gz
If HAVE_SPHINX=0 but HAVE_DOXYGEN=1, then the previous version was
trying to install notmuch.3.gz but only got as far as creating
notmuch.3
2015-01-25 15:04:51 +01:00
Todd
8fb1cbc1c2 Update documentation
Adds new entry to the NEWS file, and updates the search terms section
of the man page.  The search terms section needs to be updated again
once the new section in the documentation covering probablistic terms
has been committed.
2015-01-24 16:51:20 +01:00
Todd
694c7b9ba7 Update completions for Emacs and bash
This adds completions for both Emacs and bash. ZSH does not appear to
have completions for search terms.
2015-01-24 16:50:02 +01:00
Todd
b04bc967f9 Add indexing for the mimetype term
This adds the indexing support for the "mimetype:" term and removes
the broken test flag.  The indexing is probablistic in Xapian terms,
which gives a better experience to end users.  Standard content-types
of the form "foo/bar" are automatically interpreted as phrases in
Xapian due to the embedded slash.

Assume, separate messages with application/pdf and application/x-pdf
are indexed, then:

- mimetype:application/x-pdf will find only the application/x-pdf
- mimetype:application/pdf will find only the application/pdf
- mimetype:pdf will find both of the messages
2015-01-24 16:47:59 +01:00
Todd
0de999aab5 Add the NOTMUCH_FEATURE_INDEXED_MIMETYPES database feature
This feature will exist in all newly created databases, but there is
no upgrade provided for it.  If this flag exists, it indicates that
the database was created after the indexed MIME-types feature was
added.
2015-01-24 16:47:47 +01:00