When opening a file one can use
$ emacs +2:9 practice.b
Which will open file ‘practice.b’ on line 2 and character 9 on that line. How do I jump like this in an already running Emacs? I know about M-x goto-line
but it doesn’t recognize semicolon.
Best Answer
M-x goto-line
(M-g g
orM-g M-g
) gets you to the beginning of the target line. Then you can useC-u 8 right
to move to the target column. Note that this puts you in column 8, because Emacs numbers columns from 0, except that the command line option+LINE:COLUMN
numbers columns from 1.If you want an Emacs command where you can type
2:9
, here's some code you can paste in your.emacs
that allows you to write it as an argument togoto-line
. Note that the code is only minimally tested in Emacs 23.