如何让GNU Emacs拼写检查在OSX上找到用户的个人字典?

时间:2014-03-05 05:41:22

标签: emacs aquamacs aspell flyspell ispell

我从Aquamacs切换到GNU Emacs。之前,当Aquamacs认为单词拼写错误时,我可以右键单击“学习拼写”。 (我还有一个忽略拼写的选项,让它只为那个缓冲区取消标记。)

在GNU Emacs中,我使用ispell的flyspell-mode,aspell作为字典。但是我注意到我之前添加到我的词典中的单词(例如我的名字)被标记为拼写错误。

如何让GNU Emacs查找并使用我已经建立的个人单词列表?我可以这样做,例如,从源代码构建Aquamacs吗?

1 个答案:

答案 0 :(得分:4)

以下是关于为OSX和Windows设置Aspell的注意事项 - 设置用户个人字典的说明在该链接的主题中列出:

https://stackoverflow.com/a/20013202/2112489

Aspell中的个人单词列表是一个平面文本文件,其中包含如下所示的内容,您可以手动插入任何单词 - 包括但不限于复制 的内容来自本地OSX拼写检查器~/Library/Spelling/LocalDictionary的列表:

personal_ws-1.1 en 79 
lawlist
realleges
parte

而且,在我的.emacs中,我使用(相应地调整自己的路径):

(require 'ispell)
(require 'flyspell)
(setq-default ispell-program-name "/Users/HOME/.0.data/.0.emacs/elpa/bin/aspell")
(setq flyspell-default-dictionary "english")
(setq ispell-dictionary "english")

这是我用来在西班牙语和英语之间切换的功能:

(defun spell (choice)
   "Switch between language dictionaries."
   (interactive "cChoose:  (1) English | (2) Español")
    (cond ((eq choice ?1)
           (setq flyspell-default-dictionary "english")
           (setq ispell-dictionary "english")
           (setq ispell-personal-dictionary "/Users/HOME/.0.data/.0.emacs/.aspell.en.pws")
           (ispell-kill-ispell))
          ((eq choice ?2)
           (setq flyspell-default-dictionary "spanish")
           (setq ispell-dictionary "spanish")
           (setq ispell-personal-dictionary "/Users/HOME/.0.data/.0.emacs/.aspell.es.pws")
           (ispell-kill-ispell))
          (t (message "No changes have been made."))) )

对于Windows,我使用:

(setq-default ispell-program-name "c:/Program Files/Aspell/bin/aspell.exe")