Force Emacs to use tabs
So, I’m not wasn’t really a fan of using tabs to indent code. I like spaces. It means that the code always look the same no matter what editor or OS you’re viewing it in but since using tabs (as is the codestyle at $work), I have come to [kinda] like it and I can see the reasoning behind it.
When editing code, I like using one of two editor - emacs or vim. I can use vim to a pretty good standard but I still love emacs as I don’t like the modal editing you get with vim (having to enter edit mode to type). I like just opening the document and code away. So to cut a long story short, to make emacs always use tabs (instead of spaces) to indent code, I added these settings to my ~/.emacs file:
;; Turn on tabs (setq indent-tabs-mode t) (setq-default indent-tabs-mode t) ;; Bind the TAB key (global-set-key (kbd "TAB") 'self-insert-command) ;; Set the tab width (setq default-tab-width 4) (setq tab-width 4) (setq c-basic-indent 4)
About this entry
You’re currently reading “Force Emacs to use tabs,” an entry on CreativeAdea
- 31.07.10 / 1am