Add automatic indentation-detection (experimental)

Editorconfig is given precedence. If it successfully sets an
indent_style or indent_size for the current buffer, automatic
indentation detection will be disabled.
This commit is contained in:
Henrik Lissner 2018-05-18 01:28:40 +02:00
parent b1dce548ad
commit 3d0745c3ec
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395
3 changed files with 21 additions and 0 deletions

View file

@ -39,6 +39,12 @@ extension, try to guess one."
(apply orig-fn args)))
(advice-add #'editorconfig-call-editorconfig-exec :around #'doom*editorconfig-smart-detection)
(defun +editorconfig|disable-indent-detection (props)
(when (or (gethash 'indent_style props)
(gethash 'indent_size props))
(setq doom-inhibit-indent-detection t)))
(add-hook 'editorconfig-custom-hooks #'+editorconfig|disable-indent-detection)
;; Editorconfig makes indentation too rigid in Lisp modes, so tell
;; editorconfig to ignore indentation there. I prefer dynamic indentation
;; support built into Emacs.