GNU bug report logs - #73175
30.0.60; toggling emacs-news-view-mode doesn't remove buttons

Previous Next

Package: emacs;

Reported by: Robert Pluim <rpluim <at> gmail.com>

Date: Wed, 11 Sep 2024 09:43:02 UTC

Severity: normal

Tags: fixed

Found in version 30.0.60

Fixed in version 31.1

Done: Robert Pluim <rpluim <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


Message #8 received at 73175 <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> linkov.net>
To: Robert Pluim <rpluim <at> gmail.com>
Cc: 73175 <at> debbugs.gnu.org
Subject: Re: bug#73175: 30.0.60; toggling emacs-news-view-mode doesn't
 remove buttons
Date: Fri, 20 Sep 2024 09:52:25 +0300
> src/emacs -Q etc/NEWS
> C-x C-q ; buttons appear
> C-x C-q ; buttons donʼt disappear
>
> (personally I donʼt mind the buttons, but the intent of faf1f037987c
> was to make them disappear).
>
> I came up with the following, but I can never remember all the details
> of text property removal (maybe we need a `button-debuttonize-region'?)

Or `button-unbuttonize-region' (like in `gnus-unbuttonized-mime-types').

>  (define-derived-mode emacs-news-mode text-mode "NEWS"
>    "Major mode for editing the Emacs NEWS file."
>    ;; Disable buttons.
> -  (button-mode nil)
> +  (button-mode -1)
>    ;; And make the buffer writable.  This is used when toggling
>    ;; emacs-news-mode.
>    (setq buffer-read-only nil)
> +  (save-excursion
> +    (with-silent-modifications
> +      (widen)
> +      (remove-text-properties (point-min) (point-max)
> +                            (button--properties nil nil nil))
> +      (add-face-text-property (point-min) (point-max)
> +                              'button nil)))

Probably it would be the right thing to move this code to `button-mode'
to remove properties when it's disabled.




This bug report was last modified 224 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.