]> granicus.if.org Git - python/commitdiff
(py-compute-indentation): When looking at a continuation line inside
authorBarry Warsaw <barry@python.org>
Wed, 1 Apr 1998 21:59:41 +0000 (21:59 +0000)
committerBarry Warsaw <barry@python.org>
Wed, 1 Apr 1998 21:59:41 +0000 (21:59 +0000)
an open paren, do a better job of reindenting the line.  For example:

def foo():
    print 'hello %s, %d' % (
    a, b)

Hit TAB on the line starting with `a'.  Without this patch this line
will never be reindented.

Misc/python-mode.el

index 6fadfa1689bcbe5f6bdb7074a94750b5579b374f..b50ce9502bb3d046944401d837be84d899389c08 100644 (file)
@@ -1529,7 +1529,12 @@ the new line indented."
                  (while (and (< (point) startpos)
                              (looking-at "[ \t]*[#\n\\\\]")) ; skip noise
                    (forward-line 1))
-                 (if (< (point) startpos)
+                 (if (and (< (point) startpos)
+                          (/= startpos
+                              (save-excursion
+                                (goto-char (1+ open-bracket-pos))
+                                (skip-chars-forward " \t\n")
+                                (point))))
                      ;; again mimic the first list item
                      (current-indentation)
                    ;; else they're about to enter the first item