From 22da20bf744e481e42699035b6c425e41dae5db0 Mon Sep 17 00:00:00 2001 From: tastytea Date: Sat, 22 Aug 2020 20:52:00 +0200 Subject: [PATCH] Emacs: Use hunspell, add multi-dict "en_US,de_DE". --- init.d/text/common.el | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/init.d/text/common.el b/init.d/text/common.el index b3b1546..11ada51 100644 --- a/init.d/text/common.el +++ b/init.d/text/common.el @@ -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. + ;; + :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 (("" . 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)