Use spaces instead of tabs to indent
(setq-default indent-tabs-mode nil)
Make emacs turn all characters beyond 80 red.
(add-hook 'c++-mode-hook
'(lambda () (font-lock-set-up-width-warning 80)))
(add-hook 'python-mode-hook
'(lambda () (font-lock-set-up-width-warning 80)))
(defun font-lock-width-keyword (width)
`((,(format "^%s\\(.+\\)" (make-string width ?.))
(1 font-lock-warning-face t))))
(font-lock-add-keywords 'c++-mode (font-lock-width-keyword 80))
(font-lock-add-keywords 'python-mode (font-lock-width-keyword 80)) Make it so that trailing white space is removed on saves.
(add-hook 'write-file-hooks 'delete-trailing-whitespace)
(defun delete-trailing-blank-lines ()
"Deletes all blank lines at the end of the file."
(interactive)
(save-excursion
(save-restriction
(widen)
(goto-char (point-max))
(delete-blank-lines))))
(add-hook 'write-file-hooks 'delete-trailing-blank-lines)