nano-devel
[Top][All Lists]
Advanced

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

Re: [Nano-devel] proposal to add support for the XDG base directory spec


From: Benno Schulenberg
Subject: Re: [Nano-devel] proposal to add support for the XDG base directory spec
Date: Tue, 17 Oct 2017 21:39:37 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0


Hello Simon,

Hm.  You made it a bit difficult to review your patch, because you
based it off the state of git of more than two weeks ago.  Further,
you "messed" with the whitespace: changing tabs into spaces.

Op 15-10-2017 om 15:44 schreef Simon Ochsenreither:
I attached a new patch which

- supports both .nanorc and $XDG_CONFIG_HOME/nano/config

No.  A rename of the nanorc file is not acceptable.  The name of
any file that contains config stuff for nano should end in nanorc.
How else is nano going to know that it needs to apply the nanorc
syntax coloring?  Another (minor) reason is: if I come to a new
system, I want to be able to find all nano's config files by
simply doing 'locate nanorc'.

- migrates .nano/search_history to $XDG_DATA_HOME/nano/search_history
- migrates .nano/filepos_history to $XDG_DATA_HOME/nano/position_history

No.  I want a tool to do what I asked it to do, not to "helpfully"
do things.  This migration stuff was deleted from nano the moment
that you suggested to add the XDG stuff.  Don't bring it back in.

How nano should work is: if ~/.nanorc exists, use it.  Otherwise,
check the XDG paths.  If ~/.nano/ exists, use it for both strings
and positions histories.  If it does not exist, try the XDG paths,
and create it if it's missing.

This means that if I am on a rolling distribution, and I don't
bother to move my .nano* stuff to other places, future nanos AND
older nanos will continue to find the config and history files
without me needing to make symlinks or take any other action.
But if I prefer to have my home dir cleaner, and will not use
older nanos, I can move the history files manually.  If instead
I regularly do a reinstall, most likely I will not copy the history
files across, and they will land in the XDG location automatically.

So, please remove all migration machinery from your patch.


Some comments about details in your patch follow.

+/* Construct the legacy history filename.
+   (To be removed in 2020.) */
+char *legacysearchhistfilename(void)
+{
+    return construct_filename(homedir, "/.nano/" SEARCH_HISTORY);
+}

This is incorrect.  If SEARCH_HISTORY=recent_strings would get
passed in during compilation, nano would have mistakenly tried
to move the non-existent ~/.nano/recent_strings file to the XDG
location.

+    if (xdgdatadir != NULL) {
+        nanodatadir = construct_filename(xdgdatadir, "/nano");
+        retval = create_xdgdata_nano_directory_if_not_existing(nanodatadir);
+        free(xdgdatadir);
+    } else {
+        nanodatadir = construct_filename(homedir, XDG_DATA_FALLBACK);
+        retval = create_xdgdata_nano_directory_if_not_existing(nanodatadir);
+    }

The calls of create_xdgdata...() are identical, so they can be moved
out of the if -- calling free() on NULL is not an error.  Doing it
that way means there is no need for splitting have_dotnano() into
two functions.

Also, please leave out any DEBUG stuff.  And if you can resist, don't
change comments either.  Only change the things that you need to change
in order to make the patch *work*.  All the rest is cosmetics and can
be adjusted in subsequent patches.

Benno



reply via email to

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