[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#73175: 30.0.60; toggling emacs-news-view-mode doesn't remove buttons
From: |
Robert Pluim |
Subject: |
bug#73175: 30.0.60; toggling emacs-news-view-mode doesn't remove buttons |
Date: |
Tue, 24 Sep 2024 17:59:23 +0200 |
>>>>> On Tue, 24 Sep 2024 15:25:14 +0300, Eli Zaretskii <eliz@gnu.org> said:
>> Cc: 73175@debbugs.gnu.org
>> From: Robert Pluim <rpluim@gmail.com>
>> Date: Tue, 24 Sep 2024 11:29:45 +0200
>>
>> Hmm, `buttonize-region' isnʼt in the elisp manual. Iʼm assuming
>> emacs-30 is still open for documentation changes
Eli> Yes, thanks.
OK. Done.
Iʼve just remembered that button.el can use either overlays or text
properties to make buttons, so `unbuttonize-region' should look like
this:
(defun unbuttonize-region (start end)
"Remove all the buttons between START and END.
This removes both text-property and overlay based buttons."
(dolist (o (overlays-in start end))
(when (overlay-get o 'button)
(delete-overlay o)))
(with-silent-modifications
(remove-text-properties start end
(button--properties nil nil nil))
(add-face-text-property start end
'button nil)))
Robert
--