Daniel Bergey [Sun, 31 Mar 2013 18:20:15 +0000 (14:20 -0400)]
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.
Jani Nikula [Sat, 30 Mar 2013 13:53:16 +0000 (15:53 +0200)]
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.
Jani Nikula [Sat, 30 Mar 2013 13:53:15 +0000 (15:53 +0200)]
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.
Mark Walters [Sun, 31 Mar 2013 09:46:03 +0000 (12:46 +0300)]
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.
Jani Nikula [Sat, 9 Mar 2013 14:56:49 +0000 (16:56 +0200)]
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
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.
Tomi Ollila [Fri, 8 Mar 2013 16:32:23 +0000 (18:32 +0200)]
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.
Damien Cassou [Sat, 23 Mar 2013 11:29:54 +0000 (12:29 +0100)]
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.
Austin Clements [Mon, 4 Feb 2013 21:37:02 +0000 (16:37 -0500)]
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.
Austin Clements [Mon, 4 Feb 2013 21:37:01 +0000 (16:37 -0500)]
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.
Jani Nikula [Sun, 3 Mar 2013 21:55:09 +0000 (23:55 +0200)]
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.
Jani Nikula [Sun, 3 Mar 2013 21:55:08 +0000 (23:55 +0200)]
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.
Jani Nikula [Sun, 3 Mar 2013 21:55:06 +0000 (23:55 +0200)]
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.
David Bremner [Wed, 20 Feb 2013 22:24:37 +0000 (18:24 -0400)]
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.
David Bremner [Wed, 20 Feb 2013 22:24:36 +0000 (18:24 -0400)]
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.
David Bremner [Wed, 20 Feb 2013 22:24:35 +0000 (18:24 -0400)]
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.
David Bremner [Wed, 20 Feb 2013 22:24:34 +0000 (18:24 -0400)]
nmbug: use dump --format=batch-tag
This should make nmbug tolerate tags with whitespace and other special
characters it. At the moment this relies on _not_ passing calls to
notmuch tag through the shell, which is a documented feature of perl's
system function.
Jani Nikula [Wed, 27 Feb 2013 07:40:38 +0000 (09:40 +0200)]
cli: crypto: tell gmime to use gpg-agent
For decryption, we expect there to be a functioning gpg-agent, and we
want gpg to talk to it for any needed credentials. There's a gmime
function to declare that: g_mime_gpg_context_set_use_agent() [1], [2].
Start using it.
I had gpg-agent running, but gpg "use-agent" configuration option
disabled. This resulted in an error message from 'notmuch show':
Failed to decrypt part: Canceled.
and json had this:
"encstatus" : [ { "status" : "bad" } ]
One could argue the "use-agent" option should be enabled, but I'd like
to use the agent only as a last resort. I think that's irrelevant
though. There's a gmime function to declare what we expect, so we
should use it. Conveniently it also fixes the problem in a user
friendly way.
Austin Clements [Sun, 25 Nov 2012 04:57:05 +0000 (23:57 -0500)]
lib: Add an iterator over all messages in a thread
Previously, getting the list of all messages in a thread required
recursively traversing the thread's message hierarchy, which was both
difficult and resulted in messages being out of order. This adds a
public function to retrieve an iterator over all of the messages in a
thread in oldest-first order.
Austin Clements [Sun, 25 Nov 2012 04:57:03 +0000 (23:57 -0500)]
lib: Separate list of all messages from top-level messages
Previously, thread.cc built up a list of all messages, then
proceeded to tear it apart to transform it into a list of
top-level messages. Now we simply build a new list of top-level
messages.
This simplifies the interface to _notmuch_message_add_reply,
eliminates the pointer acrobatics from
_resolve_thread_relationships, and will enable us to do things
with the list of all messages in the following patches.
Austin Clements [Sun, 25 Nov 2012 04:57:02 +0000 (23:57 -0500)]
lib: Clean up error handling in _notmuch_thread_create
Previously, there were various opportunities for memory leaks in the
error-handling paths of this function. Use a local talloc context and
some reparenting to make eliminate these leaks, while keeping the
control flow simple.
Tomi Ollila [Mon, 21 Jan 2013 03:01:46 +0000 (05:01 +0200)]
test/test-lib.sh: separate signaled exit
When execution of tests is interrupted by signal coming outside of the
test system itself, output just one line "interrupted by signal <num>"
message to standard output. This distinguishes the case from internal
exit and reduces noise.
Mark Walters [Mon, 7 Jan 2013 21:07:20 +0000 (21:07 +0000)]
emacs: show: make buttons select window
Emacs has two button type objects: widgets (as used for saved searches
in notmuch-hello) and buttons as used by parts/citations and id links
in notmuch-show. These two behave subtly differently when clicked with
the mouse: widgets select the window clicked before running the
action, buttons do not.
This patch makes all of these behave the same: clicking always selects
the clicked window. It does this by defining a notmuch-button-type
supertype that the other notmuch buttons can inherit from. This
supertype binds the mouse-action to select the window and then
activate the button.
Details:
- $pipe_decode is turned off, to prevent message-id from being
filtered out by "ignore" settings in the muttrc.
- Original values for $pipe_decode and $wait_key are saved and restored.
- The macros, being much longer now, are line wrapped for improved
readability.
On Thu, Feb 14, 2013 at 12:36:58AM +0100, Profpatsch wrote:
> On 13-02-13 02:35pm, Kevin J. McCarthy wrote:
> > A more likely idea is to check whether you have $pipe_decode set.
>
> BRILLIANT!
> So much for copying a basic rc from someone else.
> Of course, that was it and I’m officially an idiot.
Neat, thanks Kevin for debugging the issue down to $pipe_decode (which
I've never used, mutt never stops to amaze me :-)).
> And apparently Mail::Internet errors out if there is no Message-ID.
> (Which mentioned in the docs at CPAN…)
>
> Mystery solved.
Right, but still a more graceful failure model would be nice.
Please find attached a patch that in such cases should 1) give a
supposedly nice error message explaining what's going on and 2) empty
the results dir to avoid showing you unrelated results. It works for me.
But extra checking never hurts, in particular for the tag action, which
I don't personally use.
I guess it would also be nice to actually disable $pipe_decode in the
relevant Mutt macros, but I'm not sure about to do that without
interfering with user desired configuration. Kevin: do you know if there
is a common Mutt trick to store the value of a variable before changing
it, and restoring it a posteriori? More isolation for this kind of
things in Mutt would definitely be welcome...
Cheers.
--
Stefano Zacchiroli . . . . . . . zack@upsilon.cc . . . . o . . . o . o
Maître de conférences . . . . . http://upsilon.cc/zack . . . o . . . o o
Debian Project Leader . . . . . . @zack on identi.ca . . o o o . . . o .
« the first rule of tautology club is the first rule of tautology club »
From b67ab95855ce7d279d8c0b3ddcbc20e679afc70b Mon Sep 17 00:00:00 2001
From: Stefano Zacchiroli <zack@upsilon.cc>
Date: Thu, 14 Feb 2013 09:31:37 +0100
Subject: [PATCH] notmuch-mutt: more graceful handling of missing Message-Id
errors
in particular:
- the "thread" action would print an error and empty results dir
- the "tag action would print an error
David Bremner [Sat, 16 Feb 2013 12:03:09 +0000 (08:03 -0400)]
notmuch-vim: deprecate, move to contrib
As discussed in id:871udhcmks.fsf@zancas.localnet, notmuch-vim doesn't
really meet the standards of the CLI, emacs interface, or python
bindings in terms of being well maintained.
David Bremner [Sat, 16 Feb 2013 11:54:33 +0000 (07:54 -0400)]
nmbug: move from contrib to devel
There seems to be consensus to use presence in contrib as
documentation of limited support by the notmuch developers; in fact
nmbug is pretty integrated into our current development process, so
devel seems more appropriate.
Robert Mast [Wed, 13 Feb 2013 15:32:57 +0000 (16:32 +0100)]
bitmap:improve memory usage using CHAR_BITS and unsigned CHAR
Using char instead of int allows for simpler definitions of the
DOCIDSET macros so the code is easier to understand and consistent with
respect to memory-usage. Estimated reduction of memory-usage for
bitmap about 8 times.
Jani Nikula [Sat, 9 Feb 2013 22:49:00 +0000 (00:49 +0200)]
nmbug: only push master branch on nmbug push
nmbug pull only merges upstream master, but nmbug push tries to push
all local branches. The asymmetry results in conflicts whenever there
have been changes in the config branch in the origin:
$ nmbug push
To nmbug@nmbug.tethera.net:nmbug-tags
! [rejected] config -> config (non-fast-forward)
error: failed to push some refs to 'nmbug@nmbug.tethera.net:nmbug-tags'
hint: Updates were rejected because a pushed branch tip is behind its remote
hint: counterpart. If you did not intend to push that branch, you may want to
hint: specify branches to push or set the 'push.default' configuration
hint: variable to 'current' or 'upstream' to push only the current branch.
'git push origin' exited with nonzero value
To fix this, only push the master branch on nmbug push. Any config
changes need to be done manually via git anyway.
David Bremner [Tue, 29 Jan 2013 12:13:40 +0000 (08:13 -0400)]
CLI: add simple error handling for talloc logging
This really should have been there before. I think it's better to do
the actual operation and then possibly fail writing the memory log,
but it would not be too hard to change it to abort earlier.
David Bremner [Tue, 29 Jan 2013 23:06:37 +0000 (19:06 -0400)]
test: delay watchdog checks in emacs.
Instead of checking immediately for the watched process, delay a
minute, or in the case that process-attributes returns nil, for two
minutes. This is intended to cope with the case that
process-attributes is unimplimented, and returns always returns nil.
In this case, the watchdog check is the same as the two minute limit
imposed by timeout.
Tomi Ollila [Thu, 24 Jan 2013 07:39:02 +0000 (09:39 +0200)]
test/test-lib.sh: use vt100 as dtach terminal if TERM dumb or unset/empty
The TERM environment variable is set to 'dumb' when running tests, but
the original value of it is stored for echoing colors and running emacs
(somewhat interactively) in detached session. Emacs requires some
terminal control sequences to be available for interactive operation.
In case original TERM is (also) 'dumb' (or unset/empty) emacs cannot
run interactively. To fix this problem dtach (and emacs as it's child
process) is run with TERM=vt100 in case original TERM was unset, empty
or 'dumb'. This way there is a chance to run emacs tests with different
user terminals and potentially find problems there.
David Bremner [Sat, 19 Jan 2013 18:25:55 +0000 (14:25 -0400)]
man: document existing top level options
The options --help and --version were not documented before. One
could quibble about how useful that documentation is, but we will soon
add more options.
David Bremner [Sat, 19 Jan 2013 18:25:53 +0000 (14:25 -0400)]
CLI: remove alias machinery, and "part", "search-tags" commands
The commands are long deprecated, so removal is probably overdue. The
real motivation is to simplify argument handling for notmuch so that
we can migrate to the common argument parsing framework.
Tomi Ollila [Sat, 19 Jan 2013 02:13:17 +0000 (04:13 +0200)]
devel/release-checks.sh: version string problem does not halt execution
Version string has strict format requirements in release-check.sh:
only numbers and periods (in sane order) are accepted.
Mismatch there used to halt further execution.
In this case, checking versions like '*~rc1' for (more) problems
was not possible.
This 'fatal error' is now changed buffered error message like in
following tests, and is displayed at the end of execution.
Tomi Ollila [Sat, 12 Jan 2013 07:40:14 +0000 (09:40 +0200)]
cli: propagate batch tagging warnings to exit value
In case last input for batch tagging was either invalid or skippable
line, notmuch command exited with non-zero value.
After this change if there is at least one invalid line, notmuch
command will exit with non-zero value. Additionally, skipped lines
(last or other) doesn't cause non-zero value to be returned.
Mark Walters [Sun, 13 Jan 2013 12:43:52 +0000 (12:43 +0000)]
emacs: show: w3m/invisibility workaround
There is a bug in the current notmuch code with w3m and invisible
parts. w3m sets a keymap, and if we have a hidden [text/html] point
at the start of the following line still gets this w3m keymap which
causes some strange effects. For example, RET gives an error "No URL
at Point" rather than hiding the message, <down> goes to the next link
rather than just down a line.
These keybinding are also inconvenient when the text/html part is
displayed so we ask w3m not to install a keymap.
This is only likely to be a problem for emacs 23 as shr is preferred
as html renderer on emacs 24 (although the user can set the renderer
to w3m even on emacs 24).
This solution was suggested by Tomi Ollila <tomi.ollila@iki.fi>