Subject: Re: bug#60527: 30.0.50; Typing SPC in a minibuffer with completion

From: Jim Porter <[email-masked]>
Date: Wed, 4 Jan 2023 11:11:40 -0800

On 1/3/2023 11:05 AM, Stefan Monnier via Bug reports for GNU Emacs, the 
Swiss army knife of text editors wrote:
> I wish the SPC binding to `minibuffer-complete-word` would go because it
> makes it hard to type SPC in the minibuffer whenever there's completion.
[snip]
> So my favorite option is indeed to simply remove this binding.
> Those few users who like it and use it (probably long-time users of
> Emacs) could easily get it back with:
> 
>      (define-key minibuffer-local-completion-map
>                  " " 'minibuffer-complete-word)

This would be my preference too, so long as there were an easy way for 
people who like the old behavior to get it back. (Would it be sufficient 
to just put that snippet in a NEWS entry?)

> Another option is to change `minibuffer-complete-word` so that instead
> of beeping "No match", it inserts a SPC when there's no completion and
> `require-match` is nil (after checking that the command was invoked via
> SPC).

I'm not sure about this one; if it were hard to predict ahead of time 
what SPC will do, then it could be even less usable. For example, if I 
want to insert a literal space, I might press SPC only to find that it 
performs completion. So then I have to undo and press "C-q SPC" to get 
what I want.

> Yet another option would be to let callers of `completing-read` indicate
> that it's likely the users will sometimes want to type a SPC character
> for this specific minibuffer input (i.e. `completing-read` would then
> use a map like `minibuffer-local-filename-completion-map`).

If this would work, it seems like a good compromise. But do the callers 
know for sure how this should be set? If they got it wrong, then it 
might have the effect of annoying both users who like the current 
binding and those who don't. (Similar to the above, there's not much 
worse than a button that *sometimes* does what you want.)

As yet another option, how about doing something like the first one, but 
gate it behind a defcustom? That provides an easy way for users to get 
the behavior they want, without having to deal with figuring out 
minibuffer bindings. (If we had a time machine, the defcustom probably 
wouldn't be necessary, but I think it makes sense to provide an easy 
escape hatch if changing some long-standing feature.)