First, if you use Emacs 24.4 or later (or a developement version past 24.3), then you no longer need either dired-details.el
or dired-details+.el
. Starting with Emacs 24.4, Dired listing details are hidden by default. dired-hide-details-mode
is the relevant mode.
If you use dired+.el (Dired+) then you can more easily take advantage of this new behavior -- it gives you all of the features offered by dired-details+.el
. Use (
anytime to toggle this hiding. You can use Dired+ option
diredp-hide-details-initially-flag
to change the default/initial state. See also option diredp-hide-details-propagate-flag
.
If you use an Emacs version that is prior to Emacs 24.4 (so you need dired-details[+].el
) then try loading dired-details+.el
(which will load dired-details.el
) after you have evaluated your code above. If that does not help, then try also adding this to your defadvice
body, just after (mydired-sort)
: (dired-details-hide)
. If that does not work then we will need to look a bit further.
If you can upgrade your Emacs version then you will soon be able to use Emacs 24.4 (it is in pretest now), in which case you should be able to just load dired+.el
and set option diredp-hide-details-initially-flag
to non-nil
.
Wrt sorting directories first: Are you on MS Windows? If so, consider using libraries dired-sort-menu.el
and dired-sort-menu+.el
. It lets you do that and much more.
UPDATE
The problem is that dired-details caches the list of overlays it uses to hide details. It has already done its job (because of dired-after-readin-hook
), before your sorting is done, and that changes the buffer without updating the cache info. This will fix the problem (there is probably a more elegant way, but this will do):
(defadvice dired-readin
(after dired-after-updating-hook first () activate)
"Sort dired listings with directories first before adding marks."
(mydired-sort)
(let ((dired-details-internal-overlay-list ())) (dired-details-hide)))