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