diff --git a/ChangeLog.adoc b/ChangeLog.adoc index d10f156..5c51244 100644 --- a/ChangeLog.adoc +++ b/ChangeLog.adoc @@ -1,6 +1,6 @@ = Change Log Joar Buitago -v0.4.0, 2020-01-21 +v0.4.1, 2020-01-21 All notable changes to this project will be documented in this file. @@ -13,6 +13,10 @@ link:https://semver.org/spec/v2.0.0.html[Semantic Versioning]. == [Unreleased] +== [0.4.1] +=== Fixed +* Support for using class files directly. (Fix #3) + == [0.4.0] === Added * LanguageTool Server Mode has a delay of two secconds before checking diff --git a/ReadMe.adoc b/ReadMe.adoc index 3ecb1dd..76ea51e 100644 --- a/ReadMe.adoc +++ b/ReadMe.adoc @@ -1,6 +1,6 @@ = languagetool.el Joar Buitago -v0.4.0, 2020-01-21 +v0.4.1, 2020-01-21 [.text-center] -- @@ -9,7 +9,11 @@ link:https://stable.melpa.org/\#/languagetool[image:https://stable.melpa.org/pac image:https://github.com/PillFall/Emacs-LanguageTool.el/workflows/build/badge.svg[build] -- -Use LanguageTool as your Emacs grammar and spelling corrector. +Use LanguageTool as your Emacs grammar, spelling and styling +corrector. + +.Package in action. Text from https://languagetool.org/ +image::https://i.stack.imgur.com/1oqM7.png[Package in action] This package was based on link:https://github.com/mhayashi1120/Emacs-langtool/[mhayashi1120 @@ -23,7 +27,9 @@ supports more than 30 languages. -== Getting Started +== Installation + +=== Obtaining the prerequisites The first thing you need is *Java*, so download and install it. @@ -31,12 +37,16 @@ You also need to download *link:https://languagetool.org/download/[LanguageTool]* from its official page. -After download, extract the contents in the folder you want -(e.g. `~/.languagetool/`). Now you will need to say to the package -where is the `languagetool-commandline.jar` file in your `.emacs` file -like: +After download, extract the contents in a folder you want +(e.g. `~/.languagetool/`). -[source,lisp] + +=== Configuring the package + +Next you need to set the package configuration. First we add the path +to the `languagetool-commandline.jar` file in your `.emacs` file like: + +[source, lisp] ---- (setq languagetool-language-tool-jar "~/.languagetool/languagetool-commandline.jar") @@ -44,7 +54,7 @@ like: Or via customize. It's highly encouraged to use full path instead. -If you are going to use the LanguageTool HTML Server instead, you need +If you are going to use the LanguageTool HTTP Server instead, you need to add to your `.emacs` file: [source, lisp] @@ -57,7 +67,7 @@ to add to your `.emacs` file: It's recommended to add a Java flag to process the files in UTF-8, so you should add to your `.emacs`: -[source,lisp] +[source, lisp] ---- (setq languagetool-java-arguments '("-Dfile.encoding=UTF-8")) ---- @@ -65,7 +75,7 @@ you should add to your `.emacs`: And finally you should tell which language are you using by default in your `.emacs` file like: -[source,lisp] +[source, lisp] ---- (setq languagetool-default-language "en-GB") ---- @@ -101,7 +111,7 @@ correction buffer at the minibuffer, you only need to choose. Or you can use a LanguageTool HTTP Server with `languagetool-server-mode`. In this mode the function -`languagetool-check` will be undefinded in the current buffer to +`languagetool-check` will be undefined in the current buffer to prevent checking with another tool. `languagetool-clear-buffer` clears and recheck the buffer in case of needed. The other functions works as usual. @@ -127,6 +137,8 @@ e.g. ;; or (setq languagetool-java-arguments '("-flag" "argumentforflag") ---- +* `languagetool-language-tool-class` Tell the package that the package + will use the class files directly. Set to `nil` by default. * `languagetool-language-tool-jar` Sets the path of the LanguageTool command line jar file. It's recommended to put the full path. * `languagetool-language-tool-arguments` Sets arguments to pass to diff --git a/languagetool-issue-faces.el b/languagetool-issue-faces.el index 91ea99a..472177e 100644 --- a/languagetool-issue-faces.el +++ b/languagetool-issue-faces.el @@ -5,7 +5,7 @@ ;; Author: Joar Buitrago ;; Keywords: grammar text docs tools convenience checker ;; URL: https://github.com/PillFall/Emacs-LanguageTool.el -;; Version: 0.4.0 +;; Version: 0.4.1 ;; Package-Requires: ((emacs "25.1") (request "0.3.2")) ;; This program is free software; you can redistribute it and/or modify diff --git a/languagetool.el b/languagetool.el index c758969..7deb7e3 100644 --- a/languagetool.el +++ b/languagetool.el @@ -5,7 +5,7 @@ ;; Author: Joar Buitrago ;; Keywords: grammar text docs tools convenience checker ;; URL: https://github.com/PillFall/Emacs-LanguageTool.el -;; Version: 0.4.0 +;; Version: 0.4.1 ;; Package-Requires: ((emacs "25.1") (request "0.3.2")) ;; This program is free software; you can redistribute it and/or modify @@ -39,6 +39,7 @@ (require 'json) (require 'request) +(eval-when-compile (require 'subr-x)) @@ -74,6 +75,14 @@ recommends to use: ;; Variables related to LanguageTool Command Line: +(defcustom languagetool-language-tool-class nil + "Tells if the package is using the LanguageTool classes directly. + +When nil this package will use the -jar flag in java, and will +omit it from arguments otherwise." + :group 'languagetool + :type 'boolean) + (defcustom languagetool-language-tool-jar nil "Path to LanguageTool Command Line jar file." :group 'languagetool @@ -267,6 +276,7 @@ Its not recommended to run this function more than once." (start-process "*LanguageTool Server*" buffer languagetool-java-bin + (string-join languagetool-java-arguments " ") "-cp" languagetool-server-language-tool-jar "org.languagetool.server.HTTPServer" @@ -469,7 +479,9 @@ the call of LanguageTool when correcting the text." (setq arguments (append arguments (list arg)))) ;; Appends the LanguageTool jar path - (setq arguments (append arguments (list "-jar" languagetool-language-tool-jar))) + (unless languagetool-language-tool-class + (setq arguments (append arguments (list "-jar")))) + (setq arguments (append arguments (list languagetool-language-tool-jar))) ;; Appends the LanguageTool arguments (dolist (arg languagetool-language-tool-arguments) diff --git a/makefile b/makefile index 934ed9d..a0fe650 100644 --- a/makefile +++ b/makefile @@ -1,6 +1,6 @@ EMACS = emacs -EMACS_FLAGS = -Q --batch -f package-initialize -L . -f batch-byte-compile +EMACS_FLAGS = -Q --batch --eval "(setq byte-compile-error-on-warn t)" -f package-initialize -L . -f batch-byte-compile SOURCES = $(filter-out %-autoloads.el %-pkg.el, $(wildcard *.el))