aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Monnier2011-11-09 10:00:32 -0500
committerStefan Monnier2011-11-09 10:00:32 -0500
commit90132c14854a1b92cc2141ea2a863bc0cbdcfcff (patch)
tree3fe92c69916f964cf862a5325b83800c24b50551
parentd2ad7ee1adefbfcb7b437ca3551de6d9cb405063 (diff)
downloademacs-90132c14854a1b92cc2141ea2a863bc0cbdcfcff.tar.gz
emacs-90132c14854a1b92cc2141ea2a863bc0cbdcfcff.zip
* lisp/progmodes/python.el (python-beginning-of-statement): Rewrite.
Fixes: debbugs:2703
-rw-r--r--lisp/ChangeLog3
-rw-r--r--lisp/progmodes/python.el21
2 files changed, 9 insertions, 15 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index c71cef7cdf9..83a27336855 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,5 +1,8 @@
12011-11-09 Stefan Monnier <monnier@iro.umontreal.ca> 12011-11-09 Stefan Monnier <monnier@iro.umontreal.ca>
2 2
3 * progmodes/python.el (python-beginning-of-statement):
4 Rewrite (bug#2703).
5
3 * progmodes/compile.el: Better handle TABs (bug#9749). 6 * progmodes/compile.el: Better handle TABs (bug#9749).
4 (compilation-internal-error-properties) 7 (compilation-internal-error-properties)
5 (compilation-next-error-function): Obey the target buffer's 8 (compilation-next-error-function): Obey the target buffer's
diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el
index 38bf9552b2a..8615400bf6a 100644
--- a/lisp/progmodes/python.el
+++ b/lisp/progmodes/python.el
@@ -948,22 +948,12 @@ Finds end of innermost nested class or method definition."
948 "Go to start of current statement. 948 "Go to start of current statement.
949Accounts for continuation lines, multi-line strings, and 949Accounts for continuation lines, multi-line strings, and
950multi-line bracketed expressions." 950multi-line bracketed expressions."
951 (beginning-of-line) 951 (while
952 (python-beginning-of-string)
953 (let (point)
954 (while (and (python-continuation-line-p)
955 (if point
956 (< (point) point)
957 t))
958 (beginning-of-line)
959 (if (python-backslash-continuation-line-p) 952 (if (python-backslash-continuation-line-p)
960 (progn 953 (progn (forward-line -1) t)
961 (forward-line -1) 954 (beginning-of-line)
962 (while (python-backslash-continuation-line-p) 955 (or (python-beginning-of-string)
963 (forward-line -1))) 956 (python-skip-out))))
964 (python-beginning-of-string)
965 (python-skip-out))
966 (setq point (point))))
967 (back-to-indentation)) 957 (back-to-indentation))
968 958
969(defun python-skip-out (&optional forward syntax) 959(defun python-skip-out (&optional forward syntax)
@@ -971,6 +961,7 @@ multi-line bracketed expressions."
971Skip forward if FORWARD is non-nil, else backward. 961Skip forward if FORWARD is non-nil, else backward.
972If SYNTAX is non-nil it is the state returned by `syntax-ppss' at point. 962If SYNTAX is non-nil it is the state returned by `syntax-ppss' at point.
973Return non-nil if and only if skipping was done." 963Return non-nil if and only if skipping was done."
964 ;; FIXME: Use syntax-ppss-toplevel-pos.
974 (let ((depth (syntax-ppss-depth (or syntax (syntax-ppss)))) 965 (let ((depth (syntax-ppss-depth (or syntax (syntax-ppss))))
975 (forward (if forward -1 1))) 966 (forward (if forward -1 1)))
976 (unless (zerop depth) 967 (unless (zerop depth)