]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
(py-compute-indentation): in `t' clause, watch for the
authorBarry Warsaw <barry@python.org>
Fri, 16 Dec 1994 00:13:34 +0000 (00:13 +0000)
committerBarry Warsaw <barry@python.org>
Fri, 16 Dec 1994 00:13:34 +0000 (00:13 +0000)
re-search-backwards landing you inside a mult-line string.

Misc/python-mode.el

index de5a8cb8b579326cb7cf56082de18a579ee85f70..76b391c5980bd1eb1c0a24b499ebfbae704dc2e1 100644 (file)
@@ -596,6 +596,13 @@ the new line indented."
        ;; happens to be a continuation line too
        (re-search-backward "^[ \t]*\\([^ \t\n#]\\|#[ \t\n]\\)"
                           nil 'move)
+       ;; if we landed inside a string, go to the beginning of that string
+       (let ((state (parse-partial-sexp
+                    (save-excursion (beginning-of-python-def-or-class)
+                                    (point))
+                    (point))))
+        (if (nth 3 state)
+            (goto-char (nth 2 state))))
        (py-goto-initial-line)
        (if (py-statement-opens-block-p)
           (+ (current-indentation) py-indent-offset)