nschum / auto-dictionary-mode

Emacs: automatic dictionary switcher for flyspell
http://nschum.de/src/emacs/auto-dictionary/
28 stars 13 forks source link

Easier language customization #15

Open To1ne opened 7 years ago

To1ne commented 7 years ago

It would be nice if it was possible to easily add languages without the need to change the sources. Maybe with a defcustom...

To1ne commented 7 years ago

It also would be nice if it would be possible to set a list of used languages (e.g. I only type Dutch and English) so guessing can be faster and more accurate.

sten0 commented 4 years ago

If I'm reading the following correctly, this can already be done: https://github.com/nschum/auto-dictionary-mode/blob/b364e08009fe0062cf0927d8a0582fad5a12b8e7/auto-dictionary.el#L158

I'll test it shortly. I haven't analysed the whole file yet, but I would imagine that this table is filtered using the defconst adict-language-list as keys, and if a key isn't found in adict-language-list then the negatively matched adict-dictionary-list element is dropped or deactivated.

'hopefully this issue can be solved with a documentation update.

sten0 commented 4 years ago

Confirmed fix: The following does the trick for me (I was getting occasional false positives for Slovenian when there weren't enough matches for the heuristic to pick the correct language)

(eval-after-load "auto-dictionary"
  '(setq adict-dictionary-list
        (mapcar 'adict--guess-dictionary-cons
                '(("en" . "en")
                  ("fr" . "fr")))))