diff options
| author | Stefan Kangas | 2024-09-21 04:41:46 +0200 |
|---|---|---|
| committer | Stefan Kangas | 2024-09-21 14:08:09 +0200 |
| commit | dfecd6037d5ebe5778c40ff7b38bfcbaa3ef779e (patch) | |
| tree | e9b6f41fb0c3a0f034833c10ebc3512d7b387111 /lisp/progmodes/python.el | |
| parent | 7a404e6d510830323381e5febbe61273f341dc20 (diff) | |
| download | emacs-dfecd6037d5ebe5778c40ff7b38bfcbaa3ef779e.tar.gz emacs-dfecd6037d5ebe5778c40ff7b38bfcbaa3ef779e.zip | |
Support electric-layout-mode in python-base-mode
* lisp/progmodes/python.el (python-base-mode): Add support for
'electric-layout-mode'.
Diffstat (limited to 'lisp/progmodes/python.el')
| -rw-r--r-- | lisp/progmodes/python.el | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index b350b5dadf9..5f85fecf016 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el | |||
| @@ -7071,6 +7071,11 @@ implementations: `python-mode' and `python-ts-mode'." | |||
| 7071 | (setq-local electric-indent-inhibit t) | 7071 | (setq-local electric-indent-inhibit t) |
| 7072 | (setq-local electric-indent-chars | 7072 | (setq-local electric-indent-chars |
| 7073 | (cons ?: electric-indent-chars)) | 7073 | (cons ?: electric-indent-chars)) |
| 7074 | (setq-local electric-layout-rules | ||
| 7075 | `((?: . ,(lambda () | ||
| 7076 | (and (zerop (car (syntax-ppss))) | ||
| 7077 | (python-info-statement-starts-block-p) | ||
| 7078 | 'after))))) | ||
| 7074 | 7079 | ||
| 7075 | ;; Add """ ... """ pairing to electric-pair-mode. | 7080 | ;; Add """ ... """ pairing to electric-pair-mode. |
| 7076 | (add-hook 'post-self-insert-hook | 7081 | (add-hook 'post-self-insert-hook |