在 noweb 模式下禁用自动填充模式
请问上帝啊,我怎样才能让 Emacs 停止自动填充?我使用 visual-line-mode
,我不想自动填充。我可以使用 Mx auto-fill-mode RET 将其关闭,但在 Noweb 模式下,当我移入代码块并再次退出时,它会重新打开。拜托,我只想全局关闭自动填充模式,这让我发疯。
我尝试过
(auto-fill-mode 0)
很多疯狂的事情,比如
(add-hook 'Rnw-mode-hook '(lambda () (auto-fill-mode 0)))
(add-hook 'latex-mode-hook '(lambda () (auto-fill-mode 0)))
但似乎没有任何效果。请帮我。
Please for the love of god how can I make Emacs stop auto-filling? I use visual-line-mode
, I do not want auto fill. I can turn it off with M-x auto-fill-mode RET
but in Noweb mode it gets turned back on when I move into a code chunk and back out again. Please, I just want to globally turn of auto fill mode, it's driving me crazy.
I've tried
(auto-fill-mode 0)
and a bunch of crazy things like
(add-hook 'Rnw-mode-hook '(lambda () (auto-fill-mode 0)))
(add-hook 'latex-mode-hook '(lambda () (auto-fill-mode 0)))
But nothing seems to work. Please help me.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您应该检查是否可以删除一些挂钩以禁用自动填充,而不是向系统添加更多挂钩。
如果您看到noweb-mode 的源代码,在第 211 行附近,您可以找到以下块:
要禁用自动填充,请将以下一两行放入 dotemacs 中(取决于您是否要在代码和文档中禁用自动填充)。
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:
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).
好的,我想出了一个解决办法:
如果我无法关闭自动填充模式,至少我可以通过将其设置为仅填充第 99999 列来使其无害。如果我键入超过 99999 个字符的段落,但如果发生这种情况,我将有更大的事情要担心......
OK, I worked out a hack that does the trick:
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...
如果你看一下
simple.el
,就会发现在最顶部的text-mode-hook
被定义了,它最终负责打开这个令人厌恶的东西(或者至少,它是为我)。要访问 simple.el 并自行查找:(Ch f,
auto-fill-mode
,单击/关注 simple.el 链接)要禁用,Mxcustomize-variable text-mode-hook
屏幕截图
取消选中打开自动填充。请务必点击顶部的“保存以供将来使用”。
If you look at
simple.el
, at the very toptext-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.