Re: [frogs] Patch for Issue #830

[ Thread Index | Date Index | More lilynet.net/frogs Archives ]


Graham Percival schrieb:
There's some git command that removes whitespaces at the end of
lines.  There's also a tracker issue to find a command (ideally
with python, maybe?) that removes those whitespaces.  Either it's
a hard issue to solve, or nobody noticed it in the tracker.
I found something useful here:
http://code.google.com/p/pymc/issues/detail?id=230

The program is simple but seems to work:

---
#!/usr/bin/env python
import sys

for fname in sys.argv[1:]:
   fd = open(fname,mode='U') # open in universal newline mode
   lines = []
   for line in fd.readlines():
       lines.append( line.rstrip() )
   fd.close()

   fd = open(fname,mode='w')
   fd.seek(0)
   for line in lines:
       fd.write(line+'\n')
   fd.close()
---

Marc
Cheers,
- Graham


On Sun, Dec 20, 2009 at 08:57:32PM +0000, James Lowe wrote:
   > One recommendation: every time you modify a source file, run
   > a macro or something to trim the trailing whitespaces
   As someone who wouldn't know what to run and who does get this
   occasionally in doc patches I push, can someone give me some advice so I
   don't irritate people with any future patches?'
My edits are going to be mainly (only) on the help system (Learning Manual
   etc) than writing code for functions, but any guidance would be helpful to
   pre-squelch this stuff. I see that the lilycontrib.tcl does some - but I
   think that is more a function of git when it makes the patch than anything
   else.
regards James

     ----------------------------------------------------------------------

   From: Marc Hohl
   Sent: Sun 20/12/2009 20:53
   To: Mark Polesky
   Cc: Neil Puttock; Carl Sorensen; Lily-Devel List; frogs@xxxxxxxxxxx
   Subject: Re: [frogs] Patch for Issue #830

 Mark Polesky schrieb:
 > Marc Hohl wrote:
> >> I have renamed the feta-*.mf files accordingly (see issue
 >> #830).  I did
 >>
 >> make clean
 >> make all
 >>
 >> and didn't get any errors. Ok to apply?
>> >
 > I don't see any problems looking at the patch, but that
 > doesn't mean there aren't any.  I'll let Neil or Carl weigh
 > in here.
> I think I found the error, but my computer is doing 'make all' at the
 moment,
 so I have to wait for some tests.
 > One recommendation: every time you modify a source file, run
 > a macro or something to trim the trailing whitespaces
 > (applying this patch triggered some git warnings).  In this
 > case, it's clear that you didn't *add* them (they were in
 > the original files), but even so, patches will apply more
 > cleanly if you make sure to remove them.
 >
 > What text editor are you using?
> I use kate. I think there are some options about handling whitespaces,
 I'll have a closer look at the preferences.

 Thanks for the hint.

 Marc
 > - Mark
 >
 > **********
 >
 > $ git apply 0001-Issue-830-renaming-mf-files.patch
 > [...]-files.patch:144: trailing whitespace.
 > %
 > [...]-files.patch:469: trailing whitespace.
 >         labels (5, 6, 7, 8);
 > [...]-files.patch:1080: trailing whitespace.
 >         set_char_box (0, 1.6 staff_space#,
 > [...]-files.patch:4256: trailing whitespace.
 >
 > [...]-files.patch:4270: trailing whitespace.
 >
 > warning: squelched 37 whitespace errors
 > warning: 42 lines add whitespace errors.
 >
 >
> > >

 ---
 ----
 Join the Frogs!

---
----
Join the Frogs!




---
----
Join the Frogs!


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/