windows 10, emacs 26.1, dired+

here myfolder in dired mode sort by name (by default):

enter image description here

Now I want to sort by date (inverse mode). I press s and here result:

enter image description here

why file new.txt is above two dots?

The result must be like this (Total Commander):

enter image description here

Is it possible in Emacs to get same result?

1 Answer 1


You asked dired to "sort-by-date", not "sort-by-date-but-keep-.-and-..-at-the-top". dired uses a version of the ls utility to do directory listings. Usually either GNU ls or its own "ls" in elisp. Sorting is dependent on these versions of ls. On Windows, I'd imaging that dired is using the elisp ls. You'd have to hack that to add the sort you want (either directly or via "advice"). The functionality you want may already even exist, and you can add a switch to dired-listing-switches. Take a look at ls-lisp.el for the elisp ls.

More info about dired-listing-switches can be found in the Emacs Manual at 30.1 Entering Dired.

More info about Emacs's emulated ls can be found at G.4 Emulation of ls on MS-Windows.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.