comparison lisp/files.el @ 49549:99be3a1e2589

Cygwin support patch.
author Juanma Barranquero <lekktu@gmail.com>
date Fri, 31 Jan 2003 15:24:20 +0000
parents a57a71b7eaae
children 57fdeb6dcb72
comparison
equal deleted inserted replaced
49548:8b1c605f8c9b 49549:99be3a1e2589
213 (concat "^\\([^A-Z[-`a-z]\\|..+\\)?:\\|" ; colon except after drive 213 (concat "^\\([^A-Z[-`a-z]\\|..+\\)?:\\|" ; colon except after drive
214 "[+, ;=|<>\"?*]\\|\\[\\|\\]\\|" ; invalid characters 214 "[+, ;=|<>\"?*]\\|\\[\\|\\]\\|" ; invalid characters
215 "[\000-\031]\\|" ; control characters 215 "[\000-\031]\\|" ; control characters
216 "\\(/\\.\\.?[^/]\\)\\|" ; leading dots 216 "\\(/\\.\\.?[^/]\\)\\|" ; leading dots
217 "\\(/[^/.]+\\.[^/.]*\\.\\)")) ; more than a single dot 217 "\\(/[^/.]+\\.[^/.]*\\.\\)")) ; more than a single dot
218 ((memq system-type '(ms-dos windows-nt)) 218 ((memq system-type '(ms-dos windows-nt cygwin))
219 (concat "^\\([^A-Z[-`a-z]\\|..+\\)?:\\|" ; colon except after drive 219 (concat "^\\([^A-Z[-`a-z]\\|..+\\)?:\\|" ; colon except after drive
220 "[|<>\"?*\000-\031]")) ; invalid characters 220 "[|<>\"?*\000-\031]")) ; invalid characters
221 (t "[\000]")) 221 (t "[\000]"))
222 "Regexp recognizing file names which aren't allowed by the filesystem.") 222 "Regexp recognizing file names which aren't allowed by the filesystem.")
223 223
1026 (not (and (= (match-end 0) 1) 1026 (not (and (= (match-end 0) 1)
1027 (= (aref filename 0) ?/))) 1027 (= (aref filename 0) ?/)))
1028 ;; MS-DOS root directories can come with a drive letter; 1028 ;; MS-DOS root directories can come with a drive letter;
1029 ;; Novell Netware allows drive letters beyond `Z:'. 1029 ;; Novell Netware allows drive letters beyond `Z:'.
1030 (not (and (or (eq system-type 'ms-dos) 1030 (not (and (or (eq system-type 'ms-dos)
1031 (eq system-type 'cygwin)
1031 (eq system-type 'windows-nt)) 1032 (eq system-type 'windows-nt))
1032 (save-match-data 1033 (save-match-data
1033 (string-match "^[a-zA-`]:/$" filename))))) 1034 (string-match "^[a-zA-`]:/$" filename)))))
1034 (setq filename 1035 (setq filename
1035 (concat "~" 1036 (concat "~"
1772 (setq keep-going nil) 1773 (setq keep-going nil)
1773 (let ((alist auto-mode-alist) 1774 (let ((alist auto-mode-alist)
1774 (mode nil)) 1775 (mode nil))
1775 ;; Find first matching alist entry. 1776 ;; Find first matching alist entry.
1776 (let ((case-fold-search 1777 (let ((case-fold-search
1777 (memq system-type '(vax-vms windows-nt)))) 1778 (memq system-type '(vax-vms windows-nt cygwin))))
1778 (while (and (not mode) alist) 1779 (while (and (not mode) alist)
1779 (if (string-match (car (car alist)) name) 1780 (if (string-match (car (car alist)) name)
1780 (if (and (consp (cdr (car alist))) 1781 (if (and (consp (cdr (car alist)))
1781 (nth 2 (car alist))) 1782 (nth 2 (car alist)))
1782 (setq mode (car (cdr (car alist))) 1783 (setq mode (car (cdr (car alist)))
2613 (file-error (setq backup-directory nil)))) 2614 (file-error (setq backup-directory nil))))
2614 (if (null backup-directory) 2615 (if (null backup-directory)
2615 file 2616 file
2616 (if (file-name-absolute-p backup-directory) 2617 (if (file-name-absolute-p backup-directory)
2617 (progn 2618 (progn
2618 (when (memq system-type '(windows-nt ms-dos)) 2619 (when (memq system-type '(windows-nt ms-dos cygwin))
2619 ;; Normalize DOSish file names: downcase the drive 2620 ;; Normalize DOSish file names: downcase the drive
2620 ;; letter, if any, and replace the leading "x:" with 2621 ;; letter, if any, and replace the leading "x:" with
2621 ;; "/drive_x". 2622 ;; "/drive_x".
2622 (or (file-name-absolute-p file) 2623 (or (file-name-absolute-p file)
2623 (setq file (expand-file-name file))) ; make defaults explicit 2624 (setq file (expand-file-name file))) ; make defaults explicit
2735 (setq directory (file-name-as-directory 2736 (setq directory (file-name-as-directory
2736 (expand-file-name (or directory default-directory)))) 2737 (expand-file-name (or directory default-directory))))
2737 ;; On Microsoft OSes, if FILENAME and DIRECTORY have different 2738 ;; On Microsoft OSes, if FILENAME and DIRECTORY have different
2738 ;; drive names, they can't be relative, so return the absolute name. 2739 ;; drive names, they can't be relative, so return the absolute name.
2739 (if (and (or (eq system-type 'ms-dos) 2740 (if (and (or (eq system-type 'ms-dos)
2741 (eq system-type 'cygwin)
2740 (eq system-type 'windows-nt)) 2742 (eq system-type 'windows-nt))
2741 (not (string-equal (substring fname 0 2) 2743 (not (string-equal (substring fname 0 2)
2742 (substring directory 0 2)))) 2744 (substring directory 0 2))))
2743 filename 2745 filename
2744 (let ((ancestor ".") 2746 (let ((ancestor ".")
3134 (defun toggle-read-only (&optional arg) 3136 (defun toggle-read-only (&optional arg)
3135 "Change whether this buffer is visiting its file read-only. 3137 "Change whether this buffer is visiting its file read-only.
3136 With arg, set read-only iff arg is positive. 3138 With arg, set read-only iff arg is positive.
3137 If visiting file read-only and `view-read-only' is non-nil, enter view mode." 3139 If visiting file read-only and `view-read-only' is non-nil, enter view mode."
3138 (interactive "P") 3140 (interactive "P")
3139 (if (and arg 3141 (if (and arg
3140 (if (> (prefix-numeric-value arg) 0) buffer-read-only 3142 (if (> (prefix-numeric-value arg) 0) buffer-read-only
3141 (not buffer-read-only))) ; If buffer-read-only is set correctly, 3143 (not buffer-read-only))) ; If buffer-read-only is set correctly,
3142 nil ; do nothing. 3144 nil ; do nothing.
3143 ;; Toggle. 3145 ;; Toggle.
3144 (cond 3146 (cond
3879 quoted with double quotes. 3881 quoted with double quotes.
3880 Existing quote characters in PATTERN are left alone, so you can pass 3882 Existing quote characters in PATTERN are left alone, so you can pass
3881 PATTERN that already quotes some of the special characters." 3883 PATTERN that already quotes some of the special characters."
3882 (save-match-data 3884 (save-match-data
3883 (cond 3885 (cond
3884 ((memq system-type '(ms-dos windows-nt)) 3886 ((memq system-type '(ms-dos windows-nt cygwin))
3885 ;; DOS/Windows don't allow `"' in file names. So if the 3887 ;; DOS/Windows don't allow `"' in file names. So if the
3886 ;; argument has quotes, we can safely assume it is already 3888 ;; argument has quotes, we can safely assume it is already
3887 ;; quoted by the caller. 3889 ;; quoted by the caller.
3888 (if (or (string-match "[\"]" pattern) 3890 (if (or (string-match "[\"]" pattern)
3889 ;; We quote [&()#$'] in case their shell is a port of a 3891 ;; We quote [&()#$'] in case their shell is a port of a
4020 (let* (;; We at first read by no-conversion, then after 4022 (let* (;; We at first read by no-conversion, then after
4021 ;; putting text property `dired-filename, decode one 4023 ;; putting text property `dired-filename, decode one
4022 ;; bunch by one to preserve that property. 4024 ;; bunch by one to preserve that property.
4023 (coding-system-for-read 'no-conversion) 4025 (coding-system-for-read 'no-conversion)
4024 ;; This is to control encoding the arguments in call-process. 4026 ;; This is to control encoding the arguments in call-process.
4025 (coding-system-for-write 4027 (coding-system-for-write
4026 (and enable-multibyte-characters 4028 (and enable-multibyte-characters
4027 (or file-name-coding-system 4029 (or file-name-coding-system
4028 default-file-name-coding-system)))) 4030 default-file-name-coding-system))))
4029 (setq result 4031 (setq result
4030 (if wildcard 4032 (if wildcard