これについてWebを調べると、大抵
(setq ls-lisp-dirs-first t)
を .emacs に書くという情報が見つかるが,これは Windows で ls をエミュレートするための ls-lisp の機能であり,Ubuntu などでは動かない.
ls が使える環境でディレクトリを先に表示したいなら,以下のように .emacs に書く.
(setq dired-listing-switches "-AFl --group-directories-first")
dired の ls オプションは dired-listing-switches
で変更でき,--group-directories-first
によってディレクトリを先に表示できる.-AFl
は好みと環境に合わせて設定する.
また,ディレクトリのシンボリックリンクがファイル側に表示するのが嫌なら -L
を追加すればよい.