Emacs Plug-in for Eclipse

Note:: this page is no longer maintained; the Eclipse plugin no longer works with Eclipse v3 due to changes in the internals on which it relies, and needs to be brought up to date.

Why?

The Eclipse Project provides a sophisticated integrated development environment (IDE) for programmers, offering a comprehensive set of features for "semantic" (as opposed to "syntactic") editing, incremental compilation and refactoring, with particular support for editing Java.

However, for those of us who have been using Emacs for ten or more years, switching to Eclipse is not without problems. Years of investment in learning its (sometimes arcane) command set, masses of tweaked Emacs Lisp code, and a "muscle memory" for strange chords of modifier keys are invaluable and one is naturally reluctant to leave them behind. More problematically, Eclipse's support for other languages besides Java diminishes rapidly. Learning two sets of editor keybindings is undesirable. (Three if you already learnt vi). (While Eclipse does have an Emacs keybinding emulation mode, some find the partial similarity to be more confusing than helpful.)

What?

The Emacs Plug-in for Eclipse is an editor plug-in for Eclipse that allows files (and also Java classes and methods, and compilation errors) to be opened within a running instance of Emacs.

It is based upon gnuclient [ZIP] which is similar to emacsclient, but more sophisticated. While it is straightforward to configure Eclipse with one or other of these tools as as the default editor for Java, the coupling between Emacs and Eclipse in that situation is very low: Eclipse can request that a file be opened, but cannot be more specific about the point of interest within the file.

The Emacs Plug-in for Eclipse is able to intercept requests to open not only a particular file, but also a Java class or Java method, or any other error message in the IDE associated with a marker, which identifies a location in a source file.

Where?

The Emacs Plug-in for Eclipse can be downloaded here: amadeus.eclipse.emacs.zip (<32KB). Download and extract the zip file in your Eclipse installation, above the plugins/ directory.

You will also need to have installed gnuclient, and executed (gnuserv-start) from within your $HOME/.emacs file.

Once Eclipse has been restarted, select "About Eclipse Platform" from the Help menu: the Emacs Plug-in for Eclipse should be listed. Then, select Preferences from the Window menu. Expand the Workbench node, then select File Associations. For each file type you wish to associate with Emacs (e.g. "*.java"), select it, click Add, select Internal Editors, select Emacs, hit OK, and then click Default. Now simply double-clicking on a Java source file in an Eclipse view should cause it to load in Emacs, whose window will be raised to the top.

There isn't much diagnostic code yet, so if it doesn't work, you're on your own. Works for me though.

Who?

The Emacs Plug-in for Eclipse was hacked together on 23 September, 2004, by Alan Donovan. The author welcomes comments, suggestions for improvment, bug reports, bug fixes and enhancements. However, the author cautions that this is his first Eclipse project, makes no representations about the quality or elegance of the code.

Please report bugs at PAG/zilla.

License?

This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License (LGPL) as published by the Free Software Foundation; either version 2 of the License, or any later version. (The LGPL is required since this package is a plug-in (library) that must be linked against non-GPL code, i.e., Eclipse.)

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.


adonovan@csail.mit.edu
Last updated: 12 November 2006