aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/progmodes/python.el
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/progmodes/python.el')
-rw-r--r--lisp/progmodes/python.el29
1 files changed, 20 insertions, 9 deletions
diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el
index 90e0d604217..c168b3813ff 100644
--- a/lisp/progmodes/python.el
+++ b/lisp/progmodes/python.el
@@ -1177,16 +1177,27 @@ Returns nil if point is not in a def or class."
1177 (forward-line -1)))) 1177 (forward-line -1))))
1178 (point-marker)) 1178 (point-marker))
1179 1179
1180(defun python-nav-end-of-statement () 1180(defun python-nav-end-of-statement (&optional noend)
1181 "Move to end of current statement." 1181 "Move to end of current statement.
1182Optional argument NOEND is internal and makes the logic to not
1183jump to the end of line when moving forward searching for the end
1184of the statement."
1182 (interactive "^") 1185 (interactive "^")
1183 (while (and (goto-char (line-end-position)) 1186 (let (string-start bs-pos)
1184 (not (eobp)) 1187 (while (and (or noend (goto-char (line-end-position)))
1185 (when (or 1188 (not (eobp))
1186 (python-info-line-ends-backslash-p) 1189 (cond ((setq string-start (python-syntax-context 'string))
1187 (python-syntax-context 'string) 1190 (goto-char string-start)
1188 (python-syntax-context 'paren)) 1191 (python-nav-end-of-statement t))
1189 (forward-line 1)))) 1192 ((python-syntax-context 'paren)
1193 ;; The statement won't end before we've escaped
1194 ;; at least one level of parenthesis.
1195 (condition-case err
1196 (goto-char (scan-lists (point) 1 -1))
1197 (scan-error (goto-char (nth 3 err)))))
1198 ((setq bs-pos (python-info-line-ends-backslash-p))
1199 (goto-char bs-pos)
1200 (forward-line 1))))))
1190 (point-marker)) 1201 (point-marker))
1191 1202
1192(defun python-nav-backward-statement (&optional arg) 1203(defun python-nav-backward-statement (&optional arg)