emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug/patch: python.el python-beginning-of-statement


From: Karl Chen
Subject: bug/patch: python.el python-beginning-of-statement
Date: Sun, 27 Jun 2004 02:34:52 -0700

BUG:
emacs -q /tmp/a.py
) RET TAB

If you have invalid syntax (such as unmatched ")") and try to
indent, python-mode will go into an infinite loop until you C-g.
The bug is in python-beginning-of-statement.


Index: python.el
===================================================================
--- python.el   (revision 6526)
+++ python.el   (working copy)
@@ -710,16 +710,17 @@
 expressions."
   (beginning-of-line)
   (python-beginning-of-string)
-  (while (python-continuation-line-p)
-    (beginning-of-line)
-    (if (python-backslash-continuation-line-p)
-       (while (python-backslash-continuation-line-p)
-         (forward-line -1))
-      (python-beginning-of-string)
-      ;; Skip forward out of nested brackets.
-      (condition-case ()               ; beware invalid syntax
-         (progn (backward-up-list (syntax-ppss-depth (syntax-ppss))) t)
-       (error (end-of-line)))))
+  (block nil
+    (while (python-continuation-line-p)
+      (beginning-of-line)
+      (if (python-backslash-continuation-line-p)
+          (while (python-backslash-continuation-line-p)
+            (forward-line -1))
+        (python-beginning-of-string)
+        ;; Skip forward out of nested brackets.
+        (condition-case ()             ; beware invalid syntax
+            (progn (backward-up-list (syntax-ppss-depth (syntax-ppss))) t)
+          (error (return))))))
   (back-to-indentation))
 
 (defun python-end-of-statement ()






reply via email to

[Prev in Thread] Current Thread [Next in Thread]