aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAustin Clements <amdragon@mit.edu>2015-01-24 16:17:01 -0500
committerDavid Bremner <david@tethera.net>2015-01-25 18:39:13 +0100
commitb0b5ced82b0a8cca2bbbe7b8b8c887c68b5afff0 (patch)
tree65363f4b6bc48ec62ca951434cf860aac7850567
parent3687418526b155668578c1d70ccd6d9b63de2200 (diff)
emacs: Use generalized content caching in w3m CID code
Previously this did its own caching, but this is now supported by more generally by `notmuch-get-bodypart-binary'.
-rw-r--r--emacs/notmuch-show.el23
1 files changed, 8 insertions, 15 deletions
diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index f29428ad..11eac5f0 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -562,15 +562,14 @@ message at DEPTH in the current thread."
(defvar notmuch-show-w3m-cid-store nil)
(make-variable-buffer-local 'notmuch-show-w3m-cid-store)
-(defun notmuch-show-w3m-cid-store-internal (content-id msg part content)
- (push (list content-id msg part content)
- notmuch-show-w3m-cid-store))
+(defun notmuch-show-w3m-cid-store-internal (content-id msg part)
+ (push (list content-id msg part) notmuch-show-w3m-cid-store))
(defun notmuch-show-w3m-cid-store (msg part)
(let ((content-id (plist-get part :content-id)))
(when content-id
(notmuch-show-w3m-cid-store-internal (concat "cid:" content-id)
- msg part nil))))
+ msg part))))
(defun notmuch-show-w3m-cid-retrieve (url &rest args)
(let ((matching-part (with-current-buffer w3m-current-buffer
@@ -578,18 +577,12 @@ message at DEPTH in the current thread."
(if matching-part
(let* ((msg (nth 1 matching-part))
(part (nth 2 matching-part))
- (content (nth 3 matching-part))
(content-type (plist-get part :content-type)))
- ;; If we don't already have the content, get it and cache
- ;; it, as some messages reference the same cid: part many
- ;; times (hundreds!), which results in many calls to
- ;; `notmuch part'.
- (unless content
- (setq content (notmuch-get-bodypart-binary
- msg part notmuch-show-process-crypto))
- (with-current-buffer w3m-current-buffer
- (notmuch-show-w3m-cid-store-internal url msg part content)))
- (insert content)
+ ;; Request content caching, as some messages reference the
+ ;; same cid: part many times (hundreds!), which results in
+ ;; many calls to `notmuch show'.
+ (insert (notmuch-get-bodypart-binary
+ msg part notmuch-show-process-crypto 'cache))
content-type)
nil)))