30.5.6 Long Lines Mode
Long Lines mode is a minor mode for word wrapping; it lets you
edit “unfilled” text files, which Emacs would normally display as a
bunch of extremely long lines. Many text editors, such as those built
into many web browsers, normally do word wrapping.
To enable Long Lines mode, type M-x longlines-mode. If the
text is full of long lines, this will “wrap” them
immediately—i.e., break up to fit in the window. As you edit the
text, Long Lines mode automatically re-wraps lines by inserting or
deleting soft newlines as necessary (see Hard and Soft Newlines.) These soft newlines won't show up when you save the
buffer into a file, or when you copy the text into the kill ring,
clipboard, or a register.
Word wrapping is not the same as ordinary filling
(see Fill Commands). It does not contract multiple spaces into a
single space, recognize fill prefixes (see Fill Prefix), or
perform adaptive filling (see Adaptive Fill). The reason for this
is that a wrapped line is still, conceptually, a single line. Each
soft newline is equivalent to exactly one space in that long line, and
vice versa. However, you can still call filling functions such as
M-q, and these will work as expected, inserting soft newlines
that won't show up on disk or when the text is copied. You can even
rely entirely on the normal fill commands by turning off automatic
line wrapping, with C-u M-x longlines-auto-wrap. To turn
automatic line wrapping back on, type M-x longlines-auto-wrap.
Whenever you type RET, you are inserting a hard newline. If
you want to see where all the hard newlines are, type M-x
longlines-show-hard-newlines. This will mark each hard newline with
a special symbol. The same command with a prefix argument turns this
display off.
Long Lines mode does not change normal text files that are already
filled, since the existing newlines are considered hard newlines.
Before Long Lines can do anything, you need to transform each
paragraph into a long line. One way is to set fill-column
to a
large number (e.g., C-u 9999 C-x f), re-fill all the paragraphs,
and then set fill-column
back to its original value.