Replace flyspell with spell-fu

This commit is contained in:
eriedaberrie 2023-03-08 10:04:19 -08:00
parent c97d1a0828
commit db3a294889

55
init.el
View file

@ -22,6 +22,14 @@
inhibit-splash-screen t
custom-file (expand-file-name "custom.el" temporary-file-directory))
(use-package f)
(use-package dash
:hook (emacs-lisp-mode . dash-fontify-mode)
:init
(with-eval-after-load 'info-look
(dash-register-info-lookup)))
(use-package undo-fu
:demand t
:config
@ -412,6 +420,7 @@
(use-package pdf-tools
:mode ("\\.pdf\\'" . pdf-view-mode)
:bind (:map pdf-view-mode-map ("/" . #'isearch-forward))
:config
(pdf-tools-install))
@ -504,15 +513,43 @@
(use-package meson-mode)
(use-package spell-fu
:hook org-mode text-mode)
(use-package minimap
:commands minimap-mode
:custom-face
(minimap-active-region-background ((t (:background unspecified :inherit hl-line))))
:hook (minimap-sb-mode . turn-on-solaire-mode))
(defun my-magit-commit-text-setup ()
(git-commit-turn-on-auto-fill)
(spell-fu-mode)
(setq-local spell-fu-check-range #'my-magit-spell-fu-check-range)
(spell-fu--time-ensure t))
(defun my-magit-spell-fu-check-range (pos-beg pos-end)
(require 'dash)
(spell-fu--overlays-remove pos-beg pos-end)
(with-syntax-table spell-fu-syntax-table
(save-match-data
(save-excursion
(goto-char (point-min))
(let ((check-end (-> (concat "^" comment-start " -+ >8 -+$")
(re-search-forward pos-end t)
(or pos-end)))
(comment-start-char (aref comment-start 0)))
(goto-char pos-beg)
(while (< (point) check-end)
(unless (= (char-after) comment-start-char)
(let ((pos-line-end (pos-eol)))
(while (re-search-forward spell-fu-word-regexp pos-line-end t)
(let ((word-beg (match-beginning 0))
(word-end (match-end 0)))
(spell-fu-check-word word-beg word-end (match-string-no-properties 0))))))
(forward-line)))))))
(use-package magit
:hook ((git-commit-setup . git-commit-turn-on-flyspell)
(git-commit-setup . git-commit-turn-on-auto-fill)))
:hook (git-commit-setup . my-magit-commit-text-setup))
(use-package tramp
:custom
@ -556,12 +593,10 @@
(add-to-list 'meow-mode-state-list '(vterm-mode . insert))))
(use-package elfeed
:commands (elfeed elfeed-update)
:custom
(elfeed-feeds '(("https://archlinux.org/feeds/news/" arch-linux))))
(use-package xkcd
:commands xkcd)
(use-package xkcd)
(use-package ligature
:hook (prog-mode
@ -624,14 +659,6 @@
(add-to-list 'emacs-everywhere-frame-parameters '(width . 120))
(add-to-list 'emacs-everywhere-frame-parameters '(height . 20)))
(use-package flyspell
:ensure nil
:hook org-mode text-mode
:custom
(flyspell-auto-correct-binding (kbd "C-:"))
:config
(keymap-unset flyspell-mode-map "C-."))
(use-package ffap
:ensure nil
:demand t