From owner-ntemacs-users@june  Thu Jan 11 09:49:02 1996
X-VM-v5-Data: ([nil nil nil nil nil nil nil nil nil]
	[nil "" "11" "January" "1996" "17:31:47" "GMT" "George Nassas" "George_Nassas@tvo.org" nil "25" "Re: How I solved my 'dired' problem..." "^From:" nil nil "1" nil nil nil nil]
	nil)
Received: from joker.cs.washington.edu (joker.cs.washington.edu [128.95.1.42]) by june.cs.washington.edu (8.7.2/7.2ju) with SMTP id JAA20961 for <voelker@june.cs.washington.edu>; Thu, 11 Jan 1996 09:49:02 -0800
Received: from june.cs.washington.edu (june.cs.washington.edu [128.95.1.4]) by joker.cs.washington.edu (8.6.12/7.2ws+) with ESMTP id JAA17009 for <voelker@joker.cs.washington.edu>; Thu, 11 Jan 1996 09:48:59 -0800
Received: from bertrand.ccs.carleton.ca (bertrand.ccs.carleton.ca [134.117.1.42]) by june.cs.washington.edu (8.7.2/7.2ju) with SMTP id JAA20485 for <ntemacs-users@cs.washington.edu>; Thu, 11 Jan 1996 09:45:33 -0800
Received: from tvo.org by bertrand.ccs.carleton.ca (4.1/SMI-4.0) 	id AA17497; Thu, 11 Jan 96 12:45:24 EST
Reply-To: George_Nassas@tvo.org
Message-Id: <337182653.267859@tvo.org>
Organization: From TVOntario's Public BBS
From: George_Nassas@tvo.org (George Nassas)
To: George_Nassas@tvo.org
Cc: ntemacs-users@cs.washington.edu
Subject: Re: How I solved my 'dired' problem...
Date: 11 Jan 1996 17:31:47 GMT

> Go ahead, make me look foolish!

Never mind, I did it myself!

The following code will try to change dired do a case insensitive sort. 

;; sort files in dired buffer by name disregarding case
(add-hook 'dired-after-readin-hook
	  (function (lambda ()
		      (let ((sort-fold-case t))
			(goto-char 0) (next-line 2)
			(sort-fields -1 (point) (point-max))
			;; (sort-numeric-fields 5 (point) (point-max))
			))))

I say try to because it doesn't work for me. When I set sort-fold-case to t I
get some gibberish order, when I set it to nil (ie. do a case sensitive sort)
I get the normal dired order. If you uncomment the sort-numeric-fields it
does
what you'd think (sort by size). What's wrong with sort-fields? I tried this
same code on a 19.29.2 under mips-sgi-irix5.3 and it worked fine.

Does anyone else get this problem under ntemacs?

- George

From owner-ntemacs-users@june  Thu Jan 11 12:01:28 1996
X-VM-v5-Data: ([nil nil nil nil nil nil nil nil nil]
	[nil "Thu" "11" "January" "1996" "14:57:22" "-0500" "Steve Allen" "allen@cachelink.com" nil "51" "Re: How I solved my 'dired' problem..." "^From:" nil nil "1" nil nil nil nil]
	nil)
Received: from joker.cs.washington.edu (joker.cs.washington.edu [128.95.1.42]) by june.cs.washington.edu (8.7.2/7.2ju) with SMTP id MAA11129 for <voelker@june.cs.washington.edu>; Thu, 11 Jan 1996 12:01:27 -0800
Received: from june.cs.washington.edu (june.cs.washington.edu [128.95.1.4]) by joker.cs.washington.edu (8.6.12/7.2ws+) with ESMTP id MAA25814 for <voelker@joker.cs.washington.edu>; Thu, 11 Jan 1996 12:01:25 -0800
Received: from camelot.cachelink.com (camelot.cachelink.com [146.115.34.66]) by june.cs.washington.edu (8.7.2/7.2ju) with ESMTP id LAA10720 for <ntemacs-users@cs.washington.edu>; Thu, 11 Jan 1996 11:58:42 -0800
Received: from lancelot (lancelot.cachelink.com [146.115.34.82])           by camelot.cachelink.com (post.office MTA v1.9.1 ID# 0-11403)           with SMTP id AAA100; Thu, 11 Jan 1996 15:01:13 -0500
Message-ID: <30F56BA2.3E11@cachelink.com>
Organization: CacheLink Corporation
X-Mailer: Mozilla 2.0b4 (WinNT; I)
MIME-Version: 1.0
References: <337182653.267859@tvo.org>
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
From: allen@cachelink.com (Steve Allen)
To: George_Nassas@tvo.org
CC: ntemacs-users@cs.washington.edu
Subject: Re: How I solved my 'dired' problem...
Date: Thu, 11 Jan 1996 14:57:22 -0500

George Nassas wrote:
> 
> > Go ahead, make me look foolish!
> 
> Never mind, I did it myself!
> 
> The following code will try to change dired do a case insensitive sort.
> 

I fixed the real root of the problem - disabling the case sensitive sort of
file names in ls-lisp.el

Add this replacement function to your ~/_emacs and you'll
be much happier.  Perhaps we can add this to the default
release in the future (or a common fixes area?).


(defun ls-lisp-handle-switches (file-alist switches)
  ;; FILE-ALIST's elements are (FILE . FILE-ATTRIBUTES).
  ;; Return new alist sorted according to SWITCHES which is a list of
  ;; characters.  Default sorting is alphabetically.
  (let (index)
    (setq file-alist
	  (sort file-alist
		(cond ((memq ?S switches) ; sorted on size
		       (function
			(lambda (x y)
			  ;; 7th file attribute is file size
			  ;; Make largest file come first
			  (< (nth 7 (cdr y))
			     (nth 7 (cdr x))))))
		      ((memq ?t switches) ; sorted on time
		       (setq index (ls-lisp-time-index switches))
		       (function
			(lambda (x y)
			  (ls-lisp-time-lessp (nth index (cdr y))
					      (nth index (cdr x))))))
		      (t		; sorted alphabetically
		       (function
			(lambda (x y)
			  (string-lessp (downcase (car x))
					(downcase (car y))))))))))
  (if (memq ?r switches)		; reverse sort order
      (setq file-alist (nreverse file-alist)))
  file-alist)


-- 
Steve Allen
Clay Hill Engineering (Founder/ASIC Design Consultant)
http://www.ultranet.com/~allen (My Pgp Public key available here)

From owner-ntemacs-users@june  Fri Jan 12 10:26:45 1996
X-VM-v5-Data: ([nil nil nil nil nil nil nil nil nil]
	[nil "Fri" "12" "January" "1996" "13:24:25" "-0500" "Steve Allen" "allen@cachelink.com" nil "40" "Re: How I solved my 'dired' problem..." "^From:" nil nil "1" nil nil nil nil]
	nil)
Received: from joker.cs.washington.edu (joker.cs.washington.edu [128.95.1.42]) by june.cs.washington.edu (8.7.2/7.2ju) with SMTP id KAA29141 for <voelker@june.cs.washington.edu>; Fri, 12 Jan 1996 10:26:44 -0800
Received: from june.cs.washington.edu (june.cs.washington.edu [128.95.1.4]) by joker.cs.washington.edu (8.6.12/7.2ws+) with ESMTP id KAA29403 for <voelker@joker.cs.washington.edu>; Fri, 12 Jan 1996 10:26:42 -0800
Received: from camelot.cachelink.com (camelot.cachelink.com [146.115.34.66]) by june.cs.washington.edu (8.7.2/7.2ju) with ESMTP id KAA29056 for <ntemacs-users@cs.washington.edu>; Fri, 12 Jan 1996 10:25:52 -0800
Received: from lancelot (lancelot.cachelink.com [146.115.34.82])           by camelot.cachelink.com (post.office MTA v1.9.1 ID# 0-11403)           with SMTP id AAA145; Fri, 12 Jan 1996 13:28:39 -0500
Message-ID: <30F6A759.5AE8@cachelink.com>
Organization: CacheLink Corporation
X-Mailer: Mozilla 2.0b5 (WinNT; I)
MIME-Version: 1.0
References: <9601121620.AA06673@sunburn.src.honeywell.com>
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
From: allen@cachelink.com (Steve Allen)
To: Robert Goldman <goldman@src.honeywell.com>
CC: NT Emacs mailing list <ntemacs-users@cs.washington.edu>
Subject: Re: How I solved my 'dired' problem...
Date: Fri, 12 Jan 1996 13:24:25 -0500

Robert P. Goldman wrote:
> 
> I'm not sure I fully understand your patch, but I believe that it
> won't work properly for those of us who work with a mix of NTFS and
> NFS-mounted Unix file systems.  I don't myself know if there's some
> way to look at a directory and find out whether it's appropriate to
> treat it as case-sensitive or not...
> R

All I changed was two lines in the lisp emulated 'ls' command (ls-lisp.el).
in the "ls-lisp-handle-switches" function

from: 
                         (string-lessp (car x)
                                       (car y)))))))))
to:
                         (string-lessp (downcase (car x))
                                       (downcase (car y))))))))))


Perhaps a better fix would be something like this modification to 
ls-lisp-handle-switches in ls-lisp.el:

                         (string-lessp (downcase-if-nt (car x))
                                       (downcase-if-nt (car y))))))))))

(defvar dired-force-case-sensitive nil)

(defun downcase-if-nt (str)
  (if (or (string-match "x86.*nt" (version)) dired-force-case-sensitive)
      (downcase str)
    str))


I don't have a mixed environment to test it in, so your results may vary.
As usual, you get what you pay for . . .
-- 
Steve Allen
Clay Hill Engineering (Founder/ASIC Design Consultant)
http://www.ultranet.com/~allen (My Pgp Public key available here)

