unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: Jonas Bernoulli <jonas@bernoul.li>
To: notmuch@notmuchmail.org
Subject: [PATCH 3/4] emacs: notmuch-show--get-cid-content: cosmetics
Date: Sun, 10 Jan 2021 19:47:21 +0100	[thread overview]
Message-ID: <20210110184722.29294-4-jonas@bernoul.li> (raw)
In-Reply-To: <20210110184722.29294-1-jonas@bernoul.li>

---
 emacs/notmuch-show.el | 17 +++++++----------
 1 file changed, 7 insertions(+), 10 deletions(-)

diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index 21133611..8c846fb2 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -599,16 +599,13 @@ (defun notmuch-show--get-cid-content (cid)
 into the current buffer.  CID must be a raw content ID, without
 enclosing angle brackets, a cid: prefix, or URL encoding.  This
 will return nil if the CID is unknown or cannot be retrieved."
-  (let ((descriptor (cdr (assoc cid notmuch-show--cids))))
-    (when descriptor
-      (let* ((msg (car descriptor))
-	     (part (cadr descriptor))
-	     ;; Request caching for this content, as some messages
-	     ;; reference the same cid: part many times (hundreds!).
-	     (content (notmuch-get-bodypart-binary
-		       msg part notmuch-show-process-crypto 'cache))
-	     (content-type (plist-get part :content-type)))
-	(list content content-type)))))
+  (when-let ((descriptor (cdr (assoc cid notmuch-show--cids))))
+    (pcase-let ((`(,msg ,part) descriptor))
+      ;; Request caching for this content, as some messages
+      ;; reference the same cid: part many times (hundreds!).
+      (list (notmuch-get-bodypart-binary
+	     msg part notmuch-show-process-crypto 'cache)
+	    (plist-get part :content-type)))))
 
 (defun notmuch-show-setup-w3m ()
   "Instruct w3m how to retrieve content from a \"related\" part of a message."
-- 
2.30.0

  parent reply	other threads:[~2021-01-10 18:47 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-10 18:47 [PATCH 0/4] emacs: avoid type errors due to nil as content-type Jonas Bernoulli
2021-01-10 18:47 ` [PATCH 1/4] emacs: notmuch-mua-add-more-hidden-headers: use local binding Jonas Bernoulli
2021-01-10 18:47 ` [PATCH 2/4] emacs: notmuch-show--register-cids: fix names of bindings Jonas Bernoulli
2021-01-10 18:47 ` Jonas Bernoulli [this message]
2021-01-10 18:47 ` [PATCH 4/4] emacs: avoid type errors due to nil as content-type Jonas Bernoulli
2021-01-10 20:11 ` [PATCH 0/4] " David Edmondson
2021-01-10 20:47   ` Jonas Bernoulli
2021-01-11 19:52 ` Tomi Ollila
2021-01-12  9:49   ` Jonas Bernoulli
2021-01-12 14:02     ` Tomi Ollila
2021-01-15 11:39 ` David Bremner

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=20210110184722.29294-4-jonas@bernoul.li \
    --to=jonas@bernoul.li \
    --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).