Add configuration for electric-indent-mode
This commit is contained in:
parent
b07e4978a2
commit
0dc7fb5684
1 changed files with 19 additions and 0 deletions
|
@ -228,6 +228,25 @@ This is currently the data directory under the
|
|||
|
||||
(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:
|
||||
|
||||
;;;;; Emacs lisp mode:
|
||||
|
|
Loading…
Reference in a new issue