1 line
1.2 KiB
Plaintext
1 line
1.2 KiB
Plaintext
<!-- SC_OFF --><div class="md"><p>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 :</p> <pre><code>(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) </code></pre> <p>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 <a href="https://www.kernel.org/doc/html/v4.10/process/coding-style.html#you-ve-made-a-mess-of-it">kernel coding style emacs config</a>, which works when I press <TAB> but doesn't when using (indent-buffer).</p> </div><!-- SC_ON -->   submitted by   <a href="https://www.reddit.com/user/Nathoufresh"> /u/Nathoufresh </a> <br/> <span><a href="https://www.reddit.com/r/emacs/comments/rrzbor/how_to_insert_tabs_with_indentregion/">[link]</a></span>   <span><a href="https://www.reddit.com/r/emacs/comments/rrzbor/how_to_insert_tabs_with_indentregion/">[comments]</a></span> |