Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 1b761a6

Browse files
committed
cope with triple-quoted strings (says Barry)
1 parent 04cba5b commit 1b761a6

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

Misc/python-mode-old.el

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -596,6 +596,13 @@ the new line indented."
596596
;; happens to be a continuation line too
597597
(re-search-backward "^[ \t]*\\([^ \t\n#]\\|#[ \t\n]\\)"
598598
nil 'move)
599+
;; if we landed inside a string, go to the beginning of that string
600+
(let ((state (parse-partial-sexp
601+
(save-excursion (beginning-of-python-def-or-class)
602+
(point))
603+
(point))))
604+
(if (nth 3 state)
605+
(goto-char (nth 2 state))))
599606
(py-goto-initial-line)
600607
(if (py-statement-opens-block-p)
601608
(+ (current-indentation) py-indent-offset)

0 commit comments

Comments
 (0)