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