Re: Altering DOS/Mac/Unix terminated text files

Fergus Daly <[email protected]>
Newsgroups gmane.editors.nano.general
Message-ID <[email protected]>
Hello, Chris -

>> I'm curious what your use case is here.  

Thank you very much indeed for asking.
I frequently edit DOS text files (other people's preference, or their default) which 9 times out of 10 are intended either as programming scripts or as data sources for statistics applications. The ones I favour work on Linux platforms and, with very little re-compiling, on Cygwin under Windows. The stats applications break if the scripts or source-files are other than Unix-terminated. (You might argue that this is a local failing of the applications, but there we are.) So (i) I need to <SAVE and EXIT> as Unix files; and (ii) there is something rather nice and sparse about text files formatted in this way.
So - as it happens - it suited me for the default mode to be "if not Unix, convert to Unix" with -D (DOS) and -M (Mac) and -N (leave unchanged) as the obvious switches.
Though I would be just as happy for the default to be "leave unchanged" with switches -D, -M, -U which convention would entail the most obvious logic.

>> We still do allow the conversion, it just takes an extra step when saving.  

This had passed me by, I did not notice this. That's great for individual files, exactly as above. For batch operations I would use dos2unix anyway, whatever the architecture of nano.
This facility ("extra step when saving") is fine, but I have to say my preference would still be to issue the instruction from the prompt at the command line at the start of activity (nano followed by nothing, -D, -M, -U) rather than from within the application at the end of activity when saving, for the simple reason that I could then define an alias such as
alias nano = 'nano -U ' 
and the preferred usage would be achieved, and invisible! As it happens I already use
alias nano= 'nano -xS '

Anyway, you were kind enough to ask me my typical use environment, and that's it!

Best wishes,

Fergus
  
-----Original Message-----
From: Chris Allegretta [mailto:[email protected]] 
Sent: 25 March 2015 17:25
To: Fergus Daly
Cc: Benno Schulenberg; [email protected]
Subject: Re: [Help-nano] Altering DOS/Mac/Unix terminated text files

On 3/25/15, Fergus Daly <[email protected]> wrote:
>>   I still don't like to burden nano with format conversions.
>
> That's absolutely fine!
> Actually I greatly prefer the behaviours (both standard and with formatting
> options) of nano 1.3.4 and will carry on using it.
> But of course more modern versions must reflect the originators preferences
> and priorities.
> At least as a result of this interesting correspondence I know that 2.4.0
> does not do format conversions; and that this behaviour is intentional
> rather than accidental.

Hey Fergus,

I'm curious what your use case is here.  Do you frequently edit files
which are DOS format (i.e. someone sends you a file or you copy it
from another system) and you then intend to keep them in Unix format?
In that case I agree our current system is less than perfect, namely
you have to toggle saving back to Unix format by toggling with Meta-D
at the save file prompt.

The design decision we made was what Benno said above, that generally
people will want to stay in the same format that the file was in
before ediitng, and we'd imagine people converting files en masse
would use a conversion tool versus opening files in the editor.  We
still do allow the conversion, it just takes an extra step when
saving.  That said, if you would be fine with an option to the effect
of 'always convert to unix format' which due to the lack of command
line flags would probably need to be a .nanorc option, we could do
that in 2.5 series.

I do hate to think we're leaving users behind though and am curious,
are there other things in older versions of nano you'd like to see
preserved or configurable?
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.