You probably know that major modes in Emacs can derive (inherit) functionality from a parent major mode.

Emacs 24.1 introduced prog-mode - a new major mode from which all programming modes (e.g. lisp-mode, ruby-mode) should be derived. All of the programming modes that come bundled with Emacs already inherit it (as do most actively maintained third-party modes). Having a common parent for all the programming modes allows us to do some pretty neat stuff - like setting common behavior for all of them. Here’s how we can enable spell-checking in comments:

(add-hook 'prog-mode-hook 'flyspell-prog-mode)

That’s all for now. We’ll discuss flyspell in more detail down the road.