mac os x上的emacs,如何让拼写检查工作

LWZ*_*LWZ 18 macos emacs spell-checking aspell flyspell

我正在从Windows迁移到Mac,我花了整整一夜试图让emacs工作.

我已经安装了GNU emacs并简单地复制了我的Windows .emacs文件,除了拼写检查之外,这似乎没问题.我安装了cocoAspell并按照此设置说明添加路径并将ispell更改为aspell,但是当我运行拼写检查时,我得到了

Error: The file "/use/local/lib/aspell-0.60/english" can not be opened for reading.
Run Code Online (Sandbox Code Playgroud)

和FlySpell也不起作用.

好像它正在查看错误的目录,但我已经有了

(setq ispell-program-name "aspell"
      ispell-dictionary "english"
      ispell-dictionary-alist
      (let ((default '("[A-Za-z]" "[^A-Za-z]" "[']" nil
                       ("-B" "-d" "english" "--dict-dir"
                        "/Library/Application Support/cocoAspell/aspell6-en-6.0-0")
                       nil iso-8859-1)))
        `((nil ,@default)
          ("english" ,@default))))
Run Code Online (Sandbox Code Playgroud)

它指向正确的字典目录"/ Library/Application Support/cocoAspell/aspell6-en-6.0-0".我无法弄清楚为什么我得到错误以及如何解决它.


更新:

现在我删除了我的GNU emacs和cocoAspell,并使用自制软件重新安装(和链接)emacs/aspell,如@katspaugh所建议的那样.我删除了上面显示的代码,只留下

(setq ispell-program-name "aspell")
Run Code Online (Sandbox Code Playgroud)

现在,当我进行拼写检查时,我得到了

Searching for program: No such file or directory, aspell
Run Code Online (Sandbox Code Playgroud)

我已经链接了aspell brew link aspell,为什么它仍然无法找到它?

kat*_*ugh 26

这是一个有效的解决方案:

  • 安装Homebrew
  • brew install emacs --with-cocoa --with-gnutls
  • brew install aspell
  • open -a Emacs
  • M-x ispell

请享用!

  • 使用 aspell 而不是 ispell。 (2认同)
  • @katspaugh这些词典包含在公式中.只需看看他们的论点,然后选择你需要的论点,例如`brew install aspell --with-lang-de`. (2认同)

Dav*_*ell 11

我使用自制的 aspell .只是:

brew install aspell --with-lang-en
Run Code Online (Sandbox Code Playgroud)

然后,确保您的brew bin目录位于Emacs exec-path变量中.如果您使用/usr/localbrew前缀,那么它将起作用,因为exec-path默认情况下包含该路径.否则你需要在.emacs中的某个地方:

  (setq exec-path (append "/path/to/brew/bin" exec-path)))
Run Code Online (Sandbox Code Playgroud)

您也可以使用customize带有" M-x customize-variable RET exec-path RET" 的界面完成相同的操作,然后使用gui添加路径.

这适用于任何Emacs,包括Emacs for Mac OS X,brew中的一个或Emacs系统.