【问题标题】:Emacs cannot find flyspell/ispellEmacs 找不到 flyspell/ispell
【发布时间】:2013-06-12 04:37:38
【问题描述】:

在我的 Mac(Snow Leopard,10.6.8)上,我使用 Emacs 24.2 provided here 的修改版本来利用来自 downloads page 的 Emacs Speaks Statistics (ESS)。 Emacs 可以工作,但我还不能让拼写检查器工作。

为了解决这个问题,我按照this page 的说明下载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

this questionthis question 中提出的解决方案均无效,所以我不确定这里的问题是什么。有没有人有想法或以前遇到过这个问题?

【问题讨论】:

    标签: emacs spell-checking flyspell


    【解决方案1】:

    在尝试随机网站的任意指令之前,请阅读 Emacs 本身提供的文档。

    Emacs 24.2 包含 Flyspell。您必须明确安装它。如果这样做,请撤消此操作,即从/Applications/Emacs.app/Contents/Resources/site-lisp 中删除flyspell.el。充其量,完全删除/Applications/Emacs.app,然后重新安装,从头开始。

    但是,Flyspell 需要一个拼写检查工具,Emacs 中不包含该工具。错误消息告诉您没有安装此类工具。

    您需要安装ASpell 拼写检查器。您可以使用homebrewbrew install aspell 安装它。

    【讨论】:

    • 或 Macports 作为 Homebrew 的替代品。
    • 如果 O.P. 想让他/她的生活真正轻松,请改用 Aquamacs——它使用 OSX 内置的 NSSpellChecker。那么 O.P. 就不需要任何东西了。
    • 实际上,安装 aspell 对我不起作用。不过,在完成brew install ispell --with-lang-en 之后,flyspell-mode 认出了它。
    • OP 的问题并不奇怪,因为从 flyspell website 中看不出需要安装 aspell。
    • 单独安装 aspell 和 ispell 并不能解决我的问题。我还必须按照here 的建议将(setenv "PATH" (concat (getenv "PATH") ":/usr/local/bin"))(setq exec-path (append exec-path '("/usr/local/bin"))) 添加到我的.emacs 文件中。
    【解决方案2】:

    在 Windows 上,我必须执行以下操作才能启动 Ispell 进程:

    1. 已下载 ispell (http://www.ssc.wisc.edu/~dvanness/ispell.htm)
    2. 在我的路径(即 Windows 或 c:\windows\系统
    3. 下载 aspell (http://aspell.net/win32/)-get 完整下载。请参阅页面上的链接。 (无论你需要 ispell 与否,我不确定)
    4. 将下面显示的代码添加到您的 init.el 文件中

    5. 运行 aspell 安装程序

    6. 再次启动emacs,错误应该不会出现。

      (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,似乎工作得很好。
    • 看起来 aspell 不再适用于带有 emacs 26.1 的 Windows
    【解决方案3】:

    我使用homebrew 来安装ispell 和apsell,并且会得到我在~/.emacs 中设置的任何一个

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

    这个here也有类似的讨论

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-01-03
      相关资源
      最近更新 更多