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.