Обсуждение: Tabs or Spaces

Поиск
Список
Период
Сортировка

Tabs or Spaces

От
"Simon Riggs"
Дата:
Minor request for clarification:

I read in the Developer's FAQ that tabs should be interpreted as 4
spaces. ...and also that pgindent replaces tabs as spaces.

Trouble is, there are tabs throughout the code. What gives?

Should I be replacing tabs as spaces, or leaving them alone? At all?
Only in patches I submit? Everywhere? 

I have no opinion either way as to what should be done. Please advise.

--  Simon Riggs              EnterpriseDB   http://www.enterprisedb.com




Re: Tabs or Spaces

От
Tom Lane
Дата:
"Simon Riggs" <simon@2ndquadrant.com> writes:
> Minor request for clarification:
> I read in the Developer's FAQ that tabs should be interpreted as 4
> spaces. ...and also that pgindent replaces tabs as spaces.

No, it does the opposite (or I would hope so anyway).
        regards, tom lane


Re: Tabs or Spaces

От
Andrew Dunstan
Дата:
Tom Lane wrote:
> "Simon Riggs" <simon@2ndquadrant.com> writes:
>   
>> Minor request for clarification:
>> I read in the Developer's FAQ that tabs should be interpreted as 4
>> spaces. ...and also that pgindent replaces tabs as spaces.
>>     
>
> No, it does the opposite (or I would hope so anyway).
>
>   

Sure looks that way in the code. In fact it detabifies and then 
retabifies, from what I can see.

cheers

andrew


Re: Tabs or Spaces

От
Bruce Momjian
Дата:
Andrew Dunstan wrote:
> Tom Lane wrote:
> > "Simon Riggs" <simon@2ndquadrant.com> writes:
> >   
> >> Minor request for clarification:
> >> I read in the Developer's FAQ that tabs should be interpreted as 4
> >> spaces. ...and also that pgindent replaces tabs as spaces.
> >>     
> >
> > No, it does the opposite (or I would hope so anyway).
> >
> >   
> 
> Sure looks that way in the code. In fact it detabifies and then 
> retabifies, from what I can see.
> 
> cheers
> 
> andrew
> 
> ---------------------------(end of broadcast)---------------------------
> TIP 2: Don't 'kill -9' the postmaster

--  Bruce Momjian   bruce@momjian.us EnterpriseDB    http://www.enterprisedb.com
 + If your life is a hard drive, Christ can be your backup. +


Re: Tabs or Spaces

От
Bruce Momjian
Дата:
Tom Lane wrote:
> "Simon Riggs" <simon@2ndquadrant.com> writes:
> > Minor request for clarification:
> > I read in the Developer's FAQ that tabs should be interpreted as 4
> > spaces. ...and also that pgindent replaces tabs as spaces.
> 
> No, it does the opposite (or I would hope so anyway).

Sorry, the mistake was in a reference to entab.  It now reads:
   entab           converts spaces to tabs, used by pgindent

--  Bruce Momjian   bruce@momjian.us EnterpriseDB    http://www.enterprisedb.com
 + If your life is a hard drive, Christ can be your backup. +


Re: Tabs or Spaces

От
"Simon Riggs"
Дата:
On Thu, 2007-01-04 at 16:01 -0500, Bruce Momjian wrote:
> Tom Lane wrote:
> > "Simon Riggs" <simon@2ndquadrant.com> writes:
> > > Minor request for clarification:
> > > I read in the Developer's FAQ that tabs should be interpreted as 4
> > > spaces. ...and also that pgindent replaces tabs as spaces.
> > 
> > No, it does the opposite (or I would hope so anyway).
> 
> Sorry, the mistake was in a reference to entab.  It now reads:
> 
>     entab           converts spaces to tabs, used by pgindent

S'OK, just thought it was funny I'd been doing it backwards all this
time: Actively been replacing tabs with spaces. :-)

--  Simon Riggs              EnterpriseDB   http://www.enterprisedb.com




Re: Tabs or Spaces

От
Alvaro Herrera
Дата:
Simon Riggs wrote:
> On Thu, 2007-01-04 at 16:01 -0500, Bruce Momjian wrote:
> > Tom Lane wrote:
> > > "Simon Riggs" <simon@2ndquadrant.com> writes:
> > > > Minor request for clarification:
> > > > I read in the Developer's FAQ that tabs should be interpreted as 4
> > > > spaces. ...and also that pgindent replaces tabs as spaces.
> > > 
> > > No, it does the opposite (or I would hope so anyway).
> > 
> > Sorry, the mistake was in a reference to entab.  It now reads:
> > 
> >     entab           converts spaces to tabs, used by pgindent
> 
> S'OK, just thought it was funny I'd been doing it backwards all this
> time: Actively been replacing tabs with spaces. :-)

That explains why your patches always seemed to be so weird to me
spacing-wise :-)

-- 
Alvaro Herrera                                http://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.


Re: Tabs or Spaces

От
"Simon Riggs"
Дата:
On Thu, 2007-01-04 at 21:41 -0300, Alvaro Herrera wrote:
> Simon Riggs wrote:
> > S'OK, just thought it was funny I'd been doing it backwards all this
> > time: Actively been replacing tabs with spaces. :-)
> 
> That explains why your patches always seemed to be so weird to me

LOL

> spacing-wise :-)

Nobody ever said... laughs/rolls eyes/sighs

--  Simon Riggs              EnterpriseDB   http://www.enterprisedb.com




Re: Tabs or Spaces

От
Bruce Momjian
Дата:
Simon Riggs wrote:
> On Thu, 2007-01-04 at 16:01 -0500, Bruce Momjian wrote:
> > Tom Lane wrote:
> > > "Simon Riggs" <simon@2ndquadrant.com> writes:
> > > > Minor request for clarification:
> > > > I read in the Developer's FAQ that tabs should be interpreted as 4
> > > > spaces. ...and also that pgindent replaces tabs as spaces.
> > > 
> > > No, it does the opposite (or I would hope so anyway).
> > 
> > Sorry, the mistake was in a reference to entab.  It now reads:
> > 
> >     entab           converts spaces to tabs, used by pgindent
> 
> S'OK, just thought it was funny I'd been doing it backwards all this
> time: Actively been replacing tabs with spaces. :-)

It was a little more complex because entab does conversion to/from tabs,
but pgindent uses it in the "to tabs" mode.

--  Bruce Momjian   bruce@momjian.us EnterpriseDB    http://www.enterprisedb.com
 + If your life is a hard drive, Christ can be your backup. +


Re: Tabs or Spaces

От
Jim Nasby
Дата:
On Jan 4, 2007, at 7:54 PM, Simon Riggs wrote:
> On Thu, 2007-01-04 at 21:41 -0300, Alvaro Herrera wrote:
>> Simon Riggs wrote:
>>> S'OK, just thought it was funny I'd been doing it backwards all this
>>> time: Actively been replacing tabs with spaces. :-)
>>
>> That explains why your patches always seemed to be so weird to me
>
> LOL
>
>> spacing-wise :-)
>
> Nobody ever said... laughs/rolls eyes/sighs

I just figured you were using British tabs instead of American ones. ;P
--
Jim Nasby                                            jim@nasby.net
EnterpriseDB      http://enterprisedb.com      512.569.9461 (cell)