OS X 10.9上的hunspell / emacs [英] hunspell / emacs on OS X 10.9

查看:215
本文介绍了OS X 10.9上的hunspell / emacs的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不能让aspell建立,所以我正在尝试hunspell。建立了hunspell设置.emacs,以便emacs可以(并且)找到可执行文件,如下所示:

I can't get aspell to build, so I'm trying hunspell. Got hunspell built. Set up .emacs so that emacs can (and does) find the executable, like so:

;;; Spell checking using hunspell
(setq ispell-dictionary-alist
  '((nil "[A-Za-z]" "[^A-Za-z]" "[']" t
     ("-d" "en_US" "-i" "utf-8") nil utf-8)
    ("american"
     "[A-Za-z]" "[^A-Za-z]" "[']" nil
     ("-d" "en_US") nil utf-8)
    ("english"
     "[A-Za-z]" "[^A-Za-z]" "[']" nil
     ("-d" "en_GB") nil utf-8)
    ("british"
     "[A-Za-z]" "[^A-Za-z]" "[']" nil
     ("-d" "en_GB") nil utf-8)
    ("norsk"
     "[A-Za-zÉÆØÅéæøå]" "[^A-Za-zÉÆØÅéæøå]" "[\"]" nil
     ("-d" "nb_NO") "~list" utf-8)))
(eval-after-load "ispell"
  (progn
    (setq ispell-dictionary "english"
          ispell-extra-args '("-a" "-i" "utf-8")
          ispell-silently-savep t)))

(setq ispell-dictionary "en_US")
(setq ispell-program-name "/usr/local/bin/hunspell")

这在我的.bash_profile中

and this in my .bash_profile

export DICTIONARY=en_US
export DICPATH=/Users/myname/Applications/en_US

/ p>

also tried

export DICTIONARY=en_US
export DICPATH=/Users/gpajer/Applications/

(有一个目录〜/ Applications / en_US,其中字典文件所在的位置)

(there's a directory ~/Applications/en_US in which the dictionary files reside)

但ispell缓冲区返回类似于

But ispell-buffer returns something like

Can't open affix or dictionary flies for dictionary named "english".
@(#) International Ispell Version 3.2.06 (but really Hunspell 1.3.2)
@(#) International Ispell Version 3.2.06 (but really Hunspell 1.3.2)

hunspell没有找到字典?有什么特别的地方我应该放字典吗?或者如何告诉emacs / hunspell在哪里寻找字典?

Is hunspell not finding the dictionary? Is there a special place I should put the dictionary? or how do I tell emacs/hunspell where to look for the dictionary?

推荐答案

升级到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.

这篇关于OS X 10.9上的hunspell / emacs的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆