]> git.eshelyaron.com Git - emacs.git/commitdiff
Don't turn on flymake-mode any more than is needed
authorJoão Távora <joaotavora@gmail.com>
Sun, 22 Jul 2018 18:07:43 +0000 (19:07 +0100)
committerJoão Távora <joaotavora@gmail.com>
Sun, 22 Jul 2018 18:07:47 +0000 (19:07 +0100)
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

index 49a1f3d496b7610a5fdea31a32345f2b7434225c..cb9a5ed0515a13ec9325b24ce8aa3ea7c82c51d9 100644 (file)
@@ -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