File Outs: Can We Have Unix Line Endings?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
16 messages Options
Reply | Threaded
Open this post in threaded view
|

File Outs: Can We Have Unix Line Endings?

Sean P. DeNigris
Administrator
Any reason not to? Tedious to continually do "%s/\r/\r/g"s on Mac to fix:
  TextStream subclass:^M#UCTextStream^MinstanceVariableNames: ''^MclassVariableNames: ''^MpoolDictionaries: ''^Mcategory: 'UFFA-Core'!^M!
Cheers,
Sean
Reply | Threaded
Open this post in threaded view
|

Re: File Outs: Can We Have Unix Line Endings?

Eliot Miranda-2
I have crcat crvi crmore crdiff crtolf lftocr etc...

Eliot (phone)

On Jul 23, 2014, at 7:17 PM, "Sean P. DeNigris" <[hidden email]> wrote:

> Any reason not to? Tedious to continually do "%s/\r/\r/g"s on Mac to fix:
>  TextStream subclass:^M#UCTextStream^MinstanceVariableNames:
> ''^MclassVariableNames: ''^MpoolDictionaries: ''^Mcategory: 'UFFA-Core'!^M!
>
>
>
>
> -----
> Cheers,
> Sean
> --
> View this message in context: http://forum.world.st/File-Outs-Can-We-Have-Unix-Line-Endings-tp4769721.html
> Sent from the Pharo Smalltalk Developers mailing list archive at Nabble.com.
>

Reply | Threaded
Open this post in threaded view
|

Re: File Outs: Can We Have Unix Line Endings?

Nicolas Cellier
AFAIK, Cuis has switched to LF for simpler git integration.


2014-07-24 8:33 GMT+02:00 Eliot Miranda <[hidden email]>:
I have crcat crvi crmore crdiff crtolf lftocr etc...

Eliot (phone)

On Jul 23, 2014, at 7:17 PM, "Sean P. DeNigris" <[hidden email]> wrote:

> Any reason not to? Tedious to continually do "%s/\r/\r/g"s on Mac to fix:
>  TextStream subclass:^M#UCTextStream^MinstanceVariableNames:
> ''^MclassVariableNames: ''^MpoolDictionaries: ''^Mcategory: 'UFFA-Core'!^M!
>
>
>
>
> -----
> Cheers,
> Sean
> --
> View this message in context: http://forum.world.st/File-Outs-Can-We-Have-Unix-Line-Endings-tp4769721.html
> Sent from the Pharo Smalltalk Developers mailing list archive at Nabble.com.
>


Reply | Threaded
Open this post in threaded view
|

Re: File Outs: Can We Have Unix Line Endings?

Marcus Denker-4
In reply to this post by Sean P. DeNigris

On 24 Jul 2014, at 07:17, Sean P. DeNigris <[hidden email]> wrote:

> Any reason not to? Tedious to continually do "%s/\r/\r/g"s on Mac to fix:
>  TextStream subclass:^M#UCTextStream^MinstanceVariableNames:
> ''^MclassVariableNames: ''^MpoolDictionaries: ''^Mcategory: 'UFFA-Core'!^M!
>

Yes, the default line endings should be unix for everything, this would simplify life
a lot.

        Marcus
Reply | Threaded
Open this post in threaded view
|

Re: File Outs: Can We Have Unix Line Endings?

hernanmd
In reply to this post by Sean P. DeNigris
Why you cannot detect OS and then format accordingly?

Hernán



2014-07-24 2:17 GMT-03:00 Sean P. DeNigris <[hidden email]>:
Any reason not to? Tedious to continually do "%s/\r/\r/g"s on Mac to fix:
  TextStream subclass:^M#UCTextStream^MinstanceVariableNames:
''^MclassVariableNames: ''^MpoolDictionaries: ''^Mcategory: 'UFFA-Core'!^M!




-----
Cheers,
Sean
--
View this message in context: http://forum.world.st/File-Outs-Can-We-Have-Unix-Line-Endings-tp4769721.html
Sent from the Pharo Smalltalk Developers mailing list archive at Nabble.com.


Reply | Threaded
Open this post in threaded view
|

Re: File Outs: Can We Have Unix Line Endings?

Damien Cassou
On Thu, Jul 24, 2014 at 9:32 AM, Hernán Morales Durand
<[hidden email]> wrote:
> Why you cannot detect OS and then format accordingly?


OSPlatform current lineEnding

--
Damien Cassou
http://damiencassou.seasidehosting.st

"Success is the ability to go from one failure to another without
losing enthusiasm."
Winston Churchill

Reply | Threaded
Open this post in threaded view
|

Re: File Outs: Can We Have Unix Line Endings?

Esteban A. Maringolo
In reply to this post by Sean P. DeNigris
2014-07-24 2:17 GMT-03:00 Sean P. DeNigris <[hidden email]>:
> Any reason not to? Tedious to continually do "%s/\r/\r/g"s on Mac to fix:
>   TextStream subclass:^M#UCTextStream^MinstanceVariableNames:
> ''^MclassVariableNames: ''^MpoolDictionaries: ''^Mcategory: 'UFFA-Core'!^M!

Yes please.

And have an option to switch to any other ending for those who want it
that way for any uncomprehensible reason :P.
But Unix by default.


Esteban A. Maringolo

Reply | Threaded
Open this post in threaded view
|

Re: File Outs: Can We Have Unix Line Endings?

Damien Cassou
In reply to this post by Sean P. DeNigris

Agree. Mac switched to Unix line endings long ago

Le 24 juil. 2014 07:18, "Sean P. DeNigris" <[hidden email]> a écrit :
Any reason not to? Tedious to continually do "%s/\r/\r/g"s on Mac to fix:
  TextStream subclass:^M#UCTextStream^MinstanceVariableNames:
''^MclassVariableNames: ''^MpoolDictionaries: ''^Mcategory: 'UFFA-Core'!^M!




-----
Cheers,
Sean
--
View this message in context: http://forum.world.st/File-Outs-Can-We-Have-Unix-Line-Endings-tp4769721.html
Sent from the Pharo Smalltalk Developers mailing list archive at Nabble.com.

Reply | Threaded
Open this post in threaded view
|

Re: File Outs: Can We Have Unix Line Endings?

hernanmd
In reply to this post by Esteban A. Maringolo
There is no need to choose a default because before the file out is executed, one could check the which OS the system is running.
And then switch to the proper line ending.
Is just a one-liner

Smalltalk os isUnix




2014-07-24 11:12 GMT-03:00 Esteban A. Maringolo <[hidden email]>:
2014-07-24 2:17 GMT-03:00 Sean P. DeNigris <[hidden email]>:
> Any reason not to? Tedious to continually do "%s/\r/\r/g"s on Mac to fix:
>   TextStream subclass:^M#UCTextStream^MinstanceVariableNames:
> ''^MclassVariableNames: ''^MpoolDictionaries: ''^Mcategory: 'UFFA-Core'!^M!

Yes please.

And have an option to switch to any other ending for those who want it
that way for any uncomprehensible reason :P.
But Unix by default.


Esteban A. Maringolo


Reply | Threaded
Open this post in threaded view
|

Re: File Outs: Can We Have Unix Line Endings?

Sean P. DeNigris
Administrator
Hernán Morales Durand wrote
There is no need to choose a default...
git was mentioned (which is my use-case too). Since the community is using it more and more, it might make sense to have a default, no?
Cheers,
Sean
Reply | Threaded
Open this post in threaded view
|

Re: File Outs: Can We Have Unix Line Endings?

hernanmd
I see. I don't know the Git use-case. I was suggesting OS detection for the file-out from image to local disk.

But I use Windows now, if you set Unix line ending that would mean I (or anyone using Windows) have to unix2dos for every pull or fetch from any Git repository commited from Pharo?

Hernán



2014-07-25 4:42 GMT-03:00 Sean P. DeNigris <[hidden email]>:
Hernán Morales Durand wrote
> There is no need to choose a default...

git was mentioned (which is my use-case too). Since the community is using
it more and more, it might make sense to have a default, no?



-----
Cheers,
Sean
--
View this message in context: http://forum.world.st/File-Outs-Can-We-Have-Unix-Line-Endings-tp4769721p4770031.html
Sent from the Pharo Smalltalk Developers mailing list archive at Nabble.com.


Reply | Threaded
Open this post in threaded view
|

Re: File Outs: Can We Have Unix Line Endings?

Stephan Eggermont-3
In reply to this post by Sean P. DeNigris
Sean wrote:
>git was mentioned (which is my use-case too). Since the community is using it more and more, it might make sense to have a default, no?

Not AFAIK. You are supposed to tell git and github what to use.

http://stackoverflow.com/questions/170961/whats-the-best-crlf-handling-strategy-with-git

Stephan
Reply | Threaded
Open this post in threaded view
|

Re: File Outs: Can We Have Unix Line Endings?

Nicolas Cellier
At the origin, Smalltalk was all CR
Then some conversions were introduced at input/output from/to external world.
Then we made some of our tools line-Ending-Zoo-Agnostic (for example, text rendering now supports CR, LF, or  CR-LF).
This was questionnable, because we injected a bit more complexity in the image, rather than segregating the complexity at the interfaces.
But I think it was a good change, because we had more and more interfaces, and more and more patches/workarounds to handle.
And finally, being line-Ending-Zoo-Agnostic costs a bit, but not that much.
The most questionnable feature is the presence of mixed convention in image and the impact on simple String comparison...
Some conversion is still required.

In any case, what we must avoid is massively replace cr with lf in our source code.
What I recommand is using (aStream nextLine) rather than (aStream upTo: Character cr).
And we should probably replace most of the (aStream cr) with (aStream newLine) in our tools.
( except in rare places where with really want to control cr/lf because it is protocol specific )

This way, cr/lf will be an implementation detail that we can rapidly switch with a Preference/Setting, some OS-Aware environment variable (some class variable set at image startup to avoid asking os colour at each newLine), or just hardcode.
Even if that does not completely eliminate the need for converting some input/output...



2014-07-25 12:03 GMT+02:00 Stephan Eggermont <[hidden email]>:
Sean wrote:
>git was mentioned (which is my use-case too). Since the community is using it more and more, it might make sense to have a default, no?

Not AFAIK. You are supposed to tell git and github what to use.

http://stackoverflow.com/questions/170961/whats-the-best-crlf-handling-strategy-with-git

Stephan

Reply | Threaded
Open this post in threaded view
|

Re: File Outs: Can We Have Unix Line Endings?

Esteban A. Maringolo
In reply to this post by hernanmd
2014-07-25 3:57 GMT-03:00 Hernán Morales Durand <[hidden email]>:
> There is no need to choose a default because before the file out is
> executed, one could check the which OS the system is running.
> And then switch to the proper line ending.
> Is just a one-liner

Okay, OS line ending by default, but what I want is a way to override
current setting and use the one I like.

If you work both in Linux and Windows, normally you choose only one
(usually linux).
If you install git on Windows, it will ask you if you want to use OS
default or convert everything to a particular line ending when pushing
changes.

Regards,

Esteban A. Maringolo

Reply | Threaded
Open this post in threaded view
|

Re: File Outs: Can We Have Unix Line Endings?

Ben Coman
Esteban A. Maringolo wrote:
2014-07-25 3:57 GMT-03:00 Hernán Morales Durand [hidden email]:
  
There is no need to choose a default because before the file out is
executed, one could check the which OS the system is running.
And then switch to the proper line ending.
Is just a one-liner
    

Okay, OS line ending by default, but what I want is a way to override
current setting and use the one I like.

If you work both in Linux and Windows, normally you choose only one
(usually linux).
If you install git on Windows, it will ask you if you want to use OS
default or convert everything to a particular line ending when pushing
changes.

Regards,

Esteban A. Maringolo


  
When we have the libgit bindings, won't we be able to write direct to the git database (under .git), an by not touching the standard filesystem avoid dealing with platform line endings for our source code store?  Then maybe any line ending conversion by 'git' command-line tools for processing source outside of the image would then by of no concern to the image.
cheers -ben
Reply | Threaded
Open this post in threaded view
|

Re: File Outs: Can We Have Unix Line Endings?

Sean P. DeNigris
Administrator
In reply to this post by Stephan Eggermont-3
Stephan Eggermont wrote
Not AFAIK. You are supposed to tell git and github what to use.
http://stackoverflow.com/questions/170961/whats-the-best-crlf-handling-strategy-with-git
Ah, thanks! Good link :)
Cheers,
Sean