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.

I'm running Aquamacs 2.4 (based on Emacs 23.3.50.1) 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
1  
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
add comment

1 Answer

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:

~/.emacs
~/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
add comment

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.