Giter Site home page Giter Site logo

senny / emacs-eclim Goto Github PK

View Code? Open in Web Editor NEW
587.0 51.0 104.0 781 KB

This project brings some of the great eclipse features to emacs developers. It is based on the eclim project, which provides eclipse features for vim.

Home Page: http://www.emacswiki.org/emacs/EmacsEclim

Emacs Lisp 100.00%

emacs-eclim's Introduction

License GPL 3 Build Status MELPA MELPA Stable

Development has moved to https://github.com/emacs-eclim/emacs-eclim !!!

Overview

Join the chat at https://gitter.im/senny/emacs-eclim

Please Note: Development has moved to https://github.com/emacs-eclim/emacs-eclim

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.

Emacs-eclim 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, emacs-eclim 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 at our Google Group

A note about Eclim versions

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 emacs-eclim.

Eclim versions 1.7.3 and later however, serves responses using a standard JSON format. These are supported by emacs-eclim versions 0.2 and later.

Emacs-eclim versions are tagged with the appropriate version number. You can see and download previous releases here.

Installation

  1. Download and install eclim.
  2. 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 emacs-eclim with the package-install command.
    • Manual installation from GitHub.
      1. (git clone git://github.com/senny/emacs-eclim.git)
      2. Add (add-to-list 'load-path "/path/to/emacs-eclim/") to your startup script.
  3. Add the following code to your emacs startup script
(require 'eclim)
(global-eclim-mode)

If you want to control eclimd from emacs, also add:

(require 'eclimd)

Configuration

Eclipse installation

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"))

Displaying compilation error messages in the echo area

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)

Configuring auto-complete-mode

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)

Configuring company-mode

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.

Configuring eclimd module

When emacs-eclim is configured correctly, you don't need to modify the configuration for the eclimd package. Still, there are some configurable variables you can tweak:

  1. eclimd-executable: This variable is used for locating the eclimd executable file. You can set it to nil ("Same directory as eclim-executable variable" choice in customization screen) to indicate that the executable is in the same directory as the eclim program. Alternatively, you can give it a string value ("Custom value" choice in customization screen) to specify the location of the executable.

  2. eclimd-default-workspace: When start-eclimd is executed, it will ask for the workspace directory to use. The default value for this question is controlled by this variable.

  3. eclimd-wait-for-process: Normally, when start-eclimd starts the eclimd process, it pauses emacs until eclimd is ready to accept commands. If you change the value of this variable to nil, start-eclimd will return as soon as eclimd is started. Eclimd startup takes several seconds, so if you change the default value of this variable, emacs-eclim commands will fail until eclimd is ready.

Dependencies

  • dash.el for list manipulation functions
  • s.el for string manipulation functions
  • json.el (part of emacs as of version 23)
  • popup.el for inplace popup menus

Optional dependencies

  • A recent version (0.6.0 or later) of yasnippet
  • A recent version (tested with 0.5) of company-mode
  • A recent version (tested with 1.4) version of auto-complete-mode
  • ido-mode (part of emacs as of version 22)

Usage

To get started just launch the eclim executable that the placed in your Eclipse installation directory.

Controlling eclimd

When you import the eclimd package, you will have access to two commands: start-eclimd, and stop-eclimd.

start-eclimd will ask for a workspace directory, and it will attempt to start eclimd program with the entered workspace directory. The configurable variable eclimd-default-workspace controls the default value of this directory. After start-eclimd runs the daemon, it will monitor its log output, and wait for the message that indicates that it is ready to accept commands. This is done to prevent failures with emacs-eclim commands while eclimd is starting up. While start-eclimd is waiting for the daemon to be ready, emacs will not accept any user input. To prevent this pause, you can modify the configurable variable eclimd-wait-for-process.

Normally, simply killing the buffer *eclimd* will allow you to stop the eclimd daemon. However, there is a command to perform a graceful shutdown: stop-eclimd. You should use this command when you wish to stop the eclimd program.

Press

Read more about emacs-eclim:

Contributing

Have a quick look at our Contribution Guidelines and hack away.

emacs-eclim's People

Contributors

aarzilli avatar bbelleville avatar chumpage avatar damiencassou avatar dgutov avatar eeemil avatar expez avatar fred-o avatar jaigupta avatar jchochli avatar jiblits avatar jingtaozf avatar jlombacher avatar kleewho avatar lespaul avatar lmichelbacher avatar mnp avatar rlazo avatar ryfow avatar sabof avatar scottyb avatar senny avatar skybert avatar taku0 avatar tsdh avatar useername avatar vedang avatar vhallac avatar yivanusi avatar yveszoundi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

emacs-eclim's Issues

cannot access project manager

After executing eclim-manage-projects, I get an error;

/bin/bash: -command: command not found
truncate-string-to-width: Wrong type argument: stringp, nil

have no clue what could be causing this, but I also get the following when trying to create a new project after entering the project type

/bin/bash: -command: command not found

eclim-problems highlighting actually doing anything?

Sorry to put this in the issues section, but I don't think there is a mailing list for discussion. I've actually ignored eclim's ability to highlight errors and warnings since I didn't think they were supported.

Only a few days ago, I saw that eclim does try to highlight stuff, but I only see the problem area being underlined.

I see that eclim--problems-insert-highlight works properly, but it seems no matter how I change:
eclim-problems-highlight-error-face,

I can't get the buffer to do anything more than underline the problem. Is anyone else having this problem? I assume it's my misunderstanding of the defface command.

(defface eclim-problems-highlight-error-face
'((t (:foreground "Blue" :background "Red")))
"Face used for highlighting errors in code"
:group 'eclim-problems)

I've been trying weird combinations like the above.

Thanks!

apply: Setting current directory: No such file or directory, "/home/seeyou/workspace"

while i use C-c C-e p c in emacs. there would show some infomation the echo area , i type the info follow by the tip ,as below
Name:android
Project Directory:~/workspace/android
there are some message echo in the message :/home/seeyou/eclipse/eclim -command project_nature_aliases
Type: java
there are some message echo in the message :
/home/seeyou/eclipse/eclim -command project_create -f /home/seeyou/workspace/android/ -n java -p android "Created project \u0027android\u0027."
while i use C-c C-e p p
there are some message echo in the message:apply: Setting current directory: No such file or directory , "/home/seeyou/workspace"

I don't know what happen .the directory already exited .while show the error?who can help me .thank you very much

i don't know what happen.the directory "/home/seeyou/workspace" already exist in my path,

Support for eclim command project_build

It would be nice, if there was a function eclim-project-build-current-file, which, if no argument is given, builds the project that the currently visited file belongs to. I tried this on the command line:

  $ eclim project_by_resource -f SomeFile.java
  "SomeProject"
  $ eclim -command project_build -p SomeProject
  "Built project \u0027SomeProject\u0027."

So I guess this should be pretty straight forward to implement.

Wrong type argument: stringp, nil... Again

Hi guys,

I am sorry for the bother, i have already find some answer related to this issue, but the solutions do not seem to work. I am on OS X and have eclimd running, I have installed eclim in the default eclipse path and put it in my PATH in bashrc plus added these to my .emacs to be sure:

(setq exec-path (append exec-path '("/Applications/eclipse/")) )
(setenv "PATH" (concat "/Applications/eclipse/:" (getenv "PATH")))

When I run the eclim-manage-projects command, I get a

Wrong type argument: stringp, nil... 

error message. So I switched on the debug mode and now the Message buffer tells me this:

Executing: /Applications/eclipse/eclim -command workspace_dir 
Executing: /Applications/eclipse/eclim -command project_list 
truncate-string-to-width: Wrong type argument: stringp, nil

If I try a eclim-project-open, I get something similar:

Executing: /Applications/eclipse/eclim -command project_list 
Wrong type argument: stringp, nil

I went back to see my Message buffer later and I see this:

Executing: /Applications/eclipse/eclim -command ping  [3 times]
Executing: /Applications/eclipse/eclim -command project_list  [2 times]

So it doens't seem to raise errors then, but the eclim-manage-projects is still not working for me.

I have tryed running the /Applications/eclipse/eclim -command project_list in my terminal and I get:

[{"open":false,"name":"DialogueInterface","path":"/Users/pandrews/PHD/code/java/dialogueInterface"},{"open":false,"name":"Personage","path":"/Users/pandrews/PHD/code/java/personage"},{"open":true,"name":"Servers","path":"/Users/pierreandrews/Documents/workspace/Servers"},{"open":false,"name":"Util","path":"/Users/pandrews/PHD/code/java/util"},{"open":false,"name":"chatterbean","path":"/Users/pandrews/dev/PHDlinked/chatterbean"}]

Any ideas?

managing java import statements

Eclim provides functionality to remove unused imports and to add missing imports into the source file. THis functionality needs to be implemented in emacs-eclim.

ELPA compatibility

To simplify the distribution and release management we should make use of ELPA. I was also recently contacted by Stefan Monnier (core Emacs developer). He asked if I was interested to upload emacs-eclim to ELPA.

plans to add compatibility to xemacs

I'm currently looking on wether I should try to make malabar or eclim-emacs to work with xemacs and want to find out if this is something that is already considered for eclim-emacs?

eclim-manage-projects and JSON output

I am running a fairly new eclim pulled from git (org.eclim_1.7.2.155-gf407cc27). All eclim output appears to be JSON, which emacs-eclim seems not to parse. I see some issues discussing JSON, but I can't see what the plan form emacs-eclim is.

This issue could track updating emacs-eclim to handle eclim's JSON output.

Support for 'correct' feature

Ecim vim version have ':JavaCorrect' feature, where Eclipse will suggest possible solutions for detected problem. Is it possible to implement the same feature in emacs-eclim?

Thanks

display class hierarchy of the current class

Emacs eclim should provide a way to display the complete inheritance tree of the current class. That tree should also display the implemented interfaces. It would be great, if the entries in the tree were linked against their source files.

Roadmap

Could somebody update the roadmap. I heard fred-o pretty much took over this project so maybe he could do it. It could help bringing new features to emacs-eclim in case any lispers are feeling generous or bored.

Problem with file encoding

When trying to use eclim-java-complete, I get the following error and no completions:

condition-case: java.io.UnsupportedEncodingException: iso-latin-1-unix
at java.lang.StringCoding.decode(StringCoding.java:170)
at java.lang.String.(String.java:443)
at java.lang.String.(String.java:515)
at org.eclim.util.file.FileUtils.byteOffsetToCharOffset(FileUtils.java:94)
at org.eclim.util.file.FileUtils.byteOffsetToCharOffset(FileUtils.java:67)
at org.eclim.plugin.core.command.AbstractCommand.getOffset(AbstractCommand.java:81)
at org.eclim.plugin.jdt.command.complete.CodeCompleteCommand.execute(CodeCompleteCommand.java:72)
at org.eclim.command.Main$1.run(Main.java:98)
at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:135)
at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:3563)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3212)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2701)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2665)
at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2499)
at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:679)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:668)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:123)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:344)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:622)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:577)
at org.eclipse.equinox.launcher.Main.run(Main.java:1410)
at org.eclipse.equinox.launcher.Main.main(Main.java:1386)

How can I fix this?

Problem running eclim

Hi,

I just heard about eclim and am trying to give it a shot and encountered this error:

require(decompile)
eval-buffer(#<buffer load<3>> nil "/Users/federico/.emacs.d/emacs-eclim/eclim-java.el" nil t) ; Reading at buffer position 1091
load-with-code-conversion("/Users/federico/.emacs.d/emacs-eclim/eclim-java.el" "/Users/federico/.emacs.d/emacs-eclim/eclim-java.el" nil t)
require(eclim-java)
eval-buffer(#<buffer load<2>> nil "/Users/federico/.emacs.d/emacs-eclim/eclim.el" nil t) ; Reading at buffer position 12825
load-with-code-conversion("/Users/federico/.emacs.d/emacs-eclim/eclim.el" "/Users/federico/.emacs.d/emacs-eclim/eclim.el" nil t)
require(eclim)
eval-buffer(#<buffer load> nil "/Users/federico/.emacs" nil t) ; Reading at buffer position 12862
load-with-code-conversion("/Users/federico/.emacs" "/Users/federico/.emacs" t t)
load("~/.emacs" t t)
#[nil "^H\205\276^@ \306=\203^Q^@\307^H\310Q\202A^@ \311=\2033^@\312\307\313\314#\203#^@\315\202A^@\312\307\313\316#\203/^@\317\202A^@\315\202A^@ \320=\203=^@\321\202A^@\307^H\322Q^Z\323^S\324\n\323\211#\210^K\323=\203i^@\325\326\3$
command-line()
normal-top-level()

I am running OSX Lion, have the eclim server running without a problem, also using GNU Emacs 22.1.1. Let me know if there is any other info you need.

Thanks

Spurious temp buffers called *eclim-async...*

After working a while with emacs-eclim, I get a bunch of temp buffers called eclim-asyncN where N > 1. Usually, the eclim-async buffer automatically deleted, but it seems this does not happen all the time. Maybe emacs-eclim should have an idle function, which deletes these buffers, if they are not active anymore?

Calling eclim-complete sometimes removes the undo ability

Unfortunately I can't seem to find a small example were this behaviour occurs, but it goes like this:

  1. Do some modifications to a file
  2. Call M-x eclim-complete to complete a variable name (for example, "thisIsAVari" becomes "thisIsAVariable")
  3. Call M-x undo. The "thisIsAVariable" returns to being "thisIsAVari"
  4. Try to undo more stuff
  5. Emacs complains in the minibuffer with the message "undo-more: No further undo information"

Screencast showing the problem: http://www.megaupload.com/?d=ABGZKSZB

eclim-java-format does not revert-buffer

Upon calling eclim-java-format, the eclim/execute-command does not complete its execution path which includes a call to revert-buffer. This is because the json library signals an end-of-file error when parsing the result of eclimc's java_format command (this call returns no result).

We could change the eclim-java-format function to:
(defun eclim-java-format ()
"Format the source code of the current java source file."
(interactive)
(ignore-errors
(eclim/execute-command "java_format" "-p" "-f" ("-b" 0) ("-e" (buffer-size))))
(revert-buffer t t t))

but I'm guessing the problem can be fixed by changing the eclim--parse-result function to handle the end-of-file error.

better company-mode integration

The current company-mode integration is copied from the company-eclim.el script. This file does not use the other features from emacs-eclim and needs to be improved.

Emacs-eclim doesn't support php completion and breaks php completion in auto-complete

I have two projects in my workspace.

A. java project
B. php project

I configured emacs-eclim as mentioned in readme (global eclim mode and with auto-complete)

When I run M-x eclim-manage-projects and open java project - code completion works properly for java.

When I open php project and php file, eclimd reports:

NGSession 3: 127.0.0.1: org.eclim.command.Main exited with status 1

and auto-complete doesn't work at all.

In my opinion emacs-eclim should:

a. provide code completion taken from php-eclipse

or

b. fallback to php completion provided by auto-complete.

Actually emacs-eclim documentation should mention that it doesn't currently support code completion for php code.

Eclim documentation and Vim screenshots on eclim website shows Php completion. And it's pretty misleading and dissapointing that it doesn't work in Emacs.

Cant find ac-source-emacs-eclim-c-dot

I've followed documentation that mentions ac-source-emacs-eclim-c-dot ic cofigure auto-complete-mode section. It appears that there is no such function in master head at the moment.

Please stop bundling third-party libraries

emacs-eclim is mirrored on the Emacsmirror, which is a large up-to-date collection of Emacs packages.

As the maintainer of the mirror I am trying to resolve feature conflicts that result from one package bundling libraries from another package. I suspect in most cases these libraries were included so that users would not have to find, download and install each dependency manually.

Unfortunately bundling also has negative side-effects: if the bundled libraries are also installed separately, then it is undefined which version actually gets loaded when the respective feature is required.

Initially that isn't a big problem but in many cases upstream changes are not included or only after a long delay. This can be very confusing for users who are not aware that some of the installed packages bundle libraries which are also installed separately. In other cases bugs are fixed in the bundled versions but the fixes are never submitted to upstream.

Also now that Emacs contains the package.el package manager there is a better way to not require users to manually deal with dependencies: add the package (and when that hasn't been done yet the dependencies) to the Melpa package repository. If make is required to install your make you might want to add it to the el-get (another popular package manager) package repository instead.

Alternatively if you want to keep bundling these libraries please move them to a directory only containing bundled libraries and add the file ".nosearch" to that directory. You can then load the library using something like this:

(or (require 'bundled nil t)
    (let ((load-path
           (cons (expand-file-name "fallback-libs"
                                   (or load-file-name buffer-file-name)
                                   load-path))))
      (require 'bundled)))

Of course if your version differs from the upstream version this might not be enough in which case you should make an effort to get your changes merged upstream.

emacs-eclim bundles at least the following libraries:

  • json

Best regards,
Jonas

Auto-complete support

Hello,

It will be so great to have the eclim complete java feature integrated with auto-complete instead of company.

Do you think that it's a good idea ?

scala-search

I want to use eclim for scala development and can't use very important feature 'go to definition' which is provided by scala-search.
Is it possible to use scala-search features in emacs-eclim?

Update for upcoming eclim json responses.

Hey guys,

As suggested by @DamienCassou (ervandew/eclim#80), I've created a branch for eclim which converts all eclimd responses to json, doing away with all the crappy per command (and usually vim specific) response formats. I'd like to get these changes into eclim's master for the next release but I also don't want to cause emacs-eclim users any more headaches than are necessary.

So I'm creating this issue to track updating of emacs-eclim to utilize the new json response, and also to help coordinate with you guys on timing releases or messaging to users to minimize issues resulting from the switch.

Feature Feasability: Org-mode integration

I blindly posted the following on the [email protected] the other day. Since I could not find a mailing list for eclim-emacs, and the eclim author also gave this advice, I am asking this as a 'feature feasability issue'.

Hello to all eclim-emacs developers and users,

I find myself jumping between Eclipse and Emacs very often. I used eclim-emacs some time ago, but have settled to mainly use Eclipse, since a lot of debugging is needed ATM. Also, we are not only using Java, but occasionally GNU R and others inside Eclipse. I use Emacs org-mode for project management, documentation and todos. Now I was curious whether there are some folks that managed to integrate e.g. org-mode TODO items with Eclipse via eclim-emacs.

I am thinking along the lines of [1], but not only for Java projects. Is there someone who thought about this or even managed something similar?

Best Regards,
Michael Bach

[1] http://eclim.org/vim/java/search.html#element-search

Missing required option: p

I have set up emacs-eclim to the best of my abilities, following the instructions in the readme. After a successful start-eclimd, when I try to do eclim-complete I get this:

Debugger entered--Lisp error: (error "Missing required option: p")
  signal(error ("Missing required option: p\n"))
  error("Missing required option: p\n")
  (cond ((string-match "java.io.UnsupportedEncodingException: \\(.*\\)" result) (let ((e (match-string 1 result))) (error "Eclim doesn't know how to handle the encoding %s. You can avoid this by\nevaluating (add-to-list 'eclim--file-coding-system-mapping '(\"%s\" . \"<encoding>\"))\nwhere <encoding> is the corresponding java name for this encoding." e e))) ((string-match ".*Exception: \\(.*\\)" result) (error (match-string 1 result))) (t (error result)))
  (condition-case nil (json-read-from-string result) ((quote json-readtable-error) (cond ((string-match "java.io.UnsupportedEncodingException: \\(.*\\)" result) (let ((e (match-string 1 result))) (error "Eclim doesn't know how to handle the encoding %s. You can avoid this by\nevaluating (add-to-list 'eclim--file-coding-system-mapping '(\"%s\" . \"<encoding>\"))\nwhere <encoding> is the corresponding java name for this encoding." e e))) ((string-match ".*Exception: \\(.*\\)" result) (error (match-string 1 result))) (t (error result)))))
  (if (string-match (rx string-start (zero-or-more (any " " "\n" "  ")) string-end) result) nil (condition-case nil (json-read-from-string result) ((quote json-readtable-error) (cond ((string-match "java.io.UnsupportedEncodingException: \\(.*\\)" result) (let ((e ...)) (error "Eclim doesn't know how to handle the encoding %s. You can avoid this by\nevaluating (add-to-list 'eclim--file-coding-system-mapping '(\"%s\" . \"<encoding>\"))\nwhere <encoding> is the corresponding java name for this encoding." e e))) ((string-match ".*Exception: \\(.*\\)" result) (error (match-string 1 result))) (t (error result))))))
  eclim--parse-result("Missing required option: p\n")
  (let ((cmd (eclim--make-command args))) (when eclim-print-debug-messages (message "Executing: %s" cmd)) (eclim--parse-result (shell-command-to-string cmd)))
  eclim--call-process("java_complete" "-p" nil "-f" "AttachmentService.java" "-e" "utf-8" "-l" "standard" "-o" "1273")
  apply(eclim--call-process ("java_complete" "-p" nil "-f" "AttachmentService.java" "-e" "utf-8" "-l" "standard" "-o" "1273"))
  (let ((res (apply (quote eclim--call-process) command-line))) (funcall on-complete-fn) res)
  (lambda (command-line on-complete-fn) (let ((res (apply (quote eclim--call-process) command-line))) (funcall on-complete-fn) res))(("java_complete" "-p" nil "-f" "AttachmentService.java" "-e" "utf-8" "-l" "standard" "-o" "1273") (lambda (&rest --cl-rest--) (apply (quote (lambda (G30676 G30677 G30678) (if (symbol-value G30677) (if (and (file-exists-p ...) attrs-before (not ...)) (revert-buffer t t t))))) (quote --check--) (quote --sync--) (quote --expargs--) --cl-rest--)))
  funcall((lambda (command-line on-complete-fn) (let ((res (apply (quote eclim--call-process) command-line))) (funcall on-complete-fn) res)) ("java_complete" "-p" nil "-f" "AttachmentService.java" "-e" "utf-8" "-l" "standard" "-o" "1273") (lambda (&rest --cl-rest--) (apply (quote (lambda (G30676 G30677 G30678) (if (symbol-value G30677) (if (and (file-exists-p ...) attrs-before (not ...)) (revert-buffer t t t))))) (quote --check--) (quote --sync--) (quote --expargs--) --cl-rest--)))
  (let ((attrs-before (if (symbol-value --cl-sync--) (file-attributes (buffer-file-name)) nil))) (funcall executor (cons cmd (symbol-value --cl-expargs--)) (list (quote lambda) (quote (&rest --cl-rest--)) (list (quote apply) (list (quote quote) (function (lambda (G30676 G30677 G30678) (if ... ...)))) (list (quote quote) --cl-check--) (list (quote quote) --cl-sync--) (list (quote quote) --cl-expargs--) (quote --cl-rest--)))))
  (progn (if (symbol-value --cl-sync--) (eclim/java-src-update)) (if (symbol-value --cl-check--) (condition-case nil (eclim--check-project (if (listp (symbol-value --cl-check--)) (eval (second (symbol-value --cl-check--))) (eclim--project-name))) (error nil))) (let ((attrs-before (if (symbol-value --cl-sync--) (file-attributes (buffer-file-name)) nil))) (funcall executor (cons cmd (symbol-value --cl-expargs--)) (list (quote lambda) (quote (&rest --cl-rest--)) (list (quote apply) (list (quote quote) (function (lambda ... ...))) (list (quote quote) --cl-check--) (list (quote quote) --cl-sync--) (list (quote quote) --cl-expargs--) (quote --cl-rest--))))))
  (let ((--cl-check-- (make-symbol "--check--"))) (set --cl-check-- (eclim--args-contains args (quote ("-p")))) (progn (if (symbol-value --cl-sync--) (eclim/java-src-update)) (if (symbol-value --cl-check--) (condition-case nil (eclim--check-project (if (listp (symbol-value --cl-check--)) (eval (second ...)) (eclim--project-name))) (error nil))) (let ((attrs-before (if (symbol-value --cl-sync--) (file-attributes (buffer-file-name)) nil))) (funcall executor (cons cmd (symbol-value --cl-expargs--)) (list (quote lambda) (quote (&rest --cl-rest--)) (list (quote apply) (list (quote quote) (function ...)) (list (quote quote) --cl-check--) (list (quote quote) --cl-sync--) (list (quote quote) --cl-expargs--) (quote --cl-rest--)))))))
  (let ((--cl-sync-- (make-symbol "--sync--"))) (set --cl-sync-- (eclim--args-contains args (quote ("-f" "-o")))) (let ((--cl-check-- (make-symbol "--check--"))) (set --cl-check-- (eclim--args-contains args (quote ("-p")))) (progn (if (symbol-value --cl-sync--) (eclim/java-src-update)) (if (symbol-value --cl-check--) (condition-case nil (eclim--check-project (if (listp ...) (eval ...) (eclim--project-name))) (error nil))) (let ((attrs-before (if (symbol-value --cl-sync--) (file-attributes ...) nil))) (funcall executor (cons cmd (symbol-value --cl-expargs--)) (list (quote lambda) (quote (&rest --cl-rest--)) (list (quote apply) (list ... ...) (list ... --cl-check--) (list ... --cl-sync--) (list ... --cl-expargs--) (quote --cl-rest--))))))))
  (let ((--cl-expargs-- (make-symbol "--expargs--"))) (setf (symbol-value --cl-expargs--) (eclim--expand-args args)) (let ((--cl-sync-- (make-symbol "--sync--"))) (set --cl-sync-- (eclim--args-contains args (quote ("-f" "-o")))) (let ((--cl-check-- (make-symbol "--check--"))) (set --cl-check-- (eclim--args-contains args (quote ("-p")))) (progn (if (symbol-value --cl-sync--) (eclim/java-src-update)) (if (symbol-value --cl-check--) (condition-case nil (eclim--check-project (if ... ... ...)) (error nil))) (let ((attrs-before (if ... ... nil))) (funcall executor (cons cmd (symbol-value --cl-expargs--)) (list (quote lambda) (quote ...) (list ... ... ... ... ... ...))))))))
  (lexical-let ((expargs (eclim--expand-args args))) (lexical-let ((sync (eclim--args-contains args (quote ("-f" "-o"))))) (lexical-let ((check (eclim--args-contains args (quote ("-p"))))) (when sync (eclim/java-src-update)) (when check (ignore-errors (eclim--check-project (if (listp check) (eval ...) (eclim--project-name))))) (let ((attrs-before (if sync (file-attributes ...) nil))) (funcall executor (cons cmd expargs) (lambda nil (when sync (when ... ...))))))))
  (lexical-let* ((expargs (eclim--expand-args args)) (sync (eclim--args-contains args (quote ("-f" "-o")))) (check (eclim--args-contains args (quote ("-p"))))) (when sync (eclim/java-src-update)) (when check (ignore-errors (eclim--check-project (if (listp check) (eval (second check)) (eclim--project-name))))) (let ((attrs-before (if sync (file-attributes (buffer-file-name)) nil))) (funcall executor (cons cmd expargs) (lambda nil (when sync (when (and (file-exists-p ...) attrs-before (not ...)) (revert-buffer t t t)))))))
  eclim--execute-command-internal((lambda (command-line on-complete-fn) (let ((res (apply (quote eclim--call-process) command-line))) (funcall on-complete-fn) res)) "java_complete" ("-p" "-f" "-e" ("-l" "standard") "-o"))
  (eclim/execute-command "java_complete" "-p" "-f" "-e" ("-l" "standard") "-o")
  (unwind-protect (eclim/execute-command "java_complete" "-p" "-f" "-e" ("-l" "standard") "-o") (setq eclim--is-completing nil))
  eclim/java-complete()
  (assoc-default (quote completions) (eclim/java-complete))
  (mapcar (quote second) (assoc-default (quote completions) (eclim/java-complete)))
  (mapcar (quote cdr) (mapcar (quote second) (assoc-default (quote completions) (eclim/java-complete))))
  (eclim--java-complete-internal (mapcar (quote cdr) (mapcar (quote second) (assoc-default (quote completions) (eclim/java-complete)))))
  eclim-java-complete()
  eclim-complete()
  call-interactively(eclim-complete record nil)
  command-execute(eclim-complete record)
  (progn (setq prefix-arg current-prefix-arg) (command-execute chosen-item (quote record)))
  (unwind-protect (progn (setq prefix-arg current-prefix-arg) (command-execute chosen-item (quote record))) (smex-rank chosen-item) (smex-show-key-advice chosen-item) (run-at-time 0.01 nil (lambda (cmd) (setq last-repeatable-command cmd)) chosen-item))
  (if smex-custom-action (let ((action smex-custom-action)) (setq smex-custom-action nil) (funcall action chosen-item)) (unwind-protect (progn (setq prefix-arg current-prefix-arg) (command-execute chosen-item (quote record))) (smex-rank chosen-item) (smex-show-key-advice chosen-item) (run-at-time 0.01 nil (lambda (cmd) (setq last-repeatable-command cmd)) chosen-item)))
  (let ((chosen-item (intern (smex-completing-read commands initial-input)))) (if smex-custom-action (let ((action smex-custom-action)) (setq smex-custom-action nil) (funcall action chosen-item)) (unwind-protect (progn (setq prefix-arg current-prefix-arg) (command-execute chosen-item (quote record))) (smex-rank chosen-item) (smex-show-key-advice chosen-item) (run-at-time 0.01 nil (lambda (cmd) (setq last-repeatable-command cmd)) chosen-item))))
  smex-read-and-run(("toggle-debug-on-error" "eclim-complete" "start-eclimd" "package-list-packages" "js2-mode" "er/mark-comment" "html-mode" "camelize-buffer" "flush-lines" "align-regexp" "replace-string" "slime-js-jack-in-browser" "raise-sexp" "zoom-frm-in" "eldoc-mode" "nrepl-jack-in" "package-install" "wgrep-save-all-buffers" "edebug-defun" "multiple-cursors-mode" "clojure-jack-in" "cua-mode" "transpose-params" "pp-macroexpand-last-sexp" "eshell" "persp-mode" "keep-lines" "yas/new-snippet" "change-number-at-point" "fci-mode" "delete-selection-mode" "ansi-term" "change-inner" "undo-tree-mode" "lisp-interaction-mode" "slime-js-jack-in-node" "remove-js2-mark-overlay" "kmacro-name-last-macro" "bury-buffer" "ispell-word" "ediff-buffers" "slime-connect" "insert-kbd-macro" "yas/visit-snippet-file" "clojure-test-mode" "toggle-window-split" "toggle-assert-refute" "nxml-mode" "emacs-version" "byte-compile-file" ...))
  (if (smex-already-running) (smex-update-and-rerun) (and smex-auto-update (smex-detect-new-commands) (smex-update)) (smex-read-and-run smex-ido-cache))
  smex()
  call-interactively(smex nil nil)

Calling eclim-complete eats the last character that was on that line

How to reproduce the error:

  1. Start emacs
    $ emacs -Q

  2. Start eclimd
    $ ~/path-eclim-folder/eclimd

  3. Load the eclim-emacs configurations
    ;; ;; Eclim emacs
    ;; (add-to-list 'load-path (expand-file-name "/src/git/emacs-eclim/"))
    ;; ;; only add the vendor path when you want to use the libraries provided with emacs-eclim
    ;; (add-to-list 'load-path (expand-file-name "
    /src/git/emacs-eclim/vendor"))
    ;; (require 'eclim)

    ;; (setq eclim-auto-save t)
    ;; (setq eclim-executable "~/src/eclim/eclipse/eclim")
    ;; (global-eclim-mode)

  4. Create folder ~/foo
    $ mkdir ~/foo

  5. Call M-x eclim-project-create
    Name: foo
    Project Directory: ~/foo
    Type: java

  6. Call M-x eclim-project-goto
    Project: foo
    Find file: ~/foo/src/Main.java

  7. Call M-x eclim-mode

  8. Write the following in the buffer
    public class Main {
    public static void main(String[] args) {
    System.out.pri

  9. With the cursor in front of "System.out.pri" call M-x eclim-complete

  10. Notice that the line became "System.outprint" instead of "System.out.print"

eclim-java-complete results elisp error

When 'eclim-java-complete' was issued on unknown class (which is available in classpath), eclim-java-complete should complete it (or suggest) and add required 'import' if needed. However, when this command was run, it will write:

Wrong type argument: lisp, [((type . "t") (info . - ) (menu . ...))]

Here I replaced actual class with and the package with .

Thanks.

Imports failing

I can’t seem to get imports to work, and can’t find any resolution to these errors.

When I invoke eclim-java-import, I get the error “Unrecognized option: -n”.

When I invoke eclim-java-import-missing, I get the error “No command ‘java_import_order’ found.”

Using GNU Emacs 24.2.1
Eclim version 2.2.2

void-function ac-define-source

get the following error when trying to load:

Debugger entered--Lisp error: (void-function ac-define-source)
  (ac-define-source emacs-eclim (quote (... ... ... ... ... ... ... ... ...)))
  eval-buffer(#<buffer  *load*> nil "MY_PATH/emacs-eclim-20120422/ac-emacs-eclim-source.el" nil t)  ; Reading at buffer position 3625
  (let ((load-file-name fullname) (set-auto-coding-for-load t) (inhibit-file-name-operation nil)) (with-current-buffer buffer (set-buffer-multibyte t) (let ... ...) (if ... ...) (set-buffer-modified-p nil)) (eval-buffer buffer nil (if purify-flag file fullname) nil t))
  (unwind-protect (let (... ... ...) (with-current-buffer buffer ... ... ... ...) (eval-buffer buffer nil ... nil t)) (let (kill-buffer-hook kill-buffer-query-functions) (kill-buffer buffer)))
  (let* ((buffer ...) (load-in-progress t) (source ...)) (unless nomessage (if source ... ...)) (when purify-flag (push ... preloaded-file-list)) (unwind-protect (let ... ... ...) (let ... ...)) (do-after-load-evaluation fullname) (unless (or nomessage noninteractive) (if source ... ...)) t)
  (if (null (file-readable-p fullname)) (and (null noerror) (signal ... ...)) (let* (... ... ...) (unless nomessage ...) (when purify-flag ...) (unwind-protect ... ...) (do-after-load-evaluation fullname) (unless ... ...) t))
  load-with-code-conversion("MY_PATH/emacs-eclim-20120422/ac-emacs-eclim-source.el" "MY_PATH/emacs-eclim-20120422/ac-emacs-eclim-source.el" nil nil)
  load("MY_PATH/emacs-eclim-20120422/ac-emacs-eclim-source.el" nil nil t)
  load-file("MY_PATH/emacs-eclim-20120422/ac-emacs-eclim-source.el")
  (if ask (when (y-or-n-p ...) (load-file file)) (load-file file))
  (let ((file ...)) (when (file-exists-p ...) (if ... ... ... ...)) (if ask (when ... ...) (load-file file)))
  (while files (let (...) (when ... ...) (if ask ... ...)) (setq files (cdr files)))
  (let ((files ...)) (while files (let ... ... ...) (setq files ...)))
  load-this-directory("MY_PATH/emacs-eclim-20120422/")
  eval((load-this-directory "MY_PATH/emacs-eclim-20120422/"))
  eval-last-sexp-1(nil)
  eval-last-sexp(nil)
  call-interactively(eval-last-sexp nil nil)

;;;;;;;;
Thanks!

Andreas

http://launchpad.net/python-mode
http://launchpad.net/s-x-emacs-werkstatt/

Symbol's function definition is void: find

Hi.

I'm no emacs expert, so maybe this is just "user error", but here goes:

When I start a fresh emacs and issue M-x eclim-manage-projects, I get the message Symbol's function definition is void: find.

After looking around for a while, I realized that various calls like (find ...) are all over eclim.el, and indeed that function wasn't defined. But I found a defun for it here:

hobbes@metalbaby:~/src/emacs$ find . -name *.el -exec grep -H  "^(defun find (" {} +
./emacs24-24.2+1/lisp/emacs-lisp/cl-seq.el:(defun find (cl-item cl-seq &rest cl-keys)

...So, long story short, I had to (require 'cl), then eclim-manage-projects works.

So maybe emacs-eclim should call (require 'cl) on its own. Is that how that works?

Now, I have read that it's not popular to make a package depend on cl at runtime, but it's accepted to make it depend on it at compile time... And indeed I seem to recall cl being loaded during compile when I first installed emacs-eclim. Personally, I don't mind having cl loaded, so I consider my problem solved, but, I just thought that you might want to know about this.

Cheers,
--Dave

Windows: eclim/project-list fails with path lookup

I am running emacs 24.0.93 and latest emacs-eclim as of today.

When I invoke `eclim-manage-projects', I get the following backtrace:

Debugger entered--Lisp error: (wrong-type-argument stringp nil)
string-width(nil)
truncate-string-to-width(nil 30 0 nil t)
eclim--insert-project(("'-command' is not recognized as an internal or external command,"))
eclim--project-buffer-refresh()
eclim--project-mode-init()
eclim-manage-projects()

I looked into the source and found the `eclim/project-list' returning the (("'-command' is not recognized as an internal or external command,")) portion. Now I am quite certain that this has got something to do with the fact that I am operating on Windows. I also do have cygwin with the common unix tools installed.

Any ideas on resolving / fixing?

Thanks in advance!
Michael Bach

Here's a simple implementation for automatic corrections for Java

Sorry, that it's not in patch format, but it's quite simple, only one function and GIT is not yet properly set up on my system (I use Mercurial).

It simply adds a binding 'c' to the problems buffer, so if you press c on a problem and it is a Java problem then it lists the possible corrections offered by Eclipse and you can simply apply any of them by pressing Enter.

It worked well in the few tests I've done with it:

(define-key eclim-problems-mode-map (kbd "c") 'eclim-problems-correct)

(defun eclim-problems-correct ()
  (interactive)
  (let* ((p (aref (eclim--problems-filtered) (1- (line-number-at-pos))))
         (filename (cdr (assoc 'filename p))))
    (if (not (string-match "\.java$" filename))
        (error "Not a Java file. Corrections are currently supported only for Java.")

      (eclim-problems-open-current)
      (message "Getting corrections...")

      (let ((project eclim--problems-project)
            (line (cdr (assoc 'line p)))
            (column (cdr (assoc 'column p))))

        (eclim/with-results correction-info ("java_correct"
                                             ("-p" project)
                                             "-f"
                                             ("-l" line)
                                             ("-o" column))

          (let ((window-config (current-window-configuration))
                (corrections (cdr (assoc 'corrections correction-info))))

            (pop-to-buffer "*corrections*")
            (erase-buffer)

            (insert "Problem: " (cdr (assoc 'message correction-info)) "\n\n")

            (dotimes (i (length corrections))
              (let ((correction (aref corrections i)))
                (insert "------------------------------------------------------------\n"
                        "Correction "
                        (int-to-string (cdr (assoc 'index correction)))
                        ": " (cdr (assoc 'description correction)) "\n\n"
                        "Preview:\n\n"
                        (cdr (assoc 'preview correction))
                        "\n\n")))

            (make-local-variable 'eclim-corrections-previous-window-config)
            (setq eclim-corrections-previous-window-config window-config)

            (make-local-variable 'eclim-correction-command-info)
            (setq eclim-correction-command-info (list 'project project
                                                      'line line
                                                      'column column))


            (local-set-key (kbd "<RET>")
                           (lambda ()
                             (interactive)
                             (save-excursion
                               (if (not (re-search-backward "^Correction \\([0-9]+\\):" nil t))
                                   (message "No correction here.")

                                 (let ((index (string-to-int (match-string 1)))
                                       (info eclim-correction-command-info))
                                   (set-window-configuration eclim-corrections-previous-window-config)

                                   (message "Applying correction %s" index)

                                   (eclim/with-results correction-info
                                     ("java_correct"
                                      ("-p" (plist-get info 'project))
                                      "-f"
                                      ("-l" (plist-get info 'line))
                                      ("-o" (plist-get info 'column))
                                      ("-a" index))))))))

            (local-set-key "q"
                           (lambda ()
                             (interactive)
                             (set-window-configuration eclim-corrections-previous-window-config)))

            (if (eq (length corrections) 0)
                (insert "No automatic corrections found. Sorry.")

              (message "Choose a correction by pressing Enter on it or press q to quit"))

            (goto-char (point-min))))))))

eclim/project-list error

Checkout from today and using emacs 24 dev.

When doing M-x eclim-manage-projects, I get this error backtrace:

Debugger entered--Lisp error: (void-variable res)
eclim/project-list()
eclim--project-buffer-refresh()
eclim--project-mode-init()
eclim-manage-projects()
call-interactively(eclim-manage-projects t nil)
execute-extended-command(nil)
call-interactively(execute-extended-command nil nil)
recursive-edit()

I then looked into eclim/project-list() and saw res was not let'ed or otherwise defined.

Am I missing something obvious?

Eclim completion doesn't work properly in some cases

import java.util.ArrayList;

public class NuevaClase {

    public NuevaClase() {
        ArrayList a;

        a.get(1);
        a.remove(1);

        //áéíóú@ł€¶ŧ←
        //Completion doesn't work properly below this line

        a.
    }
}

(eclim--current-coding) returns "utf-8"

describe-current-coding-system returns

Coding system for saving this buffer:
U -- utf-8-unix (alias: mule-utf-8-unix)

Default coding system (for new files):
U -- utf-8-unix (alias: mule-utf-8-unix)

Coding system for keyboard input:
= -- no-conversion (alias: binary)

Coding system for terminal output:
nil
Coding system for inter-client cut and paste:
nil
Defaults for subprocess I/O:
decoding: U -- utf-8-unix (alias: mule-utf-8-unix)

encoding: U -- utf-8-unix (alias: mule-utf-8-unix)

btw, the first comment is //áéíóú@ł€¶ŧ←
Github formatter replaces it with weirder symbols.

Contact me if more info is needed.

Emacs can't be exited correctly when forgetting to launch the eclimd

When I forget to launch eclimd and call emacs-manage-projects I can't exit emacs without killing the process. I think the issue is with eclim--error-buffer setting the error buffer read only. If I comment out that line, I can kill the buffer, and exit emacs normally. Since I'm sure I'm not the only person who is forgetful about starting eclim in eclipse, it might make more sense to not make Eclim errors read only.

eclim-problem-correct doesn't work with get/set solution

Hi,

eclim-problem-correct is excellent! I use it in the java buffers, just as I would fix my code in IDEA or Eclipse. Who would have thought we could do this in Emacs. Amazing! Unfortunately, it doesn't work for the get/set generation. There's no error, but also no insertion of get/set methods.

To reproduce this, have an unused member field, say:

public class App {
   private String name;
}

Then do eclim-problems-correct and choose 1 (which is Correction 1: Create getter and setter for 'name'...). Nothing happens. All other corrections I have tried work.

eclim: 2.2.5.67
eclim-emacs: from master @ 2013-03-27
emacs: GNU Emacs 24.3.50.1 (x86_64-pc-linux-gnu, GTK+ Version 3.4.2) of 2013-03-25 on dex, modified by Debian

Every time I open a file of any sorts, eclim tries to ping the server

Hi,

I just started playing with this package and I think it is awesome!

I have everything pretty much configured the way I want, the only thing that is slightly annoying is that every time I try to open/save a file, or even when I exit emacs something in eclim.el is initiating a ping and it lags (a few seconds) before I can actually see the file to edit it when I open it up.

I see these messages in the messages buffer:

Executing: c:/Sun/eclipse/plugins/org.eclim_1.7.6/bin/eclim -command ping
Executing: c:/Sun/eclipse/plugins/org.eclim_1.7.6/bin/eclim -command project_list

I also see the eclim--running-p function where I think this is coming from, but I can't see the project_list... my lisp needs work.

the following is in my configuration file:

(add-to-list 'load-path (concat dotfiles-dir "plugins/emacs-eclim"))
(add-to-list 'load-path (concat dotfiles-dir "plugins/emacs-eclim/vendor"))

(require 'eclim)
(require 'eclimd)

(setq eclim-auto-save t)
(global-eclim-mode)
(setq eclim-print-debug-messages t)

Is there any way to only enable it to ping when I am actually in eclim-mode? I tried commenting out (global-eclim-mode) but that didn't work.

Thanks!

eclipse project management

Emacs-eclim needs to take full advantage of the eclim possibilities to manage eclipse projects. It should be possible to create, remove and open / close projects from within emacs. In addition there must be an overall project functionality which allows the user to tell emacs on which project he is working on and then the eclim commands should be scoped correctly.

error in eclim-java-import-missing

Calling eclim-java-import-missing fails with an error:
if: Search failed: "package (.*?);"
(probably from eclim--java-current-package)

It also removes all existing imports.

eclim-java-import-missing throws an error on emacs24

Starting with the following basic file missing include for IOExceptoin:

import java.io.File;
import java.util.*;

public class EclimImportTest {

public static void main(String[] args) throws IOException {

}

}

when i run eclim-java-import-missing, i get the following error:
Debugger entered--Lisp error: (args-out-of-range "java.io.File" 0 17)
substring-no-properties("java.io.File" 0 17)
(equal (substring-no-properties string 0 (string-width prefix)) prefix)
string-startswith-p("java.io.File" "asposewobfuscated")
cl-position("java.io.File" ("android" "antenna" "antlr" "ar" "asposewobfuscated" "asquare" "atg" "au" "beaver" "bibtex" "bmsi" "bsh" "ccl" "cern" "ChartDirector" "checkers" "com" "COM" "common" "contribs" "corejava" "cryptix" "cybervillains" "dalvik" "danbikel" "de" "EDU" "eg" "eu" "examples" "fat" "fit" "fitlibrary" "fmpp" "freemarker" "gnu" "groovy" "groovyjarjarantlr" "groovyjarjarasm" "hak" "hep" "ie" "imageinfo" "info" "it" "jal" "Jama" "japa" "japacheckers" "jas" ...) 0 nil nil)
position("java.io.File" ("android" "antenna" "antlr" "ar" "asposewobfuscated" "asquare" "atg" "au" "beaver" "bibtex" "bmsi" "bsh" "ccl" "cern" "ChartDirector" "checkers" "com" "COM" "common" "contribs" "corejava" "cryptix" "cybervillains" "dalvik" "danbikel" "de" "EDU" "eg" "eu" "examples" "fat" "fit" "fitlibrary" "fmpp" "freemarker" "gnu" "groovy" "groovyjarjarantlr" "groovyjarjarasm" "hak" "hep" "ie" "imageinfo" "info" "it" "jal" "Jama" "japa" "japacheckers" "jas" ...) :test string-startswith-p)
apply(position "java.io.File" ("android" "antenna" "antlr" "ar" "asposewobfuscated" "asquare" "atg" "au" "beaver" "bibtex" "bmsi" "bsh" "ccl" "cern" "ChartDirector" "checkers" "com" "COM" "common" "contribs" "corejava" "cryptix" "cybervillains" "dalvik" "danbikel" "de" "EDU" "eg" "eu" "examples" "fat" "fit" "fitlibrary" "fmpp" "freemarker" "gnu" "groovy" "groovyjarjarantlr" "groovyjarjarasm" "hak" "hep" "ie" "imageinfo" "info" "it" "jal" "Jama" "japa" "japacheckers" "jas" ...) (:test string-startswith-p))
find("java.io.File" ("android" "antenna" "antlr" "ar" "asposewobfuscated" "asquare" "atg" "au" "beaver" "bibtex" "bmsi" "bsh" "ccl" "cern" "ChartDirector" "checkers" "com" "COM" "common" "contribs" "corejava" "cryptix" "cybervillains" "dalvik" "danbikel" "de" "EDU" "eg" "eu" "examples" "fat" "fit" "fitlibrary" "fmpp" "freemarker" "gnu" "groovy" "groovyjarjarantlr" "groovyjarjarasm" "hak" "hep" "ie" "imageinfo" "info" "it" "jal" "Jama" "japa" "japacheckers" "jas" ...) :test string-startswith-p)
(or (find imp non-ordered :test (function string-startswith-p)) :default)
(setq key (or (find imp non-ordered :test (function string-startswith-p)) :default))
(while (consp --cl-var--) (setq imp (car --cl-var--)) (setq key (or (find imp non-ordered :test (function string-startswith-p)) :default)) (puthash key (cons imp (gethash key sorted)) sorted) (setq --cl-var-- (cdr --cl-var--)))
(let* ((--cl-var-- (sort imports (function string<))) (imp nil) (key nil)) (while (consp --cl-var--) (setq imp (car --cl-var--)) (setq key (or (find imp non-ordered :test (function string-startswith-p)) :default)) (puthash key (cons imp (gethash key sorted)) sorted) (setq --cl-var-- (cdr --cl-var--))) nil)
(catch (quote --cl-block-nil--) (let* ((--cl-var-- (sort imports (function string<))) (imp nil) (key nil)) (while (consp --cl-var--) (setq imp (car --cl-var--)) (setq key (or (find imp non-ordered :test (function string-startswith-p)) :default)) (puthash key (cons imp (gethash key sorted)) sorted) (setq --cl-var-- (cdr --cl-var--))) nil))
(cl-block-wrapper (catch (quote --cl-block-nil--) (let* ((--cl-var-- (sort imports (function string<))) (imp nil) (key nil)) (while (consp --cl-var--) (setq imp (car --cl-var--)) (setq key (or (find imp non-ordered :test (function string-startswith-p)) :default)) (puthash key (cons imp (gethash key sorted)) sorted) (setq --cl-var-- (cdr --cl-var--))) nil)))
(block nil (let* ((--cl-var-- (sort imports (function string<))) (imp nil) (key nil)) (while (consp --cl-var--) (setq imp (car --cl-var--)) (setq key (or (find imp non-ordered :test (function string-startswith-p)) :default)) (puthash key (cons imp (gethash key sorted)) sorted) (setq --cl-var-- (cdr --cl-var--))) nil))
(loop for imp in (sort imports (function string<)) for key = (or (find imp non-ordered :test (function string-startswith-p)) :default) do (puthash key (cons imp (gethash key sorted)) sorted))
(let* ((non-ordered (loop for a in imports-order for r = (cdr imports-order) then (cdr r) while (string< a (car r)) finally return r)) (sorted (make-hash-table))) (loop for imp in (sort imports (function string<)) for key = (or (find imp non-ordered :test (function string-startswith-p)) :default) do (puthash key (cons imp (gethash key sorted)) sorted)) (remove-duplicates (loop for key in (cons :default non-ordered) append (reverse (gethash key sorted))) :test (function string=)))
eclim--java-sort-imports(("java.util.") ("com.google" "android" "antenna" "antlr" "ar" "asposewobfuscated" "asquare" "atg" "au" "beaver" "bibtex" "bmsi" "bsh" "ccl" "cern" "ChartDirector" "checkers" "com" "COM" "common" "contribs" "corejava" "cryptix" "cybervillains" "dalvik" "danbikel" "de" "EDU" "eg" "eu" "examples" "fat" "fit" "fitlibrary" "fmpp" "freemarker" "gnu" "groovy" "groovyjarjarantlr" "groovyjarjarasm" "hak" "hep" "ie" "imageinfo" "info" "it" "jal" "Jama" "japa" "japacheckers" ...))
(write-imports (eclim--java-sort-imports imports imports-order))
(let ((imports (remove-if (function eclim--java-ignore-import-p) (remove-if (lambda (x) (member x unused-imports)) (append (eclim--java-extract-imports) additional-imports))))) (write-imports (eclim--java-sort-imports imports imports-order)))
(progn (fset (quote write-imports) (function
(lambda (imports) (block write-imports (loop for imp in imports for last-import-first-part = nil then first-part for first-part = (first (eclim--java-package-components imp)) do (progn (unless ... ...) (insert ...))))))) (let ((imports (remove-if (function eclim--java-ignore-import-p) (remove-if (lambda (x) (member x unused-imports)) (append (eclim--java-extract-imports) additional-imports))))) (write-imports (eclim--java-sort-imports imports imports-order))))
(unwind-protect (progn (fset (quote write-imports) (function* (lambda (imports) (block write-imports (loop for imp in imports for last-import-first-part = nil then first-part for first-part = (first ...) do (progn ... ...)))))) (let ((imports (remove-if (function eclim--java-ignore-import-p) (remove-if (lambda ... ...) (append ... additional-imports))))) (write-imports (eclim--java-sort-imports imports imports-order)))) (if --cl-letf-bound-- (fset (quote write-imports) --cl-letf-save--) (fmakunbound (quote write-imports))))
(let* ((--cl-letf-bound-- (fboundp (quote write-imports))) (--cl-letf-save-- (and --cl-letf-bound-- (symbol-function (quote write-imports))))) (unwind-protect (progn (fset (quote write-imports) (function* (lambda (imports) (block write-imports (loop for imp in imports for last-import-first-part = nil then first-part for first-part = ... do ...))))) (let ((imports (remove-if (function eclim--java-ignore-import-p) (remove-if ... ...)))) (write-imports (eclim--java-sort-imports imports imports-order)))) (if --cl-letf-bound-- (fset (quote write-imports) --cl-letf-save--) (fmakunbound (quote write-imports)))))
(letf (((symbol-function (quote write-imports)) (function* (lambda (imports) (block write-imports (loop for imp in imports for last-import-first-part = nil then first-part for first-part = (first ...) do (progn ... ...))))))) (let ((imports (remove-if (function eclim--java-ignore-import-p) (remove-if (lambda (x) (member x unused-imports)) (append (eclim--java-extract-imports) additional-imports))))) (write-imports (eclim--java-sort-imports imports imports-order))))
(letf* (((symbol-function (quote write-imports)) (function* (lambda (imports) (block write-imports (loop for imp in imports for last-import-first-part = nil then first-part for first-part = (first ...) do (progn ... ...))))))) (let ((imports (remove-if (function eclim--java-ignore-import-p) (remove-if (lambda (x) (member x unused-imports)) (append (eclim--java-extract-imports) additional-imports))))) (write-imports (eclim--java-sort-imports imports imports-order))))
(flet ((write-imports (imports) (loop for imp in imports for last-import-first-part = nil then first-part for first-part = (first (eclim--java-package-components imp)) do (progn (unless (equal last-import-first-part first-part) (newline)) (insert (format "import %s;\n" imp)))))) (let ((imports (remove-if (function eclim--java-ignore-import-p) (remove-if (lambda (x) (member x unused-imports)) (append (eclim--java-extract-imports) additional-imports))))) (write-imports (eclim--java-sort-imports imports imports-order))))
(save-excursion (flet ((write-imports (imports) (loop for imp in imports for last-import-first-part = nil then first-part for first-part = (first (eclim--java-package-components imp)) do (progn (unless (equal last-import-first-part first-part) (newline)) (insert (format "import %s;\n" imp)))))) (let ((imports (remove-if (function eclim--java-ignore-import-p) (remove-if (lambda ... ...) (append ... additional-imports))))) (write-imports (eclim--java-sort-imports imports imports-order)))))
eclim--java-organize-imports(("com.google" "android" "antenna" "antlr" "ar" "asposewobfuscated" "asquare" "atg" "au" "beaver" "bibtex" "bmsi" "bsh" "ccl" "cern" "ChartDirector" "checkers" "com" "COM" "common" "contribs" "corejava" "cryptix" "cybervillains" "dalvik" "danbikel" "de" "EDU" "eg" "eu" "examples" "fat" "fit" "fitlibrary" "fmpp" "freemarker" "gnu" "groovy" "groovyjarjarantlr" "groovyjarjarasm" "hak" "hep" "ie" "imageinfo" "info" "it" "jal" "Jama" "japa" "japacheckers" ...) ("java.io.IOException" "java.util."))
(progn (eclim--java-organize-imports imports-order (list (if (string-endswith-p import type) import (concat import "." type)))))
(if import (progn (eclim--java-organize-imports imports-order (list (if (string-endswith-p import type) import (concat import "." type))))))
(when import (eclim--java-organize-imports imports-order (list (if (string-endswith-p import type) import (concat import "." type)))))
(let
((candidates (append (cdr (assoc (quote imports) unused)) nil)) (type (cdr (assoc (quote type) unused))) (import (if (= 1 (length candidates)) (car candidates) (eclim--completing-read (concat "Missing type '" type "'") candidates)))) (when import (eclim--java-organize-imports imports-order (list (if (string-endswith-p import type) import (concat import "." type))))))
(while (< (setq --cl-idx-- (1+ --cl-idx--)) (length --cl-vec--)) (setq unused (aref --cl-vec-- --cl-idx--)) (let* ((candidates (append (cdr (assoc (quote imports) unused)) nil)) (type (cdr (assoc (quote type) unused))) (import (if (= 1 (length candidates)) (car candidates) (eclim--completing-read (concat "Missing type '" type "'") candidates)))) (when import (eclim--java-organize-imports imports-order (list (if (string-endswith-p import type) import (concat import "." type)))))))
(let* ((--cl-vec-- (json-read-from-string (replace-regexp-in-string "'" """ (first (eclim/execute-command "java_import_missing" "-p" "-f"))))) (--cl-idx-- -1) (unused nil)) (while (< (setq --cl-idx-- (1+ --cl-idx--)) (length --cl-vec--)) (setq unused (aref --cl-vec-- --cl-idx--)) (let* ((candidates (append (cdr (assoc ... unused)) nil)) (type (cdr (assoc (quote type) unused))) (import (if (= 1 (length candidates)) (car candidates) (eclim--completing-read (concat "Missing type '" type "'") candidates)))) (when import (eclim--java-organize-imports imports-order (list (if (string-endswith-p import type) import (concat import "." type))))))) nil)
(catch (quote --cl-block-nil--) (let* ((--cl-vec-- (json-read-from-string (replace-regexp-in-string "'" """ (first (eclim/execute-command "java_import_missing" "-p" "-f"))))) (--cl-idx-- -1) (unused nil)) (while (< (setq --cl-idx-- (1+ --cl-idx--)) (length --cl-vec--)) (setq unused (aref --cl-vec-- --cl-idx--)) (let* ((candidates (append (cdr ...) nil)) (type (cdr (assoc ... unused))) (import (if (= 1 ...) (car candidates) (eclim--completing-read ... candidates)))) (when import (eclim--java-organize-imports imports-order (list (if ... import ...)))))) nil))
(cl-block-wrapper (catch (quote --cl-block-nil--) (let* ((--cl-vec-- (json-read-from-string (replace-regexp-in-string "'" """ (first ...)))) (--cl-idx-- -1) (unused nil)) (while (< (setq --cl-idx-- (1+ --cl-idx--)) (length --cl-vec--)) (setq unused (aref --cl-vec-- --cl-idx--)) (let* ((candidates (append ... nil)) (type (cdr ...)) (import (if ... ... ...))) (when import (eclim--java-organize-imports imports-order (list ...))))) nil)))
(block nil (let* ((--cl-vec-- (json-read-from-string (replace-regexp-in-string "'" """ (first (eclim/execute-command "java_import_missing" "-p" "-f"))))) (--cl-idx-- -1) (unused nil)) (while (< (setq --cl-idx-- (1+ --cl-idx--)) (length --cl-vec--)) (setq unused (aref --cl-vec-- --cl-idx--)) (let* ((candidates (append (cdr ...) nil)) (type (cdr (assoc ... unused))) (import (if (= 1 ...) (car candidates) (eclim--completing-read ... candidates)))) (when import (eclim--java-organize-imports imports-order (list (if ... import ...)))))) nil))
(loop for unused across (json-read-from-string (replace-regexp-in-string "'" """ (first (eclim/execute-command "java_import_missing" "-p" "-f")))) do (let* ((candidates (append (cdr (assoc (quote imports) unused)) nil)) (type (cdr (assoc (quote type) unused))) (import (if (= 1 (length candidates)) (car candidates) (eclim--completing-read (concat "Missing type '" type "'") candidates)))) (when import (eclim--java-organize-imports imports-order (list (if (string-endswith-p import type) import (concat import "." type)))))))
(progn (loop for unused across (json-read-from-string (replace-regexp-in-string "'" """ (first (eclim/execute-command "java_import_missing" "-p" "-f")))) do (let* ((candidates (append (cdr (assoc ... unused)) nil)) (type (cdr (assoc (quote type) unused))) (import (if (= 1 (length candidates)) (car candidates) (eclim--completing-read (concat "Missing type '" type "'") candidates)))) (when import (eclim--java-organize-imports imports-order (list (if (string-endswith-p import type) import (concat import "." type))))))))
(if imports-order (progn (loop for unused across (json-read-from-string (replace-regexp-in-string "'" """ (first (eclim/execute-command "java_import_missing" "-p" "-f")))) do (let* ((candidates (append (cdr ...) nil)) (type (cdr (assoc ... unused))) (import (if (= 1 ...) (car candidates) (eclim--completing-read ... candidates)))) (when import (eclim--java-organize-imports imports-order (list (if ... import ...))))))))
(when imports-order (loop for unused across (json-read-from-string (replace-regexp-in-string "'" """ (first (eclim/execute-command "java_import_missing" "-p" "-f")))) do (let* ((candidates (append (cdr (assoc ... unused)) nil)) (type (cdr (assoc (quote type) unused))) (import (if (= 1 (length candidates)) (car candidates) (eclim--completing-read (concat "Missing type '" type "'") candidates)))) (when import (eclim--java-organize-imports imports-order (list (if (string-endswith-p import type) import (concat import "." type))))))))
(let* ((imports-order (eclim/execute-command "java_import_order" "-p")) (eclim-auto-save (and eclim-auto-save (not nil)))) (when imports-order (loop for unused across (json-read-from-string (replace-regexp-in-string "'" """ (first (eclim/execute-command "java_import_missing" "-p" "-f")))) do (let* ((candidates (append (cdr ...) nil)) (type (cdr (assoc ... unused))) (import (if (= 1 ...) (car candidates) (eclim--completing-read ... candidates)))) (when import (eclim--java-organize-imports imports-order (list (if ... import ...))))))))
(eclim/with-results imports-order ("java_import_order" "-p") (loop for unused across (json-read-from-string (replace-regexp-in-string "'" """ (first (eclim/execute-command "java_import_missing" "-p" "-f")))) do (let* ((candidates (append (cdr (assoc ... unused)) nil)) (type (cdr (assoc (quote type) unused))) (import (if (= 1 (length candidates)) (car candidates) (eclim--completing-read (concat "Missing type '" type "'") candidates)))) (when import (eclim--java-organize-imports imports-order (list (if (string-endswith-p import type) import (concat import "." type))))))))
eclim-java-import-missing()
call-interactively(eclim-java-import-missing t nil)
execute-extended-command(nil)
call-interactively(execute-extended-command nil nil)

eclim--completion-documentation is broken?

At least, it doesn't work when used from the company-mode backend.

The reason seems to be, eclim--completion-candidates returns the values by the key info from the completion list (for java-mode, at least), but eclim--completion-documentation compares them to the completion values. The former include the arguments list and the closing paren, the latter don't.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.