From af075fa5ad86917d4dd7e280ec6478ef4b966e89 Mon Sep 17 00:00:00 2001 From: noa@gaiwan.org Date: Fri, 14 Jun 2024 00:35:14 +0000 Subject: Use jinx for spellchecking --- emacs/init.el | 32 +++++++++++++++++++++++--------- 1 file changed, 23 insertions(+), 9 deletions(-) diff --git a/emacs/init.el b/emacs/init.el index ff82975..f68cbac 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -145,9 +145,29 @@ and when JID is not in `jabber-activity-banned'." (use-package nov :ensure t) (add-to-list 'auto-mode-alist '("\\.epub\\'" . nov-mode)) -;; also check out jinx https://github.com/minad/jinx -(use-package spell-fu :ensure t) -(add-hook 'text-mode-hook #'spell-fu-mode) +;;; Spellcheck +(use-package jinx :ensure t) +(setopt global-jinx-mode t) +(keymap-global-set "M-$" #'jinx-correct) +(keymap-global-set "C-M-$" #'jinx-languages) +(add-to-list 'vertico-multiform-categories + '(jinx grid (vertico-grid-annotate . 20))) +(defun jinx--add-to-abbrev (overlay word) + "Add abbreviation to `global-abbrev-table'. +The misspelled word is taken from OVERLAY. WORD is the corrected word." + (let ((abbrev (buffer-substring-no-properties + (overlay-start overlay) + (overlay-end overlay)))) + (message "Abbrev: %s -> %s" abbrev word) + (define-abbrev global-abbrev-table abbrev word))) + +(advice-add 'jinx--correct-replace :before #'jinx--add-to-abbrev) +;;; spellcheck +;; (add-hook 'text-mode-hook #'flyspell-mode) +;; (setopt ispell-program-name "aspell" +;; ispell-dictionary "en_GB" +;; ispell-extra-args '("--sug-mode=ultra")) + ;;; Completing-read everywhere with consult @@ -595,12 +615,6 @@ and when JID is not in `jabber-activity-banned'." ;;; sentences (setopt sentence-end-double-space nil) -;;; spellcheck -(setopt flyspell-mode t - ispell-program-name "aspell" - ispell-dictionary "en_GB" - ispell-extra-args '("--sug-mode=ultra")) - ;; If i write a script, i will always run chmod +x after saving it. This command means i don't have to do that. (add-hook 'after-save-hook #'executable-make-buffer-file-executable-if-script-p) -- cgit 1.4.1-2-gfad0