Ads by Google

Saturday, April 19, 2008

The closest to text intellisense in Emacs

Emacs users know that M-/ is used to the expand the text at point for possible completions. One good thing is that it searches all the buffers for possible completions. While this is not the same as programming language intellisense stuff you find in programming editors from Microsoft, Sun and Eclipse, it's still a better choice than a language specific offering.

Why? Because it gives the same consistent behaviour in whatever buffer you're in. You can be sure that if you had typed it before, it can be plugged into the current buffer in whatever mode it is in with a minimal of keystrokes. This is in contrast to other specialised editors which can offer the feature for Java, C or C++, say.

OK, the choice of M-/ is not exactly great for those who are not good typists.

But this is Emacs; there is a way to use TAB as the more natural keystroke to expand the text at point. Plugging in the code given at this link will make text expansion or completion a lot more natural. Having done that, I've pretty much stopped using M-/ for text expansion.

One other way to do text completion is to use Predictive mode which learns from your typing style; Having used it before, I could see the benefits but I ran into some resource usage errors with the dictionary and hence stopped using it.

I'd encourage people to try predictive mode if only to see the possibilities that might arise for you. A typing session that is customised to the way you write. It might be very useful for people who are in some specialised fields with limited but large words usage.


Anonymous said...

Ever tried

It has an intelligent autocomplete.

sivaram said...

Thanks for that software. But I can get the same features in Emacs without installing any other software. Of course it's a bit more work.

For example, every time I make a typo, I add that to the global abbrev. table by hitting C-x a i g.

That corrects the typos from the second time around.


Strav said...

While I'm an emacs addict for multiple reasons (one being the consistent features availability across different modes), I must point out that M-/ is far from being close to what intellisense usually is.

M-/ has no knowledge of your program's data structures, neither it is aware of the current language's syntax. It's merely an auto-completion based on the buffer's content and proximity of your cursor.

AFAIK (I stumbled on this post loooking for it), there is nothing currently similar to intellisense in emacs. I hope there will me a coordinated move in that direction soon.

sivaram said...

Agreed,M-/ is not intellisense, I was only pointing out, it was closest one could get to it.

But have you considered

I haven't but it might be worth a spin.

Strav said...

Yep, after some more searching, as you point out, I found that cedet might be the closest alternative to intellisense there is (it seems pretty flexible too), I'll give it a try and keep you posted about this mode :)