diff --git a/eglot.el b/eglot.el index 3d1b19c9..b858c306 100644 --- a/eglot.el +++ b/eglot.el @@ -1047,8 +1047,9 @@ INTERACTIVE is t if called interactively." () (remove-hook 'post-command-hook #'maybe-connect nil) (eglot--when-live-buffer buffer - (unless eglot--managed-mode - (apply #'eglot--connect (eglot--guess-contact)))))) + (unless (eglot-current-server) + (apply #'eglot--connect (eglot--guess-contact))) + (eglot--maybe-activate-editing-mode)))) (when buffer-file-name (add-hook 'post-command-hook #'maybe-connect 'append nil))))) @@ -1723,9 +1724,6 @@ If it is activated, also signal textDocument/didOpen." (eglot--managed-mode) (eglot--signal-textDocument/didOpen)))) -(add-hook 'find-file-hook 'eglot--maybe-activate-editing-mode) -(add-hook 'after-change-major-mode-hook 'eglot--maybe-activate-editing-mode) - (defun eglot-clear-status (server) "Clear the last JSONRPC error for SERVER." (interactive (list (eglot--current-server-or-lose)))