【问题标题】:Emacs and ispell: error loading german8Emacs 和 ispell:加载 German8 时出错
【发布时间】:2016-05-21 17:48:17
【问题描述】:

当我在文本模式下使用 flyspell-mode 时尝试加载“german8”拼写字典时收到此错误消息:

Error in post-command-hook (flyspell-post-command-hook): (error "Error: The file "/usr/lib/aspell/deutsch\" can not be opened for reading.")

我检查过,没有 /usr/lib/aspell/deutsch。 Ubuntu synaptic 软件包管理器向我提供了“aspell-de”,但并没有清除它。

这是我的 .emacs 中引发问题的代码:

;;switch dictionaries between German and English with F8 key
(defun fd-switch-dictionary()
      (interactive)
      (let* ((dic ispell-current-dictionary)
         (change (if (string= dic "deutsch8") "english" "deutsch8")))
        (ispell-change-dictionary change)
        (message "Dictionary switched from %s to %s" dic change)
        ))

(global-set-key (kbd "<f8>")   'fd-switch-dictionary)

我可以通过简单地启动 flyspell-mode 然后尝试执行 ispell-change-dictionary 来重复同样的错误。提供了 German8,但消息再次出现:

 Error enabling Flyspell mode:
(Error: The file "/usr/lib/aspell/german" can not be opened for reading.)

【问题讨论】:

    标签: emacs elisp


    【解决方案1】:

    我遇到了完全相同的问题,但我找到了一个非常简单的解决方法。我假设

    • 您的 Emacs 拼写检查器设置为 aspell,即 (setq-default ispell-program-name "aspell")

    • 安装了适当的 aspell 字典,例如 apt-get install aspell-de

    由于某种原因,在拼写为“sees”的词典列表中似乎存在一个错误,即执行ispell-change-dictionary 时可用的词典列表。选择“deutsch”时,它会尝试加载"/usr/lib/aspell/deutsch\"。但是看起来 aspell 字典名称已更改,因为 aspell-de 现在包含名为 de_DE* 的字典。我想@Daniel Ralston 的答案是解决这个问题,但这对我不起作用。我还尝试将实际的字典名称传递给ispell-change-dictionary,但不知何故,它坚持要从自己的列表中获取字典,我永远无法说服它我的字典确实是正确的。

    对我有用的是一个简单的符号链接修复。起初我不确定我应该符号链接什么,因为错误看起来像是试图从名为“deutsch”的目录加载字典。但事实证明,它实际上是在寻找一个典型的 aspell .alias 文件。所以通过使用这个符号链接

    sudo ln -s /usr/lib/aspell/de_DE.alias /usr/lib/aspell/deutsch.alias
    

    我现在可以在ispell-change-dictionary 中简单地选择“deutsch”。

    【讨论】:

    • 符号链接是一个简单的修复程序,对我立即起作用。
    • 对我来说,这很有效:我安装了包 aspell-de(通过 apt,不在 Emacs 中),重新启动 Emacs,并选择了一个德语词典。不需要符号链接。也不是自动创建的。
    【解决方案2】:

    最近,一些旧的和经常使用的字典别名似乎已从德语 aspell 包中删除。这使得 emacs 的德语词典定义过时了。尝试将此添加到您的.emacs

    (eval-after-load "ispell"
      '(add-to-list 'ispell-dictionary-alist
                    '("deutsch8"
                       "[a-zA-ZäöüßÄÖÜ]" "[^a-zA-ZäöüßÄÖÜ]" "[']" t
                      ("-C" "-d" "de_DE-neu.multi")
                      "~latin1" iso-8859-1)))
    

    【讨论】:

    • 感谢您的帮助,但它并没有真正起作用。我仍然收到code"正在启动新的 Ispell 进程 [/usr/bin/aspell::default] ... Ispell 进程已终止 本地 Ispell 字典设置为 deutsch8 字典从 nil 切换到 deutsch8 正在启动新的 Ispell 进程 [/usr/bin/ aspell::deutsch8] ... post-command-hook 中的错误 (flyspell-post-command-hook): (error "Error: The file \"/usr/lib/aspell/deutsch\" can't be open for reading .")"code
    • ... /usr/lib/aspell/deutsch 不存在。我需要一个符号链接吗?
    • 我的错误。您正在尝试使用“deutsch8”字典,但我的定义改为定义“german8”。我的答案现在应该已经确定了。
    • 这几乎是正确的,但应该使用ispell-local-dictionary-alist 变量。还是谢谢。
    【解决方案3】:

    我在 Arch Linux 上遇到了同样的问题:安装了 aspell-ru 字典,但是当我在 emacs 中执行 ispell-change-dictionary russian 时(russian 是字典的建议名称),它返回了

    Error: The file \"/usr/lib/aspell-0.60/russian\" can not be opened for reading.
    

    所以我做了pacman -Ql aspell-ru,结果发现ru 是字典的名称,而不是russian。所以,ispell-change-dictionary ru 工作正常。

    检查字典文件的实际名称。

    【讨论】:

      【解决方案4】:

      Elementary OS 中的相同问题相同的解决方案安装包 aspell-es 和 aspell-eu-es:

      sudo apt-get install aspell-es aspell-eu-es
      

      一切正常。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2015-06-11
        • 1970-01-01
        • 2013-06-12
        • 1970-01-01
        • 1970-01-01
        • 2022-10-24
        • 1970-01-01
        • 2013-06-04
        相关资源
        最近更新 更多