Emacs wrap lines (disable/enable with toggle-truncate-lines)

Wrapping lines in emacs can be a real pain (fe.g. or programmers) or exactly what you want, for example if you’re writing the text of an email. At any rate it’s nice to know how to turn line wrap on and off in emacs – if anything every now and then you’d accidentally press the shortcut for this feature and your view would change to waht you don’t want (I do it at least once a day, hehe).

The command to turn this feature on and off is: toggle-truncate-lines.

As with any other emacs command you press the M-x key combo (i.e. “Alt-X” on a regular PC) and then type the command in the emacs mini-window. You can type it partially, then hit TAB and it wil be expanded.

Just to illustrate what a text looks like with this feature on and off look at the three sample emacs windows below:

1. The emacs window is wide enough to fit the lines completely so it is not affected by wrapping:

2. Line wrap is OFF (i.e. lines are “truncated”):

3. Line wrap is ON:

Leave a Reply

Your email address will not be published. Required fields are marked *