I discovered today that `convert-standard-filename' on Cygwin does nothing and as result `make-temp-file' fails for name like "*mail*". The change in `make-auto-save-file-name' in 22.0.50 to call `make-temp-file' (it was `make-temp-name' before) made `compose-mail' fails on Cygwin. I created a new file `cygwin.el' to have Cygwin specific functions (for now just one). Below is a patch that fix this problem. Note. Joe, I don't have CVS write permission, so pleas check my patch and if you find it appropriate, please install it. Ehud. 2005-08-11 Ehud Karni * files.el (convert-standard-filename): change documentation. (abbreviate-file-name): replace or by memq. (make-auto-save-file-name): call `convert-standard-filename' when OS is Cygwin too. * loadup.el load cygwin when OS is Cygwin. Dump on Cygwin with 2 names (as on UNIX). * cygwin.el - new file. (convert-standard-filename): new function to ensure valid file name on Cygwin. diff -c lisp/files.el.\~1.781.\~ lisp/files-new.el *** lisp/files.el.~1.781.~ Mon Aug 1 16:58:48 2005 --- lisp/files-new.el Thu Aug 11 00:10:55 2005 *************** *** 517,526 **** This function's standard definition is trivial; it just returns the argument. However, on Windows and DOS, replace invalid characters. On DOS, make sure to obey the 8.3 limitations. On ! Windows, turn Cygwin names into native names, and also turn ! slashes into backslashes if the shell requires it (see `w32-shell-dos-semantics'). See Info node `(elisp)Standard File Names' for more details." filename) --- 517,528 ---- This function's standard definition is trivial; it just returns the argument. However, on Windows and DOS, replace invalid characters. On DOS, make sure to obey the 8.3 limitations. On ! Windows (native), turn Cygwin names into native names, and also ! turn slashes into backslashes if the shell requires it (see `w32-shell-dos-semantics'). + On Cygwin, replace invalid Windows characters. + See Info node `(elisp)Standard File Names' for more details." filename) *************** *** 1232,1240 **** (= (aref filename 0) ?/))) ;; MS-DOS root directories can come with a drive letter; ;; Novell Netware allows drive letters beyond `Z:'. ! (not (and (or (eq system-type 'ms-dos) ! (eq system-type 'cygwin) ! (eq system-type 'windows-nt)) (save-match-data (string-match "^[a-zA-`]:/$" filename))))) (setq filename --- 1234,1240 ---- (= (aref filename 0) ?/))) ;; MS-DOS root directories can come with a drive letter; ;; Novell Netware allows drive letters beyond `Z:'. ! (not (and (memq system-type '(ms-dos windows-nt cygwin)) (save-match-data (string-match "^[a-zA-`]:/$" filename))))) (setq filename *************** *** 4099,4105 **** "#"))) ;; Make sure auto-save file names don't contain characters ;; invalid for the underlying filesystem. ! (if (and (memq system-type '(ms-dos windows-nt)) ;; Don't modify remote (ange-ftp) filenames (not (string-match "^/\\w+@[-A-Za-z0-9._]+:" result))) (convert-standard-filename result) --- 4099,4105 ---- "#"))) ;; Make sure auto-save file names don't contain characters ;; invalid for the underlying filesystem. ! (if (and (memq system-type '(ms-dos windows-nt cygwin) ;; Don't modify remote (ange-ftp) filenames (not (string-match "^/\\w+@[-A-Za-z0-9._]+:" result))) (convert-standard-filename result) *************** *** 4134,4140 **** ((file-writable-p default-directory) default-directory) ((file-writable-p "/var/tmp/") "/var/tmp/") ("~/"))))) ! (if (and (memq system-type '(ms-dos windows-nt)) ;; Don't modify remote (ange-ftp) filenames (not (string-match "^/\\w+@[-A-Za-z0-9._]+:" fname))) ;; The call to convert-standard-filename is in case --- 4134,4140 ---- ((file-writable-p default-directory) default-directory) ((file-writable-p "/var/tmp/") "/var/tmp/") ("~/"))))) ! (if (and (memq system-type '(ms-dos windows-nt cygwin)) ;; Don't modify remote (ange-ftp) filenames (not (string-match "^/\\w+@[-A-Za-z0-9._]+:" fname))) ;; The call to convert-standard-filename is in case Diff finished. Thu Aug 11 00:12:50 2005 diff -c lisp/loadup.el.\~1.140.\~ lisp/loadup-new.el *** lisp/loadup.el.~1.140.~ Mon Jul 11 19:32:54 2005 --- lisp/loadup-new.el Wed Aug 10 23:30:55 2005 *************** *** 166,171 **** --- 166,174 ---- (if (eq system-type 'vax-vms) (progn (load "vms-patch"))) + (if (eq system-type 'cygwin) + (progn + (load "cygwin"))) (if (eq system-type 'windows-nt) (progn (load "ls-lisp") *************** *** 320,346 **** (setq name (concat (downcase (substring name 0 (match-beginning 0))) "-" (substring name (match-end 0))))) ! (if (memq system-type '(ms-dos windows-nt cygwin)) (message "Dumping under the name emacs") ! (message "Dumping under names emacs and %s" name))) ! (condition-case () ! (delete-file "emacs") ! (file-error nil)) ! ;; We used to dump under the name xemacs, but that occasionally ! ;; confused people installing Emacs (they'd install the file ! ;; under the name `xemacs'), and it's inconsistent with every ! ;; other GNU program's build process. ! (dump-emacs "emacs" "temacs") ! (message "%d pure bytes used" pure-bytes-used) ! ;; Recompute NAME now, so that it isn't set when we dump. ! (if (not (memq system-type '(ms-dos windows-nt cygwin))) ! (let ((name (concat "emacs-" emacs-version))) ! (while (string-match "[^-+_.a-zA-Z0-9]+" name) ! (setq name (concat (downcase (substring name 0 (match-beginning 0))) ! "-" ! (substring name (match-end 0))))) ! (add-name-to-file "emacs" name t))) ! (kill-emacs))) ;; Avoid error if user loads some more libraries now. (setq purify-flag nil) --- 323,346 ---- (setq name (concat (downcase (substring name 0 (match-beginning 0))) "-" (substring name (match-end 0))))) ! (if (memq system-type '(ms-dos windows-nt)) (message "Dumping under the name emacs") ! (message "Dumping under names emacs and %s" name)) ! (condition-case () ! (delete-file "emacs") ! (file-error nil)) ! ;; We used to dump under the name xemacs, but that occasionally ! ;; confused people installing Emacs (they'd install the file ! ;; under the name `xemacs'), and it's inconsistent with every ! ;; other GNU program's build process. ! (dump-emacs "emacs" "temacs") ! (message "%d pure bytes used" pure-bytes-used) ! ;; Recompute NAME now, so that it isn't set when we dump. ! (if (not (memq system-type '(ms-dos windows-nt))) ! (if (eq system-type 'cygwin) ! (add-name-to-file "emacs.exe" (concat name ".exe") t)) ! (add-name-to-file "emacs" name t))) ! (kill-emacs))) ;; Avoid error if user loads some more libraries now. (setq purify-flag nil) Diff finished. Wed Aug 10 23:49:31 2005 New file lisp/cygwin.el Wed Aug 10 23:43:28 2005 ******************************************************** ;;; cygwin.el --- Lisp routines for Cygwin emulation layer ;; Copyright (C) 2005 Free Software Foundation, Inc. ;; Author: Ehud Karni ;; Keywords: internal ;; This file is part of GNU Emacs. ;; GNU Emacs is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by ;; the Free Software Foundation; either version 2, or (at your option) ;; any later version. ;; GNU Emacs is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;; GNU General Public License for more details. ;; You should have received a copy of the GNU General Public License ;; along with GNU Emacs; see the file COPYING. If not, write to the ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, ;; Boston, MA 02110-1301, USA. ;;; Commentary: ;; (August 10, 2005) ;; Created. (defun convert-standard-filename (filename) "Convert a standard file's name to something suitable for the OS. This means to guarantee valid names and perhaps to canonicalize certain patterns. FILENAME should be an absolute file name since the conversion rules sometimes vary depending on the position in the file name. E.g. c:/foo is a valid DOS file name, but c:/bar/c:/foo is not. This function's standard definition is trivial; it just returns the argument. However, on Windows and DOS, replace invalid characters. On DOS, make sure to obey the 8.3 limitations. On Windows (native), turn Cygwin names into native names, and also turn slashes into backslashes if the shell requires it (see `w32-shell-dos-semantics'). On Cygwin, replace invalid Windows characters. See Info node `(elisp)Standard File Names' for more details." (let ((name filename) (start 0)) ;; destructively replace invalid filename characters with % (while (string-match "[?*:<>|\"\000-\037]" name start) (aset name (match-beginning 0) ?%) (setq start (match-end 0))) name)) ;;; arch-tag: ;;; cygwin.el ends here -- Ehud Karni Better Safe Than Sorry ינרק דוהא Senior System Support בשחמ תוכרעמב הכימת