Ads by Google

Saturday, September 20, 2008

A Visual Bookmarks package for Emacs

When you use the default bookmarks feature in Emacs, those used to visual feedback on where the bookmarks are made, are let down.

There is none. Although the text based system is perfectly fine, lots of people would find a visual way to see their bookmarks as a better way to locate where they placed the bookmarks. At this point if you don't know what a bookmark is, it's best to read the manual link above.

Enter bm.el which is about as close you can get to mark up your code in technicolor!

Download and put it somewhere in your load path. Add the following to your init file

(require 'bm)

And a couple of customisations that you should set so that creation and navigation is easy. The author recommends

;; M$ Visual Studio key setup.
;; (global-set-key (kbd "<C-f2>") 'bm-toggle)
;; (global-set-key (kbd "<f2>") 'bm-next)
;; (global-set-key (kbd "<S-f2>") 'bm-previous)
you can also tinker with how you want the bookmarks to look like by using one of the following



(setq bm-highlight-style 'bm-highlight-only-line)
;;default, the last one in the pic

(setq bm-highlight-style 'bm-highlight-only-fringe) ;;middle bookmark

(setq bm-highlight-style 'bm-highlight-line-and-fringe) ;; the first one

You can customise the colours by using M-x customize-group bm and changeing the defaults.

One other function that should be useful is M-x bm-show and M-x bm-show-all; both show all the bookmarks set in the current buffer and in all buffers respectively. If you read the commentary of the elisp package, you'd see options to make the bookmarks persistent, annotate them, controlling the size of the bookmarks file etc.

While the default bookmarks bundled is more than adequate, this package is quite eye pleasing without getting in the way. At least for me, I tend to use this where I don't need persistence of bookmarks and throw it all off after I killed the code buffer.