Emacs customization
I'm new to the whole Emacs thing, and one of the things that gets me is that out-of-the-box Emacs doesn't keep you within blocks when programming. I program in mostly Python and开发者_JAVA技巧 C++ and hitting enter sends the cursor back to column 1 on a new line rather than keeping you in the block you're working in. I managed to find this:
(add-hook 'python-mode-hook '(lambda () (define-key python-mode-map "\C-m" 'newline-and-indent)))
Which binds the enter key to newline-and-indent in Python mode, but how do I extend this to cover C/C++ mode too?
The following is from my init.el for xemacs, it might or might not work for emacs:
(add-hook 'c-mode-common-hook
'(lambda ()
(define-key c-mode-base-map (kbd "RET") 'newline-and-indent)))
精彩评论