Emacs: Hard Wrap Lines, fill

- Alt + x
fill-paragraph
【Alt + q】 - Break a long line into multiple lines. (by inserting newline characters.)
- Alt + x
fill-region
- Break lines in a text selection.
- Alt + x
auto-fill-mode
- Automatically insert newline character as you type.
- Alt + x
set-fill-column
【Ctrl + x f】 - Set the max characters per line used by “fill” commands.
- Alt + x
ruler-mode
- Turn on ruler.
unfill-paragraph, unfill-region
Emacs does not have a “unfill-paragraph” command to do the inverse of “fill”. Here's the solution:
(defun xah-unfill-paragraph () "Replace newline chars in current paragraph by single spaces. This command does the inverse of `fill-paragraph'. URL `http://xahlee.info/emacs/emacs/emacs_unfill-paragraph.html' Version 2016-07-13" (interactive) (let ((fill-column most-positive-fixnum)) (fill-paragraph)))
(defun xah-unfill-region (start end) "Replace newline chars in region by single spaces. This command does the inverse of `fill-region'. URL `http://xahlee.info/emacs/emacs/emacs_unfill-paragraph.html' Version 2016-07-13" (interactive "r") (let ((fill-column most-positive-fixnum)) (fill-region start end)))
The following are better commands for “unfill”: