简体   繁体   English

emacs:如何关闭自动缩进?

[英]emacs: How to switch off auto-indent?

Can anybody tell me how to switch off auto-indent in emacs ?谁能告诉我如何在emacs关闭自动缩进?

What I tried is the recommended -我尝试的是推荐的 -

  (when (fboundp 'electric-indent-mode)
    (electric-indent-mode -1))

In my mode-hook which does not work.在我的模式挂钩中不起作用。 What also not work is to set (electric-indent-mode 0) .也不起作用的是设置(electric-indent-mode 0) And, neither does help to switch of electric indent my means of (setq electric-indent-inhibit t) .而且,我的(setq electric-indent-inhibit t)方法也无助于切换电动缩进。

What is the right approach?什么是正确的方法?

For nasm-mode , I simply call (electric-indent-local-mode -1) in my mode hook, which should be enough.对于nasm-mode ,我只是在我的模式挂钩中调用(electric-indent-local-mode -1) ,这应该就足够了。

For asm-mode , it by default binds RET to newline-and-indent , so you can redefine the key to (define-key asm-mode-map (kbd "RET") #'newline) and disable electric-indent-local-mode in your mode hook.对于asm-mode ,它默认将RET绑定到newline-and-indent ,因此您可以将键重新定义为(define-key asm-mode-map (kbd "RET") #'newline)并禁用electric-indent-local-mode在您的模式挂钩中。

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

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