Function: python-menu
python-menu is an interactive and byte-compiled function defined in
python.el.gz.
Signature
(python-menu ARG1)
Documentation
Python Mode menu
Key Bindings
Source Code
;; Defined in /usr/src/emacs/lisp/progmodes/python.el.gz
;;; Bindings
(defvar python-mode-map
(let ((map (make-sparse-keymap)))
;; Movement
(define-key map [remap backward-sentence] #'python-nav-backward-block)
(define-key map [remap forward-sentence] #'python-nav-forward-block)
(define-key map [remap backward-up-list] #'python-nav-backward-up-list)
(define-key map [remap up-list] #'python-nav-up-list)
(define-key map [remap mark-defun] #'python-mark-defun)
(define-key map "\C-c\C-j" #'imenu)
;; Indent specific
(define-key map "\177" #'python-indent-dedent-line-backspace)
(define-key map (kbd "<backtab>") #'python-indent-dedent-line)
(define-key map "\C-c<" #'python-indent-shift-left)
(define-key map "\C-c>" #'python-indent-shift-right)
;; Skeletons
(define-key map "\C-c\C-tc" #'python-skeleton-class)
(define-key map "\C-c\C-td" #'python-skeleton-def)
(define-key map "\C-c\C-tf" #'python-skeleton-for)
(define-key map "\C-c\C-ti" #'python-skeleton-if)
(define-key map "\C-c\C-tm" #'python-skeleton-import)
(define-key map "\C-c\C-tt" #'python-skeleton-try)
(define-key map "\C-c\C-tw" #'python-skeleton-while)
;; Shell interaction
(define-key map "\C-c\C-p" #'run-python)
(define-key map "\C-c\C-s" #'python-shell-send-string)
(define-key map "\C-c\C-e" #'python-shell-send-statement)
(define-key map "\C-c\C-r" #'python-shell-send-region)
(define-key map "\C-\M-x" #'python-shell-send-defun)
(define-key map "\C-c\C-c" #'python-shell-send-buffer)
(define-key map "\C-c\C-l" #'python-shell-send-file)
(define-key map "\C-c\C-z" #'python-shell-switch-to-shell)
;; Some util commands
(define-key map "\C-c\C-v" #'python-check)
(define-key map "\C-c\C-f" #'python-eldoc-at-point)
(define-key map "\C-c\C-d" #'python-describe-at-point)
;; Import management
(define-key map "\C-c\C-ia" #'python-add-import)
(define-key map "\C-c\C-if" #'python-fix-imports)
(define-key map "\C-c\C-ir" #'python-remove-import)
(define-key map "\C-c\C-is" #'python-sort-imports)
;; Utilities
(substitute-key-definition #'complete-symbol #'completion-at-point
map global-map)
(easy-menu-define python-menu map "Python Mode menu"
'("Python"
:help "Python-specific Features"
["Shift region left" python-indent-shift-left :active mark-active
:help "Shift region left by a single indentation step"]
["Shift region right" python-indent-shift-right :active mark-active
:help "Shift region right by a single indentation step"]
"-"
["Start of def/class" beginning-of-defun
:help "Go to start of outermost definition around point"]
["End of def/class" end-of-defun
:help "Go to end of definition around point"]
["Mark def/class" mark-defun
:help "Mark outermost definition around point"]
["Jump to def/class" imenu
:help "Jump to a class or function definition"]
"--"
("Skeletons")
"---"
["Start interpreter" run-python
:help "Run inferior Python process in a separate buffer"]
["Switch to shell" python-shell-switch-to-shell
:help "Switch to running inferior Python process"]
["Eval string" python-shell-send-string
:help "Eval string in inferior Python session"]
["Eval buffer" python-shell-send-buffer
:help "Eval buffer in inferior Python session"]
["Eval statement" python-shell-send-statement
:help "Eval statement in inferior Python session"]
["Eval region" python-shell-send-region
:help "Eval region in inferior Python session"]
["Eval defun" python-shell-send-defun
:help "Eval defun in inferior Python session"]
["Eval file" python-shell-send-file
:help "Eval file in inferior Python session"]
["Debugger" pdb :help "Run pdb under GUD"]
"----"
["Check file" python-check
:help "Check file for errors"]
["Help on symbol" python-eldoc-at-point
:help "Get help on symbol at point"]
["Complete symbol" completion-at-point
:help "Complete symbol before point"]
"-----"
["Add import" python-add-import
:help "Add an import statement to the top of this buffer"]
["Remove import" python-remove-import
:help "Remove an import statement from the top of this buffer"]
["Sort imports" python-sort-imports
:help "Sort the import statements at the top of this buffer"]
["Fix imports" python-fix-imports
:help "Add missing imports and remove unused ones from the current buffer"]
))
map)
"Keymap for `python-mode'.")