help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

select-frame-set-input-focus operates on wrong frame


From: Óscar Fuentes
Subject: select-frame-set-input-focus operates on wrong frame
Date: Mon, 14 Oct 2024 17:01:04 +0200
User-agent: Gnus/5.13 (Gnus v5.13)

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 via email to

[Prev in Thread] Current Thread [Next in Thread]