M-x ecb-activate

I'm a long time (x)emacs user. I use vi for small day-to-day stuff (vi TODO, anyone?), but as far as possible I do any development work with emacs, and have done for the past 12 years.

So, a few days ago I was pleased to discover a new mode that I'd not previously known about.

ecb, the Emacs Code Browser is a minor mode that makes browsing a collection of source code easier. Activate it (assuming it's installed) with M-x ecb-activate. It defaults to creating four new buffers within the current window. These buffers are displayed next to your primary editing buffer.

The first shows a directory tree view of the filesystem, centred at whichever directory contains the currently open file. The second shows a list of all the files in the currently selected directory. The third shows a list of all the items of interest in the current file (I'll come back to that in a moment). The fourth shows a list of the currently open files.

The third pane, which shows items of interest, is particularly useful. Here's a screenshot, where I've got a number of .c files open for editing.

Click to enlarge
ecb with a .c file

That third pane (mostly green in the thumbnail) is a list of all the functions (along with their type signature) in the file. Selecting one of those functions jumps to its definition in the file, and makes navigating large source files much easier.

The list of interesting items is not limited to just function definitions. In this screenshot I'm in the middle of editing a Perl module (.pm).

Click to enlarge
ecb with a .pm file

As well as containing functions, the list now contains information about documentation in the file (in POD format), and package declarations. Again, this making zipping around the file much easier than repeatedly seaching for "sub foo {".

I'm still scratching the surface of what ecb can do though.

No comments:

Post a Comment