unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: "Óscar Fuentes" <ofv@wanadoo.es>
To: help-gnu-emacs@gnu.org
Subject: select-frame-set-input-focus operates on wrong frame
Date: Mon, 14 Oct 2024 17:01:04 +0200	[thread overview]
Message-ID: <87a5f6wwy7.fsf@telefonica.net> (raw)

I have a frame named "pdf" to view files opened via emacsclient. This
code shows those files on the "pdf" frame (if it exists) when
`emacsclient -n somefile' is invoked:


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

(setq server-window 'ofv-display-buffer-pop-up-frame)


This works except select-frame-set-input-focus raises and sets focus to
the frame that had the focus before emacsclient was invoked.

I guess that the code that processes the emacsclient request in Emacs
sets the focus after the function contained in server-window is
invoked. How can I avoid this?




             reply	other threads:[~2024-10-14 15:01 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-14 15:01 Óscar Fuentes [this message]
2024-10-15  1:25 ` select-frame-set-input-focus operates on wrong frame Óscar Fuentes
2024-10-19 16:43 ` Stefan Monnier via Users list for the GNU Emacs text editor
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=87a5f6wwy7.fsf@telefonica.net \
    --to=ofv@wanadoo.es \
    --cc=help-gnu-emacs@gnu.org \
    /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).