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 673FA431FAF for ; Mon, 3 Jun 2013 10:21:34 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: 0 X-Spam-Level: X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none] 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 UJ8CROAyPpNK for ; Mon, 3 Jun 2013 10:21:26 -0700 (PDT) Received: from guru.guru-group.fi (guru.guru-group.fi [46.183.73.34]) by olra.theworths.org (Postfix) with ESMTP id 82130431FAE for ; Mon, 3 Jun 2013 10:21:26 -0700 (PDT) Received: from guru.guru-group.fi (localhost [IPv6:::1]) by guru.guru-group.fi (Postfix) with ESMTP id 399BF100030; Mon, 3 Jun 2013 20:21:21 +0300 (EEST) From: Tomi Ollila 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.15.2+168~gf91ff62 (http://notmuchmail.org) Emacs/24.3.1 (x86_64-unknown-linux-gnu) X-Face: HhBM'cA~ MIME-Version: 1.0 Content-Type: text/plain 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 17:21:34 -0000 On Mon, Jun 03 2013, Austin Clements wrote: > 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. > --- LGTM (took a while to understand :D). Tomi > 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 > > _______________________________________________ > notmuch mailing list > notmuch@notmuchmail.org > http://notmuchmail.org/mailman/listinfo/notmuch