diff options
author | Thomas Voss <mail@thomasvoss.com> | 2024-10-21 15:05:17 +0200 |
---|---|---|
committer | Thomas Voss <mail@thomasvoss.com> | 2024-10-21 15:05:17 +0200 |
commit | 58b7d5dd55f9f401c41b9dda8291a2f98186cfd7 (patch) | |
tree | 98a4e3ec2badc49a070569fc699bc7f25e8792b9 /.config/emacs/modules/mm-editing.el | |
parent | 87deb7427b1560c18ee1007fa0eb2b4bcd8162e7 (diff) |
emacs: Fixes for ‘python-mode’
Diffstat (limited to '.config/emacs/modules/mm-editing.el')
-rw-r--r-- | .config/emacs/modules/mm-editing.el | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/.config/emacs/modules/mm-editing.el b/.config/emacs/modules/mm-editing.el index e6b3801..5811e25 100644 --- a/.config/emacs/modules/mm-editing.el +++ b/.config/emacs/modules/mm-editing.el @@ -70,10 +70,15 @@ The indentation settings are set based on the configured values in (spaces (plist-member plist :spaces)) (width (plist-member plist :width)) (extras (plist-member plist :extras))) - (when spaces - (indent-tabs-mode (and (cadr spaces) -1))) - (when width - (setq-local tab-width (cadr width))) + ;; Some modes like ‘python-mode’ explicitly set ‘tab-width’ and + ;; ‘indent-tabs-mode’ so we must override them explicitly. + (setq-local + indent-tabs-mode (if spaces + (and (cadr spaces) -1) + (default-value 'indent-tabs-mode)) + tab-width (if width + (cadr width) + (default-value 'tab-width))) (when extras (setq extras (cadr extras)) (when (symbolp extras) |