Smarter RET in normal mode over flyspell regions

Will now trigger flyspell-correct-word-generic
This commit is contained in:
Henrik Lissner 2019-02-26 16:54:32 -05:00
parent db2949ff32
commit 594df64913
No known key found for this signature in database
GPG Key ID: 5F6C0EA160557395
2 changed files with 13 additions and 0 deletions

View File

@ -55,6 +55,12 @@
(fboundp 'evilmi-jump-items)
'evilmi-jump-items)
;; Smarter RET in normal mode
:n "RET" (general-predicate-dispatch nil
(and (bound-and-true-p flyspell-mode)
(+flyspell-correction-at-point-p))
'flyspell-correct-word-generic)
;; Smarter newlines
:i [remap newline] #'newline-and-indent ; auto-indent on newline
:i "C-j" #'+default/newline ; default behavior

View File

@ -14,3 +14,10 @@
"TODO"
(when-let* ((pred (assq major-mode +flyspell--predicate-alist)))
(setq-local flyspell-generic-check-word-predicate (cdr pred))))
;;;###autoload
(defun +flyspell-correction-at-point-p (&optional point)
"TODO"
(cl-loop for ov in (overlays-at (or point (point)))
if (overlay-get ov 'flyspell-overlay)
return t))