* (fwd) Re: Trying to use only tabs for indenting c# files - csharp-mode error?
@ 2012-01-11 9:34 Alan Mackenzie
2012-01-11 12:38 ` Guido Van Hoecke
0 siblings, 1 reply; 6+ messages in thread
From: Alan Mackenzie @ 2012-01-11 9:34 UTC (permalink / raw)
To: help-gnu-emacs
-- 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 --
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: (fwd) Re: Trying to use only tabs for indenting c# files - csharp-mode error?
2012-01-11 9:34 (fwd) Re: Trying to use only tabs for indenting c# files - csharp-mode error? Alan Mackenzie
@ 2012-01-11 12:38 ` Guido Van Hoecke
2012-01-11 14:26 ` Óscar Fuentes
0 siblings, 1 reply; 6+ messages in thread
From: Guido Van Hoecke @ 2012-01-11 12:38 UTC (permalink / raw)
To: help-gnu-emacs
Hi Alan,
On Wed, Jan 11, 2012 at 10:34, Alan Mackenzie <acm@muc.de> wrote:
>> The tab-width is 8,
>> indent-tabs-mode is t
>> and still, it uses spaces to indent, and only two of them.
>> 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. =C2=A0:-)
> However, for your specific problem, the variable c-basic-offset needs
> to be set to 8. =C2=A0Currently, it looks like it is 2.
That was the missing piece of information!
With c-basic-offset set to 8, the requested behaviour is obtained.
Thanks Alan,
Guido
--
That must be wonderful: I don't understand it at all.
-- Moliere
http://vanhoecke.org ... and go2 places!
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: (fwd) Re: Trying to use only tabs for indenting c# files - csharp-mode error?
2012-01-11 12:38 ` Guido Van Hoecke
@ 2012-01-11 14:26 ` Óscar Fuentes
2012-01-11 15:22 ` Guido Van Hoecke
0 siblings, 1 reply; 6+ messages in thread
From: Óscar Fuentes @ 2012-01-11 14:26 UTC (permalink / raw)
To: Guido Van Hoecke; +Cc: Alan Mackenzie, help-gnu-emacs
Guido Van Hoecke <guivho@gmail.com> writes:
>>> The tab-width is 8,
>>> indent-tabs-mode is t
>>> and still, it uses spaces to indent, and only two of them.
>>> 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. :-)
Alan: there are mentions to cc-mode all around csharp-mode.el. Your name
is prominently mentioned on the Acknowledgements section too. It would
be even nicer if CC Mode were capitalized correctly, though. :-)
>> However, for your specific problem, the variable c-basic-offset needs
>> to be set to 8. Currently, it looks like it is 2.
>
> That was the missing piece of information!
>
> With c-basic-offset set to 8, the requested behaviour is obtained.
The function hook I recommended you to try on a previous message
activated the "C#" style, which is defined into csharp-mode:
(defun my-csharp-mode-fn ()
(c-set-style "C#")
(setq tab-width 4)
(setq indent-tabs-mode t))
(add-hook 'csharp-mode-hook 'my-csharp-mode-fn)
It sets c-basic-offset to 4. So with that setup you should see tabs
instead of spaces too. I wonder why you didn't.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: (fwd) Re: Trying to use only tabs for indenting c# files - csharp-mode error?
2012-01-11 14:26 ` Óscar Fuentes
@ 2012-01-11 15:22 ` Guido Van Hoecke
2012-01-11 17:42 ` Óscar Fuentes
0 siblings, 1 reply; 6+ messages in thread
From: Guido Van Hoecke @ 2012-01-11 15:22 UTC (permalink / raw)
To: Óscar Fuentes; +Cc: Alan Mackenzie, help-gnu-emacs
Hi Óscar,
On Wed, Jan 11, 2012 at 15:26, Óscar Fuentes <ofv@wanadoo.es> wrote:
> Guido Van Hoecke <guivho@gmail.com> writes:
>
>>>> The tab-width is 8,
>>>> indent-tabs-mode is t
>>>> and still, it uses spaces to indent, and only two of them.
>>>> 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. :-)
>
> Alan: there are mentions to cc-mode all around csharp-mode.el. Your name
> is prominently mentioned on the Acknowledgements section too. It would
> be even nicer if CC Mode were capitalized correctly, though. :-)
>
>>> However, for your specific problem, the variable c-basic-offset needs
>>> to be set to 8. Currently, it looks like it is 2.
>>
>> That was the missing piece of information!
>>
>> With c-basic-offset set to 8, the requested behaviour is obtained.
>
> The function hook I recommended you to try on a previous message
> activated the "C#" style, which is defined into csharp-mode:
>
> (defun my-csharp-mode-fn ()
> (c-set-style "C#")
> (setq tab-width 4)
> (setq indent-tabs-mode t))
>
> (add-hook 'csharp-mode-hook 'my-csharp-mode-fn)
>
> It sets c-basic-offset to 4. So with that setup you should see tabs
> instead of spaces too. I wonder why you didn't.
Well, on the one hand, c-basic-offset should be 8 for this case, but on the
other hand, emacs complains with "Undefined style: C#" when entering c# mode.
Kind regards,
Guido
--
"And what will you do when you grow up to be as big as me?"
asked the father of his little son.
"Diet."
http://vanhoecke.org ... and go2 places!
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: (fwd) Re: Trying to use only tabs for indenting c# files - csharp-mode error?
2012-01-11 15:22 ` Guido Van Hoecke
@ 2012-01-11 17:42 ` Óscar Fuentes
2012-01-11 20:04 ` Guido Van Hoecke
0 siblings, 1 reply; 6+ messages in thread
From: Óscar Fuentes @ 2012-01-11 17:42 UTC (permalink / raw)
To: Guido Van Hoecke; +Cc: Alan Mackenzie, help-gnu-emacs
Guido Van Hoecke <guivho@gmail.com> writes:
>>>> However, for your specific problem, the variable c-basic-offset needs
>>>> to be set to 8. Currently, it looks like it is 2.
>>>
>>> That was the missing piece of information!
>>>
>>> With c-basic-offset set to 8, the requested behaviour is obtained.
>>
>> The function hook I recommended you to try on a previous message
>> activated the "C#" style, which is defined into csharp-mode:
>>
>> (defun my-csharp-mode-fn ()
>> (c-set-style "C#")
>> (setq tab-width 4)
>> (setq indent-tabs-mode t))
>>
>> (add-hook 'csharp-mode-hook 'my-csharp-mode-fn)
>>
>> It sets c-basic-offset to 4. So with that setup you should see tabs
>> instead of spaces too. I wonder why you didn't.
>
> Well, on the one hand, c-basic-offset should be 8 for this case,
No. The hook sets tab-width to 4 and the C# style indents by 4 columns,
which was precisely what you wanted, IIRC.
> but on the other hand, emacs complains with "Undefined style: C#" when
> entering c# mode.
My version of csharp-mode.el is 0.8.6, from May 2011. It defines the C#
style at line 5219:
(c-add-style "C#"
...
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: (fwd) Re: Trying to use only tabs for indenting c# files - csharp-mode error?
2012-01-11 17:42 ` Óscar Fuentes
@ 2012-01-11 20:04 ` Guido Van Hoecke
0 siblings, 0 replies; 6+ messages in thread
From: Guido Van Hoecke @ 2012-01-11 20:04 UTC (permalink / raw)
To: Óscar Fuentes; +Cc: Alan Mackenzie, help-gnu-emacs
Hi
On Wed, Jan 11, 2012 at 18:42, Óscar Fuentes <ofv@wanadoo.es> wrote:
> Guido Van Hoecke <guivho@gmail.com> writes:
>
>>>>> However, for your specific problem, the variable c-basic-offset needs
>>>>> to be set to 8. Currently, it looks like it is 2.
>>>>
>>>> That was the missing piece of information!
>>>>
>>>> With c-basic-offset set to 8, the requested behaviour is obtained.
>>>
>>> The function hook I recommended you to try on a previous message
>>> activated the "C#" style, which is defined into csharp-mode:
>>>
>>> (defun my-csharp-mode-fn ()
>>> (c-set-style "C#")
>>> (setq tab-width 4)
>>> (setq indent-tabs-mode t))
>>>
>>> (add-hook 'csharp-mode-hook 'my-csharp-mode-fn)
>>>
>>> It sets c-basic-offset to 4. So with that setup you should see tabs
>>> instead of spaces too. I wonder why you didn't.
>>
>> Well, on the one hand, c-basic-offset should be 8 for this case,
>
> No. The hook sets tab-width to 4 and the C# style indents by 4 columns,
> which was precisely what you wanted, IIRC.
Not really, the technical lead wants only indentation by means of tabs, and
they set the display width to 4. My understanding is that tab-width 4 would
lead to using spaces for the trailing 'odd' tab (e.g. create 3 indentations
with one tab and 4 spaces).
>
>> but on the other hand, emacs complains with "Undefined style: C#" when
>> entering c# mode.
>
> My version of csharp-mode.el is 0.8.6, from May 2011. It defines the C# style
> at line 5219:
>
> (c-add-style "C#" ...
Same version here, still that's the error message.
Kind Regards,
Guido
--
Put a pot of chili on the stove to simmer.
Let it simmer. Meanwhile, broil a good steak.
Eat the steak. Let the chili simmer. Ignore it.
-- Recipe for chili from Allan Shrivers, former governor
of Texas.
http://vanhoecke.org ... and go2 places!
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2012-01-11 20:04 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-01-11 9:34 (fwd) Re: Trying to use only tabs for indenting c# files - csharp-mode error? Alan Mackenzie
2012-01-11 12:38 ` 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
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).