Add configuration for electric-indent-mode

This commit is contained in:
Tom Willemse 2016-08-02 13:59:14 +02:00
parent b07e4978a2
commit 0dc7fb5684

View file

@ -228,6 +228,25 @@ This is currently the data directory under the
(ensure-library paredit) (ensure-library paredit)
;;;;; Electric indent mode:
;;; By default `electric-indent-mode' is enabled globally, but I
;;; prefer to enable it locally where I need it.
(electric-indent-mode -1)
;;; Since Emacs 24 `electric-indent-mode' switches the behavior of the
;;; C-j and RET keys. I prefer the original situation:
(defun oni:switch-newline-keys ()
"Switch the C-j and RET keys in the local buffer."
(if electric-indent-mode
(progn
(local-set-key (kbd "C-j") 'newline)
(local-set-key (kbd "RET") 'electric-newline-and-maybe-indent))
(local-unset-key (kbd "C-j"))
(local-unset-key (kbd "RET"))))
(add-hook 'electric-indent-local-mode-hook #'oni:switch-newline-keys)
;;;; Major modes: ;;;; Major modes:
;;;;; Emacs lisp mode: ;;;;; Emacs lisp mode: