How can I disable auto-fill mode in emacs?

拟墨画扇 提交于 2019-12-03 09:29:06

Add to your .emacs,

(auto-fill-mode -1)

If there are hooks for specific modes, you will need to zap those as well. My suspicion is that you do not actually have auto-fill-mode on by default in all modes, but with the information you have supplied, at least this should be a starting point.

A reasonable safeguard would be to also disable auto-fill mode from `text-mode-hook':

(remove-hook 'text-mode-hook #'turn-on-auto-fill)

You may need something similar for other modes as well.

Assuming that he has not made fundamental changes, you have several paths:

You can just turn off the mode globally in your .emacs file:

(turn-off-auto-fill)
;; ...or (auto-fill-mode -1)

Since Emacs of that vintage also turns on auto-fill for text-mode, add:

(remove-hook 'text-mode-hook 'turn-on-auto-fill)

That should account for all the default places, but check the major mode hooks if you have other modes enabling this automatically.

If you'd like to keep it turned-on in most text-mode while disable auto-fill in specific modes, e.g. org-mode in my case, you could use the following:

;; turn on auto-fill for text-mode
(add-hook 'text-mode-hook 'turn-on-auto-fill)
;; turn off auto-fill for org-mode
(add-hook 'org-mode-hook 'turn-off-auto-fill)
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!