]> git.eshelyaron.com Git - emacs.git/commitdiff
Ensure that new emacsclient frames has focus
authorLars Ingebrigtsen <larsi@gnus.org>
Mon, 7 Dec 2020 13:29:46 +0000 (14:29 +0100)
committerLars Ingebrigtsen <larsi@gnus.org>
Mon, 7 Dec 2020 13:29:46 +0000 (14:29 +0100)
* lisp/server.el (server-execute): Focus the frame here...
(server-switch-buffer): Instead of here (bug#15469).  This ensures
that the frame has focus if Emacs is querying the user about
something when opening a file (for instance "Revert from file?").

lisp/server.el

index b1b27e33b2e824ebc7c9fafcf2394c7d70fd1c5d..651f801a237652318a8db802cc67f33d209b6c90 100644 (file)
@@ -1334,6 +1334,8 @@ The following commands are accepted by the client:
   ;; inhibit-quit flag, which is good since `commands' (as well as
   ;; find-file-noselect via the major-mode) can run arbitrary code,
   ;; including code that needs to wait.
+  (when (and frame server-raise-frame)
+    (select-frame-set-input-focus frame))
   (with-local-quit
     (condition-case err
         (let ((buffers (server-visit-files files proc nowait)))
@@ -1686,9 +1688,7 @@ be a cons cell (LINENUMBER . COLUMNNUMBER)."
                   (switch-to-buffer next-buffer))
              ;; After all the above, we might still have ended up with
              ;; a minibuffer/dedicated-window (if there's no other).
-             (error (pop-to-buffer next-buffer)))))))
-    (when server-raise-frame
-      (select-frame-set-input-focus (window-frame)))))
+             (error (pop-to-buffer next-buffer)))))))))
 
 ;;;###autoload
 (defun server-save-buffers-kill-terminal (arg)