From 2c3d9688013f0e23f48efef22c34be417197c842 Mon Sep 17 00:00:00 2001 From: Mark Walters Date: Tue, 18 Dec 2012 08:54:03 +0000 Subject: [PATCH] Re: [PATCH v4 0/5] Use invisibility to toggle display of all parts including multipart --- f6/0283da725d52ab6da20a3ba1e34e6ae22d3a2b | 169 ++++++++++++++++++++++ 1 file changed, 169 insertions(+) create mode 100644 f6/0283da725d52ab6da20a3ba1e34e6ae22d3a2b diff --git a/f6/0283da725d52ab6da20a3ba1e34e6ae22d3a2b b/f6/0283da725d52ab6da20a3ba1e34e6ae22d3a2b new file mode 100644 index 000000000..60617bf5b --- /dev/null +++ b/f6/0283da725d52ab6da20a3ba1e34e6ae22d3a2b @@ -0,0 +1,169 @@ +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 258C2431FAF + for ; Tue, 18 Dec 2012 00:54:10 -0800 (PST) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: 1.401 +X-Spam-Level: * +X-Spam-Status: No, score=1.401 tagged_above=-999 required=5 + tests=[DKIM_ADSP_CUSTOM_MED=0.001, FREEMAIL_FROM=0.001, + FREEMAIL_REPLY=2.499, NML_ADSP_CUSTOM_MED=1.2, 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 2W2R3gS7bO2U for ; + Tue, 18 Dec 2012 00:54:08 -0800 (PST) +Received: from mail2.qmul.ac.uk (mail2.qmul.ac.uk [138.37.6.6]) + (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) + (No client certificate requested) + by olra.theworths.org (Postfix) with ESMTPS id 13089431FAE + for ; Tue, 18 Dec 2012 00:54:08 -0800 (PST) +Received: from smtp.qmul.ac.uk ([138.37.6.40]) + by mail2.qmul.ac.uk with esmtp (Exim 4.71) + (envelope-from ) + id 1Tksw8-0004uF-7Y; Tue, 18 Dec 2012 08:54:04 +0000 +Received: from 93-97-24-31.zone5.bethere.co.uk ([93.97.24.31] helo=localhost) + by smtp.qmul.ac.uk with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.69) + (envelope-from ) + id 1Tksw7-0004gq-T1; Tue, 18 Dec 2012 08:54:04 +0000 +From: Mark Walters +To: notmuch@notmuchmail.org +Subject: Re: [PATCH v4 0/5] Use invisibility to toggle display of all parts + including multipart +In-Reply-To: <1355781287-6010-1-git-send-email-markwalters1009@gmail.com> +References: <1355781287-6010-1-git-send-email-markwalters1009@gmail.com> +User-Agent: Notmuch/0.14+236~g1d0044f (http://notmuchmail.org) Emacs/24.2.1 + (x86_64-pc-linux-gnu) +Date: Tue, 18 Dec 2012 08:54:03 +0000 +Message-ID: <87ip7zu4es.fsf@qmul.ac.uk> +MIME-Version: 1.0 +Content-Type: text/plain +X-Sender-Host-Address: 93.97.24.31 +X-QM-SPAM-Info: Sender has good ham record. :) +X-QM-Body-MD5: 3c6eba937d4796f95dd81d2e8eb32c68 (of first 20000 bytes) +X-SpamAssassin-Score: -1.2 +X-SpamAssassin-SpamBar: - +X-SpamAssassin-Report: The QM spam filters have analysed this message to + determine if it is + spam. We require at least 5.0 points to mark a message as spam. + This message scored -1.2 points. + Summary of the scoring: + * -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at http://www.dnswl.org/, + * medium trust + * [138.37.6.40 listed in list.dnswl.org] + * 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail + provider * (markwalters1009[at]gmail.com) + * -0.0 T_RP_MATCHES_RCVD Envelope sender domain matches handover relay + * domain + * 1.0 FREEMAIL_REPLY From and body contain different freemails + * 0.1 AWL AWL: From: address is in the auto white-list +X-QM-Scan-Virus: ClamAV says the message is clean +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: Tue, 18 Dec 2012 08:54:10 -0000 + +On Mon, 17 Dec 2012, Mark Walters wrote: +> This is version 4 of this series (previous version at +> id:1355559338-14313-1-git-send-email-markwalters1009@gmail.com). +> +> The only change should be a bugfix which, for reasons I don't +> understand, only causes a problem on emacs 24. The problem is that the +> part invisibility code looks for a part button at the start of the +> region. This gets confused if there is a part with no part button +> (this is the case for the first part if it is text/plain) and the part +> starts with a button (as can happen if the message starts with the +> reply as in the first test in test/emacs-show). +> +> This checks that the button is a part button before creating the part +> overlay. + +I don't think the above is very clear so I will try to explain it more +fully. + +The invisibility overlay for a part needs to be `linked' to the part +header button so that the part header button can toggle the overlay +visibility. The overlay is created and linked to this button after the +whole part has been inserted (including any notmuch-wash stuff). + +I could have made insert-part-header return the button it made and pass +it back up the call chain to the the create-overlays function but +instead I chose to make create-overlays just take the button at the +start of the part. + +Now if the first part is text/plain then notmuch does not insert a +[text/plain] button so the code checks for this case by making sure the +part does start with a button, and if not it does not create the part +overlay (there is no button to toggle it so no point in an overlay). + +However, if the first part is text/plain and notmuch wash happens to +make a button at the very start of the part then the create-overlays +function did still create an overlay *and* link it to the button. This +linking overwrote some of the things notmuch wash had attached to its +button (eg the button :overlay property) and that caused things to +break. + +I still do not know why emacs 23 and emacs 24 behave differently, but +regardless the change from v3 is a clear bugfix: we just make sure it is +a notmuch-show-insert-part-header button not a notmuch-wash button +before we do the overlay creation/linking to the button. This version +does that by looking for a :base-label property of the button which +insert-part-header buttons have but notmuch-wash buttons do +not. (Obviously there are other ways this check could be done) + +Best wishes + +Mark + + + +> The diff is below the diffstat. +> +> Best wishes +> +> Mark +> +> +> +> Mark Walters (5): +> emacs: show: modify insert-part-header to save the button text +> emacs: show: add overlays for each part +> emacs: show: add invisibility button action +> emacs: wash: fix fake-diff part to include msg parameter +> emacs: show: set default show-all-multipart/alternatives to nil +> +> emacs/notmuch-show.el | 115 ++++++++++++++++++++++++++++++++++++++----------- +> emacs/notmuch-wash.el | 2 +- +> 2 files changed, 90 insertions(+), 27 deletions(-) +> +> diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el +> index 5ca6fe2..3816e32 100644 +> --- a/emacs/notmuch-show.el +> +++ b/emacs/notmuch-show.el +> @@ -865,8 +865,10 @@ message at DEPTH in the current thread." +> (let* ((button (button-at beg)) +> (part-beg (and button (1+ (button-end button))))) +> +> - ;; If the part contains no text we do not make it toggleable. +> - (when (and button (/= part-beg end)) +> + ;; If the part contains no text we do not make it toggleable. We +> + ;; also need to check that the button is a genuine part button not +> + ;; a notmuch-wash button. +> + (when (and button (/= part-beg end) (button-get button :base-label)) +> (let ((base-label (button-get button :base-label)) +> (overlay (make-overlay part-beg end)) +> (message-invis-spec (plist-get msg :message-invis-spec)) +> -- +> 1.7.9.1 -- 2.26.2