Indiana University
University Information Technology Services
What are archived documents?

Login is for authorized groups (e.g., UITS, OVPIT, and TCC) that need access to specialized Knowledge Base documents. Otherwise, simply use the Knowledge Base without logging in.


In Emacs, how can I change tab sizes?

To change the tab size in Emacs, add the following line to your .emacs file: (setq default-tab-width #)

Replace  #  with the number of spaces at which you would like to set your tabs. This will only affect the way your files look in Emacs; if you look at your files with another command or program (like the cat or more commands), the tabs will contain eight spaces. For instance, if you have tabs set to four spaces in Emacs, and write a C program using tabs, it would look like this in Emacs: main() { if (i==7) printf("lucky 7\n"); else printf("try again\n"); return 0; }

But if you use the cat command or the more command to look at it, it would look like this: main() { if (i==7) printf("lucky 7\n"); else printf("try again\n"); return 0; }

This is because standard tabs are set to eight spaces.

Tabs are special characters. If you use a tab, it does not insert as many characters as it takes to get to the 8th, 16th, or so on space. If you replace tabs with the appropriate number of spaces (with the untabify command in Emacs), the file you are working with will look the same when viewed with the cat, more, or vi commands, another Emacs configuration, etc. You can make the tabs convert to spaces before saving a document with M-x untabify, and the spacing will then look acceptable when you use the more or cat commands or when you print the document.

If you want to change the default indentation level when editing source code in Emacs, you should modify the c-basic-offset variable. For example, to cause Emacs C mode to indent four spaces, you would enter:

M-x set-variable RET c-basic-offset RET 4 RET

Note: If you aren't sure how to enter these commands in Emacs, see In Emacs, how are keystrokes denoted?

At Indiana University, for personal or departmental Linux or Unix systems support, see At IU, how do I get support for Linux or Unix?

This is document abde in domain all.
Last modified on August 22, 2008.

I need help with a computing problem

  • Fill out this form to submit your issue to the UITS Support Center.
  • Please note that you must be affiliated with Indiana University to receive support.
  • All fields are required.

Please provide your IU email address. If you currently have a problem receiving email at your IU account, enter an alternate email address.

I have a comment for the Knowledge Base

  • Fill out this form to submit your comment to the IU Knowledge Base.
  • If you are affiliated with Indiana University and need help with a computing problem, please use the I need help with a computing problem section above, or contact your campus Support Center.