I'm using emacs 24.3 and Ubuntu 12.04 LTS. How do I make emacs automatically indent lines in Python, like in IDLE? Currently, it does not do that.
Also, in general, how would I do this for any programming language, say, Java or c++?
I'm using emacs 24.3 and Ubuntu 12.04 LTS. How do I make emacs automatically indent lines in Python, like in IDLE? Currently, it does not do that.
Also, in general, how would I do this for any programming language, say, Java or c++?
Try electric-indent-mode.  It will be ebabled by default in Emacs-24.4.  But note that the version in 24.3 probably doesn't work too well in python-mode buffers.
(electric-indent-mode 1) in your ~/.emacs file.You can try other python modes, like emacs-for-python or elpy, as given by this doc: http://wikemacs.org/index.php/Python (though the default mode works fine for me on the same config).
You can install them with package.el (M-x package-install RET elpy RET) and call them as explained.
newline) and indent. This combo is currently done for me with reindent-then-newline-and-indent. You can investigate with the help (see C-h ?).Open a newline with C-j, you should get the indentation.
C-j, because that frees up the tab key for GitHub Copilot!