1

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 Answer 1

4

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.

Sign up to request clarification or add additional context in comments.

1 Comment

Good point. Thanks, this works great. I wonder if python-mode has it's own keyboard map?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.