diff options
| author | Jim Blandy | 1992-12-12 15:21:45 +0000 |
|---|---|---|
| committer | Jim Blandy | 1992-12-12 15:21:45 +0000 |
| commit | 5dbfdacd20b0c059da2e4e25fdfc1996b44acbb7 (patch) | |
| tree | 91c772705a65c77d06af040f9110290d6a70e59c | |
| parent | 7114f404be6136811b52b930f979fb5387213b8c (diff) | |
| download | emacs-5dbfdacd20b0c059da2e4e25fdfc1996b44acbb7.tar.gz emacs-5dbfdacd20b0c059da2e4e25fdfc1996b44acbb7.zip | |
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.
| -rw-r--r-- | lisp/dired-aux.el | 9 | ||||
| -rw-r--r-- | lisp/dired.el | 9 | ||||
| -rw-r--r-- | lisp/files.el | 46 | ||||
| -rw-r--r-- | lisp/ls-lisp.el | 9 |
4 files changed, 9 insertions, 64 deletions
diff --git a/lisp/dired-aux.el b/lisp/dired-aux.el index c34fd50f0e7..75d0f17fd93 100644 --- a/lisp/dired-aux.el +++ b/lisp/dired-aux.el | |||
| @@ -477,14 +477,7 @@ and use this command with a prefix argument (the value does not matter)." | |||
| 477 | ;; Compress or uncompress FILE. | 477 | ;; Compress or uncompress FILE. |
| 478 | ;; Return the name of the compressed or uncompressed file. | 478 | ;; Return the name of the compressed or uncompressed file. |
| 479 | ;; Rerurn nil if no change in files. | 479 | ;; Rerurn nil if no change in files. |
| 480 | (let (handler (handlers file-name-handler-alist)) | 480 | (let ((handler (find-file-name-handler file))) |
| 481 | (save-match-data | ||
| 482 | (while (and (consp handlers) (null handler)) | ||
| 483 | (if (and (consp (car handlers)) | ||
| 484 | (stringp (car (car handlers))) | ||
| 485 | (string-match (car (car handlers)) file)) | ||
| 486 | (setq handler (cdr (car handlers)))) | ||
| 487 | (setq handlers (cdr handlers)))) | ||
| 488 | (cond (handler | 481 | (cond (handler |
| 489 | (funcall handler 'dired-compress-file file)) | 482 | (funcall handler 'dired-compress-file file)) |
| 490 | ((file-symlink-p file) | 483 | ((file-symlink-p file) |
diff --git a/lisp/dired.el b/lisp/dired.el index 0417a71e692..4ec1907df1f 100644 --- a/lisp/dired.el +++ b/lisp/dired.el | |||
| @@ -581,14 +581,7 @@ If DIRNAME is already in a dired buffer, that buffer is used without refresh." | |||
| 581 | 581 | ||
| 582 | ;; Remove directory DIR from any directory cache. | 582 | ;; Remove directory DIR from any directory cache. |
| 583 | (defun dired-uncache (dir) | 583 | (defun dired-uncache (dir) |
| 584 | (let (handler (handlers file-name-handler-alist)) | 584 | (let ((handler (find-file-name-handler dir))) |
| 585 | (save-match-data | ||
| 586 | (while (and (consp handlers) (null handler)) | ||
| 587 | (if (and (consp (car handlers)) | ||
| 588 | (stringp (car (car handlers))) | ||
| 589 | (string-match (car (car handlers)) dir)) | ||
| 590 | (setq handler (cdr (car handlers)))) | ||
| 591 | (setq handlers (cdr handlers)))) | ||
| 592 | (if handler | 585 | (if handler |
| 593 | (funcall handler 'dired-uncache dir)))) | 586 | (funcall handler 'dired-uncache dir)))) |
| 594 | 587 | ||
diff --git a/lisp/files.el b/lisp/files.el index 9fd20526dd6..de949be7d16 100644 --- a/lisp/files.el +++ b/lisp/files.el | |||
| @@ -251,14 +251,7 @@ This is an interface to the function `load'." | |||
| 251 | "Copy the file FILE into a temporary file on this machine. | 251 | "Copy the file FILE into a temporary file on this machine. |
| 252 | Returns the name of the local copy, or nil, if FILE is directly | 252 | Returns the name of the local copy, or nil, if FILE is directly |
| 253 | accessible." | 253 | accessible." |
| 254 | (let (handler (handlers file-name-handler-alist)) | 254 | (let ((handler (find-file-name-handler file))) |
| 255 | (save-match-data | ||
| 256 | (while (and (consp handlers) (null handler)) | ||
| 257 | (if (and (consp (car handlers)) | ||
| 258 | (stringp (car (car handlers))) | ||
| 259 | (string-match (car (car handlers)) file)) | ||
| 260 | (setq handler (cdr (car handlers)))) | ||
| 261 | (setq handlers (cdr handlers)))) | ||
| 262 | (if handler | 255 | (if handler |
| 263 | (funcall handler 'file-local-copy file) | 256 | (funcall handler 'file-local-copy file) |
| 264 | nil))) | 257 | nil))) |
| @@ -270,14 +263,7 @@ both at the level of the file and at the level of the directories | |||
| 270 | containing it, until no links are left at any level." | 263 | containing it, until no links are left at any level." |
| 271 | (if (string= filename "~") | 264 | (if (string= filename "~") |
| 272 | (setq filename (expand-file-name filename))) | 265 | (setq filename (expand-file-name filename))) |
| 273 | (let (handler (handlers file-name-handler-alist)) | 266 | (let ((handler (find-file-name-handler filename))) |
| 274 | (save-match-data | ||
| 275 | (while (and (consp handlers) (null handler)) | ||
| 276 | (if (and (consp (car handlers)) | ||
| 277 | (stringp (car (car handlers))) | ||
| 278 | (string-match (car (car handlers)) filename)) | ||
| 279 | (setq handler (cdr (car handlers)))) | ||
| 280 | (setq handlers (cdr handlers)))) | ||
| 281 | ;; For file name that has a special handler, call handler. | 267 | ;; For file name that has a special handler, call handler. |
| 282 | ;; This is so that ange-ftp can save time by doing a no-op. | 268 | ;; This is so that ange-ftp can save time by doing a no-op. |
| 283 | (if handler | 269 | (if handler |
| @@ -299,6 +285,7 @@ containing it, until no links are left at any level." | |||
| 299 | (file-truename (expand-file-name target dir)) | 285 | (file-truename (expand-file-name target dir)) |
| 300 | ;; No, we are done! | 286 | ;; No, we are done! |
| 301 | filename))))) | 287 | filename))))) |
| 288 | |||
| 302 | 289 | ||
| 303 | (defun switch-to-buffer-other-window (buffer) | 290 | (defun switch-to-buffer-other-window (buffer) |
| 304 | "Select buffer BUFFER in another window." | 291 | "Select buffer BUFFER in another window." |
| @@ -1037,14 +1024,7 @@ This is a separate procedure so your site-init or startup file can | |||
| 1037 | redefine it. | 1024 | redefine it. |
| 1038 | If the optional argument KEEP-BACKUP-VERSION is non-nil, | 1025 | If the optional argument KEEP-BACKUP-VERSION is non-nil, |
| 1039 | we do not remove backup version numbers, only true file version numbers." | 1026 | we do not remove backup version numbers, only true file version numbers." |
| 1040 | (let (handler (handlers file-name-handler-alist)) | 1027 | (let ((handler (find-file-name-handler name))) |
| 1041 | (save-match-data | ||
| 1042 | (while (and (consp handlers) (null handler)) | ||
| 1043 | (if (and (consp (car handlers)) | ||
| 1044 | (stringp (car (car handlers))) | ||
| 1045 | (string-match (car (car handlers)) name)) | ||
| 1046 | (setq handler (cdr (car handlers)))) | ||
| 1047 | (setq handlers (cdr handlers)))) | ||
| 1048 | (if handler | 1028 | (if handler |
| 1049 | (funcall handler 'file-name-sans-versions name keep-backup-version) | 1029 | (funcall handler 'file-name-sans-versions name keep-backup-version) |
| 1050 | (substring name 0 | 1030 | (substring name 0 |
| @@ -1407,14 +1387,7 @@ or multiple mail buffers, etc." | |||
| 1407 | (defun make-directory (dir &optional parents) | 1387 | (defun make-directory (dir &optional parents) |
| 1408 | "Create the directory DIR and any nonexistent parent dirs." | 1388 | "Create the directory DIR and any nonexistent parent dirs." |
| 1409 | (interactive "FMake directory: \nP") | 1389 | (interactive "FMake directory: \nP") |
| 1410 | (let (handler (handlers file-name-handler-alist)) | 1390 | (let ((handler (find-file-name-handler dir))) |
| 1411 | (save-match-data | ||
| 1412 | (while (and (consp handlers) (null handler)) | ||
| 1413 | (if (and (consp (car handlers)) | ||
| 1414 | (stringp (car (car handlers))) | ||
| 1415 | (string-match (car (car handlers)) file)) | ||
| 1416 | (setq handler (cdr (car handlers)))) | ||
| 1417 | (setq handlers (cdr handlers)))) | ||
| 1418 | (if handler | 1391 | (if handler |
| 1419 | (funcall handler 'make-directory dir parents) | 1392 | (funcall handler 'make-directory dir parents) |
| 1420 | (if (not parents) | 1393 | (if (not parents) |
| @@ -1655,14 +1628,7 @@ switches do not contain `d', so that a full listing is expected. | |||
| 1655 | This works by running a directory listing program | 1628 | This works by running a directory listing program |
| 1656 | whose name is in the variable `ls-program'. | 1629 | whose name is in the variable `ls-program'. |
| 1657 | If WILDCARD, it also runs the shell specified by `shell-file-name'." | 1630 | If WILDCARD, it also runs the shell specified by `shell-file-name'." |
| 1658 | (let (handler (handlers file-name-handler-alist)) | 1631 | (let ((handler (find-file-name-handler file))) |
| 1659 | (save-match-data | ||
| 1660 | (while (and (consp handlers) (null handler)) | ||
| 1661 | (if (and (consp (car handlers)) | ||
| 1662 | (stringp (car (car handlers))) | ||
| 1663 | (string-match (car (car handlers)) file)) | ||
| 1664 | (setq handler (cdr (car handlers)))) | ||
| 1665 | (setq handlers (cdr handlers)))) | ||
| 1666 | (if handler | 1632 | (if handler |
| 1667 | (funcall handler 'insert-directory file switches | 1633 | (funcall handler 'insert-directory file switches |
| 1668 | wildcard full-directory-p) | 1634 | wildcard full-directory-p) |
diff --git a/lisp/ls-lisp.el b/lisp/ls-lisp.el index 54be933b2e3..94b0ed4385e 100644 --- a/lisp/ls-lisp.el +++ b/lisp/ls-lisp.el | |||
| @@ -57,14 +57,7 @@ It does not support ordinary shell wildcards; instead, it allows | |||
| 57 | regular expressions to match file names. | 57 | regular expressions to match file names. |
| 58 | 58 | ||
| 59 | The switches that work are: A a c i r S s t u" | 59 | The switches that work are: A a c i r S s t u" |
| 60 | (let (handler (handlers file-name-handler-alist)) | 60 | (let (handler ((find-file-name-handler file))) |
| 61 | (save-match-data | ||
| 62 | (while (and (consp handlers) (null handler)) | ||
| 63 | (if (and (consp (car handlers)) | ||
| 64 | (stringp (car (car handlers))) | ||
| 65 | (string-match (car (car handlers)) file)) | ||
| 66 | (setq handler (cdr (car handlers)))) | ||
| 67 | (setq handlers (cdr handlers)))) | ||
| 68 | (if handler | 61 | (if handler |
| 69 | (funcall handler 'insert-directory file switches | 62 | (funcall handler 'insert-directory file switches |
| 70 | wildcard full-directory-p) | 63 | wildcard full-directory-p) |