Emacs Wrong Paragraph Wraps Text

So, in Emacs, the phrase is called padding and is done with M-qor M-x fill-paragraph. Is there a way to change this function to respect spaces that should be inextricable? For example, if we have the following sentence:

This is a black sentence with a yellow word at the end.

and tell Emacs to fill in the paragraph at 50, he completes it as follows:

This is a black sentence with a yellow word at the
end.

However, if I do the same with C-u M-x shell-command-on-regionand type fold -sw 50, I get the following (correct) output:

This is a black sentence with a yellow word at 
the end.

A similar problem occurs when something in brackets follows at the end of a sentence:

This is a black sentence with a yellow word here. (This is something in parens)

The above sentence is wrapped M-qaround 50 as follows:

This is a black sentence with a yellow word
here. (This is something in parens)

However, it fold -sw 50wraps it correctly:

This is a black sentence with a yellow word here. 
(This is something in parens)

, , fold, , , fill-paragraph .

+4
1

, "" .

, , :

(add-to-list 'fill-nobreak-predicate 'fill-single-word-nobreak-p)
(setq sentence-end-double-space nil)

( ) fill-single-word-nobreak-p :

"Don't break a line after the first or before the last word of a sentence."
;; Actually, allow breaking before the last word of a sentence, so long as
;; it not the last word of the paragraph.

fill-nobreak-predicate.

+5

All Articles