Commit graph

3616 commits

Author SHA1 Message Date
Vladimir Marek
51b073c6f2 lib/message.cc: stale pointer bug (v3)
Xapian::TermIterator::operator* returns std::string which is destroyed
as soon as (*i).c_str() finishes. The remembered pointer 'term' then
references invalid memory.

Signed-off-by: Vladimir Marek <vlmarek@volny.cz>
2013-05-03 21:17:56 -03:00
Tomi Ollila
8bee3c417c emacs: fixed (declare-function ...) definitions
Some (declare-function ...) definitions were drifted away from the
actual (defun ...)'s. To find the drifts and to verify changes
the following command line was used:

$ emacs --batch -L emacs --eval '(check-declare-directory "emacs")'
2013-04-30 06:13:18 -03:00
David Bremner
3c5ada48be man: document NOTMUCH_DEBUG_QUERY
This is is really functionality of the library, but CLI users might
not look at library docs even if they existed beyond notmuch.h
2013-04-30 06:13:05 -03:00
Jani Nikula
d2c881867e cli: mime node: fix compiler warning when building against gmime 2.4
commit d487ef9e58
Author: Jani Nikula <jani@nikula.org>
Date:   Sat Mar 30 15:53:16 2013 +0200

    cli: mime node: abstract decryption and signature verification

introduced a compiler warning, reported by Mark Walters, when building
against gmime 2.4:

mime-node.c:224:9: warning: assignment discards ‘const’ qualifier from
pointer target type [enabled by default]

Pass the non-const signature validity to the destructor to fix this.
2013-04-14 19:49:16 -03:00
Jani Nikula
566e8f1eba TODO: remove some completed todo items from the list
Bash completion has been rewritten. Configuration file saves follow
symlinks. There is --config=FILE top level option to specify
configuration file.
2013-04-14 19:46:17 -03:00
Jani Nikula
58ed67992d cli: config: do not overwrite symlinks when saving config file
Use realpath to canonicalize the config path before writing.

Previously 'notmuch setup' and 'notmuch config set' overwrote the
config file even if it was a symbolic link.
2013-04-14 18:38:07 -03:00
Jani Nikula
7defbcdcec test: add some config file tests
Test the --config=FILE option, and add a broken test for writing
config file through a symbolic link.
2013-04-14 18:35:02 -03:00
David Bremner
661dcf87ae Revert "emacs: functions to import sender or recipient into BBDB"
This reverts commit 238bf4cb09.

This commit was causing a build failure.

Bad me for not checking before pushing.
2013-04-06 16:11:02 -03:00
Daniel Bergey
238bf4cb09 emacs: functions to import sender or recipient into BBDB
From a show buffer, notmuch-bbdb/snarf-from imports the sender into
bbdb.  notmuch-bbdb/snarf-to imports all recipients.  Newly imported
contacts are reported in the minibuffer / Messages buffer.

Both functions use the BBDB parser to recognize email address formats.
2013-04-06 08:36:54 -03:00
Jani Nikula
02cb7cf152 nmbug-status: only import notmuch when needed
Make it possible to use the script to query search views without
notmuch python bindings installed.
2013-04-06 08:36:34 -03:00
Jani Nikula
73fcfa861c nmbug-status: add support for querying the search views
Make it easy for scripts to read the views and corresponding searches.
2013-04-06 08:36:26 -03:00
Jani Nikula
1c450ec5fa cli: conform to same conditional build style as elsewhere in notmuch-show
Conform to the same style for #ifdef GMIME_ATLEAST_26 conditional
builds as elsewhere.

There are no functional changes.
2013-04-01 15:39:41 -04:00
Jani Nikula
d487ef9e58 cli: mime node: abstract decryption and signature verification
The code filled with #ifdef GMIME_ATLEAST_26 is difficult to
read. Abstract the decryption and signature verification into
functions, with separate implementations for GMime 2.4 and 2.6, to
clarify the code.

There should be no functional changes.
2013-04-01 15:39:33 -04:00
Jani Nikula
8c6fd79795 cli: crypto: abstract gpg context creation for clarity
The code filled with #ifdef GMIME_ATLEAST_26 is difficult to
read. Abstract gpg context creation into a function, with separate
implementations for GMime 2.4 and 2.6, to clarify the code.

There should be no functional changes.
2013-04-01 15:39:22 -04:00
Mark Walters
c933e54227 emacs: hello: use batch count
This modifies notmuch hello to use the new count --batch
functionality. It should give exactly the same results as before but
under many conditions it should be much faster. In particular it is
much faster for remote use.

The code is a little ugly as it has to do some working out of the
query when asking the query and some when dealing with the result.
However, the code path is exactly the same in both local and remote
use.
2013-04-01 12:22:30 -04:00
Jani Nikula
360c3c8607 test: notmuch count --batch and --input options 2013-04-01 09:38:48 -04:00
Jani Nikula
1abd795677 man: document notmuch count --batch and --input options 2013-04-01 09:38:32 -04:00
Jani Nikula
c6265706e8 cli: add --batch option to notmuch count
Add support for reading queries from stdin, one per line, and writing
results to stdout, one per line.

This will bring considerable performance improvements when utilized in
Emacs notmuch-hello, especially so when running remote notmuch.
2013-04-01 09:36:09 -04:00
Jani Nikula
530b562111 cli: extract count printing to a separate function in notmuch count
Make count printing on a query string reusable. No functional changes.
2013-04-01 09:35:52 -04:00
Jani Nikula
ab65c365d5 cli: remove useless talloc_strdup
If the condition holds, query_string_from_args() has already returned
a talloc allocated empty string. There's no need to duplicate that.
2013-04-01 09:34:44 -04:00
David Bremner
abd4d6b92e emacs: introduce notmuch-command-to-string, replace use of shell-command-to-string
This has two benefits: unified error handling, and avoiding tramp's
hooking into shell-command-string.

This seems to be a fix for id:874nguxbvq.fsf@tu-dortmund.de
2013-04-01 07:58:20 -04:00
Jani Nikula
6b405143d7 test: notmuch tag --remove-all 2013-03-30 18:34:22 -04:00
Jani Nikula
26105ddbb0 man: document notmuch tag --remove-all 2013-03-30 18:34:10 -04:00
Jani Nikula
268666a071 cli: add --remove-all option to "notmuch tag"
Add --remove-all option to "notmuch tag" to remove all tags from the
messages matching query before applying the tag changes. This allows
removal of all tags and unconditional setting of the tags of a
message:

$ notmuch tag --remove-all id:foo@example.com
$ notmuch tag --remove-all +foo +bar id:foo@example.com

without having to resort to the complicated (and still quoting
broken):

$ notmuch tag $(notmuch search --output=tags '*' | sed 's/^/-/') \
  id:foo@example.com
$ notmuch tag $(notmuch search --output=tags '*' | sed 's/^/-/') \
  +foo +bar id:foo@example.com
2013-03-30 18:33:59 -04:00
Jani Nikula
a6822eccac cli: make caller check tag count in parse_tag_command_line 2013-03-30 18:33:40 -04:00
Jani Nikula
703136c57b completion: update README about bash completion dependencies 2013-03-30 18:31:01 -04:00
Jani Nikula
fbf6536959 NEWS: bash completion 2013-03-30 18:30:34 -04:00
Jani Nikula
bf34366693 cli: config: remove unnecessary braces from if blocks
Cosmetic change to drop unnecessary braces that don't even conform to
the prevailing coding style.
2013-03-30 18:30:06 -04:00
Adam Wolfe Gordon
f55b35b3df lib: Fix name reordering to handle commas without spaces
Notmuch automatically re-orders names of the format "Last, First" to
"First Last" when the associated email address is
First.Last@example.com. But, if a name is of the format "Last,First"
then notmuch will format the name as "irst Last". Handle any number of
spaces after the comma, including none.
2013-03-29 09:24:29 -04:00
Tomi Ollila
a629b2e1cb devel: add post-release tools news2wiki.pl and man-to-mdwn.pl
After new notmuch release has been published the NEWS and manual
pages have been updated using these 2 programs.

Adding the tools to notmuch repository eases their use, adds more
transparency to the "process" and gives more people chance to
do the updates is one is unavailable to do it at the time being.
2013-03-29 09:23:19 -04:00
Tomi Ollila
5872cba1eb devel/STYLE: information how to enable standard pre-commit hook
It is easier to enable git standard pre-commit hook, when the
operation to do so is presented.
2013-03-29 09:21:44 -04:00
Jani Nikula
2302fd7925 completion: complete bash completion rewrite
Rewrite the bash completion script to actually do something
useful. Supported completions:

* All the notmuch commands, command line arguments, and values for
  keyword arguments.

* Tags after + and - in 'notmuch tag'.

* Config options in 'notmuch config', and some config option values.

* Search prefixes in all commands that use search terms.

* Tags after tag: prefix in search terms.

* User's email addresses after from: and to: in search terms.

This is all based on the bash-completion package [1], and will not
work without it.

[1] http://bash-completion.alioth.debian.org/
2013-03-28 15:07:54 -04:00
Damien Cassou
b714a808a6 emacs: possibility to customize the rendering of tags
This patch extracts the rendering of tags in notmuch-show to
the notmuch-tag file.

This file introduces a `notmuch-tag-formats' variable that associates
each tag to a particular format. This variable can be customized
thanks to the work of Austin Clements. For example,

  '(("unread" (propertize tag 'face '(:foreground "red")))
    ("flagged" (notmuch-tag-format-image tag "star.svg")))

associates a red foreground to the "unread" tag and a star picture to
the "flagged" tag.

Signed-off-by: Damien Cassou <damien.cassou@gmail.com>
2013-03-25 11:38:49 -04:00
Damien Cassou
4ea80dd2a1 emacs: Add notmuch-combine-face-text-property-string
Signed-off-by: Damien Cassou <damien.cassou@gmail.com>
2013-03-25 11:38:29 -04:00
Austin Clements
9cf89a3c04 emacs: Combine string faces and combine under existing faces
This improves notmuch-combine-face-text-property to support both
applying faces to strings and to support combining the given face
under existing faces, rather than over.
2013-03-25 11:36:47 -04:00
Austin Clements
3ddb4dc806 emacs: Handle all face forms when combining faces
Previously, notmuch-combine-face-text-property assumed that any
existing face properties of the modified text were already in face
list form.  This was true as long as it was the only function
manipulating faces (since it always produced a list form face), but if
anything else has manipulated the face, it was more likely to be
either a face name or a face plist.  It also didn't correctly handle
face lists as arguments, even though the doc string claimed it did.

This patch fixes notmuch-combine-face-text-property to handle all face
forms correctly by canonicalizing both the argument face and the
existing faces into list form.  This also means we can set the face to
a simpler non-list form if there's no existing face.
2013-03-25 11:35:22 -04:00
David Bremner
b5a4bfafc0 debian/changelog: stanza for 0.15.2-2
Debian only changes.
2013-03-22 20:46:57 -04:00
Jameson Graef Rollins
4a8372c240 Bug#703608: [PATCH] debian: tighten notmuch-mutt dependency on notmuch
notmuch version 0.4 is required for the --output=files option.
2013-03-22 20:42:25 -04:00
Jameson Graef Rollins
6a38b5db37 Bug#703608: [PATCH] debian: tighten notmuch-mutt dependency on notmuch
notmuch version 0.4 is required for the --output=files option.
2013-03-22 13:08:55 -03:00
Jani Nikula
6daee9b082 man: document the notmuch --config=FILE global option 2013-03-08 07:55:04 -04:00
Jani Nikula
ed016e5670 cli: add top level --config=FILE option
Let the user specify the config file on the command line.
2013-03-08 07:54:53 -04:00
Jani Nikula
4ef2106792 cli: move config open/close to main() from subcommands
This allows specifying config file as a top level argument to notmuch,
and generally makes it possible to override config file options in
main(), without having to touch the subcommands.

If the config file does not exist, one will be created for the notmuch
main command and setup and help subcommands. Help is special in this
regard; the config is created just to avoid errors about missing
config, but it will not be saved.

This also makes notmuch config the talloc context for subcommands.
2013-03-08 07:54:41 -04:00
Jani Nikula
e76f6517de cli: config: make notmuch_config_open() "is new" parameter input only
We now have a notmuch_config_is_new() function to query whether a
config was created or not. Change the notmuch_config_open() is_new
parameter into boolean create_new to determine whether the function
should create a new config if one doesn't exist. This reduces the
complexity of the API.
2013-03-07 09:39:12 -04:00
Jani Nikula
ca3a4fc022 cli: config: keep track of whether the config is newly created
Keep track of whether the config is newly created, and add
notmuch_config_is_new() accessor function to query this.

This is to support anyone with a config handle to check this, instead
of just whoever called notmuch_config_open().
2013-03-07 09:39:05 -04:00
Jani Nikula
e9cffd9345 cli: plug main notmuch command into subcommand machinery
This allows top level arguments to be added to notmuch in a way that
doesn't require special handling for the plain notmuch command without
a subcommand.
2013-03-07 09:38:58 -04:00
Jani Nikula
c1d1954469 cli: abstract subcommand finding into a new function
Clean up code.
2013-03-07 09:38:50 -04:00
Aaron Ecay
ed5150d2df test/README: mention the test_expect_equal_json and *sanitize* functions
also fix one typo
2013-03-07 09:38:26 -04:00
David Bremner
16bf7b4b89 nmbug: allow empty prefix
Current code does not distinguish between an empty string in the
NMBPREFIX environment variable and the variable being undefined. This
makes it impossible to define an empty prefix, if, e.g. somebody wants
to dump all of their tags with nmbug.
2013-03-02 10:42:45 -04:00
David Bremner
f7a7f78aeb nmbug: replace hard-coded magic hash with git-hash-object
This is at least easier to understand than the magic hash. It may also
be a bit more robust, although it is hard to imagine these numbers
changing without many other changes in git.
2013-03-02 10:42:27 -04:00
David Bremner
17b468ac9f nmbug: use 'notmuch tag --batch'
This should be more robust with respect to tags with whitespace and
and other special characters. It also (hopefully) fixes a remaining
bug handling message-ids with whitespace.  It should also be
noticeably faster for large sets of changes since it does one exec per
change set as opposed to one exec per tag changed.
2013-03-02 10:42:16 -04:00