diff options
| author | Blake Romero <blake@blkrom.com> | 2025-07-10 19:15:40 +0100 |
|---|---|---|
| committer | Blake Romero <blake@blkrom.com> | 2025-07-10 19:15:40 +0100 |
| commit | 6901533882baffec488dfaf09674ccbc5cd05d83 (patch) | |
| tree | e35c7a9b8e7780317631f54637c93f0c5287b071 | |
| parent | f4dfc6728c290ac140e4a3c17c595772e9a0d7d6 (diff) | |
Add add word to dictionary function and keybinding
| -rw-r--r-- | emacs-config.org | 19 |
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 |
