1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-01-05 19:31:02 -08:00

Support electric-layout-mode in python-base-mode

* lisp/progmodes/python.el (python-base-mode): Add support for
'electric-layout-mode'.
This commit is contained in:
Stefan Kangas 2024-09-21 04:41:46 +02:00
parent 7a404e6d51
commit dfecd6037d

View file

@ -7071,6 +7071,11 @@ implementations: `python-mode' and `python-ts-mode'."
(setq-local electric-indent-inhibit t)
(setq-local electric-indent-chars
(cons ?: electric-indent-chars))
(setq-local electric-layout-rules
`((?: . ,(lambda ()
(and (zerop (car (syntax-ppss)))
(python-info-statement-starts-block-p)
'after)))))
;; Add """ ... """ pairing to electric-pair-mode.
(add-hook 'post-self-insert-hook