4 Customizing Eglot

Eglot itself has a relatively small number of customization options. A large part of customizing Eglot to your needs and preferences should actually be done via options of the Emacs packages and features which Eglot supports and enhances (see Eglot Features). For example:

For this reason, this manual describes only how to customize Eglot’s own operation, which mainly has to do with the server connections and the server features to be used by Eglot.

eglot-server-programs

This variable determines which language server to start for each supported major mode, and how to invoke that server’s program. See Setting Up LSP Servers, for the details.

eglot-strict-mode

This is nil by default, meaning that Eglot is generally lenient about non-conforming servers. If you need to debug a server, set this to (disallow-non-standard-keys enforce-required-keys).

eglot-server-initialized-hook

A hook run after the server object is successfully initialized.

eglot-connect-hook

A hook run after connection to the server is successfully established. See Starting Eglot.

eglot-managed-mode-hook

A hook run after Eglot started or stopped managing a buffer. See Buffers, Projects, and Eglot, for details of its usage.

eglot-stay-out-of

This variable’s value lists Emacs features that Eglot shouldn’t automatically try to manage on the user’s behalf. It is useful, for example, when you need to use non-LSP Flymake or Company back-ends. To have Eglot stay away from some Emacs feature, add that feature’s symbol or a regexp that will match a symbol’s name to the list: for example, the symbol xref to leave Xref alone, or the string ‘company’ to stay away from your Company customizations. Here’s an example:

(add-to-list 'eglot-stay-out-of 'flymake)

Note that you can still configure the excluded Emacs features manually to use Eglot in your eglot-managed-mode-hook or via some other mechanism.

eglot-report-progress

Set this variable to true if you’d like progress notifications coming from the language server to be handled as Emacs’s progress reporting facilities.