scimax icon indicating copy to clipboard operation
scimax copied to clipboard

ispell: Using the document language for spellchecking

Open AKielhorn opened this issue 4 years ago • 2 comments

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?

AKielhorn avatar Mar 09 '20 12:03 AKielhorn

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).

  1. (setq ispell-extra-args '("--encoding=utf-8" "--sug-mode=ultra" "--lang=de"))

  2. 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

  1. 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:
  1. You could use an org-mode-hook function that looks for #+language and then makes ispell-extra-args buffer local with the right dictionary.

jkitchin avatar Mar 09 '20 12:03 jkitchin

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.

AKielhorn avatar Mar 09 '20 14:03 AKielhorn