diff options
Diffstat (limited to 'lisp/progmodes/python.el')
-rw-r--r-- | lisp/progmodes/python.el | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index f641880428c..fbf944f9c68 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el @@ -284,6 +284,7 @@ (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 mark-defun] 'python-mark-defun) (define-key map "\C-c\C-j" 'imenu) ;; Indent specific (define-key map "\177" 'python-indent-dedent-line-backspace) @@ -1251,6 +1252,21 @@ the line will be re-indented automatically if needed." (python-indent-region dedenter-pos current-pos))))))))) +;;; Mark + +(defun python-mark-defun (&optional allow-extend) + "Put mark at end of this defun, point at beginning. +The defun marked is the one that contains point or follows point. + +Interactively (or with ALLOW-EXTEND non-nil), if this command is +repeated or (in Transient Mark mode) if the mark is active, it +marks the next defun after the ones already marked." + (interactive "p") + (when (python-info-looking-at-beginning-of-defun) + (end-of-line 1)) + (mark-defun allow-extend)) + + ;;; Navigation (defvar python-nav-beginning-of-defun-regexp |