Emacs无法找到flyspell/ispell。

21
在我的Mac上(Snow Leopard,10.6.8),我正在使用一个修改过的Emacs 24.2版本提供在这里以利用来自下载页面的Emacs Speaks Statistics (ESS)。Emacs可以正常工作,但我还没有能够让拼写检查器起作用。
为了解决这个问题,我正在按照此页面的说明下载flyspell。我将flyspell.el文件复制到我的/Applications/Emacs.app/Contents/Resources/site-lisp目录中,这显然是我的emacs加载路径的目录(请注意,例如auctex.el文件位于该目录中)。
然后,我通过添加以下内容修改了我的.emacs文件:
(autoload 'flyspell-mode "flyspell" "On-the-fly spelling checker." t)
(autoload 'flyspell-delay-command "flyspell" "Delay on command." t)
(autoload 'tex-mode-flyspell-verify "flyspell" "" t)
(add-hook 'LaTeX-mode-hook 'turn-on-flyspell)

当我打开一个 .tex 文件并使用 M-x flyspell-mode 时,我可以“自动完成”它(即按下 tab 键会给出正确的 flyspell 选项),但是当我按下 RET 键时,我会得到以下提示:
Searching for program: no such file or directory, ispell

这个问题这个问题中提出的解决方案都没有奏效,所以我不确定问题出在哪里。有没有人有想法或遇到过这个问题?

3个回答

37
请在尝试任意网站上的指令之前,务必阅读Emacs提供的文档。Emacs 24.2包含Flyspell,您不需要显式安装它。如果这样做了,请撤销此操作,即从/Applications/Emacs.app/Contents/Resources/site-lisp中删除flyspell.el。最好彻底删除/Applications/Emacs.app,并重新安装,以从头开始。但是,Flyspell需要一个拼写检查工具,它不包含在Emacs中。错误消息告诉您未安装此类工具。您需要安装ASpell拼写检查器。您可以使用homebrewbrew install aspell进行安装。

1
或者使用Macports作为Homebrew的替代方案。 - lawlist
如果楼主想让自己的生活变得非常简单,可以使用Aquamacs代替--它使用了OSX内置的NSSpellChecker。这样楼主就不需要其他任何东西了。 - lawlist
9
实际上,安装aspell对我没用。但是,在执行brew install ispell --with-lang-en后,flyspell-mode成功识别了它。 - metakermit
5
从FlySpell网站上看不出需要安装aspell,因此OP的问题并不令人意外。 - kalu
6
仅安装aspell和ispell并不能解决我的问题。我还需要在我的.emacs文件中添加(setenv "PATH" (concat (getenv "PATH") ":/usr/local/bin"))(setq exec-path (append exec-path '("/usr/local/bin"))),就像这里建议的那样。 - farenorth
显示剩余3条评论

10

我使用了homebrew来安装ispell和apsell,然后通过设置~/.emacs文件中的配置来使用其中之一。

[iMac ~]$ cat .emacs
(setq ispell-program-name "/usr/local/bin/aspell")

这里有一个相关讨论,可以参考这里


4
在Windows上,我需要按照以下步骤启动Ispell进程:
  1. downloaded ispell (http://www.ssc.wisc.edu/~dvanness/ispell.htm)
  2. Unzip content in a folder that is in my path (i.e. Windows or c:\windows\system
  3. download aspell (http://aspell.net/win32/)- get the full download. see the link on the page. (whether you need ispell or not, I am not sure)
  4. Add the code shown below to your init.el file

  5. Run aspell installer

  6. Start emacs again, the error should not come up.

    (require 'package)
    (add-to-list 'package-archives
             '("MELPA Stable" . "http://stable.melpa.org/packages/") t)
    (package-initialize)
    (package-refresh-contents)
    
    (package-install 'flycheck)
    
    (global-flycheck-mode)
    
    (use-package flycheck
      :ensure t
      :init
      (global-flycheck-mode t))
    
    (setq ispell-program-name "C:\\Program Files (x86)\\Aspell\\bin\\aspell.exe"
    

你可能不需要做上述步骤,但对于我在运行于Windows 7的Emacs上的情况是有效的。


这个方法可行,但我根本不需要安装 ispell。只需要安装 aspell 并将 ispell-program-name 设置为指向它即可。Aspell 是更新的 ispell,似乎完全可以正常工作。 - Didier A.
似乎aspell在Windows上无法与emacs 26.1一起使用了。 - Didier A.
使用hunspell解决了这个问题:https://lists.gnu.org/archive/html/help-gnu-emacs/2014-04/msg00030.html - Didier A.
警告:不要将从互联网下载的随机文件解压到 c:\windows\system 目录下。虽然这里可能没问题,但这是一个不好的做法。 - Forge
一般来说是一个好观点。 - Stryker

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接