Emacs: Use hunspell, add multi-dict "en_US,de_DE".

This commit is contained in:
tastytea 2020-08-22 20:52:00 +02:00
parent 1cda6ed3f9
commit 22da20bf74
1 changed files with 17 additions and 5 deletions

View File

@ -1,6 +1,6 @@
;;; common.el --- Common settings for text files. -*- lexical-binding: t; -*-
;; Time-stamp: <2020-05-24T22:51:00+0200>
;; Time-stamp: <2020-08-22T20:50:31+0200>
;;; Commentary:
@ -83,14 +83,26 @@
:hook ((find-file . display-fill-column-indicator-mode)
(text-mode . display-fill-column-indicator-mode))))
;; Spell checking.
;; spell checking.
(use-package ispell
:straight nil
;; Use hunspell with multiple dictionaries if possible.
;; <https://200ok.ch/posts/2020-08-22_setting_up_spell_checking_with_multiple_dictionaries.html>
:config (when (executable-find "hunspell")
(customize-set-variable 'ispell-program-name
(executable-find "hunspell"))
;; (customize-set-variable 'ispell-dictionary "en_US,de_DE")
(ispell-set-spellchecker-params)
(ispell-hunspell-add-multi-dic "en_US,de_DE")))
;; Interactive spell checking.
(unless slow-computer
(use-package flyspell
:if (or (executable-find "aspell")
(executable-find "hunspell")
(executable-find "ispell"))
:diminish flyspell-mode
:custom (flyspell-default-dictionary "english")
:custom ((flyspell-default-dictionary "en_US"))
:config (progn
(defun my/toggle-flyspell ()
"Toggle flyspell-mode and run flyspell-buffer after activating."
@ -103,10 +115,10 @@
(defun my/flyspell-german ()
"Set dictionary to german."
(interactive)
(ispell-change-dictionary "german")))
(ispell-change-dictionary "de_DE")))
:bind (("<f8>" . my/toggle-flyspell)
(:map flyspell-mode-map
("C-;" . nil))) ; iedit needs C-;.
("C-;" . nil))) ; iedit needs C-;.
:hook ((prog-mode . flyspell-prog-mode) ; Spellcheck comments.
(text-mode . flyspell-mode) ; Spellcheck text documents ↓.
(LaTeX-mode . my/flyspell-german)