unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: "Drew Adams" <drew.adams@oracle.com>
Cc: Emacs-Pretest-Bug <emacs-pretest-bug@gnu.org>
Subject: RE: Sorting of directories in dired
Date: Thu, 7 Jul 2005 09:43:59 -0700	[thread overview]
Message-ID: <DNEMKBNJBGPAOPIJOOICIEGFCKAA.drew.adams@oracle.com> (raw)
In-Reply-To: <42CCD07F.5010509@student.lu.se>

    >>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
    >has this:
    >
    >(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.

---

(defcustom ls-lisp-emulation
  (cond ((eq system-type 'macos) 'MacOS)
	;; ((eq system-type 'windows-nt) 'MS-Windows)
	((memq system-type
	       '(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)
		 (const MacOS)
		 (const MS-Windows)
		 (const UNIX))
  :group 'ls-lisp)

(defcustom ls-lisp-ignore-case
  ;; 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."
  :type 'boolean
  :group 'ls-lisp)

(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 <cmcmahan@one.net>
  :type 'boolean
  :group 'ls-lisp)

(defcustom ls-lisp-verbosity
  (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
identifier.

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 <howard@silverstream.com>
  :type '(set (const :tag "Show Link Count" links)
	      (const :tag "Show User" uid)
	      (const :tag "Show Group" gid))
  :group 'ls-lisp)

---

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.

  parent reply	other threads:[~2005-07-07 16:43 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-07-06 23:58 Sorting of directories in dired Lennart Borgman
2005-07-07  0:13 ` Juanma Barranquero
2005-07-07  6:49   ` Lennart Borgman
2005-07-07  8:02     ` Juanma Barranquero
2005-07-07  8:28       ` Edward O'Connor
2005-07-07 10:11         ` Juanma Barranquero
2005-07-07 12:24           ` David Kastrup
2005-07-07 10:53         ` theming (was: Sorting of directories in dired) John S. Yates, Jr.
2005-07-07 12:17           ` theming Lennart Borgman
2005-07-07 13:31             ` theming Juanma Barranquero
2005-07-07 13:50               ` theming Lennart Borgman
2005-07-07 14:00                 ` theming Juanma Barranquero
2005-07-07 14:24                   ` theming Lennart Borgman
2005-07-07 17:36               ` theming Drew Adams
2005-07-08  4:36               ` theming Richard M. Stallman
2005-07-08 11:05             ` theming John S. Yates, Jr.
2005-07-07 12:22           ` theming (was: Sorting of directories in dired) David Reitter
2005-07-07 14:20             ` theming David Kastrup
2005-07-08 12:38               ` theming David Reitter
2005-07-08 14:27                 ` theming Stefan Monnier
2005-07-08 22:01                   ` theming Richard M. Stallman
     [not found]             ` <m1DqbHY-0004RAC@rattlesnake.com>
2005-07-07 18:59               ` theming (was: Sorting of directories in dired) David Reitter
2005-07-07 19:11             ` David Reitter
2005-07-10  5:19             ` Richard M. Stallman
2005-07-10  5:19           ` Richard M. Stallman
2005-07-07 20:37         ` Sorting of directories in dired Eli Zaretskii
2005-07-08  1:12         ` Bill Wohler
2005-07-07 16:43     ` Drew Adams [this message]
2005-07-07 21:08       ` Eli Zaretskii
2005-07-07 20:35         ` Drew Adams
2005-07-07 22:41           ` Eli Zaretskii
2005-07-07 22:53             ` Drew Adams
2005-07-08 10:58               ` Eli Zaretskii
2005-07-08 17:40             ` Richard M. Stallman
  -- strict thread matches above, loose matches on Subject: below --
2005-07-07  9:55 LENNART BORGMAN
2005-07-07 16:32 ` Edward O'Connor
2005-07-08 20:59   ` Johan Bockgård
2005-07-07 17:56 ` Alex Schroeder
2005-07-07 20:38 ` Eli Zaretskii
2005-07-07 19:53   ` Lennart Borgman
2005-07-07 21:21     ` Eli Zaretskii
2005-07-07 20:44       ` Lennart Borgman
2005-07-07 22:43         ` Eli Zaretskii
2005-07-07 22:06           ` Lennart Borgman
2005-07-08 10:28             ` Eli Zaretskii
2005-07-07 20:00   ` Drew Adams

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=DNEMKBNJBGPAOPIJOOICIEGFCKAA.drew.adams@oracle.com \
    --to=drew.adams@oracle.com \
    --cc=emacs-pretest-bug@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

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).