diff options
author | Thomas Voss <mail@thomasvoss.com> | 2023-08-11 05:01:48 +0200 |
---|---|---|
committer | Thomas Voss <mail@thomasvoss.com> | 2023-08-11 05:01:48 +0200 |
commit | 486ee8947f5d800ae45b4d1014254f79da3afcde (patch) | |
tree | cf5e02c739c9c4d29ea9036fc9af4e498a34a80b | |
parent | 15b26c84cbb7b37c7d9e5eb99e6693aba30b6855 (diff) |
emacs: Use default indent-settings if none given
Now you can totally omit ‘:width’ or ‘:tabs’ when setting
‘mm-indentation-settings’. If they’re unset then we default to the
default settings of ‘tab-width’ and ‘indent-tabs-mode’.
-rw-r--r-- | .config/emacs/config.org | 23 |
1 files changed, 8 insertions, 15 deletions
diff --git a/.config/emacs/config.org b/.config/emacs/config.org index 2ce2d82..c5d2759 100644 --- a/.config/emacs/config.org +++ b/.config/emacs/config.org @@ -769,20 +769,13 @@ with a custom function that reads a list of mode-specific indentation settings. indent-tabs-mode t) (defvar mm-indentation-settings - '((c-mode :width 8 :tabs t - :extra-vars (c-basic-offset)) - (css-mode :width 8 :tabs t - :extra-vars (css-basic-offset)) - (emacs-lisp-mode :width 8 :tabs nil) - (go-mode :width 8 :tabs t) - (json-mode :width 8 :tabs t) - (lisp-mode :width 8 :tabs nil) - (makefile-mode :width 8 :tabs t) - (python-mode :width 4 :tabs t - :extra-vars (python-indent-offset)) + '((c-mode :extra-vars (c-basic-offset)) + (css-mode :extra-vars (css-basic-offset)) + (emacs-lisp-mode :tabs nil) + (lisp-mode :tabs nil) + (python-mode :width 4 :tabs t :extra-vars (python-indent-offset)) (rust-mode :width 4 :tabs t) - (sgml-mode :width 4 :tabs t - :extra-vars (sgml-basic-offset)) + (sgml-mode :width 4 :tabs t :extra-vars (sgml-basic-offset)) (xml-mode :width 4 :tabs t)) "A list of per-mode indentation settings. Each list contains a major-mode, a tab-width, whether or not to indent using tabs, and an optional list of @@ -796,8 +789,8 @@ with a custom function that reads a list of mode-specific indentation settings. (mm-for-each mm-indentation-settings (let* ((mode (car x)) (args (cdr x)) - (width (plist-get args :width)) - (tabs (plist-get args :tabs)) + (width (or (plist-get args :width) (default-value 'tab-width))) + (tabs (or (plist-get args :tabs) (default-value 'indent-tabs-mode))) (extra (plist-get args :extra-vars)) (callback (λ (indent-tabs-mode (or tabs -1)) |