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

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

Re: Indentation settings problems


From: Alan Mackenzie
Subject: Re: Indentation settings problems
Date: Wed, 23 Sep 2009 11:15:17 +0000
User-agent: Mutt/1.5.9i

Hi, TriKri,

On Wed, Sep 23, 2009 at 01:38:35AM -0700, TriKri wrote:

> I added the code (setq-default tab-width 4 indent-tabs-mode t) to the file
> (\AppData\Roaming\.emacs in my user folder in windows) as you said, but it
> doesn't work. If the indentation is made two times (2 times*2 spaces) it
> will insert a tab instead, so that works, and the tab width is set to 4.

> What confuses me is that the variable standard-indent is set to 4 (and C
> Basic Offset is set to Use style settings), but it still indents with two
> spaces! Isn't standard-indent the right variable to change?

CC Mode doesn't use standard-indent at all.  Sadly.  The great thing
about standards is that there're so many to chose from.  ;-)

> I really have no idea of what more could be wrong. The standard-indent
> is said to be 4 by default, but it indented with 2 spaces right from
> the beginning when I had installed Emacs.

The variables you need set are:
c-basic-offset           ; The size of an indentation - set to 4
indent-tabs-mode         ; Tells Emacs to use tabs rather than spaces -
                         ; set to t ("t" is Lisp's symbol for "true").
tab-width                ; How much space a tab character takes up on the
                         ; screen


Unfortunately, setting up CC Mode's "style variables" is too complicated.
If you don't manage to get this sorted now, it would be best if you could
supply "all the evidence" so that we can get it sorted out.  Believe me,
it WILL work.

So, next time round, please
(i) Post your .emacs file.
(ii) Post a (short) C++ source file which illustrates the problems.  Say
  exactly what is wrong with its indentation, and what you want it to
  look like.
(iii) Tell us EXACTLY what you do, after starting Emacs, to show the
  problem.
(iv) Post your CC Mode configuration here.  To get this, do C-c C-b
  (that's "control-c followed by control-b") in your C++ buffer, and cut
  and paste the information into your post.

> -Kristofer

-- 
Alan Mackenzie (Nuremberg, Germany).




reply via email to

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