vc-annotate

The Internet's tireless blogger Sacha Chua has another interesting video chat about Emacs. This time it's with Avdi Grimm, a well-known Ruby guru and Emacs user. The video is informative and definitely worth 40 minutes of your time so give it a look when you get a chance.

Towards the end, Grimm talks a little about how many developers use all sorts of suboptimal strategies for learning about the history of a piece of code. Many switch to a terminal and interrogate their version control system. Some go to github and browse the history there. Some even comment out old code so that the history is always there in the file. As Grimm points out, none of that is necessary if you're using Emacs or other decent programmer's editor. In the case of Emacs, you need merely invoke vc-annotate and a color coded history of the file is displayed along with the commit id, committer, date, and other information. From there you can drill down and get further details. Grimm has an excellent short video1 that demonstrates some of its functionality.

The nice thing is that vc-annotate is in stock Emacs so you don't need to do anything to use it. Just bring up a file that's under version control and type【Meta+xvc-annotate or 【Ctrl+x v g】 to try it out. You can read about vc-annotate in the Emacs manual or under the Old Revisions node in Info. This is a great feature; I can't believe I didn't know about it.

Footnotes:

1 The video doesn't show up at all without Flash so if you don't see the video at the link, you'll need to view it with Chrome or some other browser with Flash installed.

This entry was posted in General and tagged . Bookmark the permalink.