From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id aA/JFNS04WCFHQEAgWs5BA (envelope-from ) for ; Sun, 04 Jul 2021 15:17:08 +0200 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id 8M2GENS04WBsPQAAbx9fmQ (envelope-from ) for ; Sun, 04 Jul 2021 13:17:08 +0000 Received: from mail.notmuchmail.org (nmbug.tethera.net [144.217.243.247]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id E639827FC4 for ; Sun, 4 Jul 2021 15:17:07 +0200 (CEST) Received: from nmbug.tethera.net (localhost [127.0.0.1]) by mail.notmuchmail.org (Postfix) with ESMTP id CAA7729093; Sun, 4 Jul 2021 09:16:51 -0400 (EDT) Received: from fethera.tethera.net (fethera.tethera.net [IPv6:2607:5300:60:c5::1]) by mail.notmuchmail.org (Postfix) with ESMTP id 4BAC026B99 for ; Sun, 4 Jul 2021 09:16:46 -0400 (EDT) Received: by fethera.tethera.net (Postfix, from userid 1001) id 433135FD21; Sun, 4 Jul 2021 09:16:46 -0400 (EDT) Received: (nullmailer pid 3400886 invoked by uid 1000); Sun, 04 Jul 2021 13:16:43 -0000 From: David Bremner To: David Bremner , notmuch@notmuchmail.org Subject: [PATCH 2/3] emacs: don't inline message/rfc822 parts without content Date: Sun, 4 Jul 2021 10:16:38 -0300 Message-Id: <20210704131639.3400795-3-david@tethera.net> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210704131639.3400795-1-david@tethera.net> References: <20210703201131.3184165-2-david@tethera.net> <20210704131639.3400795-1-david@tethera.net> MIME-Version: 1.0 Message-ID-Hash: BJKC5XTG55SI76OLAALELEGL6PCHVLLY X-Message-ID-Hash: BJKC5XTG55SI76OLAALELEGL6PCHVLLY X-MailFrom: bremner@tethera.net X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-notmuch.notmuchmail.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header X-Mailman-Version: 3.2.1 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Help: List-Post: List-Subscribe: List-Unsubscribe: Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1625404628; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=cxdF9DsTEv3hMCk0Pd7Y/OIxCyTv9vnfvPDYCi162jg=; b=k7jklZ/EV7bdgjufI0GUkWjsEhUVVyPp9/unki1umOKK7ow8236lXAgWHBzZHhSk5usaij giwXL604Qoi4sDMhExoVCoKNoqzRnM2+zidE8riJRWTj/x7uH1y1YS9UHOnehqdGCMIotk NXoPYdCoE6CEkaqpz4O1+tmO1/mULO87bt/3Cj4s6aXLWiPdbwOQ88UwZSQjGFo8cAgcvF AHdnbH9ZIRO05G/2BW6agxQol5ajXz/sc7W1dyuSK1v37hgY7bBzm629TaqkjtosPKGoaE exoZZwnCJ3jMxu/AkdYqnQRJmYALd0JlcIvtkklZsbBOiB/gMql+yOP8BEmBeg== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1625404628; a=rsa-sha256; cv=none; b=pWO1sBaaiXJVgjeVQ9QmaLlURZiBSXTEkq9GDSn20BNYoWID0L7W8Ns9KZw9XvucJ6LN7n pdtc+IiQibLGICnxhY/8mWw5Op65we0R8usnAKxJNo5lL61CTxDgJvcxnSy1pNJ1fhnjMN d4CfXLWAiQJs00udcDxXnLIUo6IrT/cm7xKjelHb9P/YwgM+VKvxL85+qtgKdrvsjv54tC 1140y/FBA3yPy3aATNw0OqA2nVwwPPIi9l9OoKxe1aYNw8CZjauFFs7sVSnsv+jFbQ6RQJ XMBn1tI2yz7br6xUKff4EmEodFOALngOS1xFANey4/X3QtVcV3ebsvK5rjxgSQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; spf=pass (aspmx1.migadu.com: domain of notmuch-bounces@notmuchmail.org designates 144.217.243.247 as permitted sender) smtp.mailfrom=notmuch-bounces@notmuchmail.org X-Migadu-Spam-Score: -1.06 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of notmuch-bounces@notmuchmail.org designates 144.217.243.247 as permitted sender) smtp.mailfrom=notmuch-bounces@notmuchmail.org X-Migadu-Queue-Id: E639827FC4 X-Spam-Score: -1.06 X-Migadu-Scanner: scn0.migadu.com X-TUID: wQXyPIY5gI6Y This avoids some ugly error messages and exceptions, and hopes that some gnus method will display message/rfc822 parts that have only a file, no :content part. --- emacs/notmuch-show.el | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el index 9a95eb34..7695e869 100644 --- a/emacs/notmuch-show.el +++ b/emacs/notmuch-show.el @@ -718,21 +718,23 @@ will return nil if the CID is unknown or cannot be retrieved." t) (defun notmuch-show-insert-part-message/rfc822 (msg part _content-type _nth depth _button) - (let* ((message (car (plist-get part :content))) - (body (car (plist-get message :body))) - (start (point))) - ;; Override `notmuch-message-headers' to force `From' to be - ;; displayed. - (let ((notmuch-message-headers '("From" "Subject" "To" "Cc" "Date"))) - (notmuch-show-insert-headers (plist-get message :headers))) - ;; Blank line after headers to be compatible with the normal - ;; message display. - (insert "\n") - ;; Show the body - (notmuch-show-insert-bodypart msg body depth) - (when notmuch-show-indent-multipart - (indent-rigidly start (point) 1))) - t) + (let ((message (car (plist-get part :content)))) + (and + message + (let ((body (car (plist-get message :body))) + (start (point))) + ;; Override `notmuch-message-headers' to force `From' to be + ;; displayed. + (let ((notmuch-message-headers '("From" "Subject" "To" "Cc" "Date"))) + (notmuch-show-insert-headers (plist-get message :headers))) + ;; Blank line after headers to be compatible with the normal + ;; message display. + (insert "\n") + ;; Show the body + (notmuch-show-insert-bodypart msg body depth) + (when notmuch-show-indent-multipart + (indent-rigidly start (point) 1)) + t)))) (defun notmuch-show-insert-part-text/plain (msg part _content-type _nth depth button) ;; For backward compatibility we want to apply the text/plain hook -- 2.30.2