unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: Austin Clements <amdragon@MIT.EDU>
To: notmuch@notmuchmail.org
Subject: [PATCH 09/11] emacs: Use generalized content caching in w3m CID code
Date: Mon, 21 Apr 2014 14:37:46 -0400	[thread overview]
Message-ID: <1398105468-14317-10-git-send-email-amdragon@mit.edu> (raw)
In-Reply-To: <1398105468-14317-1-git-send-email-amdragon@mit.edu>

Previously this did its own caching, but this is now supported by more
generally by `notmuch-get-bodypart-binary'.
---
 emacs/notmuch-show.el | 23 ++++++++---------------
 1 file changed, 8 insertions(+), 15 deletions(-)

diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index 537c558..9411c9a 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -540,15 +540,14 @@ (defvar w3m-current-buffer) ;; From `w3m.el'.
 (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
@@ -556,18 +555,12 @@ (defun notmuch-show-w3m-cid-retrieve (url &rest args)
     (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)))
 
-- 
1.9.1

  parent reply	other threads:[~2014-04-21 18:38 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-21 18:37 [PATCH 00/11] Improve charset and cid: handling Austin Clements
2014-04-21 18:37 ` [PATCH 01/11] emacs: Remove redundant NTH argument from `notmuch-get-bodypart-content' Austin Clements
2014-07-10  9:46   ` David Bremner
2014-04-21 18:37 ` [PATCH 02/11] test: New tests for Emacs charset handling Austin Clements
2014-04-24 14:38   ` Mark Walters
2014-04-24 18:29     ` Austin Clements
2014-04-25  6:18       ` Mark Walters
2014-04-25 13:57       ` Tomi Ollila
2014-04-21 18:37 ` [PATCH 03/11] emacs: Fix coding system in `notmuch-show-view-raw-message' Austin Clements
2014-07-10  9:48   ` David Bremner
2014-09-23 17:59   ` David Bremner
2014-04-21 18:37 ` [PATCH 04/11] emacs: Track full message and part descriptor in w3m CID store Austin Clements
2014-07-10  9:52   ` David Bremner
2015-01-24 16:45     ` Austin Clements
2014-04-21 18:37 ` [PATCH 05/11] emacs: Create an API for fetching parts as undecoded binary Austin Clements
2014-04-21 18:37 ` [PATCH 06/11] emacs: Remove broken `notmuch-get-bodypart-content' API Austin Clements
2014-07-11 11:48   ` David Bremner
2015-01-24 17:10     ` Austin Clements
2014-04-21 18:37 ` [PATCH 07/11] emacs: Return unibyte strings for binary part data Austin Clements
2014-04-21 18:37 ` [PATCH 08/11] emacs: Support caching in notmuch-get-bodypart-{binary, text} Austin Clements
2014-04-24 10:46   ` Mark Walters
2014-04-24 18:12     ` Austin Clements
2014-04-25  6:42       ` Mark Walters
2015-01-24 18:06         ` Austin Clements
2014-04-21 18:37 ` Austin Clements [this message]
2014-04-21 18:37 ` [PATCH 10/11] emacs: Rewrite content ID handling Austin Clements
2014-04-21 18:37 ` [PATCH 11/11] emacs: Support cid: references with shr renderer Austin Clements
2014-05-01  9:20   ` David Edmondson
2015-01-24 17:12     ` Austin Clements
2014-04-21 20:26 ` [PATCH 00/11] Improve charset and cid: handling Tomi Ollila
2014-04-26 10:50 ` Mark Walters
2015-01-24 17:29   ` Austin Clements

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=1398105468-14317-10-git-send-email-amdragon@mit.edu \
    --to=amdragon@mit.edu \
    --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).