From: David Bremner <david@tethera.net>
To: David Bremner <david@tethera.net>, 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 [thread overview]
Message-ID: <20210704131639.3400795-3-david@tethera.net> (raw)
In-Reply-To: <20210704131639.3400795-1-david@tethera.net>
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
next prev parent reply other threads:[~2021-07-04 13:17 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-03 20:11 [PATCH 1/2] test/crypto: test message with rfc822 attachment David Bremner
2021-07-03 20:11 ` [PATCH 2/2] test: known broken test for emacs display of message/rfc822 parts David Bremner
2021-07-04 9:24 ` Tomi Ollila
2021-07-04 13:32 ` David Bremner
2021-08-30 23:32 ` David Bremner
2021-07-04 13:16 ` WIP fixes for rfc822/attachement display David Bremner
2021-07-04 13:16 ` [PATCH 1/3] emacs: forcibly set notmuch-show-mode after delegating inlining David Bremner
2021-07-04 13:16 ` David Bremner [this message]
2021-08-30 23:37 ` [PATCH 2/3] emacs: don't inline message/rfc822 parts without content David Bremner
2021-07-04 13:16 ` [PATCH 3/3] emacs: dynamically bind gnus-newsgroup-charset David Bremner
2021-07-06 15:49 ` WIP fixes for rfc822/attachement display David Bremner
2021-07-09 0:35 ` Antoine Beaupré
2021-07-09 10:23 ` David Bremner
2021-07-09 23:36 ` Antoine Beaupré
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=20210704131639.3400795-3-david@tethera.net \
--to=david@tethera.net \
--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).