]> git.notmuchmail.org Git - notmuch/commitdiff
emacs: Retain text properties when toggling buttons
authorAustin Clements <amdragon@MIT.EDU>
Thu, 30 May 2013 01:13:44 +0000 (21:13 -0400)
committerDavid Bremner <bremner@debian.org>
Sat, 1 Jun 2013 01:00:44 +0000 (22:00 -0300)
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
emacs/notmuch-wash.el

index b0a8d8ab022a1c68c22e472b53fcbda30c062906..a080134ff7e5dbea69528267c277dad6fef062fd 100644 (file)
@@ -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))
index 8a68819cc9940be440871622cbfda237f6749962..8fe91e1415944e3ec132dab441ff3641c0029fde 100644 (file)
@@ -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))