aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/progmodes/python.el
diff options
context:
space:
mode:
authorFabián Ezequiel Gallina2015-07-06 01:03:46 -0300
committerFabián Ezequiel Gallina2015-07-06 01:04:00 -0300
commita5e39bfae8fe8950a01e01b1ae1ad864f5f523b4 (patch)
tree7452a926b25a45f793fe5c3a9d6fb4e25bc5ea0a /lisp/progmodes/python.el
parent342ed936e1957c0af32b96d6dee13fa0c84452c1 (diff)
downloademacs-a5e39bfae8fe8950a01e01b1ae1ad864f5f523b4.tar.gz
emacs-a5e39bfae8fe8950a01e01b1ae1ad864f5f523b4.zip
python.el: Fix mark-defun behavior (Bug#19665)
* lisp/progmodes/python.el: (python-mark-defun): New function. * test/automated/python-tests.el (python-mark-defun-1) (python-mark-defun-2, python-mark-defun-3): New tests.
Diffstat (limited to 'lisp/progmodes/python.el')
-rw-r--r--lisp/progmodes/python.el16
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 @@
284 (define-key map [remap backward-sentence] 'python-nav-backward-block) 284 (define-key map [remap backward-sentence] 'python-nav-backward-block)
285 (define-key map [remap forward-sentence] 'python-nav-forward-block) 285 (define-key map [remap forward-sentence] 'python-nav-forward-block)
286 (define-key map [remap backward-up-list] 'python-nav-backward-up-list) 286 (define-key map [remap backward-up-list] 'python-nav-backward-up-list)
287 (define-key map [remap mark-defun] 'python-mark-defun)
287 (define-key map "\C-c\C-j" 'imenu) 288 (define-key map "\C-c\C-j" 'imenu)
288 ;; Indent specific 289 ;; Indent specific
289 (define-key map "\177" 'python-indent-dedent-line-backspace) 290 (define-key map "\177" 'python-indent-dedent-line-backspace)
@@ -1251,6 +1252,21 @@ the line will be re-indented automatically if needed."
1251 (python-indent-region dedenter-pos current-pos))))))))) 1252 (python-indent-region dedenter-pos current-pos)))))))))
1252 1253
1253 1254
1255;;; Mark
1256
1257(defun python-mark-defun (&optional allow-extend)
1258 "Put mark at end of this defun, point at beginning.
1259The defun marked is the one that contains point or follows point.
1260
1261Interactively (or with ALLOW-EXTEND non-nil), if this command is
1262repeated or (in Transient Mark mode) if the mark is active, it
1263marks the next defun after the ones already marked."
1264 (interactive "p")
1265 (when (python-info-looking-at-beginning-of-defun)
1266 (end-of-line 1))
1267 (mark-defun allow-extend))
1268
1269
1254;;; Navigation 1270;;; Navigation
1255 1271
1256(defvar python-nav-beginning-of-defun-regexp 1272(defvar python-nav-beginning-of-defun-regexp