diff options
| author | Michael Albinus | 2009-11-29 20:04:08 +0000 |
|---|---|---|
| committer | Michael Albinus | 2009-11-29 20:04:08 +0000 |
| commit | f06dbf7ea981c278f2fd5cd7ab78edc40d085e1e (patch) | |
| tree | ac929a52b535442366905050c1d0fd6b908027d5 | |
| parent | abeafb2a06c9eac90ac5edfad3d1c56e532114d2 (diff) | |
| download | emacs-f06dbf7ea981c278f2fd5cd7ab78edc40d085e1e.tar.gz emacs-f06dbf7ea981c278f2fd5cd7ab78edc40d085e1e.zip | |
* net/ange-ftp.el (ange-ftp-parse-filename): Use `save-match-data'.
(ange-ftp-directory-files-and-attributes)
(ange-ftp-real-directory-files-and-attributes): New defuns.
| -rw-r--r-- | lisp/net/ange-ftp.el | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/lisp/net/ange-ftp.el b/lisp/net/ange-ftp.el index 7eb01d7c410..3f4be250647 100644 --- a/lisp/net/ange-ftp.el +++ b/lisp/net/ange-ftp.el | |||
| @@ -2672,10 +2672,11 @@ The main reason for this alist is to deal with file versions in VMS.") | |||
| 2672 | 2672 | ||
| 2673 | (defmacro ange-ftp-parse-filename () | 2673 | (defmacro ange-ftp-parse-filename () |
| 2674 | ;;Extract the filename from the current line of a dired-like listing. | 2674 | ;;Extract the filename from the current line of a dired-like listing. |
| 2675 | `(let ((eol (progn (end-of-line) (point)))) | 2675 | `(save-match-data |
| 2676 | (beginning-of-line) | 2676 | (let ((eol (progn (end-of-line) (point)))) |
| 2677 | (if (re-search-forward directory-listing-before-filename-regexp eol t) | 2677 | (beginning-of-line) |
| 2678 | (buffer-substring (point) eol)))) | 2678 | (if (re-search-forward directory-listing-before-filename-regexp eol t) |
| 2679 | (buffer-substring (point) eol))))) | ||
| 2679 | 2680 | ||
| 2680 | ;; This deals with the F switch. Should also do something about | 2681 | ;; This deals with the F switch. Should also do something about |
| 2681 | ;; unquoting names obtained with the SysV b switch and the GNU Q | 2682 | ;; unquoting names obtained with the SysV b switch and the GNU Q |
| @@ -3421,6 +3422,17 @@ system TYPE.") | |||
| 3421 | (nreverse files))) | 3422 | (nreverse files))) |
| 3422 | (apply 'ange-ftp-real-directory-files directory full match v19-args))) | 3423 | (apply 'ange-ftp-real-directory-files directory full match v19-args))) |
| 3423 | 3424 | ||
| 3425 | (defun ange-ftp-directory-files-and-attributes | ||
| 3426 | (directory &optional full match nosort id-format) | ||
| 3427 | (setq directory (expand-file-name directory)) | ||
| 3428 | (if (ange-ftp-ftp-name directory) | ||
| 3429 | (mapcar | ||
| 3430 | (lambda (file) | ||
| 3431 | (cons file (file-attributes (expand-file-name file directory)))) | ||
| 3432 | (ange-ftp-directory-files directory full match nosort)) | ||
| 3433 | (ange-ftp-real-directory-files-and-attributes | ||
| 3434 | directory full match nosort id-format))) | ||
| 3435 | |||
| 3424 | (defun ange-ftp-file-attributes (file &optional id-format) | 3436 | (defun ange-ftp-file-attributes (file &optional id-format) |
| 3425 | (setq file (expand-file-name file)) | 3437 | (setq file (expand-file-name file)) |
| 3426 | (let ((parsed (ange-ftp-ftp-name file))) | 3438 | (let ((parsed (ange-ftp-ftp-name file))) |
| @@ -4359,6 +4371,8 @@ NEWNAME should be the name to give the new compressed or uncompressed file.") | |||
| 4359 | (put 'delete-directory 'ange-ftp 'ange-ftp-delete-directory) | 4371 | (put 'delete-directory 'ange-ftp 'ange-ftp-delete-directory) |
| 4360 | (put 'insert-file-contents 'ange-ftp 'ange-ftp-insert-file-contents) | 4372 | (put 'insert-file-contents 'ange-ftp 'ange-ftp-insert-file-contents) |
| 4361 | (put 'directory-files 'ange-ftp 'ange-ftp-directory-files) | 4373 | (put 'directory-files 'ange-ftp 'ange-ftp-directory-files) |
| 4374 | (put 'directory-files-and-attributes 'ange-ftp | ||
| 4375 | 'ange-ftp-directory-files-and-attributes) | ||
| 4362 | (put 'file-directory-p 'ange-ftp 'ange-ftp-file-directory-p) | 4376 | (put 'file-directory-p 'ange-ftp 'ange-ftp-file-directory-p) |
| 4363 | (put 'file-writable-p 'ange-ftp 'ange-ftp-file-writable-p) | 4377 | (put 'file-writable-p 'ange-ftp 'ange-ftp-file-writable-p) |
| 4364 | (put 'file-readable-p 'ange-ftp 'ange-ftp-file-readable-p) | 4378 | (put 'file-readable-p 'ange-ftp 'ange-ftp-file-readable-p) |
| @@ -4436,6 +4450,8 @@ NEWNAME should be the name to give the new compressed or uncompressed file.") | |||
| 4436 | (ange-ftp-run-real-handler 'insert-file-contents args)) | 4450 | (ange-ftp-run-real-handler 'insert-file-contents args)) |
| 4437 | (defun ange-ftp-real-directory-files (&rest args) | 4451 | (defun ange-ftp-real-directory-files (&rest args) |
| 4438 | (ange-ftp-run-real-handler 'directory-files args)) | 4452 | (ange-ftp-run-real-handler 'directory-files args)) |
| 4453 | (defun ange-ftp-real-directory-files-and-attributes (&rest args) | ||
| 4454 | (ange-ftp-run-real-handler 'directory-files-and-attributes args)) | ||
| 4439 | (defun ange-ftp-real-file-directory-p (&rest args) | 4455 | (defun ange-ftp-real-file-directory-p (&rest args) |
| 4440 | (ange-ftp-run-real-handler 'file-directory-p args)) | 4456 | (ange-ftp-run-real-handler 'file-directory-p args)) |
| 4441 | (defun ange-ftp-real-file-writable-p (&rest args) | 4457 | (defun ange-ftp-real-file-writable-p (&rest args) |