views:

453

answers:

3

How do you use line-wrap (autoscrolling?) in emacs? So that the portion that doesn't fit on the screen isn't shown as opposed to shown on the next line?

+6  A: 

What you describe sounds more like linewrap than scrolling. If that's what you're actually interested in, it's controlled with buffer-local variable truncate-lines. You can use customization to set it globally, or use hooks. For example, I used to prevent linewrap in dired with this:

(add-hook 'dired-mode-hook (lambda () (setq truncate-lines t)))
JB
tx man, for the term : M-xtoggle-truncate-lines did the trick. Although for me (emacs newbie) there's only a fine line between scrolling and truncating, since scrolling seems to imply truncation.
Peter
+3  A: 

You can also change this from the menu.

Options->Line Wrapping in this Buffer->Truncate Long Lines

Or if you want this globally you can use the function

global-visual-line-mode

mamboking
I don't have that `global-visual-line-mode` function. I'm on GNU 22.3.1, is it newer that that?
JB
I'm using GNU Emacs 23.0.91.1 (i386-mingw-nt5.1.2600) on XP.
mamboking
Yes, that feature is since version 23.
Török Gábor
+2  A: 

toggle-truncate-lines allows you to turn it on-off (as Peter noted in a comment on this post)

I have it mapped to a function-key:

(define-key global-map [f5] 'toggle-truncate-lines)

It won't work in vertically-split (partial-width) windows unless truncate-partial-width-windows is set to nil (from my .emacs):

(setq-default truncate-lines t)
(setq truncate-partial-width-windows nil) ;; for vertically-split windows
Michael Paulukonis