summaryrefslogtreecommitdiff
path: root/lisp/progmodes
diff options
context:
space:
mode:
authorFabián Ezequiel Gallina <fgallina@gnu.org>2013-01-10 00:44:12 -0300
committerFabián Ezequiel Gallina <fgallina@gnu.org>2013-01-10 00:44:12 -0300
commit50620051800d14a47558fb4379d7cbae5d81f6a1 (patch)
tree5606e4a930960aa3d067d0e9213974d34ff8107b /lisp/progmodes
parentc4dd9efc9ed3f7de8f4ee74b6d47f65ad72320cf (diff)
downloademacs-50620051800d14a47558fb4379d7cbae5d81f6a1.tar.gz
* progmodes/python.el (python-nav-end-of-statement): Fix
cornercase when handling multiline strings.
Diffstat (limited to 'lisp/progmodes')
-rw-r--r--lisp/progmodes/python.el13
1 files changed, 11 insertions, 2 deletions
diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el
index 7294984fc4a..e58dfa169ef 100644
--- a/lisp/progmodes/python.el
+++ b/lisp/progmodes/python.el
@@ -1188,7 +1188,16 @@ of the statement."
(not (eobp))
(cond ((setq string-start (python-syntax-context 'string))
(goto-char string-start)
- (python-nav-end-of-statement t))
+ (if (python-syntax-context 'paren)
+ ;; Ended up inside a paren, roll again.
+ (python-nav-end-of-statement t)
+ ;; This is not inside a paren, move to the
+ ;; end of this string.
+ (goto-char (+ (point)
+ (python-syntax-count-quotes
+ (char-after (point)) (point))))
+ (or (re-search-forward (rx (syntax string-delimiter)) nil t)
+ (goto-char (point-max)))))
((python-syntax-context 'paren)
;; The statement won't end before we've escaped
;; at least one level of parenthesis.
@@ -1302,7 +1311,7 @@ backward to previous block."
"Safe version of standard `forward-sexp'.
When ARG > 0 move forward, else if ARG is < 0."
(or arg (setq arg 1))
- (let ((forward-sexp-function nil)
+ (let ((forward-sexp-function)
(paren-regexp
(if (> arg 0) (python-rx close-paren) (python-rx open-paren)))
(search-fn