Hi Thorsten,

In this example:

my $animals = ('dog',   # they bark
               'cat);   # they meow

(the above could look messed up due to mail clients, so below I have replaced 
tabs with --> and -------> and spaces with underscores, assuming tab stops 
every 8 characters)

my_$animals_=_('dog',-->#_they_bark
------->_______'cat);-->#_they_meow

the tabs are of course different widths.  I suspect that it is very hard or 
impossible to write a regular expression that can expand these tabs properly, 
is that not the case?  Of course if scmbug only uses tabs at the start of a 
line and not embedded in the line, the tab width is always 8.  In my 
experience, people will occasionally accidentally put some spaces in front of a 
tab, e.g.:

__----->_______'cat);-->#_they_meow

and it will not affect the display of the code, but it would also mean that all 
tabs are not 8 characters wide.

>From memory, the 'expand' tool I mentioned handles this situation properly - 
>instead of treating a tab as a particular width, it (correctly) treats a tab 
>as moving to the next column from a list of columns (typically 8, 16, 24, ...).

Just as one example of how tabs can be annoying: when you generate diffs of 
files with tabs, you end up with a situation like this:

_my_$animals_=_('dog',-->#_they_bark
+------>_______'cat);-->#_they_meow

The first line was not modified, so is preceded by a space.  The second line 
was added, so is preceded by a plus character.  The tab that follows the plus 
character is now a different width (only 7 characters instead of 8), but the 
text above it ("my $anim") is still the same width, so the code is out of 
alignment.  One fix for this is to run all your diffs through 'expand', telling 
it that the tab stops are at 9, 17, 25, ...

In response to Oliver's question "Used vi with tabs and spaces?", vi (or vim or 
some other variety) does allow the tab width to be changed.  I believe it is 
much nicer though when you don't have to configure your editor in order to be 
able to view a file properly - especially if you happen to work on different 
projects with different tab widths.  I imagine that I could set up Emacs to 
configure the tab width differently for different files, but I could think of 
more useful things to do with my time :)

Regards,
David

----------------------------------------------
David O'Shea
Engineer
DSpace Pty Ltd
(an EMS Technologies Company)

[EMAIL PROTECTED]
www.dspace.com.au
T: +61 8 8260 8118
 

> -----Original Message-----
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On Behalf Of 
> Thorsten Schöning
> Sent: Tuesday, 11 December 2007 5:37 PM
> To: [email protected]
> Subject: Re[2]: [scmbug-users] issue #1058
> 
> Guten Tag Kristis Makris,
> am Montag, 10. Dezember 2007 um 22:44 schrieben Sie:
> 
> > We started discussing changing tabs to spaces.
> 
> I'm just interested, what's the advantage of using spaces?
> 
> > If we find a tool that
> > will do just that, I'll run it. But currently perltidy won't do just
> > that.
> 
> Didn't you work with Windows, too? TextPad for Windows can do this
> easily with supported regular expressions, I always use it the other
> way around. ;-)
> 
> Mit freundlichen Grüßen,
> 
> Thorsten Schöning
> 
> -- 
> Thorsten Schöning
> AM-SoFT IT-Systeme - Hameln | Potsdam | Leipzig
>  
> Telefon: Potsdam: 0331-743881-0
> E-Mail:  [EMAIL PROTECTED]
> Web:     http://www.am-soft.de
> 
> AM-SoFT Potsdam GmbH, Konsumhof 1-5, 14482 Potsdam
> Amtsgericht Potsdam HRB 12480, Geschäftsführer Andreas Muchow
> 
> _______________________________________________
> scmbug-users mailing list
> [email protected]
> http://lists.mkgnu.net/cgi-bin/mailman/listinfo/scmbug-users
> 
_______________________________________________
scmbug-users mailing list
[email protected]
http://lists.mkgnu.net/cgi-bin/mailman/listinfo/scmbug-users

Reply via email to