From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Robert Pluim Newsgroups: gmane.emacs.bugs Subject: bug#73175: 30.0.60; toggling emacs-news-view-mode doesn't remove buttons Date: Fri, 20 Sep 2024 10:57:53 +0200 Message-ID: <87o74ihfce.fsf@gmail.com> References: <87y13yle65.fsf@gmail.com> <86y13m6esa.fsf@mail.linkov.net> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="1105"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 73175@debbugs.gnu.org To: Juri Linkov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Sep 20 11:00:13 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 1srZUr-00006L-CX for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 20 Sep 2024 11:00:13 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1srZUP-0005A3-GC; Fri, 20 Sep 2024 04:59:45 -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 1srZUO-00059Q-11 for bug-gnu-emacs@gnu.org; Fri, 20 Sep 2024 04:59: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 1srZUN-0002nQ-OH for bug-gnu-emacs@gnu.org; Fri, 20 Sep 2024 04:59:43 -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=VVHhyNTXurcWOyOoy1krEf6PbJn/EFDvloU3pOdCQWA=; b=qwGKWXoWy2o9TQo42OakZi8Nx2tfW+Ea38FoyEsiessaqPUhhvnW66ERBgM9ZvbmXmadwjirkcARY07XyE0jVKs2aUq9iPcxCqcZemO7mVC1bQEk58v6i5OmqGmZHfxn+l0BWWHC8D8dgiMFnhpILetZEQKTE5uVVN6i0j+UE3VA4Vfa4OzrvIsl0Y4Ve4pVMEmkgU1DD4IVMDS8kYqhq6slslyUT/VD8QSA23tXG8hQCwKuxI6arMsUqhBOQfHR4PuObkzlMf1xwqwKJipia6zci5jlDD9DON547YTOvmovY6Fz2WCVoI4N1HIiwlW+TD7+McpPqsOfgbBiQ0ebFA==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1srZUg-0004RT-3G for bug-gnu-emacs@gnu.org; Fri, 20 Sep 2024 05:00:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Robert Pluim Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 20 Sep 2024 09:00: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.172682276216987 (code B ref 73175); Fri, 20 Sep 2024 09:00:02 +0000 Original-Received: (at 73175) by debbugs.gnu.org; 20 Sep 2024 08:59:22 +0000 Original-Received: from localhost ([127.0.0.1]:34055 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1srZU2-0004Pu-DY for submit@debbugs.gnu.org; Fri, 20 Sep 2024 04:59:22 -0400 Original-Received: from mail-wm1-f44.google.com ([209.85.128.44]:44362) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1srZU0-0004Pd-5O for 73175@debbugs.gnu.org; Fri, 20 Sep 2024 04:59:21 -0400 Original-Received: by mail-wm1-f44.google.com with SMTP id 5b1f17b1804b1-42cba6cdf32so15029545e9.1 for <73175@debbugs.gnu.org>; Fri, 20 Sep 2024 01:59:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1726822675; x=1727427475; darn=debbugs.gnu.org; h=content-transfer-encoding:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from:from:to:cc:subject:date:message-id :reply-to; bh=VVHhyNTXurcWOyOoy1krEf6PbJn/EFDvloU3pOdCQWA=; b=YwEM3fGTEg8aWpnpFLoJFsl5Cn1bxeHkb71R31pB/dlXrs1bCSbRrbL4fSJ63nExEc PKIGPxFGDl8+UMZ1xhnSZBQ6xwUd1W+IkdvNOFoBAVROL1cjm/iyiS72xUdENrAga45M CJzCprDJIYlJl6/E+/yFAuABLdjRXdpVVcR6K4DKAxn0Z/Z6JhlbFsQTZa/fN5MvdHL4 jpIpWVoxxsyVyjnN+DfjIOwxflHNsUA9Za22HS9TPJumPE/xqQGReUVtZIaVtSDyuEFA fnaYr0duwypjL4ceAp+dUTwfibf3jb7I5ZNnE9ICvkyZtuSBHvPH03p9X2dVI15O2YYv CreA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726822675; x=1727427475; h=content-transfer-encoding:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=VVHhyNTXurcWOyOoy1krEf6PbJn/EFDvloU3pOdCQWA=; b=sc2bLk5kSv5ap2CqD/KlcuuvJjy7ohK+lX2IcBKAR4C24JSTOCOSV+KWL6d9RNKFvx QqrbwC+AxyiZdP8crfh4R8xXzxMniGFWSJJUxm9NcHV+u1Va4Qr9u20XOs9TNb4grq9K sa12cT8wKjB1WYeyQ6tFJ6cnEjK4lUZ3i29BEt9Ui42NDTBuZlvzz4nBU747XbPFqjlX 0fLQ7teJrWH8dSnIQnauSEWFB7Y1i6f+kpoIVilIJJyMXyizxrdXSc2b/7QgXF0BhKYw cb1TBGcuo4KQt8TzkahXkXTmB7c6dVQy/cnj7yHOMthLO32qEXER3J9v7h1TheetXp93 P5Fg== X-Gm-Message-State: AOJu0Yy69uOckDskSnbmH0ZU5N8twHLpo19fH4KqdywQLa/WZa/pduE3 3PicTfVAc3m+fFW8FM3wjAydcq1f/bUcy0sReFMgzLTOQmQGFgxZL3RAJQ== X-Google-Smtp-Source: AGHT+IEWK8oMh8f2i5yhi4c8j6JVeyQbeDQqY4V+0cFjtul/yZS3nlcFrLTz73ieh3FO/avK/+t+HQ== X-Received: by 2002:a05:600c:310a:b0:42c:a89e:b0e6 with SMTP id 5b1f17b1804b1-42e7abe8e3emr13989155e9.11.1726822674978; Fri, 20 Sep 2024 01:57:54 -0700 (PDT) Original-Received: from rltb ([2a01:e0a:3f3:fb51:3f8e:9d48:84d3:6a9f]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42e7afbfa1asm16594475e9.21.2024.09.20.01.57.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Sep 2024 01:57:54 -0700 (PDT) In-Reply-To: <86y13m6esa.fsf@mail.linkov.net> (Juri Linkov's message of "Fri, 20 Sep 2024 09:52:25 +0300") 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:292096 Archived-At: >>>>> On Fri, 20 Sep 2024 09:52:25 +0300, Juri Linkov sai= d: >> src/emacs -Q etc/NEWS >> C-x C-q ; buttons appear >> C-x C-q ; buttons don=CA=BCt disappear >>=20 >> (personally I don=CA=BCt mind the buttons, but the intent of faf1f03= 7987c >> was to make them disappear). >>=20 >> I came up with the following, but I can never remember all the detai= ls >> of text property removal (maybe we need a `button-debuttonize-region= '?) Juri> Or `button-unbuttonize-region' (like in `gnus-unbuttonized-mime-t= ypes'). 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=CA=BCve got the incantation right ;-)) Robert --=20