]> granicus.if.org Git - python/commitdiff
(py-outdent-p): When looking at the previous line, watch out for
authorBarry Warsaw <barry@python.org>
Wed, 21 Jan 1998 05:36:18 +0000 (05:36 +0000)
committerBarry Warsaw <barry@python.org>
Wed, 21 Jan 1998 05:36:18 +0000 (05:36 +0000)
continuation lines.  This fixes this bug report, reported by Frank
Stajano.

# But if I split the "raise" line and reindent, the else WRONGLY goes up a
# level (?!?)

while condition1:
    if condition2:
        raise error3, \
              moreInfo4
else: # meant to close "if condition2"
    action5()

Misc/python-mode.el

index bd69739ae0b6be4d560ea5f4b54c841a23b600d1..1cff2d9d0f38885068aa904955e517ec3662ca78 100644 (file)
@@ -960,7 +960,9 @@ py-beep-if-tab-change\t\tring the bell if tab-width is changed"
   (save-excursion
     (and (progn (back-to-indentation)
                (looking-at py-outdent-re))
-        (progn (backward-to-indentation 1)
+        (progn (forward-line -1)
+               (py-goto-initial-line)
+               (back-to-indentation)
                (while (or (looking-at py-blank-or-comment-re)
                           (bobp))
                  (backward-to-indentation 1))