How to Prevent Lines from Wrapping in Emacs

By default, Emacs’s buffer list truncates lines at the right edge of the screen: if you’re editing a file with a long name, it doesn’t wrap around; you have to use C-x < and C-x > to scroll the viewport left and right.

I’d always wondered how to do that, since it can be useful when editing files like ~/.ssh/known_hosts, where the useful information is at the beginning of the line, and the wrapped keys get in the way.

Now I know:

(setq truncate-lines t)