Implement cleaner version

This commit is contained in:
Ian Wahbe 2020-12-06 23:57:40 +01:00
parent a51be66d30
commit 448bff2fd8

View file

@ -64,9 +64,9 @@
(if (not (or (featurep! :completion ivy) (if (not (or (featurep! :completion ivy)
(featurep! :completion helm))) (featurep! :completion helm)))
(call-interactively #'ispell-word) (call-interactively #'ispell-word)
(let ((current-point (bounds-of-thing-at-point 'word))) (cl-destructuring-bind (start . end)
(if current-point (or (bounds-of-thing-at-point 'word)
(cl-destructuring-bind (start . end) current-point (user-error "No word at point"))
(let ((word (thing-at-point 'word t)) (let ((word (thing-at-point 'word t))
(orig-pt (point)) (orig-pt (point))
poss ispell-filter) poss ispell-filter)
@ -107,8 +107,7 @@
(+spell--correct cmd poss wrd orig-pt start end) (+spell--correct cmd poss wrd orig-pt start end)
(unless (string-equal wrd word) (unless (string-equal wrd word)
(+spell--correct wrd poss word orig-pt start end)))))) (+spell--correct wrd poss word orig-pt start end))))))
(ispell-pdict-save t))))) (ispell-pdict-save t)))))))
(user-error "No word at point")))))
;;;###autoload (defalias '+spell/add-word #'spell-fu-word-add) ;;;###autoload (defalias '+spell/add-word #'spell-fu-word-add)
;;;###autoload (defalias '+spell/remove-word #'spell-fu-word-remove) ;;;###autoload (defalias '+spell/remove-word #'spell-fu-word-remove)