Emacs error 'ls does not support --dired'

Since upgrading to emacs 24.x I have seen this error every time I open the directory. All error:

 ls does not support --dired; see `dired-use-ls-dired' for more details. 

Looking at the variable, you can find:

 dired-use-ls-dired is a variable defined in `dired.el'. Its value is nil Original value was unspecified Documentation: Non-nil means Dired should pass the "--dired" option to "ls". The special value of `unspecified' means to check explicitly, and save the result in this variable. This is performed the first time `dired-insert-directory' is called. Note that if you set this option to nil, either through choice or because your "ls" program does not support "--dired", Dired will fail to parse some "unusual" file names, eg those with leading spaces. You might want to install ls from GNU Coreutils, which does support this option. Alternatively, you might want to use Emacs's own emulation of "ls", by using: (setq ls-lisp-use-insert-directory-program nil) (require 'ls-lisp) This is used by default on MS Windows, which does not have an "ls" program. Note that `ls-lisp' does not support as many options as GNU ls, though. For more details, see Info node `(emacs)ls in Lisp'. You can customize this variable. 

I work on FreeBSD; therefore, by default, ls not GNU'ish and does not offer the --dired . In fact, I really don't want to install GNU kernels on all of my servers.

Does anyone have experience using the lisp ls alternative mentioned above?

Presumably dired.el installs dired-use-ls-dired something non-nil on boot, and do I constantly compress it when I first look in the directory? And setting dired-use-ls-dired to nil in my .emacs silence the message?

Does anyone have an opinion that giving up work can be a security problem? those. file names made up of spaces remain invisible?

Maybe I need to check out some of the above ...

+12
emacs freebsd emacs24
source share
3 answers

on macOS ls does not support the --dired , while on Linux it is supported.

 (when (string= system-type "darwin") (setq dired-use-ls-dired nil)) 
+9
source share

Presumably, dired.el installs dired-use-ls-dired for something non-nil on boot, and do I constantly compress it the first time I look at the directory? And setting dired-use-ls-dired to nil in my .emacs will silence the message?

I think you are speaking correctly. Set the nil value. (If this does not help, you can always delete your setting.)

+4
source share

In this case, you can also try using gnu-ls, you can install these utilities, see here how to replace mac-os-x-utilities-with-gnu-core-utilities

In my case, I support both gnu utilities with the prefix "g".

If you use gls, the --dired argument is included

 man gls 

NAME ls - directory listing

DESCRIPTION ls [OPTION] ... [FILE] ...

DESCRIPTION Displays FILE information (current default directory). Sort the entries in alphabetical order if neither -cftuvSUX nor --sort is specified.

  Mandatory arguments to long options are mandatory for short options too. .... -d, --directory list directories themselves, not their contents .... 
 which gls /usr/local/bin/gls 

Then we all set up emacs too:

 (when (string= system-type "darwin") (setq dired-use-ls-dired t insert-directory-program "/usr/local/bin/gls" dired-listing-switches "-aBhl --group-directories-first")) 

Then you can use this:

+2
source share

All Articles