From: Robin Rosenberg <robin.rosenberg.lists@dewire.com>
To: Michael Witten <mfwitten@mit.edu>
Cc: git@vger.kernel.org
Subject: Re: On Tabs and Spaces
Date: Sat, 20 Oct 2007 15:54:16 +0200 [thread overview]
Message-ID: <200710201554.16576.robin.rosenberg.lists@dewire.com> (raw)
In-Reply-To: <634393B0-734A-4884-93E3-42F7D3CB157F@mit.edu>
[-- Attachment #1: Type: text/plain, Size: 2947 bytes --]
tisdag 16 oktober 2007 skrev Michael Witten:
> What are the rules about tabs and spaces in source code?
>
> I'm having a terrible time with formatting,
> especially in the perl scripts; there is a
> mix of spaces and tabs.
>
> from what I can deduce, single tabs are used
> to introduce the equivalent of 8 spaces while
> 4 explicit spaces are used for half a tab.
A looong time ago I worked with a system that did not have *this* problem.
The code had a straight left margin. No indent. The code was initially written
just after the origin of time_t (content, not name) and that it was written
on punched cards probably explains the left margin, efter all you can indent
the cards if you like to.
I "accidentally" did indent code once, but only once, since I got a lot of
complains from others about not following coding standards. My solution was
to write a Brief macro to indent the code before working on it and undent
before submitting my work to test. We never had a discussion on tabs vs
spaces.
Btw, some of that code was "logically" indented 22 levels. I'm still amazed
att those long sheets of code people annotated with pencil to discover the
logical structure.
So it is possble to simply not care about tabs and spaces, except where
there is a syntactic difference.
Fast-formward twenty years and back to the topic.
I think it is ok to start or end a *big* series of changes with a re-format
patch, iff the series already introduces a *lot* of changes.
In the previously submitted and rejected patch to cvsexportcommit this
was not the case, I rewrote it heavily and that would have been a window
for for reformatting, but I didn't see a need, probably because I used emacs
and probably the original author too. Now I realize the file *is* actually
indented inconsistently. Add to that that I am responsible for some of it.
Next person to do any major work on it should submit a fix-indentation patch
very much like the one MIchael did. The problem with reviewing such patches
still exists, it is not possible to just read such patches, one has to apply
them and verify them with other tools.
I've been through enough many bracket and indentation discussions to see that
it really doesn't matter as much what style is used as long as the same style
is used throughout a whole source file. There are some coding styles that
works bad with the patch/apply style submitting code, but those are not an
issue here.
As for TAB size. The most authoritative read "stupid") programs on the issue,
i.e. cat (unix) and type (dos/windows) agree that tab stops are located at
every eight position starting (8,16 etc).
Attached is an updated version of a script I've been using lately to clean up
commits. First it only removed trailing whitespace, but after this thread I
changed it to (try to) tabify changes. Should we use such scripts more
actively to root out inconsistencies a patch at a time?
-- robin
[-- Attachment #2: washammend --]
[-- Type: application/x-shellscript, Size: 636 bytes --]
[-- Attachment #3: washtrailing --]
[-- Type: application/x-shellscript, Size: 535 bytes --]
prev parent reply other threads:[~2007-10-20 13:52 UTC|newest]
Thread overview: 100+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-10-16 6:45 On Tabs and Spaces Michael Witten
2007-10-16 7:04 ` Shawn O. Pearce
2007-10-16 7:27 ` Michael Witten
2007-10-16 17:20 ` Andreas Ericsson
2007-10-16 17:40 ` Sam Ravnborg
2007-10-16 23:09 ` Petr Baudis
2007-10-17 3:41 ` David
2007-10-17 11:32 ` Andy Parkins
2007-10-16 8:30 ` Adam Piatyszek
2007-10-16 9:04 ` Lars Hjemli
2007-10-16 10:16 ` Adam Piatyszek
2007-10-16 15:26 ` Jeffrey C. Ollie
2007-10-16 15:51 ` Michael Witten
2007-10-16 17:06 ` Jari Aalto
2007-10-16 19:20 ` Linus Torvalds
2007-10-16 19:36 ` Mike Hommey
2007-10-16 19:47 ` Linus Torvalds
2007-10-16 19:51 ` Linus Torvalds
2007-10-16 20:32 ` Matthieu Moy
2007-10-16 20:18 ` Tom Tobin
2007-10-16 23:05 ` Linus Torvalds
2007-10-16 23:51 ` Christer Weinigel
2007-10-17 0:45 ` Linus Torvalds
2007-10-17 3:08 ` Michael Witten
2007-10-17 3:29 ` Linus Torvalds
2007-10-17 7:17 ` Luke Lu
2007-10-17 9:09 ` Michael Witten
2007-10-17 10:03 ` Luke Lu
2007-10-17 10:21 ` Nikolai Weibull
2007-10-17 11:23 ` Michael Witten
2007-10-17 22:02 ` Jari Aalto
2007-10-17 22:36 ` Andreas Ericsson
2007-10-17 23:38 ` Jari Aalto
2007-10-18 4:31 ` Dmitry Torokhov
2007-10-18 8:19 ` Jari Aalto
2007-10-18 11:34 ` Petr Baudis
2007-10-18 11:39 ` Nikolai Weibull
2007-10-22 3:39 ` Miles Bader
2007-10-18 7:15 ` David Kågedal
2007-10-18 5:42 ` Mike Hommey
2007-10-18 10:36 ` Jari Aalto
2007-10-17 15:53 ` Linus Torvalds
2007-10-17 18:05 ` Johannes Schindelin
2007-10-17 18:25 ` Tom Tobin
2007-10-17 18:54 ` Linus Torvalds
2007-10-17 19:33 ` Tom Tobin
2007-10-17 19:44 ` Linus Torvalds
2007-10-17 19:48 ` Nicolas Pitre
2007-10-17 19:52 ` Josh England
2007-10-17 19:53 ` Linus Torvalds
2007-10-17 21:21 ` Christer Weinigel
2007-10-17 22:03 ` Linus Torvalds
2007-10-18 6:25 ` David Kastrup
2007-10-17 22:11 ` Johannes Schindelin
2007-10-17 23:17 ` Christer Weinigel
2007-10-17 23:44 ` Johannes Schindelin
2007-10-18 0:31 ` Christer Weinigel
2007-10-18 6:02 ` Andreas Ericsson
2007-10-18 7:12 ` David Kågedal
2007-10-17 23:53 ` Linus Torvalds
2007-10-17 20:31 ` David Kastrup
2007-10-17 21:08 ` Johannes Schindelin
2007-10-17 19:47 ` Jan Wielemaker
2007-10-18 0:32 ` Jeff King
2007-10-18 0:59 ` Linus Torvalds
2007-10-18 2:45 ` Jeff King
2007-10-18 3:03 ` david
2007-10-18 3:00 ` Jeff King
2007-10-18 3:32 ` Linus Torvalds
2007-10-18 4:17 ` Linus Torvalds
2007-10-18 3:13 ` Linus Torvalds
2007-10-18 3:23 ` Jeff King
2007-10-18 4:41 ` [PATCH] Add a message explaining that automatic GC is about to start koreth
2007-10-18 4:44 ` Steven Grimm
2007-10-18 5:01 ` Jeff King
2007-10-18 5:11 ` Shawn O. Pearce
2007-10-18 13:52 ` Brian Gernhardt
2007-10-18 14:16 ` Steven Grimm
2007-10-18 18:08 ` Jeff King
2007-10-19 0:16 ` Shawn O. Pearce
2007-10-19 1:12 ` [PATCH] git-gc: improve wording of --auto notification Jeff King
2007-10-19 1:24 ` Shawn O. Pearce
2007-10-19 1:26 ` Jeff King
2007-10-18 14:21 ` [PATCH] Add a message explaining that automatic GC is about to start Nicolas Pitre
2007-10-18 4:52 ` On Tabs and Spaces Nicolas Pitre
2007-10-18 4:54 ` Jeff King
2007-10-18 4:55 ` Jeff King
2007-10-17 16:08 ` David Kastrup
2007-10-17 17:44 ` Nicolas Pitre
2007-10-17 19:52 ` David Kastrup
2007-10-17 17:51 ` Sean
2007-10-17 5:56 ` David Kastrup
2007-10-16 20:56 ` Sam Ravnborg
2007-10-18 3:31 ` Paul Wankadia
2007-10-18 4:22 ` Linus Torvalds
2007-10-18 4:36 ` Dmitry Potapov
2007-10-16 17:23 ` Andreas Ericsson
2007-10-16 18:34 ` Jan-Benedict Glaw
2007-10-16 18:51 ` Andreas Ericsson
2007-10-20 13:54 ` Robin Rosenberg [this message]
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=200710201554.16576.robin.rosenberg.lists@dewire.com \
--to=robin.rosenberg.lists@dewire.com \
--cc=git@vger.kernel.org \
--cc=mfwitten@mit.edu \
/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.
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 NNTP newsgroup(s).