* Sort directories then files in Dired.
@ 2010-09-05 18:47 Oleksandr Gavenko
2010-09-05 20:02 ` Thamer Mahmoud
0 siblings, 1 reply; 5+ messages in thread
From: Oleksandr Gavenko @ 2010-09-05 18:47 UTC (permalink / raw)
To: help-gnu-emacs
ls have option --group-directories-first. But then I set
'dired-listing-switches' to '-al --group-directories-first'
output seems damaged:
e:/home/devel/autorpg:
total used in directory 1 available 13039040
281474976729852 0drwxrwxrwx 1 sasha Отсутствует 0 2007-09-05 ..
1407374883569819 0drwxrwxrwx 1 sasha Отсутствует 0 2009-08-24 .
1125899906859437 0drwxrwxrwx 1 sasha Отсутствует 0 2009-08-24 .hg
2533274790412740 1-rw-rw-rw- 1 sasha Отсутствует 209 2009-08-24
README
562949953438149 0drwxrwxrwx 1 sasha Отсутствует 0 2009-08-24
very-dumb-game
--
Best regards!
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Sort directories then files in Dired.
2010-09-05 18:47 Sort directories then files in Dired Oleksandr Gavenko
@ 2010-09-05 20:02 ` Thamer Mahmoud
2010-09-05 21:16 ` Drew Adams
0 siblings, 1 reply; 5+ messages in thread
From: Thamer Mahmoud @ 2010-09-05 20:02 UTC (permalink / raw)
To: help-gnu-emacs
Oleksandr Gavenko <gavenkoa@gmail.com> writes:
> ls have option --group-directories-first. But then I set
> 'dired-listing-switches' to '-al --group-directories-first'
> output seems damaged:
>
> e:/home/devel/autorpg:
> total used in directory 1 available 13039040
> 281474976729852 0drwxrwxrwx 1 sasha Отсутствует 0 2007-09-05 ..
> 1407374883569819 0drwxrwxrwx 1 sasha Отсутствует 0 2009-08-24 .
> 1125899906859437 0drwxrwxrwx 1 sasha Отсутствует 0 2009-08-24 .hg
> 2533274790412740 1-rw-rw-rw- 1 sasha Отсутствует 209 2009-08-24
> README
> 562949953438149 0drwxrwxrwx 1 sasha Отсутствует 0 2009-08-24
> very-dumb-game
I don't use --group-directories-first, sorry. Perhaps you should
consider reporting this as a bug.
As an alternative, I use the following code in ~/.emacs which
essentially does the same thing:
(defun mydired-sort ()
"Sort dired listings with directories first."
(save-excursion
(let (buffer-read-only)
(forward-line 2) ;; beyond dir. header
(sort-regexp-fields t "^.*$" "[ ]*." (point) (point-max)))
(set-buffer-modified-p nil)))
(defadvice dired-readin
(after dired-after-updating-hook first () activate)
"Sort dired listings with directories first before adding marks."
(mydired-sort))
For more sorting options, see:
http://www.emacswiki.org/emacs/DiredSortDirectoriesFirst
http://www.emacswiki.org/emacs/DiredSortMenu
--
Thamer
^ permalink raw reply [flat|nested] 5+ messages in thread
* RE: Sort directories then files in Dired.
2010-09-05 20:02 ` Thamer Mahmoud
@ 2010-09-05 21:16 ` Drew Adams
2010-09-17 13:25 ` Oleksandr Gavenko
0 siblings, 1 reply; 5+ messages in thread
From: Drew Adams @ 2010-09-05 21:16 UTC (permalink / raw)
To: 'Thamer Mahmoud', help-gnu-emacs
FYI - dired-sort-menu.el and dired-sort-menu+.el give you all kinds of useful
sort orders for Dired.
http://www.emacswiki.org/emacs/DiredSortMenu
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Sort directories then files in Dired.
[not found] <mailman.3.1283713178.26984.help-gnu-emacs@gnu.org>
@ 2010-09-05 22:10 ` Tim X
0 siblings, 0 replies; 5+ messages in thread
From: Tim X @ 2010-09-05 22:10 UTC (permalink / raw)
To: help-gnu-emacs
Oleksandr Gavenko <gavenkoa@gmail.com> writes:
> ls have option --group-directories-first. But then I set
> 'dired-listing-switches' to '-al --group-directories-first'
> output seems damaged:
>
> e:/home/devel/autorpg:
> total used in directory 1 available 13039040
> 281474976729852 0drwxrwxrwx 1 sasha Отсутствует 0 2007-09-05 ..
> 1407374883569819 0drwxrwxrwx 1 sasha Отсутствует 0 2009-08-24 .
> 1125899906859437 0drwxrwxrwx 1 sasha Отсутствует 0 2009-08-24 .hg
> 2533274790412740 1-rw-rw-rw- 1 sasha Отсутствует 209 2009-08-24 README
> 562949953438149 0drwxrwxrwx 1 sasha Отсутствует 0 2009-08-24
> very-dumb-game
You could use the ls-lisp package, which comes with emacs and set
ls-lisp-dirs-first to have the directories listed first in dired. You
may need to add (require 'ls-lisp) to your .emacs
,----[ C-h v ls-lisp-dirs-first RET ]
| ls-lisp-dirs-first is a variable defined in `ls-lisp.el'.
| Its value is t
|
| Documentation:
| Non-nil causes ls-lisp to sort directories first in any ordering.
| (Or last if it is reversed.) Follows Microsoft Windows Explorer.
|
| You can customize this variable.
|
| [back]
`----
Tim
--
tcross (at) rapttech dot com dot au
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Sort directories then files in Dired.
2010-09-05 21:16 ` Drew Adams
@ 2010-09-17 13:25 ` Oleksandr Gavenko
0 siblings, 0 replies; 5+ messages in thread
From: Oleksandr Gavenko @ 2010-09-17 13:25 UTC (permalink / raw)
To: help-gnu-emacs
On 2010-09-06 0:16, Drew Adams wrote:
> FYI - dired-sort-menu.el and dired-sort-menu+.el give you all kinds of useful
> sort orders for Dired.
>
> http://www.emacswiki.org/emacs/DiredSortMenu
>
Thanks all for replay.
'dired-listing-switches' not work for me because I use
Emacs on Windows and so 'ls-lisp-use-insert-directory-program'
by default set to 'nil'.
I check 'ls-lisp.el' and found easy solution for my needs.
'ls-lisp-dirs-first' is essential part of them, but
you can find they all useful:
;; If non-nil - use 'insert-directory-program', which I dislike.
(setq ls-lisp-use-insert-directory-program nil)
(setq ls-lisp-ignore-case t)
(setq ls-lisp-dirs-first t)
(if (eq system-type 'windows-nt)
(setq ls-lisp-verbosity nil)
(setq ls-lisp-verbosity '(links uid gid)))
;; Force use 'ls-lisp-format-time-list'.
(setq ls-lisp-use-localized-time-format t)
(setq ls-lisp-format-time-list
'("%Y-%m-%d %H:%M"
"%Y-%m-%d "))
--
Best regards and happy hacking!
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2010-09-17 13:25 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-09-05 18:47 Sort directories then files in Dired Oleksandr Gavenko
2010-09-05 20:02 ` Thamer Mahmoud
2010-09-05 21:16 ` Drew Adams
2010-09-17 13:25 ` Oleksandr Gavenko
[not found] <mailman.3.1283713178.26984.help-gnu-emacs@gnu.org>
2010-09-05 22:10 ` Tim X
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).