From c9713e83b9cbcd61d75c70d51134eacab452278b Mon Sep 17 00:00:00 2001 From: Julian Mutter Date: Sun, 27 Aug 2023 18:27:57 +0200 Subject: [PATCH] Add better languagetool implementation to emacs --- emacs/doom/config.org | 45 ++++++++---------------------------------- emacs/doom/init.el | 2 +- emacs/doom/packages.el | 33 ++++++++++++++----------------- nix/configuration.nix | 5 ++++- 4 files changed, 28 insertions(+), 57 deletions(-) diff --git a/emacs/doom/config.org b/emacs/doom/config.org index 3d49354..e18b09f 100644 --- a/emacs/doom/config.org +++ b/emacs/doom/config.org @@ -41,6 +41,7 @@ (map! :desc "Flycheck next error" :nv "g n" #'flycheck-next-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! :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-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 (setenv "PERL5LIB" "~/perl5/lib/perl5") @@ -180,33 +168,16 @@ ** Spell Checking #+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 (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 (remove-hook! '(org-mode-hook markdown-mode-hook diff --git a/emacs/doom/init.el b/emacs/doom/init.el index 8233ccd..4abdee8 100644 --- a/emacs/doom/init.el +++ b/emacs/doom/init.el @@ -82,7 +82,7 @@ :checkers (syntax +childframe) ; tasing you for every semicolon you forget (spell +flyspell +hunspell +everywhere) ; tasing you for misspelling mispelling - grammar ; tasing grammar mistake every you make + ;; grammar ; tasing grammar mistake every you make :tools ansible diff --git a/emacs/doom/packages.el b/emacs/doom/packages.el index 6c3ad1f..06b0be4 100644 --- a/emacs/doom/packages.el +++ b/emacs/doom/packages.el @@ -10,21 +10,18 @@ ;(package! some-package) (package! company-quickhelp) -;; (package! lsp-grammarly) -;; (package! lsp-ltex) -;; (unpin! org-roam) -;; (package! org :pin "ca873f7") +(package! github-tags) ;; Needed for lsp-ltex auto-install to work +(package! lsp-ltex) (package! org-roam-ui) -(package! langtool-ignore-fonts) (package! openwith) ;; To install a package directly from a remote git repo, you must specify a ;; `:recipe'. You'll find documentation on what `:recipe' accepts here: ;; https://github.com/raxod502/straight.el#the-recipe-format -;(package! another-package -; :recipe (:host github :repo "username/repo")) + ;(package! another-package + ; :recipe (:host github :repo "username/repo")) (package! matlab :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 ;; file, or is located in a subdirectory of the repo, you'll need to specify ;; `:files' in the `:recipe': -;(package! this-package -; :recipe (:host github :repo "username/repo" -; :files ("some-file.el" "src/lisp/*.el"))) + ;(package! this-package + ; :recipe (:host github :repo "username/repo" + ; :files ("some-file.el" "src/lisp/*.el"))) ;; If you'd like to disable a package included with Doom, you can do so here ;; 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 ;; all the properties for `:recipe'. These will inherit the rest of its recipe ;; from Doom or MELPA/ELPA/Emacsmirror: -;(package! builtin-package :recipe (:nonrecursive t)) -;(package! builtin-package-2 :recipe (:repo "myfork/package")) + ;(package! builtin-package :recipe (:nonrecursive t)) + ;(package! builtin-package-2 :recipe (:repo "myfork/package")) ;; 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 ;; 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. -;(package! builtin-package :pin "1a2b3c4d5e") + ;(package! builtin-package :pin "1a2b3c4d5e") ;; Doom's packages are pinned to a specific commit and updated from release to ;; release. The `unpin!' macro allows you to unpin single packages... -;(unpin! pinned-package) + ;(unpin! pinned-package) ;; ...or multiple packages -;(unpin! pinned-package another-pinned-package) + ;(unpin! pinned-package another-pinned-package) ;; ...Or *all* packages (NOT RECOMMENDED; will likely break things) -;(unpin! t) + ;(unpin! t) diff --git a/nix/configuration.nix b/nix/configuration.nix index c37254e..04879eb 100644 --- a/nix/configuration.nix +++ b/nix/configuration.nix @@ -193,7 +193,7 @@ xdg.portal.enable = true; xdg.portal.extraPortals = [ pkgs.xdg-desktop-portal-gtk ]; - services.emacs.enable = true; + # services.emacs.enable = true; services.gnome.gnome-keyring.enable = true; @@ -293,6 +293,9 @@ pulseaudio gcolor3 geogebra + + languagetool + xclip ]; nixpkgs.overlays = [