Use .gz filenames for saved attachments in the tests to check
that Emacs does not re-compress the file.
Use test_expect_equal_file instead of test_expect_equal to avoid
binary output on the console.
Before the change, test_expect_equal_file moved files it compared
in case of failure. The patch changes it to copy the files
instead. This allows testing non-temporary files which are
stored in git.
Note: the change should not result in new temporary files left
after the tests. Test_expect_equal_file used to move files only
on failure, so callers had to cleanup them anyway.
Write-region handles some file names specially, see Emacs Lisp
manual section 25.11 Making Certain File Names "Magic" [1]. This
is a nice feature for normal text editing, but it is not
desirable if we need to save raw file content (e.g. attachment).
In particular, this affects archives and may result in corrupted
attachments saved with notmuch-show-save-part (attachment button
click handler).
Turns out, smart GNUS folks encountered the same problem and
implemented write-region wrapper which inhibits some file name
handlers. In particular, this wrapper is used in mm-save-part,
which is why notmuch-save-attachments that uses it works fine
with archives.
The patch replaces write-region with mm-write-region in
notmuch-show-save-part. Also it removes coding-system-for-write
and require-final-newline setting in notmuch-show-save-part. The
former is set in mm-write-region. The latter seems to be
unneeded because mm-save-part does not use it.
[1] http://www.gnu.org/s/emacs/manual/html_node/elisp/Magic-File-Names.html
This is the best way to make the displayed output for
decrypted/verified messages clearer. The special sigstatus and
encstatus buttons are now displayed under the part header button. The
part header button is also tweaked to provide information to user
about how to proces crypto.
We probably shouldn't have been doing this anyway, but we do it here
specifically because we don't want the content of the
application/pgp-encrypted parts to be displayed and cluttering the
message show.
The primary goal here is to keep the decrypted output as similarly
structured as undecrypted output as possible. Now, when decrypting
parts, only the original encrypted part is replaced by the it's
decrypted content. If this part isn't itself a multipart, then all
part numbering should remain consistent during decryption.
The only draw back here is that the useless application/pgp-encrypted
sub-part of the multipart/encrypted part is also emitted. But this
part can be easily ignored by clients.
Some folks have complained about the part renumbering that occurs when
the entire multipart/signed part is replaced with the part contents
after verification. This is primarily because it incurs an additional
computational cost to retrieve individual parts, since verification
has to be performed again to ensure that part numbering is consistent.
This patch simply leaves the full multipart/signed part as is.
The emacs crypto test is also updated to reflect this change.
This patch adds the tag "signed" to messages with any multipart/signed
parts, and the tag "encrypted" to messages with any
multipart/encrypted parts. This only occurs when messages are indexed
during notmuch new, so a database rebuild is required to have old
messages tagged.
A new emacs configuration variable "notmuch-crypto-process-mime"
controls the processing of PGP/MIME signatures and encrypted parts.
When this is set true, notmuch-query will use the notmuch show
--decrypt flag to decrypt encrypted messages and/or calculate the
sigstatus of signed messages. If sigstatus is available, notmuch-show
will place a specially color-coded header at the begining of the
signed message.
Also included is the ability to switch decryption/verification on/off
on the fly, which is bound to M-RET in notmuch-search-mode.
This adds support for decrypting PGP/MIME-encrypted parts to
notmuch-show and notmuch-reply. The --decrypt option implies
--verify. Once decryption (and possibly signature verification) is
done, a new part_encstatus formatter is emitted, the part_sigstatus
formatter is emitted, and the entire multipart/encrypted part is
replaced by the contents of the encrypted part.
At the moment only a json part_encstatus formatting function is
available, even though decryption is done for all formats. Emacs
support to follow.
This is primarily for notmuch-show, although the functionality is
added to show-message. Once signatures are processed a new
part_sigstatus formatter is emitted, and the entire multipart/signed
part is replaced with the contents of the signed part.
At the moment only a json part_sigstatus formatting function is
available. Emacs support to follow.
The original work for this patch was done by
Daniel Kahn Gillmor <dkg@fifthhorseman.net>
whose help with this functionality I greatly appreciate.
This adds a new "crypto" test script to the test suite to test
PGP/MIME signature verification and message decryption. Included here
is a test GNUPGHOME with a test secret key (passwordless), and test
for:
* signing/verification
* signing/verification with full owner trust
* verification with signer key unavailable
* encryption/decryption
* decryption failure with missing key
* encryption/decryption + signing/verfifying
* reply to encrypted message
* verification of signature from revoked key
These tests are not expected to pass now, but will as crypto
functionality is included.
We need to be able to test for the presence of a newline at the end of
output. There's no good way to capture trailing newlines in bash, so
redirecting output to a file is the next best thing. This new
function should be used when testing for output that is expected to
have trailing newlines.
The next commit will demonstrate the use of this.
Future improvements (eg. crypto support) will require adding new part
header. By breaking up the output of part headers from the output of
part content, we can easily out new part headers with new formatting
functions.
After the last patch to eliminate some redundant code paths in
reply_part, the reply_part_content function was only being called
once. Disolving the function and integrating its contents into the
reply_part function makes things a little simpler, and frees up some
name space that will be needed in the next patch.
The patch replaces all (message (buffer-string)) calls in emacs
tests with (princ (buffer-string)). This avoids accidentally
interpreting '%' as format specifiers and makes code simpler
because we do not need to capture stderr.
Also, the patch works around an Emacs (23.3+1-1 on current Debian
Unstable) segfault in "Ensure that emacs doesn't drop results"
test. Note: the segfault does not happen on every test run.
Though, it seems to be consistently reproducible if the test uses
300 messages instead of 30. Hopefully, it is the crash described
in Emacs bug #8545 [1] which is already fixed.
[1] http://debbugs.gnu.org/cgi/bugreport.cgi?bug=8545
Change #!/bin/bash at start of tests to "#!/usr/bin/env bash". That way
systems running on bash < 4 can prepend bash >= 4 to path before
running the tests.
Fix to check the value returned by sysconf(_SC_GETPW_R_SIZE_MAX)
before using the value.
This fixes a core dump on DragonFlyBSD where this function returns -1.
This patch adds a customization variable that controls what queries
are used to construct the all-tags section in notmuch-hello. It allows
the user to specify a function to construct the query given a tag or
a string that is used as a filter for each tag.
It also adds a variable to hide various tags from the all-tags section.
Signed-off-by: Daniel Schoepe <daniel.schoepe@googlemail.com>
The patch adds test-lib.el file for Emacs tests auxiliary stuff.
Currently, it implements two functions: `visible-buffer-string'
and `visible-buffer-substring'. These are similar to standard
counterparts without "visible-" prefix but exclude invisible
text. The functions are not used anywhere at the moment but
should be useful for testing hiding/showing in the Emacs
interface.
Edited-by: Carl Worth <cworth@cworth.org> Fixed "basic" test to ignore
new test-lib.el file.
This adds functions and variables needed for this feature to be implemented.
Once it's done, the user will be able to use a prefix argument (e.g. pressing
C-u m instead of m) and be able to select a From address.
By default the list of names/addresses to be used during completion will be
automatically generated by the settings in the notmuch configuration file. The
user can customize the notmuch-identities variable to provide an alternate list.
This is based on a previous patch by Carl Worth
(id:"87wrhfvk6a.fsf@yoom.home.cworth.org" and follow-ups).
Before the change, save-excursion was used to save the point. But the
marker saved by save-excursion was inside a region that was deleted,
so that approach is unreliable, (leading to point jumping to a new
position past the button). This patch instead saves point in an
integer variable, and when restoring, carefully avoids moving point
past the button, (in case the new button label is shorter than the old
button label).
Before the change, citation and signature wash buttons used the
same label in both visible and hidden states. Sometimes it is
very convenient when you can determine if the text is hidden or
shown without reading the context and/or clicking the button.
The patch makes it easy to see if the text is shown or hidden by
explicitly saying what the button does (shows or hides the text).
This patch adds hooks that are run before/after messages are tagged
From the emacs interface. In order to implement this and to avoid
having hooks parse all the arguments to the notmuch binary again, I
created a `notmuch-tag' function that other modules should use instead
of running (notmuch-call-notmuch-process "tag" ...) directly.
The old instructions were telling users to do "easy_install cnotmuch"
which installed some old, stale bindings. The new instructions should
be much more effective.
Manually turn off both filling and justification for the one
exceedingly-long URL which was blowing groff's mind. Also, adjust the
position of 'text' to not be at the beginning of a line so it is not
mistaken for a macro.
Ever since we added support for "notmuch search --output=tags" the
"notmuch search-tags" command has been redundant. The recent addition
of alias support makes it easy to drop the explicit search-tags
command in favor of a simple alias that runs "notmuch search
--output=tags *".
So there's no longer any documentation of the search-tags command, but
existing scripts will not break at all.
The example multipart message is made a bit more complicated by adding
a message/rfc822 message, and the all parts are output and tested in
all output formats.
The command-line interface for extracting a single part from a message
recently changed from:
notmuch part --part=X
to:
notmuch show --format=raw --part=X
Since message/rfc822 parts are really just a special kind of
multipart, we here normalize the handling of the two. This will
provide access to sub-parts of message/rfc822 parts, which was
previously unavailable.
We recently made the --part option to "notmuch show" trigger a default
format of "raw", (since the previous default of "text" is not often
useful with a single part---especially a non-text part).
Here, we update the documentation to match.
We unifed the "notmuch part" functionality into "notmuch show" where
the implementation is both simpler and more powerful. But there's no
good reason to break users of the old interface.
Add support for aliases, which are undocumented means of getting at
functionality through deprecated names. The first such alias is
"notmuch part" as implemented here.
Outputting of single MIME parts is moved to an option of notmuch show,
instead of being handled in it's own sub-command. The recent rework
of multipart mime allowed for this change but consolidating part
handling into a single recursive function (show_message_part) that
includes formatting. This allows for far simpler handling single
output of a single part, including formatting.
Simplify the function by moving part counting and formatting outside
of conditionals, thereby eliminating redundant code. This also wraps
message part output handling with proper part formatting.
We rename here in order to make do_show_single into a generic function
for handling output of just a single message, or which format=raw is a
special case. The raw case is handled by setting a new parameter,
params.raw, which is used to tell do_show_single to output a single
message as a raw file.
This is mostly in preparation for much improved part handling to
follow imminently.