Subject: find-file-existing-other-name doesn't work in 19.33 (was Case sensitivity in etags)

From: Robert Brodersen <[email-masked]>
Date: Fri, 6 Sep 1996 15:44:22 -0700

I can confirm that this used to work in 19.31, but it doesn't work in
19.33.  In 19.31 I get the following message:
C:/UTLDATA.C and C:/utldata.c are the same file
When I try to open utldata.c again with different filename case, and the
existing buffer is selected.

I noticed that files.el changed a bit from 19.31 to 19.33, but when I
tried to run the .31 version in .33, the bug still seems to be there.  I
would really appreciate a fix to this great feature!!!

>----------
>From: 	Dave Strauss[SMTP:[email-masked]]
>Sent: 	Friday, September 06, 1996 3:03 PM
>To: 	Robert Brodersen; [email-masked]
>Subject: 	RE: Case sensitivity in etags
>
>At 11:52 AM 9/6/96 -0700, Robert Brodersen wrote:
> +----
> | >> Dave Strauss writes::
> | 
> | >But in emacs 19.34, the drive letters are now lower-cased.  So now there
> | >is no way I can get the file names in the tags file to match the
> | >filename-completion names.  As a result, I sometimes have two, and
> | >even three or four, copies of the same file open at the same time.  It
> | >gets very confusing trying to remember which copy I'm editing!
> | 
> | I used to have filename case problems all the time, and I solved it with
> | this beauty:
> | 
> | ; Don't visit two buffers of the same file (solves some filename case
> | problems)
> | (setq find-file-existing-other-name t)
> | 
> | Bob Brodersen  -- [email-masked]
> +----
>
>I tried this; it doesn't seem to make any difference (at least with
>19.34).  I can still open a file into two buffers; for example
>Foo.txt and foo.Txt.
>
>-- Dave Strauss ([email-masked]  -or- [email-masked])
>

---

From: "Richard Y. Kim" <[email-masked]>
Date: Fri, 6 Sep 1996 17:49:07 -0700

I posted this many months ago before 19.31 was released.
I have made some changes to make it work with 19.31 and up.
I don't know whether this is obsoleted by find-file-existing-other-name
or not, but this has served me well for several months.

;;; stdname.el --- use standard file names to prevent duplicate buffers

;;; Copyright (c) 1996 Richard Y. Kim

;;; Author: Richard Y. Kim, <[email-masked]>
;;; Maintainer: Richard Y. Kim, <[email-masked]>
;;; Created: Sat Feb 17 15:40:42 1996
;;; Version: $Id: stdname.el,v 1.6 1996/08/02 21:59:50 ryk Exp ryk $
;;; Keywords: 
;;;
;;; Description:
;;;   This solves (for many situations but not all) the annoying problem
;;;   where multiple buffers are created for the same file under Windows
;;;   95 due to case insensitivity of the Windows file system, e.g.,
;;; 
;;;     C:\home\somefile
;;;     c:\home\SOMEFILE
;;;     c:\HOME/somefile
;;;
;;;   The following code prevents the creation of multiple buffers.
;;;
;;; Installation:
;;;   Simply load this file in your .emacs, _emacs, emacs.ini, or whatever,
;;;     e.g., (load-library "stdname").
;;;   
;;; Commentary:
;;;   This was tested using pre-built Ntemacs 19.31 under Windows 95.
;;;   The URL for ntemacs is something like
;;;
;;;       ftp://ftp.cs.washington.edu/pub/ntemacs.
;;;
;;; Bugs:
;;;   I think stdname.el should be disabled for NT, but I don't know how
;;;   to distinguish win95 verses nt in emacs-lisp.
;;;   On my ntemacs-19.33 running on Windows 95, (getenv "winbasedir") returns
;;;   nil!

;;; Code:

(if (not (equal system-type 'windows-nt))
    (message "stdname.el is only for Windows 95 (and Windows NT?)")
  (require 'advice)

  (defun standard-file-name ( name )
    (let* ((sep-char (char-to-string directory-sep-char))
	   (unc-regexp (concat "^" sep-char sep-char)))
      (cond
       ;; do nothing if NAME starts with two backslashes since this could
       ;; be a file system which is case sensitive such as unix.
       ((string-match unc-regexp name)
	name)
       (t
	(downcase name)
	;;(upcase name) ;; if you prefer uppercase filenames.
	))))
  
  (defadvice find-file-noselect
    (before lowercase-names activate compile)
    "Standardize file name to minimize duplicate buffers."
    (setq filename (standard-file-name filename)))
  )

(provide 'stdname)

;;; stdname.el ends here

Richard Y. Kim
Audio Precision
[email-masked]

---

From: Andrew Innes <[email-masked]>
Date: Sat, 7 Sep 1996 14:33:46 +0100

>or not, but this has served me well for several months.

[ .. ]

>;;;   On my ntemacs-19.33 running on Windows 95, (getenv "winbasedir") returns

Use (getenv "winbootdir") instead.  That returns nil on NT and a string
on Win95.

AndrewI