mirror of
https://github.com/doomemacs/doomemacs.git
synced 2026-04-10 23:31:11 -07:00
refactor!(lib): set-indent-vars!: change signature
BREAKING CHANGE: Changes `set-indent-vars!`s arity from 1+N to 2, so: (set-indent-vars! 'some-mode 'var1 'var2 'var3) To (set-indent-vars! 'some-mode '(var1 var2 var3)) In preparation for a plist argument in the future.
This commit is contained in:
parent
731ea5b17e
commit
1bdcb81feb
4 changed files with 14 additions and 16 deletions
|
|
@ -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.
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue