# Eglot for Better Programming Experience in Emacs

LSP, or Language Server Protocol, makes programming easier by introducing features like more precise auto-completion and definition lookup. It may have scratched your itches, and you are wondering what the experience is like in Emacs.

Emacs has mainly two LSP clients out there, eglot and lsp-mode. Eglot is lightweight, and it could almost run out of the box. So in this post I will briefly show you how to use eglot.

As a user, we only need to know these commands to get started:

1. M-x eglot connects to an LSP server for the current project
2. M-x flymake-goto-next-error goes to previous error in the current buffer
3. M-x flymake-goto-prev-error goes to next error in the current buffer
4. M-. or M-x xref-find-definitions finds the definition of the symbol at point and opens it in the current window
5. M-, or M-x xref-pop-marker-stack jumps back
6. M-? or M-x xref-find-references finds the references of the symbol at point

Occasionally, we may need:

1. M-x company-complete to trigger completions manually
2. M-x eldoc-doc-buffer to show docs for the symbol at point in a dedicated buffer

I've also made a video to demonstrate the workflow as below:

And, the emacs-showcase.el is following for the video: