[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [h-e-w] c++ editing , variable name completion

From: Paul Whitfield
Subject: Re: [h-e-w] c++ editing , variable name completion
Date: Wed, 24 Jul 2002 14:18:52 +0800
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.1b) Gecko/20020721

Paul Kinnucan wrote:
Jeremy Bowen writes:
 > From: john ware [mailto:address@hidden
 > Sent: 22 July 2002 19:33
> > > Hi, > > Is there a mode which will perform variable name and function name > > completion for C++.
 > >
> > By this I mean, if you type in the the beginning of a variable name > > and hit the proper key combination then a list of all possible symbols > > which are valid in the scope are displayed. I know that the JDEE mode > > will do this for java code, but alas, I am back working with C++. > > I quite like dabbrev mode. Look in Info under the topic "Emacs->Abbrevs" > > It doesn't "display" all completions but it does cycle through the > available ones it knows about. It is very light-weight but this might be > good enough. > > I think it works out of the box. You can try it with simply M-/ after > typing the first few letters of the variable/function name. >
I cringe whenever I read a post recommending dabbrev as Emacs' answer
to Microsoft's Intellisense completion facility. Anyone who has used
Intellisense or the equivalent facilities provided by Java IDEs,
including the JDEE, and who tries dabbrev, is going to be disappointed
and get the impression that Emacs users work in the backwaters of
their profession blissfully unaware that the rest of the world has
passed them by when it comes to programming tools. Better to frankly
admit that Emacs is deficient in this area.

Comparing dabbrev to Intellisense is like comparing a brain-damaged
nonprogrammer having only short-term memory to a programmer with total
recall and a complete command of C++ syntax and the fields and methods
of all classes used in the current project including the class of
the object at point. dabbrev only "knows" how to complete symbols
in open buffers (i.e., in memory). It blindly cycles through every
symbol in memory that might complete the text at point, regardless of
context. If the symbol you want to complete is not in memory, you're
out of luck. Further, if you ask dabbrev to complete obj.getFo and
there is a symbol called getFoo in memory, dabbrev will offer getFoo
as a completion even if the class of obj has no such method. This is
very far from the kind of syntax-, context-, and type-aware method and
field completion that the JDEE provides for Java or Microsoft's
Intellisense facility provides for C++.

I valid point... however, dabrev is

a) Small
b) Quick
c) Works in languages / contexts other than C/C++
d) Is better than any alternatives than I know about.

Eric Ludlam and I are working on providing a true syntax-, context,
and type-aware field and method completion facility for C++, Java, C
and other languages, using parse databases generated by
Eric's semantic package. We hope to have it ready for at least
C, C++, and Java in the very near future.

WOOHOO... Guess I had better keep checking the cedet site for the
beta release.

Eric's semantic/speedbar package is one of the absolutely
irreplaceable parts of emacs.  I can't express how much I
like these packages!!! Keep up the good work.

Now if only someone could make a BNF file for tcl I would be
really happy! (I started but my brain over-heated... )



reply via email to

[Prev in Thread] Current Thread [Next in Thread]