Changing ispell dictionaries
Dec. 2nd, 2011 09:52 pmAfter my move back to GNU Emacs, I've finally come up with a way to switch the default dictionary from American to British English.
Initially I attempted to change the dictionary by changing the value of
Eventually, after examining the
ETA: For the record, the actual magic incantation I added to my
Initially I attempted to change the dictionary by changing the value of
ispell-dictionary-alist in my .emacs init file, but I found that this kept on being reset back to the default value even when I tried to trigger the code using an eval-after-load. I concluded that the value was being reset every time a new ispell command — actually hunspell in my environment — was created and decided to apply a short term fix — setting DICTIONARY=en_GB in my environment before starting Emacs — while I contemplated how to fix things properly.Eventually, after examining the
ispell.el source and consulting the documentation, I realised that all I needed to do was change ispell-dictionary-alist to ispell-dictionary-default-alist to get each new ispell session to pick up the correct dictionary list. Once this was working, I changed the defaults to British English by duplicating the british entry in the dictionary list in the default position at the head of the list — inelegant but sufficient — leaving me free to remove the dictionary environment setting whilst still keeping my spelling mode of choice.ETA: For the record, the actual magic incantation I added to my
.emacs was:
(load-library "ispell")
(setq ispell-dictionary-base-alist
'(
(nil "[A-Za-z]" "[^A-Za-z]" "[']" nil
("-B" "-d" "en_GB")
nil iso-8859-1)
("american" "[A-Za-z]" "[^A-Za-z]" "[']" nil
("-B" "-d" "en_US")
nil iso-8859-1)
("british" "[A-Za-z]" "[^A-Za-z]" "[']" nil
("-B" "-d" "en_GB")
nil iso-8859-1)))Unpleasant but functional.