Re: [PATCH 0/4] emacs: avoid type errors due to nil as content-type

Subject: Re: [PATCH 0/4] emacs: avoid type errors due to nil as content-type

Date: Mon, 11 Jan 2021 21:52:07 +0200



From: Tomi Ollila

On Sun, Jan 10 2021, Jonas Bernoulli wrote:

> The fourth commit tries to address the issue raised in
>   The output of "notmuch show --format=sexp --format-version=4"
>   may contain `:content-type' entries with `nil' as the value,
>   when it fails to detect the correct value.  Account for that
>   in a few places where we would otherwise risk a type error.
> The other three commits cleanup the code I had to look at to do
> the above, because I just can't help myself.
> This does not apply without first applying

Perhaps this series still applies on top of that series from 2020-12-14,
but perhaps one should apply it on top of series (from 2021-01-10):

Meaning emails in range 

(also visible in

Note that messages and

have base64 -encoded content, with CRLF line endings
so those don't apply as is, but CR's from the encoded
content must be deleted.

I used a hack to do so, appended to the end of this
email; David has done something that is more robust,
and perhaps from that we could get a tool to be added
in devel/ which could do this in the future.

Both of these series applied cleanly, and I will
start using those in my emacs mua.

I like these changes and hope these can be applied soon.

>      Jonas


Usage: ./ < input.mbox > output.mbox


# -*- mode: cperl; cperl-indent-level: 4 -*-

use 5.8.1;
use strict;
use warnings;
use MIME::Base64;

while (<STDIN>) {
    print $_;
    if (/^Content-Transfer-Encoding: base64/) {
	while (<STDIN>) { print $_; last if /^\s*$/ }
	my @lines;
	while (<STDIN>) { last if /^\s*$/; push @lines, $_ }
	my $decoded = decode_base64 join('', @lines);
	$decoded =~ tr/\r//d;
	print(encode_base64 $decoded);
	print "\n"
notmuch mailing list --
To unsubscribe send an email to