all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Guido Van Hoecke <guivho@gmail.com>
To: help-gnu-emacs@gnu.org
Cc: "Óscar Fuentes" <ofv@wanadoo.es>
Subject: Trying to use only tabs for indenting c# files - csharp-mode error?
Date: Sun, 8 Jan 2012 14:01:38 +0100	[thread overview]
Message-ID: <CAEySM9GNH9Fgb17KdPvTiWp+tqbY5eXyxeEkvey5CeFqkbMj8A@mail.gmail.com> (raw)

Hi,

Objective: use only tabs for indenting c# files

I start with an 'emacs -Q' session.

	C-x C-f MyClass.cs

(This file has been created with MonoDevelop, and uses only tabs for
indentation, and - in MonoDevelop - the tab width is set to 4.)

As expected, MyClass.cs is shown in fundamental mode.

We want to see the whitespace, so

	M-x whitespace-mode

This shows clearly that only tabs are used for indentation.

So lets load csharp-mode and select that mode:

	M-x load-file csharp-mode.el
	M-X csharp-mode

That removes the whitespace visualisation, so reactivate it:

	M-x whitespace-mode

Tell emacs that it should use tabs for indenting:

	M-x set-variable [enter] indent-tabs-mode [enter] t [enter]

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.

For the record, the emacs and csharp-mode versions:

GNU Emacs 23.3.1 (x86_64-apple-darwin, NS apple-appkit-1038.36)
 of 2011-12-13 on bob.porkrind.org

 ;;; 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>

So one more test: insert a 'public string MyString' line
before the 'public Myclass()' line by positioning point after the second
{ and just typing:

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

The leading tab is respected and replicated, but the new line is then
indented by two spaces rather than by an extra tab!?

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,

TIA,


Guido

--
If I had only known, I would have been a locksmith.
		-- Albert Einstein

http://vanhoecke.org ... and go2 places!



             reply	other threads:[~2012-01-08 13:01 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-08 13:01 Guido Van Hoecke [this message]
2012-01-08 14:58 ` Trying to use only tabs for indenting c# files - csharp-mode error? Óscar Fuentes
2012-01-08 15:49   ` Guido Van Hoecke
2012-01-08 17:29 ` PJ Weisberg
2012-01-08 19:06 ` Óscar Fuentes
2012-01-08 19:19   ` Guido Van Hoecke
     [not found] <mailman.1451.1326027725.15002.help-gnu-emacs@gnu.org>
2012-01-14 18:32 ` Uday Reddy

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=CAEySM9GNH9Fgb17KdPvTiWp+tqbY5eXyxeEkvey5CeFqkbMj8A@mail.gmail.com \
    --to=guivho@gmail.com \
    --cc=help-gnu-emacs@gnu.org \
    --cc=ofv@wanadoo.es \
    /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.