1. Home
  2. Computing & Technology
  3. Linux

Spelling
Emacs Documentation

By , About.com Guide

Checking and Correcting Spelling

This section describes the commands to check the spelling of a single word or of a portion of a buffer. These commands work with the spelling checker program Ispell, which is not part of Emacs.

  • M-x flyspell-mode
    Enable Flyspell mode, which highlights all misspelled words.
  • M-$
    Check and correct spelling of the word at point (ispell-word).
  • M-<TAB>
    Complete the word before point based on the spelling dictionary (ispell-complete-word).
  • M-x ispell
    Spell-check the active region or the current buffer.
  • M-x ispell-buffer
    Check and correct spelling of each word in the buffer.
  • M-x ispell-region
    Check and correct spelling of each word in the region.
  • M-x ispell-message
    Check and correct spelling of each word in a draft mail message, excluding cited material.
  • M-x ispell-change-dictionary <RET> dict <RET>
    Restart the Ispell process, using dict as the dictionary.
  • M-x ispell-kill-ispell
    Kill the Ispell subprocess.

Flyspell mode is a fully-automatic way to check spelling as you edit in Emacs. It operates by checking words as you change or insert them. When it finds a word that it does not recognize, it highlights that word. This does not interfere with your editing, but when you see the highlighted word, you can move to it and fix it. Type M-x flyspell-mode to enable or disable this mode in the current buffer.

When Flyspell mode highlights a word as misspelled, you can click on it with Mouse-2 to display a menu of possible corrections and actions. You can also correct the word by editing it manually in any way you like.

The other Emacs spell-checking features check or look up words when you give an explicit command to do so. Checking all or part of the buffer is useful when you have text that was written outside of this Emacs session and might contain any number of misspellings.

To check the spelling of the word around or next to point, and optionally correct it as well, use the command M-$ (ispell-word). If the word is not correct, the command offers you various alternatives for what to do about it.

To check the entire current buffer, use M-x ispell-buffer. Use M-x ispell-region to check just the current region. To check spelling in an email message you are writing, use M-x ispell-message; that command checks the whole buffer, except for material that is indented or appears to be cited from other messages.

The M-x ispell command spell-checks the active region if the Transient Mark mode is on (see Transient Mark), otherwise it spell-checks the current buffer.

Each time these commands encounter an incorrect word, they ask you what to do. They display a list of alternatives, usually including several "near-misses"--words that are close to the word being checked. Then you must type a single-character response. Here are the valid responses:

Explore Linux
About.com Special Features

The Best Web Trends of the Decade

A look back at the best innovations, ideas and technologies over the last 10 years, More >

Family Tech Center

Stay connected and entertained with reviews on tips on the latest HDTVs, cellphones and more. More >

  1. Home
  2. Computing & Technology
  3. Linux
  4. Linux Software
  5. Editors
  6. Emacs
  7. Emacs Documentation - Spelling

©2009 About.com, a part of The New York Times Company.

All rights reserved.