unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Stefan Monnier via Users list for the GNU Emacs text editor <help-gnu-emacs@gnu.org>
To: help-gnu-emacs@gnu.org
Subject: Re: select-frame-set-input-focus operates on wrong frame
Date: Sat, 19 Oct 2024 12:43:18 -0400	[thread overview]
Message-ID: <jwvwmi482ur.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: 87a5f6wwy7.fsf@telefonica.net

> (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




  parent reply	other threads:[~2024-10-19 16:43 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-14 15:01 select-frame-set-input-focus operates on wrong frame Óscar Fuentes
2024-10-15  1:25 ` Óscar Fuentes
2024-10-19 16:43 ` Stefan Monnier via Users list for the GNU Emacs text editor [this message]
2024-10-20 12:51   ` Óscar Fuentes

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=jwvwmi482ur.fsf-monnier+emacs@gnu.org \
    --to=help-gnu-emacs@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).