help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Unable to Set Tab Width


From: Bijan Soleymani
Subject: Re: Unable to Set Tab Width
Date: 21 Mar 2003 08:39:10 -0500
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2

Chris <matrix2468REMOVETHISTOREPLY@cox.net> writes:

> Despite countless efforts, I cannot set the tab width
> in emacs to 2 spaces instead of 4.
> 
>  >uname -a
> HP-UX host B.11.00 U 9000/785 2007718834 unlimited-user license
> 
>  >/usr/local/bin/emacs-21.2.1
>  >cat .emacs
> (setq default-tab-width 2)
> 
> I thought the above command would set the tab width to 2,
> but it is stuck at 4!
> 
> That is all I have in the emacs file.
> 
> I did have that long list of tab stops such as 2 4 6 8 ...
> but that didn't help.
> 
> Any suggestions?
> 
> It's driving me nuts while editing perl or java.
> 
> I thought emacs was configurable... no?
> 
> I have the same trouble with a Win32 version of emacs (20.7.1).
> 

There is a difference between tab stops, tab-width, and what the "tab"
key does. The tab keys behaviour depends on which mode you are on,
what time of day it is, etc :).

If you really want to set tab stops then consult the emacs manual
under the heading "tab stops" under the section "indentation". It
recommends running M-x edit-tab-stops. Btw it says at the bottom of
that info node that tab-to-tab-stops have nothing to do with
displaying tab characters. There is a link to the secton on
customizing the display, where it says that "tab-width" controls how
tabs are shown, but doesn't affect the tab stops. I think what that
means is that a tab character will display as tab-width, but indenting
will use multiple tabs and/or spaces to indent to the next tab stop.

Tab width only affect 'tab' character (i.e. \t) in the buffer. But
many programming modes use a combination of spaces and tabs. I don't
know if this is the problem you're having.

Hope that helps,

Bijan


reply via email to

[Prev in Thread] Current Thread [Next in Thread]