Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Emacs flycheck checker for yalafi #206

Open
soli opened this issue Mar 29, 2021 · 3 comments
Open

Emacs flycheck checker for yalafi #206

soli opened this issue Mar 29, 2021 · 3 comments
Labels
enhancement New feature or request type: editor integration Concerning YaLafi integration into text editors

Comments

@soli
Copy link

soli commented Mar 29, 2021

Not an issue per se but a suggestion: there's a simple way to get a flycheck (more or less emacs equivalent of ALE for vim) spell/grammar-checker with yalafi as follows.

Just add to your .emacs the following snippet (that I may, one day, try to push to flycheck's repo)

  (flycheck-define-checker tex-yalafi
    "A LaTeX grammar/spelling checker using languagetool and yalafi.

    See https://github.com/matze-dd/YaLafi"
    :modes (latex-mode plain-tex-mode)
    :command ("python3" "-m" "yalafi.shell" "--lt-command" "languagetool" source)
    :error-patterns ((warning line-start "=== " (file-name) " ===\n"
                              (one-or-more digit) ".) Line " line ", column " column
                              ", Rule ID: " (id (one-or-more (any "A-Z_")) (optional "[" (one-or-more digit)"]")) "\n"
                              "Message: " (message) line-end))
    :enabled (lambda () (and
                         (flycheck-python-find-module 'tex-yalafi "yalafi.shell")
                         (executable-find "languagetool")))
    :verify (lambda (_) (flycheck-python-verify-module 'tex-yalafi "yalafi.shell")))
  (add-to-list 'flycheck-checkers 'tex-yalafi t)
  (flycheck-add-next-checker 'tex-chktex 'tex-yalafi)

This should work directly (no shell script involved, no package dependency except flycheck). Didn't try to get a sever-based version to work (I just have the CLI version).

If you want I can make a pull request to the README, but I guess you can just add it as you like…

@enikko
Copy link

enikko commented Jun 8, 2022

There’s already a flycheck module for language languagetool for emacs: https://github.com/emacs-languagetool/flycheck-languagetool

Would be nice to see if one could simply integrate this tool into that module (by making it language-aware to some extent).

@soli
Copy link
Author

soli commented Jun 8, 2022

Sorry but I have no idea how one would do that… you can open an Issue there, but that's far beyond my emacs-lisp knowledge (which is very limited).

@enikko
Copy link

enikko commented Jun 8, 2022

Nothing to be sorry for :)

just threw my two cents in. Hopefully, a module will be updated in the future.

@torik42 torik42 added enhancement New feature or request type: editor integration Concerning YaLafi integration into text editors labels Aug 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request type: editor integration Concerning YaLafi integration into text editors
Projects
None yet
Development

No branches or pull requests

3 participants