且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

OS X 10.9上的hunspell / emacs

更新时间:2022-11-08 14:59:39

升级到Emacs 24.4,通过安装最近预测试或建造Emacs树干。可以从 Emacs for Mac OS X 在Pretests和Pretests中获得预制和夜间构建Emacs中继线的预制二进制文件Nightlies部分。

Upgrade to Emacs 24.4, either by installing a recent pretest or by building Emacs trunk. Prebuild binaries for pretests and nightly builds of Emacs trunk are available from Emacs for Mac OS X, in the "Pretests" and "Nightlies" sections respectively.

Emacs 24.4大大改善了对Hunspell的支持,现在可以自动使用Hunspell进行一些进一步的定制。值得注意的是,Emacs现在可以发现可用的Hunspell字典,并自动填充 ispell-dictionary-alist 。基本上,您只需要以下信息告诉Emacs使用hunspell:

Emacs 24.4 considerably improves support for Hunspell, and is now able to use Hunspell automatically with only little further customization. Notably, Emacs can now discover available Hunspell dictionaries, and fills ispell-dictionary-alist automatically. Essentially, you just need the following to tell Emacs to use hunspell:

(setq ispell-program-name (executable-find "hunspell"))

您需要为Hunspell显式安装这些字典,但是,取决于你如何安装Hunspell。通常,您只需将相应的 *。aff *。dic 文件放入 〜/库/拼写。但是,获得字典有点困难。***的方法是下载相应的LibreOffice扩展,并从中提取 *。dic *。aff OXT文件,这本质上就是ZIP文件。至少这就是我所做的。字典可能有更好的来源。

You need to explicitly install these dictionaries for Hunspell, though, depending on how you installed Hunspell. Normally, you just need to put the corresponding *.aff and *.dic files into ~/Library/Spelling. Obtaining dictionaries is a little more difficult, though. The best way probably is to download the corresponding LibreOffice extensions and extract the *.dic and *.aff files from the OXT files, which are essentially just ZIP files. At least, that's what I do. There may be better sources of dictionaries.

除了语言特定的词典,您还需要为Emacs提供默认字典。这个字典需要命名为 default 。然而,创建它是很容易的。只需在您的首选语言的字典中创建符号链接:

Besides language-specific dictioniaries, you also need to have a "default" dictionary for Emacs. This dictionary needs to be named default, literally. Creating it is easy enough, though. Just create symlinks to the dictionaries of your preferred language:

$ cd ~/Library/Spelling
$ ln -s en_GB.aff default.aff
$ ln -s en_GB.dic default.dic

那是所有我需要得到Hunspell并在我的系统上工作。

That's all I needed to get Hunspell up and working on my system.