Subject: Re: bug#25521: 26.0.50; After (make-frame '((name . "foo"))) (select-frame-by-name "foo") doesn't see the frame

From: [email-masked]
Date: Thu, 26 Jan 2017 21:02:41 -0500

"Alex (QWxleA)" <[email-masked]> writes:
>
> Ah, sorry, did not try that. Your above mentioned suggestion works. As I
> needed the name to be set for my window-manager, I ended up with the following (but it
> also works without (name . "foo")):
>
> (defun qw ()
>   (interactive) 
>   (select-frame (make-frame '((name . "foo") 
>                               (width . 120)
>                               (height . 25))))
>   (org-agenda))
>
> This is perfect, it does the same thing as:
>
> (defun qw ()
>   (interactive)
>   (make-frame '( (name . "foo")
>                 (width . 120)
>                 (height . 25)))
>   (sleep-for 0.00134)
>   (select-frame-by-name "foo") 
>   (org-agenda))
>
> But without the time-delay, so for my use it works, and is shorter to
> boot, excellent!

Thanks for confirming.

> Select-frame-by-name is a bit slow, when called right after make-frame, which might be
> a bug or not.

select-frame-by-name only selects frames that are on the current
display, so it doesn't work for frames that haven't been selected yet.
Until recently, Emacs would busy wait until the frame becomes visible,
now that it doesn't, you need to add the wait in lisp code.

Eli Zaretskii <[email-masked]> writes:
>
> I wonder whether we should reinstate a wait there, but make it limited
> so that it never infloops.  Otherwise, these issues will continue to
> haunt us and the users.

This case can be solved in a simpler way, and in the other case
(Bug#25511), I believe Martin was saying something similar, so I think
it would be a bit premature to add the busy wait again.

For select-frame-by-name specifically, we could make it check
non-visible frames as well, though I'm inclined to just mark this as
notabug/wontfix.