1
votes

When I am debugging code in Emacs, I like to have two buffers open, the first one with the source code I am debugging, and the second one with the debugger (pdb for Python).

I have the following keyboard shortcuts defined on my .emacs file:

(require 'gud)                                                                                                                                                
(define-key gud-mode-map '[C-f10] 'gud-next)                                                                                                                  
(define-key gud-mode-map '[C-f11] 'gud-step)                                                                                                                  
(define-key gud-mode-map '[C-f5] 'gud-cont)                                                                                                                   
(define-key gud-mode-map '[C-f12] 'gud-break) 

With the above, I can trigger the GUD shortcuts for gud-next, gud-step, etc. from the buffer where pdb is running, but I can't trigger them from the buffer that has the python code.

I would like to use keyboard shortcuts on the buffer with the source code to trigger GUD commands for the debugger. Is there any way to do this?

I am using the most recent version of python-mode (6.0.4) and Emacs 23.3.1.

1

1 Answers

4
votes

Try using global-set-key instead:

(global-set-key [C-f10] 'gud-next)
(global-set-key [C-f11] 'gud-step)
(global-set-key [C-f5] 'gud-cont)
(global-set-key [C-f12] 'gud-break)

IIRC, this worked for me.