Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

In emacs, I want flyspell-mode to be enabled by default whenever I am in org-mode.

Based on different examples I've seen in emacs documentation I've tried adding various lines to my .emacs file one at a time, such as:

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

and

(dolist (hook '(text-mode-hook))
      (add-hook hook (lambda () (flyspell-mode 1))))

Neither of these will work. Please let me know the correct way to save myself from doing a M-x flyspell-mode every time I open an org-mode file.

share|improve this question
    
dolist is for doing a bunch of stuff different than this. You can do it like mk1 suggested below, and if you have many things for the hook, you can do something like this: (add-hook 'org-mode-hook (lambda () (flyspell-mode 1) )) –  lawlist Dec 31 '13 at 4:54

1 Answer 1

up vote 4 down vote accepted
(add-hook 'org-mode-hook 'turn-on-flyspell)
share|improve this answer
    
I tried adding this line to my .emacs file, and it didn't work. I realized org-mode-hook was already defined toward the end of my file, so I added turn-on-flyspell there.... but still not working. Any suggestions? –  Brian Z Jan 1 '14 at 15:06
    
Can you post the exact command that sets your org-mode-hook? –  mk1 Jan 2 '14 at 23:28
    
It was a long screwy mess under customize-variable, so I just wiped that out and added the line above and it's working fine now. Thanks! –  Brian Z Jan 3 '14 at 1:40

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.