Subject: Re: bug#46583: 28.0.50; nested minibuffers

From: Juri Linkov <[email-masked]>
Date: Wed, 17 Feb 2021 20:48:08 +0200

> I save a file that is read-only, so I am asked
>
>   File phones is write-protected; try to save anyway? (yes or no) 
>
> Then I type C-x b and it tries to read a buffer name.
>
> But enable-recursive-minibuffers is nil!

Let-binding enable-recursive-minibuffers temporarily to t was necessary
to fix bug#17272/bug#19064.

So when the minibuffer is already activated, and a minibuffer command
wants to ask a question, displaying another recursive minibuffer with
such question should override the value of enable-recursive-minibuffers.

But you found the problem that is a side-effect of this fix.

The problem is that currently it's impossible for a command
to override enable-recursive-minibuffers only for its own use,
while keeping it disabled for more recursive minibuffer calls.

Maybe enable-recursive-minibuffers should support a numeric value
that is decremented in every recursive minibuffer calls
until reaching zero value that disables more recursive calls?

Then a command that needs to use the recursive minibuffer
could let-bind enable-recursive-minibuffers to 1,
allowing this only for own use, while it will be 0
in more recursive calls.