From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.bugs Subject: bug#73175: 30.0.60; toggling emacs-news-view-mode doesn't remove buttons Date: Fri, 20 Sep 2024 09:52:25 +0300 Organization: LINKOV.NET Message-ID: <86y13m6esa.fsf@mail.linkov.net> References: <87y13yle65.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="29789"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/31.0.50 (x86_64-pc-linux-gnu) Cc: 73175@debbugs.gnu.org To: Robert Pluim Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Sep 20 08:53:52 2024 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1srXWZ-0007Zf-VZ for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 20 Sep 2024 08:53:52 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1srXWU-0002Vi-5E; Fri, 20 Sep 2024 02:53:46 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1srXWS-0002VL-KP for bug-gnu-emacs@gnu.org; Fri, 20 Sep 2024 02:53:44 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1srXWS-0001oy-B2 for bug-gnu-emacs@gnu.org; Fri, 20 Sep 2024 02:53:44 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:Date:References:In-Reply-To:From:To:Subject; bh=PAzMaZ5jK8uVeABPzHXSoiPNDuSB+WNagf55xD2doFE=; b=q8lv3gvcR1bvSsvxGFi8Q0gPAohM6HcVbMwHxdFM3jQbEPgcGE9CV7oWAdQOXTLp8+OCoFwNZqJ3bO5lW+GZhGjuq/OTPE/2hQMpm+bg0npjcfy8idnyDHLLGrrWh+arpRqVfyuUhGR6toucudjwtmTUK4VtscwafvX4q7RJvCgyWZL2o0Ba1tLZ0+snA6O3SLXNJ9PIoK1tYaVp1LqC4fSGm+xxDk0Xdpkuet7b4N44BkpcnEUbUp2VFD9hjaq6jeYtAvagKDqnlzu8CWoAwao3aF7afixGC8/bwgMCjr2qAtvTRlSdmC+2cQ9smnm/FTXFSHqVArJnL4WeBKBNbw==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1srXWk-0005oL-OF for bug-gnu-emacs@gnu.org; Fri, 20 Sep 2024 02:54:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Juri Linkov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 20 Sep 2024 06:54:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 73175 X-GNU-PR-Package: emacs Original-Received: via spool by 73175-submit@debbugs.gnu.org id=B73175.172681521822290 (code B ref 73175); Fri, 20 Sep 2024 06:54:02 +0000 Original-Received: (at 73175) by debbugs.gnu.org; 20 Sep 2024 06:53:38 +0000 Original-Received: from localhost ([127.0.0.1]:33915 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1srXWL-0005nR-CG for submit@debbugs.gnu.org; Fri, 20 Sep 2024 02:53:38 -0400 Original-Received: from relay1-d.mail.gandi.net ([217.70.183.193]:58145) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1srXW7-0005md-0H for 73175@debbugs.gnu.org; Fri, 20 Sep 2024 02:53:36 -0400 Original-Received: by mail.gandi.net (Postfix) with ESMTPSA id F0FB0240009; Fri, 20 Sep 2024 06:52:56 +0000 (UTC) In-Reply-To: <87y13yle65.fsf@gmail.com> (Robert Pluim's message of "Wed, 11 Sep 2024 11:42:26 +0200") X-GND-Sasl: juri@linkov.net X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:292087 Archived-At: > 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.