修改后的文档如何自动重新换行?

我已经启用了 auto-fill-mode

(add-hook 'org-mode-hook #'auto-fill-mode)

遇到比较长的句子时,按 RET 可以自动换行。

现在的问题是,如果我对已经存在的文档进行修改,所修改的行就不再是原来的行宽了。随便找篇文章类比一下,比如:

… concluding they are anything but a counterbalance to the American distaste for intellectual pursuits. But they could and should be. Encouraging kids to reject the life of the mind leaves them vulnerable to exploitation and control. …

从中间的 But 处换行就变成:

… concluding they are anything but a counterbalance to the American distaste for intellectual pursuits. But they could and should be. Encouraging kids to reject the life of the mind leaves them vulnerable to exploitation and control. …

我想要的效果是类似这样:

… concluding they are anything but a counterbalance to the American distaste for intellectual pursuits. But they could and should be. Encouraging kids to reject the life of the mind leaves them vulnerable to exploitation and control. …

这样很不美观,SPC t l 也不能解决。

请问如何才能不手动逐行 RET,使被修改行后面的文档(reject the life …)重新自动换行?

M-q fill-paragraph

试试这个,一般来说的话 你换行应该中间空一行,这样才是一个paragraph 因为emacs里换行都只是emacs里面看着方便 export的时候是不会认为后面有new-line的

所以你应该这么做

......
concluding they are anything but a counterbalance to the American distaste
for intellectual pursuits.

But they could and should be. Encouraging kids to reject the life of the mind
leaves them vulnerable to exploitation and control. ......

在pursuits. 后面按两下回车 然后按下 M-q 它会自动forma那行的格式

可能我表述地不够清楚。 我确实只是为了看着方便、美观,不是为了 new-line ,一般也不需要 export 。 本来 auto-fill-mode 也够用了,只是重新 format 的话会更整齐一些。

哦 抱歉 我没理解你的意思,那样的话我并不知道解决方法 希望有其他人知道能帮到你

这个问题 Spacemacs 早已有了方案,现在才知道解决方法。

可以加 hook ,(setq truncate-lines nil),@xunchunyang 说默认就是 nil,可能之前是跟我的某个设置起冲突了吧。

但是 truncate-lines 的改变不涉及文本内容只关心显示的宽度,如果遇到英文会把单词截断,这时候用 visual-line-mode 就可以了。可以区别 logical lines 和 screen lines。如果有需要,可以重新修改 C-a C-e 等键的绑定。