unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* select-frame-set-input-focus operates on wrong frame
@ 2024-10-14 15:01 Ó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
  0 siblings, 2 replies; 4+ messages in thread
From: Óscar Fuentes @ 2024-10-14 15:01 UTC (permalink / raw)
  To: help-gnu-emacs

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?




^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-10-20 12:51 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2024-10-20 12:51   ` Óscar Fuentes

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