scimax
scimax copied to clipboard
ispell: Using the document language for spellchecking
Currently the ispell language is hardcoded to en_US.
Since most of my documents are written in german, I could simply change that to de_DE. (Changing it via customize does not work.)
But it would be much better to take the document language and use that.
In my org file I have:
#+language: de
Is there a way to use that to set up ispell?
There are a couple of options we can consider.
https://www.emacswiki.org/emacs/InteractiveSpell
suggests you can put this at the top:
-- ispell-dictionary: "de" --
It seems to work for me.
You can set the language permanently, maybe like this (I am guessing you just change en_US to de here).
-
(setq ispell-extra-args '("--encoding=utf-8" "--sug-mode=ultra" "--lang=de"))
-
We could make a defcustom in scimax so you can set the language that way.
1,2 will be convenient unless you need to conveniently switch languages
- You can probably put that in a file-local variable, it will look something like this:
# Local Variables:
# ispell-extra-args: ("--encoding=utf-8" "--sug-mode=ultra" "--lang=de")
# End:
- You could use an org-mode-hook function that looks for #+language and then makes
ispell-extra-args
buffer local with the right dictionary.
I'm using the local variable method. C-h v tells me that the variable is set. Emacs knows that I use aspell.
But aspell still thinks it is correcting english and writes to the .aspell.en.pws file. When I start aspell with the same options from the command line, everything is german.
The only thing working for me is changing scimax-spellcheck.el
This is on macOS 10.13 with emacs 26.3 running a current org and scimax. aspell is installed via Macports.