Subject: bug#77973: 30.1; `which-key' breaks `string-rectangle' after popup shown

From: Alcor <[email-masked]>
Date: Mon, 21 Apr 2025 22:00:10 +0200

1. Start Emacs (30.1) with emacs -Q
2. Hit M-< or C-<home> to go to the beginning of the scratch buffer
3. Hit C-x SPC (`rectangle-mark-mode') and do any rectangular selection
4. Do M-x which-key-mode to enable which-key mode
5. Hit C-x (wait for the which-key popup to appear) *then* continue with
r t (`string-rectangle')

Expected result:

The `string-rectangle' command behaves normally, as specified in the
manual.

Observed result:

The following error messages are printed in the *Messages* buffer:

region-beginning: Lisp nesting exceeds ‘max-lisp-eval-depth’: 1601
rectangle--region-beginning: Lisp nesting exceeds ‘max-lisp-eval-depth’

In GNU Emacs 30.1 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.41,
 cairo version 1.18.0) of 2025-03-17 built on lcy02-amd64-052
Repository revision: dcd52678035563e43e3ed80dadb9f3970536f692
Repository branch: master
System Description: Ubuntu 24.04.2 LTS

Configured using:
 'configure --prefix=/snap/emacs/current/usr --with-x-toolkit=gtk3
 --without-xaw3d --with-modules --with-cairo
 --with-native-compilation=aot --with-pgtk --with-xinput2
 --with-tree-sitter 'CFLAGS=-isystem
 /build/emacs/parts/emacs/install/usr/include -isystem
 /build/emacs/parts/emacs/install/usr/include/x86_64-linux-gnu -isystem
 /build/emacs/stage/usr/include -O2' 'CPPFLAGS=-isystem
 /build/emacs/parts/emacs/install/usr/include -isystem
 /build/emacs/parts/emacs/install/usr/include/x86_64-linux-gnu -isystem
 /build/emacs/stage/usr/include'
 'LDFLAGS=-L/build/emacs/parts/emacs/install/lib
 -L/build/emacs/parts/emacs/install/usr/lib
 -L/build/emacs/parts/emacs/install/lib/x86_64-linux-gnu
 -L/build/emacs/parts/emacs/install/usr/lib/x86_64-linux-gnu
 -L/build/emacs/stage/usr/lib''

Configured features:
ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ JPEG
LCMS2 LIBOTF LIBSELINUX LIBSYSTEMD LIBXML2 MODULES NATIVE_COMP NOTIFY
INOTIFY PDUMPER PGTK PNG RSVG SECCOMP SOUND SQLITE3 THREADS TIFF
TOOLKIT_SCROLL_BARS TREE_SITTER WEBP XIM GTK3 ZLIB

Important settings:
  value of $LANG: de_DE.UTF-8
  value of $XMODIFIERS: @im=ibus
  locale-coding-system: utf-8-unix

Major mode: Messages

Minor modes in effect:
  which-key-mode: t
  winner-mode: t
  windmove-mode: t
  recentf-mode: t
  global-auto-revert-mode: t
  fido-vertical-mode: t
  icomplete-vertical-mode: t
  icomplete-mode: t
  fido-mode: t
  desktop-save-mode: t
  minibuffer-depth-indicate-mode: t
  delete-selection-mode: t
  repeat-mode: t
  override-global-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  show-paren-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  minibuffer-regexp-mode: t
  buffer-read-only: t
  column-number-mode: t
  line-number-mode: t
  indent-tabs-mode: t
  transient-mark-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t

Load-path shadows:
/home/alcor/.emacs.d/elpa/erc-5.6.1snapshot0.20250416.173013/erc hides /snap/emacs/current/usr/share/emacs/30.1/lisp/erc/erc
/home/alcor/.emacs.d/elpa/erc-5.6.1snapshot0.20250416.173013/erc-xdcc hides /snap/emacs/current/usr/share/emacs/30.1/lisp/erc/erc-xdcc
/home/alcor/.emacs.d/elpa/erc-5.6.1snapshot0.20250416.173013/erc-truncate hides /snap/emacs/current/usr/share/emacs/30.1/lisp/erc/erc-truncate
/home/alcor/.emacs.d/elpa/erc-5.6.1snapshot0.20250416.173013/erc-track hides /snap/emacs/current/usr/share/emacs/30.1/lisp/erc/erc-track
/home/alcor/.emacs.d/elpa/erc-5.6.1snapshot0.20250416.173013/erc-status-sidebar hides /snap/emacs/current/usr/share/emacs/30.1/lisp/erc/erc-status-sidebar
/home/alcor/.emacs.d/elpa/erc-5.6.1snapshot0.20250416.173013/erc-stamp hides /snap/emacs/current/usr/share/emacs/30.1/lisp/erc/erc-stamp
/home/alcor/.emacs.d/elpa/erc-5.6.1snapshot0.20250416.173013/erc-spelling hides /snap/emacs/current/usr/share/emacs/30.1/lisp/erc/erc-spelling
/home/alcor/.emacs.d/elpa/erc-5.6.1snapshot0.20250416.173013/erc-speedbar hides /snap/emacs/current/usr/share/emacs/30.1/lisp/erc/erc-speedbar
/home/alcor/.emacs.d/elpa/erc-5.6.1snapshot0.20250416.173013/erc-sound hides /snap/emacs/current/usr/share/emacs/30.1/lisp/erc/erc-sound
/home/alcor/.emacs.d/elpa/erc-5.6.1snapshot0.20250416.173013/erc-services hides /snap/emacs/current/usr/share/emacs/30.1/lisp/erc/erc-services
/home/alcor/.emacs.d/elpa/erc-5.6.1snapshot0.20250416.173013/erc-sasl hides /snap/emacs/current/usr/share/emacs/30.1/lisp/erc/erc-sasl
/home/alcor/.emacs.d/elpa/erc-5.6.1snapshot0.20250416.173013/erc-ring hides /snap/emacs/current/usr/share/emacs/30.1/lisp/erc/erc-ring
/home/alcor/.emacs.d/elpa/erc-5.6.1snapshot0.20250416.173013/erc-replace hides /snap/emacs/current/usr/share/emacs/30.1/lisp/erc/erc-replace
/home/alcor/.emacs.d/elpa/erc-5.6.1snapshot0.20250416.173013/erc-pcomplete hides /snap/emacs/current/usr/share/emacs/30.1/lisp/erc/erc-pcomplete
/home/alcor/.emacs.d/elpa/erc-5.6.1snapshot0.20250416.173013/erc-page hides /snap/emacs/current/usr/share/emacs/30.1/lisp/erc/erc-page
/home/alcor/.emacs.d/elpa/erc-5.6.1snapshot0.20250416.173013/erc-notify hides /snap/emacs/current/usr/share/emacs/30.1/lisp/erc/erc-notify
/home/alcor/.emacs.d/elpa/erc-5.6.1snapshot0.20250416.173013/erc-nicks hides /snap/emacs/current/usr/share/emacs/30.1/lisp/erc/erc-nicks
/home/alcor/.emacs.d/elpa/erc-5.6.1snapshot0.20250416.173013/erc-networks hides /snap/emacs/current/usr/share/emacs/30.1/lisp/erc/erc-networks
/home/alcor/.emacs.d/elpa/erc-5.6.1snapshot0.20250416.173013/erc-netsplit hides /snap/emacs/current/usr/share/emacs/30.1/lisp/erc/erc-netsplit
/home/alcor/.emacs.d/elpa/erc-5.6.1snapshot0.20250416.173013/erc-menu hides /snap/emacs/current/usr/share/emacs/30.1/lisp/erc/erc-menu
/home/alcor/.emacs.d/elpa/erc-5.6.1snapshot0.20250416.173013/erc-match hides /snap/emacs/current/usr/share/emacs/30.1/lisp/erc/erc-match
/home/alcor/.emacs.d/elpa/erc-5.6.1snapshot0.20250416.173013/erc-log hides /snap/emacs/current/usr/share/emacs/30.1/lisp/erc/erc-log
/home/alcor/.emacs.d/elpa/erc-5.6.1snapshot0.20250416.173013/erc-loaddefs hides /snap/emacs/current/usr/share/emacs/30.1/lisp/erc/erc-loaddefs
/home/alcor/.emacs.d/elpa/erc-5.6.1snapshot0.20250416.173013/erc-list hides /snap/emacs/current/usr/share/emacs/30.1/lisp/erc/erc-list
/home/alcor/.emacs.d/elpa/erc-5.6.1snapshot0.20250416.173013/erc-lang hides /snap/emacs/current/usr/share/emacs/30.1/lisp/erc/erc-lang
/home/alcor/.emacs.d/elpa/erc-5.6.1snapshot0.20250416.173013/erc-join hides /snap/emacs/current/usr/share/emacs/30.1/lisp/erc/erc-join
/home/alcor/.emacs.d/elpa/erc-5.6.1snapshot0.20250416.173013/erc-imenu hides /snap/emacs/current/usr/share/emacs/30.1/lisp/erc/erc-imenu
/home/alcor/.emacs.d/elpa/erc-5.6.1snapshot0.20250416.173013/erc-identd hides /snap/emacs/current/usr/share/emacs/30.1/lisp/erc/erc-identd
/home/alcor/.emacs.d/elpa/erc-5.6.1snapshot0.20250416.173013/erc-ibuffer hides /snap/emacs/current/usr/share/emacs/30.1/lisp/erc/erc-ibuffer
/home/alcor/.emacs.d/elpa/erc-5.6.1snapshot0.20250416.173013/erc-goodies hides /snap/emacs/current/usr/share/emacs/30.1/lisp/erc/erc-goodies
/home/alcor/.emacs.d/elpa/erc-5.6.1snapshot0.20250416.173013/erc-fill hides /snap/emacs/current/usr/share/emacs/30.1/lisp/erc/erc-fill
/home/alcor/.emacs.d/elpa/erc-5.6.1snapshot0.20250416.173013/erc-ezbounce hides /snap/emacs/current/usr/share/emacs/30.1/lisp/erc/erc-ezbounce
/home/alcor/.emacs.d/elpa/erc-5.6.1snapshot0.20250416.173013/erc-desktop-notifications hides /snap/emacs/current/usr/share/emacs/30.1/lisp/erc/erc-desktop-notifications
/home/alcor/.emacs.d/elpa/erc-5.6.1snapshot0.20250416.173013/erc-dcc hides /snap/emacs/current/usr/share/emacs/30.1/lisp/erc/erc-dcc
/home/alcor/.emacs.d/elpa/erc-5.6.1snapshot0.20250416.173013/erc-compat hides /snap/emacs/current/usr/share/emacs/30.1/lisp/erc/erc-compat
/home/alcor/.emacs.d/elpa/erc-5.6.1snapshot0.20250416.173013/erc-common hides /snap/emacs/current/usr/share/emacs/30.1/lisp/erc/erc-common
/home/alcor/.emacs.d/elpa/erc-5.6.1snapshot0.20250416.173013/erc-capab hides /snap/emacs/current/usr/share/emacs/30.1/lisp/erc/erc-capab
/home/alcor/.emacs.d/elpa/erc-5.6.1snapshot0.20250416.173013/erc-button hides /snap/emacs/current/usr/share/emacs/30.1/lisp/erc/erc-button
/home/alcor/.emacs.d/elpa/erc-5.6.1snapshot0.20250416.173013/erc-backend hides /snap/emacs/current/usr/share/emacs/30.1/lisp/erc/erc-backend
/home/alcor/.emacs.d/elpa/erc-5.6.1snapshot0.20250416.173013/erc-autoaway hides /snap/emacs/current/usr/share/emacs/30.1/lisp/erc/erc-autoaway

Features:
(shadow sort mail-extr gnus-msg gnus-art mm-uu mml2015 mm-view mml-smime
smime gnutls dig gnus-sum shr pixel-fill kinsoku url-file svg dom
gnus-group gnus-undo gnus-start gnus-dbus dbus xml gnus-cloud nnimap
nnmail mail-source utf7 nnoo parse-time iso8601 gnus-spec gnus-int
gnus-range gnus-win compile comint ansi-osc ansi-color comp-run emacsbug
message yank-media puny dired dired-loaddefs rfc822 mml mml-sec epa
derived epg rfc6068 epg-config mm-decode mm-bodies mm-encode mail-parse
rfc2231 mailabbrev gmm-utils mailheader shortdoc rect help-fns
radix-tree disp-table whitespace display-line-numbers goto-addr
thingatpt sendmail rfc2047 rfc2045 ietf-drums gnus nnheader gnus-util
text-property-search time-date mail-utils range mm-util mail-prsvr xdg
doom-themes-ext-org doom-themes-ext-visual-bell face-remap
doom-nord-theme pcase doom-themes doom-themes-base which-key cus-edit pp
finder-inf use-package-ensure winner ring windmove recentf tree-widget
wid-edit autorevert filenotify icomplete desktop frameset mb-depth
delsel repeat cus-load edmacro kmacro use-package-bind-key bind-key
easy-mmode use-package-core site-start comp comp-cstr cl-extra help-mode
comp-common warnings rx doom-themes-autoloads erc-irc-format-autoloads
info erc-autoloads markdown-mode-autoloads rainbow-delimiters-autoloads
package browse-url url url-proxy url-privacy url-expand url-methods
url-history url-cookie generate-lisp-file url-domsuf url-util mailcap
url-handlers url-parse auth-source cl-seq eieio eieio-core cl-macs icons
password-cache json subr-x map byte-opt gv bytecomp byte-compile
url-vars cl-loaddefs cl-lib rmc iso-transl tooltip cconv eldoc paren
electric uniquify ediff-hook vc-hooks lisp-float-type elisp-mode mwheel
term/pgtk-win pgtk-win term/common-win touch-screen pgtk-dnd tool-bar
dnd fontset image regexp-opt fringe tabulated-list replace newcomment
text-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 nadvice seq simple cl-generic
indonesian philippine 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 emoji-zwj charscript charprop case-table epa-hook
jka-cmpr-hook help abbrev obarray oclosure cl-preloaded button loaddefs
theme-loaddefs faces cus-face macroexp files window text-properties
overlay sha1 md5 base64 format env code-pages mule custom widget keymap
hashtable-print-readable backquote threads dbusbind inotify
dynamic-setting system-font-setting font-render-setting cairo gtk pgtk
lcms2 multi-tty move-toolbar make-network-process native-compile emacs)

Memory information:
((conses 16 542067 30817) (symbols 48 25725 0)
 (strings 32 143008 4180) (string-bytes 1 4469408) (vectors 16 36971)
 (vector-slots 8 446370 9839) (floats 8 584 8701) (intervals 56 468 0)
 (buffers 992 11))