[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: Sorting of directories in dired
RE: Sorting of directories in dired
Thu, 7 Jul 2005 09:43:59 -0700
>>In dired files are sorted case sensitive. This does not make
sense on an
>>OS with case insensitive file system. Is there any way to get the
>>listing in dired sorted case insensitive?
>If you're on Windows, dired is using the Lisp emulation of `ls', that
>is, ls-lisp.el. You can configure it to be case insensitive. My .emacs
>(when (eq system-type 'windows-nt)
> (setq ls-lisp-emulation 'MS-Windows
> ls-lisp-dirs-first t
> ls-lisp-ignore-case t
> ls-lisp-verbosity (nconc (and (w32-using-nt)
> '(links)) '(uid))))
I've been doing the same thing Juanma does (code above). But I wonder if
there isn't a bug in `ls-lisp.el'. Notice the commented-out line in
`ls-lisp-emulation' (below). Commenting it out does not make sense in light
of the code of `ls-ignore-case', `ls-lisp-dirs-first', and
`ls-lisp-verbosity', together with the fact that `ls-lisp.el' is preloaded.
The latter options should not bother to test `ls-lisp-emulation'. They
appear dependent on `ls-lisp-emulation', but if that is set by a user, it
will be set _after_ all of these preloaded defcustoms, so the user will in
any case be obliged to set each of these options, not just
`ls-lisp-emulation'. IOW, the dependency code doesn't work.
(cond ((eq system-type 'macos) 'MacOS)
;; ((eq system-type 'windows-nt) 'MS-Windows)
'(hpux dgux usg-unix-v unisoft-unix rtu irix berkeley-unix))
'UNIX)) ; very similar to GNU
;; Anything else defaults to nil, meaning GNU.
"*Platform to emulate: GNU (default), MacOS, MS-Windows, UNIX.
Corresponding value is one of the atoms: nil, MacOS, MS-Windows, UNIX.
Sets default values for: `ls-lisp-ignore-case', `ls-lisp-dirs-first',
`ls-lisp-verbosity'. Need not match actual platform. Changing this
option will have no effect until you restart Emacs."
:type '(choice (const :tag "GNU" nil)
;; Name change for consistency with other option names.
(or (memq ls-lisp-emulation '(MS-Windows MacOS))
(and (boundp 'ls-lisp-dired-ignore-case) ls-lisp-dired-ignore-case))
"*Non-nil causes ls-lisp alphabetic sorting to ignore case."
(defcustom ls-lisp-dirs-first (eq ls-lisp-emulation 'MS-Windows)
"*Non-nil causes ls-lisp to sort directories first in any ordering.
\(Or last if it is reversed.) Follows Microsoft Windows Explorer."
;; Functionality suggested by Chris McMahan <address@hidden>
(cond ((eq ls-lisp-emulation 'MacOS) nil)
((eq ls-lisp-emulation 'MS-Windows)
(if (and (fboundp 'w32-using-nt) (w32-using-nt))
'(links))) ; distinguish NT/2K from 9x
((eq ls-lisp-emulation 'UNIX) '(links uid)) ; UNIX ls
(t '(links uid gid))) ; GNU ls
"*A list of optional file attributes that ls-lisp should display.
It should contain none or more of the symbols: links, uid, gid.
nil (or an empty list) means display none of them.
Concepts come from UNIX: `links' means count of names associated with
the file\; `uid' means user (owner) identifier\; `gid' means group
If emulation is MacOS then default is nil\;
if emulation is MS-Windows then default is `(links)' if platform is
Windows NT/2K, nil otherwise\;
if emulation is UNIX then default is `(links uid)'\;
if emulation is GNU then default is `(links uid gid)'."
;; Functionality suggested by Howard Melman <address@hidden>
:type '(set (const :tag "Show Link Count" links)
(const :tag "Show User" uid)
(const :tag "Show Group" gid))
I suspect that what happened was that the code originally made sense (i.e.
was consistent) with the line uncommented (and it would have made Lennart
and me happy), but someone then decided that this should not be the behavior
for Windows. Instead of removing or commenting-out the corresponding (i.e.
dependent) code everywhere, which would have at least been consistent, only
the Windows line in `ls-lisp-emulation' was commented out.
I would like to see the commented line uncommented again, so that these
variables all do what they were originally desiged to do for Windows.
People, such as Edward, who want "consistent" behavior across platforms
(e.g. showing columns that make no sense outside of Unix), could always
change the option values, but the default values should make sense for each
platform. This is especially important for novices. On Windows, it makes
sense to show directories first, ignore case differences, and get rid of
columns that make no sense.
- RE: Sorting of directories in dired,
Drew Adams <=
- Re: Sorting of directories in dired, Eli Zaretskii, 2005/07/07
- RE: Sorting of directories in dired, Drew Adams, 2005/07/07
- Re: Sorting of directories in dired, Richard M. Stallman, 2005/07/08
- bug in ls-lisp.el (was: Sorting of directories in dired), Drew Adams, 2005/07/08
- Re: bug in ls-lisp.el (was: Sorting of directories in dired), Eli Zaretskii, 2005/07/08
- RE: bug in ls-lisp.el (was: Sorting of directories in dired), Drew Adams, 2005/07/08