help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: Tools for C Programming


From: Pascal J. Bourguignon
Subject: Re: Tools for C Programming
Date: Sat, 07 Mar 2009 12:03:21 +0100
User-agent: Gnus/5.1008 (Gnus v5.10.8) Emacs/22.3 (darwin)

"Chengqi(Lars) Song" <songcq@gmail.com> writes:

> hi,
>
> I've been using emacs for a long time but I've just started to write C 
> program in emacs. I need some functions but dunno how to configure. Maybe you 
> can give me some suggestions.
>
> 1. The folder structure is like:
>    abc-+-
>        |--MakeFile
>        |--src-+-
>               |--main.c
>
>    after I use C-x C-f to open main.c, how to 'make' when the
>    MakeFile is in the parent folder?

M-x compile RET C-a C-k make -C /home/chengqi/src/abc/Makefile all RET

next time you can just do:

M-x recompile RET


> 2. How to display function list?
>
>
> 3. How to auto-complete identifier names, struct memebers, and hints
>    for function parameters?
>
>
> 4. How to jump to definition?

ECB is the most complete package to do that. 
http://ecb.sourceforge.net/

Otherwise, there are also tools such as tags (use etags(1) to build a
TAGS index, and use M-. to jump to the definition(s) of a symbol,
M-TAB to complete a symbol, etc).


Put this in your Makefile:

tags etags:
        find $(SRCDIR) \( \( -name \[#.]\?\* -prune \) \
                          -o -name \*.h -o -name \*.c  \
                          -o -name \*.hh -o -name \*.hxx -o -name \*.cc -o 
-name \*.cxx \) \
                          -print \
         | while read f ; do echo $$f ; etags -a -o $(SRCDIR)/TAGS $$f ; done

M-x compile RET C-e tags RET

and then type or move after the name of a function, and type M-.

-- 
__Pascal Bourguignon__


reply via email to

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