]> git.eshelyaron.com Git - emacs.git/commitdiff
* net/ange-ftp.el (ange-ftp-get-passwd): Throw if `non-essential'
authorMichael Albinus <michael.albinus@gmx.de>
Fri, 29 Jun 2012 07:14:36 +0000 (09:14 +0200)
committerMichael Albinus <michael.albinus@gmx.de>
Fri, 29 Jun 2012 07:14:36 +0000 (09:14 +0200)
is non-nil.
(ange-ftp-ignore-errors-if-non-essential): New defmacro.
(ange-ftp-file-name-all-completions): Use it.  (Bug#11808)

lisp/ChangeLog
lisp/net/ange-ftp.el

index 0f293be18c9d0ea92b976608f24f5b8243a1a16f..788a94e01b3bd50f375cc7db270aa793f174f407 100644 (file)
@@ -1,3 +1,10 @@
+2012-06-29  Michael Albinus  <michael.albinus@gmx.de>
+
+       * 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)
+
 2012-06-29  Andreas Schwab  <schwab@linux-m68k.org>
 
        * calendar/cal-dst.el (calendar-current-time-zone):
index 6ac01a1cd69509a68ed457ce001224bdf54dde33..16ebff1cce5b2b8b18ffa75a8fe41d4a4ed2d0a6 100644 (file)
@@ -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))