unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Robert Pluim <rpluim@gmail.com>
To: Juri Linkov <juri@linkov.net>
Cc: 73175@debbugs.gnu.org
Subject: bug#73175: 30.0.60; toggling emacs-news-view-mode doesn't remove buttons
Date: Fri, 20 Sep 2024 10:57:53 +0200	[thread overview]
Message-ID: <87o74ihfce.fsf@gmail.com> (raw)
In-Reply-To: <86y13m6esa.fsf@mail.linkov.net> (Juri Linkov's message of "Fri,  20 Sep 2024 09:52:25 +0300")

>>>>> On Fri, 20 Sep 2024 09:52:25 +0300, Juri Linkov <juri@linkov.net> said:

    >> 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'?)

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

Sure.

    >> (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)))

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

That would be best (assuming Iʼve got the incantation right ;-))

Robert
-- 





  reply	other threads:[~2024-09-20  8:57 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-11  9:42 bug#73175: 30.0.60; toggling emacs-news-view-mode doesn't remove buttons Robert Pluim
2024-09-20  6:52 ` Juri Linkov
2024-09-20  8:57   ` Robert Pluim [this message]
2024-09-20 12:49     ` Robert Pluim

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://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87o74ihfce.fsf@gmail.com \
    --to=rpluim@gmail.com \
    --cc=73175@debbugs.gnu.org \
    --cc=juri@linkov.net \
    /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://git.savannah.gnu.org/cgit/emacs.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).