Subject: bug#77985: 31.0.50; infinite loop in `make-frame-names-alist`

From: Al Haji-Ali <[email-masked]>
Date: Sun, 27 Apr 2025 08:40:27 +0100

On 26/04/2025, Eli Zaretskii wrote:
>>      (while (not (eq frame current-frame))
>> 	(setq frame (next-frame frame 0)))
>> 
>> can loop.
>
> Sure, but here the loop is explicit in the looping program, so it
> could prevent the infloop.

Indeed, I thought a loop like this would work without changing the documented behaviour as far as I can see:

,----
| (let ((current-frame (selected-frame))
|       prev-frame
|       frame)
|   (while (and
|           (not (eq frame current-frame))
|           (not (eq frame prev-frame)))
|     (setq
|      prev-frame frame
|      frame (next-frame frame 0))))
`----

On 26/04/2025, martin rudalics wrote:
> - Have t for the MINIFRAME argument of 'next-frame' cycle through all
>    frames including invisible and 'no-other-frame frames.  Simple but
>    this would mean that 'make-frame-names-alist' would return the names
>    of invisible frames too (it could filter them out afterwards).

In my emacs, `make-frame-names-alist` passes 0 to next-frame, but `delete-other-frames` already passes t. 

-- Al