From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.bugs Subject: bug#47150: [External] : bug#47150: 28.0.50; Incorrect major-mode in minibuffer Date: Mon, 12 Apr 2021 16:46:34 -0400 Message-ID: References: <0f564ae1-ab0a-4e0f-a436-68f29b71d8a9@www.fastmail.com> <8cbe7629-2091-45d3-9424-46444d7a4633@www.fastmail.com> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="39811"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: "47150@debbugs.gnu.org" <47150@debbugs.gnu.org>, Sheng Yang To: Alan Mackenzie Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Apr 12 22:47:58 2021 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 1lW3TR-000ADB-8o for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 12 Apr 2021 22:47:57 +0200 Original-Received: from localhost ([::1]:43252 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lW3TQ-0001it-4v for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 12 Apr 2021 16:47:56 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:46842) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lW3SY-0001VM-KK for bug-gnu-emacs@gnu.org; Mon, 12 Apr 2021 16:47:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:46674) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lW3SY-0006Vg-CL for bug-gnu-emacs@gnu.org; Mon, 12 Apr 2021 16:47:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lW3SY-0007ir-7e for bug-gnu-emacs@gnu.org; Mon, 12 Apr 2021 16:47:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 12 Apr 2021 20:47:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 47150 X-GNU-PR-Package: emacs Original-Received: via spool by 47150-submit@debbugs.gnu.org id=B47150.161826041029119 (code B ref 47150); Mon, 12 Apr 2021 20:47:02 +0000 Original-Received: (at 47150) by debbugs.gnu.org; 12 Apr 2021 20:46:50 +0000 Original-Received: from localhost ([127.0.0.1]:58220 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lW3SL-0007ZD-HS for submit@debbugs.gnu.org; Mon, 12 Apr 2021 16:46:50 -0400 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:42844) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lW3SJ-0007U3-Sh for 47150@debbugs.gnu.org; Mon, 12 Apr 2021 16:46:48 -0400 Original-Received: from pmg1.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 550671001D2; Mon, 12 Apr 2021 16:46:42 -0400 (EDT) Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 170AD100040; Mon, 12 Apr 2021 16:46:36 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1618260396; bh=nK4/7wcElqujNXZfLAwpuU8FyUh5DlBokFvF2tOvnVY=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=DaRXj00Pl/yvCMqTazAaog1uKIlLZgjxmv0ZwaE0DRRj+CivHFb02+qJ9Q5Jj6qrp lQkgeeC/c/y3tNFsJqXFhVv2sgQasp5+B9/LhLtj3ZTzghNaYUhVhwDaUp7u2tBEOs +PbR2GHHaDNHmfEdhWTgruJ1W80Q5smLacE+E6yMP8V8pi50XT8eA53HeK2OZGfP+s +GNk7R1uLk9GKyavoCZOsvRPTuQ9AobOIufTX0/P/5ahkbL3CU7JCqEguFhLiFmgC2 OpCOyUsa/wSikeVEz8Cx7L161KExsFdzSb0HyoXFx8TcKjxoJPVt4VmQgdRT/LNpjB nwGib/UsJZCFA== Original-Received: from alfajor (104-222-126-84.cpe.teksavvy.com [104.222.126.84]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 8FAAD1204F6; Mon, 12 Apr 2021 16:46:35 -0400 (EDT) In-Reply-To: (Alan Mackenzie's message of "Mon, 12 Apr 2021 18:34:34 +0000") 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:203938 Archived-At: > OK, what you say is true, what I said above is also true - active > minibuffers ran in minibuffer-inactive-mode That was true "in name only" (i.e. only the value of the variable `major-mode` reflected that). >> The keymap and the hook are the main two features of >> `minibuffer-inactive-mode`. > Yes. Possibly they're the only features. Pretty much, yes. > Am I right in thinking that your main worry is the hook not getting > called at the end of every MB action? No. My worries are: - not having the minibuffer-inactive-mode-map active when the minibuffer is inactive. - running minibuffer-inactive-mode-hook at other times than when the minibuffer becomes inactive. >> > The idea here is to avoid the proliferation of unneeded major modes. >> Major modes are cheap. There is no problem with proliferation. > That's not true - the OP has found a problem, in that some minor modes > switch themselves on when (memq major-mode foo-mode-list). > The current situation, fundamental-mode (active), > minibuffer-inactive-mode (inactive) is causing problems with that > scheme, hence this bug. Their code was buggy/naive, will be broken no matter what we choose to do (except for sticking to what we had in Emacs<28), and is easy to fix in a backward compatible way using `minibufferp`. So I don't think this matters very much. Most cases of (eq major-mode ) are bugs waiting to bite you. > How about having just minibuffer-mode, and calling it at the end of > every MB action (as was previously done with minibuffer-inactive-mode), > but not at the start of a MB action? This will call the mode hook at > the same times as the m-inactive-m-hook used to be called, and reset the > MB's keymap to the inactive map at the same time. IOW just renaming `minibuffer-inactive-mode` to `minibuffer-mode` and calling it one extra time at the very beginning? Technically, it won't break any of my uses, of course, but then it leads to rather counter-intuitive situations where "the keymap of `minibuffer-mode`" is almost never used (it's only active when the minibuffer is inactive), "the hook of `minibuffer-mode`" is run not when entering a minibuffer but when leaving it, ... Also, there's a natural desire to occasionally use other major modes in the minibuffer (e.g. for `M-:`), so it would be very natural to make them derived modes of `minibuffer-mode` except that it would then inherit from a keymap which makes no sense in an active minibuffer. It just doesn't seem right at all. What's wrong with just making a new mode (define-derived-mode minibuffer-mode nil "Minibuffer" "Mode used inside minibuffers.") and using that instead of `fundamental-mode`. Stefan