From 693e4282510f8ba8d70e6144707907ba9fbd56b0 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jo=C3=A3o=20T=C3=A1vora?= Date: Sun, 22 Jul 2018 19:07:43 +0100 Subject: [PATCH] Don't turn on flymake-mode any more than is needed If flymake-mode is in eglot--managed-mode-hook, it will be called even if eglot--managed-mode is being turned off, which could be problematic because it triggers a check if flymake-start-on-flymake-mode is t. * eglot.el (eglot--managed-mode): Turn on flymake-mode and eldoc-mode here. GitHub-reference: close https://github.com/joaotavora/eglot/issues/44 --- lisp/progmodes/eglot.el | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el index 49a1f3d496b..cb9a5ed0515 100644 --- a/lisp/progmodes/eglot.el +++ b/lisp/progmodes/eglot.el @@ -700,7 +700,9 @@ If optional MARKERS, make markers." (add-hook 'change-major-mode-hook 'eglot--managed-mode-onoff nil t) (add-function :before-until (local 'eldoc-documentation-function) #'eglot-eldoc-function) - (add-function :around (local 'imenu-create-index-function) #'eglot-imenu)) + (add-function :around (local 'imenu-create-index-function) #'eglot-imenu) + (flymake-mode 1) + (eldoc-mode 1)) (t (remove-hook 'flymake-diagnostic-functions 'eglot-flymake-backend t) (remove-hook 'after-change-functions 'eglot--after-change t) @@ -738,9 +740,6 @@ Reset in `eglot--managed-mode-onoff'.") (setf (eglot--managed-buffers server) (delq buf (eglot--managed-buffers server))))))))) -(add-hook 'eglot--managed-mode-hook 'flymake-mode) -(add-hook 'eglot--managed-mode-hook 'eldoc-mode) - (defun eglot--current-server () "Find the current logical EGLOT server." (or -- 2.39.2