views:

116

answers:

3

If I have a multiline sentence in Emacs it naturally overflows onto the the following lines. Now, if my cursor is at the beginning of such a sentence and I press the DOWN ARROW key, the cursor is placed at the beginning of the next sentence (which might be at 4-5 lines down), rather than on the next line itself (which other editors do). Same is the behavior of the END and HOME keys.

Is there a way in which I can change this behavior and get the cursor on the next line instead of the next sentence?

A: 

You might want to try auto-fill-mode or longlines-mode. To get either use M-X then type the command you want. Toggle them off the same way.

If that doesn't work you may want to examine the binding that is being applied to your down arrow. Type C-h k then hit the down arrow key.

dmckee
`auto-fill-mode` just toggles word wrap. Also, I'm surprised that I don't have a longlines-mode. I'm using Emacs for Windows.
Ashwin
Judging from Bryan Oakley's answer, longlines-mode may be obsolete for emacs 23...anyone know?
dmckee
A: 

It sounds as though the text is wrapping, so by definition (a line being a group of characters separated by a carriage return), it is moving down to the next line.

I agree it is a pain, however a lot of other editors also have this behaviour.

One way is to turn off wrapping:

M-x toggle-truncate-lines

You wont be able to see all of the text in the editor, however it will move down to the next line.

Russell
Well, I want to be able to see the entire sentence within the buffer, and yet be able to go up/down a line.
Ashwin
+5  A: 

I haven't yet tried it myself, but I think what you are asking for is the default behavior for emacs 23. What version are you running?

You might want to check out the page Move By Visible Lines page on the emacswiki.

Bryan Oakley
I am using 'GNU Emacs 21.3.1'. I thought there would be a simple command for this.
Ashwin
Ah! Solace finally!
Ashwin
Suddenly I'm ambivalent about upgrading...
dmckee
Amazingly, you can change the setting to whatever you like. The defaults are just what you get when you don't have a .emacs.
jrockway