(defun ange-ftp-get-passwd (host user)
"Return the password for specified HOST and USER, asking user if necessary."
+ ;; If `non-essential' is non-nil, don't ask for a password. It will
+ ;; be caught in Tramp.
+ (when non-essential
+ (throw 'non-essential 'non-essential))
+
(ange-ftp-parse-netrc)
;; look up password in the hash table first; user might have overridden the
(defun ange-ftp-gwp-start (host user name args)
"Login to the gateway machine and fire up an FTP process."
;; If `non-essential' is non-nil, don't reopen a new connection. It
- ;; will be catched in Tramp.
+ ;; will be caught in Tramp.
(when non-essential
(throw 'non-essential 'non-essential))
(let (;; It would be nice to make process-connection-type nil,
If HOST is only FTP-able through a gateway machine then spawn a shell
on the gateway machine to do the FTP instead."
;; If `non-essential' is non-nil, don't reopen a new connection. It
- ;; will be catched in Tramp.
+ ;; will be caught in Tramp.
(when non-essential
(throw 'non-essential 'non-essential))
(let* ((use-gateway (ange-ftp-use-gateway-p host))
(if (and proc (memq (process-status proc) '(run open)))
proc
;; If `non-essential' is non-nil, don't reopen a new connection. It
- ;; will be catched in Tramp.
+ ;; will be caught in Tramp.
(when non-essential
(throw 'non-essential 'non-essential))
(format
"list data file %s not readable"
temp))))
- ;; remove ^M inserted by the win32 ftp client
+ ;; remove ^M inserted by the w32 ftp client
(while (re-search-forward "\r$" nil t)
(replace-match ""))
(goto-char 1)
"Documented as `expand-file-name'."
(save-match-data
(setq default (or default default-directory))
- (cond ((eq (string-to-char name) ?~)
- (ange-ftp-real-expand-file-name name))
- ((eq (string-to-char name) ?/)
- (ange-ftp-canonize-filename name))
- ((and (eq system-type 'windows-nt)
- (eq (string-to-char name) ?\\))
- (ange-ftp-canonize-filename name))
- ((and (eq system-type 'windows-nt)
- (or (string-match "\\`[a-zA-Z]:" name)
- (string-match "\\`[a-zA-Z]:" default)))
- (ange-ftp-real-expand-file-name name default))
- ((zerop (length name))
- (ange-ftp-canonize-filename default))
- ((ange-ftp-canonize-filename
- (concat (file-name-as-directory default) name))))))
+ (cond
+ ((ange-ftp-ftp-name name)
+ ;; `default' is irrelevant.
+ (ange-ftp-canonize-filename name))
+ ((file-name-absolute-p name)
+ ;; `name' is absolute but is not an ange-ftp name => not ange-ftp.
+ (ange-ftp-real-expand-file-name name "/"))
+ ((ange-ftp-canonize-filename
+ (concat (file-name-as-directory default) name))))))
\f
;;; These are problems--they are currently not enabled.
(if (ange-ftp-file-entry-p name)
(let ((file-ent (ange-ftp-get-file-entry name)))
(if (stringp file-ent)
- (file-exists-p
+ (ange-ftp-file-exists-p
(ange-ftp-expand-symlink file-ent
(file-name-directory
(directory-file-name name))))
(format "Copying %s to %s" f-abbr t-abbr)))
(list 'ange-ftp-cf2
newname t-host t-user binary temp1 temp2 cont)
- nowait))
+ nowait)
+ (ange-ftp-add-file-entry newname))
;; newname wasn't remote.
(ange-ftp-cf2 t nil newname t-host t-user binary temp1 temp2 cont))
(string-match "\\`[a-zA-Z]:[/\\]\\'" dir))
(string-equal "/" dir)))
+(defmacro ange-ftp-ignore-errors-if-non-essential (&rest body)
+ `(if non-essential
+ (ignore-errors ,@body)
+ (progn ,@body)))
+
(defun ange-ftp-file-name-all-completions (file dir)
(let ((ange-ftp-this-dir (expand-file-name dir)))
(if (ange-ftp-ftp-name ange-ftp-this-dir)
- (progn
+ (ange-ftp-ignore-errors-if-non-essential
(ange-ftp-barf-if-not-directory ange-ftp-this-dir)
(setq ange-ftp-this-dir
(ange-ftp-real-file-name-as-directory ange-ftp-this-dir))