macosemacsdired

error in dired sorting on OS X


On OS X 10.5 Emacs 23.2, in dired-mode, if I try to sort by dired-sort-toggle-or-edit with prefix argument --sort=extension or -X, I get:

insert-directory: Listing directory failed but `access-file' worked

and the dired buffer becomes empty. I tried setting

(setq dired-use-ls-dired nil)

but this had no effect. dired-sort-toggle-or-edit and sorting by extension seems to work okay on my Ubuntu box. Anyone have a clue what's going on?


Solution

  • The ls that's installed on OS X doesn't support -X or any long arguments like --sort. Setting dired-use-ls-dired won't have any effect; dired will always use ls, but if that variable is non-nil, it will pass --dired to ls.

    If you want that type of sorting, you can probably use something like fink to install coreutils, which will provide an ls more like what you're used to in Ubuntu.