On Eglot and VC


I have been pretty busy since my last update here, but that does not mean I haven’t had the time to explore a couple of things for my everyday Emacs usage.

Lately I had to deal with some Java and some JavaScript. No fancy libraries on top of them, no languages built upon them, just plain, old Java and JavaScript. I took that as a chance to familiarize myself with LSP and especially with Eglot, one of the two (to my knowledge) packages that add LSP support to Emacs. Why Eglot and not lsp-mode? Simple: I like how Eglot leverages project.el and Flymake, tools I heavily rely on, and I also like how quickly it enabled me to type Java and JavaScript code.

(add-hook 'java-mode-hook #'eglot-ensure)
(add-hook 'js-mode-hook #'eglot-ensure)

Neat, huh?

Eglot works well with Company, Xref, and ElDoc, so coding in Java finally makes sense in Emacs. Granted, I haven’t used it on a big project and I am sure the likes of IntelliJ IDEA and Eclipse do wonders, but none of them has the editing capabilities or the openness to infinite customization that Emacs offers.

Another tool that entered my day-to-day computing is the built-in version-control system, or VC for short. My love for Magit is well-known, but on my way to a vanilla Emacs appreciation I thought I could give VC a try. It turns out most of the things I need to do with my Git-versioned projects can be done from vc-dir. This means that instead of C-x g for magit-status I have been using C-x p v for project-vc-dir. When it’s time to get my hands dirty with some advanced Git-fu, Magit is always next to me.

One thing should be obvious here: Magit is more powerful and feature rich than the built-in VC, so I do not intend to drop Magit as quickly I dropped Projectile and Flycheck. Why don’t I just use Magit, then, you ask. For the same reason I tried Eglot instead of installing Eclipse, I’d reply. Curiosity will not kill any cat in my house.