summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--emacs-config.org19
1 files changed, 18 insertions, 1 deletions
diff --git a/emacs-config.org b/emacs-config.org
index 113de33..26b4eeb 100644
--- a/emacs-config.org
+++ b/emacs-config.org
@@ -254,6 +254,22 @@ Enable spell checking.
(add-hook 'prog-mode-hook #'flyspell-prog-mode)
#+end_src
+Add add word to dictionary function.
+#+begin_src elisp
+ (defun +flyspell-add-word-to-dictionary ()
+ "Save word at point to personal dictionary."
+ (interactive)
+ (when-let ((loc (point))
+ (word (flyspell-get-word)))
+ (when (yes-or-no-p
+ (format "Add '%s' to dictionary?" (car word)))
+ (flyspell-do-correct
+ 'save nil (car word) loc (cadr word) (caddr word) loc)
+ (save-buffer)
+ (revert-buffer-quick)
+ (message "Added '%s' to personal dictionary" (car word)))))
+#+end_src
+
Set custom spell checking keybindings.
#+begin_src elisp
(setq-default flyspell-mode-map (make-sparse-keymap))
@@ -263,7 +279,8 @@ Set custom spell checking keybindings.
(keymap-set flyspell-mode-map "C-x c l" #'flyspell-check-previous-highlighted-word)
(keymap-set flyspell-mode-map "C-x c n" #'flyspell-goto-next-error)
(keymap-set flyspell-mode-map "C-x c b" #'flyspell-buffer)
- (keymap-set flyspell-mode-map "C-x c d" #'ispell-change-dictionary))
+ (keymap-set flyspell-mode-map "C-x c d" #'ispell-change-dictionary)
+ (keymap-set flyspell-mode-map "C-x c i" #'+flyspell-add-word-to-dictionary))
#+end_src
** Dired