From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#66752: 30.0.50; [PATCH] Add support for 'thing-at-point' to 'bug-reference-mode' Date: Sun, 05 Nov 2023 18:20:29 -0500 Message-ID: References: <87o7g9tj79.fsf@gnu.org> <47a54242-d331-5864-7b2c-f1990034091a@gmail.com> <83fs1k4vgt.fsf@gnu.org> Reply-To: Stefan Monnier Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="38034"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: Jim Porter , 66752@debbugs.gnu.org, tsdh@gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Nov 06 00:21:50 2023 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 1qzmRA-0009h5-Fa for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 06 Nov 2023 00:21:48 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qzmQp-0008U3-PI; Sun, 05 Nov 2023 18:21:27 -0500 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 1qzmQn-0008Ts-Pc for bug-gnu-emacs@gnu.org; Sun, 05 Nov 2023 18:21:25 -0500 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 1qzmQn-0001XG-Hi for bug-gnu-emacs@gnu.org; Sun, 05 Nov 2023 18:21:25 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qzmRO-0007NE-CM for bug-gnu-emacs@gnu.org; Sun, 05 Nov 2023 18:22:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 05 Nov 2023 23:22:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 66752 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 66752-submit@debbugs.gnu.org id=B66752.169922648528282 (code B ref 66752); Sun, 05 Nov 2023 23:22:02 +0000 Original-Received: (at 66752) by debbugs.gnu.org; 5 Nov 2023 23:21:25 +0000 Original-Received: from localhost ([127.0.0.1]:38375 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qzmQm-0007M6-N6 for submit@debbugs.gnu.org; Sun, 05 Nov 2023 18:21:25 -0500 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:10189) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qzmQl-0007Lu-6I for 66752@debbugs.gnu.org; Sun, 05 Nov 2023 18:21:23 -0500 Original-Received: from pmg2.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id BA49F80283; Sun, 5 Nov 2023 18:20:40 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1699226435; bh=HkoORCEClKznevsNyGoQSi0BMNM/4c/ThOfBkf9UTGI=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=BFXFmPY6kWHmTOcp3sakQ8K8b/TrEJJ5ixQoypZ3u5I2+8ISCtr0xKyhqaLHVFtbn J2xzA40VaVVc9+7MhagK/xHnU+xT6DJJFcOB+Tit7tTC+hzadV73astaiCC4LmAzCj zdbQRT2LBnlMQgEg1I2TzuNKWO9xhVW/6PPvOrTfQn0WDpQ0yi0PSE25CX4mKM+Lk/ YLUeSnJ8jvam8VlwT852mRoGbAWsR3axFuPu8NNmv3S84DfATKY3RoB0gAuJWGoHeN YY9tYsOSV4o2tOuWZa91jIFDV0TU8c9IwDaqkymwbCyrz7qWy3Gf6Y/h2SGHtbIKzi D5JEIvVjCgAeA== Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 8EBE480409; Sun, 5 Nov 2023 18:20:35 -0500 (EST) Original-Received: from pastel (unknown [45.72.195.71]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 5D0D1120270; Sun, 5 Nov 2023 18:20:35 -0500 (EST) In-Reply-To: <83fs1k4vgt.fsf@gnu.org> (Eli Zaretskii's message of "Sun, 05 Nov 2023 07:31:30 +0200") 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:273847 Archived-At: >> I'm not sure. The only example I saw for adding to >> 'thing-at-provider-alist' was for EWW (a major mode). I thought, "What >> if someone activated and deactivated 'bug-reference-mode' and then later >> added something to the default value of 'thing-at-provider-alist'?" It's a general problem we have in Emacs, indeed. We have solutions for it for the specific case of hooks (with `add/remove-hook` and their `local` argument), and for variables holding functions (with `add-function`), but not for anything else :-( I've played with the idea of adding a new set of functions to help major&minor modes set variables in a more declarative way, so that any sequence of enabling/disabling or major/minor modes would still result in "the right" value, and I even have some basic PoC code but nothing good enough for `master`. The basic idea would be something like: (changevar-add VAR FUNCTION &optional ID LOCAL PRIO) (changevar-remove VAR FUNCTION-OR-ID &optional LOCAL) where `changevar-add` conceptually does something akin to (set VAR (funcall FUNCTION (symbol-value VAR))) and you use `changevar-remove` to set it back to its "previous" value. But as it stands, you're trying to solve a problem in your code which affects pretty much every other minor mode out there, so I think it's OK to just disregard the problem, like everyone else has done until now. Maybe you can even get away with modifying the variable globally and not removing the entry when the mode is disabled. Stefan