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

From: Alan Mackenzie <[email-masked]>
Date: Tue, 12 Jan 2021 19:00:14 +0000

Hello, Platon.

Thanks for such a high quality bug report, and thanks for investigating
it as far as you have done.

On Mon, Jan 11, 2021 at 19:09:53 +0300, Platon Pronko wrote:
> When I open a file using C-x C-f, minibuffer does not close after I
> finish typing the filename - current window does not change at all,
> minibuffer stays open (as if Emacs "froze").  Pressing C-g or any other
> key unfreezes the window and file is displayed.

It seems to be a redisplay problem.  Emacs is doing everything to visit
the new file _except_ the final redisplay action.  Any keypress (or mouse
action) triggers that missing redisplay.

> I bisected the problem to commit c7c154bb, "Fix incompleteness in the
> implementation of minibuffer-follows-selected-frame".

OK.

> Problem is somehow related to the fact that I use dvorak input method.

I spent yesterday evening trying to narrow it down more.  The
define-global-minor-mode causes dvorak-minor-mode to get added to three
hooks.  Of these, either (most likely both of them, too) of
change-major-mode-hook or after-change-major-mode-hook will cause the bug
when dvorak-minor-mode is added to it.

> The problem goes away if I comment out the section under "We've exited
> the recursive edit without an error" in minibuf.c.

I'm trying to work out, from my notes, exactly why I put that section of
code in.  I might well just take it out.  But it would be good to
understand the mechanism of the bug, first.

> Steps to reproduce:

> 1. init.el contents:

> (define-minor-mode dvorak-minor-mode "Use english-dvorak input method." :lighter nil
>    (if
>      (not (string= " *Minibuf-0*" (buffer-name (current-buffer))))
>      (if dvorak-minor-mode (activate-input-method "english-dvorak"))))
> (define-global-minor-mode global-dvorak-mode dvorak-minor-mode dvorak-minor-mode)
> (global-dvorak-mode t)

As you've said yourself in another post, the testing for " *Minibuf-0*"
doesn't seem to effect the bug.  So, it would appear to be the adding of
dvorak-minor-mode to these two hooks.  (See above.)

> 2. Start emacs with: ./src/emacs -Q --eval '(load-file "~/.emacs.d/init.el")'

> 3. Type C-x C-f, type in some text-file filename, press Return.

> 4. Observe no file being opened and "[DV@]" in minibuffer.

As already said, the file probably is being opened, it just isn't getting
displayed.  I'll be carrying on looking at this.

> In GNU Emacs 28.0.50 (build 15, x86_64-pc-linux-gnu, GTK+ Version 3.24.24, cairo version 1.17.4)
>   of 2021-01-11 built on the-big-maker
> Repository revision: c7c154bb5756e0ae71d342c5d8aabf725877f186
> Repository branch: HEAD
> Windowing system distributor 'The X.Org Foundation', version 11.0.12010000
> System Description: Arch Linux

> Configured using:
>   'configure --prefix=/usr --sysconfdir=/etc --libexecdir=/usr/lib
>   --localstatedir=/var --mandir=/usr/share/man --with-gameuser=:games
>   --with-sound=alsa --with-modules --without-gconf --without-gsettings
>   --with-x-toolkit=gtk3 --without-xaw3d'

[ .... ]

-- 
Alan Mackenzie (Nuremberg, Germany).