Subject: bug#48674: Frames and minibuffer bug

From: Iris García <[email-masked]>
Date: Wed, 26 May 2021 13:23:42 +0200

Hi everyone, this is the first time I report a bug.
In order to reproduce the bug I did exactly the following:
1. Start emacs: emacs -Q
2. Paste the following code in the scratch buffer:
(defvar box-cursor t)

(defun test/set-cursor()
  "Set cursor in all frames depending on the active state."
  (interactive)
  (dolist (frame (frame-list))
    (with-selected-frame frame
      (if box-cursor
          (progn
            (modify-frame-parameters
             frame (list (cons 'cursor-type 'box)))
            (modify-frame-parameters
             frame (list (cons 'cursor-color "#00A9FE"))))
        (progn
          (modify-frame-parameters
           frame (list (cons 'cursor-type 'hbar)))
          (modify-frame-parameters
           frame (list (cons 'cursor-color "green")))
          )))))

(defun test/enter-minibuffer()
  (setq box-cursor nil)
  (test/set-cursor))

(defun test/exit-minibuffer()
  (setq box-cursor t)
  (test/set-cursor))

(add-hook 'minibuffer-setup-hook #'test/enter-minibuffer)
(add-hook 'minibuffer-exit-hook #'test/exit-minibuffer)

(server-start)
(make-frame)

;; Call M-x (execute-extended-command) and you will see:
;; It is not possible to write in the minibuffer
;; Killing the previously created frame seems to solve the issue.

3. M-x -> eval-buffer -> RET
4. M-x (The bug appears, it is not possible to write in the minibuffer)

Note:
As soon as the new frame is destroyed, it is possible again to write in the
minibuffer.

Info:
In GNU Emacs 28.0.50 (build 2, x86_64-pc-linux-gnu, GTK+ Version 3.24.29,
cairo version 1.17.4)
 of 2021-05-26 built on ryzen9
Repository revision: f4dc646e0d7fb673f3149836bb7299fba9539e80
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.12011000
System Description: Arch Linux

Configured using:
 'configure --with-native-compilation --with-mailutils --with-pop
 --with-x --with-json --with-xwidgets --with-imagemagick --with-cairo'

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

Important settings:
  value of $LC_ALL: en_US.UTF-8
  value of $LC_CTYPE: C
  value of $LC_MESSAGES: C
  value of $LANG: en_US.UTF-8
  locale-coding-system: utf-8-unix

Major mode: Lisp Interaction

Minor modes in effect:
  tooltip-mode: t
  global-eldoc-mode: t
  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 eieio eieio-core eieio-loaddefs
password-cache json map text-property-search time-date mm-decode
mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader
sendmail comp comp-cstr warnings subr-x rx cl-seq cl-macs cl-extra
help-mode seq byte-opt gv cl-loaddefs cl-lib bytecomp byte-compile cconv
rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils server
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 easymenu timer select scroll-bar mouse jit-lock
font-lock syntax 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
xwidget-internal dbusbind inotify lcms2 dynamic-setting
system-font-setting font-render-setting cairo move-toolbar gtk x-toolkit
x multi-tty make-network-process native-compile emacs)

Memory information:
((conses 16 88884 6685)
 (symbols 48 7886 1)
 (strings 32 22435 3140)
 (string-bytes 1 860986)
 (vectors 16 15992)
 (vector-slots 8 273880 13488)
 (floats 8 30 175)
 (intervals 56 499 0)
 (buffers 992 13))