unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* indent-tabs-mode
@ 2006-08-09  0:19 Nick Roberts
  2006-08-09  0:34 ` indent-tabs-mode Giorgos Keramidas
                   ` (2 more replies)
  0 siblings, 3 replies; 20+ messages in thread
From: Nick Roberts @ 2006-08-09  0:19 UTC (permalink / raw)



Since it's generally agreed now that tabs are a bad thing, how about
changing the default value of indent-tabs-mode to t?

-- 
Nick                                           http://www.inet.net.nz/~nickrob

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

* Re: indent-tabs-mode
  2006-08-09  0:19 indent-tabs-mode Nick Roberts
@ 2006-08-09  0:34 ` Giorgos Keramidas
  2006-08-09  2:40 ` indent-tabs-mode Miles Bader
  2006-08-09 19:15 ` indent-tabs-mode Richard Stallman
  2 siblings, 0 replies; 20+ messages in thread
From: Giorgos Keramidas @ 2006-08-09  0:34 UTC (permalink / raw)
  Cc: emacs-devel

On 2006-08-09 12:19, Nick Roberts <nickrob@snap.net.nz> wrote:
> Since it's generally agreed now that tabs are a bad thing, how about
> changing the default value of indent-tabs-mode to t?

I don't think anything of this sort is 'generally' agreed.

Since Emacs can support both things and changing its behavior now
(or after the release) will probably break the setup of a lot of
people, do we really have to change this?

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

* Re: indent-tabs-mode
  2006-08-09  0:19 indent-tabs-mode Nick Roberts
  2006-08-09  0:34 ` indent-tabs-mode Giorgos Keramidas
@ 2006-08-09  2:40 ` Miles Bader
  2006-08-09  3:45   ` indent-tabs-mode Nick Roberts
  2006-08-09 19:15 ` indent-tabs-mode Richard Stallman
  2 siblings, 1 reply; 20+ messages in thread
From: Miles Bader @ 2006-08-09  2:40 UTC (permalink / raw)
  Cc: emacs-devel

Nick Roberts <nickrob@snap.net.nz> writes:
> Since it's generally agreed now that tabs are a bad thing

It's not.

-Miles
-- 
Occam's razor split hairs so well, I bought the whole argument!

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

* Re: indent-tabs-mode
  2006-08-09  2:40 ` indent-tabs-mode Miles Bader
@ 2006-08-09  3:45   ` Nick Roberts
  2006-08-09  4:58     ` indent-tabs-mode Miles Bader
  0 siblings, 1 reply; 20+ messages in thread
From: Nick Roberts @ 2006-08-09  3:45 UTC (permalink / raw)
  Cc: emacs-devel

Miles Bader writes:
 > Nick Roberts <nickrob@snap.net.nz> writes:
 > > Since it's generally agreed now that tabs are a bad thing
 > 
 > It's not.

Since different applications treat tabs in different ways, how about
changing the default value of indent-tabs-mode to t?

-- 
Nick                                           http://www.inet.net.nz/~nickrob

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

* Re: indent-tabs-mode
  2006-08-09  3:45   ` indent-tabs-mode Nick Roberts
@ 2006-08-09  4:58     ` Miles Bader
  2006-08-09  5:11       ` indent-tabs-mode Nick Roberts
  0 siblings, 1 reply; 20+ messages in thread
From: Miles Bader @ 2006-08-09  4:58 UTC (permalink / raw)
  Cc: emacs-devel

Nick Roberts <nickrob@snap.net.nz> writes:
>  > > Since it's generally agreed now that tabs are a bad thing
>  > 
>  > It's not.
>
> Since different applications treat tabs in different ways, how about
> changing the default value of indent-tabs-mode to t?

That already is the default.

-Miles
-- 
We are all lying in the gutter, but some of us are looking at the stars.
-Oscar Wilde

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

* Re: indent-tabs-mode
  2006-08-09  4:58     ` indent-tabs-mode Miles Bader
@ 2006-08-09  5:11       ` Nick Roberts
  2006-08-09  5:34         ` indent-tabs-mode Miles Bader
  0 siblings, 1 reply; 20+ messages in thread
From: Nick Roberts @ 2006-08-09  5:11 UTC (permalink / raw)
  Cc: emacs-devel

 > >  > > Since it's generally agreed now that tabs are a bad thing
 > >  > 
 > >  > It's not.
 > >
 > > Since different applications treat tabs in different ways, how about
 > > changing the default value of indent-tabs-mode to t?
 > 
 > That already is the default.

OK, thats 2-0.  How about setting indent-tabs-mode to nil?  I think that's
right: I mean don't insert tabs but spaces.  Actually many commands
seem to do this anyway: c-indent-command, lisp-indent-line, so perhaps I've
got the wrong end of the stick anyway.

-- 
Nick                                           http://www.inet.net.nz/~nickrob

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

* Re: indent-tabs-mode
  2006-08-09  5:11       ` indent-tabs-mode Nick Roberts
@ 2006-08-09  5:34         ` Miles Bader
  2006-08-09  6:13           ` indent-tabs-mode Nick Roberts
  0 siblings, 1 reply; 20+ messages in thread
From: Miles Bader @ 2006-08-09  5:34 UTC (permalink / raw)
  Cc: emacs-devel

Nick Roberts <nickrob@snap.net.nz> writes:
> OK, thats 2-0.  How about setting indent-tabs-mode to nil?  I think that's
> right: I mean don't insert tabs but spaces.

The default has been `t' for around a zillion years; if you change it
gratitously you're just going to annoy people are accustomed to the
default, for no reason.  The vast majority of applications do not
distinguish in any significant way between tabs and spaces, for good
reason (because doing so is _very confusing_ for the user).

Given that only the most bizarro applications actually care about tabs
vs. spaces, it seems better to simply deal with those rare cases
individually using modes.

[Actually, what are those applications?  Make treats TAB as significant,
but does so in a way that works well with the default settings.]

> Actually many commands seem to do this anyway: c-indent-command,
> lisp-indent-line, so perhaps I've got the wrong end of the stick
> anyway.

Those commands do not do anything special, they simply do what
indent-tabs-mode tells them to do; if indent-tabs-mode is t, they will
insert tabs.

-Miles
-- 
Do not taunt Happy Fun Ball.

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

* Re: indent-tabs-mode
  2006-08-09  5:34         ` indent-tabs-mode Miles Bader
@ 2006-08-09  6:13           ` Nick Roberts
  2006-08-09  7:13             ` indent-tabs-mode Miles Bader
  2006-08-09 11:09             ` indent-tabs-mode Klaus Zeitler
  0 siblings, 2 replies; 20+ messages in thread
From: Nick Roberts @ 2006-08-09  6:13 UTC (permalink / raw)
  Cc: emacs-devel

 > Given that only the most bizarro applications actually care about tabs
 > vs. spaces, it seems better to simply deal with those rare cases
 > individually using modes.

Every application has to decide how it's going to display a tab.  Emacs
uses eight spaces by default but others use a different number.

 > [Actually, what are those applications?  Make treats TAB as significant,
 > but does so in a way that works well with the default settings.]

I've noticed it in diffs where the source has tabs and appears different
e.g in the mail archives.

 > > Actually many commands seem to do this anyway: c-indent-command,
 > > lisp-indent-line, so perhaps I've got the wrong end of the stick
 > > anyway.
 > 
 > Those commands do not do anything special, they simply do what
 > indent-tabs-mode tells them to do; if indent-tabs-mode is t, they will
 > insert tabs.

Since they all seem to insert spaces, I think this either says that nil would
be a sensible default for indent-tabs-mode, or it doesn't really matter.
However Emacs sources have thousands, so somehow they're being inserted.

-- 
Nick                                           http://www.inet.net.nz/~nickrob

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

* Re: indent-tabs-mode
  2006-08-09  6:13           ` indent-tabs-mode Nick Roberts
@ 2006-08-09  7:13             ` Miles Bader
  2006-08-09 11:09             ` indent-tabs-mode Klaus Zeitler
  1 sibling, 0 replies; 20+ messages in thread
From: Miles Bader @ 2006-08-09  7:13 UTC (permalink / raw)
  Cc: emacs-devel

Nick Roberts <nickrob@snap.net.nz> writes:
> Every application has to decide how it's going to display a tab.  Emacs
> uses eight spaces by default but others use a different number.

8 is not an arbitrary value, it's pretty much the standard.

> I've noticed it in diffs where the source has tabs and appears different
> e.g in the mail archives.

This is due to users who use a different setting when they edit a file;
in order to get rid of _that_ problem, you're going to have to convince
everybody to change their setting, and morever, _modify_ every existing
source file.  That's a nightmare for merging/maintenance, and isn't
going to (shouldn't) happen.

>  > Those commands do not do anything special, they simply do what
>  > indent-tabs-mode tells them to do; if indent-tabs-mode is t, they will
>  > insert tabs.
>
> Since they all seem to insert spaces, I think this either says that nil would
> be a sensible default for indent-tabs-mode, or it doesn't really matter.

They do not insert spaces by default.  If they are for you, that means
you've changed some setting.

-Miles
-- 
"Suppose He doesn't give a shit?  Suppose there is a God but He
just doesn't give a shit?"  [George Carlin]

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

* Re: indent-tabs-mode
  2006-08-09  6:13           ` indent-tabs-mode Nick Roberts
  2006-08-09  7:13             ` indent-tabs-mode Miles Bader
@ 2006-08-09 11:09             ` Klaus Zeitler
  2006-08-09 17:25               ` indent-tabs-mode Eli Zaretskii
  1 sibling, 1 reply; 20+ messages in thread
From: Klaus Zeitler @ 2006-08-09 11:09 UTC (permalink / raw)


>>>>> "Nick" == Nick Roberts <nickrob@snap.net.nz> writes:
    Nick> 
    Nick> Every application has to decide how it's going to display a tab.
    Nick> Emacs uses eight spaces by default but others use a different
    Nick> number.

I don't know of any application that doesn't work right with tabs set to the
size of eight spaces. IMHO it's changing the size, that is causing the
trouble. We have a few vi users here, that change the tab size (that is
probably their means of some kind of indentation) and this is causing problems
in some other editors (not in emacs I know, just one command and it looks ok).

-- 
 ------------------------------------------
|  Klaus Zeitler      Lucent Technologies  |
|  Email:             kzeitler@lucent.com  |
 ------------------------------------------
---
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet?

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

* Re: indent-tabs-mode
  2006-08-09 11:09             ` indent-tabs-mode Klaus Zeitler
@ 2006-08-09 17:25               ` Eli Zaretskii
  2006-08-10  5:27                 ` indent-tabs-mode Miles Bader
  0 siblings, 1 reply; 20+ messages in thread
From: Eli Zaretskii @ 2006-08-09 17:25 UTC (permalink / raw)
  Cc: emacs-devel

> From: Klaus Zeitler <kzeitler@lucent.com>
> Date: Wed, 09 Aug 2006 13:09:52 +0200
> 
> >>>>> "Nick" == Nick Roberts <nickrob@snap.net.nz> writes:
>     Nick> 
>     Nick> Every application has to decide how it's going to display a tab.
>     Nick> Emacs uses eight spaces by default but others use a different
>     Nick> number.
> 
> I don't know of any application that doesn't work right with tabs set to the
> size of eight spaces. IMHO it's changing the size, that is causing the
> trouble.

Right.  So, if we are to change anything in the related defaults (and
I'm not saying that we necessarily should), at most we should reset
indent-tabs-mode to nil when the user customizes tab-width to a
non-default value.

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

* Re: indent-tabs-mode
  2006-08-09  0:19 indent-tabs-mode Nick Roberts
  2006-08-09  0:34 ` indent-tabs-mode Giorgos Keramidas
  2006-08-09  2:40 ` indent-tabs-mode Miles Bader
@ 2006-08-09 19:15 ` Richard Stallman
  2006-08-09 22:29   ` indent-tabs-mode Bill Wohler
  2 siblings, 1 reply; 20+ messages in thread
From: Richard Stallman @ 2006-08-09 19:15 UTC (permalink / raw)
  Cc: emacs-devel

    Since it's generally agreed now that tabs are a bad thing, how about
    changing the default value of indent-tabs-mode to t?

I don't think tabs are bad, and I see no reason to change this.
(t is the current default; perhaps you mean nil.)

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

* Re: indent-tabs-mode
  2006-08-09 19:15 ` indent-tabs-mode Richard Stallman
@ 2006-08-09 22:29   ` Bill Wohler
  2006-08-10  2:51     ` indent-tabs-mode Stefan Monnier
  2006-08-10 16:27     ` indent-tabs-mode Richard Stallman
  0 siblings, 2 replies; 20+ messages in thread
From: Bill Wohler @ 2006-08-09 22:29 UTC (permalink / raw)


Richard Stallman <rms@gnu.org> writes:

>     Since it's generally agreed now that tabs are a bad thing, how about
>     changing the default value of indent-tabs-mode to t?
>
> I don't think tabs are bad, and I see no reason to change this.
> (t is the current default; perhaps you mean nil.)

If everyone on the Emacs project used a different tab stop, you'd very
quickly change your mind. That's the reality on any project that where
editors other than Emacs are used.

-- 
Bill Wohler <wohler@newt.com>  http://www.newt.com/wohler/  GnuPG ID:610BD9AD

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

* Re: indent-tabs-mode
  2006-08-09 22:29   ` indent-tabs-mode Bill Wohler
@ 2006-08-10  2:51     ` Stefan Monnier
  2006-08-10  5:30       ` indent-tabs-mode Miles Bader
  2006-08-10 16:27     ` indent-tabs-mode Richard Stallman
  1 sibling, 1 reply; 20+ messages in thread
From: Stefan Monnier @ 2006-08-10  2:51 UTC (permalink / raw)
  Cc: emacs-devel

>> Since it's generally agreed now that tabs are a bad thing, how about
>> changing the default value of indent-tabs-mode to t?
>> 
>> I don't think tabs are bad, and I see no reason to change this.
>> (t is the current default; perhaps you mean nil.)

> If everyone on the Emacs project used a different tab stop, you'd very
> quickly change your mind. That's the reality on any project that where
> editors other than Emacs are used.

That's irrelevant: In that case the problem doesn't come from
indent-tabs-mode and isn't fixed (or even mitigated) by changing
indent-tabs-mode.


        Stefan

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

* Re: indent-tabs-mode
  2006-08-09 17:25               ` indent-tabs-mode Eli Zaretskii
@ 2006-08-10  5:27                 ` Miles Bader
  2006-08-10 15:11                   ` indent-tabs-mode Stefan Monnier
  0 siblings, 1 reply; 20+ messages in thread
From: Miles Bader @ 2006-08-10  5:27 UTC (permalink / raw)
  Cc: Klaus Zeitler, emacs-devel

Eli Zaretskii <eliz@gnu.org> writes:
> Right.  So, if we are to change anything in the related defaults (and
> I'm not saying that we necessarily should), at most we should reset
> indent-tabs-mode to nil when the user customizes tab-width to a
> non-default value.

I think that would be a bad idea too.

The most common use of tab-widths other than 8 that I know of is by vi
users.

As far as I understand the typical vi practice, typically they:

(1) Use _only_ tabs for indenting, e.g. C code.

(2) Set their tab-width to be their preferred "level offset" (the amount
    by which e.g. C statements are indented relative to the beginning
    brace of their enclosing block).

The claimed advantage of this is that someone who likes a different
"level offset" can easily just change their tab-width and all the C code
they view instantly changes (assuming that all the code they view
follows this convention of course :-).

In Emacs, you can easily use this convention by simply making sure
tab-width and c-basic-offset are the same.  If you do this, c-mode
always insert tabs for indentation, one per level of indentation.
C-mode doesn't have to do anything special for this to work, it just
naturally falls out of the way Emacs indentation primitives work.
But of course it only does the right thing if indent-tabs-mode is t.

-Miles
-- 
`Suppose Korea goes to the World Cup final against Japan and wins,' Moon said.
`All the past could be forgiven.'   [NYT]

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

* Re: indent-tabs-mode
  2006-08-10  2:51     ` indent-tabs-mode Stefan Monnier
@ 2006-08-10  5:30       ` Miles Bader
  0 siblings, 0 replies; 20+ messages in thread
From: Miles Bader @ 2006-08-10  5:30 UTC (permalink / raw)
  Cc: Bill Wohler, emacs-devel

Stefan Monnier <monnier@iro.umontreal.ca> writes:
>> If everyone on the Emacs project used a different tab stop, you'd very
>> quickly change your mind. That's the reality on any project that where
>> editors other than Emacs are used.
>
> That's irrelevant: In that case the problem doesn't come from
> indent-tabs-mode and isn't fixed (or even mitigated) by changing
> indent-tabs-mode.

Indeed.

If you want to avoid this problem, the right thing is to specify a
specific tab-width or no-tabs-allowed as part of the project's coding
style rules.

-Miles
-- 
Is it true that nothing can be known?  If so how do we know this?  -Woody Allen

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

* Re: indent-tabs-mode
  2006-08-10  5:27                 ` indent-tabs-mode Miles Bader
@ 2006-08-10 15:11                   ` Stefan Monnier
  2006-08-10 15:22                     ` indent-tabs-mode Aidan Kehoe
  0 siblings, 1 reply; 20+ messages in thread
From: Stefan Monnier @ 2006-08-10 15:11 UTC (permalink / raw)
  Cc: Klaus Zeitler, Eli Zaretskii, emacs-devel

> The claimed advantage of this is that someone who likes a different
> "level offset" can easily just change their tab-width and all the C code
> they view instantly changes (assuming that all the code they view
> follows this convention of course :-).

Of course this breaks down as soon as you have indentation relative to
a point that's not the first non-tab on the line.  E.g

	foobarfun(arg1,
	         arg2);

In order for this to correctly react to changes in tab-width, you have to
make sure that it's represented as

[TAB]foobarfun(arg1,
[TAB][.spaces.]arg2);


        Stefan

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

* Re: indent-tabs-mode
  2006-08-10 15:11                   ` indent-tabs-mode Stefan Monnier
@ 2006-08-10 15:22                     ` Aidan Kehoe
  0 siblings, 0 replies; 20+ messages in thread
From: Aidan Kehoe @ 2006-08-10 15:22 UTC (permalink / raw)
  Cc: emacs-devel


 Ar an deichiú lá de mí Lúnasa, scríobh Stefan Monnier: 

 > Of course this breaks down as soon as you have indentation relative to
 > a point that's not the first non-tab on the line.  E.g
 > 
 > 	foobarfun(arg1,
 > 	         arg2);
 > 
 > In order for this to correctly react to changes in tab-width, you have to
 > make sure that it's represented as
 > 
 > [TAB]foobarfun(arg1,
 > [TAB][.spaces.]arg2);

And the correct reaction will be broken if your tab width is set to two. Or,
following how Dan Bernstein indents his code, one. 

-- 
Santa Maradona, priez pour moi!

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

* Re: indent-tabs-mode
  2006-08-09 22:29   ` indent-tabs-mode Bill Wohler
  2006-08-10  2:51     ` indent-tabs-mode Stefan Monnier
@ 2006-08-10 16:27     ` Richard Stallman
  2006-08-10 16:45       ` indent-tabs-mode Bill Wohler
  1 sibling, 1 reply; 20+ messages in thread
From: Richard Stallman @ 2006-08-10 16:27 UTC (permalink / raw)
  Cc: emacs-devel

    If everyone on the Emacs project used a different tab stop, you'd very
    quickly change your mind. That's the reality on any project that where
    editors other than Emacs are used.

8-column tab stops have been standard since before 1970.  All editors
should assume this, and I am sure most of them do.

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

* Re: indent-tabs-mode
  2006-08-10 16:27     ` indent-tabs-mode Richard Stallman
@ 2006-08-10 16:45       ` Bill Wohler
  0 siblings, 0 replies; 20+ messages in thread
From: Bill Wohler @ 2006-08-10 16:45 UTC (permalink / raw)


Richard Stallman <rms@gnu.org> wrote:

> 8-column tab stops have been standard since before 1970.  All editors
> should assume this, and I am sure most of them do.

I agree with your first sentence and wished the second sentence were
true. Note that we're not just talking editors, but anything that can
view source code including printers, terminals (and myriads of programs
running there), and presentation programs. The source code might also be
viewed by folks outside of your organization that you cannot control.

More significant is that a handful of editors, Emacs excluded, also
confuse indentation with the tab stop.

Anyway, it's been my experience that the best practice in an
heterogeneous environment is to specify an indent level and the use of
spaces instead of hard tabs. More important, you can add a commit check
for the presence of a hard tab to enforce your policies. Just my 2c.

-- 
Bill Wohler <wohler@newt.com>  http://www.newt.com/wohler/  GnuPG ID:610BD9AD

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

end of thread, other threads:[~2006-08-10 16:45 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-08-09  0:19 indent-tabs-mode Nick Roberts
2006-08-09  0:34 ` indent-tabs-mode Giorgos Keramidas
2006-08-09  2:40 ` indent-tabs-mode Miles Bader
2006-08-09  3:45   ` indent-tabs-mode Nick Roberts
2006-08-09  4:58     ` indent-tabs-mode Miles Bader
2006-08-09  5:11       ` indent-tabs-mode Nick Roberts
2006-08-09  5:34         ` indent-tabs-mode Miles Bader
2006-08-09  6:13           ` indent-tabs-mode Nick Roberts
2006-08-09  7:13             ` indent-tabs-mode Miles Bader
2006-08-09 11:09             ` indent-tabs-mode Klaus Zeitler
2006-08-09 17:25               ` indent-tabs-mode Eli Zaretskii
2006-08-10  5:27                 ` indent-tabs-mode Miles Bader
2006-08-10 15:11                   ` indent-tabs-mode Stefan Monnier
2006-08-10 15:22                     ` indent-tabs-mode Aidan Kehoe
2006-08-09 19:15 ` indent-tabs-mode Richard Stallman
2006-08-09 22:29   ` indent-tabs-mode Bill Wohler
2006-08-10  2:51     ` indent-tabs-mode Stefan Monnier
2006-08-10  5:30       ` indent-tabs-mode Miles Bader
2006-08-10 16:27     ` indent-tabs-mode Richard Stallman
2006-08-10 16:45       ` indent-tabs-mode Bill Wohler

Code repositories for project(s) associated with this public inbox

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

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