Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hunspell with mutliple dictionaries on macos #941

Open
ChauhanT opened this issue May 9, 2023 · 3 comments
Open

hunspell with mutliple dictionaries on macos #941

ChauhanT opened this issue May 9, 2023 · 3 comments

Comments

@ChauhanT
Copy link

ChauhanT commented May 9, 2023

Hi,

I want to use flyspell with a hunspell backed. I prefer hunspell because it offers multilanguage dictionaries which can be very useful for me. My configuration is:

(setq +v/LANG "en_GB"
      +v/DICPATH "/Users/tc/Library/Spelling/"
      +v/MULTIDIC "en_GB,en_US,de_DE")

(use-package flyspell
  :straight t
  :after ispell
  :init
  ;; Set the locale for the dictionary
  (if (string-equal system-type "darwin")
      (setenv "DICTIONARY" "en_GB"))
  
  (setenv "LANG" +v/LANG)

  ;; Dictionary path
  (setenv "DICPATH" +v/DICPATH)
  
  :config
  ;; Use hunspell
  (setq ispell-program-name "hunspell")
  (setq ispell-really-hunspell t)

  ;; ispell-set-spellchecker-params has to be called
  ;; before ispell-hunspell-add-multi-dic will work
  (ispell-set-spellchecker-params)

  ;; Declare a multi-language dictionary and switch to it
  (ispell-hunspell-add-multi-dic +v/MULTIDIC)
  (ispell-change-dictionary +v/MULTIDIC t))

However, this does not work. My dictionary folder is populated like so:

❯ tree ~/Library/Spelling
/Users/tc/Library/Spelling
├── dynamic-counts.dat
├── en_GB.aff
├── en_GB.dic
├── en_US.aff
├── en_US.dic
├── fr_FR.aff
├── fr_FR.dic
├── it_IT.aff
└── it_IT.dic

1 directory, 9 files

While hunspell is detected, it fails to detect any dictionary :( I test this like so:

❯ hunspell
Hunspell 1.7.2
welcome
# welcome 0

test
# test 0

sadness
# sadness 0

I am on macos 13.3.1. Any help/trick/ideas ? It's totally driving me up the wall.

@caolanm
Copy link
Contributor

caolanm commented May 9, 2023

What does:

hunspell -D 2>&1|less

report?, to check what paths it is searching, and what it claims to find

@ChauhanT
Copy link
Author

ChauhanT commented May 9, 2023

Ah yes. Sorry should have reported that. I had made sure it was finding the right path before reporting this. The output is:

❯ hunspell -D
SEARCH PATH:
.::/usr/share/hunspell:/usr/share/myspell:/usr/share/myspell/dicts:/Library/Spelling:/Users/tc/.openoffice.org/3/user/wordbook:/Users/tc/.openoffice.org2/user/wordbook:/Users/tc/.openoffice.org2.0/user/wordbook:/Users/tc/Library/Spelling:/opt/openoffice.org/basis3.0/share/dict/ooo:/usr/lib/openoffice.org/basis3.0/share/dict/ooo:/opt/openoffice.org2.4/share/dict/ooo:/usr/lib/openoffice.org2.4/share/dict/ooo:/opt/openoffice.org2.3/share/dict/ooo:/usr/lib/openoffice.org2.3/share/dict/ooo:/opt/openoffice.org2.2/share/dict/ooo:/usr/lib/openoffice.org2.2/share/dict/ooo:/opt/openoffice.org2.1/share/dict/ooo:/usr/lib/openoffice.org2.1/share/dict/ooo:/opt/openoffice.org2.0/share/dict/ooo:/usr/lib/openoffice.org2.0/share/dict/ooo
AVAILABLE DICTIONARIES (path is not mandatory for -d option):
/Users/tc/Library/Spelling/fr_FR
/Users/tc/Library/Spelling/it_IT
/Users/tc/Library/Spelling/en_GB
/Users/tc/Library/Spelling/en_US
LOADED DICTIONARY:
/Users/tc/Library/Spelling/en_US.aff
/Users/tc/Library/Spelling/en_US.dic

@ChauhanT
Copy link
Author

ChauhanT commented May 9, 2023

And I also confirmed I'm not running some other binary by:

❯ which hunspell
/opt/homebrew/bin/hunspell

~
❯ /opt/homebrew/bin/hunspell -d en_GB
Hunspell 1.7.2
work
# work 0

sadness
# sadness 0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants