mhayashi1120 / emacs-langtool Goto Github PK
View Code? Open in Web Editor NEWLanguageTool for Emacs
License: GNU General Public License v3.0
LanguageTool for Emacs
License: GNU General Public License v3.0
Hi,
first thank you for your plug-in. It is really amazing.
In org-mod, file start with #+ and stuff...
By exemple :
+TITLE: MySuperTitle
+AUTHOR: JohnDo
+EMAIL: [email protected]
+LANGUAGE: fr
+OPTIONS: H:5
+OPTIONS: toc:3
How can i make a rule to don't correct it ?
(Sorry for my bad english)
Hello,
This is my setup with languagetool 2.5:
java version "1.7.0_51"
OpenJDK Runtime Environment (IcedTea 2.4.6) (ArchLinux build 7.u51_2.4.6-1-x86_64)
OpenJDK 64-Bit Server VM (build 24.51-b03, mixed mode)
GNU Emacs 24.3.1
I configure it this way:
(require 'langtool)
(setq langtool-language-tool-jar "/usr/share/java/languagetool/languagetool-commandline.jar")
(setq langtool-java-bin "/usr/bin/java")
;; Set keybindings
(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-mother-tongue "fr")
But langtool-check
always return me the following:
LanguageTool exited abnormally with code 1 (Exception in thread "main" java.lang.NoClassDefFoundError: org/languagetool/JLanguageTool)
Is there any way to check only the region selected ?
As describe in title..
One of the most common scenario when I would use langtool within emacs is when writing an email. I use Mew for email. When I run Emacs-langtool on a mew draft bufer, I get the following error when the language is set to auto:
LanguageTool exited abnormally with code 1 (Exception in thread "main" java.io.UnsupportedEncodingException: compound-text)
When the language is set to en-US, I get an error saying that langtool expects en-US.
If I copy the same text (including the header lines) to a new buffer as plain text, langtool runs as expected. However, if I have to do that, it almost negates the purpose of this script.
Can the text be given to langtool as en-US and not as "compount-text" from langtool.el?
I am starting a Langtool-server with my system start, which, I guess, leads to the error message
langtool-server--rendezvous: Failed to start LanguageTool Server.
when I am setting langtool-language-tool-server-jar. I can use langtool-server-user-arguments to start a second LanguageTool server instance, but I think it would be nicer to reuse the already running instance.
I am using NixOs where langtool is wrapped in a bash script to have a specific version an java available so I need (not strictly necessary but huuuge hacks otherwise) to use langtool-bin
. However, setting this doesn't work given that langtool--checker-mode
does not check this setting.
Hey dood,
The mode-line-message
clutters the mode line in my use case once it is done. I've used langtool-finish-hook
to remove the entry `(t langtool-mode-line-message). I think this falls to the library to provide a means or option for this but this is just a minor request.
I got this exception NoClassDefFoundError: javax/xml/bind/JAXBException
.
I don't know much about java. I figure out that --add-modules java.xml.bind
works on my mac. But can't find way to add the arg before -jar
.
After installing the extension as indicated (I had to install cl-lib.el as well), I get the following error when launching emacs
:
Symbol's function definition is void: gv-define-simple-setter
Is there a way to highlight different categories (e.g. spell, grammar) with different color?
I am using use-package to load langtool. This is my configuration.
(use-package langtool
:ensure t
:init
(setq langtool-language-tool-jar (concat user-emacs-directory "packages/LanguageTool-3.0/languagetool-commandline.jar")
langtool-java-classpath (concat user-emacs-directory "packages/LanguageTool-3.0")
langtool-default-language "en-US"
langtool-java-bin "/usr/bin/java"))
However, when I invoke langtool-check on a buffer, I get the following error:
Error: Could not find or load main class org.languagetool.commandline.Main.
I am using langtool for desktop. Is this what I should use?
I enabled langtool debug, here is the output:
/usr/bin/java: (-cp ~/.emacs.d/packages/LanguageTool-3.0 org.languagetool.commandline.Main -c ascii -l en-US -d -m en <xxx.txt>)
However, the following command works from the terminal:
/usr/bin/java -jar languagetool-commandline.jar -c ascii -l en-US -d -m en <xxx.txt>
Hi, im an emacs noob and this error appeared while i tried to compile your repository using your makefile. I suspect it has to do with a personalized file called .test-init.el that you created which is in /usr/share/emacs/site-lisp/site-start.d/ . Can you help me??
It doesn't seem to work on emacs24 with the latest version of LangTool.
Some times it shows "LanguageTool finished with code 1"
I have installed java 1.7 and the LangTool works fine in server mode setting with TexStudio.
Hello,
I have an issue with the output coming from LanguageTool not displaying correctly.
I'm using the German language, langtool 1.5.1 on Windows 8.1 with emacs 25.2 and LanguageTool 3.7.
The issue appears with umlauts and the "ß" character, as shown below (and probably unicode characters in other languages).
To fix the issue I took the second example from here and modified langtool as follows to switch java encoding to UTF-8:
diff --git a/langtool.el b/langtool.el
index 029bba4..b6aaad5 100644
--- a/langtool.el
+++ b/langtool.el
@@ -626,7 +626,9 @@ Ordinary no need to change this."
"org.languagetool.commandline.Main")
args))
(setq args (append
- (list "-jar" (langtool--process-file-name langtool-language-tool-jar))
+ (list "-Dfile.encoding=UTF-8"
+ "-jar"
+ (langtool--process-file-name langtool-language-tool-jar))
args)))
(when langtool-mother-tongue
(setq args (append args (list "-m" langtool-mother-tongue))))
I'm working on Arch Linux, and the way that packages install, they don't expose the proper classpaths using environment variables, but instead create wrapper scripts that contain the proper "-cp /some/path/here:/another/path/" in the command
for example:
#!/bin/bash
[...]
CP=/usr/share/languagetool
for name in /usr/share/java/languagetool/*.jar ; do
CP=$CP:$name
done
[...]
CLI_command='org.languagetool.commandline.Main'
[...]
"$JAVA_HOME/bin/java" -cp $CP $CLI_command"
So whenever I try to run langtool-check or any of the other commands I get a rather lengthy "NoClassDefFoundError", and I can't set langtool-java-bin as the command with the classpath added, since langtool.el checks whether the set binary exists or not.
I was thinking this could be avoided by having some sort of variable like "langtool-java-classpath" that is empty by default, and then checking whether it's empty. If not, a "-cp " (langtool-java-classpath)
could be added to the args list on line 251.
For now I have to do a global search and replace to make my documents single-spaced after the period before running langtool, then change them back to 2 spaces after the period. :-)
Would it be possible, that the function langtool-correct-buffer
runs langtool-check-done
when at the end of a run no errors are left?
This is not a issue but http://d.hatena.ne.jp/LaclefYoshi/20150912/langtool_popup
link is dead on the README.md.
Currently langtool-language-tool-jar
or langtool-java-classpath
setting is required.
But e.g. Gentoo distro provide executable standalone launcher for LangTool, running it manually without that is a pain.
So consider adding a way to use standalone LangTool launcher to work and just set it's path, say /usr/bin/languagetool
.
You could mention that langtool
is available through MELPA: https://melpa.org/#/langtool
(use-package langtool
:ensure t
:config (setq langtool-language-tool-jar "/path/to/languagetool-commandline.jar"))
Hi, I was trying to add the --languagemodel option with the english n-gram data, but it does not work as expected (it was fine without the --langguagemodel).
The init.el file is as follow:
(setq langtool-language-tool-jar "/opt/program/nux/LanguageTool-4.1/languagetool-commandline.jar" )
(require 'langtool)
(setq langtool-java-user-arguments '(--languagemodel "/opt/program/nux/LanguageTool-4.1/ngrams"))
When I run M-x langtool-check
,
it gave error message
LanguageTool exited abnormally with code 1 (Unrecognized option: --languagemodel /opt/program/nux/LanguageTool-4.1/ngrams)
Did I made a mistake?
Thanks!
Hi,
I can't start the languagetool-server with your package and this setup:
(setq langtool-java-classpath
"/usr/share/languagetool:/usr/share/java/languagetool/*")
(setq langtool-language-tool-server-jar "/usr/share/java/languagetool/languagetool-server.jar")
(setq langtool-java-bin "/usr/bin/java")
If I use the languagetool-commandline from your package like this:
(setq langtool-java-classpath
"/usr/share/languagetool:/usr/share/java/languagetool/*")
(setq langtool-language-tool-jar "/usr/share/java/languagetool/languagetool-commandline.jar")
(setq langtool-java-bin "/usr/bin/java")
then there is no problem.
my system:
OS: Linux Arch
languagetool: 3.8 from community repo
Emacs: 25.3
I installed langtool package on Spacemacs. My config looks like this:
(use-package langtool
:ensure t
:init (
(setq langtool-bin "/usr/bin/languagetool")
(setq langtool-mother-tongue "pl")
(setq langtool-language-tool-jar "/usr/share/java/languagetool/languagetool-commandline.jar")
(setq langtool-default-language "en-US")
(setq langtool-java-bin "/usr/bin/java")
))
I tried this and few combinations (only langtool-java-bin or langtool-bin). Every time I try to run
M-x langtool-check
there is an error: LanguageTool exited abnormally with code 1 (Unrecognized option: -c)
Hi,
I observe that current Emacs-langtool
may report Latex macros, which starts by a backslash like \emph, \textbf, \textit,...
as grammar errors. There is often a lot of such macros and and the overwhelming appearance of these errors actually makes the real error less obvious.
Do you know if it is possible to make Emacs-langtool
skip such Latex macros?
Thank you!
When checking a sentence, the placement of the error and of the correction is wrong.
For example:
First sentence. For instance, most of people are chinese.
However, most of people are not old.
In the first one, the " most of peopl" will be highlighted and the correction will lead to " For instance,most of the peoplee"… which is just bad.
But the second one will be correct. This only appear if one or more sentence are contained in the line.
Eventually, the last example:
First sencence. Second sentence but a bit longer. For instance, most of people are using Emacs.
In this case, the last sentence is matched as "t most of peop".
To sum up:
The position of the mistake is good in the first sentence of the line.
The position of the mistakes in sentences after the first one will shift on the right by 1 caracter on the left for each sentence.
It seems that this has actually been done. My mistake
Open a narrowed org subtree in a separate window or frame and launch langtool-check.
The highlighted areas will be shifted to a position that counts from the beginning of the original buffer, not of that narrowed buffer.
So all the highlighted areas will not correspond to the area that has a problem and the correction will be applied to the wrong area.
When typing something else than just text, let's say a LaTeX document, langtool is not aware of the LaTeX syntaxe and found a lot of small errors due to that. It would be great if it would deal with environments only and ignore LaTeX commands for example.
Actually, I don't really think it's possible since LanguageTool isn't aware of the syntax... so, it's more a question: is that possible without too much work or not really ?
I only see the function langtool-correct-buffer
, but I just want to correct the word my cursor is currently hovering over.
Is there something like langtool-correct-word-at-point
?
When using the French language, langtool with the "fr" language set up doesn't find all the mistakes it should. (However, some are well found).
For example, writing "Il a changer d'école." in emacs and checking it with langtool does not found any error.
However, checking with
java -jar LanguageTool.jar -l fr"
will find the mistake on "changer". Therefore there is an issue.
By the way, langtool always says "M-x langtool-correct-buffer to correct buffer." after a check even if no errors have been found when it should say "langtool hasn't found any errors" or something like that.
Another little detail is that when performing a check on a text, it might take a while (in my case even for 2/3 pages long texts) but during that time the mini-buffer doesn't say anything so we just wait hopping langtool is doing something… it would be great if the mini-buffer would says something like "Grammar checking in progress…"
Note: I use java 1.6.0_22 (OpenJDK6).
Good evening,
Tonight I am writing to humbly put in a request for you to tag this project.
The reason is that a lot of users want to rely on a "numbered" release, by
the most broad definition of the term. For me, it is really simple, I am setting
up a "kind of stable" Emacs configuration of my system here https://github.com/grettke/home/blob/master/.emacs.el
and I would like to rely 100% just one tag. Whenever a "kind of stable" version
is ready, another tag would be super, too.
You might already have the most stable version in the mainline; and tagging it
would make it crystal clear to new users. Perhaps you have already released such
a version elsewhere, and if so, my apologies, and where does it live?
Stable is not the best word here. It just means that the project lives on GitHub
and that it has a tag. It doesn't mean that the software is perfect, it just
means that it is tagged. That tag gives users a version to settle on and go on
with their life is all.
I've used your package for a long time, love it, and so do many, many others.
This is a way to get that project out to the other thousands and thousands of
users who also rely upon MELPA stable.
All it takes is for you to create a tag, and within hours, it will show up on
MELPA stable. Here are the specs for the tag name.
Can't wait to hear about what you think and whether or not a tag is in this
project's future!
Kind regards,
Grant Rettke
Hello,
I've started playing with LanguageTool and Emacs-langtool yesterday. I could not make Emacs-langtool work until few minutes ago when I realized that:
(setq langtool-language-tool-jar "/path/to/LanguageTool.jar")
on line 14 of README.md, should be (at least for me):
(setq langtool-language-tool-jar "/path/to/languagetool-commandline.jar")
Now it looks really great!
Many tanks and Happy New Year!
Christophe
How can I install latest version of LanguageTool.jar file?
I was not able to find it in https://languagetool.org. They provide browser extensions.
Please provide a setting for .emacs for mothertongue.
This should pass e.g. -m en if your mothertongue is English and is independent of the language for which grammar is being checked.
Implementing and documentating this allows for activation of extra grammar rules aimed specifically at native or non-native speakers regarding the non-native or native language in which grammar is checked.
Please get included in emacs-goodies-el Contact Bhavani Shankar [email protected] and Peter S Galbraith [email protected] for this.
Also, notify them again for each new version or provide them with RSS-feed to this repository.
Hello,
I get the following error when I try to run langtool
LanguageTool exited abnormally with code 1 (Exception in thread "main" java.lang.UnsupportedClassVersionError: org/languagetool/commandline/Main : Unsupported major.minor version 52.0)
I'm running java 8 on Mac High Sierra, but recently installed legacy support here: https://support.apple.com/kb/dl1572?locale=en_US
Good day,
Emacspeak is a tool for Emacs which allows Emacs to be used by people who are blind. It uses Advise to know what Emacs is doing. I'm trying to use this with Langtool, and it works a little. The issues I'm having are:
So, what I'm asking is, can these two things be fixed? Can lang-tool be used with the function ispell uses for langtool-correct-buffer? And can langtool-show-message-at-point use the regular print function? This works well when the langtool-correct-buffer finishes, and langtool says that there are errors or not, but not when using langtool to show message at point.
I'm sorry if this isn't as specific as you need. I'm not a programmer, just a writer that finds Emacs more useful than any modern text editor. Langtool has been very useful already. I've found uncapitalized sentences, grammar problems, and more that I wouldn't have with other tools.
When I check any buffer without setting the language, the output is correct (says that I have errors if any).
But when I set any language. it always returns that the buffer is correct (I know is not).
Checking langtool debugging tool in Emacs I notice that when I delete the -d
when it has no options (in log the command is langtool.jar -c ascii -d -l en-GB file.txt
) that error is fixed. Is the only flag that clashes.
I propose to change the code in the langtool-command--invoke-process to avoid the -d
flag is there is no options to pass.
(defun langtool-command--invoke-process (file begin finish &optional lang)
(let ((version (langtool--jar-version)))
(cl-destructuring-bind (command args)
(langtool--basic-command&args)
;; Construct arguments pass to jar file.
;; http://wiki.languagetool.org/command-line-options
(setq args (append
args
(list "-c" (langtool--java-coding-system
buffer-file-coding-system))
;;-----------------------------
;; Avoid using -d flag if not needed.
(if (string= (langtool--disabled-rules) "")
(list "")
(list "-d" (langtool--disabled-rules)))))
(cond
((stringp (or lang langtool-default-language))
(setq args (append args (list "-l" (or lang langtool-default-language)))))
(t
(setq args (append args (list "--autoDetect")))))
(when langtool-mother-tongue
(setq args (append args (list "-m" langtool-mother-tongue))))
(setq args (append args (langtool--custom-arguments 'langtool-user-arguments)))
(setq args (append args (list (langtool--process-file-name file))))
(langtool--debug "Command" "%s: %s" command args)
(let* ((buffer (langtool--process-create-client-buffer))
(proc (langtool--with-java-environ
(apply 'start-process "LanguageTool" buffer command args))))
(set-process-filter proc 'langtool-command--process-filter)
(set-process-sentinel proc 'langtool-command--process-sentinel)
(process-put proc 'langtool-source-buffer (current-buffer))
(process-put proc 'langtool-region-begin begin)
(process-put proc 'langtool-region-finish finish)
(process-put proc 'langtool-jar-version version)
proc))))
When using the "M-x langtool-check" command, I receive the error "java command not found"
This is my .emacs file:
(add-to-list 'load-path "~/.emacs.d/LanguageTool-4.3/") (setq langtool-java-bin "/Library/Java/JavaVirtualMachines/jdk-11.0.1.jdk/Contents/Home/bin") (setq langtool-language-tool-jar "~/.emacs.d/LanguageTool-4.3/languagetool-commandline.jar") (setq langtool-default-language "en-US") (require 'langtool)
I installed the melpa package, java and downloaded version 4.3 of langtool.
There´s nothing wrong with the langtool download, as it works perfectly fine from the command-line. What am I doing wrong?
Allow option to connect to and use the remote web version of language tool without installing the language server itself.
Recently vimtex
includes grammar checker (https://www.reddit.com/r/vim/comments/mec34b/grammar_check_and_more_in_latex_documents/).
It relies on a Python package called YaLafi.
YaLafi
also seems to provide an emacs interface.
Possibly this can be a way to do LaTeX with LangTool.
Unfortunately I do not have time to study how to do that.
Hello!
I recently started using Cygwin for some of my development on Windows and I noted that there are a number of issues with running ´langtool` under that platform:
.jar
path's to be specified in Windows syntax (C:\User\...
). However, there is a file existance test for it as well where the path must be given in Cygwin syntax (/cygdrive/c/...
)
langtool-output-regexp
to fail to match anything when creating the overlays.
(delete-trailing-whitespace)
function.langtool-output-regexp
to match carriage returns ("\r?\n" rather than "\n"). This might be more effective in practice.I may be able to generate a pull request that solves this soon.
I just updated package"langtool" via melpa, and got the notification of error "wrong error argument :stringp, nil". I checked my .init.el, my setting comes below:
(require 'langtool)
(setq langtool-language-tool-jar "/usr/local/Cellar/languagetool/2.8/libexec/languagetool-commandline.jar"
langtool-mother-tongue "en"
langtool-disabled-rules '("WHITESPACE_RULE"
"EN_UNPAIRED_BRACKETS"
"COMMA_PARENTHESIS_WHITESPACE"
"EN_QUOTES"))
(global-set-key (kbd "") 'langtool-check-buffer)
(global-set-key (kbd "M-") 'langtool-correct-buffer)
I surprisingly found out this issue could be "fixed" by commenting "require 'langtool", all the functions work well,is this a bug?
Recently, I've been using your package and one of the things that caught my attention. Currently this package is great if you want to check the grammar of a text. However, it can also be useful to check the grammar of any comment in any development language.
I was surprised to see that there is not yet a function that would allow langtool-check
to run only in code comments. In fact, such a function would avoid adding various rules in langtool-disabled-rules
in order to avoid errors related to the syntax of the programming language. In addition, these disabled rules are a disadvantage because you would like to activate them in most cases.
My idea is this: what do you think about implementing a function like flyspell-prog-mode
that would enable langtool only in comments when langtool-check
runs in a mode other than markdown-mode
, org-mode
, text-mode
?
Thank you for your work.
I've created a fork at https://github.com/justintaft/Emacs-langtool/tree/httpserver
Please let me know if I should create a Pull request. I can create a new package if this package is now not maintained.
Hey,
I'm trying to get LangTool to work on my Emacs.
I'm using Mac, and have java 8 installed.
Got language tool from the official site, and Emacs-langtool from Melpa (version 20160116.1654).
I followed the readme, and tried each of the alternatives. Here's my current setup:
(use-package langtool
:ensure t
:init
(setq langtool-language-tool-jar "~/Downloads/LanguageTool-3.2/languagetool-commandline.jar")
(setq langtool-default-language "en-US"))
I always get the same error message:
LanguageTool exited abnormally with code 1 (Exception in thread "main" java.lang.NoClassDefFoundError: org/languagetool/commandline/Main)
I'm sure configuring something wrong, but can't figure out what.
Thanks. Yaniv
I am using LanguageTool in LaTeX text. I guess that the integration with AUCTeX will be complicated, but I think that maybe it would be easy to implement the ability to skip commented regions.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.