[PATCH v2 1/8] emacs: Track full message and part descriptor in w3m CID store
authorAustin Clements <amdragon@mit.edu>
Sat, 24 Jan 2015 21:16:56 +0000 (16:16 +1900)
committerW. Trevor King <wking@tremily.us>
Sat, 20 Aug 2016 21:47:48 +0000 (14:47 -0700)
c7/926a05f89d3e057eab26cd701d98fb8f618304 [new file with mode: 0644]

diff --git a/c7/926a05f89d3e057eab26cd701d98fb8f618304 b/c7/926a05f89d3e057eab26cd701d98fb8f618304
new file mode 100644 (file)
index 0000000..11271a2
--- /dev/null
@@ -0,0 +1,149 @@
+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 5D095431FAE\r
+       for <notmuch@notmuchmail.org>; Sat, 24 Jan 2015 13:17:19 -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 qUrBqzQrgh0L for <notmuch@notmuchmail.org>;\r
+       Sat, 24 Jan 2015 13:17:16 -0800 (PST)\r
+Received: from dmz-mailsec-scanner-3.mit.edu (dmz-mailsec-scanner-3.mit.edu\r
+       [18.9.25.14])\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 388D7431FD2\r
+       for <notmuch@notmuchmail.org>; Sat, 24 Jan 2015 13:17:13 -0800 (PST)\r
+X-AuditID: 1209190e-f799e6d000000cfe-92-54c40bd6e2da\r
+Received: from mailhub-auth-3.mit.edu ( [18.9.21.43])\r
+       (using TLS with cipher DHE-RSA-AES256-SHA (256/256 bits))\r
+       (Client did not present a certificate)\r
+       by dmz-mailsec-scanner-3.mit.edu (Symantec Messaging Gateway) with SMTP\r
+       id 44.73.03326.6DB04C45; Sat, 24 Jan 2015 16:17:10 -0500 (EST)\r
+Received: from outgoing.mit.edu (outgoing-auth-1.mit.edu [18.9.28.11])\r
+       by mailhub-auth-3.mit.edu (8.13.8/8.9.2) with ESMTP id t0OLH9GY027944; \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 t0OLH6O0007452\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-0005RP-Jy; Sat, 24 Jan 2015 16:17:05 -0500\r
+From: Austin Clements <amdragon@mit.edu>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH v2 1/8] emacs: Track full message and part descriptor in w3m\r
+       CID store\r
+Date: Sat, 24 Jan 2015 16:16:56 -0500\r
+Message-Id: <1422134223-20739-2-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+NgFrrJIsWRmVeSWpSXmKPExsUixCmqrXuN+0iIwZ1TihY3WrsZLfbd2cJk\r
+       sXouj8X1mzOZLd6snMfqwOqx6/lfJo+ds+6yexz+upDF49mqW8weWw69Zw5gjeKySUnNySxL\r
+       LdK3S+DKWPX1PmPBUpGKH4c3MDUwHuHvYuTgkBAwkXh2PKuLkRPIFJO4cG89WxcjF4eQwGIm\r
+       iUPdW6CcjYwSJxd/Z4FwLjJJXHr3nhnCmcQocfvjSlaQfjYBDYnftxYzgdgiAtISO+/OBosz\r
+       C9RJ/J1znhHEFhYIk+jds4EdxGYRUJVo2ngRrJ5XwEHixtrvTBAnyUlsXecNEuYUcJS4sWEX\r
+       C4gtBFTS/bmRbQIj/wJGhlWMsim5Vbq5iZk5xanJusXJiXl5qUW6xnq5mSV6qSmlmxjBISjJ\r
+       t4Px60GlQ4wCHIxKPLwBjIdDhFgTy4orcw8xSnIwKYnyrvoFFOJLyk+pzEgszogvKs1JLT7E\r
+       KMHBrCTCe2EDUI43JbGyKrUoHyYlzcGiJM676QdfiJBAemJJanZqakFqEUxWhoNDSYKXERhr\r
+       QoJFqempFWmZOSUIaSYOTpDhPEDDWUFqeIsLEnOLM9Mh8qcYFaXEeb9yASUEQBIZpXlwvbAU\r
+       8YpRHOgVYd56kCoeYHqB634FNJgJaHDB9gMgg0sSEVJSDYz+LO8aY6Is/y5bOGWOjPvkItNi\r
+       7YTvL78r5zsb7L/3/S0rY9CDb3en7P60L/D67+9/K+bFzbtx7Hf386NJ3UfTDzRMf5o94/xn\r
+       Tgn2pIIfrikvbSvXuc6e1aFdLxa87NZHT3nX/uv7b72NV5LSl1n6dEGXYgG7e4BK/ptZly+G\r
+       ZgZm2CSIWi1UYinOSDTUYi4qTgQAM2OyTOwCAAA=\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:19 -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 87b4881..df2389e 100644\r
+--- a/emacs/notmuch-show.el\r
++++ b/emacs/notmuch-show.el\r
+@@ -562,35 +562,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
+@@ -599,11 +590,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
+2.1.3\r
+\r