all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Karl Chen <quarl@hkn.eecs.berkeley.edu>
Subject: bug/patch: python.el python-beginning-of-statement
Date: Sun, 27 Jun 2004 02:34:52 -0700	[thread overview]
Message-ID: <quack.20040627T0234.j5hdsxibsz@hkn.eecs.berkeley.edu> (raw)


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	other threads:[~2004-06-27  9:34 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-06-27  9:34 Karl Chen [this message]
2004-06-28  2:23 ` bug/patch: python.el python-beginning-of-statement Richard Stallman
2004-06-28  8:33   ` Karl Chen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=quack.20040627T0234.j5hdsxibsz@hkn.eecs.berkeley.edu \
    --to=quarl@hkn.eecs.berkeley.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.