From b87f56abcf71de12b2a26f9201a31d2528659ebe Mon Sep 17 00:00:00 2001 From: Riyyi Date: Tue, 16 Aug 2022 22:52:25 +0200 Subject: [PATCH] Emacs: Add spell checker toggle function --- .config/emacs/config.org | 1 + .config/emacs/config/development.org | 13 ++++++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/.config/emacs/config.org b/.config/emacs/config.org index aa04b0f..e3f1ec6 100644 --- a/.config/emacs/config.org +++ b/.config/emacs/config.org @@ -1065,6 +1065,7 @@ General.el ~leader key binds. "t k" '(centaur-tabs-select-beg-tab :which-key "Tab select last") "t l" '(centaur-tabs-forward-group :which-key "Tab forward group") "t n" '(neotree-toggle-in-project-root :which-key "Toggle Neotree") + "t s" '(dot/flyspell-toggle :which-key "Toggle spell checker") "t w" '(visual-line-mode :which-key "Toggle line wrapping") ;; Update packages diff --git a/.config/emacs/config/development.org b/.config/emacs/config/development.org index b24cdbf..818250c 100644 --- a/.config/emacs/config/development.org +++ b/.config/emacs/config/development.org @@ -416,7 +416,18 @@ Give Flyspell a selection menu. :hook (org-mode . flyspell-mode) :config (setq flyspell-issue-message-flag nil) - (setq flyspell-issue-welcome-flag nil)) + (setq flyspell-issue-welcome-flag nil) + + (defun dot/flyspell-toggle () + "Toggle Flyspell, prompt for language." + (interactive) + (if (symbol-value flyspell-mode) + (flyspell-mode -1) + (call-interactively 'ispell-change-dictionary) + (if (derived-mode-p 'prog-mode) + (flyspell-prog-mode) + (flyspell-mode)) + (flyspell-buffer)))) #+END_SRC **** Rainbow Delimiters