diff --git a/lisp/lib/indent.el b/lisp/lib/indent.el index 133659cad..0bfc2c290 100644 --- a/lisp/lib/indent.el +++ b/lisp/lib/indent.el @@ -6,24 +6,26 @@ (defvar doom-indent-excluded-modes '(special-mode org-mode) "Modes not to no-op `doom-set-indent' in.") - (defun set-indent-vars! (modes &rest vars) + (defun set-indent-vars! (modes vars) "Register VARS as the tab-width proxy variables for each of major MODES. `tab-width' and `standard-indent' will be set to match the values of these variables in their respective buffers. Failing that, a best-guess effort will be made to find an appropriate variable to use. -if MODES is `t', VARS will be made to match `tab-width' in all major modes. +If MODES is `t', VARS will be made to match `tab-width' in all major modes. +Both MODES and VARS can be a single symbol or a list thereof. Note that it's not necessary to register indent variables if they end in MODE-ts-mode-indent-offset, MODE-indent-offset, MODE-indent-level, MODE-tab-width, or MODE-basic-offset. It is also not necessary if you have `dtrt-indent' installed and a variable association exists in `dtrt-indent-hook-mapping-list'." - (if (eq modes t) - (put 'tab-width 'indent-vars vars) - (dolist (mode (ensure-list modes)) - (put mode 'indent-vars vars)))) + (let ((vars (ensure-list vars))) + (if (eq modes t) + (put 'tab-width 'indent-vars vars) + (dolist (mode modes) + (put mode 'indent-vars vars))))) (defun doom-indent-var-for-mode (mode) "Try to guess MODE's indent offset variable based on heuristics. diff --git a/modules/lang/data/config.el b/modules/lang/data/config.el index 9bfba65c9..89ba70e86 100644 --- a/modules/lang/data/config.el +++ b/modules/lang/data/config.el @@ -12,7 +12,7 @@ (sp-local-pair 'nxml-mode "<" ">" :post-handlers '(("[d1]" "/")))) (set-company-backend! 'nxml-mode '(company-nxml company-yasnippet)) (set-formatter! 'xmllint '("xmllint" "--format" "-") :modes '(nxml-mode)) - (set-indent-vars! 'nxml-mode 'nxml-child-indent 'nxml-attribute-indent)) + (set-indent-vars! 'nxml-mode '(nxml-child-indent nxml-attribute-indent))) ;;;###package csv-mode diff --git a/modules/lang/fortran/config.el b/modules/lang/fortran/config.el index 2a9a02684..6891d6176 100644 --- a/modules/lang/fortran/config.el +++ b/modules/lang/fortran/config.el @@ -16,14 +16,10 @@ compilation-buffer-name-function #'+fortran-compilation-buffer-name-fn)) (set-popup-rule! "^\\*fortran-compilation" :side 'right :size 0.5 :quit t) - (set-indent-vars! 'f90-mode - 'f90-associate-indent - 'f90-continuation-indent - 'f90-critical-indent - 'f90-do-indent - 'f90-if-indent - 'f90-program-indent - 'f90-type-indent) + (set-indent-vars! + 'f90-mode '(f90-associate-indent f90-continuation-indent + f90-critical-indent f90-do-indent f90-if-indent + f90-program-indent f90-type-indent)) ;; --- LSP Configuration --- ;; (when (modulep! +lsp) diff --git a/modules/lang/fsharp/config.el b/modules/lang/fsharp/config.el index c0d2d6960..1318279e3 100644 --- a/modules/lang/fsharp/config.el +++ b/modules/lang/fsharp/config.el @@ -12,7 +12,7 @@ (set-company-backend! 'fsharp-mode 'fsharp-ac/company-backend)) (set-repl-handler! 'fsharp-mode #'run-fsharp) (set-formatter! 'fantomas '("fantomas" "--stdin") :modes '(fsharp-mode)) - (set-indent-vars! 'fsharp-mode 'fsharp-indent-offset 'fsharp-continuation-offset) + (set-indent-vars! 'fsharp-mode '(fsharp-indent-offset fsharp-continuation-offset)) (map! :localleader :map fsharp-mode-map "b" #'fsharp-ac/pop-gotodefn-stack ; Useful for re-tracing your steps