fix(editorconfig): prevent changes to tab-width in org-mode
- Add another measure for preventing changes to tab-width in org-mode. The hook introduced in2757a97
runs too early and could be overwritten by editorconfig. - Fix the hook in2757a97
to run much later, ensuring (as a last resort) no other packages can overwrite tab-width either. Amend:2757a97a30
Ref: #7670
This commit is contained in:
parent
198fe82b6d
commit
43870bf831
2 changed files with 19 additions and 4 deletions
|
@ -48,6 +48,16 @@ extension, try to guess one."
|
|||
(defun +editorconfig-disable-indent-detection-h (props)
|
||||
"Inhibit `dtrt-indent' if an explicit indent_style and indent_size is
|
||||
specified by editorconfig."
|
||||
(when (or (gethash 'indent_style props)
|
||||
(gethash 'indent_size props))
|
||||
(setq doom-inhibit-indent-detection 'editorconfig)))))
|
||||
(when (and (not doom-inhibit-indent-detection)
|
||||
(or (gethash 'indent_style props)
|
||||
(gethash 'indent_size props)))
|
||||
(setq doom-inhibit-indent-detection 'editorconfig)))
|
||||
;; I use a hook over `editorconfig-exclude-modes' because the option
|
||||
;; inhibits all settings, and I only want to inhibit indent_size. Plus modes
|
||||
;; in that option won't apply to derived modes, so we'd have to add *all*
|
||||
;; possible org-mode derivatives to it.
|
||||
(defun +editorconfig-unset-tab-width-in-org-mode-h (props)
|
||||
"A tab-width != 8 is an error state in org-mode, so prevent changing it."
|
||||
(when (and (gethash 'indent_size props)
|
||||
(derived-mode-p 'org-mode))
|
||||
(setq tab-width 8)))))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue