Return-Path: X-Original-To: notmuch@notmuchmail.org Delivered-To: notmuch@notmuchmail.org Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id CC9A0431FD7 for ; Sat, 24 Jan 2015 13:17:15 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: 0.138 X-Spam-Level: X-Spam-Status: No, score=0.138 tagged_above=-999 required=5 tests=[DNS_FROM_AHBL_RHSBL=2.438, RCVD_IN_DNSWL_MED=-2.3] autolearn=disabled Received: from olra.theworths.org ([127.0.0.1]) by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id yHvFVbUkkY5t for ; Sat, 24 Jan 2015 13:17:12 -0800 (PST) Received: from dmz-mailsec-scanner-8.mit.edu (dmz-mailsec-scanner-8.mit.edu [18.7.68.37]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id 7B416431FAE for ; Sat, 24 Jan 2015 13:17:12 -0800 (PST) X-AuditID: 12074425-f798e6d000000d1a-a2-54c40bd7af8d Received: from mailhub-auth-2.mit.edu ( [18.7.62.36]) (using TLS with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by dmz-mailsec-scanner-8.mit.edu (Symantec Messaging Gateway) with SMTP id 9C.4B.03354.7DB04C45; Sat, 24 Jan 2015 16:17:11 -0500 (EST) Received: from outgoing.mit.edu (outgoing-auth-1.mit.edu [18.9.28.11]) by mailhub-auth-2.mit.edu (8.13.8/8.9.2) with ESMTP id t0OLH9L7000698; Sat, 24 Jan 2015 16:17:09 -0500 Received: from drake (216-15-114-40.c3-0.arl-ubr1.sbo-arl.ma.cable.rcn.com [216.15.114.40]) (authenticated bits=0) (User authenticated as amdragon@ATHENA.MIT.EDU) by outgoing.mit.edu (8.13.8/8.12.4) with ESMTP id t0OLH6L1007458 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NOT); Sat, 24 Jan 2015 16:17:07 -0500 Received: from amthrax by drake with local (Exim 4.84) (envelope-from ) id 1YF84n-0005Rj-MN; Sat, 24 Jan 2015 16:17:05 -0500 From: Austin Clements To: notmuch@notmuchmail.org Subject: [PATCH v2 6/8] emacs: Use generalized content caching in w3m CID code Date: Sat, 24 Jan 2015 16:17:01 -0500 Message-Id: <1422134223-20739-7-git-send-email-amdragon@mit.edu> X-Mailer: git-send-email 2.1.3 In-Reply-To: <1422134223-20739-1-git-send-email-amdragon@mit.edu> References: <1422134223-20739-1-git-send-email-amdragon@mit.edu> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrFIsWRmVeSWpSXmKPExsUixG6nonud+0iIwZZHGhY3WrsZLfbd2cJk sXouj8X1mzOZLd6snMfqwOqx6/lfJo+ds+6yexz+upDF49mqW8weWw69Zw5gjeKySUnNySxL LdK3S+DK2LzzBmvBVcGKt58uMTUwLuLrYuTkkBAwkTi8YDsbhC0mceHeeiCbi0NIYDGTxOn5 O5ghnI2MEu/+N0M5F5kkHsy/yg7hTGKU+P39LCtIP5uAhsTvW4uZQGwRAWmJnXdng8WZBeok /s45zwhiCwv4SSzr/8QOYrMIqErcnncUrIZXwEFi+5HzQLs5gO6Qk9i6zhskzCngKHFjwy4W EFsIqKT7cyPbBEb+BYwMqxhlU3KrdHMTM3OKU5N1i5MT8/JSi3Qt9HIzS/RSU0o3MYKD0EV1 B+OEQ0qHGAU4GJV4eH/8OxQixJpYVlyZe4hRkoNJSZR31a/DIUJ8SfkplRmJxRnxRaU5qcWH GCU4mJVEeC9sAMrxpiRWVqUW5cOkpDlYlMR5N/3gCxESSE8sSc1OTS1ILYLJynBwKEnwLuY6 EiIkWJSanlqRlplTgpBm4uAEGc4DNPwkSA1vcUFibnFmOkT+FKOilDjvepCEAEgiozQPrheW JF4xigO9Isy7D6SKB5hg4LpfAQ1mAhpcsP0AyOCSRISUVAPj9sUL7m+cWNp8MWpudN2CA3cf P/mhe6lbc4MNq3q8/cXbdRft20uufJrpc7V6zjYN9tLPud3Cy52FPqcLMun7Htqs4Ftd1Dpz cvBc4+C/F722MbjZT4i3UJs4e+m/4u43RzdGF+ZNDgtpcuEWW9DULzpx8pVf8aXZuW9mX+L+ fa93u/2iK6rsSizFGYmGWsxFxYkABjHC4O0CAAA= Cc: tomi.ollila@iki.fi X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Jan 2015 21:17:16 -0000 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 f29428a..11eac5f 100644 --- a/emacs/notmuch-show.el +++ b/emacs/notmuch-show.el @@ -562,15 +562,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 @@ -578,18 +577,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))) -- 2.1.3