Emacs: Hard-Wrap Lines

By Xah Lee. Date: .

reformat lines so that lines are not longer than 70 chars

emacs fill paragraph 80995
emacs Alt+x fill-paragraph

Alt+x fill-paragraphAlt+q】 to reformat the current block of text your cursor is on.

Alt+x fill-region to reformat a text selection.

To have emacs automatically insert a newline char when typing reaches the right margin, Alt+x auto-fill-mode.

The variable fill-column controls the width used in the above commands. Alt+x set-variable, to change value.

Note: these commands insert newline characters into your file. This type of wrapping is called hard-wrap. Hard-wrap convention of 80 chars came from punched card. You should avoid hard-wrap when possible; add newline char only at logical positions. (Rant: The Harm of hard-wrapping Lines.)

make sentence ending by single space

When Alt+x fill-paragraph etc, emacs will reformat it so that there are 2 spaces after a period.

;; make sentence ending by single space
(setq sentence-end-double-space nil )

[see Emacs: Hard Wrap Lines, fill]

Emacs Line Wrap

Emacs Init

Init Basics



Text Editing



Restore Things





Advanced Init Tips


ErgoEmacs mascot-s276x226
Buy Xah Emacs Tutorial