我想对大型项目/存储库中的几个文件进行拼写检查,并使用与我自己的字典不同的私有字典。这样我就可以使用项目字典,并在以后上传给其他用户使用。
发布于 2014-12-19 01:02:52
克里斯的答案是正确的。这只是我用来在aspell个人词典和aspell语言之间切换的一个例子。我同时使用flyspell和ispell。需要根据用户规范来调整到个人词典的路径。
(defface ispell-alpha-num-choice-face
'((t (:background "black" :foreground "red")))
"Face for `ispell-alpha-num-choice-face`."
:group 'ispell)
(defface ispell-text-choice-face
'((t (:background "black" :foreground "forestgreen")))
"Face for `ispell-text-choice-face`."
:group 'ispell)
(defun my-ispell-change-dictionaries ()
"Switch between language dictionaries."
(interactive)
(let ((choice (read-char-exclusive (concat
"["
(propertize "E" 'face 'ispell-alpha-num-choice-face)
"]"
(propertize "nglish" 'face 'ispell-text-choice-face)
" | ["
(propertize "S" 'face 'ispell-alpha-num-choice-face)
"]"
(propertize "panish" 'face 'ispell-text-choice-face)))))
(cond
((eq choice ?E)
(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)
(message "English"))
((eq choice ?S)
(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)
(message "Español"))
(t (message "No changes have been made."))) ))发布于 2014-12-19 00:39:27
在Emacs中,可以使用变量ispell-personal-dictionary来选择您的个人字典文件:
个人拼写字典的文件名,或nil。如果为nil,则使用默认个人字典(“~/.ISPEL_ DICTNAME”表示ispell或"~/.aspell.LANG.pws“表示aspell),其中DICTNAME是默认字典的名称,LANG是两个字母的语言代码。
在现代系统上,Emacs的ispell-函数通常使用GNU aspell、一个
是一个免费开源的拼写检查器,旨在最终取代Ispell
从你的问题中还不清楚是否每个人都会通过Emacs进行拼写检查。幸运的是,aspell支持一个工作方式类似的命令行选项:
--personal=<file>, -p <file>
Personal word list file name.发布于 2017-08-26 10:56:48
我在我的init.el文件中有这个文件,这个文件对我很有效(在http://www.emacswiki.org/emacs/FlySpell找到)。
(setq ispell-program-name "aspell")
(setq ispell-list-command "list")
(let ((langs '("spanish" "british" "french")))
(setq lang-ring (make-ring (length langs)))
(dolist (elem langs) (ring-insert lang-ring elem)))
(defun cycle-ispell-languages ()
(interactive)
(let ((lang (ring-ref lang-ring -1)))
(ring-insert lang-ring lang)
(ispell-change-dictionary lang)))我设置了一个组合键从一个字典循环到另一个字典
(global-set-key [M-f6] 'cycle-ispell-languages)https://stackoverflow.com/questions/27544869
复制相似问题