Emacs: Make dtrt and editorconfig play together
Alan Pearce alan.pearce@spotcap.com
Fri, 06 May 2016 12:51:50 +0200
1 files changed, 6 insertions(+), 3 deletions(-)
jump to
M tag-emacs/emacs.d/init.org → tag-emacs/emacs.d/init.org
@@ -738,9 +738,12 @@ #+BEGIN_SRC emacs-lisp (use-package dtrt-indent :config (progn - (dtrt-indent-mode 1) - (add-hook 'editorconfig-custom-hooks (lambda () - (dtrt-indent-undo))) + (defun ap/dtrt-adapt-if-needed () + (unless editorconfig-mode + (dtrt-adapt))) + (if (fboundp #'editorconfig-mode) + (add-hook 'after-change-major-mode-hook #'ap/dtrt-adapt-if-needed) + (add-hook 'after-change-major-mode-hook #'dtrt-indent-adapt)) (defadvice dtrt-indent-try-set-offset (after toggle-smart-tabs activate) (smart-tabs-mode (or indent-tabs-mode -1))))) #+END_SRC