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

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

Re: TAB


From: Sean Richards
Subject: Re: TAB
Date: Tue, 18 Nov 2003 08:49:19 +1300
User-agent: Gnus/5.1002 (Gnus v5.10.2) Emacs/21.3 (gnu/linux)

Dan Anderson <dan@mathjunkies.com> writes:

> On Mon, 2003-11-17 at 12:31, Kevin Rodgers wrote:
>> David Rasmussen wrote:
>> 
>> > When I edit java-files, most of the times emacs inserts spaces when I 
>> > press TAB to indent something. But sometimes I've found it inserts a TAB 
>> > character instead. Why?
>> 
>> 
>> C-h v indent-tabs-mode
>> 
>> > How can I turn it off? I never want TAB 
>> > characters when editing Java or C++ source code files.
>> 
>> (setq-default indent-tabs-mode nil)  ; for all modes, or
>> 
>> (add-hook 'java-mode-hook            ; for just java mode
>>        (lambda () (setq indent-tabs-mode nil)))
>
> That tells him how to turn of tabs.  Is there any way to change tabs to
> spaces?  i.e. when tabbing insert 4 spaces instead of a tab (if tabs
> default to 4 spaces long)?

I use in my ~/.emacs
 
(setq-default tab-width 4)
(setq-default indent-tabs-mode nil)

That makes Emacs insert 4 spaces instead of a tab. 

>From the Emacs manual  ....

Tabs vs. Spaces
===============

   Emacs normally uses both tabs and spaces to indent lines.  If you
prefer, all indentation can be made from spaces only.  To request this,
set `indent-tabs-mode' to `nil'.  This is a per-buffer variable, so
altering the variable affects only the current buffer, but there is a
default value which you can change as well.  *Note Locals::.

Sean

-- 
"Hver sin smak", sa vintapperen, han drakk mens de andre sloss.


reply via email to

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