diff options
Diffstat (limited to 'lisp/progmodes/python.el')
| -rw-r--r-- | lisp/progmodes/python.el | 33 |
1 files changed, 22 insertions, 11 deletions
diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index 54a657a2593..172193266ca 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | ;;; python.el --- Python's flying circus support for Emacs | 1 | ;;; python.el --- Python's flying circus support for Emacs |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 2003-2012 Free Software Foundation, Inc. | 3 | ;; Copyright (C) 2003-2013 Free Software Foundation, Inc. |
| 4 | 4 | ||
| 5 | ;; Author: Fabián E. Gallina <fabian@anue.biz> | 5 | ;; Author: Fabián E. Gallina <fabian@anue.biz> |
| 6 | ;; URL: https://github.com/fgallina/python.el | 6 | ;; URL: https://github.com/fgallina/python.el |
| @@ -220,7 +220,7 @@ | |||
| 220 | (defgroup python nil | 220 | (defgroup python nil |
| 221 | "Python Language's flying circus support for Emacs." | 221 | "Python Language's flying circus support for Emacs." |
| 222 | :group 'languages | 222 | :group 'languages |
| 223 | :version "23.2" | 223 | :version "24.3" |
| 224 | :link '(emacs-commentary-link "python")) | 224 | :link '(emacs-commentary-link "python")) |
| 225 | 225 | ||
| 226 | 226 | ||
| @@ -1187,16 +1187,27 @@ Returns nil if point is not in a def or class." | |||
| 1187 | (forward-line -1)))) | 1187 | (forward-line -1)))) |
| 1188 | (point-marker)) | 1188 | (point-marker)) |
| 1189 | 1189 | ||
| 1190 | (defun python-nav-end-of-statement () | 1190 | (defun python-nav-end-of-statement (&optional noend) |
| 1191 | "Move to end of current statement." | 1191 | "Move to end of current statement. |
| 1192 | Optional argument NOEND is internal and makes the logic to not | ||
| 1193 | jump to the end of line when moving forward searching for the end | ||
| 1194 | of the statement." | ||
| 1192 | (interactive "^") | 1195 | (interactive "^") |
| 1193 | (while (and (goto-char (line-end-position)) | 1196 | (let (string-start bs-pos) |
| 1194 | (not (eobp)) | 1197 | (while (and (or noend (goto-char (line-end-position))) |
| 1195 | (when (or | 1198 | (not (eobp)) |
| 1196 | (python-info-line-ends-backslash-p) | 1199 | (cond ((setq string-start (python-syntax-context 'string)) |
| 1197 | (python-syntax-context 'string) | 1200 | (goto-char string-start) |
| 1198 | (python-syntax-context 'paren)) | 1201 | (python-nav-end-of-statement t)) |
| 1199 | (forward-line 1)))) | 1202 | ((python-syntax-context 'paren) |
| 1203 | ;; The statement won't end before we've escaped | ||
| 1204 | ;; at least one level of parenthesis. | ||
| 1205 | (condition-case err | ||
| 1206 | (goto-char (scan-lists (point) 1 -1)) | ||
| 1207 | (scan-error (goto-char (nth 3 err))))) | ||
| 1208 | ((setq bs-pos (python-info-line-ends-backslash-p)) | ||
| 1209 | (goto-char bs-pos) | ||
| 1210 | (forward-line 1)))))) | ||
| 1200 | (point-marker)) | 1211 | (point-marker)) |
| 1201 | 1212 | ||
| 1202 | (defun python-nav-backward-statement (&optional arg) | 1213 | (defun python-nav-backward-statement (&optional arg) |