diff options
author | Stefan Monnier <[email protected]> | 2011-11-09 10:00:32 -0500 |
---|---|---|
committer | Stefan Monnier <[email protected]> | 2011-11-09 10:00:32 -0500 |
commit | 90132c14854a1b92cc2141ea2a863bc0cbdcfcff (patch) | |
tree | 3fe92c69916f964cf862a5325b83800c24b50551 | |
parent | d2ad7ee1adefbfcb7b437ca3551de6d9cb405063 (diff) |
* lisp/progmodes/python.el (python-beginning-of-statement): Rewrite.
Fixes: debbugs:2703
-rw-r--r-- | lisp/ChangeLog | 3 | ||||
-rw-r--r-- | lisp/progmodes/python.el | 21 |
2 files changed, 9 insertions, 15 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index c71cef7cdf..83a2733685 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,8 @@ 2011-11-09 Stefan Monnier <[email protected]> + * progmodes/python.el (python-beginning-of-statement): + Rewrite (bug#2703). + * progmodes/compile.el: Better handle TABs (bug#9749). (compilation-internal-error-properties) (compilation-next-error-function): Obey the target buffer's diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index 38bf9552b2..8615400bf6 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el @@ -948,22 +948,12 @@ Finds end of innermost nested class or method definition." "Go to start of current statement. Accounts for continuation lines, multi-line strings, and multi-line bracketed expressions." - (beginning-of-line) - (python-beginning-of-string) - (let (point) - (while (and (python-continuation-line-p) - (if point - (< (point) point) - t)) - (beginning-of-line) + (while (if (python-backslash-continuation-line-p) - (progn - (forward-line -1) - (while (python-backslash-continuation-line-p) - (forward-line -1))) - (python-beginning-of-string) - (python-skip-out)) - (setq point (point)))) + (progn (forward-line -1) t) + (beginning-of-line) + (or (python-beginning-of-string) + (python-skip-out)))) (back-to-indentation)) (defun python-skip-out (&optional forward syntax) @@ -971,6 +961,7 @@ multi-line bracketed expressions." Skip forward if FORWARD is non-nil, else backward. If SYNTAX is non-nil it is the state returned by `syntax-ppss' at point. Return non-nil if and only if skipping was done." + ;; FIXME: Use syntax-ppss-toplevel-pos. (let ((depth (syntax-ppss-depth (or syntax (syntax-ppss)))) (forward (if forward -1 1))) (unless (zerop depth) |