4

I want to synchronize my personal dictionaries between my computers. For this, they should be in a dictionary with only stuff I want to synchronize, preferably in a dictionary in ~/.emacs.d because I'm already synchronizing this directory.

I don't know whether I use ispell or aspell. I always use M-x ispell-buffer and M-x ispell-region but there are no .ispell* files in my home directory. These files, however, are in my home directory:

.aspell.de.prepl  .aspell.de.pws  .aspell.en.prepl  .aspell.en.pws

I customized ispell-personal-dictionary to ~/.emacs.d/aspell ('(ispell-personal-dictionary "~/.emacs.d/aspell")), created the directory ~/.emacs.d/aspell, moved the files mentioned above there, and restarted Emacs. It didn't work because now the words I added in the past are shown as mistakes.

But changing the variable definitely changed the location where the spell checker looks for dictionaries because after moving the files back and restarting Emacs, but before undoing the customization of the variable, it still didn't recognize the words I added myself as correct.

Because I write in two different languages (English and German as can be seen above), I suppose I need different dictionaries. But the variable ispell-personal-dictionary can only hold a single value. How do I solve this?

0

2 Answers 2

2

Create and customize the aspell.conf in the ../etc directory of the root directory where aspell is installed. Inside the aspell.conf file, set the home-dir /desired/path/here. And, spelling languages in Emacs can be changed like this: (ispell-change-dictionary "english") or (ispell-change-dictionary "spanish").

To dump the settings for aspell, in the terminal call:

/path/to/aspell --lang=en dump config
3
  • Are you saying that I should modify a file outside my home directory for this? $ type aspell returns aspell is /usr/bin/aspell, so I should create that file in /usr/etc because that's ../etc from where ispell is installed? This directory doesn't exist which makes me think even more that I'm misinterpreting what you wrote.
    – UTF-8
    Jan 28, 2018 at 23:18
  • Type in the terminal: aspell --lang=en dump config and see where it says your conf-dir is located. That is where your aspell.conf gets put.
    – lawlist
    Jan 28, 2018 at 23:27
  • Thank you, it worked. :) To everyone else having the same problem: Don't wrap the path in quotes, even if it contains spaces.
    – UTF-8
    Jan 30, 2018 at 12:41
0

The files ending with ".prepl" are aspell's replacement dictionaries. You can change where they are stored by setting --repl option given to aspell through the ispell-extra-args variable.

Here is how I use it to store aspell's files in ~/.config/aspell/:

(defun set-language (code name)
  (let* ((dir (expand-file-name "~/.config/aspell/"))
         (pd (concat dir code ".pws"))
         (rd (concat dir code ".prepl")))
    (make-directory dir t)
    (setq ispell-personal-dictionary pd)
    (setq ispell-extra-args (list "--repl" rd)))
  (ispell-change-dictionary code)
  (flyspell-buffer)
  (message (format "Switched to %s" name)))

(setq flyspell-issue-message-flag nil)
(add-hook 'text-mode-hook 'flyspell-mode)
(add-hook 'flyspell-mode-hook
          (lambda ()
            (set-language "en" "English")))

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.