Subject: Re: 28.0.50; regression in commit c7c154bb, minibuffer is not closed after opening a file

From: Alan Mackenzie <[email-masked]>
Date: Sun, 31 Jan 2021 11:50:57 +0000

Hello, Platon.

On Sun, Jan 31, 2021 at 11:54:24 +0300, Platon Pronko wrote:
> Hi!

> > No problem, but I don't think you did.  There were real bugs connected
> > with input methods, and I think your initial scenario highlighted one of
> > these bugs.

> I'm glad to hear that!

> > It hasn't gone away for me.  

> This is quite strange. (minibufferp) guard was supposed to avoid running
> any code whatsoever on minibuffer, so there shouldn't be any calls
> to activate-input-method and associated bugs shouldn't be triggered.

> Here's the code I'm talking about, just in case:

> (define-minor-mode dvorak-minor-mode "Use english-dvorak input method." :lighter nil
>    (if (and dvorak-minor-mode (not (minibufferp)))
>      (activate-input-method "english-dvorak")))
> (define-global-minor-mode global-dvorak-mode dvorak-minor-mode dvorak-minor-mode)
> (global-dvorak-mode t)

Apologies, I'd not paid enough attention to your test code.  With the
(minibufferp) check, the bug indeed doesn't show itself.

However, I think users ought to be able to use input methods in
minibuffers too.

What was triggering the bug without the (minibufferp) check was the
minibuffer's transition from fundamental-mode to
minibuffer-inactive-mode.  A change in major mode triggers a call to
global minor modes.  Here, the activate-input-method causes "guidance"
to be displayed on the mode line and an infinite wait to start.  This is
normally OK, because the user's command has just been completed, but
this isn't the case when a minibuffer has just been used.

So I've committed a patch which suppresses the display of "guidance" in
an expired minibuffer.  The aim is that you can omit the (minibufferp)
check from your code if you want, and have the input method working in
minibuffers.

Could you please try out the new code, and let me know whether it's
working properly, or what's still not quite right.  Then I can either
close the bug or start fixing it again.  Thanks!

> Best regards,
> Platon Pronko

-- 
Alan Mackenzie (Nuremberg, Germany).