When opening files on Windows, XEmacs does not maintain the filename
case for existing files. The particular case that makes this a
nuisance for me is using makefiles for a "largish" project under CVS
control, compiling with the Visual C++ compiler set to write out
complete pathnames for the files. When this is the case, for some
reason that really escapes me, cl.exe leaves me with pathnames in all
lower case. When calling next-error / C-x ` to bring up a file with a
warning or error, correcting the problem and finally saving the file
using C-x C-s, I've suddenly changed the capitalization of the
filename on disk. CVS understandably does not particularly like this
(thinks the properly named file is missing and thinks the
all-lower-case named file is a new, not yet added file).
For the moment, I have written a little bit of code to correct the
filename for me, whenever find-file is used to load something, using
the find-file-hooks hook. Essentially what my piece of code does is to
list all files in the directory of the file being loaded, and looks
for a file that is the same, ignoring case. If found, it will set the
visited filename to the found name, otherwise it uses the name that
was given. I'm sure my code is not ideal and may not be suitable for
everyone, but at least it solves my problem at the moment.
Having said that my code solves my problem, I would like to stress
that I would feel more comfortable if XEmacs maintained the case for
existing files (without me poking at stuff I don't necessarily
understand) regardless of what case was specified in the request.
Obviously, this is only relevant for system that are not
case-sensitive and will not allow multiple files with names differing
only by case.
My google searches didn't really leave me with any clues as to whether
this has been discussed by anyone else at some point in time. If I've
missed something somewhere, including existing options to deal with
this behaviour, my apologies.
Regards,
Lars Nilsson
(defun find-file-hook-filter (l name)
(if (eq l nil)
name
(if (string-equal (downcase name) (downcase (car l)))
(car l)
(find-file-hook-filter (cdr l) name))))
(defun my-find-file-hook ()
(let ((candidates (file-name-all-completions
(file-name-nondirectory (buffer-file-name))
(file-name-directory (buffer-file-name)))))
(set-visited-file-name
(expand-file-name
(find-file-hook-filter candidates
(file-name-nondirectory (buffer-file-name)))
(file-name-directory (buffer-file-name))))))
(add-hook 'find-file-hooks 'my-find-file-hook)
_______________________________________________
XEmacs-Beta mailing list
XEmacs-Beta(a)xemacs.org
http://calypso.tux.org/cgi-bin/mailman/listinfo/xemacs-beta