unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Trying to use only tabs for indenting c# files - csharp-mode error?
@ 2012-01-08 13:01 Guido Van Hoecke
  2012-01-08 14:58 ` Óscar Fuentes
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Guido Van Hoecke @ 2012-01-08 13:01 UTC (permalink / raw)
  To: help-gnu-emacs; +Cc: Óscar Fuentes

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!



^ permalink raw reply	[flat|nested] 7+ messages in thread
[parent not found: <mailman.1451.1326027725.15002.help-gnu-emacs@gnu.org>]

end of thread, other threads:[~2012-01-14 18:32 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-01-08 13:01 Trying to use only tabs for indenting c# files - csharp-mode error? Guido Van Hoecke
2012-01-08 14:58 ` Ó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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).