Saturday, June 16, 2012

Bookmarking in Emacs

This little feature in Emacs should be among the first things you should learn when you're trying out Emacs.

The thing is, you have to consciously keep at it for sometime before you start using it in a fashion that suits your workflow. In fact, I didn't use bookmarks at all for quite a few years; doing the same C-x d, scrolling to a folder, repeat scrolling till I reached my usual nested directory.  If you're doing something repetitively, it's a good bet to check out the manual about it or ask in the Emacs mailing list, someone's been through your pain before.

Anyways, if you want to bookmark a location(think man, info pages, specific directories), hit C-x r m and it will prompt you for a name.  Give one and you're set. C-x r b will give a promptable(tab completable) list that you type in to jump to the specific directory or file location.  The bookmarks can be saved for the next sessions by issuing a M-x bookmark-save.

That's all there is to it and you'll soon find it nifty when you're working on a coding project with large number of folders and files. People get lost in the humongous manual and this is the quickest way to get back to where you were when trying out things in the scratch buffer.

This thread might be useful for some and there are some improvements to it which can be found in the Emacswiki bookmarks link.