Mark Walters [Thu, 10 Jan 2013 10:41:16 +0000 (10:41 +0000)]
contrib: pick: move save-excursion closer to message insertion
Pick keeps point roughly at the top of the buffer while inserting
messages at the end as they come in (from the async
parser). Previously the save-excursion to do this was done once for
each thread inserted: now it is done for each individual message.
The advantage is that the message insertion code can decide where to
leave point. In the next patch point will be left on the target message.
Note notmuch-pick-insert-msg is unchanged as that is used by the tag
display update code.
Mark Walters [Sat, 4 May 2013 13:01:14 +0000 (14:01 +0100)]
emacs:show: separate out handling of application/octet-stream
Currently mime parts are basically handled based on their mime-type
with the exception of application/octet-stream parts. Deal with these
parts at the top level (notmuch-show-insert-bodypart).
This is needed later in the series as we need to put in a part button
for each part (which means knowing its mime type) while deferring the
actual insertion of the part.
Austin Clements [Fri, 17 May 2013 20:14:28 +0000 (16:14 -0400)]
emacs: Proper error string handling in search sentinel
Apparently Emacs provides a function to stringify errors properly.
Use this in the search sentinel where we have to do our own error
messaging, rather than assuming the first error argument will be the
descriptive string.
David Bremner [Wed, 15 May 2013 10:53:27 +0000 (07:53 -0300)]
perf-test: add notmuch-memory-test
Somehow this file was not added to the patch set which split the tests
into time and memory tests. Take advantage of the the "new" way of
running tests to avoid listing the explicitly.
Aaron Ecay [Wed, 6 Mar 2013 03:31:49 +0000 (22:31 -0500)]
lib/database.cc: change how the parent of a message is calculated
Presently, the code which finds the parent of a message as it is being
added to the database assumes that the first Message-ID-like substring
of the In-Reply-To header is the parent Message ID. Some mail clients,
however, put stuff other than the Message-ID of the parent in the
In-Reply-To header, such as the email address of the sender of the
parent. This can fool notmuch.
The updated algorithm prefers the last Message ID in the References
header. The References header lists messages oldest-first, so the last
Message ID is the parent (RFC2822, p. 24). The References header is
also less likely to be in a non-standard
syntax (http://cr.yp.to/immhf/thread.html,
http://www.jwz.org/doc/threading.html). In case the References header
is not to be found, fall back to the old behavior.
V2 of this patch, incorporating feedback from Jani and (indirectly)
Austin.
Tomi Ollila [Sun, 31 Mar 2013 20:04:02 +0000 (23:04 +0300)]
emacs: removed code attempting to support emaces prior to version 23
The support for emacs version 22 has not worked at least since
September 2011 when I attempted to use it. I expanded the support in
id:yf6ippgtbn0.fsf@taco2.nixu.fi but that was not enough and then I
found it easier to switch to emacs 23.
In case one wants to resurrect emacs 22 (or earlier!) support, pick
the changes from the patch email referenced above.
Added a customizable variable notmuch-address-selection-function
and the function with the same name to provide a way for user to
change the function called to do address selection.
By default the functionality is exactly the same as it has been so
far; completing-read is called with the same parameters as before.
Setting equivalent lambda expression in place of using
notmuch-address-selection-function function is done as follows:
The notmuch-addrlookup utility uses a third party library to read the
notmuch configuration file. The previously used implementation at
"github.com/kless/goconfig" vanished, so this patch switches to the
implementation at "github.com/msbranco/goconfig". As the
implementations differ at the API level, the code is updated
accordingly.
Vladimir Marek [Thu, 2 May 2013 14:31:42 +0000 (16:31 +0200)]
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.
Tomi Ollila [Wed, 10 Apr 2013 21:42:55 +0000 (00:42 +0300)]
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:
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.