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 E1158431FAE for ; Mon, 27 May 2013 13:46:54 -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 JT9R7QFML7HS for ; Mon, 27 May 2013 13:46:47 -0700 (PDT) Received: from dmz-mailsec-scanner-7.mit.edu (DMZ-MAILSEC-SCANNER-7.MIT.EDU [18.7.68.36]) by olra.theworths.org (Postfix) with ESMTP id 48791431FAF for ; Mon, 27 May 2013 13:46:47 -0700 (PDT) X-AuditID: 12074424-b7f8c6d0000028c4-1a-51a3c634b37f Received: from mailhub-auth-3.mit.edu ( [18.9.21.43]) by dmz-mailsec-scanner-7.mit.edu (Symantec Messaging Gateway) with SMTP id 19.E5.10436.436C3A15; Mon, 27 May 2013 16:46:45 -0400 (EDT) Received: from outgoing.mit.edu (OUTGOING-AUTH-1.MIT.EDU [18.9.28.11]) by mailhub-auth-3.mit.edu (8.13.8/8.9.2) with ESMTP id r4RKkhsn032253; Mon, 27 May 2013 16:46:43 -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 r4RKkewD026417 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT); Mon, 27 May 2013 16:46:42 -0400 Received: from amthrax by drake.dyndns.org with local (Exim 4.77) (envelope-from ) id 1Uh4JT-0008NB-Mz; Mon, 27 May 2013 16:46:39 -0400 From: Austin Clements To: notmuch@notmuchmail.org Subject: [PATCH 1/4] emacs: Retain text properties when toggling buttons Date: Mon, 27 May 2013 16:46:31 -0400 Message-Id: <1369687594-31774-2-git-send-email-amdragon@mit.edu> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1369687594-31774-1-git-send-email-amdragon@mit.edu> References: <1369687594-31774-1-git-send-email-amdragon@mit.edu> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrDIsWRmVeSWpSXmKPExsUixCmqrWt6bHGgwaS3zBar5/JYXL85k9mB yWPnrLvsHs9W3WIOYIrisklJzcksSy3St0vgyth4UKWgm6/iSut7tgbGHdxdjJwcEgImEsu3 rGKHsMUkLtxbz9bFyMUhJLCPUeLzl+msEM5GIGfhPXYI5zSTxNH3k6CcuYwSW1fMZgHpZxPQ kNi2fzkjiC0iIC2x8+5sVhCbWcBR4vP+RWwgtrCAh8ScjxuZQGwWAVWJzolHwGxeAQeJ/mdr GCHuUJTofjYBrJ4TqPfKrt9gc4SAala/7mCawMi/gJFhFaNsSm6Vbm5iZk5xarJucXJiXl5q ka65Xm5miV5qSukmRlAgsbuo7GBsPqR0iFGAg1GJh9cic3GgEGtiWXFl7iFGSQ4mJVFe9iNA Ib6k/JTKjMTijPii0pzU4kOMEhzMSiK821cA5XhTEiurUovyYVLSHCxK4rzXU276CwmkJ5ak ZqemFqQWwWRlODiUJHjlQIYKFqWmp1akZeaUIKSZODhBhvMADc8AqeEtLkjMLc5Mh8ifYlSU EuctB0kIgCQySvPgemGR/opRHOgVYV4nkCoeYJKA634FNJgJaLA4M9jgkkSElFQD4/wrudu9 lm7Sd1H8kB/tyGbz8+ikP9qJKa6HLrqtCymvtNAXnK97SNF/4SHtXw5Xl68s6V/Jy+X0xL9L vqfzH7v44brPti84vnJJm70+KBz9K9phtyeHWnbR9JML8mbPrN2UdUZw09PXzk6eKnaLFizd tDXS8WxBW1f3WpEVlas42LdX26xqV2Ipzkg01GIuKk4EAOcRN8TPAgAA 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, 27 May 2013 20:46:55 -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