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 A52246DE0297 for ; Thu, 13 Oct 2016 13:14:29 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at cworth.org X-Spam-Flag: NO X-Spam-Score: -0.323 X-Spam-Level: X-Spam-Status: No, score=-0.323 tagged_above=-999 required=5 tests=[AWL=-0.012, 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 qS4ONxk5Tq9P for ; Thu, 13 Oct 2016 13:14:28 -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 4EFCC6DE02DA for ; Thu, 13 Oct 2016 13:14:28 -0700 (PDT) Received: by mail-pa0-f66.google.com with SMTP id qn10so5177936pac.2 for ; Thu, 13 Oct 2016 13:14:28 -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=diRV/Mq2YKBVBxUMZJRZBhPoxJa4SaAew9L5ER81zG0RnMFFXtVNVnHxkPp/qB1GDE QT1IIjtX/3OJwtcXfXarssC6azFXDSItiG3hADMtgwoQhvpg1iWFHRMOE/oiiEaGwt5Y HRAIs6IFptEuxra9RsM+Tbs3KhTOePaccmKpa9rdP7krUtdu7ln3H42JlQusqj8dunWK W1gLhhpDR1n011B4Fu9mBO7q4M782RbqZBZ8FQb4LqN0gMBoFz2c/cx1+SDHmIVMsGhg 89y0KqViYZ1WL3qPcFfqCt03GfwJu2Zec5NNGB68L0xmT7dVYOAm8MG/NU/VH/HhYj9U g64Q== 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=hmR5iUI4vXsrRnk3/PJt9IokquE93G9l7f70CFR+yuxQvVDZzrhsynZaCsb1PlsEJz l6UtTpUA+Iub8M3aNj8Z8Qt6K1QWAIverLw1xB7ZekpRN14GN4Ni/9FGJEm93O3y3eLL EJezBrnGjxlRjmtb9DL/i1m/QUhDwHCyKwgv0DFTYLQVzw60CVAtxOepvipJnO3PdA6V uR8lrth47tYf/vleEtRGkecNST/PPjiq7yaiT7Cen4AbVJo9MAq52xLJpGK5JfulMHwe 1CBNoKQhEcoRtGZAI0DxUY05ubm/6qRaqP18il9oCF2Z0243QV0wY5/4yodxd4tNWZyC edrg== X-Gm-Message-State: AA6/9RmyWcUXXLwRNSqQlXaXhmgqFfW4iTKiQG+mSEDVxoJjiYS5PAwAAmO1VpIWE2+ZIQ== X-Received: by 10.66.172.12 with SMTP id ay12mr10803241pac.180.1476389668016; Thu, 13 Oct 2016 13:14:28 -0700 (PDT) Received: from localhost ([204.121.136.153]) by smtp.gmail.com with ESMTPSA id j63sm21665375pfg.32.2016.10.13.13.14.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 13 Oct 2016 13:14:26 -0700 (PDT) From: Nick Howell 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 Message-Id: <1476389636-10383-4-git-send-email-nlhowell@gmail.com> X-Mailer: git-send-email 2.7.3 In-Reply-To: <1476389636-10383-1-git-send-email-nlhowell@gmail.com> References: <57ffd0251b0a4_6fed5783cdf@mercury.notmuch> <1476389636-10383-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:14:29 -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