From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms12 with LMTPS id cKdFL+DTul80LgAAsNZ9tg (envelope-from ) for ; Sun, 22 Nov 2020 21:10:56 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id H0rsKuDTul/bZgAAbx9fmQ (envelope-from ) for ; Sun, 22 Nov 2020 21:10:56 +0000 Received: from pb-smtp20.pobox.com (pb-smtp20.pobox.com [173.228.157.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id D54809403EC for ; Sun, 22 Nov 2020 21:10:55 +0000 (UTC) Received: from pb-smtp20.pobox.com (unknown [127.0.0.1]) by pb-smtp20.pobox.com (Postfix) with ESMTP id A33DF100962 for ; Sun, 22 Nov 2020 16:10:53 -0500 (EST) (envelope-from kyle@kyleam.com) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=pobox.com; h=from:to :subject:in-reply-to:references:date:message-id:mime-version :content-type; s=sasl; bh=WOe0hsY2unFJ7aU/I4JCNGJEQwY=; b=wq0zyy yNJ8fDV7aJaIhMKl8leOfCRjBNV1iP6sXrzMqdSNtApmAZKR6Ti8E5VtZ3uJKfwc MUUeBp1F7Z1p/UPfbIYe9XVt3XHmMgJ7prrpfDdvG18fKtzr62CotEQsqFv09l+/ RQY2cC0Uvzp8PXi/lvX4sAbaB56GXhWWwMjJ0= Received: from pb-smtp20.sea.icgroup.com (unknown [127.0.0.1]) by pb-smtp20.pobox.com (Postfix) with ESMTP id 9BB22100961 for ; Sun, 22 Nov 2020 16:10:53 -0500 (EST) (envelope-from kyle@kyleam.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed; d=kyleam.com; h=from:to:subject:in-reply-to:references:date:message-id:mime-version:content-type; s=mesmtp; bh=zzQgElrHY+Gt/VEXW4Pi4MR/8GyP2rDJb4/NWg1RiFE=; b=y6WY6d9nFRnhqslh3QktINRILXeZNoqpnDf6ezLk8lMQD4ar7DSv42cPuou1lC4AgdFvrjjhWhEKm0WPZFtx7XqHyh6VJfiVx1ijvDrsyBScU99o9WuzqxJ9Bnhs730NigL9vKngq0kWLMHso/+eU5IaAyMyPjeCEZMXGyX9WTk= Received: from localhost (unknown [45.33.91.115]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by pb-smtp20.pobox.com (Postfix) with ESMTPSA id 1A4E3100960 for ; Sun, 22 Nov 2020 16:10:51 -0500 (EST) (envelope-from kyle@kyleam.com) From: Kyle Meyer To: piem@inbox.kyleam.com Subject: Re: [PATCH 4/4] gnus, notmuch: Consider text/plain patch attachments In-Reply-To: <20201122204609.12604-5-kyle@kyleam.com> References: <20201122204609.12604-1-kyle@kyleam.com> <20201122204609.12604-5-kyle@kyleam.com> Date: Sun, 22 Nov 2020 16:10:49 -0500 Message-ID: <87k0udumg6.fsf@kyleam.com> MIME-Version: 1.0 Content-Type: text/plain X-Pobox-Relay-ID: 3328ACEA-2D07-11EB-8F4B-E43E2BB96649-24757444!pb-smtp20.pobox.com X-Scanner: ns3122888.ip-94-23-21.eu Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=pobox.com header.s=sasl header.b=wq0zyy y; dkim=pass header.d=kyleam.com header.s=mesmtp header.b=y6WY6d9n; dmarc=none; spf=pass (aspmx1.migadu.com: domain of kyle@kyleam.com designates 173.228.157.52 as permitted sender) smtp.mailfrom=kyle@kyleam.com X-Spam-Score: -1.00 X-TUID: QR+ZXVPh4i24 Kyle Meyer writes: > -(defun piem-am-patch-attachment-p (type) > +(defun piem-am-patch-attachment-p (type filename) > "Return non-nil if an attachment should be treated as a patch. > -TYPE is a media type such as \"text/x-patch\"." > - (member type '("text/x-diff" "text/x-patch"))) > +TYPE is a media type such as \"text/x-patch\". FILENAME is the > +attachment file name, if any." > + (or (member type '("text/x-diff" "text/x-patch")) > + (and filename > + (equal type "text/plain") > + (string-match-p "\\.patch\\'" filename)))) Oops, the indentation is off here. Will squash this in. diff --git a/piem.el b/piem.el index bee17c0..cf43503 100644 --- a/piem.el +++ b/piem.el @@ -565,7 +565,7 @@ (defun piem-am-patch-attachment-p (type filename) "Return non-nil if an attachment should be treated as a patch. TYPE is a media type such as \"text/x-patch\". FILENAME is the attachment file name, if any." - (or (member type '("text/x-diff" "text/x-patch")) + (or (member type '("text/x-diff" "text/x-patch")) (and filename (equal type "text/plain") (string-match-p "\\.patch\\'" filename))))