From: Nick Howell <nlhowell@gmail.com>
To: notmuch@notmuchmail.org
Cc: nlhowell@gmail.com
Subject: [RFC PATCH 3/7] vim: mailcap: gracefully handle missing mimetype
Date: Thu, 13 Oct 2016 14:13:52 -0600 [thread overview]
Message-ID: <1476389636-10383-4-git-send-email-nlhowell@gmail.com> (raw)
In-Reply-To: <1476389636-10383-1-git-send-email-nlhowell@gmail.com>
Some plaintext messages do not specify a mimetype. Instead of failing in
this situation, just assume the part is plaintext. (Maybe a better
strategy would be to check if the message contains non-unicode first?)
---
vim/notmuch.vim | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/vim/notmuch.vim b/vim/notmuch.vim
index 947fec0..89fa2dc 100644
--- a/vim/notmuch.vim
+++ b/vim/notmuch.vim
@@ -345,9 +345,9 @@ ruby << EOF
end
parts.each do |part|
- b << "--- %s ---" % part.mime_type
+ b << "--- %s ---" % ( [part.mime_type || "unknown", part.filename].find_all { |x| x }.join(" ") )
begin
- IO.popen(mailcap % part.mime_type, "r+b") do |io|
+ IO.popen(mailcap % (part.mime_type || "text/plain"), "r+b") do |io|
io.write(part.decoded)
io.close_write
io.each_line do |l|
--
2.7.3
next prev parent reply other threads:[~2016-10-13 20:14 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-29 15:21 Status of Vim client J. Lewis Muir
2016-09-29 17:52 ` Lucas Hoffmann
2016-09-29 18:52 ` David Bremner
2016-10-08 0:08 ` Nick Howell
2016-10-11 0:39 ` Nick Howell
2016-10-13 17:18 ` David Bremner
2016-10-13 18:19 ` nlhowell
2016-10-13 19:58 ` [RFC PATCH 0/2] vim: add "attach" support to compose Nick Howell
2016-10-13 19:58 ` [RFC PATCH 1/2] vim: compose: support additional Notmuch- filters Nick Howell
2016-10-13 19:58 ` [RFC PATCH 2/2] vim: compose: attachment support Nick Howell
2016-10-13 20:13 ` [RFC PATCH 0/7] vim: add mailcap filtering to show Nick Howell
2016-10-13 20:13 ` [RFC PATCH 1/7] vim: show: add mailcap filtering Nick Howell
2016-10-13 20:13 ` [RFC PATCH 2/7] vim: mailcap: forbid access to display server Nick Howell
2016-10-13 20:13 ` Nick Howell [this message]
2016-10-13 20:13 ` [RFC PATCH 4/7] vim: mailcap: don't corrupt the view if filters write to stderr Nick Howell
2016-10-13 20:13 ` [RFC PATCH 5/7] vim: mailcap: redraw after processing Nick Howell
2016-10-13 20:13 ` [RFC PATCH 6/7] vim: mailcap: show all alternatives if none preferred Nick Howell
2016-10-13 20:13 ` [RFC PATCH 7/7] vim: mailcap: handle mailcap failure gracefully Nick Howell
2016-10-13 20:47 ` [RFC PATCHv2 0/8] vim: add mailcap filtering to show Nick Howell
2016-10-13 20:47 ` [RFC PATCHv2 1/8] vim: show: add mailcap filtering Nick Howell
2016-10-13 20:47 ` [RFC PATCHv2 2/8] vim: mailcap: forbid access to display server Nick Howell
2016-10-13 20:47 ` [RFC PATCHv2 3/8] vim: mailcap: gracefully handle missing mimetype Nick Howell
2016-10-13 20:47 ` [RFC PATCHv2 4/8] vim: mailcap: don't corrupt the view if filters write to stderr Nick Howell
2016-10-13 20:47 ` [RFC PATCHv2 5/8] vim: mailcap: redraw after processing Nick Howell
2016-10-13 20:47 ` [RFC PATCHv2 6/8] vim: show: add multipart/alternative picking Nick Howell
2016-10-13 20:47 ` [RFC PATCHv2 7/8] vim: mailcap: show all alternatives if none preferred Nick Howell
2016-10-13 20:47 ` [RFC PATCHv2 8/8] vim: mailcap: handle mailcap failure gracefully Nick Howell
2016-10-13 20:42 ` Status of Vim client David Bremner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://notmuchmail.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1476389636-10383-4-git-send-email-nlhowell@gmail.com \
--to=nlhowell@gmail.com \
--cc=notmuch@notmuchmail.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://yhetil.org/notmuch.git/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).