Emacs Flaw: fill-paragraph fill-region

By Xah Lee. Date: . Last updated: .

What is Emacs Fill Commands

Emacs has a command fill-paragraphAlt+q】. It reformats the current paragraph into multiple lines, by inserting a newline char at every ~70 chars.

Emacs also has fill-region, which acts on a text selection.

However, there are some usability problems with these commands. This page discuss the problems and fixes.

Problems of Emacs Fill Commands

It is inconvenient to “unfill” a paragraph or region.

One frequently asked question is how to “unfill” — do inverse of fill-paragraph. Technically, this means replacing newline char by space. Emacs does not have a built-in command for this.

The typical solution is to set the cut-width to a huge number (e.g. set fill-column to 10001000), then Alt+x fill-paragraph, then set fill-column back to previous value.

If you need to reformat several paragraphs, use Alt+x fill-region.

There is no keyboard shortcut.

Solution

Emacs fill command problems