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

Skip to content

Commit 9b623b3

Browse files
committed
(py-electric-colon): don't re-indent the line if it starts in column
zero
1 parent 464c94a commit 9b623b3

1 file changed

Lines changed: 9 additions & 5 deletions

File tree

Misc/python-mode.el

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -433,11 +433,15 @@ argument is provided, that many colons are inserted non-electrically."
433433
(py-compute-indentation)))
434434
)
435435
(setq outdent py-indent-offset))
436-
(goto-char here)
437-
(beginning-of-line)
438-
(delete-horizontal-space)
439-
(indent-to (- indent outdent))
440-
)))
436+
;; electric colon won't re-indent lines that start in column
437+
;; zero. you'd have to use TAB for that. TBD: Is there a
438+
;; better way to determine this???
439+
(if (zerop (current-indentation)) nil
440+
(goto-char here)
441+
(beginning-of-line)
442+
(delete-horizontal-space)
443+
(indent-to (- indent outdent))
444+
))))
441445

442446

443447
;;; Functions that execute Python commands in a subprocess

0 commit comments

Comments
 (0)