diff options
| author | Eli Zaretskii | 2006-07-29 12:05:28 +0000 |
|---|---|---|
| committer | Eli Zaretskii | 2006-07-29 12:05:28 +0000 |
| commit | 18b28ef18f66eed75843a3dce4c5ad890c09e0d8 (patch) | |
| tree | 0d85c97871e9024543b41d19bc82a6b4a7fb711c | |
| parent | ebdcf65aa82789250274ca7613ccaf6aed42a816 (diff) | |
| download | emacs-18b28ef18f66eed75843a3dce4c5ad890c09e0d8.tar.gz emacs-18b28ef18f66eed75843a3dce4c5ad890c09e0d8.zip | |
(convert-standard-filename): For Cygwin, replace characters not allowed in
Windows file names.
(make-auto-save-file-name): Add Cygwin to the list of systems where the
auto-save file name needs to be run through convert-standard-filename.
| -rw-r--r-- | lisp/files.el | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/lisp/files.el b/lisp/files.el index fdc4464da86..0cd17932fd8 100644 --- a/lisp/files.el +++ b/lisp/files.el | |||
| @@ -540,13 +540,21 @@ is a valid DOS file name, but c:/bar/c:/foo is not. | |||
| 540 | 540 | ||
| 541 | This function's standard definition is trivial; it just returns | 541 | This function's standard definition is trivial; it just returns |
| 542 | the argument. However, on Windows and DOS, replace invalid | 542 | the argument. However, on Windows and DOS, replace invalid |
| 543 | characters. On DOS, make sure to obey the 8.3 limitations. On | 543 | characters. On DOS, make sure to obey the 8.3 limitations. |
| 544 | Windows, turn Cygwin names into native names, and also turn | 544 | In the native Windows build, turn Cygwin names into native names, |
| 545 | slashes into backslashes if the shell requires it (see | 545 | and also turn slashes into backslashes if the shell requires it (see |
| 546 | `w32-shell-dos-semantics'). | 546 | `w32-shell-dos-semantics'). |
| 547 | 547 | ||
| 548 | See Info node `(elisp)Standard File Names' for more details." | 548 | See Info node `(elisp)Standard File Names' for more details." |
| 549 | filename) | 549 | (if (eq system-type 'cygwin) |
| 550 | (let ((name (copy-sequence filename)) | ||
| 551 | (start 0)) | ||
| 552 | ;; Replace invalid filename characters with ! | ||
| 553 | (while (string-match "[?*:<>|\"\000-\037]" name start) | ||
| 554 | (aset name (match-beginning 0) ?!) | ||
| 555 | (setq start (match-end 0))) | ||
| 556 | name) | ||
| 557 | filename)) | ||
| 550 | 558 | ||
| 551 | (defun read-directory-name (prompt &optional dir default-dirname mustmatch initial) | 559 | (defun read-directory-name (prompt &optional dir default-dirname mustmatch initial) |
| 552 | "Read directory name, prompting with PROMPT and completing in directory DIR. | 560 | "Read directory name, prompting with PROMPT and completing in directory DIR. |
| @@ -4368,7 +4376,7 @@ See also `auto-save-file-name-p'." | |||
| 4368 | "#"))) | 4376 | "#"))) |
| 4369 | ;; Make sure auto-save file names don't contain characters | 4377 | ;; Make sure auto-save file names don't contain characters |
| 4370 | ;; invalid for the underlying filesystem. | 4378 | ;; invalid for the underlying filesystem. |
| 4371 | (if (and (memq system-type '(ms-dos windows-nt)) | 4379 | (if (and (memq system-type '(ms-dos windows-nt cygwin)) |
| 4372 | ;; Don't modify remote (ange-ftp) filenames | 4380 | ;; Don't modify remote (ange-ftp) filenames |
| 4373 | (not (string-match "^/\\w+@[-A-Za-z0-9._]+:" result))) | 4381 | (not (string-match "^/\\w+@[-A-Za-z0-9._]+:" result))) |
| 4374 | (convert-standard-filename result) | 4382 | (convert-standard-filename result) |
| @@ -4403,7 +4411,7 @@ See also `auto-save-file-name-p'." | |||
| 4403 | ((file-writable-p default-directory) default-directory) | 4411 | ((file-writable-p default-directory) default-directory) |
| 4404 | ((file-writable-p "/var/tmp/") "/var/tmp/") | 4412 | ((file-writable-p "/var/tmp/") "/var/tmp/") |
| 4405 | ("~/"))))) | 4413 | ("~/"))))) |
| 4406 | (if (and (memq system-type '(ms-dos windows-nt)) | 4414 | (if (and (memq system-type '(ms-dos windows-nt cygwin)) |
| 4407 | ;; Don't modify remote (ange-ftp) filenames | 4415 | ;; Don't modify remote (ange-ftp) filenames |
| 4408 | (not (string-match "^/\\w+@[-A-Za-z0-9._]+:" fname))) | 4416 | (not (string-match "^/\\w+@[-A-Za-z0-9._]+:" fname))) |
| 4409 | ;; The call to convert-standard-filename is in case | 4417 | ;; The call to convert-standard-filename is in case |