在Emacs flyspell模式下,如何在字典中添加新词



在flyspell模式下的Aquamacs中,当flyspell将一个单词标记为拼写错误时,如果该单词实际上拼写正确,我可以右键单击将其添加到词典中。

在OSX上的GNU Emacs中,当flyspell模式高亮显示它认为拼写错误的单词时,我如何将该单词添加到词典中?查看文档,我看不到像flyspell-learn-wordispell-add-word-to-personal-dictionary这样的函数。

您要查找的函数是flyspell-correct-word-before-point。默认情况下,它绑定到密钥C-C$。把你的手指移到错误的单词上,然后执行命令。您将获得一个弹出菜单,其中包含可能的更正和将单词保存到词典的选项。

如果你想用一个命令来保存当前单词,这就是我从flyspell.el 中提取的内容

(defun my-save-word ()
(interactive)
(let ((current-location (point))
(word (flyspell-get-word)))
(when (consp word)    
(flyspell-do-correct 'save nil (car word) current-location (cadr word) (caddr word) current-location))))

您可以使用M-$打开建议,然后使用i保存到字典中。系统会提示您进行确认。

最新更新