Long Lines minor mode helps you edit text files that have long lines.
Long Lines mode visually wraps long lines, to fill text and prevent lines from running off the screen. This wrapping is a display effect. It works by inserting line-ending characters temporarily. These visual line separations are called soft returns. Soft returns are removed when text is copied to the kill ring or the buffer is saved to disk.
This means that, ultimately, the text in a file you edit is changed only by hard returns (the returns that you insert manually), not by soft returns (which are inserted temporarily for visual wrapping).
GnuEmacs 22 and later come with Long Lines mode. For other versions of Emacs, you can download it here: Lisp:longlines.el. (Do not take the version of
longlines.el from Emacs CVS and dump it into an older Emacs version; it’s not compatible. The version of
longlines.el in the ElispArea (Lisp:longlines.el) is maintained to be compatible with older Emacs versions and with XEmacs.)
By default, soft returns are automatically inserted as you edit, to keep your text wrapped. If you do not want this effect, set
‘nil’. You can still type
‘M-q’, or use any of the other fill commands, to fill text using soft returns (see FillParagraph.)
If you invoke command
‘longlines-show-hard-newlines’ or set variable
‘longlines-show-hard-newlines’ to non-
‘nil’, then hard returns are marked with a glyph. This makes typing errors easier to spot.
Long Lines mode does not lengthen short lines. It does not remove line endings (hard returns); it only (visually) wraps long lines.
If you want to remove hard returns and then let Long Lines mode handle line wrapping, you can do this:
‘C-u 99999 C-x f’to set variable
‘fill-region’to fill all paragraphs in the region. Or use
‘fill-paragraph’) on individual paragraphs to fill them. See also commands
‘longlines-wrap-follows-window-size’ is non-
‘nil’, then Long Lines mode uses the window size as the wrap limit, instead of