[PATCH 04/11] emacs: Track full message and part descriptor in w3m CID store
authorAustin Clements <amdragon@MIT.EDU>
Mon, 21 Apr 2014 18:37:41 +0000 (14:37 +2000)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 18:01:49 +0000 (10:01 -0800)
c9/b8703d5f64451f2bf8b20a99a19767099964a2 [new file with mode: 0644]

diff --git a/c9/b8703d5f64451f2bf8b20a99a19767099964a2 b/c9/b8703d5f64451f2bf8b20a99a19767099964a2
new file mode 100644 (file)
index 0000000..420b603
--- /dev/null
@@ -0,0 +1,147 @@
+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 65810431FC3\r
+       for <notmuch@notmuchmail.org>; Mon, 21 Apr 2014 11:38:42 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.7\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5\r
+       tests=[RCVD_IN_DNSWL_LOW=-0.7] 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 7yT5hr5gKCyT for <notmuch@notmuchmail.org>;\r
+       Mon, 21 Apr 2014 11:38:37 -0700 (PDT)\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 07F84431FD8\r
+       for <notmuch@notmuchmail.org>; Mon, 21 Apr 2014 11:38:07 -0700 (PDT)\r
+X-AuditID: 12074425-f79906d000000cf9-2f-5355658fd36d\r
+Received: from mailhub-auth-2.mit.edu ( [18.7.62.36])\r
+       (using TLS with cipher 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 9A.F3.03321.F8565535; Mon, 21 Apr 2014 14:38:07 -0400 (EDT)\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 s3LIbuLh009462; \r
+       Mon, 21 Apr 2014 14:37:57 -0400\r
+Received: from drake.dyndns.org\r
+       (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 s3LIbs2f029714\r
+       (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT);\r
+       Mon, 21 Apr 2014 14:37:56 -0400\r
+Received: from amthrax by drake.dyndns.org with local (Exim 4.77)\r
+       (envelope-from <amdragon@mit.edu>)\r
+       id 1WcJ6I-0003kz-Cy; Mon, 21 Apr 2014 14:37:54 -0400\r
+From: Austin Clements <amdragon@MIT.EDU>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH 04/11] emacs: Track full message and part descriptor in w3m\r
+       CID store\r
+Date: Mon, 21 Apr 2014 14:37:41 -0400\r
+Message-Id: <1398105468-14317-5-git-send-email-amdragon@mit.edu>\r
+X-Mailer: git-send-email 1.9.1\r
+In-Reply-To: <1398105468-14317-1-git-send-email-amdragon@mit.edu>\r
+References: <1398105468-14317-1-git-send-email-amdragon@mit.edu>\r
+X-Brightmail-Tracker:\r
+ H4sIAAAAAAAAA+NgFtrMIsWRmVeSWpSXmKPExsUixG6notufGhpscP2zrsX1mzOZHRg9nq26\r
+       xRzAGMVlk5Kak1mWWqRvl8CV0dbzkblgqUjF5etHmRoYj/B3MXJySAiYSGxcPp8VwhaTuHBv\r
+       PVsXIxeHkMBsJokNkzYyQzgbGSV+vW9ggXDuMEms7PoJ5cxllHh0YTkLSD+bgIbEtv3LGUFs\r
+       EQFpiZ13ZwPN5eBgFlCT+NOlAhIWFgiV+PHnNzOIzSKgKjHtbzMbiM0r4CDx+OZjdogz5CRO\r
+       HpsMdhKngKNE2+qXYHEhoJoNe9cwTWDkX8DIsIpRNiW3Sjc3MTOnODVZtzg5MS8vtUjXQi83\r
+       s0QvNaV0EyM4bFxUdzBOOKR0iFGAg1GJh7fAKDRYiDWxrLgy9xCjJAeTkijvqyigEF9Sfkpl\r
+       RmJxRnxRaU5q8SFGCQ5mJRHe9ZpAOd6UxMqq1KJ8mJQ0B4uSOO9ba6tgIYH0xJLU7NTUgtQi\r
+       mKwMB4eSBG9aClCjYFFqempFWmZOCUKaiYMTZDgP0PAokBre4oLE3OLMdIj8KUZFKXHeNpCE\r
+       AEgiozQPrhcW168YxYFeEeZ1B6niAaYEuO5XQIOZgAY/2RICMrgkESEl1cCofDJd44/L76j/\r
+       CZ6KYQ9WF5xfK5vPacu072NJRulF1Ztle6uWzp70nieErTTwt7Kiz17uN8l9czhvvujKd9z0\r
+       rfivwtWXQWeLUmbMO628d/Gtmxal3DPSy9mzH2xbOqV1t+xvkTDp04s+BXOtlF4YePXrnfQ1\r
+       LAJH42OvH3B9HM+4gn3G/eiXSizFGYmGWsxFxYkALQewMsYCAAA=\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: Mon, 21 Apr 2014 18:38:43 -0000\r
+\r
+This will simplify later changes.\r
+---\r
+ emacs/notmuch-show.el | 33 ++++++++++-----------------------\r
+ 1 file changed, 10 insertions(+), 23 deletions(-)\r
+\r
+diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el\r
+index 2b225df..455cfee 100644\r
+--- a/emacs/notmuch-show.el\r
++++ b/emacs/notmuch-show.el\r
+@@ -540,35 +540,26 @@ (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\r
+-                                          message-id\r
+-                                          part-number\r
+-                                          content-type\r
+-                                          content)\r
+-  (push (list content-id\r
+-            message-id\r
+-            part-number\r
+-            content-type\r
+-            content)\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
\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
+-                                         (plist-get msg :id)\r
+-                                         (plist-get part :id)\r
+-                                         (plist-get part :content-type)\r
+-                                         nil))))\r
++                                         msg part nil))))\r
\r
+ (defun notmuch-show-w3m-cid-retrieve (url &rest args)\r
+   (let ((matching-part (with-current-buffer w3m-current-buffer\r
+                        (assoc url notmuch-show-w3m-cid-store))))\r
+     (if matching-part\r
+-      (let ((message-id (nth 1 matching-part))\r
+-            (part-number (nth 2 matching-part))\r
+-            (content-type (nth 3 matching-part))\r
+-            (content (nth 4 matching-part)))\r
++      (let* ((msg (nth 1 matching-part))\r
++             (part (nth 2 matching-part))\r
++             (content (nth 3 matching-part))\r
++             (message-id (plist-get msg :id))\r
++             (part-number (plist-get part :id))\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
+@@ -577,11 +568,7 @@ (defun notmuch-show-w3m-cid-retrieve (url &rest args)\r
+           (setq content (notmuch-get-bodypart-internal (notmuch-id-to-query message-id)\r
+                                                             part-number notmuch-show-process-crypto))\r
+           (with-current-buffer w3m-current-buffer\r
+-            (notmuch-show-w3m-cid-store-internal url\r
+-                                                 message-id\r
+-                                                 part-number\r
+-                                                 content-type\r
+-                                                 content)))\r
++            (notmuch-show-w3m-cid-store-internal url msg part content)))\r
+         (insert content)\r
+         content-type)\r
+       nil)))\r
+-- \r
+1.9.1\r
+\r