Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

dired-listing-switsches and --group-directories-first

9 views
Skip to first unread message

Rolf Wester

unread,
Aug 28, 2008, 8:45:01 AM8/28/08
to
Hi,

I would like to get dired list the directories first. I set the variable
dired-listing-switsches accordingly:

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

but C-x d then results in:

Listing directory failed

I would be very appreciative for any help.

Regards

Rolf

Mats Lidell

unread,
Aug 28, 2008, 6:09:34 PM8/28/08
to Rolf Wester
>>>>> Rolf wrote:

Rolf> I would like to get dired list the directories first. I set the
Rolf> variable dired-listing-switsches accordingly:

Rolf> (setq dired-listing-switches "-la --group-directories-first")

Rolf> but C-x d then results in:

Rolf> Listing directory failed

Unfortunately the current version of dired in the xemacs package tree
doesn't support long options to ls and since group-directories-first
doesn't seem to be available as a short option I'm afraid there isn't
a real clean solution.

From the dirty solutions I suggest you could either define you own ls
program, by constructing a script that wraps ls and sets the
--group-directories-first option or you could change the internals
slightly in dired-mode by using advice. This should do the trick:

(defadvice dired-insert-directory (before my-dired-insert-directory
(dir-or-list switches &optional wildcard full-p))
(setq switches (concat switches " --group-directories-first")))
(ad-activate 'dired-insert-directory)

Yours
--
%% Mats

Martin Fischer

unread,
Aug 29, 2008, 6:54:21 AM8/29/08
to

Rolf Wester writes:

Hi,

GNU-Emacs has ls-lisp.el which provides an option ls-lisp-dirs-first.

Don't know if it's possible, to use it within X-Emacs.

Martin

Mats Lidell

unread,
Aug 29, 2008, 5:21:46 PM8/29/08
to
>>>>> Martin Fischer <paro...@web.de> writes:

Martin> GNU-Emacs has ls-lisp.el which provides an option
Martin> ls-lisp-dirs-first. Don't know if it's possible, to use it
Martin> within X-Emacs.

Unfortunately that has not been synced into the dired version in the
XEmacs Package Tree. So it is not possible to use that out of the box
I'm afraid.

Yours
--
%% Mats

0 new messages