使用 emacs 在本地禁用自动填充模式(或取消填充段落)
我使用 Mq 来填充段落,我可以在自动填充模式下执行取消填充段落吗?
在组织模式下,我有时会输入 [[非常长的 HTML][带空格的名称]],对于“带空格的名称”,自动填充模式会根据插入的空格打破整行,这使得它非常丑陋。
有类似 un-fill-paragraph 之类的命令吗?或者,有没有办法暂时/本地禁用自动填充模式?
I use M-q for fill-paragraph, can I do the un-fill-paragraph in auto-fill-mode?
With org mode, I sometimes enter [[Very long HTML][Name with spaces]], and for the 'Name with spaces' the auto-fill mode break the whole line based on the inserted space, which makes it very ugly.
Is there a command something like un-fill-paragraph? Or, is there a way disable auto-fill-mode temporarily/locally?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
在调用
fill-paragraph
之前,Emacs 不会记录您的行内容。所以你唯一能做的就是 C-_ 运行命令撤消。它可以撤消您的fill-paragraph
命令,但前提是它是前面的命令调用。如果您想将多行段落放在一行上,您可以这样做:
Emacs does not record what was your line before calling
fill-paragraph
. So the only thing you can do is C-_ which runs the command undo. It can undo yourfill-paragraph
command but only if it is the preceding command call.If you want to put a multi-line paragraph on one line you could do like this :
自 monotux 回答以来,Xah Lee 更新了他的代码,为了可读性,我对其进行了一些重构:
Xah Lee has updated his code since monotux's answer, and I refactored it somewhat for readability:
为了在组织模式下从段落中重新制作长行,我给了自己一个新命令。以下是相关的 Emacs Lisp 代码:
当然,您可以根据需要调整命令键绑定!
To remake a long line out of a paragraph in Org mode, I gave myself a new command. Here is the associated Emacs Lisp code:
Of course, you adjust the command keybinding as you see fit!
我使用以下代码片段来填充和取消填充段落(仅使用
Mq
),它真的非常方便。我从 Xah Lee 那里借用了它,但删除了一些注释和空格以使其适合这里。第一条评论中的链接指向他的原始代码。I use the following snippet to fill and un-fill paragraphs (using only
M-q
), it is really, really handy. I borrowed it from Xah Lee, but removed some comments and whitespace in order to make it fit in here. The link in the first comment goes to his original code.