diff options
author | Michael Albinus <michael.albinus@gmx.de> | 2012-06-29 09:14:36 +0200 |
---|---|---|
committer | Michael Albinus <michael.albinus@gmx.de> | 2012-06-29 09:14:36 +0200 |
commit | 929df0e72251a48d1cf9b329f594ac3fe64a7b35 (patch) | |
tree | 35876580c56b510a0d640675259b4883d1200bf0 /lisp/net | |
parent | c8d3a25c0981020e1b8aa3bf96a4a0059be82431 (diff) | |
download | emacs-929df0e72251a48d1cf9b329f594ac3fe64a7b35.tar.gz |
* net/ange-ftp.el (ange-ftp-get-passwd): Throw if `non-essential'
is non-nil.
(ange-ftp-ignore-errors-if-non-essential): New defmacro.
(ange-ftp-file-name-all-completions): Use it. (Bug#11808)
Diffstat (limited to 'lisp/net')
-rw-r--r-- | lisp/net/ange-ftp.el | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/lisp/net/ange-ftp.el b/lisp/net/ange-ftp.el index 6ac01a1cd69..16ebff1cce5 100644 --- a/lisp/net/ange-ftp.el +++ b/lisp/net/ange-ftp.el @@ -1200,6 +1200,11 @@ only return the directory part of FILE." (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 catched 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 @@ -3969,10 +3974,15 @@ E.g., (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)) |