emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/eglot cbb1da42be 12/33: Let eglot-flymake-backend be in


From: Stefan Kangas
Subject: [elpa] externals/eglot cbb1da42be 12/33: Let eglot-flymake-backend be in flymake-d-functions even if Eglot off
Date: Sat, 8 Jan 2022 12:30:49 -0500 (EST)

branch: externals/eglot
commit cbb1da42be65fe7e6105d4638b889180f2a1b17d
Author: João Távora <joaotavora@gmail.com>
Commit: João Távora <joaotavora@gmail.com>

    Let eglot-flymake-backend be in flymake-d-functions even if Eglot off
    
    This is useful when using  eglot-stay-out-of and a pattern like:
    
       (defun my/js-mode-hook ()
         (add-hook 'flymake-diagnostic-functions 'some-eslint-backend nil t))
         (setq-local eglot-stay-out-of '(flymake))
         (add-hook 'flymake-diagnostic-functions 'eglot-flymake-backend nil t))
    
       (add-hook 'js-mode-hook 'my/js-mode-hook)
    
    Then, _both_ backends will run unconditionally, but Eglot backend only
    actually reports diagnostics if Eglot is on.
    
    * eglot.el (eglot-flymake-backend): If buffer isn't being managed
    by Eglot, behave as a noop.
---
 eglot.el | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/eglot.el b/eglot.el
index 0f367fd220..71f7d7ea59 100644
--- a/eglot.el
+++ b/eglot.el
@@ -2089,10 +2089,13 @@ Calls REPORT-FN (or arranges for it to be called) when 
the server
 publishes diagnostics.  Between calls to this function, REPORT-FN
 may be called multiple times (respecting the protocol of
 `flymake-backend-functions')."
-  (setq eglot--current-flymake-report-fn report-fn)
-  ;; Report anything unreported
-  (when eglot--unreported-diagnostics
-    (eglot--report-to-flymake (cdr eglot--unreported-diagnostics))))
+  (cond (eglot--managed-mode
+         (setq eglot--current-flymake-report-fn report-fn)
+         ;; Report anything unreported
+         (when eglot--unreported-diagnostics
+           (eglot--report-to-flymake (cdr eglot--unreported-diagnostics))))
+        (t
+         (funcall report-fn nil))))
 
 (defun eglot--report-to-flymake (diags)
   "Internal helper for `eglot-flymake-backend'."



reply via email to

[Prev in Thread] Current Thread [Next in Thread]