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

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

(fwd) Re: Trying to use only tabs for indenting c# files - csharp-mode e


From: Alan Mackenzie
Subject: (fwd) Re: Trying to use only tabs for indenting c# files - csharp-mode error?
Date: 11 Jan 2012 09:34:57 -0000
User-agent: tin/1.9.6-20101126 ("Burnside") (UNIX) (FreeBSD/8.2-STABLE (amd64))

-- forwarded message --
Path: news.muc.de!not-for-mail
From: Alan Mackenzie <acm@muc.de>
Newsgroups: gnu.emacs.help
Subject: Re: Trying to use only tabs for indenting c# files - csharp-mode error?
Date: Mon, 9 Jan 2012 09:46:45 +0000 (UTC)
Organization: muc.de e.V.
Lines: 115
Message-ID: <jeed25$rk8$1@colin.muc.de>
References: <mailman.1451.1326027725.15002.help-gnu-emacs@gnu.org>
NNTP-Posting-Host: news.muc.de
X-Trace: colin.muc.de 1326102405 28296 193.149.48.2 (9 Jan 2012 09:46:45 GMT)
X-Complaints-To: news-admin@muc.de
NNTP-Posting-Date: Mon, 9 Jan 2012 09:46:45 +0000 (UTC)
User-Agent: tin/1.9.6-20101126 ("Burnside") (UNIX) (FreeBSD/8.2-STABLE (amd64))
Xref: news.muc.de gnu.emacs.help:183926

Guido Van Hoecke <guivho@gmail.com> wrote:
> Hi,

> Objective: use only tabs for indenting c# files

[ .... ]

> Ultimately, I want the tab-width set to 4, but for now I just want to
> leave or set it to 8:

>        M-x set-variable [enter] tab-width [enter] 8 [enter]

> I will use following legend when showing file content:
> # represents a leading tab
> + represents a leading empty space (following a preceding tab)
> = represents a leading space character

> Here's the source file:

> namespace Application
> {
> #+++++++public class MyClass
> #+++++++{
> #+++++++#+++++++public MyClass ()
> #+++++++#+++++++{
> #+++++++#+++++++}
> #+++++++}
> }

> Deleting the first tab changes it to:

> namespace Application
> {
> =======public class MyClass
> #+++++++{
> #+++++++#+++++++public MyClass ()
> #+++++++#+++++++{
> #+++++++#+++++++}
> #+++++++}
> }

> Hitting tab key while point is the 'public class' line changes it to:

> namespace Application
> {
> ==public class MyClass
> #+++++++{
> #+++++++#+++++++public MyClass ()
> #+++++++#+++++++{
> #+++++++#+++++++}
> #+++++++}
> }

> I can't help but feeling that this is in error!

> The tab-width is 8,
> indent-tabs-mode is t
> and still, it uses spaces to indent, and only two of them.

You have told it to use a tab instead of 8 spaces.  You haven't told
it how far to indent, though.

[ .... ]

> And finally"

>        M-<
>        C-SPC
>        M->
>        <tab>

> produces following result:


> namespace Application
> {
> ==public class MyClass
> =={
> ====public string MyString;
> ====public MyClass ()
> ===={
> ====}
> ==}
> }

> So obviously neither tab-width nor indent-tabs-mode are obeyed nor
> respected!

> Please advise,

C# mode is derived from CC Mode, so read the CC Mode manual.  :-)
However, for your specific problem, the variable c-basic-offset needs
to be set to 8.  Currently, it looks like it is 2.

> ;;; csharp-mode.el --- C# mode derived mode
> 
> ;; Author     : Dylan R. E. Moonfire (original)
> ;; Maintainer : Dino Chiesa <dpchiesa@hotmail.com>
> ;; Created    : Feburary 2005
> ;; Modified   : May 2011
> ;; Version    : 0.8.6
> ;; Keywords   : c# languages oop mode
> ;; X-URL      : http://code.google.com/p/csharpmode/
> ;; Last-saved : <2011-May-21 20:28:30>

Perhaps you could contact Dino Chiesa and ask him to include "CC Mode"
(with that capitalisation, please) somewhere in that information.

> TIA,


> Guido

-- 
Alan Mackenzie (Nuremberg, Germany).
-- end of forwarded message --



reply via email to

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