Eclim is an Eclipse plugin which exposes Eclipse
features through a server interface. When this server is started, the
command line utility eclim
can be used to issue requests to that
server.
The eclim package uses the Eclim Server to integrate Eclipse with Emacs. This project wants to bring some of the invaluable features from Eclipse to Emacs. Please note, the eclim package is limited to mostly Java support at this time.
It is also possible to start and stop the eclim daemon from Emacs using the
eclimd
package.
You can ask questions or discuss new features on the Gitter channel (see badge above), and at our Google Group
This package was originally called emacs-eclim, and was renamed to
eclim on August 15, 2016 because use-package
could not load it from
the MELPA package archive.
Prior to version 1.7.3, Eclim used a proprietary protocol for communication with the Eclim Server. If you are running one of these older versions, you need version 0.1 of this package.
Eclim versions 1.7.3 and later however, serves responses using a standard JSON format. These are supported by versions 0.2 and later of this package.
The eclim package versions are tagged with the appropriate version number. You can see and download previous releases here.
emacs-eclim requires Emacs version 24.5 or later.
-
Download and install eclim.
-
Install emacs-eclim. You have two options:
- Installation from the MELPA package archive. Just
add the archive to
package-archives
if you haven't already, and then install the "eclim" package with thepackage-install
command. - Manual installation from GitHub.
- (
git clone git://github.com/emacs-eclim/emacs-eclim.git
) - Add
(add-to-list 'load-path "/path/to/emacs-eclim/")
to your startup script. - Make sure all dependencies are available, see
eclim-pkg.el
.
- (
- Installation from the MELPA package archive. Just
add the archive to
-
Add the following code to your emacs startup script:
(require 'eclim) (setq eclimd-autostart t) (defun my-java-mode-hook () (eclim-mode t)) (add-hook 'java-mode-hook 'my-java-mode-hook)
Or, if you prefer to enable eclim-mode globally:
(require 'eclim) (setq eclimd-autostart t) (global-eclim-mode)
If you wish to start the Eclim Server outside of Emacs, then set
eclimd-autostart
tonil
.
Now every time you open a file that belongs to a Eclipse project eclim mode is enabled.
Emacs-eclim tries its best to locate your Eclipse installation. If you
have Eclipse installed in a non-standard location (i.e.
~/nonStandard/eclipse
or /opt/eclipse
) you may specify the paths
manually by adding this to your startup script:
(custom-set-variables
'(eclim-eclipse-dirs '("~/nonStandard/eclipse"))
'(eclim-executable "~/nonStandard/eclipse/eclim"))
When the cursor is positioned on an error marker in a code buffer,
emacs-eclim uses the local help feature in emacs to display the
corresponding error message in the echo area. You can either invoke
(display-local-help)
manually or activate automatic display of local
help by adding the following to .emacs:
(setq help-at-pt-display-when-idle t)
(setq help-at-pt-timer-delay 0.1)
(help-at-pt-set-timer)
If you wish to use auto-complete-mode with emacs-eclim, add the following to your .emacs:
;; regular auto-complete initialization
(require 'auto-complete-config)
(ac-config-default)
;; add the emacs-eclim source
(require 'ac-emacs-eclim-source)
(ac-emacs-eclim-config)
Emacs-eclim can integrate with company-mode to provide pop-up dialogs for auto-completion. To activate this, you need to add the following to your .emacs:
(require 'company)
(require 'company-emacs-eclim)
(company-emacs-eclim-setup)
(global-company-mode t)
Emacs-eclim completions in company are case sensitive by default. To
make completions case insensitive set
company-emacs-eclim-ignore-case
to t
.
If you installed Eclim from MELPA you will have to install
company-emacs-eclim
as well. Add the archive to package-archives if
you haven't already, and then install the company-emacs-eclim
package with the package-install
command.
When emacs-eclim
is configured correctly, you don't need to modify the
configuration for the eclimd
package. Still, in the customization group
eclimd
there are a few variables you can tweak.
To use eclim-mode
's features eclimd
must to be running (M-x eclimd-start
or set eclimd-autostart
to t
) and the files you are editing have to be
organized in a Eclipse project (M-x eclim-project-create
).
Since most of eclim's commands require eclimd, you should ensure eclimd is running when you need it. Here are your options:
- Variable
eclimd-autostart
: Enables automatic starting of eclimd whenevereclim-mode
is enabled or whenglobal-eclim-mode
needs it. - Use the commands
start-eclimd
andstop-eclimd
. - Start
eclimd
manually using Eclipse or a shell. If you always want to start eclimd like this you should add(setq eclimd-autostart nil)
to your startup script to prevent accidental starting of eclimd from within Emacs.
This package uses Cask to compile and
test the project. Please install it prior to compiling the files.
Package dependencies are installed using the make init
command in a
shell. Once dependencies have been installed, use make compile
to
compile the files.
Read more about emacs-eclim:
- Enterprise Java Development in Emacs, [Torstein Krause Johansen]
- The Ballad of Emacs-Eclim, [Fredrik Appelberg]
- Emacs and Java, [Yves Senn]
- Java Autocompletion for Emacs, [root42]
- Eclim: Eclipse Meets Vim And Emacs, [Faruk Akgul]
Have a quick look at our Contribution Guidelines and hack away.