36

In Aquamacs in flyspell-mode, when flyspell flags a word as misspelled, I can right-click to add the word to my dictionary if it is in fact correctly spelled.

In GNU Emacs on OSX, when flyspell-mode highlights a word it thinks is misspelled, how can I add the word to the dictionary? Looking at the documentation, I do not see a function like flyspell-learn-word or ispell-add-word-to-personal-dictionary.

incandescentman
  • 6,168
  • 3
  • 46
  • 86
  • 4
    Is the function `flyspell-correct-word-before-point` defined, try calling it with (`C-c $`) with point on the incorrect word, it gives an option to save the word. –  Mar 01 '14 at 03:08
  • 4
    Is there a way to do this without navigating through a drop-down menu? – incandescentman Mar 01 '14 at 05:29
  • Is there a way to add a compound like "half-hearted" ? Only "hearted" gets the wiggly red underline and flyspell tries to add "hearted" to the dictionary. – Ryo Nov 05 '20 at 07:16

2 Answers2

54

The function you are looking for is flyspell-correct-word-before-point. By default it is bound to the keys C-c$. Move your point to the incorrect word and execute the command. You will get a popup-menu with possible corrections and an option to save the word to you dictionary.

If you want a single command to save the current word, this is what I was able to extract from flyspell.el

(defun my-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))))
  • 6
    But where is the new word saved to? – strongwillow May 11 '16 at 12:50
  • 9
    @strongwillow, in `~/.aspell.LANG.pws`, for aspell or `~/.ispell_DICTNAME` for ispell. See https://emacs.stackexchange.com/questions/17237/in-emacs-where-is-ispells-personal-dictionary-stored – tlegutko May 01 '17 at 20:57
18

You can probably use M-$ to open suggestions, then i to save to dictionary. You'd be prompted for confirmation.

Source

Gauthier
  • 40,309
  • 11
  • 63
  • 97