I would like to do spell check on several files in a big project/repository and use a different private dictionary than my own. Such that I instead use a project dictionary and can later upload this for other users to use.
How do I change ispell private dictionary
3.7k views Asked by Erex At
3
There are 3 answers
0
On
The answer by Chris is correct. Here is just an example of what I use to switch between aspell
personal dictionaries, and also aspell
languages. I use both flyspell
and ispell
. The paths to the personal dictionaries would need to be adjusted according to the user specifications.
(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."))) ))
0
On
I have this in my init.el file, which works great for me (found at 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)))
I've set a key combination to cycle from one dictionary to another
(global-set-key [M-f6] 'cycle-ispell-languages)
From Emacs, the variable
ispell-personal-dictionary
can be used to select your personal dictionary file:On modern systems, Emacs'
ispell-
functions generally use GNUaspell
, aIt isn't clear from your question whether everybody will be spell-checking through Emacs. Luckily,
aspell
supports a command-line option that works similarly: