diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2013-01-02 08:13:04 -0800 |
---|---|---|
committer | Paul Eggert <eggert@cs.ucla.edu> | 2013-01-02 08:13:04 -0800 |
commit | 0877d0dc24ee792b9b14592869ea1aa0934aee58 (patch) | |
tree | 08e9265a1dd95974dc72622a9bef194682c0c716 /lisp/progmodes/python.el | |
parent | aca3d51dfa45794fa68a2ffb6269e34fcee2ec6c (diff) | |
parent | d8fb8cce84b923a3289b69549e30958710ac3ebb (diff) | |
download | emacs-0877d0dc24ee792b9b14592869ea1aa0934aee58.tar.gz emacs-0877d0dc24ee792b9b14592869ea1aa0934aee58.tar.bz2 emacs-0877d0dc24ee792b9b14592869ea1aa0934aee58.zip |
Merge from emacs-24; up to 2012-12-06T01:39:03Z!monnier@iro.umontreal.ca
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 @@ ;;; python.el --- Python's flying circus support for Emacs -;; Copyright (C) 2003-2012 Free Software Foundation, Inc. +;; Copyright (C) 2003-2013 Free Software Foundation, Inc. ;; Author: Fabián E. Gallina <fabian@anue.biz> ;; URL: https://github.com/fgallina/python.el @@ -220,7 +220,7 @@ (defgroup python nil "Python Language's flying circus support for Emacs." :group 'languages - :version "23.2" + :version "24.3" :link '(emacs-commentary-link "python")) @@ -1187,16 +1187,27 @@ Returns nil if point is not in a def or class." (forward-line -1)))) (point-marker)) -(defun python-nav-end-of-statement () - "Move to end of current statement." +(defun python-nav-end-of-statement (&optional noend) + "Move to end of current statement. +Optional argument NOEND is internal and makes the logic to not +jump to the end of line when moving forward searching for the end +of the statement." (interactive "^") - (while (and (goto-char (line-end-position)) - (not (eobp)) - (when (or - (python-info-line-ends-backslash-p) - (python-syntax-context 'string) - (python-syntax-context 'paren)) - (forward-line 1)))) + (let (string-start bs-pos) + (while (and (or noend (goto-char (line-end-position))) + (not (eobp)) + (cond ((setq string-start (python-syntax-context 'string)) + (goto-char string-start) + (python-nav-end-of-statement t)) + ((python-syntax-context 'paren) + ;; The statement won't end before we've escaped + ;; at least one level of parenthesis. + (condition-case err + (goto-char (scan-lists (point) 1 -1)) + (scan-error (goto-char (nth 3 err))))) + ((setq bs-pos (python-info-line-ends-backslash-p)) + (goto-char bs-pos) + (forward-line 1)))))) (point-marker)) (defun python-nav-backward-statement (&optional arg) |