From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by arlo.cworth.org (Postfix) with ESMTP id 34C836DE02AC for ; Thu, 13 Oct 2016 13:48:36 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at cworth.org X-Spam-Flag: NO X-Spam-Score: -0.319 X-Spam-Level: X-Spam-Status: No, score=-0.319 tagged_above=-999 required=5 tests=[AWL=-0.008, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.211, SPF_PASS=-0.001] autolearn=disabled Received: from arlo.cworth.org ([127.0.0.1]) by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 2knYURZkV4d9 for ; Thu, 13 Oct 2016 13:48:35 -0700 (PDT) Received: from mail-pa0-f66.google.com (mail-pa0-f66.google.com [209.85.220.66]) by arlo.cworth.org (Postfix) with ESMTPS id ACE906DE0297 for ; Thu, 13 Oct 2016 13:48:35 -0700 (PDT) Received: by mail-pa0-f66.google.com with SMTP id hh10so5219912pac.0 for ; Thu, 13 Oct 2016 13:48:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=oOKhpfWWK1JomqMyKyI9Zr5EScrPHgl5AsvGZ6aYuCU=; b=fWH8aTYwR/pjNN9eW3SFSnIzUSd6E5HejQfA3zOhVpjiA7h9yC5ngFngW2cvLSWZl7 Yo3vCUqqUvhQ5at2cNebNx3w+Lv9OPyGfQ3e4mx+06hp5aKB0xQDWTfhTPjI8QBDu2Vn PVJ/WfksGLs62ggM+hyocrhDMLiV7z8kJtc4EwWL3gI/DC7L7aZytzfoL33GYe8trkpH cHxJMxGAZCwIHxdSjm2RW2+PGBY4rGXgWA5MjXVEWeoKMTu3bqS+pOhRCaHq2je9ZZQe 8AjbD9hyg3IIxjMjJB3BO8g8ujj9pXU5ikd7Z8m48OGjiPxXDkkNVvgBZSxTXY8CnviS 88CQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=oOKhpfWWK1JomqMyKyI9Zr5EScrPHgl5AsvGZ6aYuCU=; b=JYdwsU9inE4FJ+hDTkLhZv5ea+g3Ov//XYCM+KfXPF4xZKdWAoNSXxIPiJ9xeKeqKs FoH/lET8bKkiuTTQLVR0jHxbegs3i+G/jM257u92J/LITqqgdfk22D4eQPmyr/IsG4JN bj7PeD44jEjEtRybaZyonwjwZW0SLAJI98+ooA3/IdOowPfWsD+EW9B569QLJWUecaxk tStLalff5kpl/cTYhzoDm21zQJokuNavk/aQdmKAZdvCjHG+bxvvRGtGMjHowvxJuXKy XDlB06UvBpL2KU6u2p2LnMFgv18IbsranrACAjaBJQnA9lw/mjSYVvWE+epF3zUCILTV GRWQ== X-Gm-Message-State: AA6/9RmLkHsya2I0XWyfeKQiGT1gH9sbtApdgvhccED4R/M0PLaeVQw+7gmsKRAH5peXQw== X-Received: by 10.67.30.170 with SMTP id kf10mr10612687pad.81.1476391715343; Thu, 13 Oct 2016 13:48:35 -0700 (PDT) Received: from localhost ([204.121.136.153]) by smtp.gmail.com with ESMTPSA id x1sm21757426pay.41.2016.10.13.13.48.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 13 Oct 2016 13:48:34 -0700 (PDT) From: Nick Howell To: notmuch@notmuchmail.org Cc: nlhowell@gmail.com Subject: [RFC PATCHv2 3/8] vim: mailcap: gracefully handle missing mimetype Date: Thu, 13 Oct 2016 14:47:51 -0600 Message-Id: <1476391676-14542-4-git-send-email-nlhowell@gmail.com> X-Mailer: git-send-email 2.7.3 In-Reply-To: <1476391676-14542-1-git-send-email-nlhowell@gmail.com> References: <1476389636-10383-1-git-send-email-nlhowell@gmail.com> <1476391676-14542-1-git-send-email-nlhowell@gmail.com> X-Mailman-Approved-At: Thu, 13 Oct 2016 23:10:02 -0700 X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 13 Oct 2016 20:48:36 -0000 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