Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Indeed. I'm hoping the IDE support will include emacs - it can already do loads of cool things connected to nrepl, but completion on a hash would be amazing.


Does emacs support language aware intelliense (auto complete) for any language? I thought the common case was support through CTAGs.


I know of two modes for OCaml: TypeRex[1] and Merlin[2]. I've used both, and they both work reasonably well. The problem with TypeRex is that it requires changing your build, so it's not an easy option for companies that have some sort of custom build system in place.

Happily, by the time I got around to working at a company like that, somebody had written Merlin which does not need anything like that. It even worked with js_of_ocaml, which was very impressive. I thought it was a very good tool.

[1]: http://www.typerex.org/

[2]: http://kiwi.iuwt.fr/~asmanur/blog/merlin/

Emacs also has good support for a few other languages. Haskell has ghc-mod[3] and scion[4], for example.

[3]: http://www.mew.org/~kazu/proj/ghc-mod/en/

[4]: https://github.com/nominolo/scion

Similarly, there is ENSIME[5] for Scala.

[5]: https://github.com/aemoncannon/ensime

You can also use eclim[6] with Emacs, which integrates with Eclipse to offer rich functionality for Java.

[6]: https://github.com/senny/emacs-eclim

Of course, Emacs has language-aware editing for Emacs Lisp by default :). You can get similar support for most other popular dynamically typed languages as well.

So yes, Emacs does support plenty of languages like that, although almost always through a plugin. Happily, with the new package manager, installing and managing plugins is now trivial.


Yes, at least in clojure and CL. In Clojure, you use nrepl. Emacs (and several other IDEs) have clients which open a socket connection to your running clojure process. While editing a function, emacs will say "tell me about `my.namespace/foo`". It then shows arity and argument name info for the fn.

It's basically the same UX as you're used to in Java, except the info comes from asking the running process, rather than parsing statically.


It does for several languages (Dylan, Common Lisp, Java, etc). If you've got a compiler with an API, like say Clang, you can talk to it from Emacs Lisp.


How does Emacs plug into a statically typed language like Java? Does a compiler like Clang have an interactive/heuristic based mode suitable for use in a language-aware editor? Or do they just assume the code is in a good state and run the compiler when feedback is desired?


A compiler designed to support things like code completion can have an explicit API. For example, it may be asked to parse the code until the cursor location, the do a longjmp back out (or throw an exception, or whatever) with symbolic information about that location in the code.

If the parser error recovery is decent (and there is some effort put into this in most substantial front ends, since it's key to good error messages in large projects with long compile times, where recompile on every error fix isn't a great experience), the code doesn't need to be in a good state.


That might work...but does it work in practice (i.e. do you have an example where this is being used?).

I've found that most IDEs support two kinds of compilers: the compiler used to generate code and find type errors, and a "presentation" compiler to provide interactive feedback that is error tolerant and can run in incomplete contexts. Java works this way, Scala worked this way (at least when I was working on the plugin), C# has a lot of infrastructure separate from the compiler to support its use in Visual Studio. A lot of work goes into this infrastructure beyond "writing a decent compiler," and emacs very simple language-aware interface didn't seem to support it very well (when I looked ~8 years ago).


See: http://www.skybert.net/emacs/java. With Java, Emacs can just talk to the Eclipse Java Compiler, since it exposes an API. Same thing with Clang--it exposes an API which is used by XCode to support interactive feedback, and Emacs can consume it too. The Open Dylan compiler was originally intended to interface tightly with the Open Dylan Windows IDE, and that interface has been repurposed to interface with Emacs.


Cool, are these APIs buffer based or area based? I mean, when you make a change, do you get the message: the buffer has changed, or is there an area-based damage-repair cycle as in Eclipse or Visual Studio?


That might work...but does it work in practice (i.e. do you have an example where this is being used?).

It is how the Delphi compiler works in the IDE. I used to work for Borland, then Embarcadero, on the compiler front end.

When the compiler is running for code completion (kibitz mode, it calls it), it does a lot less work. No codegen, no type analysis of function bodies (begin / end blocks are entirely skipped), unless the cursor location is discovered to be inside a function body, whereupon the it rewinds and does more complete analysis. Normally takes no more than a few milliseconds to finish.


Yes, you can make it work for at least Java (JDE, I think?) and Python (I forget the mode, it's to do with Pymacs).





Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: