all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Alan Mackenzie <acm@muc.de>
To: help-gnu-emacs@gnu.org
Subject: (fwd) Re: Trying to use only tabs for indenting c# files - csharp-mode error?
Date: 11 Jan 2012 09:34:57 -0000	[thread overview]
Message-ID: <20120111093457.53318.qmail@mail.muc.de> (raw)

-- 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	other threads:[~2012-01-11  9:34 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-11  9:34 Alan Mackenzie [this message]
2012-01-11 12:38 ` (fwd) Re: Trying to use only tabs for indenting c# files - csharp-mode error? Guido Van Hoecke
2012-01-11 14:26   ` Óscar Fuentes
2012-01-11 15:22     ` Guido Van Hoecke
2012-01-11 17:42       ` Óscar Fuentes
2012-01-11 20:04         ` Guido Van Hoecke

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120111093457.53318.qmail@mail.muc.de \
    --to=acm@muc.de \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.