Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a custom value to set default flyspell correct direction. #102

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions flyspell-correct.el
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,12 @@

;; Variables

(defcustom flyspell-default-direction 'backward
"Default direction to work in. 'forward starts correcting after point
and 'backward starts correcting before point."
:group 'flyspell-correct
:type 'symbol)

(defcustom flyspell-correct-interface #'flyspell-correct-completing-read
"Interface for `flyspell-correct-at-point'.

Expand Down Expand Up @@ -326,16 +332,16 @@ misspelled words in the buffer."
- Three \\[universal-argument]'s changes direction of spelling
errors search and enables rapid mode."
(interactive)
(let ((forward-direction nil)
(rapid nil))
(let ((forward-direction (equal flyspell-default-direction 'forward))
(rapid nil))
(cond
((equal current-prefix-arg '(4)) ; C-u = rapid
(setq rapid t))
((equal current-prefix-arg '(16)) ; C-u C-u = change direction
(setq forward-direction t))
(setq forward-direction (not forward-direction)))
((equal current-prefix-arg '(64)) ; C-u C-u C-u = do both
(setq rapid t)
(setq forward-direction t)))
(setq forward-direction (not forward-direction))))

(flyspell-correct-move (point) forward-direction rapid)))

Expand Down