mirror of
https://git.notmuchmail.org/git/notmuch
synced 2024-12-23 01:44:52 +01:00
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'.
This commit is contained in:
parent
3687418526
commit
b0b5ced82b
1 changed files with 8 additions and 15 deletions
|
@ -562,15 +562,14 @@ message at DEPTH in the current thread."
|
||||||
(defvar notmuch-show-w3m-cid-store nil)
|
(defvar notmuch-show-w3m-cid-store nil)
|
||||||
(make-variable-buffer-local 'notmuch-show-w3m-cid-store)
|
(make-variable-buffer-local 'notmuch-show-w3m-cid-store)
|
||||||
|
|
||||||
(defun notmuch-show-w3m-cid-store-internal (content-id msg part content)
|
(defun notmuch-show-w3m-cid-store-internal (content-id msg part)
|
||||||
(push (list content-id msg part content)
|
(push (list content-id msg part) notmuch-show-w3m-cid-store))
|
||||||
notmuch-show-w3m-cid-store))
|
|
||||||
|
|
||||||
(defun notmuch-show-w3m-cid-store (msg part)
|
(defun notmuch-show-w3m-cid-store (msg part)
|
||||||
(let ((content-id (plist-get part :content-id)))
|
(let ((content-id (plist-get part :content-id)))
|
||||||
(when content-id
|
(when content-id
|
||||||
(notmuch-show-w3m-cid-store-internal (concat "cid:" 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)
|
(defun notmuch-show-w3m-cid-retrieve (url &rest args)
|
||||||
(let ((matching-part (with-current-buffer w3m-current-buffer
|
(let ((matching-part (with-current-buffer w3m-current-buffer
|
||||||
|
@ -578,18 +577,12 @@ message at DEPTH in the current thread."
|
||||||
(if matching-part
|
(if matching-part
|
||||||
(let* ((msg (nth 1 matching-part))
|
(let* ((msg (nth 1 matching-part))
|
||||||
(part (nth 2 matching-part))
|
(part (nth 2 matching-part))
|
||||||
(content (nth 3 matching-part))
|
|
||||||
(content-type (plist-get part :content-type)))
|
(content-type (plist-get part :content-type)))
|
||||||
;; If we don't already have the content, get it and cache
|
;; Request content caching, as some messages reference the
|
||||||
;; it, as some messages reference the same cid: part many
|
;; same cid: part many times (hundreds!), which results in
|
||||||
;; times (hundreds!), which results in many calls to
|
;; many calls to `notmuch show'.
|
||||||
;; `notmuch part'.
|
(insert (notmuch-get-bodypart-binary
|
||||||
(unless content
|
msg part notmuch-show-process-crypto 'cache))
|
||||||
(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)
|
|
||||||
content-type)
|
content-type)
|
||||||
nil)))
|
nil)))
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue