Improve emacs eglot config
Some checks are pending
ELP CI / ci (28, 28.0.1, linux, 28, ubuntu-22.04-arm, ubuntu-22.04-arm, aarch64-unknown-linux-gnu, false, linux-arm64) (push) Blocked by required conditions
ELP CI / ci (28, 28.0.1, macos, 28, macos-13, macos-13-x64, x86_64-apple-darwin, false, darwin-x64) (push) Blocked by required conditions
ELP CI / ci (28, 28.0.1, macos, 28, macos-latest, macos-latest-arm, aarch64-apple-darwin, false, darwin-arm64) (push) Blocked by required conditions
ELP CI / ci (28, 28.0.1, windows, 28, windows-2022, windows-2022-x64, x86_64-pc-windows-msvc, false, win32-x64) (push) Blocked by required conditions
ELP CI / ci (26, 26.2.5.13, linux, 26.2, ubuntu-22.04, ubuntu-22.04-x64, x86_64-unknown-linux-gnu, true, linux-x64) (push) Blocked by required conditions
ELP CI / ci (26, 26.2.5.13, linux, 26.2, ubuntu-22.04-arm, ubuntu-22.04-arm, aarch64-unknown-linux-gnu, true, linux-arm64) (push) Blocked by required conditions
ELP CI / ci (26, 26.2.5.13, macos, 26.2, macos-13, macos-13-x64, x86_64-apple-darwin, true, darwin-x64) (push) Blocked by required conditions
ELP CI / edb (push) Waiting to run
ELP CI / ci (26, 26.2.5.13, macos, 26.2, macos-latest, macos-latest-arm, aarch64-apple-darwin, true, darwin-arm64) (push) Blocked by required conditions
ELP CI / ci (26, 26.2.5.13, windows, 26.2, windows-2022, windows-2022-x64, x86_64-pc-windows-msvc, true, win32-x64) (push) Blocked by required conditions
ELP CI / ci (27, 27.3.4, linux, 27.3, ubuntu-22.04, ubuntu-22.04-x64, x86_64-unknown-linux-gnu, false, linux-x64) (push) Blocked by required conditions
ELP CI / ci (27, 27.3.4, linux, 27.3, ubuntu-22.04-arm, ubuntu-22.04-arm, aarch64-unknown-linux-gnu, false, linux-arm64) (push) Blocked by required conditions
ELP CI / ci (27, 27.3.4, macos, 27.3, macos-13, macos-13-x64, x86_64-apple-darwin, false, darwin-x64) (push) Blocked by required conditions
ELP CI / ci (27, 27.3.4, macos, 27.3, macos-latest, macos-latest-arm, aarch64-apple-darwin, false, darwin-arm64) (push) Blocked by required conditions
ELP CI / ci (27, 27.3.4, windows, 27.3, windows-2022, windows-2022-x64, x86_64-pc-windows-msvc, false, win32-x64) (push) Blocked by required conditions
ELP CI / ci (28, 28.0.1, linux, 28, ubuntu-22.04, ubuntu-22.04-x64, x86_64-unknown-linux-gnu, false, linux-x64) (push) Blocked by required conditions
Deploy Website to GitHub Pages / Deploy Website to GitHub Pages (push) Waiting to run

Summary: Add a hook to automatically enable it in erlang-mode, and add the missing closing parens.

Reviewed By: lisztspace

Differential Revision: D88264639

fbshipit-source-id: d3d8166dd233ddc59ff6bb082f3c022851aec5dc
This commit is contained in:
Alan Zimmerman 2025-12-03 06:46:58 -08:00 committed by meta-codesync[bot]
parent 1fc2f63da8
commit 3461b85029

View file

@ -4,17 +4,21 @@ sidebar_position: 2
# Emacs
The ELP project can be used as a [language server](https://microsoft.github.io/language-server-protocol/overviews/lsp/overview/) in the Emacs text editor via the [eglot](https://github.com/joaotavora/eglot) or [lsp-mode](https://emacs-lsp.github.io/lsp-mode/) LSP clients.
The ELP project can be used as a
[language server](https://microsoft.github.io/language-server-protocol/overviews/lsp/overview/)
in the Emacs text editor via the [eglot](https://github.com/joaotavora/eglot) or
[lsp-mode](https://emacs-lsp.github.io/lsp-mode/) LSP clients.
## Eglot
Eglot is part of Emacs core since Emacs 29.
For earlier versions it can be installed with the `eglot` package.
Eglot is part of Emacs core since Emacs 29. For earlier versions it can be
installed with the `eglot` package.
### Configuration
```elisp
(use-package eglot
:hook ((erlang-mode . eglot-ensure))
:config
;; Remove default LSP server
@ -23,14 +27,19 @@ For earlier versions it can be installed with the `eglot` package.
;; Enable ELP
(add-to-list 'eglot-server-programs
'(erlang-mode . ("elp" "server"))
'(erlang-mode . ("elp" "server"))))
```
Refer to the [manual](https://elpa.gnu.org/devel/doc/eglot.html#Customization-Variables) for additional configuration options.
Refer to the
[manual](https://elpa.gnu.org/devel/doc/eglot.html#Customization-Variables) for
additional configuration options.
## lsp-mode
Install the `lsp-mode` package, which is a generic Emacs client for LSP servers. You can follow [these instructions](https://emacs-lsp.github.io/lsp-mode/page/installation/) to install it.
Install the `lsp-mode` package, which is a generic Emacs client for LSP servers.
You can follow
[these instructions](https://emacs-lsp.github.io/lsp-mode/page/installation/) to
install it.
### Configuration
@ -52,15 +61,21 @@ Add the following to your emacs `.emacs` file or equivalent.
)
```
For a list of available configuration option, please refer to [this page](https://emacs-lsp.github.io/lsp-mode/page/lsp-erlang-elp/) and to the [`lsp-mode` settings documentation](https://emacs-lsp.github.io/lsp-mode/page/settings/mode/).
For a list of available configuration option, please refer to
[this page](https://emacs-lsp.github.io/lsp-mode/page/lsp-erlang-elp/) and to
the
[`lsp-mode` settings documentation](https://emacs-lsp.github.io/lsp-mode/page/settings/mode/).
There is also a [`.dotemacs`](https://github.com/WhatsApp/erlang-language-platform/blob/main/editors/emacs/dotemacs.el) file in the ELP repository that you can use as a reference.
There is also a
[`.dotemacs`](https://github.com/WhatsApp/erlang-language-platform/blob/main/editors/emacs/dotemacs.el)
file in the ELP repository that you can use as a reference.
## Troubleshooting
#### The following servers support current file but do not have automatic installation
Ensure that the `elp` executable is available in your `PATH` via Emacs. A workaround is:
Ensure that the `elp` executable is available in your `PATH` via Emacs. A
workaround is:
```elisp
;; Ensure your Emacs environment looks like your user's shell one