unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Indentation settings problems
@ 2009-09-19 10:46 TriKri
  2009-09-20  1:55 ` Bernardo
                   ` (3 more replies)
  0 siblings, 4 replies; 18+ messages in thread
From: TriKri @ 2009-09-19 10:46 UTC (permalink / raw)
  To: Help-gnu-emacs


Hi. I'm having some trouble getting the size of the indentation right. I'm
writing a .cpp-file, but I guess the indentation will work in about the same
way as for a .c-file. I'm running windows (more specifically windows 7), and
I've just installed GNU Emacs 23.1.1. The indentation is 2 spaces right now.
I prefer a tab instead (with tab width 4), or possibly 4 spaces if tab is
not possible. Here is what I've tried: I enter the options, go to
Editing->Indent, where I find that the variable "Standard Indent" is set to
4. I get 2 spaces when I indent, why not 4? Okay I get 2 spaces, so how do I
change it? I have also tried changing "C Basic Offset" in
Programming->Languages->C to "Override style settings: 4", but that doesn't
work either. It's still indenting with 2 spaces.

So, I would prefer 4 spaces instead of 2, or even better, a tab, and having
the tab width set to 4 (how I now can change the tab width) so someone else
with another text editor can apply another indentation size on my code by
simply setting the tab width in their editor. Can someone tell me how to
change this? And I'm an Emacs newbie, so you will have to tell me exactly
which variables to change and how to change them.

Thanks in advance

-Kristofer
-- 
View this message in context: http://www.nabble.com/Indentation-settings-problems-tp25520490p25520490.html
Sent from the Emacs - Help mailing list archive at Nabble.com.





^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: Indentation settings problems
  2009-09-19 10:46 Indentation settings problems TriKri
@ 2009-09-20  1:55 ` Bernardo
  2009-09-20  2:18   ` Bernardo
                     ` (4 more replies)
  2009-10-01 22:44 ` TriKri
                   ` (2 subsequent siblings)
  3 siblings, 5 replies; 18+ messages in thread
From: Bernardo @ 2009-09-20  1:55 UTC (permalink / raw)
  To: TriKri; +Cc: Help-gnu-emacs



TriKri said the following on 19/09/09 20:46:
> Hi. I'm having some trouble getting the size of the indentation right. I'm
> writing a .cpp-file, but I guess the indentation will work in about the same
> way as for a .c-file. I'm running windows (more specifically windows 7), and
> I've just installed GNU Emacs 23.1.1. The indentation is 2 spaces right now.
> I prefer a tab instead (with tab width 4), or possibly 4 spaces if tab is
> not possible. Here is what I've tried: I enter the options, go to
> Editing->Indent, where I find that the variable "Standard Indent" is set to
> 4. I get 2 spaces when I indent, why not 4? Okay I get 2 spaces, so how do I
> change it? I have also tried changing "C Basic Offset" in
> Programming->Languages->C to "Override style settings: 4", but that doesn't
> work either. It's still indenting with 2 spaces.
> 
> So, I would prefer 4 spaces instead of 2, or even better, a tab, and having
> the tab width set to 4 (how I now can change the tab width) so someone else
> with another text editor can apply another indentation size on my code by
> simply setting the tab width in their editor. Can someone tell me how to
> change this? And I'm an Emacs newbie, so you will have to tell me exactly
> which variables to change and how to change them.
> 
> Thanks in advance
> 
> -Kristofer

er, don't know about the menus - i never use them and have them turned 
off, but the following in your .emacs should work:

(setq-default tab-width 4
               indent-tabs-mode t)

you could quickly evaluate it with C-x C-e to see its effect




^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: Indentation settings problems
  2009-09-20  1:55 ` Bernardo
@ 2009-09-20  2:18   ` Bernardo
  2009-09-20 18:37   ` TriKri
                     ` (3 subsequent siblings)
  4 siblings, 0 replies; 18+ messages in thread
From: Bernardo @ 2009-09-20  2:18 UTC (permalink / raw)
  To: Help-gnu-emacs


>> So, I would prefer 4 spaces instead of 2, or even better, a tab
>> -Kristofer
> 
> er, don't know about the menus - i never use them and have them turned 
> off, but the following in your .emacs should work:
> 
> (setq-default tab-width 4
>               indent-tabs-mode t)
> 
> you could quickly evaluate it with C-x C-e to see its effect

just to clarify this a bit further, you may need to 'tabify' your buffer 
to see the desired effect, mark the whole buffer with C-x h and tabify 
with M-x tabify




^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: Indentation settings problems
  2009-09-20  1:55 ` Bernardo
  2009-09-20  2:18   ` Bernardo
@ 2009-09-20 18:37   ` TriKri
  2009-09-20 18:55     ` Peter Dyballa
  2009-09-20 19:41     ` Andreas Politz
  2009-09-20 22:22   ` TriKri
                     ` (2 subsequent siblings)
  4 siblings, 2 replies; 18+ messages in thread
From: TriKri @ 2009-09-20 18:37 UTC (permalink / raw)
  To: Help-gnu-emacs



Bernardo Bacic wrote:
> 
> er, don't know about the menus - i never use them and have them turned 
> off, but the following in your .emacs should work:
> 
> (setq-default tab-width 4
>                indent-tabs-mode t)
> 
> you could quickly evaluate it with C-x C-e to see its effect
> 

In which file should I add it? I can't find any file ending with .emacs. I
made a search in the entire emacs folder and ordered by date last modified,
but no file is modified later than July this year, and I have made changes
in the options this month. So, where is the file located? Is there any quick
way to add it with emacs?
-- 
View this message in context: http://www.nabble.com/Indentation-settings-problems-tp25520490p25530110.html
Sent from the Emacs - Help mailing list archive at Nabble.com.





^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: Indentation settings problems
  2009-09-20 18:37   ` TriKri
@ 2009-09-20 18:55     ` Peter Dyballa
  2009-09-20 19:41     ` Andreas Politz
  1 sibling, 0 replies; 18+ messages in thread
From: Peter Dyballa @ 2009-09-20 18:55 UTC (permalink / raw)
  To: TriKri; +Cc: Help-gnu-emacs


Am 20.09.2009 um 20:37 schrieb TriKri:

> In which file should I add it?

It's your, the user init file.

> I can't find any file ending with .emacs.

So create it!

> So, where is the file located?

In your HOME directory.

> Is there any quick way to add it with emacs?

C-x C-f ~/.emacs RET.

--
Greetings
   Pete

If men could get pregnant, abortion would be a sacrament.
					– Florynce Kennedy





^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: Indentation settings problems
  2009-09-20 18:37   ` TriKri
  2009-09-20 18:55     ` Peter Dyballa
@ 2009-09-20 19:41     ` Andreas Politz
  2009-09-24  7:42       ` TriKri
  1 sibling, 1 reply; 18+ messages in thread
From: Andreas Politz @ 2009-09-20 19:41 UTC (permalink / raw)
  To: help-gnu-emacs

TriKri <kristoferkrus@hotmail.com> writes:

> Bernardo Bacic wrote:
>> 
>> er, don't know about the menus - i never use them and have them turned 
>> off, but the following in your .emacs should work:
>> 
>> (setq-default tab-width 4
>>                indent-tabs-mode t)
>> 
>
> In which file should I add it? I can't find any file ending with .emacs. I
> made a search in the entire emacs folder and ordered by date last modified,
> but no file is modified later than July this year, and I have made changes
> in the options this month. So, where is the file located? Is there any quick
> way to add it with emacs?

Maybe you're more the customize-type.

M-x customize-option tab-width RET

or

M-x customize-apropos tab RET

-ap





^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: Indentation settings problems
  2009-09-20  1:55 ` Bernardo
  2009-09-20  2:18   ` Bernardo
  2009-09-20 18:37   ` TriKri
@ 2009-09-20 22:22   ` TriKri
  2009-09-21 10:57     ` Bernardo
  2009-09-22 18:02     ` TriKri
       [not found]   ` <mailman.7104.1253471858.2239.help-gnu-emacs@gnu.org>
  2009-09-23  8:38   ` TriKri
  4 siblings, 2 replies; 18+ messages in thread
From: TriKri @ 2009-09-20 22:22 UTC (permalink / raw)
  To: Help-gnu-emacs



Bernardo Bacic wrote:
> 
> (setq-default tab-width 4
>                indent-tabs-mode t)
> 

I found the sile, there was already some code and comments generated (very
litte), and I added the code to the bottom of the document, however, it
doesn't seem to have any effect, still indenting with 2 spaces.


Bernardo Bacic wrote:
> 
> you could quickly evaluate it with C-x C-e to see its effect
> 

I did, and here is what I got:

Debugger entered--Lisp error: (void-variable })
  eval(})
  eval-last-sexp-1(nil)
  eval-last-sexp(nil)
  call-interactively(eval-last-sexp nil nil)

Seems like an error, a variable called }? I checked the .ecams file, not a
single curly bracket was in it.
-- 
View this message in context: http://www.nabble.com/Indentation-settings-problems-tp25520490p25530140.html
Sent from the Emacs - Help mailing list archive at Nabble.com.





^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: Indentation settings problems
  2009-09-20 22:22   ` TriKri
@ 2009-09-21 10:57     ` Bernardo
  2009-09-22 18:02     ` TriKri
  1 sibling, 0 replies; 18+ messages in thread
From: Bernardo @ 2009-09-21 10:57 UTC (permalink / raw)
  To: emacs help



>> (setq-default tab-width 4
>>                indent-tabs-mode t)
>>
> 
> I found the sile, there was already some code and comments generated (very
> litte), and I added the code to the bottom of the document, however, it
> doesn't seem to have any effect, still indenting with 2 spaces.
did you "tabify" the buffer beforehand? i.e.
   M-x mark-whole-buffer RET
   M-x tabify RET

>> you could quickly evaluate it with C-x C-e to see its effect
>>
> 
> I did, and here is what I got:
> 
> Debugger entered--Lisp error: (void-variable })
>   eval(})
>   eval-last-sexp-1(nil)
>   eval-last-sexp(nil)
>   call-interactively(eval-last-sexp nil nil)
> 
> Seems like an error, a variable called }? I checked the .ecams file, not a
> single curly bracket was in it.
a thing to try would be to start emacs with the -Q command line option 
and execute
M-: (setq-default tab-width 4) RET

followed by
M-: (setq-default indent-tabs-mode t) RET

to see if it still happens




^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: Indentation settings problems
       [not found]   ` <mailman.7104.1253471858.2239.help-gnu-emacs@gnu.org>
@ 2009-09-21 21:27     ` jpkotta
  0 siblings, 0 replies; 18+ messages in thread
From: jpkotta @ 2009-09-21 21:27 UTC (permalink / raw)
  To: help-gnu-emacs

On Sep 20, 1:37 pm, TriKri <kristoferk...@hotmail.com> wrote:
> Bernardo Bacic wrote:
>
> > er, don't know about the menus - i never use them and have them turned
> > off, but the following in your .emacs should work:
>
> > (setq-default tab-width 4
> >                indent-tabs-mode t)
>
> > you could quickly evaluate it with C-x C-e to see its effect
>
> In which file should I add it? I can't find any file ending with .emacs. I
> made a search in the entire emacs folder and ordered by date last modified,
> but no file is modified later than July this year, and I have made changes
> in the options this month. So, where is the file located? Is there any quick
> way to add it with emacs?
> --
> View this message in context:http://www.nabble.com/Indentation-settings-problems-tp25520490p255301...
> Sent from the Emacs - Help mailing list archive at Nabble.com.

You may want to try c-basic-offset too.  It specifies how many columns
each indentation level differs by when you use syntactic indentation.
You can change it with setq-default or use customization.

M-x customize-group RET c RET


^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: Indentation settings problems
  2009-09-20 22:22   ` TriKri
  2009-09-21 10:57     ` Bernardo
@ 2009-09-22 18:02     ` TriKri
  2009-09-22 22:54       ` Bernardo
  1 sibling, 1 reply; 18+ messages in thread
From: TriKri @ 2009-09-22 18:02 UTC (permalink / raw)
  To: Help-gnu-emacs


I still want to change the indentation. I added the code (setq-default
tab-width 4 indent-tabs-mode t) to the file (\AppData\Roaming\.emacs in my
user folder in windows) as you said, but it doesn't work. What can be wrong?
And why can't I change it through Options->Customize Emacs->Top-level
Customization Group? To me it seems like something is wrong if nothing of
this works. What does it sound like to you?

I also tried pasting the code in my .cpp file, and evaluating it by placing
the cursor after it and pressing C-x C-e (now I understand how C-x C-e works
by the way). The minibar then displayed t; I guess that should be right. It
still didn't work after that; the indentation was two spaces, just as
before. The file I'm editing is a C++ file; I guess the indentation should
work for those files as well.

-Kristofer
-- 
View this message in context: http://www.nabble.com/Indentation-settings-problems-tp25520490p25530846.html
Sent from the Emacs - Help mailing list archive at Nabble.com.





^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: Indentation settings problems
  2009-09-22 18:02     ` TriKri
@ 2009-09-22 22:54       ` Bernardo
  0 siblings, 0 replies; 18+ messages in thread
From: Bernardo @ 2009-09-22 22:54 UTC (permalink / raw)
  To: Help-gnu-emacs



TriKri said the following on 09/23/09 04:02:
> I still want to change the indentation. I added the code (setq-default
> tab-width 4 indent-tabs-mode t) to the file (\AppData\Roaming\.emacs in my
> user folder in windows) as you said, but it doesn't work. What can be wrong?
> And why can't I change it through Options->Customize Emacs->Top-level
> Customization Group? To me it seems like something is wrong if nothing of
> this works. What does it sound like to you?
> 
> I also tried pasting the code in my .cpp file, and evaluating it by placing
> the cursor after it and pressing C-x C-e (now I understand how C-x C-e works
> by the way). The minibar then displayed t; I guess that should be right. It
> still didn't work after that; the indentation was two spaces, just as
> before. The file I'm editing is a C++ file; I guess the indentation should
> work for those files as well.
> 

did you replace spaces with tabs?

(as someone else suggested) what does
   M-x describe-variable RET c-basic-offset RET
say?




^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: Indentation settings problems
  2009-09-20  1:55 ` Bernardo
                     ` (3 preceding siblings ...)
       [not found]   ` <mailman.7104.1253471858.2239.help-gnu-emacs@gnu.org>
@ 2009-09-23  8:38   ` TriKri
  2009-09-23 11:15     ` Alan Mackenzie
  4 siblings, 1 reply; 18+ messages in thread
From: TriKri @ 2009-09-23  8:38 UTC (permalink / raw)
  To: Help-gnu-emacs


I added the code (setq-default tab-width 4 indent-tabs-mode t) to the file
(\AppData\Roaming\.emacs in my user folder in windows) as you said, but it
doesn't work. If the indentation is made two times (2 times*2 spaces) it
will insert a tab instead, so that works, and the tab width is set to 4.

What confuses me is that the variable standard-indent is set to 4 (and C
Basic Offset is set to Use style settings), but it still indents with two
spaces! Isn't standard-indent the right variable to change? I really have no
idea of what more could be wrong. The standard-indent is said to be 4 by
default, but it indented with 2 spaces right from the beginning when I had
installed Emacs.

-Kristofer
-- 
View this message in context: http://www.nabble.com/Indentation-settings-problems-tp25520490p25531038.html
Sent from the Emacs - Help mailing list archive at Nabble.com.





^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: Indentation settings problems
  2009-09-23  8:38   ` TriKri
@ 2009-09-23 11:15     ` Alan Mackenzie
  0 siblings, 0 replies; 18+ messages in thread
From: Alan Mackenzie @ 2009-09-23 11:15 UTC (permalink / raw)
  To: TriKri; +Cc: Help-gnu-emacs

Hi, TriKri,

On Wed, Sep 23, 2009 at 01:38:35AM -0700, TriKri wrote:

> I added the code (setq-default tab-width 4 indent-tabs-mode t) to the file
> (\AppData\Roaming\.emacs in my user folder in windows) as you said, but it
> doesn't work. If the indentation is made two times (2 times*2 spaces) it
> will insert a tab instead, so that works, and the tab width is set to 4.

> What confuses me is that the variable standard-indent is set to 4 (and C
> Basic Offset is set to Use style settings), but it still indents with two
> spaces! Isn't standard-indent the right variable to change?

CC Mode doesn't use standard-indent at all.  Sadly.  The great thing
about standards is that there're so many to chose from.  ;-)

> I really have no idea of what more could be wrong. The standard-indent
> is said to be 4 by default, but it indented with 2 spaces right from
> the beginning when I had installed Emacs.

The variables you need set are:
c-basic-offset           ; The size of an indentation - set to 4
indent-tabs-mode         ; Tells Emacs to use tabs rather than spaces -
                         ; set to t ("t" is Lisp's symbol for "true").
tab-width                ; How much space a tab character takes up on the
                         ; screen


Unfortunately, setting up CC Mode's "style variables" is too complicated.
If you don't manage to get this sorted now, it would be best if you could
supply "all the evidence" so that we can get it sorted out.  Believe me,
it WILL work.

So, next time round, please
(i) Post your .emacs file.
(ii) Post a (short) C++ source file which illustrates the problems.  Say
  exactly what is wrong with its indentation, and what you want it to
  look like.
(iii) Tell us EXACTLY what you do, after starting Emacs, to show the
  problem.
(iv) Post your CC Mode configuration here.  To get this, do C-c C-b
  (that's "control-c followed by control-b") in your C++ buffer, and cut
  and paste the information into your post.

> -Kristofer

-- 
Alan Mackenzie (Nuremberg, Germany).




^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: Indentation settings problems
  2009-09-20 19:41     ` Andreas Politz
@ 2009-09-24  7:42       ` TriKri
  0 siblings, 0 replies; 18+ messages in thread
From: TriKri @ 2009-09-24  7:42 UTC (permalink / raw)
  To: Help-gnu-emacs


Heh, I don't know which type I am :) The problem seems to have solved anyway;
because of some strange reason it worked changing c-basic-offset this time -
which it hasn't done before... I've tried setting this variable to 4 many
times before, but it hasn't worked. Now it is the same as last time I got
this working (I have had this problem before and eventually managed to solve
it) - I have no idea of what it was I finally did (differently) that made
the problem solve.

-Kristofer


Andreas Politz wrote:
> 
> TriKri <kristoferkrus@hotmail.com> writes:
> 
>> Bernardo Bacic wrote:
>>> 
>>> er, don't know about the menus - i never use them and have them turned 
>>> off, but the following in your .emacs should work:
>>> 
>>> (setq-default tab-width 4
>>>                indent-tabs-mode t)
>>> 
>>
>> In which file should I add it? I can't find any file ending with .emacs.
>> I
>> made a search in the entire emacs folder and ordered by date last
>> modified,
>> but no file is modified later than July this year, and I have made
>> changes
>> in the options this month. So, where is the file located? Is there any
>> quick
>> way to add it with emacs?
> 
> Maybe you're more the customize-type.
> 
> M-x customize-option tab-width RET
> 
> or
> 
> M-x customize-apropos tab RET
> 
> -ap
> 
> 
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Indentation-settings-problems-tp25520490p25539168.html
Sent from the Emacs - Help mailing list archive at Nabble.com.





^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: Indentation settings problems
  2009-09-19 10:46 Indentation settings problems TriKri
  2009-09-20  1:55 ` Bernardo
@ 2009-10-01 22:44 ` TriKri
  2009-10-03  5:45   ` tomas
  2009-10-03 19:56 ` TriKri
       [not found] ` <mailman.7953.1254599775.2239.help-gnu-emacs@gnu.org>
  3 siblings, 1 reply; 18+ messages in thread
From: TriKri @ 2009-10-01 22:44 UTC (permalink / raw)
  To: Help-gnu-emacs



TriKri wrote:
> 
> Hi. I'm having some trouble getting the size of the indentation right. I'm
> writing a .cpp-file, but I guess the indentation will work in about the
> same way as for a .c-file. I'm running windows (more specifically windows
> 7), and I've just installed GNU Emacs 23.1.1. The indentation is 2 spaces
> right now. I prefer a tab instead (with tab width 4), or possibly 4 spaces
> if tab is not possible. Here is what I've tried: I enter the options, go
> to Editing->Indent, where I find that the variable "Standard Indent" is
> set to 4. I get 2 spaces when I indent, why not 4? Okay I get 2 spaces, so
> how do I change it? I have also tried changing "C Basic Offset" in
> Programming->Languages->C to "Override style settings: 4", but that
> doesn't work either. It's still indenting with 2 spaces.
> 
> So, I would prefer 4 spaces instead of 2, or even better, a tab, and
> having the tab width set to 4 (how I now can change the tab width) so
> someone else with another text editor can apply another indentation size
> on my code by simply setting the tab width in their editor. Can someone
> tell me how to change this? And I'm an Emacs newbie, so you will have to
> tell me exactly which variables to change and how to change them.
> 
> Thanks in advance
> 
> -Kristofer
> 

Hi! I think I maybe have found the way to configure Emacs in the right way.
Since I got so happy when I got it to work and I thought I had found the way
to do it, I wrote a small article about it which covers how to change the
indentation settings:  http://setup.wikia.com/wiki/GNU_Emacs
http://setup.wikia.com/wiki/GNU_Emacs  Since it's a wiki, anybody can change
it. Please feel free to contribute; add more stuff you feel is important to
know as a beginner (although the article probably could be extended to cover
more advanced things as well), and change what you feel is wrong or
incorrect. Currently some of the text is written in first-person pronoun,
which should be changed too.
-- 
View this message in context: http://www.nabble.com/Indentation-settings-problems-tp25520490p25707803.html
Sent from the Emacs - Help mailing list archive at Nabble.com.





^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: Indentation settings problems
  2009-10-01 22:44 ` TriKri
@ 2009-10-03  5:45   ` tomas
  0 siblings, 0 replies; 18+ messages in thread
From: tomas @ 2009-10-03  5:45 UTC (permalink / raw)
  To: TriKri; +Cc: Help-gnu-emacs

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Thu, Oct 01, 2009 at 03:44:36PM -0700, TriKri wrote:

[...]

> Hi! I think I maybe have found the way to configure Emacs in the right way.
> Since I got so happy when I got it to work and I thought I had found the way
> to do it, I wrote a small article about it which covers how to change the
> indentation settings:  http://setup.wikia.com/wiki/GNU_Emacs

Nice. Two suggestions

 - Typo: the command to start Emacs in Windows is "runemacs", not
   "ranemacs".

 - Don't forget a link to "http://www.emacswiki.org", which is a
   valuable resource in itself.

(I would have done that myself, but couldn't be bothered to jump through
all the necessary hoops)

Regards
- -- tomás
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)

iD4DBQFKxuTrBcgs9XrR2kYRAi6iAJi6W/y6FJZUCbX6PBi0UJrvlmvMAJ4w9G4Q
EVWnUItu+cWQjGLgXpkkbw==
=d+Sv
-----END PGP SIGNATURE-----




^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: Indentation settings problems
  2009-09-19 10:46 Indentation settings problems TriKri
  2009-09-20  1:55 ` Bernardo
  2009-10-01 22:44 ` TriKri
@ 2009-10-03 19:56 ` TriKri
       [not found] ` <mailman.7953.1254599775.2239.help-gnu-emacs@gnu.org>
  3 siblings, 0 replies; 18+ messages in thread
From: TriKri @ 2009-10-03 19:56 UTC (permalink / raw)
  To: Help-gnu-emacs


I have a question about another indentation setting: When you set
indent-tabs-mode to t, multiple spaces are replaced with tabs. But what if
you only want the part of the indentation that comes from the c-basic-offset
to be tabs, and the rest spaces? Say for example that we have the code

int main() {
	if (foo &&
	    bar) {
		foo_bar();
	}
	return 0;
}

You can see that the indentation consists of only tabs but before "bar) {".
This is because bar should always be lined up with foo, hence bar has to be
4 spaces from the start of "if". Tabs can't be used here, since opening the
code in another text editor with another tab width would result in a
misalignment between foo and bar.

With my settings, these 4 spaces would be replaced with a tab, since my tab
width is set to 4. But this part of the indentation should always have the
width 4 which it doesn't if tabs are used here. So, how can I make these 4
spaces be precisely spaces, and not become a tab? Is there any setting for
this?
-- 
View this message in context: http://www.nabble.com/Indentation-settings-problems-tp25520490p25732211.html
Sent from the Emacs - Help mailing list archive at Nabble.com.





^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: Indentation settings problems
       [not found] ` <mailman.7953.1254599775.2239.help-gnu-emacs@gnu.org>
@ 2009-10-07 18:57   ` John A Pershing Jr
  0 siblings, 0 replies; 18+ messages in thread
From: John A Pershing Jr @ 2009-10-07 18:57 UTC (permalink / raw)
  To: help-gnu-emacs

TriKri <kristoferkrus@hotmail.com> writes:

> I have a question about another indentation setting: When you set
> indent-tabs-mode to t, multiple spaces are replaced with tabs. But what
> if you only want the part of the indentation that comes from the
> c-basic-offset to be tabs, and the rest spaces? [...]

You are out of luck.  Tabs are, in general, not portable from one
person's editor/IDE to another's, because nobody can seem to agree on
the primordial truth -- which is: TABS ARE EVERY 8 COLUMNS!

If you want code formatting to be portable across editors, users, and
IDEs, you need to turn tabs off.

  -jp


^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2009-10-07 18:57 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-09-19 10:46 Indentation settings problems TriKri
2009-09-20  1:55 ` Bernardo
2009-09-20  2:18   ` Bernardo
2009-09-20 18:37   ` TriKri
2009-09-20 18:55     ` Peter Dyballa
2009-09-20 19:41     ` Andreas Politz
2009-09-24  7:42       ` TriKri
2009-09-20 22:22   ` TriKri
2009-09-21 10:57     ` Bernardo
2009-09-22 18:02     ` TriKri
2009-09-22 22:54       ` Bernardo
     [not found]   ` <mailman.7104.1253471858.2239.help-gnu-emacs@gnu.org>
2009-09-21 21:27     ` jpkotta
2009-09-23  8:38   ` TriKri
2009-09-23 11:15     ` Alan Mackenzie
2009-10-01 22:44 ` TriKri
2009-10-03  5:45   ` tomas
2009-10-03 19:56 ` TriKri
     [not found] ` <mailman.7953.1254599775.2239.help-gnu-emacs@gnu.org>
2009-10-07 18:57   ` John A Pershing Jr

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).