Emacs 填充段落未按预期换行
我有以下 HTML 代码(列表项)。内容并不重要——问题是第 2 行的末尾。
<li>Yes, you can learn how to play piano without becoming a
great notation reader,
however, <strong class="warning">you <em class="emphatic">will</em>
have to acquire a <em class="emphatic">very</em>basic amount
of notation reading skill</strong>. But the extremely
difficult task of honing your note reading skills that
classical students are required to endure for years and years
is <em class="emphatic">totally non-existant</em>as a
requirement for playing non-classical piano.</li>
已应用命令 fill-paragraph (Mq)。我一生都无法弄清楚为什么在“读者”之后的第二行上放置换行符,因为该行上有更多空间可以放置“但是”。我注意到的另一个奇怪的事情是,当我删除然后重新应用第 4 行和第 5 行的制表符(分别以“have”和“of”开头)时,也会自动插入两个空格字符,如下所示
<li>Yes, you can learn how to play piano without becoming a
great notation reader,
however, <strong class="warning">you <em class="emphatic">will</em>
have to acquire a <em class="emphatic">very</em>basic amount
of notation reading skill</strong>. But the extremely
difficult task of honing your note reading skills that
classical students are required to endure for years and years
is <em class="emphatic">totally non-existant</em>as a
requirement for playing non-classical piano.</li>
:不知道这是否是某种线索。其他任何线路都不会发生这种情况。
这只是一个错误,还是有经验的 Emacs 人员知道这里可能发生了什么?
谢谢
I have the following HTML code (a list item). The content isn't important--the problem is the end of line 2.
<li>Yes, you can learn how to play piano without becoming a
great notation reader,
however, <strong class="warning">you <em class="emphatic">will</em>
have to acquire a <em class="emphatic">very</em>basic amount
of notation reading skill</strong>. But the extremely
difficult task of honing your note reading skills that
classical students are required to endure for years and years
is <em class="emphatic">totally non-existant</em>as a
requirement for playing non-classical piano.</li>
The command fill-paragraph (M-q) has been applied. I can't for the life of me figure out why a line break is being placed on the second line after "reader," since there's more space available on that line to put "however,". Another weird thing I've noticed is that when I delete and then reapply the tab characters on lines 4 and 5 (starting with "have" and "of" respectively), two space characters are automatically inserted as well, like so:
<li>Yes, you can learn how to play piano without becoming a
great notation reader,
however, <strong class="warning">you <em class="emphatic">will</em>
have to acquire a <em class="emphatic">very</em>basic amount
of notation reading skill</strong>. But the extremely
difficult task of honing your note reading skills that
classical students are required to endure for years and years
is <em class="emphatic">totally non-existant</em>as a
requirement for playing non-classical piano.</li>
I don't know if this is some kind of clue or not. This doesn't happen with any of the other lines.
Is this just a bug, or does any experienced Emacs person know what might be going on here?
Thank you
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这是故意的。以 XML 或 SGML 标记开头的行是段落分隔符行。如果 Emacs 以标记结束于行首的方式打破段落,则
fill-paragraph
的后续应用程序将停止在该行。这是为了确保,例如,不会变成。
同样的原因,Emacs 不会在句点后换行,除非句点后有两个或多个空格,因为它使用双空格来区分句点结束一个句子和一个结束缩写的句点,并且在结束缩写的句点之后换行会造成不明确的情况。
This is intentional. Lines that start with an XML or SGML tag are paragraph separator lines. If Emacs broke the paragraph in such a way that the tag ended up at the start of a line, subsequent applications of
fill-paragraph
would stop at that line. This is to ensure that, for instance,does not turn into
For the same reason, Emacs will not break a line after a period unless there are two or more spaces after the period, because it uses a double space to distinguish between a period that ends a sentence and a period that ends an abbreviation, and breaking a line after the period that ends an abbreviation would create an ambiguous situation.
对我来说看起来像一个错误。
我能够将您的示例精简为如下内容:
如果我从中删除文本的单个字符,则
fill-paragraph
按预期工作。或者,如果我在两个连续的元素之间添加一个字符。
Looks like a bug to me.
I was able to trim down your example to something like this:
If I remove a single character of text from it,
fill-paragraph
works as expected. Or if I add a chacter between the two consequtive<b>
elements.