doomemacs / doomemacs/core

Ivy actions for spell-fu

Open
#3,940 1 comment 0 reactions 0 assignees View on GitHub
:checkers spell help wanted is:feature
Dominant language
Emacs Lisp
Stars
22.7k
Forks
3.1k
Avg merge
10h 46m
Merged PRs (30d)
4

Description

**Describe the feature**
It used to be possible to add words to your personal dictionary (and other relevant spelling actions, though that's the one I used the most) from the ivy spelling interface using ivy actions. However, the current set of ivy actions for `+spell/correct` only includes the ivy defaults -- insert or copy.

From reading the ivy docs, I think you should be able to specify a custom list of actions for `+spell-correct-ivy-fn`, as documented [here](https://oremacs.com/swiper/#example---define-a-new-command-with-several-actions). My first pass looks like this, but it doesn't work as intended because the add-to-dictionary and copy commands still cause the word under the point to be deleted (i.e., they don't exit the parent function):

```emacs-lisp
(defun +spell-correct-ivy-fn (candidates word)
(ivy-read (format "Corrections for %S: " word) candidates
:action '(1
("RET" identity "Correct")
("i" (lambda (x) (spell-fu-word-add)) "Add to dictionary")
("w" ivy--action-copy "Copy"))))
```

I think getting this to work properly requires somehow handling the exit from `ivy-read` in `+spell/correct`, but I haven't been able to get that to work.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.