summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lisp/progmodes/eglot.el7
1 files changed, 4 insertions, 3 deletions
diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el
index 2679773c117..758be488680 100644
--- a/lisp/progmodes/eglot.el
+++ b/lisp/progmodes/eglot.el
@@ -1155,12 +1155,13 @@ INTERACTIVE is t if called interactively."
(cl-labels
((maybe-connect
()
- (remove-hook 'post-command-hook #'maybe-connect nil)
(eglot--when-live-buffer buffer
+ (remove-hook 'post-command-hook #'maybe-connect t)
(unless eglot--managed-mode
(apply #'eglot--connect (eglot--guess-contact))))))
- (when buffer-file-name
- (add-hook 'post-command-hook #'maybe-connect 'append nil)))))
+ (when (and this-command
+ buffer-file-name)
+ (add-hook 'post-command-hook #'maybe-connect 'append t)))))
(defun eglot-events-buffer (server)
"Display events buffer for SERVER.