6

C-j used to newline-and-indent, now it doesn't indent anymore, but RET does. Now since I upgraded to Emacs 24 they are swapped. Is there any way to revert this?

Andreas Jansson
  • 243
  • 1
  • 10

1 Answers1

3

You can simply bind the keys to the functions you want, by adding this code to your init file:

(global-set-key (kbd "C-j") #'newline-and-indent)
(global-set-key (kbd "<return>") #'newline)

You might want a different function for return, depending on your desired behavior.

zck
  • 8,984
  • 2
  • 31
  • 65
  • with this I cannot use C-x b anymore because pressing return instead of selecting the file, emacs adds a newline to the minibuffer – Nisba Aug 08 '17 at 09:28