comparison lisp/files.el @ 43130:97ca502aebf5

(file-name-non-special): Add special handling for file-name-sans-versions, file-name-completion, and file-name-all-completions.
author Richard M. Stallman <rms@gnu.org>
date Wed, 06 Feb 2002 15:29:29 +0000
parents 193c9307d562
children 5f02f10efd8a ab5d1c9248c4
comparison
equal deleted inserted replaced
43129:67d86dad5454 43130:97ca502aebf5
3820 (unhandled-file-name-directory default-directory))) 3820 (unhandled-file-name-directory default-directory)))
3821 default-directory)) 3821 default-directory))
3822 ;; Get a list of the indices of the args which are file names. 3822 ;; Get a list of the indices of the args which are file names.
3823 (file-arg-indices 3823 (file-arg-indices
3824 (cdr (or (assq operation 3824 (cdr (or (assq operation
3825 ;; The first four are special because they 3825 ;; The first five are special because they
3826 ;; return a file name. We want to include the /: 3826 ;; return a file name. We want to include the /:
3827 ;; in the return value. 3827 ;; in the return value.
3828 ;; So just avoid stripping it in the first place. 3828 ;; So just avoid stripping it in the first place.
3829 '((expand-file-name . nil) 3829 '((expand-file-name . nil)
3830 (file-name-directory . nil)
3831 (file-name-as-directory . nil)
3832 (directory-file-name . nil)
3833 (file-name-sans-versions . nil)
3830 ;; `identity' means just return the first arg 3834 ;; `identity' means just return the first arg
3831 ;; as stripped of its quoting. 3835 ;; as stripped of its quoting.
3832 (substitute-in-file-name . identity) 3836 (substitute-in-file-name . identity)
3833 (file-name-directory . nil)
3834 (file-name-as-directory . nil)
3835 (directory-file-name . nil)
3836 (file-name-completion 0 1) 3837 (file-name-completion 0 1)
3837 (file-name-all-completions 0 1) 3838 (file-name-all-completions 0 1)
3838 (rename-file 0 1) 3839 (rename-file 0 1)
3839 (copy-file 0 1) 3840 (copy-file 0 1)
3840 (make-symbolic-link 0 1) 3841 (make-symbolic-link 0 1)
3855 "/" 3856 "/"
3856 (substring (car pair) 2))))) 3857 (substring (car pair) 2)))))
3857 (setq file-arg-indices (cdr file-arg-indices)))) 3858 (setq file-arg-indices (cdr file-arg-indices))))
3858 (if (eq file-arg-indices 'identity) 3859 (if (eq file-arg-indices 'identity)
3859 (car arguments) 3860 (car arguments)
3860 (apply operation arguments)))) 3861 (let ((value (apply operation arguments)))
3862 (cond ((memq operation '(file-name-completion))
3863 (and value (concat "/:" value)))
3864 ((memq operation '(file-name-all-completions))
3865 (mapcar (lambda (name) (concat "/:" name)) value))
3866 (t value))))))
3861 3867
3862 (define-key ctl-x-map "\C-f" 'find-file) 3868 (define-key ctl-x-map "\C-f" 'find-file)
3863 (define-key ctl-x-map "\C-r" 'find-file-read-only) 3869 (define-key ctl-x-map "\C-r" 'find-file-read-only)
3864 (define-key ctl-x-map "\C-v" 'find-alternate-file) 3870 (define-key ctl-x-map "\C-v" 'find-alternate-file)
3865 (define-key ctl-x-map "\C-s" 'save-buffer) 3871 (define-key ctl-x-map "\C-s" 'save-buffer)