All Projects → PillFall → Emacs-LanguageTool.el

PillFall / Emacs-LanguageTool.el

Licence: GPL-3.0 license
LanguageTool suggestions integrated within Emacs

Programming Languages

emacs lisp
2029 projects
Makefile
30231 projects

Projects that are alternatives of or similar to Emacs-LanguageTool.el

Nodehun
The Hunspell binding for NodeJS that exposes as much of Hunspell as possible and also adds new features. Hunspell is a first class spellcheck library used by Google, Apple, and Mozilla.
Stars: ✭ 229 (+420.45%)
Mutual labels:  spellcheck
voikko-rs
Rust bindings for the Voikko library
Stars: ✭ 16 (-63.64%)
Mutual labels:  spellcheck
identypo
identypo is a Go static analysis tool to find typos in identifiers (functions, function calls, variables, constants, type declarations, packages, labels).
Stars: ✭ 26 (-40.91%)
Mutual labels:  spellcheck
list-environment.el
A tabulated process environment editor
Stars: ✭ 13 (-70.45%)
Mutual labels:  emacs-package
WordSegmentationDP
Word Segmentation with Dynamic Programming
Stars: ✭ 18 (-59.09%)
Mutual labels:  spellcheck
LinSpell
Fast approximate strings search & spelling correction
Stars: ✭ 52 (+18.18%)
Mutual labels:  spellcheck
Nspell
📝 Hunspell compatible spell-checker
Stars: ✭ 195 (+343.18%)
Mutual labels:  spellcheck
yaspeller-ci
Fast spelling check for Travis CI
Stars: ✭ 60 (+36.36%)
Mutual labels:  spellcheck
nroam
Org-roam backlinks within org-mode buffers
Stars: ✭ 106 (+140.91%)
Mutual labels:  emacs-package
siri-shortcuts.el
A set of Emacs commands and functions for interacting with Siri Shortcuts.
Stars: ✭ 28 (-36.36%)
Mutual labels:  emacs-package
spell
Spelling correction and string segmentation written in Go
Stars: ✭ 24 (-45.45%)
Mutual labels:  spellcheck
papis.el
Emacs package for papis
Stars: ✭ 22 (-50%)
Mutual labels:  emacs-package
bnf-mode
A GNU Emacs major mode for editing BNF grammars
Stars: ✭ 34 (-22.73%)
Mutual labels:  emacs-package
flake8-spellcheck
❄️ Spellcheck variables, classnames, comments, docstrings etc
Stars: ✭ 71 (+61.36%)
Mutual labels:  spellcheck
screenshot
Swiftly grab pretty images of your code
Stars: ✭ 158 (+259.09%)
Mutual labels:  emacs-package
Php Spellchecker
🐘🎓📝 PHP Library providing an easy way to spellcheck multiple sources of text by many spellcheckers
Stars: ✭ 213 (+384.09%)
Mutual labels:  spellcheck
spellchecker-wasm
SpellcheckerWasm is an extrememly fast spellchecker for WebAssembly based on SymSpell
Stars: ✭ 46 (+4.55%)
Mutual labels:  spellcheck
ispell-lt
Lithuanian spellchecking dictionary
Stars: ✭ 26 (-40.91%)
Mutual labels:  spellcheck
contextualSpellCheck
✔️Contextual word checker for better suggestions
Stars: ✭ 274 (+522.73%)
Mutual labels:  spellcheck
check-spelling
Spelling checker action
Stars: ✭ 139 (+215.91%)
Mutual labels:  spellcheck

languagetool.el logo

languagetool.el

languagetool.el in action


MELPA Version MELPA Stable Version CI Status

Introduction

LanguageTool is a free and open-source multilingual grammar, style, and spell checker with support for more than 30 languages. So, why not use it as your Emacs grammar and spell check tool. That is what this package is for.

languagetool.el is a tool written for Emacs keeping in mind integrity and display. In a way that you can see all the issues which LanguageTool generates for your text and which kind of issue is, by following a colour key.

LanguageTool standalone version comes with tree different executables written in Java:

  • The first is the GUI, to use LanguageTool directly.
  • The other is the Command Line Interface, to check text in this way.
  • And the final one is the Server, to create an HTTP server to check text via requests.

languagetool.el creates a wrapper for two of these three tools, the CLI (console module) and the Server (server module).

Installation

Obtaining the prerequisites

As LanguageTool is code in Java, you need to install that on your system. LanguageTool requires Java 8 or later to work.

You’ll need (obviously) LanguageTool itself, you can download it in this link or, if available, with your package manager.

If you download LanguageTool Zip file, extract the contents in a folder you want; for example /home/pillfall/.languagetool/, if you use LanguageTool with other tools could be a great option.

In case you use your package manager, find out if it download the class files or the standalone executable and where it put them, this is useful for later configuration. For example ArchLinux download the class files and puts them in the /usr/share/languagetool and /usr/share/java/languagetool directories.

Obtaining the package

You can install the package using the MELPA repository or via use-package.

In case you use the latter and get the LanguageTool Zip, one default configuration, enabling all current features, would be:

(use-package languagetool
  :ensure t
  :defer t
  :commands (languagetool-check
             languagetool-clear-suggestions
             languagetool-correct-at-point
             languagetool-correct-buffer
             languagetool-set-language
             languagetool-server-mode
             languagetool-server-start
             languagetool-server-stop)
  :config
  (setq languagetool-java-arguments '("-Dfile.encoding=UTF-8")
        languagetool-console-command "~/.languagetool/languagetool-commandline.jar"
        languagetool-server-command "~/.languagetool/languagetool-server.jar"))

If you want to install it from source, you can clone this repository and do all the configuration manually (create a package.el, generate autoloads.el, etc.). Right now, there are no installation steps following this approach, so you’ll need to know what you are doing, but there is a handy makefile which byte compiles all the elisp files.

Configuring the package

To get this package to work, you’ll need to configure some variables.

First you must configure Java to accept files in UTF-8, for that purpose, set languagetool-java-arguments using customize interface or with elisp like follows:

(setq languagetool-java-arguments '("-Dfile.encoding=UTF-8"))

Then you need to tell the package how do you plan to call LanguageTool.

If you download, extracted and plan to use the LanguageTool Zip, set languagetool-console-command and languagetool-server-command using customize interface or with elisp like follows:

(setq languagetool-console-command "~/.languagetool/languagetool-commandline.jar"
      languagetool-server-command "~/.languagetool/languagetool-server.jar")

If you are going to use a package manager, and it download the class files, you will call LanguageTool from its class, so set languagetool-java-arguments, languagetool-console-command and languagetool-server-command using customize interface or with elisp like follows:

(setq languagetool-java-arguments '("-Dfile.encoding=UTF-8"
                                    "-cp" "/usr/share/languagetool:/usr/share/java/languagetool/*")
      languagetool-console-command "org.languagetool.commandline.Main"
      languagetool-server-command "org.languagetool.server.HTTPServer")

If you pay for LanguageTool Premium features, you can add the keys for the LanguageTool api as follows:

(setq languagetool-api-key "xxxxxxxxxxxx"
      languagetool-username "[email protected]")

By default, the correction language is auto and it is buffer local, meaning that you could check in different languages different files, if you want to change the language, you could use local file variables to define the language to use in that buffer, setting the variable languagetool-correction-language, or call languagetool-set-language.

If you want to know more customization options you can find those at the customize interface.

Quick Usage

When you end customizing the packages (faces, languages, etc.). You can now start checking your text. So, you can use either console mode or server mode.

console Mode

In this mode, when you start checking, the first thing you need to do is call languagetool-check. This will invoke LanguageTool in the current region, if any, and then highlight all the suggestions made by the tool. If there is no region, the whole available portion of the buffer will check.

This function is synchronous. Therefore, it blocks Emacs until LanguageTool done with your text. This is the right behaviour, as LanguageTool is a bit slow checking text in this mode, so it prevents you from changing the text while checking.

After LanguageTool highlights all its suggestions, now you can correct your text, then put your cursor on the underlined word and call languagetool-correct-at-point, this will pop up a transient minibuffer with all the suggestions, choose the one fits your needs, and you are ready to go. There is also a buffer wide correction function, called languagetool-correct-buffer, you can call it if you want to check all the buffer, suggestion by suggestion.

If you finish, and don’t want to see any more suggestions, call languagetool-clear-suggestions and all the highlighting will disappear.

server Mode

In this mode, you first start having a running the server. To initialize it, you can call languagetool-server-start, then you’ll have a running server attached to Emacs (If you close Emacs, it’s over). This server starts to listen in port 8081 by default. You can change it by setting languagetool-server-port to another value.

If you are going to use a server with another configuration, like servers not located in your localhost, you must set languagetool-server-host and languagetool-server-port to whatever adjust your needs. These variables play in the communication to the LanguageTool HTTP API.

After your server is running, you can toggle on the languagetool-server-mode. LanguageTool then starts to highlight all its suggestions in the available portion of the buffer. You use the same method as in ~console~ mode to correct your text.

If you finish, just toggle off the languagetool-server-mode, it will take all the LanguageTool suggestions with itself.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].