Subject: Re: bug#69140: 30.0.50; [elpa/vertico] Emacs with vertico-mode freezes if font is too big

From: Aleksandr Vityazev <[email-masked]>
Date: Wed, 21 Feb 2024 19:15:57 +0300

On 2024-02-15 22:29, Po Lu wrote:

> Eli Zaretskii <[email-masked]> writes:
>
>>> Cc: [email-masked]
>>> Date: Thu, 15 Feb 2024 14:23:28 +0300
>>> From:  Aleksandr Vityazev via "Bug reports for GNU Emacs,
>>>  the Swiss army knife of text editors" <[email-masked]>
>>> 
>>> Vertico version 1.7, version 1.3 has also been tested, is incompatible
>>> with the changes made by the commit -
>>> caea0c1649d1df96b811c1388fde396e66bc356b. This commit was found via
>>> git bisect.
>>> 
>>> To reproduce:
>>> 1. Run emacs -Q
>>> 2. M-x load-library vertico RET
>>> 3. M-x vertico-mode RET
>>> 4. Set a large font, the following is suitable for my 13 inch monitor:
>>> (set-face-attribute 'default nil :family "monospace" :height 440)
>>> 5. Call M-x
>>> Emacs should freeze, sometimes you can unfreeze it with a few presses
>>> of C-g
>>
>> Thanks, but why do you think the bug is in Emacs and not in vertico?
>> The fact that you can unfreeze Emacs with C-g indicates that some Lisp
>> is involved in what probably is an infloop.  At the very least, could
>> you please catch a Lisp backtrace when you type C-g, so that we could
>> see what Lisp is involved?  Also, what exactly does vertico do with
>> resizing the mini-window, and what should be the value of
>> resize-mini-windows for reproducing this issue.
>
> Also, if at all possible, please attempt to interrupt Emacs while it is
> so frozen under GDB until you have collected several unique backtraces
> containing entries for `redisplay_internal', and post them here.

No backtrace yet, but I found another reproducer without vertico, all
used packages are from Emacs core.

Configured using:
 'configure
 CONFIG_SHELL=/gnu/store/v9p25q9l5nnaixkhpap5rnymmwbhf9rp-bash-minimal-5.1.16/bin/bash
 SHELL=/gnu/store/v9p25q9l5nnaixkhpap5rnymmwbhf9rp-bash-minimal-5.1.16/bin/bash
 --prefix=/gnu/store/1gij4r65kyw6lm2m9clqpraigivjgzq9-emacs-test-test
 --enable-fast-install --with-pgtk --without-libsystemd
 --enable-checking=yes,glyphs --enable-check-lisp-object-type
 --with-native-compilation=no --with-cairo --with-modules
 --disable-build-details 'CFLAGS=-O0 -g3''

1. Run emacs -Q
2. Paste the following code into the scratch buffer and run eval-buffer
--8<---------------cut here---------------start------------->8---
(load-library "transient")
(fido-vertical-mode 1)
(defclass test-transient-multi (transient-option) ()
  ((key         :initform "-")
   (argument    :initform "-")
   (multi-value :initform t)
   (reader      :initform completing-read-multiple))
  "")

(transient-define-argument test:--1 ()
  :description "test1"
  :class 'transient-option
  :shortarg "a"
  :argument "test1=")

(transient-define-argument test:--2 ()
  :description "test2"
  :class 'test-transient-multi
  :key "r"
  :argument "test2"
  :multi-value t
  :prompt "Test2: "
  :reader (lambda (prompt _initial-input _history)
            (completing-read-multiple
             prompt
             '("nonsdlslde" "slsdl" "2323" "ldslld" "30203" "llx" "ldslsd"))))

(transient-define-argument test:--3 ()
  :description "test3"
  :class 'test-transient-multi
  :key "l"
  :argument "test3"
  :multi-value t
  :prompt "Test3: "
  :reader (lambda (prompt _initial-input _history)
            (completing-read-multiple
             prompt
             '("nonsdlslde" "slsdl" "2323" "ldslld" "30203" "llx" "ldslsd"))))

(transient-define-argument test:--4 ()
  :description "test4"
  :class 'test-transient-multi
  :key "y"
  :argument "test4"
  :multi-value t
  :prompt "Test4: "
  :reader (lambda (prompt _initial-input _history)
            (completing-read-multiple
             prompt
             '("nonsdlslde" "slsdl" "2323" "ldslld" "30203" "llx" "ldslsd"))))

(defun test-hello ()
  ""
  (interactive)
  (message "hello"))

(transient-define-prefix test-dispatch ()
  ["Test parameters"
   (test:--1)
   (test:--2)
   (test:--3)
   (test:--4)
   ]
  [["Search"
    ("s" "test" test-hello)]])
(set-face-attribute 'default nil :family "monospace" :height 440)
--8<---------------cut here---------------end--------------->8---

3. M-x test-dispatch
4. Try playing with the parameters test1, test2, test3, test4. At the
same time you can put Emacs into full screen mode and back into windowed
mode, where it will occupy half of the screen. Initially, calling the
parameters test1, test2, test3, test4 in the transient window will be
delayed and everything can be canceled with C-g, after a few repetitions
Emacs hangs completely.

-- 
Best regards,
Aleksandr Vityazev