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 inhibit-splash-screen t
custom-file (expand-file-name "custom.el" temporary-file-directory)) 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 (use-package undo-fu
:demand t :demand t
:config :config
@ -412,6 +420,7 @@
(use-package pdf-tools (use-package pdf-tools
:mode ("\\.pdf\\'" . pdf-view-mode) :mode ("\\.pdf\\'" . pdf-view-mode)
:bind (:map pdf-view-mode-map ("/" . #'isearch-forward))
:config :config
(pdf-tools-install)) (pdf-tools-install))
@ -504,15 +513,43 @@
(use-package meson-mode) (use-package meson-mode)
(use-package spell-fu
:hook org-mode text-mode)
(use-package minimap (use-package minimap
:commands minimap-mode
:custom-face :custom-face
(minimap-active-region-background ((t (:background unspecified :inherit hl-line)))) (minimap-active-region-background ((t (:background unspecified :inherit hl-line))))
:hook (minimap-sb-mode . turn-on-solaire-mode)) :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 (use-package magit
:hook ((git-commit-setup . git-commit-turn-on-flyspell) :hook (git-commit-setup . my-magit-commit-text-setup))
(git-commit-setup . git-commit-turn-on-auto-fill)))
(use-package tramp (use-package tramp
:custom :custom
@ -556,12 +593,10 @@
(add-to-list 'meow-mode-state-list '(vterm-mode . insert)))) (add-to-list 'meow-mode-state-list '(vterm-mode . insert))))
(use-package elfeed (use-package elfeed
:commands (elfeed elfeed-update)
:custom :custom
(elfeed-feeds '(("https://archlinux.org/feeds/news/" arch-linux)))) (elfeed-feeds '(("https://archlinux.org/feeds/news/" arch-linux))))
(use-package xkcd (use-package xkcd)
:commands xkcd)
(use-package ligature (use-package ligature
:hook (prog-mode :hook (prog-mode
@ -624,14 +659,6 @@
(add-to-list 'emacs-everywhere-frame-parameters '(width . 120)) (add-to-list 'emacs-everywhere-frame-parameters '(width . 120))
(add-to-list 'emacs-everywhere-frame-parameters '(height . 20))) (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 (use-package ffap
:ensure nil :ensure nil
:demand t :demand t