unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: jakanakaevangeli@chiru.no
To: Drew Adams <drew.adams@oracle.com>
Cc: "47150@debbugs.gnu.org" <47150@debbugs.gnu.org>
Subject: bug#47150: [External] : Re: bug#47150: 28.0.50; Incorrect major-mode in minibuffer
Date: Tue, 23 Mar 2021 08:18:45 +0100	[thread overview]
Message-ID: <87lfaes5gq.fsf@miha-pc> (raw)
In-Reply-To: Drew Adams's message of "Mon, 22 Mar 2021 18:38:54 +0000 (11 hours, 50 minutes, 9 seconds ago)"

>>> 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'.





      parent reply	other threads:[~2021-03-23  7:18 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-15  0:57 bug#47150: 28.0.50; Incorrect major-mode in minibuffer styang
2021-03-15  1:02 ` bug#47150: Emacs bug#47150 " Sheng Yang
2021-03-15  7:59 ` bug#47150: " Alan Mackenzie
2021-03-15 18:15   ` Sheng Yang
2021-03-15 21:30     ` Alan Mackenzie
2021-03-15 21:58       ` Sheng Yang
2021-03-22 15:12         ` Alan Mackenzie
2021-03-22 15:52           ` bug#47150: [External] : " Drew Adams
2021-03-22 16:27             ` Alan Mackenzie
2021-03-22 17:09               ` Drew Adams
     [not found]                 ` <878s6ft5ze.fsf_-_@miha-pc>
2021-03-22 18:38                   ` bug#47150: [External] : " Drew Adams
2021-03-22 21:57                 ` bug#47150: [External] : " Alan Mackenzie
2021-03-22 23:06                   ` Drew Adams
2021-03-23 13:05                     ` Alan Mackenzie
2021-03-23 15:44                       ` Drew Adams
2021-03-22 18:12         ` Stefan Monnier
2021-03-22 18:08       ` Stefan Monnier
2021-03-22 18:40         ` bug#47150: [External] : " Drew Adams
2021-03-22 19:30           ` Stefan Monnier
2021-03-22 19:42             ` Drew Adams
2021-03-22 20:11               ` Stefan Monnier
2021-03-22 21:36                 ` Drew Adams
2021-04-09  8:57                   ` Sheng Yang
2021-04-12 10:18                     ` Alan Mackenzie
2021-04-12 12:02                       ` Sheng Yang
2021-04-12 14:01                         ` Stefan Monnier
2021-04-12 16:15                           ` Alan Mackenzie
2021-04-12 17:10                             ` Stefan Monnier
2021-04-12 18:34                               ` Alan Mackenzie
2021-04-12 20:46                                 ` Stefan Monnier
2021-04-18 11:14                                   ` Alan Mackenzie
2021-04-18 15:22                                     ` Stefan Monnier
2021-04-19  9:33                                       ` Alan Mackenzie
2021-04-19 17:30                                         ` Alan Mackenzie
2021-04-19 18:22                                           ` Stefan Monnier
2021-04-19 19:18                                             ` Sheng Yang
2021-04-19 19:35                                               ` Stefan Monnier
2021-04-19 19:47                                                 ` Sheng Yang
2021-04-19 20:36                                                   ` Stefan Monnier
2021-04-19 20:42                                                     ` Sheng Yang
2021-04-20 10:25                                               ` Alan Mackenzie
2021-03-22 19:42         ` Alan Mackenzie
2021-03-22 20:03           ` Stefan Monnier
2021-03-22 18:24 ` bug#47150: [External] : " jakanakaevangeli
2021-03-23  7:18 ` jakanakaevangeli [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87lfaes5gq.fsf@miha-pc \
    --to=jakanakaevangeli@chiru.no \
    --cc=47150@debbugs.gnu.org \
    --cc=drew.adams@oracle.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).