title: Emacs spell checking with hunspell: no spell-checking done
body: <p>I would like to activate spell checking within GNU Emacs 24.5.1 (on Mac OS X 11.10). I did the following:</p>
  
  <pre><code>1) brew install hunspell
  2) cd ~/Library/Spelling
     wget http://cgit.freedesktop.org/libreoffice/dictionaries/plain/en/en_US.aff
     wget http://cgit.freedesktop.org/libreoffice/dictionaries/plain/en/en_US.dic
  </code></pre>
  
  <p>(<code>hunspell -D</code> runs correctly from the terminal). In <code>~/.bash_profile</code> I set <code>export DICTIONARY=en_US</code> and my <code>~/.emacs</code> shows:</p>
  
  <pre><code>;; Activate Hunspell
  (when (executable-find "hunspell")
    (setq-default ispell-program-name "/usr/local/bin/hunspell")
    (setq ispell-really-hunspell t))
  
  ;; Activate flyspell
  (add-hook 'text-mode-hook 'flyspell-mode)
  (add-hook 'message-mode-hook 'flyspell-mode)
  (setq flyspell-issue-message-flag nil)
  (mapcar (lambda (mode-hook) (add-hook mode-hook 'flyspell-prog-mode))
      '(c-mode-common-hook R-mode-hook emacs-lisp-mode-hook))
  </code></pre>
  
  <p>However, when I open any <code>.txt</code> file, I don't see spell-checking errors underlined or anything... and <code>M-x ispell</code> shows <code>ispell-parse-hunspell-affix-file: ispell-phaf: No matching entry for nil.</code>. How can I get this to work?</p>
  
  <p>I found <a href="https://stackoverflow.com/questions/25415070/hunspell-emacs-on-os-x-10-9">this</a> and <a href="https://joelkuiper.eu/spellcheck_emacs" rel="nofollow noreferrer">this</a> and <a href="http://www.lonecpluspluscoder.com/2015/03/setting-up-emacs-spell-checking-on-os-x/" rel="nofollow noreferrer">this</a> related post, but still couldn't figure out the problem.</p>