假设您已经下载了en_US-med.dic和en_US-med.aff并安装了hunspell
步骤1,hunspell -D
在shell中运行,它将告诉目录hunspell在哪里搜索词典,然后将en_US-med.dic和en_US-med.aff复制到该目录。
步骤2,将以下代码插入〜/ .emacs,
(setq ispell-program-name "hunspell")
;; you could set `ispell-dictionary` instead but `ispell-local-dictionary' has higher priority
(setq ispell-local-dictionary "en_US")
(setq ispell-local-dictionary-alist '(("en_US" "[[:alpha:]]" "[^[:alpha:]]" "[']" nil ("-d" "en_US,en_US-med") nil utf-8)))
实际上,我们将选项“ -d en_US,en_US-med”传递给了hunspell CLI,因此它可以同时使用两个字典“ en_US”和“ en_US-med”。
“ -d”选项记录在hunspell手册中(man hunspell
在shell中)
以下是hunspell手册中引用的文字:
-d en_US,en_geo,en_med,de_DE,de_med
en_US and de_DE are base dictionaries, they consist of aff and dic
file pairs: en_US.aff, en_US.dic and de_DE.aff, de_DE.dic. En_geo,
en_med, de_med are special dictionaries: dictionaries without affix
file. Special dictionaries are optional extension of the base dictio‐
naries usually with special (medical, law etc.) terms. There is no
naming convention for special dictionaries, only the ".dic" extension:
dictionaries without affix file will be an extension of the preceding
base dictionary (right order of the parameter list needs for good sug‐
gestions). First item of -d parameter list must be a base dictionary.
在Debian 7的Emacs 24.3上测试了“纤维软骨病”一词。
如果在Emacs的23+工作在任何操作系统上。
请注意,在Windows上,告诉hunspell可执行文件最简单的方法是字典搜索路径是设置环境变量DICTPATH
(在hunspell手册中有记录)。Cygwin / MSYS2的hunspell可执行文件很可能只识别UNIX格式的路径。
flyspell
吗?