Mercurial > emacs
changeset 1672:ecf43116a845
The find-file-name-handler function in ../src/fileio.c is now
callable from lisp; use it instead of writing out its code.
* dired-aux.el (dired-compress-file): Just that.
* dired.el (dired-uncache): Just that.
* files.el (file-local-copy, file-truename,
file-name-sans-versions, make-directory, save-buffers-kill-emacs):
Just that.
* ls-lisp.el (insert-directory): Just that.
author | Jim Blandy <jimb@redhat.com> |
---|---|
date | Sat, 12 Dec 1992 15:21:45 +0000 |
parents | b2a50ea75eea |
children | 975c866af92d |
files | lisp/dired-aux.el lisp/dired.el lisp/files.el lisp/ls-lisp.el |
diffstat | 4 files changed, 9 insertions(+), 64 deletions(-) [+] |
line wrap: on
line diff
--- a/lisp/dired-aux.el Sat Dec 12 15:21:21 1992 +0000 +++ b/lisp/dired-aux.el Sat Dec 12 15:21:45 1992 +0000 @@ -477,14 +477,7 @@ ;; Compress or uncompress FILE. ;; Return the name of the compressed or uncompressed file. ;; Rerurn nil if no change in files. - (let (handler (handlers file-name-handler-alist)) - (save-match-data - (while (and (consp handlers) (null handler)) - (if (and (consp (car handlers)) - (stringp (car (car handlers))) - (string-match (car (car handlers)) file)) - (setq handler (cdr (car handlers)))) - (setq handlers (cdr handlers)))) + (let ((handler (find-file-name-handler file))) (cond (handler (funcall handler 'dired-compress-file file)) ((file-symlink-p file)
--- a/lisp/dired.el Sat Dec 12 15:21:21 1992 +0000 +++ b/lisp/dired.el Sat Dec 12 15:21:45 1992 +0000 @@ -581,14 +581,7 @@ ;; Remove directory DIR from any directory cache. (defun dired-uncache (dir) - (let (handler (handlers file-name-handler-alist)) - (save-match-data - (while (and (consp handlers) (null handler)) - (if (and (consp (car handlers)) - (stringp (car (car handlers))) - (string-match (car (car handlers)) dir)) - (setq handler (cdr (car handlers)))) - (setq handlers (cdr handlers)))) + (let ((handler (find-file-name-handler dir))) (if handler (funcall handler 'dired-uncache dir))))
--- a/lisp/files.el Sat Dec 12 15:21:21 1992 +0000 +++ b/lisp/files.el Sat Dec 12 15:21:45 1992 +0000 @@ -251,14 +251,7 @@ "Copy the file FILE into a temporary file on this machine. Returns the name of the local copy, or nil, if FILE is directly accessible." - (let (handler (handlers file-name-handler-alist)) - (save-match-data - (while (and (consp handlers) (null handler)) - (if (and (consp (car handlers)) - (stringp (car (car handlers))) - (string-match (car (car handlers)) file)) - (setq handler (cdr (car handlers)))) - (setq handlers (cdr handlers)))) + (let ((handler (find-file-name-handler file))) (if handler (funcall handler 'file-local-copy file) nil))) @@ -270,14 +263,7 @@ containing it, until no links are left at any level." (if (string= filename "~") (setq filename (expand-file-name filename))) - (let (handler (handlers file-name-handler-alist)) - (save-match-data - (while (and (consp handlers) (null handler)) - (if (and (consp (car handlers)) - (stringp (car (car handlers))) - (string-match (car (car handlers)) filename)) - (setq handler (cdr (car handlers)))) - (setq handlers (cdr handlers)))) + (let ((handler (find-file-name-handler filename))) ;; For file name that has a special handler, call handler. ;; This is so that ange-ftp can save time by doing a no-op. (if handler @@ -299,6 +285,7 @@ (file-truename (expand-file-name target dir)) ;; No, we are done! filename))))) + (defun switch-to-buffer-other-window (buffer) "Select buffer BUFFER in another window." @@ -1037,14 +1024,7 @@ redefine it. If the optional argument KEEP-BACKUP-VERSION is non-nil, we do not remove backup version numbers, only true file version numbers." - (let (handler (handlers file-name-handler-alist)) - (save-match-data - (while (and (consp handlers) (null handler)) - (if (and (consp (car handlers)) - (stringp (car (car handlers))) - (string-match (car (car handlers)) name)) - (setq handler (cdr (car handlers)))) - (setq handlers (cdr handlers)))) + (let ((handler (find-file-name-handler name))) (if handler (funcall handler 'file-name-sans-versions name keep-backup-version) (substring name 0 @@ -1407,14 +1387,7 @@ (defun make-directory (dir &optional parents) "Create the directory DIR and any nonexistent parent dirs." (interactive "FMake directory: \nP") - (let (handler (handlers file-name-handler-alist)) - (save-match-data - (while (and (consp handlers) (null handler)) - (if (and (consp (car handlers)) - (stringp (car (car handlers))) - (string-match (car (car handlers)) file)) - (setq handler (cdr (car handlers)))) - (setq handlers (cdr handlers)))) + (let ((handler (find-file-name-handler dir))) (if handler (funcall handler 'make-directory dir parents) (if (not parents) @@ -1655,14 +1628,7 @@ This works by running a directory listing program whose name is in the variable `ls-program'. If WILDCARD, it also runs the shell specified by `shell-file-name'." - (let (handler (handlers file-name-handler-alist)) - (save-match-data - (while (and (consp handlers) (null handler)) - (if (and (consp (car handlers)) - (stringp (car (car handlers))) - (string-match (car (car handlers)) file)) - (setq handler (cdr (car handlers)))) - (setq handlers (cdr handlers)))) + (let ((handler (find-file-name-handler file))) (if handler (funcall handler 'insert-directory file switches wildcard full-directory-p)
--- a/lisp/ls-lisp.el Sat Dec 12 15:21:21 1992 +0000 +++ b/lisp/ls-lisp.el Sat Dec 12 15:21:45 1992 +0000 @@ -57,14 +57,7 @@ regular expressions to match file names. The switches that work are: A a c i r S s t u" - (let (handler (handlers file-name-handler-alist)) - (save-match-data - (while (and (consp handlers) (null handler)) - (if (and (consp (car handlers)) - (stringp (car (car handlers))) - (string-match (car (car handlers)) file)) - (setq handler (cdr (car handlers)))) - (setq handlers (cdr handlers)))) + (let (handler ((find-file-name-handler file))) (if handler (funcall handler 'insert-directory file switches wildcard full-directory-p)