Re: [Pharo-project] Changesets with LF/CRLF instead of CR?
ok stefan as a general principle, I'm open to change for the better :) Now how much? - cost to do - cost of impact - who is helping to fix bugs after - is community happy? For lot of changes we (me myself and I and a couple of others) take the cost and assume the risks. Now you see my question arriving? Are you in charge, committed (SCRUM reference to the pig and chicken story) ? Stef
Hi Eliot:
On 29 Nov 2010, at 23:31, Eliot Miranda wrote:
Is there an easy way to have change sets filed out with LF instead of the horribly incompatible CR?
Are conversion scipts of help? I depend on the following: Turns out, an error that lead me to believe there are problems with LF changesets had another cause. (a missing line end at the end of the file)
So, now I guess, the only thing to do to avoiding the CR line endings in change sets is to convince you guys that CR is not the standard line ending on OS X, and completely outdated in general.
I would like to suggest to change the behavior of the line-end guessing in MultiByteFileStream to that end.
Thanks Stefan
-- Stefan Marr Software Languages Lab Vrije Universiteit Brussel Pleinlaan 2 / B-1050 Brussels / Belgium http://soft.vub.ac.be/~smarr Phone: +32 2 629 2974 Fax: +32 2 629 3525
Hello: On 30 Nov 2010, at 09:20, Stéphane Ducasse wrote:
as a general principle, I'm open to change for the better :) Now how much? - cost to do Cleaning it up completely does not looks like a simple/localized change to a single method.
There are 'aFileStream cr' message sends all over the place, which from my perspective are wrong in the sense that they are not platform independent. I guess the best way would be to have something like 'aFileStream nl' or 'lineEnd' instead. Where nl/lineEnd uses MultiByteFileStream LineEndDefault. Best regards Stefan -- Stefan Marr Software Languages Lab Vrije Universiteit Brussel Pleinlaan 2 / B-1050 Brussels / Belgium http://soft.vub.ac.be/~smarr Phone: +32 2 629 2974 Fax: +32 2 629 3525
Le 30/11/2010 13:13, Stefan Marr a écrit :
Cleaning it up completely does not looks like a simple/localized change to a single method.
There are 'aFileStream cr' message sends all over the place, which from my perspective are wrong in the sense that they are not platform independent. I guess the best way would be to have something like 'aFileStream nl' or 'lineEnd' instead. Where nl/lineEnd uses MultiByteFileStream LineEndDefault.
maybe eol for end of line ? Alain
Best regards Stefan
A possible wrinkle: what about using Linux to write a file for a Windows user? ________________________________________ From: pharo-project-bounces@lists.gforge.inria.fr [pharo-project-bounces@lists.gforge.inria.fr] On Behalf Of Stefan Marr [pharo@stefan-marr.de] Sent: Tuesday, November 30, 2010 7:13 AM To: Pharo-project@lists.gforge.inria.fr Subject: Re: [Pharo-project] Changesets with LF/CRLF instead of CR? Hello: On 30 Nov 2010, at 09:20, Stéphane Ducasse wrote:
as a general principle, I'm open to change for the better :) Now how much? - cost to do Cleaning it up completely does not looks like a simple/localized change to a single method.
There are 'aFileStream cr' message sends all over the place, which from my perspective are wrong in the sense that they are not platform independent. I guess the best way would be to have something like 'aFileStream nl' or 'lineEnd' instead. Where nl/lineEnd uses MultiByteFileStream LineEndDefault. Best regards Stefan -- Stefan Marr Software Languages Lab Vrije Universiteit Brussel Pleinlaan 2 / B-1050 Brussels / Belgium http://soft.vub.ac.be/~smarr Phone: +32 2 629 2974 Fax: +32 2 629 3525
Hi: On 30 Nov 2010, at 13:56, Schwab,Wilhelm K wrote:
A possible wrinkle: what about using Linux to write a file for a Windows user? That is why I proposed to use MultiByteFileStream LineEndDefault.
There are methods in MultiByteFileStream to set it explicitly. So, it could be either set in a save dialog, or a user preference somewhere, I guess. Best regards Stefan PS: The file stream should be initialized on creation with MultiByteFileStream LineEndDefault, otherwise it is not thread/RoarVM-safe...
________________________________________ From: pharo-project-bounces@lists.gforge.inria.fr [pharo-project-bounces@lists.gforge.inria.fr] On Behalf Of Stefan Marr [pharo@stefan-marr.de] Sent: Tuesday, November 30, 2010 7:13 AM To: Pharo-project@lists.gforge.inria.fr Subject: Re: [Pharo-project] Changesets with LF/CRLF instead of CR?
Hello:
On 30 Nov 2010, at 09:20, Stéphane Ducasse wrote:
as a general principle, I'm open to change for the better :) Now how much? - cost to do Cleaning it up completely does not looks like a simple/localized change to a single method.
There are 'aFileStream cr' message sends all over the place, which from my perspective are wrong in the sense that they are not platform independent. I guess the best way would be to have something like 'aFileStream nl' or 'lineEnd' instead. Where nl/lineEnd uses MultiByteFileStream LineEndDefault.
Best regards Stefan
-- Stefan Marr Software Languages Lab Vrije Universiteit Brussel Pleinlaan 2 / B-1050 Brussels / Belgium http://soft.vub.ac.be/~smarr Phone: +32 2 629 2974 Fax: +32 2 629 3525
-- Stefan Marr Software Languages Lab Vrije Universiteit Brussel Pleinlaan 2 / B-1050 Brussels / Belgium http://soft.vub.ac.be/~smarr Phone: +32 2 629 2974 Fax: +32 2 629 3525
Here a quick hack, in case anyone cares: 'From Pharo1.2a of ''11 June 2010'' [Latest update: #12261] on 1 December 2010 at 10:42:06 pm'! !FileStream class methodsFor: 'file reader services' stamp: 'StefanMarr 12/1/2010 22:42'! writeSourceCodeFrom: aStream baseName: baseName isSt: stOrCsFlag | extension converter fileName lineEndConvention | lineEndConvention := MultiByteFileStream guessDefaultLineEndConvention. lineEndConvention := MultiByteFileStream lineEndConventionAsString: lineEndConvention. extension := stOrCsFlag ifTrue: ['.st'] ifFalse: ['.cs']. converter := aStream contents isAsciiString ifTrue: [MacRomanTextConverter new] ifFalse: [UTF8TextConverter new]. converter installLineEndConvention: lineEndConvention. fileName := baseName, extension. fileName := FileDirectory default checkName: fileName fixErrors: true. [FileStream newFileNamed: fileName do: [:fileStream | (converter isMemberOf: UTF8TextConverter) ifTrue: [fileStream binary. UTF8TextConverter writeBOMOn: fileStream]. fileStream text; converter: converter; nextPutAll: aStream contents; close]] on: Abort do: [:e | ]! ! !MultiByteFileStream class methodsFor: 'class initialization' stamp: 'StefanMarr 12/1/2010 22:39'! defaultToCR "MultiByteFileStream defaultToCR" LineEndDefault := #cr. ^ LineEndDefault! ! !MultiByteFileStream class methodsFor: 'class initialization' stamp: 'StefanMarr 12/1/2010 22:39'! defaultToCRLF "MultiByteFileStream defaultToCRLF" LineEndDefault := #crlf. ^ LineEndDefault! ! !MultiByteFileStream class methodsFor: 'class initialization' stamp: 'StefanMarr 12/1/2010 22:39'! defaultToLF "MultiByteFileStream defaultToLF" LineEndDefault := #lf. ^ LineEndDefault ! ! !MultiByteFileStream class methodsFor: 'class initialization' stamp: 'StefanMarr 12/1/2010 22:36'! lineEndConventionAsString: conventionSymbol ^ LineEndStrings at: conventionSymbol ! ! On 30 Nov 2010, at 14:06, Stefan Marr wrote:
Hi:
On 30 Nov 2010, at 13:56, Schwab,Wilhelm K wrote:
A possible wrinkle: what about using Linux to write a file for a Windows user? That is why I proposed to use MultiByteFileStream LineEndDefault.
There are methods in MultiByteFileStream to set it explicitly. So, it could be either set in a save dialog, or a user preference somewhere, I guess.
Best regards Stefan
PS: The file stream should be initialized on creation with MultiByteFileStream LineEndDefault, otherwise it is not thread/RoarVM-safe...
________________________________________ From: pharo-project-bounces@lists.gforge.inria.fr [pharo-project-bounces@lists.gforge.inria.fr] On Behalf Of Stefan Marr [pharo@stefan-marr.de] Sent: Tuesday, November 30, 2010 7:13 AM To: Pharo-project@lists.gforge.inria.fr Subject: Re: [Pharo-project] Changesets with LF/CRLF instead of CR?
Hello:
On 30 Nov 2010, at 09:20, Stéphane Ducasse wrote:
as a general principle, I'm open to change for the better :) Now how much? - cost to do Cleaning it up completely does not looks like a simple/localized change to a single method.
There are 'aFileStream cr' message sends all over the place, which from my perspective are wrong in the sense that they are not platform independent. I guess the best way would be to have something like 'aFileStream nl' or 'lineEnd' instead. Where nl/lineEnd uses MultiByteFileStream LineEndDefault.
Best regards Stefan
-- Stefan Marr Software Languages Lab Vrije Universiteit Brussel Pleinlaan 2 / B-1050 Brussels / Belgium http://soft.vub.ac.be/~smarr Phone: +32 2 629 2974 Fax: +32 2 629 3525
-- Stefan Marr Software Languages Lab Vrije Universiteit Brussel Pleinlaan 2 / B-1050 Brussels / Belgium http://soft.vub.ac.be/~smarr Phone: +32 2 629 2974 Fax: +32 2 629 3525
-- Stefan Marr Software Languages Lab Vrije Universiteit Brussel Pleinlaan 2 / B-1050 Brussels / Belgium http://soft.vub.ac.be/~smarr Phone: +32 2 629 2974 Fax: +32 2 629 3525
participants (4)
-
Alain Plantec -
Schwab,Wilhelm K -
Stefan Marr -
Stéphane Ducasse