Grammar check in Emacs
For the longest time, I wanted to have grammar check inside Emacs. I finally figured out how to use Emacs-langtool. It’s pretty easy to set up; It’s just that finding basic instructions is hard to find.
Here’s the rundown:
- Languagetool desktop off app from https://languagetool.org/download/1.
- Langaugetool require java. To install:
sudo apt install default-jre.
The standalone GUI tool:
java -jar languagetool-commandline.jar, or for command line,
java -jar languagetool-commandline.jar (use –help to see what’s available).
To use in Emacs:
- Get the package, Emacs-langtool (also in MELPA).
- Follow the instructions to add the right lines to your .emacs config and relaunch Emacs.
- Highlight the text you want.
- Check the buffer for warnings:
- Then correct them with:
- Can also go to point to check:
- Clean highlights with
Languagetool work well enough, but the Emacs version is not as dynamic as the standalone tool or the website. You have to follow the sequence above each time to conducts checks.
For now, I find the langtool-check option to be enough. It highlights mistakes and then move the pointer over the highlights shows the errors the minibuffer below. There’s no option to save a personal dictionary to allow you to add words you know are not mistakes.
Overall, the quality of the corrections is somewhat less than Grammarly (especially if you pay for the premium version), which I’ve been using for years2.
But. I have grammar check in Emacs. I can now write emails and Reddit posts inside org-mode without copy-pasting into the Grammarly webpage. That’s the other thing: privacy. I am not logged into a user account. Grammarly defiantly collect a lot of information, which makes checking personal texts for grammar awkward. Langaugetool is a FOSS project that doesn’t (as far as I know) need ads. I also don’t have to deal with annoying captchas and logging in each time, copy paste text from and then back into Emacs, and get an email later from Grammarly that “someone” accessed my account.
I have a feeling this will become a go-to method for most of my writings. I will still use Grammarly for more polished and professional looking things. As I learn more how to utilize it, I will probably add macros and keyboard shortcuts with langaugetool to improve my workflow.
I’m aware there’s a emacs-grammarly package. Instructions, as usual, are the problem. I asked several times if anyone got this package to work, and even reached out to the creator via email, but so far no answers. It seems this package requires access to the API, which means a paid Grammarly account. ↩︎