diff options
author | Michael Albinus <michael.albinus@gmx.de> | 2009-11-29 20:04:08 +0000 |
---|---|---|
committer | Michael Albinus <michael.albinus@gmx.de> | 2009-11-29 20:04:08 +0000 |
commit | f06dbf7ea981c278f2fd5cd7ab78edc40d085e1e (patch) | |
tree | ac929a52b535442366905050c1d0fd6b908027d5 /lisp/net/ange-ftp.el | |
parent | abeafb2a06c9eac90ac5edfad3d1c56e532114d2 (diff) | |
download | emacs-f06dbf7ea981c278f2fd5cd7ab78edc40d085e1e.tar.gz |
* 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.
Diffstat (limited to 'lisp/net/ange-ftp.el')
-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.") (defmacro ange-ftp-parse-filename () ;;Extract the filename from the current line of a dired-like listing. - `(let ((eol (progn (end-of-line) (point)))) - (beginning-of-line) - (if (re-search-forward directory-listing-before-filename-regexp eol t) - (buffer-substring (point) eol)))) + `(save-match-data + (let ((eol (progn (end-of-line) (point)))) + (beginning-of-line) + (if (re-search-forward directory-listing-before-filename-regexp eol t) + (buffer-substring (point) eol))))) ;; This deals with the F switch. Should also do something about ;; unquoting names obtained with the SysV b switch and the GNU Q @@ -3421,6 +3422,17 @@ system TYPE.") (nreverse files))) (apply 'ange-ftp-real-directory-files directory full match v19-args))) +(defun ange-ftp-directory-files-and-attributes + (directory &optional full match nosort id-format) + (setq directory (expand-file-name directory)) + (if (ange-ftp-ftp-name directory) + (mapcar + (lambda (file) + (cons file (file-attributes (expand-file-name file directory)))) + (ange-ftp-directory-files directory full match nosort)) + (ange-ftp-real-directory-files-and-attributes + directory full match nosort id-format))) + (defun ange-ftp-file-attributes (file &optional id-format) (setq file (expand-file-name file)) (let ((parsed (ange-ftp-ftp-name file))) @@ -4359,6 +4371,8 @@ NEWNAME should be the name to give the new compressed or uncompressed file.") (put 'delete-directory 'ange-ftp 'ange-ftp-delete-directory) (put 'insert-file-contents 'ange-ftp 'ange-ftp-insert-file-contents) (put 'directory-files 'ange-ftp 'ange-ftp-directory-files) +(put 'directory-files-and-attributes 'ange-ftp + 'ange-ftp-directory-files-and-attributes) (put 'file-directory-p 'ange-ftp 'ange-ftp-file-directory-p) (put 'file-writable-p 'ange-ftp 'ange-ftp-file-writable-p) (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.") (ange-ftp-run-real-handler 'insert-file-contents args)) (defun ange-ftp-real-directory-files (&rest args) (ange-ftp-run-real-handler 'directory-files args)) +(defun ange-ftp-real-directory-files-and-attributes (&rest args) + (ange-ftp-run-real-handler 'directory-files-and-attributes args)) (defun ange-ftp-real-file-directory-p (&rest args) (ange-ftp-run-real-handler 'file-directory-p args)) (defun ange-ftp-real-file-writable-p (&rest args) |