Commit ffdb56c3 authored by Fabián Ezequiel Gallina's avatar Fabián Ezequiel Gallina Committed by Fabián Ezequiel Gallina

Implemented python-indent-electric-colon

parent 17d13b85
......@@ -142,6 +142,7 @@
(define-key map (kbd "<backtab>") 'python-indent-dedent-line)
(define-key map "\C-c<" 'python-indent-shift-left)
(define-key map "\C-c>" 'python-indent-shift-right)
(define-key map ":" 'python-indent-electric-colon)
;; Shell interaction
(define-key map "\C-c\C-s" 'python-shell-send-string)
(define-key map "\C-c\C-r" 'python-shell-send-region)
......@@ -786,6 +787,19 @@ lie."
(setq count python-indent-offset))
(indent-rigidly start end count))
;; Directly from Dave Love's python.el
(defun python-indent-electric-colon (arg)
"Insert a colon and maybe outdent the line if it is a statement like `else'.
With numeric ARG, just insert that many colons. With \\[universal-argument],
just insert a single colon."
(interactive "*P")
(self-insert-command (if (not (integerp arg)) 1 arg))
(and (not arg)
(not (nth 8 (syntax-ppss)))
(save-excursion (python-indent-line))))
(put 'python-indent-electric-colon 'delete-selection t)
;;; Navigation
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment