chiark / gitweb /
emacs: more selectively kill electric-indent-mode
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 9 Apr 2017 11:34:01 +0000 (12:34 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 9 Apr 2017 11:34:01 +0000 (12:34 +0100)
home/emacs/ian.el

index e846da6..06909f1 100644 (file)
 (display-time)
 ;
 (set-default 'indent-line-function 'insert-tab)
-(set-default 'electric-indent-mode nil)
+(defun defuse-electrocuting-indent ()
+  "Disable electric-indent-mode if indent-line-function is daft"
+  (and
+   (eq indent-line-function 'insert-tab)
+   (electric-indent-local-mode 0)))
+(add-hook 'after-change-major-mode-hook 'defuse-electrocuting-indent)
+;
 (set-variable 'search-repeat-char 28)
 (set-fringe-mode (cons 0 nil))
 (if (string-match "^19\." emacs-version)