6

This question already has an answer here:

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?

marked as duplicate by Drew, DoMiNeLa10 Jan 14 at 7:08

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

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.

  • 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 8 '17 at 9:28

Not the answer you're looking for? Browse other questions tagged or ask your own question.