Nemo: Fix sorting of files/folders with special characters in the beginning

Created on 10 Mar 2019  Â·  40Comments  Â·  Source: linuxmint/nemo

```

  • Nemo version (nemo --version) 4.0.6
  • Is issue with desktop or windowed nemo? windowed
  • Distribution - (Mint 17.2, Arch, Fedora 25, etc...) Linux Mint 19.1 Cinnamon
  • Graphics hardware and driver used
  • 32 or 64 bit: 64bit
    ```

Issue
Special characters in the beginning of folder names and files are ignored for sorting.

Steps to reproduce
When sorting the following folders alphabetically, the "_" in the beginning is ignored and the next character is used for sorting:
Aaron
Peter
_Sandra

Expected behaviour
When sorting the following folders alphabetically, the one with the "_" in the beginning is first.
_Sandra
Aaron
Peter

Other information
The only situation where I can think of the current behavior as good is if somebody put the special character in the first posion __by accident__, in all other use cases the user put the special character there __on purpose__ so ignoring it for sorting is bad UX.
Also, the current behavior is counterintuitive for people coming from other linux distros (I used kubuntu and xubuntu before, I think the behavior is differen) or from windows. I think we should strive to welcome those users with their habits.

Maybe also relevant (but not in favor of the proposal there): https://github.com/linuxmint/nemo/issues/1967

Most helpful comment

It is absurd that after so many years there is still not the option to sort the file names in the usual way.

All 40 comments

I adhere to the request.
I can't understand, special characters are ignored intentionally?
I clarify that it is not just the initial characters, in any part of the name they are ignored.

I dont know if it is "by design" or is a bug or a kind of missing or the programmer was drunk, but it is inconceivable.

It is absurd that after so many years there is still not the option to sort the file names in the usual way.

I totally second the request.

In my old file system, I had a few folders starting with ! so they would be the first one to show up. However, now they're just somewhere in between all the other ones. Which feels ... not right. :-)

would actually be cool to have this... at least as an option that is by default disabled

I disagree. If it becomes a setting, it should be enabled (not disabled) by
default. As I have pointed out before, the current setup ignores a
deliberate user action, which is bad UX.

Is this behavior inherited from upstream? Should we file a bugreport there,
or should we fix it in nemo?

Meru notifications@github.com schrieb am Mi., 24. Apr. 2019 22:59:

would actually be cool to have this... at least as an option that is by
default disabled

—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/linuxmint/nemo/issues/2085#issuecomment-486423728,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AG2EN5MPWNUBAOOM363SWI3PSDC3DANCNFSM4G46FCLQ
.

Sorting order Nemo is a function of your locale, different locales can have different conventions. For strict ASCII sorting (which is what I think posters in this thread are after) add export LC_COLLATE=C to your ~/.profile, log off, log back on.

@smurphos This seems to work beautifully, thanks a lot! :)

@alexanderdd I agree with you. But I am looking at it from user's perspective, while you - from dev's. From my perspective, any solution is fine, as long as I will be able to make it work the way I want to. But if things should be made right, it should be made the way you suggest.

P.S.
haven't looked into locale thingy yet. but even if it works, this solution would not look optimal for such an important thing as filesystem browser and less experienced users won't even know they need to look for this github ticket to figure it out

P.P.S.
As a side note, I develop some python apps on windows, mainly and make a heavy use of underscores and exclamation marks and always wondered about this issue since when I open my repo in Mint I have hard time finding the files I need.

@smurphos:

add export LC_COLLATE=C to your ~/.profile, log off, log back on.

I had tried this but it seems to don't work. Does it maybe depend by the distribution? I have Mint 19.1

@bannisdale:

This seems to work beautifully, thanks a lot! :)

Which distro have you?

(Anyway it would be good if there was an option for the sorting in the file manager)

Newest Mint, Tessa.

Newest Mint, Tessa.

me too. Could you paste here the part of the .profile file that you edited (or even the whole content)?

I basically just copied the line and pasted it below everything else. I'll give you a walkthrough when I'm on my PC again tomorrow.

Okay, so.

  • Open your File Explorer. You should see Home/$username. If not or if you are unsure, navigate to My Computer > Home or File System > Home > $username.
  • Right click somewhere. Check "Show Hidden Files" (might be checked already)
  • Scroll down until you find the .profile file.
  • Open the file. I used notepadqq to do this.

You should see the following file:

image

As you can see, I already included the line that smurphos mentioned at the bottom of the file.

  • Save
  • Reboot

The result, at least for me, looks like this:

image

Before that, the !downloads folder was sorted below A Test Folder as if it were starting with 'd'.

If this doesn't work for you, I'm afraid that I probably won't be able to provide more information, so sorry in advance. :)

@smurfphos:

For strict ASCII sorting (which is what I think posters in this thread are after)
add export LC_COLLATE=C to your ~/.profile, log off, log back on.

This solves sorting of some special characters before letters, but certainly doesn't address Nemo's handling of files starting with numbers. In addition, period and pound-sign still appear after letters. Here's a directory of text files with names starting with all the allowed special characters that should sort before all numbers and letters (ASCII 33-46), some numbers, and some upper/lower-case letters:

user@host:~/sort$ cat /etc/lsb-release
DISTRIB_ID=LinuxMint
DISTRIB_RELEASE=19.1
DISTRIB_CODENAME=tessa
DISTRIB_DESCRIPTION="Linux Mint 19.1 Tessa"
user@host:~/sort$ cat ~/.profile | grep COLL
export LC_COLLATE=C
user@host:~/sort$ ls -al --group-directories-first
total 8
drwxr-xr-x  2 user user 4096 Apr 26 07:50  .
drwxr-xr-x 60 user user 4096 Apr 26 07:37  ..
-rw-rw-r--  1 user user    0 Apr 26 07:23 '!.txt'
-rw-rw-r--  1 user user    0 Apr 26 07:24 '".txt'
-rw-rw-r--  1 user user    0 Apr 26 07:24 '#.txt'
-rw-rw-r--  1 user user    0 Apr 26 07:24 '$.txt'
-rw-rw-r--  1 user user    0 Apr 26 07:24  %.txt
-rw-rw-r--  1 user user    0 Apr 26 07:24 '&.txt'
-rw-rw-r--  1 user user    0 Apr 26 07:24 "'.txt"
-rw-rw-r--  1 user user    0 Apr 26 07:24 '(.txt'
-rw-rw-r--  1 user user    0 Apr 26 07:24 ').txt'
-rw-rw-r--  1 user user    0 Apr 26 07:24 '*.txt'
-rw-rw-r--  1 user user    0 Apr 26 07:24  +.txt
-rw-rw-r--  1 user user    0 Apr 26 07:24  ,.txt
-rw-rw-r--  1 user user    0 Apr 26 07:24  -.txt
-rw-rw-r--  1 user user    0 Apr 26 07:24  .txt
-rw-r--r--  1 user user    0 Apr 26 07:23  1.txt
-rw-r--r--  1 user user    0 Apr 26 07:23  2.txt
-rw-r--r--  1 user user    0 Apr 26 07:23  3.txt
-rw-r--r--  1 user user    0 Apr 26 07:24  A.txt
-rw-r--r--  1 user user    0 Apr 26 07:24  B.txt
-rw-r--r--  1 user user    0 Apr 26 07:24  C.txt
-rw-r--r--  1 user user    0 Apr 26 07:24  a.txt
-rw-r--r--  1 user user    0 Apr 26 07:24  b.txt
-rw-r--r--  1 user user    0 Apr 26 07:24  c.txt

Clearly, changing the locale has fixed the sorting for ls. Meanwhile, nemo seems to have a mind of its own:

sort

Sorry, I see now that it actually worked, but not for the character "_" which I used in my files.
I have in many folders files with "_name" to keep them on the top of the list (as well folders), but the setting "LC_COLLATE=C" doesn't affect the _
If I had used a "!" it would have been better. Now it is quite a trouble to rename all the involved folders and files.
Furthermore, as Smurfphos mentions, The problem with the sorting of numbers in Nemo, remains.

DOH! I left underscore out of my list! For both ls using LC_COLLATE=C and Nemo, it slots in between the upper and lower case letters.

Yes right. I wondered why the underscore was not in your list. I though you knew already about it:) But I wonder if I am the only who uses the uderscore "_" to put files and folder on the top of the lint in the file explorer:) It keeps the filename better distinguishable.

Added export LC_COLLATE=C to my .profile but did not work. Nemo still ignores characters like $ - _ and others...
Compare behavior of mc vs nemo

I have the same problem with the special chars by sorting.

best_files
_download
other_files

Before I used the underscore sign to bring the folder on top of the list.
Please make a switch in the config, that the special chars are not ignored.
Not even user understand the config by editing a mysterious file.

Thanks in advance.

File pinning was introduced partly to address this. There are really no plans to further address this issue beyond possible tweaks to that feature.

I'm evaluating to abandon Nemo in favor to Thunar or similar.

I'm evaluating to abandon Nemo in favor to Thunar or similar.

Thunar has the same problem. As far as I know only Dolphin and Deepin File Manager use a useful sort order like in Windows and not the standard sort order you get in the Terminal with the ls-command.

It will be Dolphin then, thanks.
Midnight commander behave as expected too.

@roberdaniel I would use Dolphin, but with Cinnamon there is this issue: https://github.com/linuxmint/cinnamon/issues/8584

Ignoring deliberate user input is bad UX.

Isn't Linux Mint all about great UX? Then don't close this but fix it.

damian101 notifications@github.com schrieb am Fr., 23. Aug. 2019, 16:03:

@roberdaniel https://github.com/roberdaniel I would use Dolphin, but
with Cinnamon there is issue #8584.

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/linuxmint/nemo/issues/2085?email_source=notifications&email_token=AG2EN5KOD4KFENJBBDHG72LQF7U47A5CNFSM4G46FCL2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD5AJXQI#issuecomment-524327873,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AG2EN5KV6WMOAR2SHQ7XBSTQF7U47ANCNFSM4G46FCLQ
.

It has not sense to close this issue. It is a very basic feature which many users are waiting to be fixed since years. This and many similar "small issues" are the reason why many users switch back to Windows after fighting with such annoying problems with Linux. "Everything is a workaround" doesn't work for the most of the regular desktop users. The community should listen more to the needs of the users.

The original request was to allow a windows hack to work (using special characters to fake out the sort order so you could keep things at the top). I thought, why not provide an actual way to bring important files to the top of the view, without resorting to trickery? So that's exactly what we did with pinning. From my perspective, this is the exact opposite of ignoring user input.

It didn't make sense to change the sort order for everyone from what 99% of users are used to and ok with, for some very small but vocal minority. This is typically what we have to evaluate, and to me it seemed to be a way of accommodating both groups of users.

I've heard all the shaming and threats before, you won't minimize our efforts just because you didn't get precisely what you wanted.

@mtwebster The thing is, there should be a uniform file sort order across all platforms. File managers on Windows, macOS, and Android all use the same sort order, with special characters coming first, then numbers and then letters. Only on Linux most file managers just use the sort order you get in the terminal and apply natural sorting to it. The only exceptions I know of are Dolphin and the Deepin File Manager. Both Deepin File Manager and Nemo are based on Nautilus, so maybe someone could look at their code to make this work in Nemo.
I think I would prefer the "universal sort order" over the sort order you get in Linux terminal and Windows Powershell even if I haven't got used to it, because it makes more sense and I think it is what I would expect when I got in front of a computer for the first time.

damian101 has right. The question is why it is so difficult just to add an option "sorting mode" in the option menu, where you can select how you want to sort the files in Nemo "universal, natural, numerical, etc...". The pinning function is not the solution.
@mtwebster Maybe you refer to the 99% of the Linux users. The 99% of the world-users expect the file sorting working in the standard way, independently of which file manager, or OS you use.

I forgot to mention my use case:

Both in my private life as in my business, I access the same files through
Nextcloud. We use both Windows and Linux machines, and sometimes the cloud
interface. Nextcloud and Nemo can do favourites/file pinning, but it is not
translated to all OS file explorers (and it probably never will).

So the method to bring important files/folders to attention for all users
is to use a leading underscore. Windows respects it, Nextcloud webinterface
respects it, Linux Mint/Nemo doesn't.

Maybe some others have the same use case?

Tyco72 notifications@github.com schrieb am So., 25. Aug. 2019, 12:09:

damian101 has right. The question is why it is to difficult just to add
an option "sorting mode" in the option menu, where you can select how you
want to sort the files in Nemo "universal, natural, numerical, etc...". The
pinning function is not the solution.
@mtwebster https://github.com/mtwebster Maybe you refer to the 99% of
the Linux users. The 99% of the world-users expect the file sorting working
in the standard way, independently of which file manager, or OS you use.

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/linuxmint/nemo/issues/2085?email_source=notifications&email_token=AG2EN5P7UMS3XSTAVLNNGPTQGJK3ZA5CNFSM4G46FCL2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD5CQOIY#issuecomment-524617507,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AG2EN5JCWXBGT3THQ65E34LQGJK3ZANCNFSM4G46FCLQ
.

@alexanderdd It's somewhat similar for me. I use both Windows and Linux on the same machine. Some of the files and folders are also shared within my family. Only Linux is running into the issue that the Folder "_Important Files" shows up in between the folders "Arbitrary Files" and "More Files". ;-)

I personally would prefer all OSs sorting the files the same way, but given that the opinions differ, it's probably the best way to go with a sorting option in the settings.

It didn't make sense to change the sort order for _everyone_ from what 99% of users are used to and ok with, for some very small but vocal minority. This is typically what we have to evaluate, and to me it seemed to be a way of accommodating both groups of users.

I argue, that 99% of these 99% have 2 reasons why you don't hear from them.

  1. They don't know, that this possibility exists to bring suggestions.
  1. They don't care, because the don't know, that the "_" can make there life easier.

I would like to add that Midnight Commander uses the expected sorting with special characters at the top as commented early in this ticket.

Also would like this to be implemented.

Linux user for 3 years now, programmer for 30+ years before that. Mint is an awesome distro and my choice after evaluating 30+ distros. That being said, it is frustrating to encounter things like this that will never be fixed. I know that resources are finite and that this is not an issue that is specific to Linux distro developers, as I have encountered the same things from Linux software developers in general. Filezilla is a prime example. I guess what I am trying to say is that I feel like I understand both sides of issues like this. Maybe when I win the Powerball I can fund the Mint team to take on issues like this. :-)

Maybe this is the wrong place to discuss this, because the issue is upstream? Can someone point me to the relevant upstream project? Is it "ls" commmand? And maybe to the correponding issue (cause I bet we are not the first people to bring this up)?

But then dolphin and midnight commander has it, so it can be fixed downstream...

But mint devs have said above that this will not be fixed, and the issue is closed already, so unless someone has the ability to make a pull request, we are stuck with weird sorting for ever.

@alexanderdd I guess an upstream "fix" would have to made for every base distribution individually and Ubuntu/Mint users aren't the only ones who enjoy the Nemo file manager.

I thought maybe the current behavior has its roots in how the ls command (or something else really basic) works, which is the same in all linux distros.

But that is probably even harder than trying to convince Mint Devs about fixing sort order.

damian101

@alexanderdd https://github.com/alexanderdd I guess an upstream "fix" would have to made for every base distribution individually and Ubuntu/Mint users aren't the only ones who enjoy the Nemo file manager.

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub https://github.com/linuxmint/nemo/issues/2085?email_source=notifications&email_token=AG2EN5KVPEGZ3VLNOS2R24TRCZULNA5CNFSM4G46FCL2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOELYI4JQ#issuecomment-586190374 , or unsubscribe https://github.com/notifications/unsubscribe-auth/AG2EN5PJWB3TQAZCLXTJ6O3RCZULNANCNFSM4G46FCLQ .

Just found this issue and dropped in here to say that there should really be an option to enable sorting in a similar way as other file explorers.
I think that @mtwebster might (?) not have understood: this request is NOT about changing the default sort order, that (maybe?) most users are happy with. This is only about adding some option so that Nemo (that I use for years) can have a behavior consistent with the other file explorers. This is crucial in a multi-OS shared filed environment, as @bannisdale and @alexanderdd pointed out.

And, talking about consistency, I agree that Nemo mimics the behavior of ls -l (or maybe it even uses it as backend?), but does that mean that this is the best way to go ?
Personaly, I don't think so, I believe sorting should be possible using plain ASCII-table ordering (but I agree that this can be disputed).
And that this should be possible using some Nemo options, not using some locale change in profile.

My 2 cents, hope this gets fixed one day...

Was this page helpful?
0 / 5 - 0 ratings