[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kstars-devel
Subject:    Re: [Kstars-devel] whitespace: worth fixing?
From:       James Bowlin <bowlin () mindspring ! com>
Date:       2007-09-21 23:50:38
Message-ID: 200709211750.38270.bowlin () mindspring ! com
[Download RAW message or body]

On Fri September 21 2007, Jason Harris wrote:
> I ran the ruby script I got from a KDE dev on skymapevents.cpp as a test.
> It bombed out on a large switch() block, so it looks like the case-align
> code isn't bulletproof.

Here is a two line Perl script that will do the tab expansion:

#!/usr/bin/perl -p -i.bak
s/\t/    /g;

This version will create backup files with .bak appended to the filename.
If you don't want backups remove ".bak" from the first line (but leave
in the -i which tells Perl to edit the files in-place).

Simply copy the two lines into a file (no leading blank line, no leading
space before the #!), call it expand.pl for example then run it like:

$ chmod a+x expand.pl
$ ./expand.pl *.cpp *.h

It needs the -p and -i Perl options for it to run correctly so it's
best to use the chmod command to make the script executable.

It does not bomb out but it is very fast so you might think it didn't
run if you don't use backup files.


-- 
Peace, James
_______________________________________________
Kstars-devel mailing list
Kstars-devel@kde.org
https://mail.kde.org/mailman/listinfo/kstars-devel
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic