Почему не работает крючок текстового режима Aquamacs, который я добавляю в файл .emacs?

586
David

Я использую Aquamacs 2.4 (на основе Emacs 23.3.50.1) на моем Macbook, OS 10.7.5. У меня есть следующая строка в моем файле .emacs:

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

Я думаю, что эта строка должна вызывать режим визуальной линии, когда текстовый режим включен, но это не так. Он не работает, даже когда эта строка является единственной строкой в ​​моем файле .emacs. Почему это может быть?

Большое спасибо!

1
Это должно работать, вы уверены, что используете текстовый режим? `Mx`` text-mode` `RET`. Вы также можете попробовать проверить, выполняется ли ловушка с помощью: `(add-hook 'text-mode-hook (lambda () (сообщение" Hello from text-mode-hook ")))`, `Mx`` text- режим `` RET` и затем проверьте буфер `* Message *`. Daimrod 11 лет назад 1
@Daimrod Этот комментарий указал мне путь к ответу. Спасибо! David 11 лет назад 0

1 ответ на вопрос

1
David

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.

Похожие вопросы