[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Backwards (and forwards) compatible nanorc files

From: Saagar Jha
Subject: Re: Backwards (and forwards) compatible nanorc files
Date: Sun, 5 Jan 2020 21:10:36 -0800

Comments inline.

Saagar Jha

On Jan 5, 2020, at 03:43, Benno Schulenberg <address@hidden> wrote:

Op 04-01-2020 om 07:20 schreef Saagar Jha:
I use nano quite a bit across a number of machines and I’ve run into an
interesting issue that I am not sure if there is a good solution for: I have
one nanorc that I would like to share across these computers,

Out of curiosity: do you copy the nanorc across?  Or do you somehow
network mount it?

Depending on the circumstances, I either grab a full copy of my dotfiles and “install” it, a process which (among other things) makes it available at ~/.nanorc, or I just grab the file individually.

but it cannot be read without errors on any of them because there is constant
churn in the format for the file. To give you an idea of the situation, I
regularly use versions of nano that literally span over a decade: on my Mac
it’s nano 4.7, but on my Ubuntu machine it’s 2.9.3, on my iPhone it’s 4.3 and
on the family Mac it’s 2.0.6.

If those are the only machines that you use, then why not upgrade the
family Mac to nano-4.7 too?

I use other machines too; those are just some that give an idea of the spread of versions I often deal with. I have the family Mac currently set up so I do not regularly install things or even exercise admin access; my use of nano on that machine falls somewhere along the lines of “I need nano because I edit files from time to time, often enough that I would like to have some of my nanorc’s settings, but I don’t use it often enough to justify installing and maintaining a package manager on it to keep nano up-to-date”. I agree that the premise is a bit convoluted, but it’s coming from a position of not wanting to make too many changes to the computer since I don’t even use it all that often.

Looking at your .nanorc, there aren't any
incompatibilities between 2.9.3 and 4.3 and 4.7, so only the 2.0.6 is
causing problems here, right?

For a while tried to keep my nanorc file portable by just not including incompatible settings, but it was just not fun to use at all so I’ve been slowly adding in things after I came up with the versioning hack. I could probably live with what I have right now when Apple either updates their version of nano or puts it out of its misery like they did with Emacs…

But I'm guessing you are looking for a general solution that covers
all possible nano versions.  Well, then there isn't.

…but yes, I was hoping there might be something like this that I missed, or some clever solution that others were using to work around this. Oh well.

Nanos before
2.1.9 and after 2.8.7 don't know the --quiet option, so it is not
possible to skip and silence those warnings for all nanos.

Nano has evolved.  Some behaviors have changed (^W always searching
forward, for example) and some poorly-named options needed to be renamed.
I have knowingly sacrificed backward compatibility.  Sorry about that.

That’s fine, I’m not too bothered with nano adding new features and changing some of its stranger defaults even if it can occasionally cause issues like these. But perhaps it might be possible to make it possible to work around the changes somewhat for future versions? For example, I could see some sort of feature where you could have multiple, versioned nanorc files and nano would load the correct one automatically, or perhaps you could invoke it with --rcfile= option to pass it a custom nanorc path to load and I could have a Bash alias that was like like nano=“nano --rcfile=~/.nanorc-$(nano --version | grep …)” to pick a compatible one.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]