sawyl: (Default)
[personal profile] sawyl
After 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 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.

Profile

sawyl: (Default)
sawyl

August 2018

S M T W T F S
   123 4
5 6 7 8910 11
12131415161718
192021222324 25
262728293031 

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated Feb. 5th, 2026 12:20 am
Powered by Dreamwidth Studios