From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Lars Ingebrigtsen Newsgroups: gmane.emacs.bugs Subject: bug#54074: 29.0.50; Feature request emacs keymap-set and minor-modes Date: Tue, 22 Feb 2022 14:22:49 +0100 Message-ID: <87fsobc9xy.fsf@gnus.org> References: <87ley5iclc.fsf.ref@aol.com> <87ley5iclc.fsf@aol.com> <87czjhmior.fsf@gnus.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="4322"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) Cc: Ergus , 54074@debbugs.gnu.org To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Feb 22 14:42:19 2022 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 1nMVQp-0000va-Pl for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 22 Feb 2022 14:42:19 +0100 Original-Received: from localhost ([::1]:51948 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nMVQn-0000Wn-NG for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 22 Feb 2022 08:42:17 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:47140) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nMV98-0003QD-Pd for bug-gnu-emacs@gnu.org; Tue, 22 Feb 2022 08:24:03 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:46402) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nMV98-0006P0-Ea for bug-gnu-emacs@gnu.org; Tue, 22 Feb 2022 08:24:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nMV98-0004kp-9o for bug-gnu-emacs@gnu.org; Tue, 22 Feb 2022 08:24:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Lars Ingebrigtsen Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 22 Feb 2022 13:24:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 54074 X-GNU-PR-Package: emacs Original-Received: via spool by 54074-submit@debbugs.gnu.org id=B54074.164553619018211 (code B ref 54074); Tue, 22 Feb 2022 13:24:02 +0000 Original-Received: (at 54074) by debbugs.gnu.org; 22 Feb 2022 13:23:10 +0000 Original-Received: from localhost ([127.0.0.1]:40299 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nMV8B-0004jW-8K for submit@debbugs.gnu.org; Tue, 22 Feb 2022 08:23:10 -0500 Original-Received: from quimby.gnus.org ([95.216.78.240]:51158) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nMV8A-0004ip-29 for 54074@debbugs.gnu.org; Tue, 22 Feb 2022 08:23:02 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date: References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=j5lthXz8OprY/DS3XSO+7FlvBysgQhDkFQfnrEBlkiY=; b=MR4RZpoREjZg28V8OytnNRSYRh zQ5RFtuPzJrsizg8BkePA0FO/kgw5aoymf7uaYS2en483+L3kFddaZOwn5H3X8+Wirpihxumt1XUs 0On99y/A+Hc8DDS/s15K3BFJz3JCmXpTL0Afpd6ttj0s6uekyfiUyI2ae3umsEOUyoAM=; Original-Received: from [84.212.220.105] (helo=giant) by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nMV80-0005e6-Gj; Tue, 22 Feb 2022 14:22:55 +0100 Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAABGdBTUEAALGPC/xhBQAAACBj SFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAGFBMVEW0pIzo07P34L34 5MTbyKqXindUS0T/////d/kTAAAAAWJLR0QHFmGI6wAAAAd0SU1FB+YCFg0LO1lcqqAAAAG7SURB VDjLdZRBcsMwCEU900n3EC5gJSewcwFcpets5HU39v2P0A9IcpO2rCQ9IfiAPQyciFNK84sNBtJv mwy8Gk4u/wJ7irpJbuYxsFXfLfcCG4ZTKfPkQAAkK9+3vazlUTrAqZDK8rm7raVMBgivKBzy+fQe ZG8euG0+yTxWAw8Ho8JBkNQBwmOMXDWAoy8Dy9hkcA2+79szONfY675NB5AD7AF0VJybwEsFWwNZ 1WpCfELcreyleLoBoCNzL6KiiA88BSGolyZovObMzDP6AVCviXXm6g5pNkBZqw4ApMg8cjxFrYnS pTroDWTxnqlUkKODECJqLVNU7fYBYNeQFe7hOHzT7S2A3UdDKABjSOYG/KlRKJbnBsinoSsnvgRA c+2tBlCDmpV68Lw0kJeWruVrAiqg86UBzImXOEIIHx4meqFY0qHcVIjGFKNEPTicLUiddgzS8ZSo V8pzRXE8eE0KUsjmHksKgTV1+IRAIHyU+HBiQ7aXkJOtcQE8T0qSYy5kacDCWz96PIBHrTkqvgD6 YzYvFfjWdYRXA+oTkTDaUj+VAHZoM/XzL2CgztqzGdA/AD979P8Q8TcQI9y9ApBXFwAAACV0RVh0 ZGF0ZTpjcmVhdGUAMjAyMi0wMi0yMlQxMzoxMTo1OSswMDowMNYVbtYAAAAldEVYdGRhdGU6bW9k aWZ5ADIwMjItMDItMjJUMTM6MTE6NTkrMDA6MDCnSNZqAAAAAElFTkSuQmCC X-Now-Playing: Cannon's Jug Stompers's _Anthology of American Folk Music: Songs (1)_: "Minglewood Blues" In-Reply-To: (Stefan Monnier's message of "Mon, 21 Feb 2022 16:22:23 -0500") 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" Xref: news.gmane.io gmane.emacs.bugs:227426 Archived-At: Stefan Monnier writes: >> I'm not sure I understand the use case. Isn't the way to do this just >> to have my-mode add itself to isearch-mode-hook, and then have my-mode >> have a minor mode keymap with the prefix it uses? > > I think the use case is basically any minor mode which currently uses > `define-key` in its body to modify some other package's keymap. But why do that instead of using a minor mode? I think many cases where packages do this, it's because the idea didn't really occur to the people that did the implementation. > I think we should provide an API to do that meaningfully. I.e. instead > of having a minor mode just bluntly set a variable, associate with each > global var a pair (VAL . FUNS) of a base value and a list of functions, > where the effective value (the one that should be stored in the > `symbol-value`, barring intervention from code that disregards the new > API) is (FUN1 (FUN2 (... VAL))). As Eli noted, isn't this kinda `add-variable-watcher'? But: > The minor mode can then add/remove a function from the list, and just as > is the case with `add-hook`, `add-function`, etc... it will correctly > handle the case where the additions/removals are not nested. My feeling is that this would be both too complicated for most people writing modes, and it would be really confusing for us people that have to try to figure out what's actually going on, and finally, values in Emacs Lisp are mutable, so it won't work reliably anyway. -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no