Switching flyspell dictionaries on the fly

Since I am using Emacs for most of my text processing, and it comes with the nice Flyspell mode, and I do write English and German the most, I found this nice snippet from the Emacs wiki:


(defun fd-switch-dictionary()
(interactive)
(let* ((dic ispell-current-dictionary)
(change (if (string= dic "deutsch8") "english" "deutsch8")))
(ispell-change-dictionary change)
(message "Dictionary switched from %s to %s" dic change)
))

(global-set-key (kbd "<f8>") 'fd-switch-dictionary)

On OS X, I recommend to use emacs-app or emacs-app-devel from MacPorts. For flyspell to work correctly, also make sure to install aspell and e.g. aspell-dict-de. Otherwise the above function will complain, most probably.

Leave a Reply

Your email address will not be published.