* Re: Tools for C Programming
[not found] <mailman.2621.1236414377.31690.help-gnu-emacs@gnu.org>
@ 2009-03-07 11:03 ` Pascal J. Bourguignon
2009-03-07 13:02 ` Dirk-Jan C. Binnema
2009-03-07 19:30 ` Richard Riley
0 siblings, 2 replies; 8+ messages in thread
From: Pascal J. Bourguignon @ 2009-03-07 11:03 UTC (permalink / raw)
To: help-gnu-emacs
"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__
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Tools for C Programming
2009-03-07 11:03 ` Tools for C Programming Pascal J. Bourguignon
@ 2009-03-07 13:02 ` Dirk-Jan C. Binnema
2009-03-07 19:30 ` Richard Riley
1 sibling, 0 replies; 8+ messages in thread
From: Dirk-Jan C. Binnema @ 2009-03-07 13:02 UTC (permalink / raw)
To: help-gnu-emacs
[-- Attachment #1: Type: text/plain, Size: 926 bytes --]
On Sat, Mar 07, 2009 at 12:03:21PM +0100, Pascal J. Bourguignon wrote:
> "Chengqi(Lars) Song" <songcq@gmail.co
> >
> > 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).
>
>
<snip>
I'd like to mention 'global', which is a nice alternative to etags.
See:
http://emacs-fu.blogspot.com/2009/01/navigating-through-source-code-using.html
There are some instructions too.
Best wishes,
Dirk.
--
------------------------------------------------------
Dirk-Jan C. Binnema <djcb[at]djcbsoftware.nl>
http://www.djcbsoftware.nl/
PGP: D09C E664 897D 7D39 5047 A178 E96A C7A1 017D DA3C
------------------------------------------------------
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 197 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Tools for C Programming
2009-03-07 11:03 ` Tools for C Programming Pascal J. Bourguignon
2009-03-07 13:02 ` Dirk-Jan C. Binnema
@ 2009-03-07 19:30 ` Richard Riley
2009-03-08 14:06 ` Richard Riley
1 sibling, 1 reply; 8+ messages in thread
From: Richard Riley @ 2009-03-07 19:30 UTC (permalink / raw)
To: help-gnu-emacs
pjb@informatimago.com (Pascal J. Bourguignon) writes:
> "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
I just have
ctags-exuberant -e --recurse=yes --links=yes --verbose=no
>
> M-x compile RET C-e tags RET
>
> and then type or move after the name of a function, and type M-.
I suggest cscope. It's much better than tags.
--
important and urgent problems of the technology of today are no longer the satisfactions of the primary needs or of archetypal wishes, but the reparation of the evils and damages by the technology of yesterday. ~Dennis Gabor, Innovations: Scientific, Technological and Social, 1970
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Tools for C Programming
2009-03-07 19:30 ` Richard Riley
@ 2009-03-08 14:06 ` Richard Riley
0 siblings, 0 replies; 8+ messages in thread
From: Richard Riley @ 2009-03-08 14:06 UTC (permalink / raw)
To: help-gnu-emacs
Richard Riley <rileyrgdev@gmail.com> writes:
> pjb@informatimago.com (Pascal J. Bourguignon) writes:
>
>> "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
>
> I just have
>
> ctags-exuberant -e --recurse=yes --links=yes --verbose=no
>
>
>>
>> M-x compile RET C-e tags RET
>>
>> and then type or move after the name of a function, and type M-.
>
> I suggest cscope. It's much better than tags.
I just noticed from Alex Ott's blog that there is a new version of
cedet.
I was pleasantly surprised to find it "just worked" with auto-complete
when you use
init-auto-complete.el
from the emacs wiki.
C programmers should give this a go.
r.
--
important and urgent problems of the technology of today are no longer the satisfactions of the primary needs or of archetypal wishes, but the reparation of the evils and damages by the technology of yesterday. ~Dennis Gabor, Innovations: Scientific, Technological and Social, 1970
^ permalink raw reply [flat|nested] 8+ messages in thread
* Tools for C Programming
@ 2009-03-07 8:25 Chengqi(Lars) Song
2009-03-07 10:10 ` Eli Zaretskii
[not found] ` <mailman.2631.1236420655.31690.help-gnu-emacs@gnu.org>
0 siblings, 2 replies; 8+ messages in thread
From: Chengqi(Lars) Song @ 2009-03-07 8:25 UTC (permalink / raw)
To: help-gnu-emacs
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?
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?
Thanks a lot!
lars
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Tools for C Programming
2009-03-07 8:25 Chengqi(Lars) Song
@ 2009-03-07 10:10 ` Eli Zaretskii
[not found] ` <mailman.2631.1236420655.31690.help-gnu-emacs@gnu.org>
1 sibling, 0 replies; 8+ messages in thread
From: Eli Zaretskii @ 2009-03-07 10:10 UTC (permalink / raw)
To: help-gnu-emacs
> Date: Sat, 7 Mar 2009 16:25:32 +0800
> From: "Chengqi(Lars) Song" <songcq@gmail.com>
>
> 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 cd .. && make RET"
> 2. How to display function list?
"M-x list-tags RET RET"
"M-x tags-apropos RET regexp RET"
But you need to create the TAGS file first, see the node "Create Tags
Table" in the Emacs manual.
> 3. How to auto-complete identifier names, struct memebers, and hints for function parameters?
I generally use M-/. For the last feature, you will have to install
ECB, I think, which is not part of Emacs, and is quite heavy. I
generally manage without that feature, and use the one below instead.
> 4. How to jump to definition?
"M-." (after creating TAGS, as explained above).
^ permalink raw reply [flat|nested] 8+ messages in thread
[parent not found: <mailman.2631.1236420655.31690.help-gnu-emacs@gnu.org>]
end of thread, other threads:[~2009-03-08 14:06 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <mailman.2621.1236414377.31690.help-gnu-emacs@gnu.org>
2009-03-07 11:03 ` Tools for C Programming Pascal J. Bourguignon
2009-03-07 13:02 ` Dirk-Jan C. Binnema
2009-03-07 19:30 ` Richard Riley
2009-03-08 14:06 ` Richard Riley
2009-03-07 8:25 Chengqi(Lars) Song
2009-03-07 10:10 ` Eli Zaretskii
[not found] ` <mailman.2631.1236420655.31690.help-gnu-emacs@gnu.org>
2009-03-07 11:05 ` Pascal J. Bourguignon
2009-03-08 13:27 ` Nikolaj Schumacher
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).