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 1A68F431FAF for ; Mon, 3 Jun 2013 08:18:18 -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 cE4rtDC8pHbF for ; Mon, 3 Jun 2013 08:18:10 -0700 (PDT) Received: from dmz-mailsec-scanner-2.mit.edu (dmz-mailsec-scanner-2.mit.edu [18.9.25.13]) by olra.theworths.org (Postfix) with ESMTP id A5B64431FAE for ; Mon, 3 Jun 2013 08:18:10 -0700 (PDT) X-AuditID: 1209190d-b7f966d000000944-16-51acb3b08bdb Received: from mailhub-auth-4.mit.edu ( [18.7.62.39]) by dmz-mailsec-scanner-2.mit.edu (Symantec Messaging Gateway) with SMTP id 08.29.02372.0B3BCA15; Mon, 3 Jun 2013 11:18:08 -0400 (EDT) Received: from outgoing.mit.edu (outgoing-auth-1.mit.edu [18.9.28.11]) by mailhub-auth-4.mit.edu (8.13.8/8.9.2) with ESMTP id r53FI5t5002307; Mon, 3 Jun 2013 11:18:05 -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 r53FI3sI007310 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT); Mon, 3 Jun 2013 11:18:04 -0400 Received: from amthrax by drake.dyndns.org with local (Exim 4.77) (envelope-from ) id 1UjWWI-0005H4-5z; Mon, 03 Jun 2013 11:18:02 -0400 From: Austin Clements To: notmuch@notmuchmail.org Subject: [PATCH] emacs: Fix applying stickiness to the :notmuch-part property Date: Mon, 3 Jun 2013 11:17:59 -0400 Message-Id: <1370272679-20175-1-git-send-email-amdragon@mit.edu> X-Mailer: git-send-email 1.7.10.4 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrIIsWRmVeSWpSXmKPExsUixG6nrrth85pAg33zFC1Wz+WxuH5zJrMD k8fOWXfZPZ6tusUcwBTFZZOSmpNZllqkb5fAlbHu4Be2ghN8FV+3drM0MM7i7mLk5JAQMJH4 u7CHDcIWk7hwbz2QzcUhJLCPUaLh2n0WCGcDo8SiBbehnNtMEi97p7FCOHMZJT7Pa2AH6WcT 0JDYtn85I4gtIiAtsfPubFYQm1nAUeLz/kVgO4QFfCVuHXwIVsMioCqxvmsjWJxXwEHizcln UHcoSnQ/m8A2gZF3ASPDKkbZlNwq3dzEzJzi1GTd4uTEvLzUIl0jvdzMEr3UlNJNjKDQ4JTk 3cH47qDSIUYBDkYlHt4AjzWBQqyJZcWVuYcYJTmYlER5OVcDhfiS8lMqMxKLM+KLSnNSiw8x SnAwK4nwftsIlONNSaysSi3Kh0lJc7AoifNeSbnpLySQnliSmp2aWpBaBJOV4eBQkuBdvgmo UbAoNT21Ii0zpwQhzcTBCTKcB2j4OpAa3uKCxNzizHSI/ClGXY7v86a8YxRiycvPS5US550P UiQAUpRRmgc3BxbTrxjFgd4S5t0OUsUDTAdwk14BLWECWjL59SqQJSWJCCmpBsa5UuGNDR7r 8xgDWSIuPf77zHrn3Avv8g6+yIvm4vsz7ZWv/RTVFHu/jpAn3EkvN57cEvzY+dtOX/7bWnty J7268CxS++qUSxe6ShuPrmNukVo1Vfz2zFu3VhS8/m3Ftz2p2IH51ovTL1JfFPN/0wy888if Zf/GKqGHD55cvilUcvbNsXdsYtPklViKMxINtZiLihMB6iGEq8QCAAA= 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 15:18:18 -0000 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