In a Cygwin Emacs on Windows, in Dired, if I try to sort by time (for example), I get the error:
insert-directory: Listing directory failed but `access-file' worked
In a Windows Emacs binary on Windows, I do not have any problem, but Emacs uses its own implementation of ls IIUC.
What I don't understand is that Cygwin ls DOES understand options such as --dired and -t (to sort by modification time).
My current config:
;; Switches passed to `ls' for Dired.
(setq dired-listing-switches
(cond ((eq system-type 'windows-nt) ; Native Windows version of Emacs.
"-a -F -l")
(t ; Cygwin version of Emacs or ...
"-a -F --group-directories-first -l --time-style=long-iso")))
Try setting
dired-listing-switchesto"-aFl"instead of"-a -F -l". Maybe that will make some difference (but it does not change anything for me).What is your value of
ls-lisp-use-insert-directory-program? If it is non-niltry setting it tonil, so that you use ls-lisp instead of Cygwin'sls. (At least do that as a trial, and maybe you will want to stick with that.)what is your value of option
ls-lisp-emulation? If it is something else, try customizing it toMS-Windows. (Be sure to readC-h vfor this option - e.g., use Customize.)In sum, I suggest that you first try getting Dired to work OK using ls-lisp and not Cygwin's
ls. That will at least give you a solid Dired to work with. If you like, you can then still pursue tackling your problem as stated, i.e., to get it working with Cygwin Emacs.