I am using flyspell and I would like to add a word in my personal dictionary ($HOME/.aspell.en.pws) with a single keystroke ("F5").

I was thinking as something like:

(global-set-key (kbd "<f5>") 'my-save-word)

But I cannot find the right command.

  • 1
    I have been using a custom version of flyspell and ispell for several years and don't remember whether I did anything special to make this function work. Thus, I'm not comfortable putting an answer until someone tests and likes it: (defun my-ispell-save-word () (interactive) (let ((current-location (point)) (word (flyspell-get-word))) (when (consp word) (flyspell-do-correct 'save nil (car word) current-location (cadr word) (caddr word) current-location)) (setq ispell-pdict-modified-p nil))) I have other projects on my plate at the moment, and am not available to test it in a vanilla Emacs
    – lawlist
    Oct 4, 2017 at 15:38
  • I just tested your code (adding (global-set-key (kbd "<f5>") 'my-ispell-save-word). I works perfectly. The only potential disagreement is it will save the word as many times you press F5 even if the word is already saved. But I cannot really think about a situation where it would be "bad" to have several time the same word in your personal dictionary.
    – ppr
    Oct 4, 2017 at 21:02
  • Another option I'm interested in is to save the word without navigate to it. I am using flyspell-lazy which avoid latence problem of flyspell (it triggers flyspell only after a inactivity period). So i see a word highlighted often after finish a paragraph. Is there a way to save the last "incorrect" word to the dictionary without navigate through it? There is such function for autocorrection (Cc ;).
    – ppr
    Oct 4, 2017 at 21:05
  • It is possible to search through a flat text file and see if a word already exists, which can be case-sensitive if so desired. It is also possible to use something like read-string to let the user manually type a word to be added to the personal database, or some other means of choosing the word to be added can be used. emacs.stackexchange.com is the best location to obtain help from a number of experienced Emacs users, whereas this forum is rarely used (e.g., 7 views in 5 days). Consider creating a new question over there with what you have so far and what it is that wish to achieve ...
    – lawlist
    Oct 4, 2017 at 21:52
  • 1
    I wouldn't be surprised if aspell already comes with a command line equivalent to test for whether a word has already been added to the personal dictionary, which a user can query using elisp and something may already exist inside flyspell.el and/or ispell.el to accomplish that goal.
    – lawlist
    Oct 4, 2017 at 21:54

1 Answer 1


If flyspell flags the word you want to add to your personal dictionary as being misspelled, flyspell already has this capability. Simply ispell-buffer and navigate to the word to add (or move to the word and use ispell-word, etc.), and press 'i' in response to flyspell's query for action.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .