Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm running Aquamacs 2.4 (based on Emacs on my Macbook, OS 10.7.5. I have the following line in my .emacs file:

(add-hook 'text-mode-hook 'turn-on-visual-line-mode)

I think that this line should cause visual line mode to be enabled whenever text-mode is, but it isn't. It fails to work even when this line is the only line in my .emacs file. Why might this be?

Many thanks!

share|improve this question
This should work, are you sure you're using a text mode? M-x text-mode RET. You could also try to see if the hook is executed with: (add-hook 'text-mode-hook (lambda () (message "Hello from text-mode-hook"))), M-x text-mode RET and then check the *Message* buffer. – Daimrod Dec 1 '12 at 22:10
@Daimrod This comment set me on the path to the answer. Thank you! – David Dec 2 '12 at 23:12
up vote 0 down vote accepted

After some experimenting (and some TFM reading) prompted by Daimrod's comment, I learned that the problem arose from the way Aquamacs does configuration. It loads the ~/.emacs file, but that's the first file it loads of four, and my text-mode-hook was being overwritten by one of the files loaded after it

Specifically, the order (according to the Aquamacs manual section 4.3, customizing Aquamacs) is:

~/Library/Preferences/Aquamacs Emacs/customizations.el
/Library/Preferences/Aquamacs Emacs/Preferences.el (for all users)
~/Library/Preferences/Aquamacs Emacs/Preferences.el

My addition to the text-mode-hook was being overwritten by a line in the customizations.el file, which was why visual line mode wasn't loading.

The manual also says that users shouldn't use ~/.emacs for customizations, but the last Preferences.el file instead, so I've moved everything in .emacs to my Preferences.el. Everything now works as I expect.

share|improve this answer

Your Answer


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.