首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >如何更改ispell专用字典

如何更改ispell专用字典
EN

Stack Overflow用户
提问于 2014-12-18 18:54:19
回答 3查看 2.7K关注 0票数 1

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

EN

回答 3

Stack Overflow用户

发布于 2014-12-19 01:02:52

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

代码语言:javascript
运行
复制
(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."))) ))
票数 5
EN

Stack Overflow用户

发布于 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支持一个工作方式类似的命令行选项:

代码语言:javascript
运行
复制
--personal=<file>, -p <file>
    Personal word list file name.
票数 4
EN

Stack Overflow用户

发布于 2017-08-26 10:56:48

我在我的init.el文件中有这个文件,这个文件对我很有效(在http://www.emacswiki.org/emacs/FlySpell找到)。

代码语言:javascript
运行
复制
(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)))

我设置了一个组合键从一个字典循环到另一个字典

代码语言:javascript
运行
复制
(global-set-key [M-f6] 'cycle-ispell-languages)
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/27544869

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档