]> git.eshelyaron.com Git - emacs.git/commitdiff
* lisp/progmodes/python.el (python-beginning-of-statement): Rewrite.
authorStefan Monnier <monnier@iro.umontreal.ca>
Wed, 9 Nov 2011 15:00:32 +0000 (10:00 -0500)
committerStefan Monnier <monnier@iro.umontreal.ca>
Wed, 9 Nov 2011 15:00:32 +0000 (10:00 -0500)
Fixes: debbugs:2703
lisp/ChangeLog
lisp/progmodes/python.el

index c71cef7cdf974654f25bd688b9c8c450aeaed832..83a27336855360eb8c22044e09b0a2443cabbd8d 100644 (file)
@@ -1,5 +1,8 @@
 2011-11-09  Stefan Monnier  <monnier@iro.umontreal.ca>
 
+       * 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
index 38bf9552b2a3b7f5306dde90e0c3f2a900e4be5b..8615400bf6a03e68fcd553e0808d6eba99fca7d1 100644 (file)
@@ -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)