comparison lisp/files.el @ 55726:9dbff3d047a0

(file-name-non-special): Allow t in file-arg-indices to mean requote the return value. Use `identity' as an element rather than as the whole value.
author Richard M. Stallman <rms@gnu.org>
date Sat, 22 May 2004 07:40:41 +0000
parents 166093a56a5b
children 821af7073c78
comparison
equal deleted inserted replaced
55725:00841464e6d8 55726:9dbff3d047a0
4485 (file-name-directory . nil) 4485 (file-name-directory . nil)
4486 (file-name-as-directory . nil) 4486 (file-name-as-directory . nil)
4487 (directory-file-name . nil) 4487 (directory-file-name . nil)
4488 (file-name-sans-versions . nil) 4488 (file-name-sans-versions . nil)
4489 ;; `identity' means just return the first arg 4489 ;; `identity' means just return the first arg
4490 ;; as stripped of its quoting. 4490 ;; not stripped of its quoting.
4491 (substitute-in-file-name . identity) 4491 (substitute-in-file-name identity)
4492 (file-name-completion 1) 4492 (file-name-completion 1)
4493 (file-name-all-completions 1) 4493 (file-name-all-completions 1)
4494 ;; t means add "/:" to the result.
4495 (file-truename t 0)
4494 (rename-file 0 1) 4496 (rename-file 0 1)
4495 (copy-file 0 1) 4497 (copy-file 0 1)
4496 (make-symbolic-link 0 1) 4498 (make-symbolic-link 0 1)
4497 (add-name-to-file 0 1))) 4499 (add-name-to-file 0 1)))
4498 ;; For all other operations, treat the first argument only 4500 ;; For all other operations, treat the first argument only
4499 ;; as the file name. 4501 ;; as the file name.
4500 '(nil 0)))) 4502 '(nil 0))))
4503 method
4501 ;; Copy ARGUMENTS so we can replace elements in it. 4504 ;; Copy ARGUMENTS so we can replace elements in it.
4502 (arguments (copy-sequence arguments))) 4505 (arguments (copy-sequence arguments)))
4503 ;; Strip off the /: from the file names that have this handler. 4506 (if (symbolp (car file-arg-indices))
4507 (setq method (pop file-arg-indices)))
4508 ;; Strip off the /: from the file names that have it.
4504 (save-match-data 4509 (save-match-data
4505 (while (consp file-arg-indices) 4510 (while (consp file-arg-indices)
4506 (let ((pair (nthcdr (car file-arg-indices) arguments))) 4511 (let ((pair (nthcdr (car file-arg-indices) arguments)))
4507 (and (car pair) 4512 (and (car pair)
4508 (string-match "\\`/:" (car pair)) 4513 (string-match "\\`/:" (car pair))
4509 (setcar pair 4514 (setcar pair
4510 (if (= (length (car pair)) 2) 4515 (if (= (length (car pair)) 2)
4511 "/" 4516 "/"
4512 (substring (car pair) 2))))) 4517 (substring (car pair) 2)))))
4513 (setq file-arg-indices (cdr file-arg-indices)))) 4518 (setq file-arg-indices (cdr file-arg-indices))))
4514 (if (eq file-arg-indices 'identity) 4519 (cond ((eq method 'identity)
4515 (car arguments) 4520 (car arguments))
4516 (apply operation arguments)))) 4521 (method
4522 (concat "/:" (apply operation arguments)))
4523 (t
4524 (apply operation arguments)))))
4517 4525
4518 (define-key ctl-x-map "\C-f" 'find-file) 4526 (define-key ctl-x-map "\C-f" 'find-file)
4519 (define-key ctl-x-map "\C-r" 'find-file-read-only) 4527 (define-key ctl-x-map "\C-r" 'find-file-read-only)
4520 (define-key ctl-x-map "\C-v" 'find-alternate-file) 4528 (define-key ctl-x-map "\C-v" 'find-alternate-file)
4521 (define-key ctl-x-map "\C-s" 'save-buffer) 4529 (define-key ctl-x-map "\C-s" 'save-buffer)