Vanilla Emacs bookmarks are for lhamas. Real octopodes use bookmark+ which enhances well known bookmarking in the way you didn’t even imagine. As the wiki page states:

Richer bookmarks. They record more. They are more accurate.

A few things we get here for free:

  • Bookmarks tagging. Yup! just like in delicious. you may use tags eg. for sorting and filtering.
  • Usage ‘statistics’. you may sort and filter your bookmarks basing on how often they were used.
  • Function / sequence / variable-list bookmarking. Sounds odd, but you may bookmark (and invoke later) a simple function or save/restore value of particular variable. If you feel it’s too primitive for your needs, you may also combine all kind of bookmarks into sequence restored (evaluated) simply by selecting such a sequence-bookmark.
  • A bit more useful thing is bookmarking a region. Region gets activated each time you select corresponding bookmark.
  • According to the documentation bookmarks+ are better relocated, which means they track the point they are assigned to in a smarter way.

Coming back to bookmark types. Beside the function, sequence and variable-list bookmarks mentioned before, bookmark+ is happy to introduce a few more types:

  1. Dired bookmarks - dired buffers get restored immedately as they were bookmarked. That’s especially useful when used with tramp-mode.
  2. Bookmark-list bookmarks - saves and restores the state of bookmarks list :) Once again, sounds weird but it’s might be helpful when you carefully adjust your bookmarks list by setting up filters or the way it’s sorted and you want to restore exactly the same list later.
  3. Desktop bookmarks - these ones I find really useful. They allow me switching between projects in a second.
  4. Gnus bookmarks - if you use Gnus, it’s something for you. And who doesn’t use Gnus after all?

Now, let’s leave the marketing buzz and focus on everyday usage.

There are at least 2 things which I think make it worth switching to bookmark+.

The first one is, as mentioned, ability to bookmark the current session of your emacs, so called desktop. Having more than one active project it’s crucial to switch between them in rational way. By switching I mean restoring the last remembered desktop of project I want to ‘visit’.

To make desktops working you have to enable them first (described here: http://www.emacswiki.org/emacs/DeskTop).

Next, enable bookmark+ (link at the top) and, with 4 fingers crossed, type C-x p K and point the file where your desktop will be saved. If you want to restore your desktop, display list of bookmarks: C-x r l and select previously created bookmark.

To make things a bit more convenient I usually prefix my ‘desktop-bookmarks’ with (desktop) (eg. (desktop) my-secret-project) and sort bookmarks alphabetically. To make things even more convenient I use anything (surprise!):

(global-set-key (kbd "C-c b") 'anything-c-pp-bookmarks)

There is also second feature which makes bookmark+ attractive alternative for vanilla bookmarks. It’s something called Autonamed bookmarks.

What it is used for?

Quite often I need to create a temporary bookmark to remember the line of code I’m just working on and I immediately jump into different place to modify some other parameter/variable/whatever. I don’t want to keep this bookmark forever so inventing a name is just a waste of time. Instead of creating a plain bookmark, I create a ‘autonamed’ one (C-x p RET) which means that Emacs takes care of inventing the bookmark name for me. Moreover, having the highlighting configured as '(bmkp-auto-light-when-set (quote autonamed-bookmark)) I have visually marked all autonamed bookmark created so far.

As autonamed bookmarks bacame part of my life, I wanted to jump between them in fastest possible way. This is why I reused meta-shift up and down keys:

(global-set-key [(M-S-down)] 'bmkp-next-bookmark-this-file)
(global-set-key [(M-S-up)]   'bmkp-previous-bookmark-this-file)

This post covers only the top of bookmark+ iceberg. I highly recommend reading the emacs wiki and going deeper into secret world of bookmarks :)