如何更改Ispell私人词典

1 emacs ispell

我想对大型项目/存储库中的几个文件进行拼写检查,并使用与我自己的字典不同的私有字典。这样,我改为使用项目字典,以后可以上载此字典供其他用户使用。

Chr*_*ris 5

在 Emacs 中,该变量ispell-personal-dictionary可用于选择您的个人词典文件:

您的个人拼写词典的文件名,或为零。如果为 nil,则使用默认的个人词典(ispell 为“~/.ispell_DICTNAME”,aspell 为“~/.aspell.LANG.pws”),其中 DICTNAME 是默认词典的名称,LANG 是两个字母的语言代码。

在现代系统上,Emacs 的ispell-功能通常使用GNUaspell

一个免费开源的拼写检查器,旨在最终取代 Ispell

从你的问题中并不清楚是否每个人都会通过 Emacs 进行拼写检查。幸运的是,aspell支持类似工作方式的命令行选项:

--personal=<file>, -p <file>
    Personal word list file name.
Run Code Online (Sandbox Code Playgroud)


law*_*ist 5

克里斯的答案是正确的。这只是我用来在aspell个人词典和aspell语言之间切换的示例。我同时使用flyspellispell。到个人词典的路径将需要根据用户规范进行调整。

(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."))) ))
Run Code Online (Sandbox Code Playgroud)