emacs/var/elfeed/db/data/5f/5f1764b43ad65891540dc7c4c08f118dfa7f1f44
2022-01-03 12:49:32 -06:00

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 &#39;python-mode)) (indent-region (point-min) (point-max)) (message &quot;Not in python&quot;))) (global-set-key (kbd &quot;M-i&quot;) &#39;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 &lt;TAB&gt; but doesn&#39;t when using (indent-buffer).</p> </div><!-- SC_ON --> &#32; submitted by &#32; <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> &#32; <span><a href="https://www.reddit.com/r/emacs/comments/rrzbor/how_to_insert_tabs_with_indentregion/">[comments]</a></span>