From: Austin Clements <amdragon@MIT.EDU>
To: notmuch@notmuchmail.org
Subject: [PATCH 1/4] emacs: Retain text properties when toggling buttons
Date: Mon, 27 May 2013 16:46:31 -0400 [thread overview]
Message-ID: <1369687594-31774-2-git-send-email-amdragon@mit.edu> (raw)
In-Reply-To: <1369687594-31774-1-git-send-email-amdragon@mit.edu>
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
next prev parent reply other threads:[~2013-05-27 20:46 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-05-27 20:46 [PATCH 0/4] emacs: Part command improvements Austin Clements
2013-05-27 20:46 ` Austin Clements [this message]
2013-05-27 20:46 ` [PATCH 2/4] emacs: Record part p-list in a text property Austin Clements
2013-05-27 22:19 ` Mark Walters
2013-05-27 20:46 ` [PATCH 3/4] emacs: Simplify MIME part command implementation Austin Clements
2013-05-27 20:46 ` [PATCH 4/4] emacs: Bind MIME part commands to "." submap Austin Clements
2013-05-27 22:30 ` [PATCH 0/4] emacs: Part command improvements Mark Walters
2013-05-30 1:01 ` Austin Clements
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://notmuchmail.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1369687594-31774-2-git-send-email-amdragon@mit.edu \
--to=amdragon@mit.edu \
--cc=notmuch@notmuchmail.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://yhetil.org/notmuch.git/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).