ECB, stands for Emacs Code Browser, tranforms your emacs from a text editor to a real IDE for coding. Once activated, it can display many useful information that help you program more effectively. The ECB’s informational windows can contain:
- a directory tree,
- a list of source files in the current directory,
- a list of functions/classes/methods/… in the current file, (ECB uses the Semantic Bovinator, or Imenu, or etags, for getting this list so all languages supported by any of these tools are automatically supported by ECB too)
- a history of recently visited files,
- the Speedbar and
- output from compilation (the “compilation” window) and other modes like help, grep, etc. or whatever the user defines to be displayed in that window.
For more information, please visit ECB Homepage.
Here is the ECB screenshot from my Emacs
ECB requires CEDET version 1.0+, which is included in Emacs version 24.
You can install ECB manually by cloning the package and add it to your
load-path. However, there is another convinience method, that is to use
package.el. If you haven’t known it yet, have a look at this post
Emacs Package Manager. To install it,
and type in
C-s and search for ecb,
RET and select Install.
After that, add this to your .emacs or init.el file
Now, everything you need to run ECB is to type
RET and ECB is now
ready for you to use. When you want to stop it, just execute the command
Some Basic Configurations
To set the layout for ECB, add this to your .emacs
Replace layout-name with the name of the layout you want. For a list of ECB layouts, follow this link ECB Layouts.
Show source files in directories buffer
By default, ECB hides the compilation window. Everytime I compile, it displays the compilation message to the same window as the buffer that I’m editing. This is really annoying because I want to see all the messages so that I can fix the error in my code easily. To keep a persistent compile window in ECB, add this to your .emacs
Some key bindings for quick interation with ECB, replace them with the key bindings that you want.
Some of My Functions
Personally, I don’t like those function
ecb-hide-ecb-windows since I usually have to open multiple windows in Emacs. When
deactivate or hide ECB window, it does not automatically restore the window
layout and switch to the buffer that I’m editing. Similar problem happens when I
try to show ecb window again. Because of that, I wrote those functions to
replace the ECB built in three functions ecb-deactivate, ecb-show-ecb-windows,
After that, bind them with a key sequence for quick interaction with ECB