I'm developing Python code in a mostly Windows environment and would
like to try using Acme(-sac) on a day-to-day basis. However, our
codebase has CRLF line endings but Acme seems to assume Unix-style LF-
only line endings inasmuch as it displays the CR character as a
visible glyph. Can I get Acme to automatically convert CRLF line
endings on read and write?
John
See pipefs(4)
Here's an example that worked for me on a directory of RFCs. Where \r
is actually the CR glyph. (The backslash r (\r) doesn't work in the
substitution position of sed, it seems).
Local pipefs -c -r 'sed ''s/\r//''' -w 'sed ''s/$/\r/''' /n/d/library/rfc /n/rfc
The following scripts (from /n/sources/rsc/contrib/scripts, slightly
modified for
use with acme-sac) are useful when dealing with Windows files. (\r to be
replaced with the CR glyph.)
Arvindh
% cat /dis/fromdos
#!/dis/sh
for i in $* {
echo ',s/\r//g
w
q' | ed $i >/dev/null
}
% cat /dis/todos
#!/dis/sh
for i in $* {
echo ',s/(^|[^\r])$/&\r/g
w
q' | ed $i >/dev/null
}
% cat /dis/dcr
#!/dis/sh
load std
if{no $acmewin}{
echo dcr: no acmewin >[1=2]
raise 'fail:no acmewin'
}
echo -n ',s/\r//g' >/mnt/acme/$acmewin/edit
% cat /dis/icr
#!/dis/sh
load std
if{no $acmewin}{
echo icr: no acmewin >[1=2]
raise 'fail:no acmewin'
}
echo -n ',s/(^|[^\r])$/&\r/g' >/mnt/acme/$acmewin/edit
%