diff options
| author | Michael Albinus | 2009-10-02 13:20:14 +0000 |
|---|---|---|
| committer | Michael Albinus | 2009-10-02 13:20:14 +0000 |
| commit | b3ee21ac4fb0dd0ed6e585691526cdc0e73cf804 (patch) | |
| tree | a92aac771e1a3e35337120757301e52325c57cd7 | |
| parent | c980f176c5c58b659b95477cadc15418a5b339be (diff) | |
| download | emacs-b3ee21ac4fb0dd0ed6e585691526cdc0e73cf804.tar.gz emacs-b3ee21ac4fb0dd0ed6e585691526cdc0e73cf804.zip | |
* net/ange-ftp.el (ange-ftp-generate-passwd-key): Check, whether
HOST and USER are strings. They are nil, when there are
incomplete entries in ~/.netrc, for example.
(ange-ftp-delete-directory): Implement RECURSIVE case. Change to
root directory ("device busy" error otherwise).
| -rw-r--r-- | lisp/net/ange-ftp.el | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/lisp/net/ange-ftp.el b/lisp/net/ange-ftp.el index 60fe96623e1..40c1650076f 100644 --- a/lisp/net/ange-ftp.el +++ b/lisp/net/ange-ftp.el | |||
| @@ -1176,7 +1176,7 @@ only return the directory part of FILE." | |||
| 1176 | ;;;; ------------------------------------------------------------ | 1176 | ;;;; ------------------------------------------------------------ |
| 1177 | 1177 | ||
| 1178 | (defmacro ange-ftp-generate-passwd-key (host user) | 1178 | (defmacro ange-ftp-generate-passwd-key (host user) |
| 1179 | `(concat (downcase ,host) "/" ,user)) | 1179 | `(and (stringp ,host) (stringp ,user) (concat (downcase ,host) "/" ,user))) |
| 1180 | 1180 | ||
| 1181 | (defmacro ange-ftp-lookup-passwd (host user) | 1181 | (defmacro ange-ftp-lookup-passwd (host user) |
| 1182 | `(gethash (ange-ftp-generate-passwd-key ,host ,user) | 1182 | `(gethash (ange-ftp-generate-passwd-key ,host ,user) |
| @@ -4067,6 +4067,15 @@ directory, so that Emacs will know its current contents." | |||
| 4067 | (defun ange-ftp-delete-directory (dir &optional recursive) | 4067 | (defun ange-ftp-delete-directory (dir &optional recursive) |
| 4068 | (if (file-directory-p dir) | 4068 | (if (file-directory-p dir) |
| 4069 | (let ((parsed (ange-ftp-ftp-name dir))) | 4069 | (let ((parsed (ange-ftp-ftp-name dir))) |
| 4070 | (if recursive | ||
| 4071 | (mapc | ||
| 4072 | (lambda (file) | ||
| 4073 | (if (file-directory-p file) | ||
| 4074 | (ange-ftp-delete-directory file recursive) | ||
| 4075 | (delete-file file))) | ||
| 4076 | ;; We do not want to delete "." and "..". | ||
| 4077 | (directory-files | ||
| 4078 | dir 'full "^\\([^.]\\|\\.\\([^.]\\|\\..\\)\\).*"))) | ||
| 4070 | (if parsed | 4079 | (if parsed |
| 4071 | (let* ((host (nth 0 parsed)) | 4080 | (let* ((host (nth 0 parsed)) |
| 4072 | (user (nth 1 parsed)) | 4081 | (user (nth 1 parsed)) |
| @@ -4083,11 +4092,14 @@ directory, so that Emacs will know its current contents." | |||
| 4083 | (ange-ftp-real-file-name-as-directory | 4092 | (ange-ftp-real-file-name-as-directory |
| 4084 | (nth 2 parsed))))) | 4093 | (nth 2 parsed))))) |
| 4085 | (abbr (ange-ftp-abbreviate-filename dir)) | 4094 | (abbr (ange-ftp-abbreviate-filename dir)) |
| 4086 | ;; TODO: handle RECURSIVE. | 4095 | (result |
| 4087 | (result (ange-ftp-send-cmd host user | 4096 | (progn |
| 4088 | (list 'rmdir name) | 4097 | ;; CWD must not in this directory. |
| 4089 | (format "Removing directory %s" | 4098 | (ange-ftp-cd host user "/" 'noerror) |
| 4090 | abbr)))) | 4099 | (ange-ftp-send-cmd host user |
| 4100 | (list 'rmdir name) | ||
| 4101 | (format "Removing directory %s" | ||
| 4102 | abbr))))) | ||
| 4091 | (or (car result) | 4103 | (or (car result) |
| 4092 | (ange-ftp-error host user | 4104 | (ange-ftp-error host user |
| 4093 | (format "Could not remove directory %s: %s" | 4105 | (format "Could not remove directory %s: %s" |