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 EE08B431FAE for ; Wed, 29 May 2013 18:14:12 -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 ncEGCoUbxbOd for ; Wed, 29 May 2013 18:14:06 -0700 (PDT) Received: from dmz-mailsec-scanner-4.mit.edu (dmz-mailsec-scanner-4.mit.edu [18.9.25.15]) by olra.theworths.org (Postfix) with ESMTP id 2FF7F431FB6 for ; Wed, 29 May 2013 18:13:59 -0700 (PDT) X-AuditID: 1209190f-b7f256d000005616-fc-51a6a7d6737a Received: from mailhub-auth-2.mit.edu ( [18.7.62.36]) by dmz-mailsec-scanner-4.mit.edu (Symantec Messaging Gateway) with SMTP id B6.C0.22038.6D7A6A15; Wed, 29 May 2013 21:13:58 -0400 (EDT) Received: from outgoing.mit.edu (outgoing-auth-1.mit.edu [18.9.28.11]) by mailhub-auth-2.mit.edu (8.13.8/8.9.2) with ESMTP id r4U1DtFW029491; Wed, 29 May 2013 21:13:55 -0400 Received: from drake.dyndns.org (c-76-21-105-205.hsd1.ca.comcast.net [76.21.105.205]) (authenticated bits=0) (User authenticated as amdragon@ATHENA.MIT.EDU) by outgoing.mit.edu (8.13.8/8.12.4) with ESMTP id r4U1DqSP003004 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT); Wed, 29 May 2013 21:13:54 -0400 Received: from amthrax by drake.dyndns.org with local (Exim 4.77) (envelope-from ) id 1UhrRA-0003Yq-0Q; Wed, 29 May 2013 21:13:52 -0400 From: Austin Clements To: notmuch@notmuchmail.org Subject: [PATCH v2 1/5] emacs: Retain text properties when toggling buttons Date: Wed, 29 May 2013 21:13:44 -0400 Message-Id: <1369876428-13537-2-git-send-email-amdragon@mit.edu> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1369876428-13537-1-git-send-email-amdragon@mit.edu> References: <1369876428-13537-1-git-send-email-amdragon@mit.edu> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrDIsWRmVeSWpSXmKPExsUixG6nontt+bJAg8UNRhar5/JYXL85k9mB yWPnrLvsHs9W3WIOYIrisklJzcksSy3St0vgyth4UKWgm6/iSut7tgbGHdxdjJwcEgImEvcm X2CBsMUkLtxbz9bFyMUhJLCPUeLKh0VQzkZGic+rz7BCOKeZJJasu8UO4cxllHhz7yArSD+b gIbEtv3LGUFsEQFpiZ13Z4PFmQUcJT7vBxnFySEs4C3R0/6eHcRmEVCVWHS9B2w3r4CDxMX/ Z6DuUJTofjYBrJ4TqPd923WwmUJANc3f+pgmMPIvYGRYxSibklulm5uYmVOcmqxbnJyYl5da pGuil5tZopeaUrqJERRInJL8Oxi/HVQ6xCjAwajEw7tBa1mgEGtiWXFl7iFGSQ4mJVHeNUuB QnxJ+SmVGYnFGfFFpTmpxYcYJTiYlUR412gD5XhTEiurUovyYVLSHCxK4rxXU276CwmkJ5ak ZqemFqQWwWRlODiUJHhtlwE1ChalpqdWpGXmlCCkmTg4QYbzAA1XAqnhLS5IzC3OTIfIn2JU lBKHaBYASWSU5sH1wiL9FaM40CvCvKYgVTzAJAHX/QpoMBPQYHHmxSCDSxIRUlINjItLj0aI r3zXYP6EYSpvUbjBmryV79a8eL5lQeUFuwKFQ4abj9RomrybZSs1dc/v2vucj+6ZiBsH5u3v WnT52AOZRb/ul64sX/L+nGzuhLKvF2d/XVN38F+5mKeH9L8L80JtJ9tXPLywUde+xXd32AXF M5km4of9vqgnzTb5lJuqH2TEKsB0WkSJpTgj0VCLuag4EQDLRPa4zwIAAA== 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: Thu, 30 May 2013 01:14:13 -0000 Previously, we lost any text properties applied to part buttons or wash buttons when they were toggled because `insert' directly copies the text properties of the string being inserted. Fix this by capturing the properties applied to the button beforehand and re-applying them after inserting the new text. --- emacs/notmuch-show.el | 2 ++ emacs/notmuch-wash.el | 2 ++ 2 files changed, 4 insertions(+) diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el index b0a8d8a..a080134 100644 --- a/emacs/notmuch-show.el +++ b/emacs/notmuch-show.el @@ -559,10 +559,12 @@ message at DEPTH in the current thread." (new-start (button-start button)) (button-label (button-get button :base-label)) (old-point (point)) + (properties (text-properties-at (point))) (inhibit-read-only t)) (overlay-put overlay 'invisible (not show)) (goto-char new-start) (insert "[ " button-label (if show " ]" " (hidden) ]")) + (set-text-properties new-start (point) properties) (let ((old-end (button-end button))) (move-overlay button new-start (point)) (delete-region (point) old-end)) diff --git a/emacs/notmuch-wash.el b/emacs/notmuch-wash.el index 8a68819..8fe91e1 100644 --- a/emacs/notmuch-wash.el +++ b/emacs/notmuch-wash.el @@ -104,9 +104,11 @@ lower).") (overlay (button-get cite-button 'overlay)) (button-label (notmuch-wash-button-label overlay)) (old-point (point)) + (properties (text-properties-at (point))) (inhibit-read-only t)) (goto-char new-start) (insert button-label) + (set-text-properties new-start (point) properties) (let ((old-end (button-end cite-button))) (move-overlay cite-button new-start (point)) (delete-region (point) old-end)) -- 1.7.10.4