[PATCH v2 6/8] emacs: Use generalized content caching in w3m CID code
authorAustin Clements <amdragon@mit.edu>
Sat, 24 Jan 2015 21:17:01 +0000 (16:17 +1900)
committerW. Trevor King <wking@tremily.us>
Sat, 20 Aug 2016 21:47:49 +0000 (14:47 -0700)
dd/ae63ae55b09beef6b00d2f70f6ef3d257ce316 [new file with mode: 0644]

diff --git a/dd/ae63ae55b09beef6b00d2f70f6ef3d257ce316 b/dd/ae63ae55b09beef6b00d2f70f6ef3d257ce316
new file mode 100644 (file)
index 0000000..a93c0ab
--- /dev/null
@@ -0,0 +1,134 @@
+Return-Path: <amdragon@mit.edu>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+       by olra.theworths.org (Postfix) with ESMTP id CC9A0431FD7\r
+       for <notmuch@notmuchmail.org>; Sat, 24 Jan 2015 13:17:15 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: 0.138\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=0.138 tagged_above=-999 required=5\r
+       tests=[DNS_FROM_AHBL_RHSBL=2.438, RCVD_IN_DNSWL_MED=-2.3]\r
+       autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+       by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+       with ESMTP id yHvFVbUkkY5t for <notmuch@notmuchmail.org>;\r
+       Sat, 24 Jan 2015 13:17:12 -0800 (PST)\r
+Received: from dmz-mailsec-scanner-8.mit.edu (dmz-mailsec-scanner-8.mit.edu\r
+       [18.7.68.37])\r
+       (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))\r
+       (No client certificate requested)\r
+       by olra.theworths.org (Postfix) with ESMTPS id 7B416431FAE\r
+       for <notmuch@notmuchmail.org>; Sat, 24 Jan 2015 13:17:12 -0800 (PST)\r
+X-AuditID: 12074425-f798e6d000000d1a-a2-54c40bd7af8d\r
+Received: from mailhub-auth-2.mit.edu ( [18.7.62.36])\r
+       (using TLS with cipher DHE-RSA-AES256-SHA (256/256 bits))\r
+       (Client did not present a certificate)\r
+       by dmz-mailsec-scanner-8.mit.edu (Symantec Messaging Gateway) with SMTP\r
+       id 9C.4B.03354.7DB04C45; Sat, 24 Jan 2015 16:17:11 -0500 (EST)\r
+Received: from outgoing.mit.edu (outgoing-auth-1.mit.edu [18.9.28.11])\r
+       by mailhub-auth-2.mit.edu (8.13.8/8.9.2) with ESMTP id t0OLH9L7000698; \r
+       Sat, 24 Jan 2015 16:17:09 -0500\r
+Received: from drake (216-15-114-40.c3-0.arl-ubr1.sbo-arl.ma.cable.rcn.com\r
+       [216.15.114.40]) (authenticated bits=0)\r
+       (User authenticated as amdragon@ATHENA.MIT.EDU)\r
+       by outgoing.mit.edu (8.13.8/8.12.4) with ESMTP id t0OLH6L1007458\r
+       (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NOT);\r
+       Sat, 24 Jan 2015 16:17:07 -0500\r
+Received: from amthrax by drake with local (Exim 4.84)\r
+       (envelope-from <amdragon@mit.edu>)\r
+       id 1YF84n-0005Rj-MN; Sat, 24 Jan 2015 16:17:05 -0500\r
+From: Austin Clements <amdragon@mit.edu>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH v2 6/8] emacs: Use generalized content caching in w3m CID code\r
+Date: Sat, 24 Jan 2015 16:17:01 -0500\r
+Message-Id: <1422134223-20739-7-git-send-email-amdragon@mit.edu>\r
+X-Mailer: git-send-email 2.1.3\r
+In-Reply-To: <1422134223-20739-1-git-send-email-amdragon@mit.edu>\r
+References: <1422134223-20739-1-git-send-email-amdragon@mit.edu>\r
+X-Brightmail-Tracker:\r
+ H4sIAAAAAAAAA+NgFrrFIsWRmVeSWpSXmKPExsUixG6nonud+0iIwZZHGhY3WrsZLfbd2cJk\r
+       sXouj8X1mzOZLd6snMfqwOqx6/lfJo+ds+6yexz+upDF49mqW8weWw69Zw5gjeKySUnNySxL\r
+       LdK3S+DK2LzzBmvBVcGKt58uMTUwLuLrYuTkkBAwkTi8YDsbhC0mceHeeiCbi0NIYDGTxOn5\r
+       O5ghnI2MEu/+N0M5F5kkHsy/yg7hTGKU+P39LCtIP5uAhsTvW4uZQGwRAWmJnXdng8WZBeok\r
+       /s45zwhiCwv4SSzr/8QOYrMIqErcnncUrIZXwEFi+5HzQLs5gO6Qk9i6zhskzCngKHFjwy4W\r
+       EFsIqKT7cyPbBEb+BYwMqxhlU3KrdHMTM3OKU5N1i5MT8/JSi3Qt9HIzS/RSU0o3MYKD0EV1\r
+       B+OEQ0qHGAU4GJV4eH/8OxQixJpYVlyZe4hRkoNJSZR31a/DIUJ8SfkplRmJxRnxRaU5qcWH\r
+       GCU4mJVEeC9sAMrxpiRWVqUW5cOkpDlYlMR5N/3gCxESSE8sSc1OTS1ILYLJynBwKEnwLuY6\r
+       EiIkWJSanlqRlplTgpBm4uAEGc4DNPwkSA1vcUFibnFmOkT+FKOilDjvepCEAEgiozQPrheW\r
+       JF4xigO9Isy7D6SKB5hg4LpfAQ1mAhpcsP0AyOCSRISUVAPj9sUL7m+cWNp8MWpudN2CA3cf\r
+       P/mhe6lbc4MNq3q8/cXbdRft20uufJrpc7V6zjYN9tLPud3Cy52FPqcLMun7Htqs4Ftd1Dpz\r
+       cvBc4+C/F722MbjZT4i3UJs4e+m/4u43RzdGF+ZNDgtpcuEWW9DULzpx8pVf8aXZuW9mX+L+\r
+       fa93u/2iK6rsSizFGYmGWsxFxYkABjHC4O0CAAA=\r
+Cc: tomi.ollila@iki.fi\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+       <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Sat, 24 Jan 2015 21:17:16 -0000\r
+\r
+Previously this did its own caching, but this is now supported by more\r
+generally by `notmuch-get-bodypart-binary'.\r
+---\r
+ emacs/notmuch-show.el | 23 ++++++++---------------\r
+ 1 file changed, 8 insertions(+), 15 deletions(-)\r
+\r
+diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el\r
+index f29428a..11eac5f 100644\r
+--- a/emacs/notmuch-show.el\r
++++ b/emacs/notmuch-show.el\r
+@@ -562,15 +562,14 @@ (defvar w3m-current-buffer) ;; From `w3m.el'.\r
+ (defvar notmuch-show-w3m-cid-store nil)\r
+ (make-variable-buffer-local 'notmuch-show-w3m-cid-store)\r
\r
+-(defun notmuch-show-w3m-cid-store-internal (content-id msg part content)\r
+-  (push (list content-id msg part content)\r
+-      notmuch-show-w3m-cid-store))\r
++(defun notmuch-show-w3m-cid-store-internal (content-id msg part)\r
++  (push (list content-id msg part) notmuch-show-w3m-cid-store))\r
\r
+ (defun notmuch-show-w3m-cid-store (msg part)\r
+   (let ((content-id (plist-get part :content-id)))\r
+     (when content-id\r
+       (notmuch-show-w3m-cid-store-internal (concat "cid:" content-id)\r
+-                                         msg part nil))))\r
++                                         msg part))))\r
\r
+ (defun notmuch-show-w3m-cid-retrieve (url &rest args)\r
+   (let ((matching-part (with-current-buffer w3m-current-buffer\r
+@@ -578,18 +577,12 @@ (defun notmuch-show-w3m-cid-retrieve (url &rest args)\r
+     (if matching-part\r
+       (let* ((msg (nth 1 matching-part))\r
+              (part (nth 2 matching-part))\r
+-             (content (nth 3 matching-part))\r
+              (content-type (plist-get part :content-type)))\r
+-        ;; If we don't already have the content, get it and cache\r
+-        ;; it, as some messages reference the same cid: part many\r
+-        ;; times (hundreds!), which results in many calls to\r
+-        ;; `notmuch part'.\r
+-        (unless content\r
+-          (setq content (notmuch-get-bodypart-binary\r
+-                         msg part notmuch-show-process-crypto))\r
+-          (with-current-buffer w3m-current-buffer\r
+-            (notmuch-show-w3m-cid-store-internal url msg part content)))\r
+-        (insert content)\r
++        ;; Request content caching, as some messages reference the\r
++        ;; same cid: part many times (hundreds!), which results in\r
++        ;; many calls to `notmuch show'.\r
++        (insert (notmuch-get-bodypart-binary\r
++                 msg part notmuch-show-process-crypto 'cache))\r
+         content-type)\r
+       nil)))\r
\r
+-- \r
+2.1.3\r
+\r