Emacs python-mode: shortcut keys for pdb step-by-step debugging

I was wondering if there is a way to link:

  • n RET (hereinafter)
  • p RET (previous)
  • c RET (continued)
  • Cx SPC RET (set/clear breakpoint)

with function keys F1 to F12 or other shortcut keys. The idea is to emulate the keyboard shortcuts that other IDEs have for debugging (e.g. Visual Studio, MATLAB, etc.).

Is this already supported by python-mode? Are there any Emacs modes that can be used to complement python-mode for debugging purposes?

+6
source share
1 answer

You can always define your own key bindings in Emacs. Type Ch m first to see the help in mode in the pdb buffer (which starts with Mx pdb ).

Then bind any key combination:

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

Read the Emacs manual on the built-in interface for the debugger (type Ch i g (emacs) Debuggers RET ) or online:

http://www.gnu.org/software/emacs/manual/html_node/emacs/Debuggers.html

+4
source

Source: https://habr.com/ru/post/907856/


All Articles