Is there a way to make Emacs indent code using only tabs globally and not spaces. I know of tabify command. I would prefer the automated indentation to use tabs rather than a mixture of tabs and spaces as the default configuration does.
|
Well, to indent with tabs, you'll want to ensure that Or, you could reduce your I urge you to reconsider. Personally, I find working on code indented with tabs to be annoying, especially if they don't appear to be 8 space tabs. (The very worst is code where some lines use spaces, some lines use tabs, and it's clearly not 8 space tabs.) Do us all a favor and just |
|||
|
|
Emacs comes with several predefined styles for C indentation, or you can write your own if none suits your needs. Amongst the standard styles, it seems that you're looking for You can make these settings your default style for C by putting this in your
Make sure that you don't use these settings when collaborating with other people with different preferences, though. In particular, using tabs will make you enemines. If a particular file is to be kept in a particular style, you can use file variables to ensure that everyone who edits the file in Emacs uses the same settings:
If you have a whole project with similarly-indented C files, use directory variables rather than pollute every file. Create a file called
|
|||
|
|
|
Tabs annoy me, but I had to figure out how to make emacs use only tabs to indent so I could work on someone else's code. Here's what worked for me:
I noticed that before messing with anything, when I pressed the tab key, it auto indented by 2 columns. Setting "tab-width" to match the 2 column offset allowed emacs to use tabs when doing auto-format. I was working in nxml mode, but I think this should work for any mode. |
|||
|
|