Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

In Emacs 24.3.1 on Windows 7, how can I group directories first in dired?

I have recently started to use dired in earnest, having belatedly checked out the advice to use C-x C-j given in one of the answers to this question. The 'jump' function is as useful as promised and has led me to investigate dired seriously. One snag is that I cannot group directories above files in dired buffers. I have tried putting the following in my .emacs.d file but it has no effect, presumably because I am running on Windows.

(setq dired-listing-switches "--group-directories-first -alh")

How can I achieve grouped directories above files in dired buffers in Windows 7?

[EDIT] as per the answer below, dired-sort-menu does seem to work - see following screenshot.

dired-sort-menu screenshot

like image 823
SlowLearner Avatar asked Sep 16 '13 08:09

SlowLearner


1 Answers

There is actually an option for this if you're using the ls emulation, as on Windows:

(setq ls-lisp-dirs-first t)

See (customize-group 'ls-lisp) for all the options. There are some useful ones -

; hide the link count, user, and group columns - default is '(links uid gid)
(setq ls-lisp-verbosity nil)

; use ISO dates (the first is for recent dates, second for old dates)
(setq ls-lisp-format-time-list '("%Y-%m-%d %H:%M" "%Y-%m-%d %H:%M"))
(setq ls-lisp-use-localized-time-format t)

Giving you a listing like this -

total used in directory 27734 available 171804716
dr-xr-xr-x       40960 2015-02-12 00:47 .
drwxrwxrwx       16384 2015-02-11 17:37 ..
dr-xr-xr-x       32768 2015-02-07 09:41 bookshelf
drwxrwxrwx       12288 2014-12-03 00:06 library
drwxrwxrwx        8192 2014-08-17 08:21 office
dr-xr-xr-x       16384 2015-02-10 19:54 projects
-rw-rw-rw-       14073 2015-01-31 17:25 android.org
-rw-rw-rw-       65736 2015-02-05 17:09 archive.org
like image 76
Brian Burns Avatar answered Nov 15 '22 08:11

Brian Burns