|
33 | 33 | (require 'evil-jumps)
|
34 | 34 | (require 'evil-vars)
|
35 | 35 | (require 'flyspell)
|
| 36 | +(require 'ispell) |
36 | 37 | (require 'cl-lib)
|
37 | 38 | (require 'reveal)
|
38 | 39 |
|
@@ -636,6 +637,38 @@ and jump to the corresponding one."
|
636 | 637 | (when ov
|
637 | 638 | (goto-char (overlay-start ov))))))))
|
638 | 639 |
|
| 640 | +(defun evil-ispell-mark-word-as-good (word) |
| 641 | + "Add WORD under the cursor as a good word to the Ispell dictionary." |
| 642 | + (interactive (list (thing-at-point 'word))) |
| 643 | + ;; accept and insert word into personal dictionary. |
| 644 | + (ispell-send-string (concat "*" word "\n")) |
| 645 | + ;; dictionary modified! |
| 646 | + (setq ispell-pdict-modified-p '(t)) |
| 647 | + (ispell-pdict-save ispell-silently-savep) |
| 648 | + (when (bound-and-true-p flyspell-mode) |
| 649 | + (let ((start (car (bounds-of-thing-at-point 'word)))) |
| 650 | + (when start |
| 651 | + (flyspell-unhighlight-at start)))) |
| 652 | + (message "Word '%s' added to personal dictionary" (upcase word))) |
| 653 | + |
| 654 | +(defun evil-ispell-mark-word-as-locally-good (word &optional buffer-local) |
| 655 | + "Add WORD under the cursor to the session dictionary. |
| 656 | +If BUFFER-LOCAL is non-nil, the word will be added to current buffer." |
| 657 | + (interactive (list (thing-at-point 'word) current-prefix-arg)) |
| 658 | + ;; accept word without insertion |
| 659 | + (ispell-send-string (concat "@" word "\n")) |
| 660 | + (add-to-list 'ispell-buffer-session-localwords word) |
| 661 | + ;; session localwords might conflict. |
| 662 | + (unless ispell-buffer-local-name |
| 663 | + (setq ispell-buffer-local-name (buffer-name))) |
| 664 | + (when buffer-local |
| 665 | + (ispell-add-per-file-word-list word)) |
| 666 | + (when (bound-and-true-p flyspell-mode) |
| 667 | + (let ((start (car (bounds-of-thing-at-point 'word)))) |
| 668 | + (when start |
| 669 | + (flyspell-unhighlight-at start)))) |
| 670 | + (message "Word '%s' added to local dictionary" (upcase word))) |
| 671 | + |
639 | 672 | (evil-define-motion evil-next-flyspell-error (count)
|
640 | 673 | "Go to the COUNT'th spelling mistake after point."
|
641 | 674 | (interactive "p")
|
|
0 commit comments