Error in Dired sorting on Windows (with Cygwin Emacs)

767 views Asked by At

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")))
1

There are 1 answers

17
Drew On BEST ANSWER

Try setting dired-listing-switches to "-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-nil try setting it to nil, so that you use ls-lisp instead of Cygwin's ls. (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 to MS-Windows. (Be sure to read C-h v for 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.