emacs-languagetool/flycheck-languagetool

Silently fails/shows outdated errors when current buffer is not saved to a file

Closed this issue · 4 comments

mavit commented

If a buffer is not visiting a file (i.e., when buffer-file-name is nil) the languagetool Flycheck checker appears to be active, but no errors are highlighted.

If a buffer is visiting a file but that file has not been saved recently (i.e., when (buffer-modified-p) is t), errors are shown for the file as it is on disk, not as it is in the buffer.

Hi, @mavit!

I don't know if this is possible since the package itself works by using the languagetool-commandline.jar file and I don't think the executable accept checking by text and not file. 😕

mavit commented

If you specify - as the filename then it reads from STDIN:

> echo foo | java -jar languagetool-commandline.jar --language en-GB -
Expected text language: English (GB)
Working on STDIN...
1.) Line 1, column 0, Rule ID: UPPERCASE_SENTENCE_START prio=1
Message: This sentence does not start with an uppercase letter.
Suggestion: Foo
foo 
^^^ 
Time: 2485ms for 1 sentences (0.4 sentences/sec)

Cool! Thanks for the information! Just added in 96b4efd.

Can you upgrade to the latest version and see if this work for you? Thanks!

mavit commented

I think this will run into trouble if the buffer is larger than ARG_MAX, which varies from platform to platform. Also, on a multi-user system, it will allow other users to use the ps command to snoop on what you're writing.

It's probably better to pass input to the command over standard input directly, perhaps with (start-process ...) and (process-send-string ...).