- (if electric-indent-mode
- (add-hook 'post-self-insert-hook
- #'electric-indent-post-self-insert-function)
- (remove-hook 'post-self-insert-hook
- #'electric-indent-post-self-insert-function))
- ;; FIXME: electric-indent-mode and electric-layout-mode interact
- ;; in non-trivial ways. It turns out that electric-indent-mode works
- ;; better if it is run *after* electric-layout-mode's hook.
- (when (memq #'electric-layout-post-self-insert-function
- (memq #'electric-indent-post-self-insert-function
- (default-value 'post-self-insert-hook)))
- (remove-hook 'post-self-insert-hook
- #'electric-layout-post-self-insert-function)
+ (if (not electric-indent-mode)
+ (remove-hook 'post-self-insert-hook
+ #'electric-indent-post-self-insert-function)
+ ;; post-self-insert-hooks interact in non-trivial ways.
+ ;; It turns out that electric-indent-mode generally works better if run
+ ;; late, but still before blink-paren.