Add better languagetool implementation to emacs

This commit is contained in:
Julian Mutter 2023-08-27 18:27:57 +02:00
parent 3ae6dac93b
commit c9713e83b9
4 changed files with 28 additions and 57 deletions

View File

@ -41,6 +41,7 @@
(map! :desc "Flycheck next error" :nv "g n" #'flycheck-next-error) (map! :desc "Flycheck next error" :nv "g n" #'flycheck-next-error)
(map! :desc "Flycheck previous error" :nv "g N" #'flycheck-previous-error) (map! :desc "Flycheck previous error" :nv "g N" #'flycheck-previous-error)
(map! :leader "c X" #'flycheck-list-errors)
(map! :desc "Format and save" :g "C-s" #'fd-format-and-save) (map! :desc "Format and save" :g "C-s" #'fd-format-and-save)
(map! :leader "w 1" #'delete-other-windows) (map! :leader "w 1" #'delete-other-windows)
@ -159,19 +160,6 @@
(map! :map TeX-mode-map :nv "C-h" #'outline-up-heading) (map! :map TeX-mode-map :nv "C-h" #'outline-up-heading)
(map! :map TeX-mode-map :nv "C-l" #'outline-next-heading) (map! :map TeX-mode-map :nv "C-l" #'outline-next-heading)
(add-hook 'LaTeX-mode-hook 'langtool-ignore-fonts-minor-mode)
(use-package! langtool-ignore-fonts
:config
(langtool-ignore-fonts-add 'latex-mode '(font-lock-comment-face
;; font-latex-math-face
;; font-latex-string-face
font-lock-keyword-face
font-lock-constant-face
font-lock-function-name-face
font-lock-variable-name-face
font-lock-type-face))) ;; figure captions
;; Fixes latexindent not finding perl libraries ;; Fixes latexindent not finding perl libraries
(setenv "PERL5LIB" "~/perl5/lib/perl5") (setenv "PERL5LIB" "~/perl5/lib/perl5")
@ -180,33 +168,16 @@
** Spell Checking ** Spell Checking
#+begin_src emacs-lisp :tangle yes #+begin_src emacs-lisp :tangle yes
(use-package! lsp-ltex
:init
(setq lsp-ltex-enabled t)
(setq lsp-ltex-language "en-US")
(setq lsp-ltex-mother-tongue "de-DE"))
;; Do not automatically enable writegood mode ;; Do not automatically enable writegood mode
(remove-hook! '(org-mode-hook markdown-mode-hook rst-mode-hook asciidoc-mode-hook latex-mode-hook LaTeX-mode-hook) #'writegood-mode) (remove-hook! '(org-mode-hook markdown-mode-hook rst-mode-hook asciidoc-mode-hook latex-mode-hook LaTeX-mode-hook) #'writegood-mode)
(use-package! langtool
:init
(setq langtool-language-tool-jar "~/git/languagetool/languagetool-standalone/target/LanguageTool-6.1-SNAPSHOT/LanguageTool-6.1-SNAPSHOT/languagetool-commandline.jar")
(setq langtool-default-language "de-DE"))
;; (use-package lsp-grammarly
;; :ensure t
;; :hook (text-mode . (lambda ()
;; (require 'lsp-grammarly)
;; (lsp)))) ; or lsp-deferred
;; (use-package! lsp-ltex
;; :ensure t
;; :hook (text-mode . (lambda ()
;; (require 'lsp-ltex)
;; (lsp))) ; or lsp-deferred
;; :init
;; (setq lsp-ltex-version "16.0.0")) ; make sure you have set this, see below
;; (after! lsp-grammarly
;; :hook (text-mode . (lambda ()
;; (require 'lsp-grammarly)
;; (lsp))))
;; TODO make toggling of spell checking ('SPC t s') use flyspell-mode in text modesm and flyspell-prog-mode in programming modes (see hooks below)
;; Removing hooks for automatic spell checking set here: https://github.com/hlissner/doom-emacs/blob/develop/modules/checkers/spell/config.el ;; Removing hooks for automatic spell checking set here: https://github.com/hlissner/doom-emacs/blob/develop/modules/checkers/spell/config.el
(remove-hook! '(org-mode-hook (remove-hook! '(org-mode-hook
markdown-mode-hook markdown-mode-hook

View File

@ -82,7 +82,7 @@
:checkers :checkers
(syntax +childframe) ; tasing you for every semicolon you forget (syntax +childframe) ; tasing you for every semicolon you forget
(spell +flyspell +hunspell +everywhere) ; tasing you for misspelling mispelling (spell +flyspell +hunspell +everywhere) ; tasing you for misspelling mispelling
grammar ; tasing grammar mistake every you make ;; grammar ; tasing grammar mistake every you make
:tools :tools
ansible ansible

View File

@ -10,21 +10,18 @@
;(package! some-package) ;(package! some-package)
(package! company-quickhelp) (package! company-quickhelp)
;; (package! lsp-grammarly)
;; (package! lsp-ltex)
;; (unpin! org-roam) (package! github-tags) ;; Needed for lsp-ltex auto-install to work
;; (package! org :pin "ca873f7") (package! lsp-ltex)
(package! org-roam-ui) (package! org-roam-ui)
(package! langtool-ignore-fonts)
(package! openwith) (package! openwith)
;; To install a package directly from a remote git repo, you must specify a ;; To install a package directly from a remote git repo, you must specify a
;; `:recipe'. You'll find documentation on what `:recipe' accepts here: ;; `:recipe'. You'll find documentation on what `:recipe' accepts here:
;; https://github.com/raxod502/straight.el#the-recipe-format ;; https://github.com/raxod502/straight.el#the-recipe-format
;(package! another-package ;(package! another-package
; :recipe (:host github :repo "username/repo")) ; :recipe (:host github :repo "username/repo"))
(package! matlab (package! matlab
:recipe (:repo "https://git.code.sf.net/p/matlab-emacs/src" )) :recipe (:repo "https://git.code.sf.net/p/matlab-emacs/src" ))
@ -32,33 +29,33 @@
;; If the package you are trying to install does not contain a PACKAGENAME.el ;; If the package you are trying to install does not contain a PACKAGENAME.el
;; file, or is located in a subdirectory of the repo, you'll need to specify ;; file, or is located in a subdirectory of the repo, you'll need to specify
;; `:files' in the `:recipe': ;; `:files' in the `:recipe':
;(package! this-package ;(package! this-package
; :recipe (:host github :repo "username/repo" ; :recipe (:host github :repo "username/repo"
; :files ("some-file.el" "src/lisp/*.el"))) ; :files ("some-file.el" "src/lisp/*.el")))
;; If you'd like to disable a package included with Doom, you can do so here ;; If you'd like to disable a package included with Doom, you can do so here
;; with the `:disable' property: ;; with the `:disable' property:
;(package! builtin-package :disable t) ;(package! builtin-package :disable t)
;; You can override the recipe of a built in package without having to specify ;; You can override the recipe of a built in package without having to specify
;; all the properties for `:recipe'. These will inherit the rest of its recipe ;; all the properties for `:recipe'. These will inherit the rest of its recipe
;; from Doom or MELPA/ELPA/Emacsmirror: ;; from Doom or MELPA/ELPA/Emacsmirror:
;(package! builtin-package :recipe (:nonrecursive t)) ;(package! builtin-package :recipe (:nonrecursive t))
;(package! builtin-package-2 :recipe (:repo "myfork/package")) ;(package! builtin-package-2 :recipe (:repo "myfork/package"))
;; Specify a `:branch' to install a package from a particular branch or tag. ;; Specify a `:branch' to install a package from a particular branch or tag.
;; This is required for some packages whose default branch isn't 'master' (which ;; This is required for some packages whose default branch isn't 'master' (which
;; our package manager can't deal with; see raxod502/straight.el#279) ;; our package manager can't deal with; see raxod502/straight.el#279)
;(package! builtin-package :recipe (:branch "develop")) ;(package! builtin-package :recipe (:branch "develop"))
;; Use `:pin' to specify a particular commit to install. ;; Use `:pin' to specify a particular commit to install.
;(package! builtin-package :pin "1a2b3c4d5e") ;(package! builtin-package :pin "1a2b3c4d5e")
;; Doom's packages are pinned to a specific commit and updated from release to ;; Doom's packages are pinned to a specific commit and updated from release to
;; release. The `unpin!' macro allows you to unpin single packages... ;; release. The `unpin!' macro allows you to unpin single packages...
;(unpin! pinned-package) ;(unpin! pinned-package)
;; ...or multiple packages ;; ...or multiple packages
;(unpin! pinned-package another-pinned-package) ;(unpin! pinned-package another-pinned-package)
;; ...Or *all* packages (NOT RECOMMENDED; will likely break things) ;; ...Or *all* packages (NOT RECOMMENDED; will likely break things)
;(unpin! t) ;(unpin! t)

View File

@ -193,7 +193,7 @@
xdg.portal.enable = true; xdg.portal.enable = true;
xdg.portal.extraPortals = [ pkgs.xdg-desktop-portal-gtk ]; xdg.portal.extraPortals = [ pkgs.xdg-desktop-portal-gtk ];
services.emacs.enable = true; # services.emacs.enable = true;
services.gnome.gnome-keyring.enable = true; services.gnome.gnome-keyring.enable = true;
@ -293,6 +293,9 @@
pulseaudio pulseaudio
gcolor3 gcolor3
geogebra geogebra
languagetool
xclip
]; ];
nixpkgs.overlays = [ nixpkgs.overlays = [