0

When setting up my spell-checking with flyspell and hunspell, contractions such as shouldn't and isn't are getting flagged:

enter image description here

I believe it's not (entirely) the dictionary's issue (en_GB) as when I type in shouldnt the suggestion (from ispell-word) for shouldn't still comes up:

enter image description here

After accepting shouldn't and taking the cursor off it, the word gets flagged up again:

enter image description here

I'm not sure where in the flyspell/ispell/hunspell stack this can be addressed. The issue still occurs if I use backtick instead of single quote.

1 Answer 1

0

After digging around the ispell source (https://github.com/emacs-mirror/emacs/blob/master/lisp/textmodes/ispell.el), narrowed down the issue to (ispell-get-word 'f) returning shouldn when it should have been returning shouldn't; its docs suggested customising this behaviour using ispell-dictionary-alist.

A code search on GitHub suggested adding in something like '("en_GB" "[[:alpha:]]" "[^[:alpha:]]" "[']" nil ("-d" "en_GB") nil utf-8) to the list, which I've also had to do after flyspell-mode is activated, so overall something like this fixed it for me:

(defun my/fix-ispell-contraction ()
  "Fixes contractions (e.g. shouldn't) aren't not being checked properly.
See https://github.com/casouri/lunarymacs/blob/master/star/checker.el#L44-L49."
  (add-to-list 'ispell-dictionary-alist
               '("en_GB" "[[:alpha:]]" "[^[:alpha:]]" "[']" nil ("-d" "en_GB") nil utf-8)))

;; Flyspell
(use-package flyspell
  :ensure nil
  :config
  (add-hook 'flyspell-mode-hook 'my/fix-ispell-contraction)
...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.