Git uses a simple and yet powerful test framework, written in shell.
The framework is easy to use for both users and developers so I think
it would help if it is used in notmuch as well.
This is a copy of Git's test framework from commit
b6b0afdc30e066788592ca07c9a6c6936c68cc11 in git repository.
Signed-off-by: Michal Sojka <sojkam1@fel.cvut.cz>
We extend the '|' command so that passing a prefix argument, (for
example, "C-u |"), causes it to pipe all open messages in the current
thread rather than just the single, current message.
This was previously wrapped for unsubtituted command names. It looks
much better in the notmuch-help (available with '?') if wrapped
according to the length of the substituted command names.
Since commit f41a35e292 running a command
such as:
NOTMUCH_CONFIG=/new/config/file notmuch setup
would result in a segmentation fault.
The purpose of that commit was to ensure that an attempt to manipulate
a non-standard database would not inadvertently manipulate the default
database only due to a typo in the NOTMUCH_CONFIG environment
variable. That is, a command like:
NOTMUCH_CONFIG=mistyped-config-filename notmuch tag -new tag:new
shouldn't modify the database at ${HOME}/mail, but should instead
simply report that the mistype configuration filename does not exist.
We fix both cases simultaneously by reporting the error message
whenever the function calling notmuch_config_open is not explicitly
prepared for a default configuration file.
We don't love the mbox format, but it's still sometimes the most
practical way to share a collection of messages as a single file.
Here we implement the "mboxrd" variant of the mbox file format. This
variant applies reversible escaping by prefixing a '>' character to
all lines in the email messages matching the regular expression:
"^>*From "
This allows the escaping to be reliably removed. A reader should remove
a '>' from any line matching the regular expression:
"^>>*From "
More details on the mboxrd formats (and others as well) can be found
here:
http://homepage.ntlworld.com/jonathan.deboynepollard/FGA/mail-mbox-formats.html
Let the user destroy objects that she wants explicitly.
It's not possible to specify the order objects are garbage collected.
See id:86y6f8v838.fsf@harikalardiyari.ev on ruby-talk for more
information.
Micah Anderson reported an issue where a message failed to display in
the emacs interface, (it instead gave an error, "json-read-string: Bad
string format").
Micah tracked this down to the json output from "notmuch show" being
interrupted by a GMime error message:
gmime-CRITICAL **: g_mime_stream_filter_add: assertion
`GMIME_IS_FILTER (filter)
I tracked this down further to notmuch passing a NULL value to
g_mime_stream_filter_add. And this was due to calling
g_mime_filter_charset_new with a value of "unknown-8bit".
So we add a test message withe a Conten-Type of "text/plain;
charset=unknown-8bit" from Micah's message. Then we fix "notmuch show"
to test for NULL before calling g_mime_stream_filter_add. Bug fixed.
Various users were confused as to why they couldn't run notmuch
immediately after "make install", (with linker errors saying that
libnotmuch.so could not be found). The errors came from two different
causes:
1. The user had installed to a system library directory, but had not
yet run ldconfig.
2. The user had installed to some non-system directory, and had not
set the LD_LIBRARY_PATH variable.
With this change we fix both problems (on Linux) without the user
having to do anything additional. We first use ldconfig to find the
system library directories. If the user is installing to one of these,
then we run ldconfig as part of "make install".
For case (2) we use the -rpath and --enable-new-dtags linker options
to install a DT_RUNPATH entry in the binary. This entry tells the
dynamic linker where to find libnotmuch. Without the
--enable-new-dtags option only a DT_RPATH option would be installed,
(which has the drawback of not allowing any override with the
LD_LIBRARY_PATH variable).
Distributions (such as Debian and Fedora) don't want to see binaries
packaged with a DT_RPATH or DT_RUNPATH entry. This should be avoided
automatically as long as the packages install to standard locations,
(such as /usr/lib).
The idea here is to more easily support filenames with spaces in them
in various loops. We're about to add a loop over the paths configured
by the dynamic linker. Hopefully, they wouldn't contain spaces, but
one never knows so we might as well be prepared.
Scott Henson reported an internal error that occurred when he tried to
add a message that referenced another message with a message ID well
over 300 characters in length. The bug here was running into a Xapian
limit for the length of metadata key names, (which is even more
restrictive than the Xapian limit for the length of terms).
We fix this by noticing long message ID values and instead using a
message ID of the form "notmuch-sha1-<sha1_sum_of_message_id>". That
is, we use SHA1 to generate a compressed, (but still unique), version
of the message ID.
We add support to the test suite to exercise this fix. The tests add a
message referencing the long message ID, then add the message with the
long message ID, then finally add another message referencing the long
ID. Each of these tests exercise different code paths where the
special handling is implemented.
A final test ensures that all three messages are stitched together
into a single thread---guaranteeing that the three code paths all act
consistently.
We're about to add a test with an excessively long message-id, (512
characters or so). This exceeds filename length limits, so just always
the simple counter to generate the filenames, (which we were doing for
messages with non-custom IDs anyway).
Previously we were using Xapian's add_document to allocate document ID
values for notmuch_message_t objects. This had the drawback of adding
a partially constructed mail document to the database. If notmuch was
subsequently interrupted before fully populating this document, then
later runs would be quite confused when seeing the partial documents.
There are reports from the wild of people hitting internal errors of
the form "Message ... has no thread ID" for example, (which is
currently an unrecoverable error).
We fix this by manually allocating document IDs without adding
documents. With this change, we never call Xapian's add_document
method, but only replace_document with either the current document ID
of a message or a new one that we have allocated.
Rather than discarding authors when truncated to fit the defined
column width, mark the text beyond the end of the column as invisible
and allow `isearch' to be used over the text so hidden.
This allows us to retain the compact display whilst enabling a user to
find the elided text.
Add `notmuch-show-relative-dates' to control whether the summary line
in `notmuch-show' mode displays relative dates (e.g. '26 mins. ago') or
the full date string from the message. Default to `t' for
compatibility with the previous behaviour.
Shift-TAB is standard "opposite" of TAB -- in GUI interfaces they
typically cycle through input elements in opposite orders -- so it
makes sense to behave the same way.
Signed-off-by: Nelson Elhage <nelhage@ksplice.com>
Insert a separator every three digits when outputting numbers. Allow
the user to choose the separator by customizing
`notmuch-decimal-separator'. Widen the space allocated for message
counts accordingly.
This lets us pick up later changes to widget-keymap if the user
customizes it in some way. This is the recommended way to use
`widget-keymap', according to its help.
This enables the nifty '?' key binding to work in notmuch-hello
(although for some strange reasons I don't see any descriptions for
specific key bindings yet. Not sure how that is supposed to work
though.
But this starts, runs and behaves identical to the existing code.
Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
The configure usage string documents that it respects LDFLAGS, but
currently it doesn't do anything with the configure-time LDFLAGS
value.
Signed-off-by: Tomas Carnecky <tom@dbservice.com>
[Tomas and Nelson sent almost identical patches which I've merged
together here.]
In notmuch-mua-reply we were filtering out the Subject and To headers
manually in a loop, but message mode offers a nice function for
exactly that. Simplify the code by using it. Also, as notmuch-mua-mail
already sorts and hides headers that we want sorted and hidden, we can
safely remove those 2 functions from here as well. Also remove the
(require 'cl), the only reason for its existence was the now removed
"loop" function.
Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
Add `notmuch-column-control', which has three potential sets of
values:
- t: automatically calculate the number of columns per line based on
the tags to be shown and the window width,
- an integer: a lower bound on the number of characters that will be
used to display each column,
- a float: a fraction of the window width that is the lower bound on
the number of characters that should be used for each column.
So:
- if you would like two columns of tags, set this to 0.5.
- if you would like a single column of tags, set this to 1.0.
- if you would like tags to be 30 characters wide, set this to
30.
- if you don't want to worry about all of this nonsense, leave
this set to `t'.
Add face declarations for the date, count, matching author and subject
columns in search mode and apply those faces when building the search
mode display.
Approved-by: Jameson Rollins <jrollins@finestructure.net>
In search mode some messages don't match the search criteria. Show
their authors names with a different face - generally darker than
those that do match.
I know I should be writing something witty here to make cworth happy,
but I can't think for any verbose justification of this patch beyond
that submitting a NEWS blurb will make cworth happy too. So let's make
him happy.
Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
In the common case that a user only has one FCC (save outgoing mail in
the Mail directory, it is now possible to simply configure a string
such as "Sent" in the notmuch-fcc-dirs variable. More complex options,
depending on a users email address, are possible and described in the
variable customization help text.
The whole function notmuch-fcc-header-setup has been cleaned up a
little while working on that.
Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
- If no saved searches exist or are displayed, don't signal an error,
- If no saved searches exist or are displayed, leave the cursor in the
search bar,
- Minor layout improvements.
The commit said it fixed a problem with headers >200 characters
long. But examination of the code suggests that it was a header of
exactly 200 characters long that caused the problem. So we add a test
case for that here.
Before the fix in the previous commit, valgrind would detect many
errors when replying to the message created with this test case. After
that commit, those errors are gone.
If a single header is more than 200 characters long a set of 'off by
one' errors cause memory corruption.
When allocating memory with:
a = malloc (len);
the last usable byte of the memory is 'a + len - 1' rather than 'a +
len'.
Fix the same bug when calculating the current offset should the buffer
used for collecting the output header need to be reallocated.
This was already telling the user how to run notmuch within emacs, but
not how to just run the notmuch command-line interface, (which, as it
turns out, is a prerequisite for running the emacs interface anyway).
So add a small paragraph here.
The INSTALL file still had old information about the "make
install-emacs" command which no longer exists. README was also giving
pointers on how to develop a real interface, (which is not the right
thing since README should be addressed to users, not coders).
So remove the stale and misplaced information, and instead add a new
"Running notmuch" section to the README describing how to run the
notmuch command-line interface and how to run the emacs interface.
These versions provide greatly desired performance advantages for
notmuch.
Previously, theses details existed in an old NEWS entry, but most
users are unlikely to find those details there. Put them here where we
mention the Xapian dependency.