Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to enable automatic spell check by default? [closed]

Tags:

emacs

I can't find what can be added to init file to enable automatic spell check by default.

Automatic spell checking (Flyspell) can be enabled from menu -- may be there is a way to learn how menu entry work?

like image 454
Onlyjob Avatar asked Apr 09 '13 01:04

Onlyjob


1 Answers

I have the following in my init.el:

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

That covers my editing needs just fine.

Hooks are like 'events' or the observer pattern if you're used to OOP: they're lists of functions that get run at certain points. One of the main ways you customise Emacs is by adding your own functions to these hooks.

Most modes in Emacs call a hook when they're enabled. prog-mode is the mode from which programming modes are derived, so adding functions to prog-mode-hook customises all programming modes.

The best reference for this stuff is the built-in Emacs Lisp manual (C-h r or M-x info-emacs-manual). It has sections on Emacs Lisp programming, including a chapter on hooks.

like image 154
Chris Barrett Avatar answered Oct 13 '22 00:10

Chris Barrett