How to turn off Emacs's auto line wrapping for the current session?

Depending on which flavor of automatic line wrapping you're using, it'll be one of

M-x toggle-truncate-lines

if your lines wrap hard at the right-hand edge of the window, or

M-x visual-line-mode

if your lines "soft wrap" at the whitespace nearest the right-hand edge of the window.

(If you're using an Emacs version older than 24.4, it may also be M-x longlines-mode, if your lines wrap hard at a given column.)

If you've issued the wrong command for your configuration, then the message in the minibuffer will say "...enabled" instead of "...disabled"; in that case, just issue the same command again to re-disable the bogus mode, and try the others until you've found the one which disables the mode you're actually using.

These are buffer-local modes, so issuing the command will affect only the buffer you're in when you do so; in all other buffers, you'll still have the benefit of line wrapping unless you similarly turn off the mode there as well.

Should you wish later to turn line-wrapping back on, just reissue the command you used to disable it.


Just an update on longlines-mode.

As of emacs 24.4, longlines-mode no longer exists. Therefore I'd recommend using M-x toggle-truncate-lines if you want it temporarily, or (set-default 'truncate-lines t) in your .emacs file if you want it be default in all buffers


Another possibility may be to toggle auto-fill-mode

For example, turning off auto-fill-mode in auctex stops hard line wrapping

Tags:

Emacs