By default, the results of running M-x ispell-buffer in org-mode are very disappointing.

  1. Ispell looks inside :PROPERTY: drawers, which commonly contain things like

    :ID:       797495bd-581b-4a42-883b-c2a55a08f08a
  2. It tries to correct org statements! For instance, it complains about the SRC in

    #+BEGIN_SRC emacs-lisp
  3. It goes inside org-blocks. I suppose this might be useful for blocks like #+BEGIN_QUOTE, but in source code blocks that’s just silly.

Is there a package that fixes all this?

I’d love to spell-check my writing but the amount of false-positives I’m getting makes it unfeasible.

If it matters, the OS's spell checker is aspell.

  • There is a flyspell predicate for org-mode (check (get 'org-mode 'flyspell-mode-predicate)), but I'm not sure how that could be generalised for ispell-buffer. – legoscia Sep 29 '14 at 13:03
  • @legoscia Ispell has a variable called ispell-parser, so flyspell's predicate might work well there with a wrapper around it. – Malabarba Sep 29 '14 at 13:11
  • 1
    I use flyspell and hunspell and I don't see that behavior. Anything in lines with #+ or in source code blocks is not spell-checked. But normal text under headings is checked. I have these in my flyspell setup: (add-hook 'prog-mode-hook 'flyspell-prog-mode), (add-hook 'org-mode-hook 'turn-on-flyspell) – Kaushal Modi Sep 29 '14 at 13:40
  • @kaushalmodi Yeah, flyspell is smarter than ispell. Unfortunately, flyspell is a little demanding for my laptops processing power :(. It's not unusable, but it's a little annoying, which is why I was trying ispell. – Malabarba Sep 29 '14 at 13:44
  • 3
    Have you seen Can I prevent ispell from checking source blocks? in orgmode.org/worg/org-faq.html ? – rvf0068 Oct 10 '14 at 1:55

As rvf0068 suggested, ispell can be configured to skip over regions that match regexes. For example, to skip over :PROPERTIES: and :LOGBOOK: drawers as well as SRC blocks, you could put this in your .emacs file:

(add-to-list 'ispell-skip-region-alist '(":\\(PROPERTIES\\|LOGBOOK\\):" . ":END:"))
(add-to-list 'ispell-skip-region-alist '("#\\+BEGIN_SRC" . "#\\+END_SRC"))

(I'm new to StackExchange, so if I've broken etiquette or rules by expanding on rvf0068's answer please let me know.)


If you use flyspell instead, see How does one use flyspell in org buffers without flyspell triggering on tangled code blocks?

Please note: ispell-skip-region-alist is NOT used by flyspell.

Your Answer

