Intro

This article covers an additional grammar check inside any Emacs buffer. Full manual is at this site.

Prerequisites

Check up Java

e.g. langtool is Java package

java -version
openjdk version "1.8.0_151"
OpenJDK Runtime Environment (build 1.8.0_151-8u151-b12-1~deb9u1-b12)
OpenJDK 64-Bit Server VM (build 25.151-b12, mixed mode)

Java 7 is installed already

Check up Java libs

Where all stuff located on your system

which java
/usr/bin/java

Default folder for Java packages

it is /usr/local/java/, but in most cases it is absent in a file tree after when you're successfuly re-installing OS.

ls -la /usr/local/java/
ls: cannot access '/usr/local/java/': No such file or directory

Lets create it:

mkdir /usr/local/java
ls -la /usr/local/java/
mkdir: cannot create directory ‘/usr/local/java’: File exists
total 8
drwxr-sr-x  2 alioth staff 4096 Nov 20 12:59 .
drwxrwsr-x 12 root   staff 4096 Nov 20 12:59 ..

Now, when we're already prepared our system it is very time for the next step further.

Put Java package on place

Perfect, now it's time to determine an appropriate place to allocate your Java packages.

ls /usr/local/java

Download languagetool

in zip archive from this site. 3.6 version seems compatible with Java 8 version installed on our host. Choose it and download zip archive.

Extract it

into Java lib folder, in this particular case into /usr/local/java/

Ensure yourself

ls /usr/local/java/LanguageTool-3.6/
CHANGES.md
CHANGES.txt
COPYING.txt
languagetool-commandline.jar
languagetool.jar
languagetool-server.jar
libs
META-INF
org
README.md
testrules.bat
testrules.sh
third-party-licenses

Install Emacs plugin

(package-install 'langtool)

Configure Emacs

Add these strings into your Emacs config

(require 'langtool)
(setq langtool-language-tool-jar "/usr/local/java/LanguageTool-3.6/languagetool-commandline.jar")

(global-set-key "\C-x4w" 'langtool-check)
(global-set-key "\C-x4W" 'langtool-check-done)
(global-set-key "\C-x4l" 'langtool-switch-default-language)
(global-set-key "\C-x44" 'langtool-show-message-at-point)
(global-set-key "\C-x4c" 'langtool-correct-buffer)

(setq langtool-default-language "en-US")
;;(setq langtool-java-bin "/usr/bin/java") ;; perhaps

Final check

Grammar

Figure 1: langTool usage



blog comments powered by Disqus

Published

25 May 2017

Categories

Literate Programming Emacs

Tags