简体   繁体   English

Emacs - 当我进入主模式时如何自动进入次模式?

[英]Emacs - how do I automatically enter minor modes when I enter a major mode?

I'm kind of a newb when it comes to emacs. 对于emacs,我有点像新手。 I know about the .emacs file but have very little idea as to do anything more advanced than elementary stuff. 我知道.emacs文件,但是对于做一些比基本内容更先进的事情一点都不知道。

Whenever I enter latex-mode, I'd also like to automatically turn on flyspell-mode, reftex-mode, auto-fill-mode, and also set fill-column to 120. How do I edit my .emacs file to do this? 每当我进入乳胶模式时,我也想自动打开flyspell模式,reftex模式,自动填充模式,并将fill-column设置为120.如何编辑我的.emacs文件来执行此操作?

Thanks! 谢谢!

(add-hook 'latex-mode-hook
    (function (lambda ()
       (flymake-mode)
       (reftex-mode)
       (auto-fill-mode)
       (setq fill-column 120))))

for example should work. 例如应该工作。

You can set a so-called hook to a major mode. 您可以将所谓的挂钩设置为主模式。 Have a look at this page of the manual for some examples. 有关示例,请查看手册的此页面

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM