tags:

views:

71

answers:

3

I'd like to be able to set multiple marks in Emacs like Vim does. In Vim you might press m B and that would set a mark at that line in the file. Later pressing ' b will then move your cursor back to that line. You can make multiple marks with m{a-zA-Z} Is there a way to have multiple marks like this in Emacs?

A: 

Have a look at this: http://www.cs.utah.edu/dept/old/texinfo/emacs18/emacs_13.html

Yeah I'm looking for random access to my marks. That mark ring is a stack.
MDCore
+2  A: 

You can use what Emacs calls registers. The documentation explains them better than I can.

High Performance Mark
Thanks. For a bonus multiplier, do you know of any way/plugin to highlight marked lines?
MDCore
No, no way that I know of. There are commands, such as `highlight-phrase` and `highlight-regexp`, which may be useful, but nothing like `highlight-register` in the standard build.
High Performance Mark
Found something close to it: http://www.emacswiki.org/emacs/BetterRegisters
MDCore
@MDCore: I've been using Emacs for donkeys years, but still learn something new every time I check this tag on SO. Thanks.
High Performance Mark
+1  A: 

From Emacs documentation :

C-x r SPC r

  • Record the position of point and the current buffer in register r (point-to-register).

C-x r j r

  • Jump to the position and buffer saved in register r (jump-to-register).

But if you want your positions to persist automatically from one Emacs session to the next, you should use Bookmarks :

C-x r m RET

  • Set the bookmark for the visited file, at point.

C-x r m bookmark RET

  • Set the bookmark named bookmark at point (bookmark-set).

C-x r b bookmark RET

  • Jump to the bookmark named bookmark (bookmark-jump).

C-x r l

  • List all bookmarks (list-bookmarks).

M-x bookmark-save

  • Save all the current bookmark values in the default bookmark file.
Jérôme Radix