From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: jakanakaevangeli@chiru.no Newsgroups: gmane.emacs.bugs Subject: bug#47150: [External] : Re: bug#47150: 28.0.50; Incorrect major-mode in minibuffer Date: Tue, 23 Mar 2021 08:18:45 +0100 Message-ID: <87lfaes5gq.fsf@miha-pc> References: <877dm9nsii.fsf@gmail.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="22662"; mail-complaints-to="usenet@ciao.gmane.io" Cc: "47150@debbugs.gnu.org" <47150@debbugs.gnu.org> To: Drew Adams Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Mar 23 08:19:28 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 1lObK2-0005n1-BN for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 23 Mar 2021 08:19:26 +0100 Original-Received: from localhost ([::1]:36032 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lObK1-0007aQ-9d for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 23 Mar 2021 03:19:25 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:57668) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lObJe-0007Zc-5d for bug-gnu-emacs@gnu.org; Tue, 23 Mar 2021 03:19:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:47870) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lObJd-0001Hz-UZ for bug-gnu-emacs@gnu.org; Tue, 23 Mar 2021 03:19:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lObJd-00087q-QF for bug-gnu-emacs@gnu.org; Tue, 23 Mar 2021 03:19:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: jakanakaevangeli@chiru.no Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 23 Mar 2021 07:19:01 +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.161648392831213 (code B ref 47150); Tue, 23 Mar 2021 07:19:01 +0000 Original-Received: (at 47150) by debbugs.gnu.org; 23 Mar 2021 07:18:48 +0000 Original-Received: from localhost ([127.0.0.1]:59416 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lObJQ-00087N-8O for submit@debbugs.gnu.org; Tue, 23 Mar 2021 03:18:48 -0400 Original-Received: from chiru.no ([142.4.209.132]:33796) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lObJO-00087D-05 for 47150@debbugs.gnu.org; Tue, 23 Mar 2021 03:18:46 -0400 Original-Received: from localhost (unknown [178.172.46.206]) by chiru.no (Postfix) with ESMTPSA id C249612801AE; Tue, 23 Mar 2021 07:18:44 +0000 (UTC) In-Reply-To: Drew Adams's message of "Mon, 22 Mar 2021 18:38:54 +0000 (11 hours, 50 minutes, 9 seconds ago)" 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:202879 Archived-At: >>> Yeah, I see that the doc string for `minibuffer-inactive-mode' >>> suggests that it's not used when the minibuffer is active. >>> And that's effectively the case, though the mode name might >>> not reflect it. There's _nothing to that mode_, apart from >>> its keymap, and its keymap is not used when the minibuffer >>> is active. So the mode is there in name only. >> >> I haven't checked whether its mode hook gets run, but I think it would >> (if anybody put any functions on it). > OK. But does the mode ever get turned off, > once it's turned on (at minibuffer creation > presumably)? > > I didn't think so. My impression has been that > the mode remains `minibuffer-inactive-mode'. >> [...] >> That's about the only thing I worry about (along with >> the possibility of using a mode hook - but we have that >> danger with minibuffer-inactive-mode-hook anyway, and >> it doesn't appear to have caused trouble, as yet.) > > I really don't see the mode hook (on any such mode) > being a problem in practice. > > Currently, the minibuffer is (I think) _always_ in > `minibuffer-inactive-mode'. Its mode hook only ever > kicks in when a minibuffer buffer is created. True, the mode doesn't normally switch to a different mode in 27.1, but on the other hand, the function `minibuffer-inactive-mode' does indeed get called on every minibuffer entry and exit (except for the first one, I think) and its hook gets run every time. The only thing Alan changed recently (for 28.1) was to instead call `fundamental-mode' on minibuffer entry and now wants to change this to call `minibuffer-mode'. As I see it, this is as small of a change as it can get. >>> What if the name of that mode was just `minibuffer' >>> or `foobar'? Would you think/feel the same way about >>> needing to add another mode? Seriously - please think >>> about this. >> >> Well the behaviour of a minibuffer is so utterly different when it is >> active, from when it is inactive (e.g., in a minibuffer-only frame) that >> having them share a major mode doesn't seem right. But I take the point. > > It's a mode for the minibuffer; that's all. > > Yes, the behavior's different when it's inactive vs > active - it's the key bindings. But the behavior's > different when you use `completing-read' from when > you use `read-string' or whatever - again, it's the > key bindings (keymaps). > > Should we have a different major mode for each kind > of active behavior - completing-read, read-file-name, > read-buffer, read-number, read-expression,... > > All of those behaviors are different - different > key binding. By your reasoning we should have > different major modes for them, no? I believe Stefan actually proposed something like that in a previous message from this thread when he said read-from-minibuffer could accept a major-mode/functionp argument. This would allow for straight-forward documentation of each different minibuffer usage in `C-h m', including mentioning the ability to use general editing commands. Besides, wouldn't it be cool to have syntax highlighting in `M-:'? I believe function eshell-command already does something like this, it puts the minibuffer into eshell-mode. Not to say that this comes without its own problems. For example, if a user binds current-local-map's RET key from a major mode's hook, he will not be able able to use RET to exit from a minibuffer in such a major mode. `eshell-command' works around this with a minor mode that binds C-g and RET to appropriate minibuffer commands but this solution isn't ideal in my opinion because the user's modifications to minibuffer-local-map aren't taken into account. Perhaps a better way to make a major mode for use in minibuffers is to derive it from an ordinary major mode and use an :after-hook to install a local keymap that is composed of minibuffer-local[-completion|-ns]-map and the current local map. > [...] > > Do we even know whether adding that major mode to their > lists would solve their problem? > >> I'm not familiar with any of the three packages cited >> by the OP, > > Nor am I. > >> but in previous discussions, we'd already been through >> talking about using `minibufferp'. > > Dunno what that was about. See previous: the minibuffer > has a major mode, `minibuffer-inactive-mode', doesn't it? > Why is that harder to handle than some other major mode? See above. Alan recently changed active minibuffers' major mode from `minibuffer-inactive-mode' to `fundamental-mode'.