Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

It also on Linux/UNIX does not create a directory listing itself, but calls an external program, provided by the operating system: ls. Where on a Lisp Machine it calls the Lisp function FS:DIRECTORY-LIST, which underneath is implemented in Lisp via its object system.


On a Unix-compatible system, ls(1) is the highest-level interface to get a directory listing. There is no good reason for Emacs to use scandir(3) (or even opendir(3)/readdir(3)).


GNU Emacs has complex code to deal with it. Some "ls" programs support a "-dired" option, some not. If this option is not supported, then Dired may fail to parse some unusual filenames. Then there is an 'ls' emulation in Emacs Lisp, which by default is not used on UNIX, but on Windows...

There is a huge machinery with lots of complexity to deal with listing directories, either with ls, a GNU provided ls, or by providing a complex emulation of ls.




Consider applying for YC's Fall 2026 batch! Applications are open till July 27.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: