[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/eglot af9dcad 10/22: Take over Flymake and Eldoc comple
From: |
João Távora |
Subject: |
[elpa] externals/eglot af9dcad 10/22: Take over Flymake and Eldoc completely while managing buffers |
Date: |
Sat, 5 Jan 2019 09:31:03 -0500 (EST) |
branch: externals/eglot
commit af9dcad2e677fa7eb59faa39561f3c60f4e886d7
Author: João Távora <address@hidden>
Commit: João Távora <address@hidden>
Take over Flymake and Eldoc completely while managing buffers
Take a pragmatic approach and override all other Flymake and Eglot
backends while Eglot is enabled. Restore previous values after
eglot-shutdown.
Certainly cases might arise where using more than one datasource
besides LSP while Eglot is managing the buffer is useful. But
currently contrary, it confuses users enabling Eglot in buffers that
already have flymake/eldoc backends configured.
The reasons are slightly different for Eldoc and Flymake:
- For Eldoc the :before-until strategy only makes sense for
synchronous backends, which Eglot isn't. This conflicts with
python.el default python-eldoc-function, which is also asynchronous.
- For Flymake, the default backends in Emacs (python-mode, c-mode, and
a few others) are mainly repetitions of what LSP does. The global
value is still run though (in case you want to put, say, a
spell-checking backend there).
* eglot.el (eglot--saved-bindings, eglot--setq-saving): New
helpers.
(eglot--managed-mode): Use them.
---
eglot.el | 18 ++++++++++++------
1 file changed, 12 insertions(+), 6 deletions(-)
diff --git a/eglot.el b/eglot.el
index 60dad45..7f3eea4 100644
--- a/eglot.el
+++ b/eglot.el
@@ -1118,6 +1118,14 @@ and just return it. PROMPT shouldn't end with a
question mark."
(defvar-local eglot--current-flymake-report-fn nil
"Current flymake report function for this buffer")
+(defvar-local eglot--saved-bindings nil
+ "Bindings saved by `eglot--setq-saving'.")
+
+(defmacro eglot--setq-saving (symbol binding)
+ `(progn (push (cons ',symbol (symbol-value ',symbol))
+ eglot--saved-bindings)
+ (setq-local ,symbol ,binding)))
+
(define-minor-mode eglot--managed-mode
"Mode for source buffers managed by some EGLOT project."
nil nil eglot-mode-map
@@ -1125,7 +1133,6 @@ and just return it. PROMPT shouldn't end with a question
mark."
(eglot--managed-mode
(add-hook 'after-change-functions 'eglot--after-change nil t)
(add-hook 'before-change-functions 'eglot--before-change nil t)
- (add-hook 'flymake-diagnostic-functions 'eglot-flymake-backend nil t)
(add-hook 'kill-buffer-hook 'eglot--signal-textDocument/didClose nil t)
(add-hook 'kill-buffer-hook 'eglot--managed-mode-onoff nil t)
(add-hook 'before-revert-hook 'eglot--signal-textDocument/didClose nil t)
@@ -1136,8 +1143,8 @@ and just return it. PROMPT shouldn't end with a question
mark."
(add-hook 'change-major-mode-hook 'eglot--managed-mode-onoff nil t)
(add-hook 'post-self-insert-hook 'eglot--post-self-insert-hook nil t)
(add-hook 'pre-command-hook 'eglot--pre-command-hook nil t)
- (add-function :before-until (local 'eldoc-documentation-function)
- #'eglot-eldoc-function)
+ (eglot--setq-saving eldoc-documentation-function #'eglot-eldoc-function)
+ (eglot--setq-saving flymake-diagnostic-functions '(eglot-flymake-backend
t))
(add-function :around (local 'imenu-create-index-function) #'eglot-imenu)
(flymake-mode 1)
(eldoc-mode 1))
@@ -1154,9 +1161,8 @@ and just return it. PROMPT shouldn't end with a question
mark."
(remove-hook 'change-major-mode-hook #'eglot--managed-mode-onoff t)
(remove-hook 'post-self-insert-hook 'eglot--post-self-insert-hook t)
(remove-hook 'pre-command-hook 'eglot--pre-command-hook t)
- (remove-function (local 'eldoc-documentation-function)
- #'eglot-eldoc-function)
- (remove-function (local 'imenu-create-index-function) #'eglot-imenu)
+ (cl-loop for (var . saved-binding) in eglot--saved-bindings
+ do (set (make-local-variable var) saved-binding))
(setq eglot--current-flymake-report-fn nil))))
(defvar-local eglot--cached-current-server nil
- [elpa] externals/eglot ef95839 05/22: Adjust active param highlighting in first line of signature (3/3), (continued)
- [elpa] externals/eglot ef95839 05/22: Adjust active param highlighting in first line of signature (3/3), João Távora, 2019/01/05
- [elpa] externals/eglot 64c7605 03/22: Adjust active param highlighting in first line of signature (1/3), João Távora, 2019/01/05
- [elpa] externals/eglot e8b9cbf 16/22: Slightly simplify eglot-completion-at-point, João Távora, 2019/01/05
- [elpa] externals/eglot d5521e9 12/22: Remove workaround for company bug that has been fixed, João Távora, 2019/01/05
- [elpa] externals/eglot d167c80 15/22: Fix #190: actually make completion sorting work, João Távora, 2019/01/05
- [elpa] externals/eglot 476feb8 07/22: Add edebug specs to destructuring macros, João Távora, 2019/01/05
- [elpa] externals/eglot b8a8901 09/22: Fix #187: be more careful when making xref summaries, João Távora, 2019/01/05
- [elpa] externals/eglot 2f0e51a 13/22: Per #188: use gfm-view-mode, João Távora, 2019/01/05
- [elpa] externals/eglot b393c48 14/22: Fix previous commit where workaround had been removed, João Távora, 2019/01/05
- [elpa] externals/eglot 64da240 19/22: Fix #196: run connection hooks with proper dir-locals, João Távora, 2019/01/05
- [elpa] externals/eglot af9dcad 10/22: Take over Flymake and Eldoc completely while managing buffers,
João Távora <=
- [elpa] externals/eglot 5b9a164 01/22: Per #180: frame lsp-mode.el comparison as historical even more evidently, João Távora, 2019/01/05
- [elpa] externals/eglot 7b0d845 17/22: Close #195: remove a hard dependency on flymake-mode, João Távora, 2019/01/05
- [elpa] externals/eglot 923cbbe 08/22: Don't make bogus responses to client/(Un)RegisterCapability, João Távora, 2019/01/05
- [elpa] externals/eglot 85711cc 11/22: * eglot.el (Package-Requires): Require jsonrpc 1.0.7., João Távora, 2019/01/05
- [elpa] externals/eglot 1e1665e 06/22: Rewrite eglot--sig-info a bit for readability, João Távora, 2019/01/05
- [elpa] externals/eglot e65792f 18/22: Close #197: allow read-only modes for markup rendering, João Távora, 2019/01/05
- [elpa] externals/eglot c5dea9a 20/22: * eglot.el (eglot-workspace-configuration): Safe when listp., João Távora, 2019/01/05
- [elpa] externals/eglot 83f7f84 21/22: Appease checkdoc, João Távora, 2019/01/05
- [elpa] externals/eglot 35597d2 22/22: Handle (un)registerCapability requests via generic functions, João Távora, 2019/01/05