Emacs fill-paragraph Problem

By Xah Lee. Date: . Last updated: .

What is Emacs Fill Commands

Emacs has a command fill-paragraphAlt+q】 that does hard-wrap of current paragraph (it inserts 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 answer to this question, 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, Alt+x fill-region. There is no keyboard shortcut.

Solution: Command that Auto Toggle Fill or Unfill, on Region or Current Paragraph

Emacs Modernization