unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / Atom feed
* bug#45792: 28.0.50; regression in commit c7c154bb, minibuffer is not closed after opening a file
@ 2021-01-11 16:09 Platon Pronko
  2021-01-12  9:06 ` martin rudalics
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Platon Pronko @ 2021-01-11 16:09 UTC (permalink / raw)
  To: 45792; +Cc: Alan Mackenzie

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.

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

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

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

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)

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.



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'

Configured features:
XPM JPEG TIFF GIF PNG RSVG CAIRO SOUND GPM DBUS GLIB NOTIFY INOTIFY ACL
GNUTLS LIBXML2 FREETYPE HARFBUZZ M17N_FLT LIBOTF ZLIB
TOOLKIT_SCROLL_BARS GTK3 X11 XDBE XIM MODULES THREADS LIBSYSTEMD JSON
PDUMPER LCMS2

Important settings:
   value of $LC_TIME: en_SE.UTF-8
   value of $LANG: en_US.UTF-8
   locale-coding-system: utf-8-unix

Major mode: Text

Minor modes in effect:
   global-dvorak-mode: t
   dvorak-minor-mode: t
   tooltip-mode: t
   global-eldoc-mode: t
   electric-indent-mode: t
   mouse-wheel-mode: t
   tool-bar-mode: t
   menu-bar-mode: t
   file-name-shadow-mode: t
   global-font-lock-mode: t
   font-lock-mode: t
   blink-cursor-mode: t
   auto-composition-mode: t
   auto-encryption-mode: t
   auto-compression-mode: t
   line-number-mode: t
   transient-mark-mode: t

Load-path shadows:
None found.

Features:
(shadow sort mail-extr emacsbug message rmc puny dired dired-loaddefs
rfc822 mml mml-sec epa derived epg epg-config gnus-util rmail
rmail-loaddefs auth-source cl-seq eieio eieio-core cl-macs
eieio-loaddefs password-cache json map text-property-search time-date
subr-x seq byte-opt gv bytecomp byte-compile cconv mm-decode mm-bodies
mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail
rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils quail help-mode
easymenu cl-loaddefs cl-lib easy-mmode iso-transl tooltip eldoc electric
uniquify ediff-hook vc-hooks lisp-float-type mwheel term/x-win x-win
term/common-win x-dnd tool-bar dnd fontset image regexp-opt fringe
tabulated-list replace newcomment text-mode elisp-mode lisp-mode
prog-mode register page tab-bar menu-bar rfn-eshadow isearch timer
select scroll-bar mouse jit-lock font-lock syntax facemenu font-core
term/tty-colors frame minibuffer cl-generic cham georgian utf-8-lang
misc-lang vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms
cp51932 hebrew greek romanian slovak czech european ethiopic indian
cyrillic chinese composite charscript charprop case-table epa-hook
jka-cmpr-hook help simple abbrev obarray cl-preloaded nadvice button
loaddefs faces cus-face macroexp files window text-properties overlay
sha1 md5 base64 format env code-pages mule custom widget
hashtable-print-readable backquote threads dbusbind inotify lcms2
dynamic-setting font-render-setting cairo move-toolbar gtk x-toolkit x
multi-tty make-network-process emacs)

Memory information:
((conses 16 61568 4854)
  (symbols 48 7179 1)
  (strings 32 21381 1187)
  (string-bytes 1 655960)
  (vectors 16 13820)
  (vector-slots 8 173393 10673)
  (floats 8 22 45)
  (intervals 56 265 0)
  (buffers 984 13))





^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#45792: 28.0.50; regression in commit c7c154bb, minibuffer is not closed after opening a file
  2021-01-11 16:09 bug#45792: 28.0.50; regression in commit c7c154bb, minibuffer is not closed after opening a file Platon Pronko
@ 2021-01-12  9:06 ` martin rudalics
  2021-01-12 10:29   ` Platon Pronko
  2021-01-12 19:00 ` Alan Mackenzie
  2021-01-16 16:36 ` Alan Mackenzie
  2 siblings, 1 reply; 6+ messages in thread
From: martin rudalics @ 2021-01-12  9:06 UTC (permalink / raw)
  To: Platon Pronko, 45792; +Cc: Alan Mackenzie

 > 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"))))

I understand that this may have worked for you over the past decades but
it's not really clean.  Why don't you just use "(minibufferp)" here?  If
the problem persists, we then can dig further.

Thanks, martin





^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#45792: 28.0.50; regression in commit c7c154bb, minibuffer is not closed after opening a file
  2021-01-12  9:06 ` martin rudalics
@ 2021-01-12 10:29   ` Platon Pronko
  0 siblings, 0 replies; 6+ messages in thread
From: Platon Pronko @ 2021-01-12 10:29 UTC (permalink / raw)
  To: martin rudalics, 45792; +Cc: Alan Mackenzie

Yes, of course minibufferp is much cleaner - I just wasn't aware of its existence :)

But the problem still persists if I refactor the code to use it. Here's the code I used:

(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)

Actually even removing (not (minibufferp)) altogether has no effect on the issue.

Best regards,
Platon Pronko





^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#45792: 28.0.50; regression in commit c7c154bb, minibuffer is not closed after opening a file
  2021-01-11 16:09 bug#45792: 28.0.50; regression in commit c7c154bb, minibuffer is not closed after opening a file Platon Pronko
  2021-01-12  9:06 ` martin rudalics
@ 2021-01-12 19:00 ` Alan Mackenzie
  2021-01-16 16:36 ` Alan Mackenzie
  2 siblings, 0 replies; 6+ messages in thread
From: Alan Mackenzie @ 2021-01-12 19:00 UTC (permalink / raw)
  To: Platon Pronko; +Cc: 45792

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





^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#45792: 28.0.50; regression in commit c7c154bb, minibuffer is not closed after opening a file
  2021-01-11 16:09 bug#45792: 28.0.50; regression in commit c7c154bb, minibuffer is not closed after opening a file Platon Pronko
  2021-01-12  9:06 ` martin rudalics
  2021-01-12 19:00 ` Alan Mackenzie
@ 2021-01-16 16:36 ` Alan Mackenzie
  2021-01-17  7:50   ` Platon Pronko
  2 siblings, 1 reply; 6+ messages in thread
From: Alan Mackenzie @ 2021-01-16 16:36 UTC (permalink / raw)
  To: Platon Pronko; +Cc: acm, 45792

Hello again, Platon.

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.

What is happening is that Emacs is getting caught on a (sit-for 1000000)
in quail-minibuffer-message.  The good news is that it will respond
eventually.  The bad news is that 11½ days is a rather sluggish response
time.

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

This commit has triggered the problem, which was there all along.  It is
not the cause of it.

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

More precisely, any input method which uses quail-activate to start
itself.  For testing, I actually switched to "german-postfix" in your
recipe, so as to be able actually to use Emacs after applying it.  ;-)

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

That may be so, but it is the trigger for an existing problem rather
than being the problem itself.

> 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)

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

Just as a matter of interest, you can write that more easily as
./src/emacs -Q -l ~/.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.

What happens is that read-minibuffer does its thing, then a C function
read_minibuf_unwind calls minibuffer-inactive-mode since the minibuffer
is no longer live.  This mode change calls (run-mode-hooks
'minibuffer-inactive-mode-hook), which as a side effect runs the hook
after-change-major-mode-hook, onto which define-global-mode has put
global-dvorak-mode-enable-in-buffers.  g-d-m-e-i-b calls
dvorak-minor-mode (for the expired minibuffer) which calls
activate-input-method, ....., then quail-minibuffer-message.

This last function is the one with the million second timeout.

Clearly, changing mode to minibuffer-inactive-mode shouldn't trigger the
input method mechanisms.  I'm not sure at the moment how to stop this
happening, so I can't as yet close the bug.

> 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

[ .... ]

-- 
Alan Mackenzie (Nuremberg, Germany).





^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#45792: 28.0.50; regression in commit c7c154bb, minibuffer is not closed after opening a file
  2021-01-16 16:36 ` Alan Mackenzie
@ 2021-01-17  7:50   ` Platon Pronko
  0 siblings, 0 replies; 6+ messages in thread
From: Platon Pronko @ 2021-01-17  7:50 UTC (permalink / raw)
  To: Alan Mackenzie; +Cc: 45792

Hi!

I'm terribly sorry, apparently I wasted a lot of your time.

I tested (minibufferp) refactoring again and it seems that when I
did that for the previous email I messed something up. When I ran the code today
the issue went away.

Original reason for " *Minibuf-0*" test in dvorak-minor-mode was to
stop emacs --daemon from hanging on startup. (now that you explained about
quail-minibuffer-message and sit-for, I assume that's was the reason why that was happening)

But the buffer that was triggering the current issue is called " *Minibuf-1*", so it
passes the test and activate-input-method is called.

I had no idea that activate-input-method was dangerous when called in
global minor modes, but that's probably just the way it is.

Again, terribly sorry for wasting your time on what turned out to be
a configuration issue.

> Just as a matter of interest, you can write that more easily as
> ./src/emacs -Q -l ~/.emacs.d/init.el.

Thanks, that's a useful shortcut!

Best regards,
Platon Pronko





^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2021-01-17  7:50 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-11 16:09 bug#45792: 28.0.50; regression in commit c7c154bb, minibuffer is not closed after opening a file Platon Pronko
2021-01-12  9:06 ` martin rudalics
2021-01-12 10:29   ` Platon Pronko
2021-01-12 19:00 ` Alan Mackenzie
2021-01-16 16:36 ` Alan Mackenzie
2021-01-17  7:50   ` Platon Pronko

unofficial mirror of bug-gnu-emacs@gnu.org 

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://yhetil.org/emacs-bugs/0 emacs-bugs/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 emacs-bugs emacs-bugs/ https://yhetil.org/emacs-bugs \
		bug-gnu-emacs@gnu.org
	public-inbox-index emacs-bugs

Example config snippet for mirrors.
Newsgroups are available over NNTP:
	nntp://news.yhetil.org/yhetil.emacs.bugs
	nntp://news.gmane.io/gmane.emacs.bugs


AGPL code for this site: git clone http://ou63pmih66umazou.onion/public-inbox.git