Disable auto fill mode in noweb-mode

独自空忆成欢 提交于 2019-12-04 04:25:47

Instead of adding further hooks to your system, you should check if you could remove some to disable auto-fill.

If you see noweb-mode's source code, around line 211 you find this chunk:

(add-hook 'noweb-select-doc-mode-hook 'noweb-auto-fill-doc-mode)
(add-hook 'noweb-select-code-mode-hook 'noweb-auto-fill-code-mode)

To disable auto filling, put the following one or two lines in your dotemacs (depending on whether you want to disable auto-fill in both code and documentation).

(remove-hook 'noweb-select-doc-mode-hook 'noweb-auto-fill-doc-mode)
(remove-hook 'noweb-select-code-mode-hook 'noweb-auto-fill-code-mode)

OK, I worked out a hack that does the trick:

(setq auto-fill-mode -1)
(setq-default fill-column 99999)
(setq fill-column 99999)

If I can't turn off auto-fill mode, at least I can make it harmless by setting it to fill only in column 99999. I'll be annoyed if I type a paragraph with more than 99999 characters, but if that happens I'll have bigger things to worry about...

If you look at simple.el, at the very top text-mode-hook is defined, which is ultimately responsible for turning on this abomination (or at least, it was for me).

To get to simple.el and look for yourself: (C-h f, auto-fill-mode, click / follow simple.el link)

To disable, M-x customize-variable text-mode-hook

Screen shot

Uncheck turn-on-auto-fill. Be sure to click "Save for future sessions" at the top.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!