[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: select-frame-set-input-focus operates on wrong frame
From: |
Stefan Monnier |
Subject: |
Re: select-frame-set-input-focus operates on wrong frame |
Date: |
Sat, 19 Oct 2024 12:43:18 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) |
> (defun ofv-display-buffer-pop-up-frame (buffer &rest alist)
> (unless (catch 'out
> (dolist (frame (frame-list))
> (when (and (equal (frame-parameter frame 'display)
> (frame-parameter nil 'display))
> (string= "pdf" (frame-parameter frame 'name)))
> (with-selected-frame frame
> (select-frame-set-input-focus frame)
> (display-buffer-full-frame buffer '())
> (throw 'out t)))))
> (display-buffer-full-frame buffer alist)))
As you discovered, using something like `select-frame-set-input-focus`
from within a `with-selected-frame` is not a good idea.
I don't know why you did that, because it seems contradictory, I suspect
it was an oversight.
Regarding the focus itself (which is a subtly different concept than the
selected frame), the situation is very messy and what happens in which
case can also depend on your window-manager (or the part of your OS
which takes on that responsibility) as well as timing. 🙁
> (setq server-window 'ofv-display-buffer-pop-up-frame)
I recommend #' here to clarify that this is intended to set the var to
a function.
Stefan