tags:

views:

531

answers:

3

I'm trying to get accustomed to using Emacs for building and debugging, although I'm having some difficulties. My biggest problem right now is that I need to be in (e.g. have a file open in) the root directory to make -k my applications and I need to be in the binaries directory to run gdb MyApp.

Is it futile to try to get Ctrl+Shift+B to make -k -C <my_hard_coded_dir> and some type of ditto with F5 running gdb <MyApp> from my bin directory? Never mind if the shift key is to much of a hassle for Emacs.

+2  A: 

for compiling i use this spippet in my .emacs

(global-set-key [f2]   'compile)
(global-set-key [f3]   'next-error)
(setq compile-command "u: & cd \\gbceinspielen\\trunk\\src\\compile & make -k ")

the command "gdb" starts the debugger, but i do not know, wether there is an equivalent to compile-command.

Peter Miehle
And to get Ctrl-Shift-B, substitute (kbd "C-S-b") for [f2].
Jouni K. Seppänen
One plus for pointing out starters for make, but had to do make -C <mydir> -k, since cd didn't work (Linux problem?). No luck with finding gdb variables though. Is there some type of list for these variables and what they do?
Jonas Byström
okay, sorry for gdb, (i thought i should have, but i did not know, because i do not use it)finding things: M-x apropos
Peter Miehle
I've searched apropos in vain. Btw: (kbd "C-S-b") does not work for me (tries to move the cursor, yields "already at beginning of buffer", etc), but it's not really important.
Jonas Byström
If you are using Emacs on the console, or in xterm or similar, Control-Shift-letter is not differentiated from Control-letter, and Control-b is backward-char. You need to use a windowing system for that kind of combinations to work.
Jouni K. Seppänen
+5  A: 

To specify what M-x make uses for compilation, you specify the compile-command variable.

(setq compile-command "make -c /path/to/makefile")

For your GDB stuff, the variable is gud-gdb-command-name, so

(setq gud-gdb-command-name "gdb --anotate=3 -cd /path/to/exec")
Nathaniel Flath
A: 

I'm personaly use EDE to keep compilation settings for concrete projects, and create compile command on the fly. You can see how it works in my cedet config, starting with line 100

Alex Ott