From: Mark Walters Date: Mon, 3 Jun 2013 16:33:35 +0000 (+0100) Subject: Re: [PATCH] emacs: Fix applying stickiness to the :notmuch-part property X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=e80e99dfcae4991cf8033e901ca7b91e68c3ebd4;p=notmuch-archives.git Re: [PATCH] emacs: Fix applying stickiness to the :notmuch-part property --- diff --git a/ca/6a1567263f664d126bd88783a04a565cf15c93 b/ca/6a1567263f664d126bd88783a04a565cf15c93 new file mode 100644 index 000000000..7c4c744be --- /dev/null +++ b/ca/6a1567263f664d126bd88783a04a565cf15c93 @@ -0,0 +1,121 @@ +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 186A6431FAF + for ; Mon, 3 Jun 2013 09:33:52 -0700 (PDT) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: -1.098 +X-Spam-Level: +X-Spam-Status: No, score=-1.098 tagged_above=-999 required=5 + tests=[DKIM_ADSP_CUSTOM_MED=0.001, FREEMAIL_FROM=0.001, + 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 B0ZT4bGwbOVW for ; + Mon, 3 Jun 2013 09:33:44 -0700 (PDT) +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 2B916431FAE + for ; Mon, 3 Jun 2013 09:33:44 -0700 (PDT) +Received: from smtp.qmul.ac.uk ([138.37.6.40]) + by mail2.qmul.ac.uk with esmtp (Exim 4.71) + (envelope-from ) + id 1UjXhR-0004dl-9d; Mon, 03 Jun 2013 17:33:42 +0100 +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.71) + (envelope-from ) + id 1UjXhR-0001CV-1y; Mon, 03 Jun 2013 17:33:37 +0100 +From: Mark Walters +To: Austin Clements , notmuch@notmuchmail.org +Subject: Re: [PATCH] emacs: Fix applying stickiness to the :notmuch-part + property +In-Reply-To: <1370272679-20175-1-git-send-email-amdragon@mit.edu> +References: <1370272679-20175-1-git-send-email-amdragon@mit.edu> +User-Agent: Notmuch/0.14+255~gff3cc55 (http://notmuchmail.org) Emacs/23.4.1 + (i486-pc-linux-gnu) +Date: Mon, 03 Jun 2013 17:33:35 +0100 +Message-ID: <878v2rf928.fsf@qmul.ac.uk> +MIME-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +X-Sender-Host-Address: 93.97.24.31 +X-QM-SPAM-Info: Sender has good ham record. :) +X-QM-Body-MD5: fa082a8cc85353dffe10fe9d19b6a5ba (of first 20000 bytes) +X-SpamAssassin-Score: -0.0 +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 -0.0 points. + Summary of the scoring: + * 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail + provider * (markwalters1009[at]gmail.com) + * -0.0 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: Mon, 03 Jun 2013 16:33:52 -0000 + + +LGTM +1. This fixes the test failures (and errors in the emacs display) I was seeing on one of my systems. + +Best wishes + +Mark + + + +Austin Clements writes: + +> Previously, we simply called pushnew to add :notmuch-part to the +> front-sticky and rear-nonsticky text property lists. This works if +> these are nil or lists, but they can also have the value t, meaning +> that all properties are front-sticky/rear-nonsticky. In this case, +> pushnew will signal an error because t is not a list. We never set +> these properties to t ourselves, but since we apply these property +> changes over arbitrary renderer output, we have to deal with this +> possibility. +> --- +> emacs/notmuch-show.el | 13 ++++++++++--- +> 1 file changed, 10 insertions(+), 3 deletions(-) +> +> diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el +> index 5771950..83bb9ad 100644 +> --- a/emacs/notmuch-show.el +> +++ b/emacs/notmuch-show.el +> @@ -846,11 +846,18 @@ If HIDE is non-nil then initially hide this part." +> (notmuch-map-text-property beg (point) :notmuch-part +> (lambda (v) (or v part))) +> ;; Make :notmuch-part front sticky and rear non-sticky so it stays +> - ;; applied to the beginning of each line when we indent the message. +> + ;; applied to the beginning of each line when we indent the +> + ;; message. Since we're operating on arbitrary renderer output, +> + ;; watch out for sticky specs of t, which means all properties are +> + ;; front-sticky/rear-nonsticky. +> (notmuch-map-text-property beg (point) 'front-sticky +> - (lambda (v) (pushnew :notmuch-part v))) +> + (lambda (v) (if (listp v) +> + (pushnew :notmuch-part v) +> + v))) +> (notmuch-map-text-property beg (point) 'rear-nonsticky +> - (lambda (v) (pushnew :notmuch-part v))))) +> + (lambda (v) (if (listp v) +> + (pushnew :notmuch-part v) +> + v))))) +> +> (defun notmuch-show-insert-body (msg body depth) +> "Insert the body BODY at depth DEPTH in the current thread." +> -- +> 1.7.10.4