I often need to use indent-region from indent.el to fix the indentation of code template I have from school. So I made this function :

(defun indent-buffer () (interactive) (if (not (string= major-mode 'python-mode)) (indent-region (point-min) (point-max)) (message "Not in python"))) (global-set-key (kbd "M-i") 'indent-buffer) 

It works well but I recently found out that the default indentation is only 2 space char. I would like to have it inserting 4 chars width TABS. I tried to look in the customization group of indent.el and even used kernel coding style emacs config, which works when I press <TAB> but doesn't when using (indent-buffer).

submitted by /u/Nathoufresh
[link] [comments]