Mercurial > emacs
comparison lisp/files.el @ 55778:f4d8fa42ea58
* files.el (file-name-non-special): There are more operations
which need handling: `find-backup-file-name',
`insert-file-contents', `verify-visited-file-modtime',
`write-region'. Rename t value of method to `add'. Add new
methods `quote' and `unquote-then-quote' to file-arg-indices.
author | Michael Albinus <michael.albinus@gmx.de> |
---|---|
date | Thu, 27 May 2004 20:23:31 +0000 |
parents | 821af7073c78 |
children | ef8edc11a6e4 |
comparison
equal
deleted
inserted
replaced
55777:de35aa92d3f3 | 55778:f4d8fa42ea58 |
---|---|
4479 (unhandled-file-name-directory default-directory))) | 4479 (unhandled-file-name-directory default-directory))) |
4480 default-directory)) | 4480 default-directory)) |
4481 ;; Get a list of the indices of the args which are file names. | 4481 ;; Get a list of the indices of the args which are file names. |
4482 (file-arg-indices | 4482 (file-arg-indices |
4483 (cdr (or (assq operation | 4483 (cdr (or (assq operation |
4484 ;; The first five are special because they | 4484 ;; The first six are special because they |
4485 ;; return a file name. We want to include the /: | 4485 ;; return a file name. We want to include the /: |
4486 ;; in the return value. | 4486 ;; in the return value. |
4487 ;; So just avoid stripping it in the first place. | 4487 ;; So just avoid stripping it in the first place. |
4488 '((expand-file-name . nil) | 4488 '((expand-file-name . nil) |
4489 (file-name-directory . nil) | 4489 (file-name-directory . nil) |
4490 (file-name-as-directory . nil) | 4490 (file-name-as-directory . nil) |
4491 (directory-file-name . nil) | 4491 (directory-file-name . nil) |
4492 (file-name-sans-versions . nil) | 4492 (file-name-sans-versions . nil) |
4493 (find-backup-file-name . nil) | |
4493 ;; `identity' means just return the first arg | 4494 ;; `identity' means just return the first arg |
4494 ;; not stripped of its quoting. | 4495 ;; not stripped of its quoting. |
4495 (substitute-in-file-name identity) | 4496 (substitute-in-file-name identity) |
4497 ;; `add' means add "/:" to the result. | |
4498 (file-truename add 0) | |
4499 ;; `quote' means add "/:" to buffer-file-name. | |
4500 (insert-file-contents quote 0) | |
4501 ;; `unquote-then-quote' means set buffer-file-name | |
4502 ;; temporarily to unquoted filename. | |
4503 (verify-visited-file-modtime unquote-then-quote) | |
4504 ;; List the arguments which are filenames. | |
4496 (file-name-completion 1) | 4505 (file-name-completion 1) |
4497 (file-name-all-completions 1) | 4506 (file-name-all-completions 1) |
4498 ;; t means add "/:" to the result. | 4507 (write-region 2 5) |
4499 (file-truename t 0) | |
4500 (rename-file 0 1) | 4508 (rename-file 0 1) |
4501 (copy-file 0 1) | 4509 (copy-file 0 1) |
4502 (make-symbolic-link 0 1) | 4510 (make-symbolic-link 0 1) |
4503 (add-name-to-file 0 1))) | 4511 (add-name-to-file 0 1))) |
4504 ;; For all other operations, treat the first argument only | 4512 ;; For all other operations, treat the first argument only |
4520 "/" | 4528 "/" |
4521 (substring (car pair) 2))))) | 4529 (substring (car pair) 2))))) |
4522 (setq file-arg-indices (cdr file-arg-indices)))) | 4530 (setq file-arg-indices (cdr file-arg-indices)))) |
4523 (cond ((eq method 'identity) | 4531 (cond ((eq method 'identity) |
4524 (car arguments)) | 4532 (car arguments)) |
4525 (method | 4533 ((eq method 'add) |
4526 (concat "/:" (apply operation arguments))) | 4534 (concat "/:" (apply operation arguments))) |
4535 ((eq method 'quote) | |
4536 (prog1 (apply operation arguments) | |
4537 (setq buffer-file-name (concat "/:" buffer-file-name)))) | |
4538 ((eq method 'unquote-then-quote) | |
4539 (let (res) | |
4540 (setq buffer-file-name (substring buffer-file-name 2)) | |
4541 (setq res (apply operation arguments)) | |
4542 (setq buffer-file-name (concat "/:" buffer-file-name)) | |
4543 res)) | |
4527 (t | 4544 (t |
4528 (apply operation arguments))))) | 4545 (apply operation arguments))))) |
4529 | 4546 |
4530 (define-key ctl-x-map "\C-f" 'find-file) | 4547 (define-key ctl-x-map "\C-f" 'find-file) |
4531 (define-key ctl-x-map "\C-r" 'find-file-read-only) | 4548 (define-key ctl-x-map "\C-r" 'find-file-read-only) |