[Insight-developers] Fwd: Followup: using uncrustify

Matthew McCormick (thewtex) matt at mmmccormick.com
Wed Dec 15 13:15:11 EST 2010


Forwarding to the mailing list for the benefit of all from the Dark Side...


---------- Forwarded message ----------
From: kent williams <norman-k-williams at uiowa.edu>
Date: Wed, Dec 15, 2010 at 12:08 PM
Subject: Re: [Insight-developers] Followup: using uncrustify
To: matt at mmmccormick.com


If you use Emacs -- as all programmers should -- add this to your custom.el:

(setq-default show-trailing-whitespace t)

There's a 'delete-trailing-whitespace' command which does exactly that for
the entire file you're editing.

There's an 'untabify' command as well that works on the current region.

On 12/15/10 11:42 AM, "Matthew McCormick (thewtex)" <matt at mmmccormick.com>
wrote:

> Hi Michael,
>
> Great to here you got it working.  Here is a script I use to remove
> trailing whitespace:
>
> #!/bin/bash
>
> # strip trailing whitespaces from filenames sent to stdin or as args
> # Matt McCormick (thewtex) <matt at mmmccormick.com>
> # created 2008 May 01
>
> MYTEMP=`tempfile`
> trap 'rm -f $MYTEMP' SIGINT SIGTERM
>
> stripit() {
>   echo "stripping $1"
>   sed 's/[ \t]*$//' "$1" > $MYTEMP
>   cp $MYTEMP "$1"
> }
>
> if [ $# -gt 0 ]; then
>   while [ "$1" != "" ]; do
>     stripit $1
>     shift
>   done
> else
>   while read; do
>     stripit $REPLY
>   done
> fi
>
> rm $MYTEMP
>
> Regards,
> Matt
>
> On Wed, Dec 15, 2010 at 11:24 AM, Michael Stauffer (Circular Logic)
> <mstauff at verizon.net> wrote:
>> Hi again,
>>
>> I've got it working now, sorry. So the "trailing whitespaces" errors
>> must be coming from git itself. Once I fixed those manually, uncrustify
>> ran and launched the mergetool. Very cool!
>>
>> Is there a way to get uncrustify or something else to fix trailing
>> whitespaces? If not, I'll try to write a simple script myself.
>>
>> Cheers,
>> Michael
>>
>>> -----Original Message-----
>>> From: Michael Stauffer (Circular Logic) [mailto:mstauff at verizon.net]
>>> Sent: Wednesday, December 15, 2010 11:47 AM
>>> To: 'ITK-dev-list'
>>> Subject: using uncrustify
>>>
>>> Hi,
>>>
>>> I'm trying to run uncrustify via the commit hooks to remove a
>>> whole bunch of kwstyle errors with trailing whitespace. I've
>>> enabled it via 'git config hooks.uncrustify true', but it
>>> doesn't seem to be doing anything I can see. Is there an
>>> intermediate output file I should see that has my changed
>>> source? Am I wrong to think that uncrustify should remove
>>> trailing whitespaces?
>>>
>>> I've installed uncrustify 0.56 and set the env var
>>> UNCRUSTIFYBIN to point to the exe.
>>>
>>> Sorry if this is explained somewhere that I've missed, I can't
>>> seem to find it in any documentation.
>>>
>>> Thanks.
>>>
>>> Cheers,
>>> Michael ``
>>
>> _______________________________________________
>> Powered by www.kitware.com
>>
>> Visit other Kitware open-source projects at
>> http://www.kitware.com/opensource/opensource.html
>>
>> Kitware offers ITK Training Courses, for more information visit:
>> http://kitware.com/products/protraining.html
>>
>> Please keep messages on-topic and check the ITK FAQ at:
>> http://www.itk.org/Wiki/ITK_FAQ
>>
>> Follow this link to subscribe/unsubscribe:
>> http://www.itk.org/mailman/listinfo/insight-developers
>>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Kitware offers ITK Training Courses, for more information visit:
> http://kitware.com/products/protraining.html
>
> Please keep messages on-topic and check the ITK FAQ at:
> http://www.itk.org/Wiki/ITK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.itk.org/mailman/listinfo/insight-developers


More information about the Insight-developers mailing list