comparison lisp/files.el @ 284:558f606b08ae r21-0b40

Import from CVS: tag r21-0b40
author cvs
date Mon, 13 Aug 2007 10:34:13 +0200
parents c42ec1d1cded
children 57709be46d1b
comparison
equal deleted inserted replaced
283:fa3d41851a08 284:558f606b08ae
388 Not actually set up until the first time you use it.") 388 Not actually set up until the first time you use it.")
389 389
390 (defvar cdpath-previous nil 390 (defvar cdpath-previous nil
391 "Prior value of the CDPATH environment variable.") 391 "Prior value of the CDPATH environment variable.")
392 392
393 (defvar path-separator ":"
394 "Character used to separate concatenated paths.")
395
396 (defun parse-colon-path (cd-path) 393 (defun parse-colon-path (cd-path)
397 "Explode a colon-separated list of paths into a string list. 394 "Explode a colon-separated search path into a list of directory names.
398 This will be moved into \"C\" when decode_path is no longer called so 395
399 early in XEmacs initialization." 396 If you think you want to use this, you probably don't. This function
397 is provided for backward compatibility. A more robust implementation
398 of the same functionality is available as `split-path', which see."
400 (and cd-path 399 (and cd-path
401 (let (cd-list (cd-start 0) cd-colon) 400 (let (cd-list (cd-start 0) cd-colon)
402 (setq cd-path (concat cd-path path-separator)) 401 (setq cd-path (concat cd-path path-separator))
403 (while (setq cd-colon (string-match path-separator cd-path cd-start)) 402 (while (setq cd-colon (string-match path-separator cd-path cd-start))
404 (setq cd-list 403 (setq cd-list
1095 (make-directory (file-name-directory 1094 (make-directory (file-name-directory
1096 buffer-file-name) 1095 buffer-file-name)
1097 t)) 1096 t))
1098 (quit 1097 (quit
1099 (kill-buffer (current-buffer)) 1098 (kill-buffer (current-buffer))
1100 (error "Canceled")))) 1099 (signal 'quit nil))))
1101 nil)))) 1100 nil))))
1102 (if msg 1101 (if msg
1103 (progn 1102 (progn
1104 (message "%s" msg) 1103 (message "%s" msg)
1105 (or not-serious (sit-for 1 t))))) 1104 (or not-serious (sit-for 1 t)))))
2075 (defun file-nlinks (filename) 2074 (defun file-nlinks (filename)
2076 "Return number of names file FILENAME has." 2075 "Return number of names file FILENAME has."
2077 (car (cdr (file-attributes filename)))) 2076 (car (cdr (file-attributes filename))))
2078 2077
2079 (defun file-relative-name (filename &optional directory) 2078 (defun file-relative-name (filename &optional directory)
2080 "Convert FILENAME to be relative to DIRECTORY (default: default-directory).1 2079 "Convert FILENAME to be relative to DIRECTORY (default: default-directory).
2081 This function returns a relative file name which is equivalent to FILENAME 2080 This function returns a relative file name which is equivalent to FILENAME
2082 when used with that default directory as the default. 2081 when used with that default directory as the default.
2083 If this is impossible (which can happen on MSDOS and Windows 2082 If this is impossible (which can happen on MSDOS and Windows
2084 when the file name and directory use different drive names) 2083 when the file name and directory use different drive names)
2085 then it returns FILENAME." 2084 then it returns FILENAME."
2094 (not (string-equal (substring fname 0 2) 2093 (not (string-equal (substring fname 0 2)
2095 (substring directory 0 2)))) 2094 (substring directory 0 2))))
2096 filename 2095 filename
2097 (let ((ancestor ".") 2096 (let ((ancestor ".")
2098 (fname-dir (file-name-as-directory fname))) 2097 (fname-dir (file-name-as-directory fname)))
2099 (while (and (not (string-match (concat "^" (regexp-quote directory)) fname-dir)) 2098 (while (and (not (string-match (concat "^" (regexp-quote directory))
2099 fname-dir))
2100 (not (string-match (concat "^" (regexp-quote directory)) fname))) 2100 (not (string-match (concat "^" (regexp-quote directory)) fname)))
2101 (setq directory (file-name-directory (substring directory 0 -1)) 2101 (setq directory (file-name-directory (substring directory 0 -1))
2102 ancestor (if (equal ancestor ".") 2102 ancestor (if (equal ancestor ".")
2103 ".." 2103 ".."
2104 (concat "../" ancestor)))) 2104 (concat "../" ancestor))))