As you move vertically from line-to-line, Emacs tries to keep the point in the same column position or as near to it as it can. Normally, that's what you want to have happen but sometimes it's convenient to have the point move to some other column on the next or previous line. You can do that with the
set-goal-column command, which is bound to 【Ctrl+x Ctrl+n】.
For example, suppose you have some columnar data such as
aaa bbb ccc ddd eee fff ggg hhh iii ...
and you want to change the second column
aaa 111 ccc ddd 222 fff ggg 333 iii ...
The most direct way of doing that is to put the point on the first
b, delete the
bbb with 【Meta+d】, type the
111, and then move down to the next line. The problem is that the point will then be right after the last
e so you have to move it to the first
e, perhaps with a 【Meta+b】. An easier way is to put the point at the first
b and then set the goal column with 【Ctrl+x Ctrl+n】. Then you can delete the
bbb, type the
111, and move down to the next line. Now the point will be at the first
e so you can just delete and type in the
222. When you're finished, you can cancel the goal column with 【Ctrl+u Ctrl+x Ctrl+n】.
set-goal-column command is disabled by default so you will need to enable it before its first use. You can let Emacs ask you and then set it permanently or temporarily or you can enable it in your
init.el file with
(put 'set-goal-column 'disabled nil)