From 486ee8947f5d800ae45b4d1014254f79da3afcde Mon Sep 17 00:00:00 2001 From: Thomas Voss Date: Fri, 11 Aug 2023 05:01:48 +0200 Subject: emacs: Use default indent-settings if none given MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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’. --- .config/emacs/config.org | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) (limited to '.config/emacs/config.org') 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)) -- cgit v1.2.3