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

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

Re: TAB


From: Kevin Rodgers
Subject: Re: TAB
Date: Mon, 17 Nov 2003 12:42:40 -0700
User-agent: Mozilla/5.0 (X11; U; SunOS i86pc; en-US; rv:0.9.4.1) Gecko/20020406 Netscape6/6.2.2

Dan Anderson wrote:

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 don't even know what you mean by "turn off tabs".  Setting indent-tabs-mode

to nil does exactly what its doc string says: the TAB key, which is bound to
c-indent-command, will always insert spaces and never insert tab characters:

| TAB runs the command c-indent-command
|    which is an interactive compiled Lisp function in `cc-cmds'.
| (c-indent-command &optional ARG)
|
| Indent current line as C code, and/or insert some whitespace.
...
|  [*] The amount and kind of whitespace inserted is controlled by the
|  variable `c-insert-tab-function', which is called to do the actual
|  insertion of whitespace.  Normally the function in this variable
|  just inserts a tab character, or the equivalent number of spaces,
|  depending on the variable `indent-tabs-mode'.


--
Kevin Rodgers



reply via email to

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