summary refs log tree commit diff stats
path: root/tag-emacs/emacs.d/init.org
diff options
context:
space:
mode:
authorAlan Pearce2016-05-06 12:51:50 +0200
committerAlan Pearce2016-05-06 12:51:50 +0200
commitdaeb01f134721b5a6b75c5578ed7cf5309727d02 (patch)
tree527faf4f790f8637a491049db7d24077abfb71f6 /tag-emacs/emacs.d/init.org
parent2ae305459c747e70e39b23af4f92e9faf398126d (diff)
downloadnixfiles-daeb01f134721b5a6b75c5578ed7cf5309727d02.tar.lz
nixfiles-daeb01f134721b5a6b75c5578ed7cf5309727d02.tar.zst
nixfiles-daeb01f134721b5a6b75c5578ed7cf5309727d02.zip
Emacs: Make dtrt and editorconfig play together
Diffstat (limited to 'tag-emacs/emacs.d/init.org')
-rw-r--r--tag-emacs/emacs.d/init.org9
1 files changed, 6 insertions, 3 deletions
diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org
index b9518d34..65a1c437 100644
--- a/tag-emacs/emacs.d/init.org
+++ b/tag-emacs/emacs.d/init.org
@@ -738,9 +738,12 @@ guesses the correct settings for me.
 #+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