comparison lisp/net/tramp.el @ 95659:926453fe3d68

* net/tramp.el (top): Quote feature names. Remove `tramp-rfn-eshadow-setup-minibuffer' from `rfn-eshadow-setup-minibuffer-hook' when unloading. (tramp-read-passwd): There is only one call to `auth-source-user-or-password' needed. Pacify byte compiler.
author Michael Albinus <michael.albinus@gmx.de>
date Sun, 08 Jun 2008 10:47:43 +0000
parents e29bfedb7864
children a20bb74ebe03
comparison
equal deleted inserted replaced
95658:ad3644a3612d 95659:926453fe3d68
142 142
143 (when feature 143 (when feature
144 (require feature) 144 (require feature)
145 (add-hook 'tramp-unload-hook 145 (add-hook 'tramp-unload-hook
146 `(lambda () 146 `(lambda ()
147 (when (featurep ,feature) 147 (when (featurep (quote ,feature))
148 (unload-feature ,feature 'force))))))) 148 (unload-feature (quote ,feature) 'force)))))))
149 149
150 ;;; User Customizable Internal Variables: 150 ;;; User Customizable Internal Variables:
151 151
152 (defgroup tramp nil 152 (defgroup tramp nil
153 "Edit remote files with a combination of rsh and rcp or similar programs." 153 "Edit remote files with a combination of rsh and rcp or similar programs."
2092 (funcall (symbol-function 'overlay-put) 2092 (funcall (symbol-function 'overlay-put)
2093 tramp-rfn-eshadow-overlay (pop props) (pop props)))))) 2093 tramp-rfn-eshadow-overlay (pop props) (pop props))))))
2094 2094
2095 (when (boundp 'rfn-eshadow-setup-minibuffer-hook) 2095 (when (boundp 'rfn-eshadow-setup-minibuffer-hook)
2096 (add-hook 'rfn-eshadow-setup-minibuffer-hook 2096 (add-hook 'rfn-eshadow-setup-minibuffer-hook
2097 'tramp-rfn-eshadow-setup-minibuffer)) 2097 'tramp-rfn-eshadow-setup-minibuffer)
2098 (add-hook 'tramp-unload-hook
2099 '(lambda ()
2100 (remove-hook 'rfn-eshadow-setup-minibuffer-hook
2101 'tramp-rfn-eshadow-setup-minibuffer))))
2098 2102
2099 (defun tramp-rfn-eshadow-update-overlay () 2103 (defun tramp-rfn-eshadow-update-overlay ()
2100 "Update `rfn-eshadow-overlay' to cover shadowed part of minibuffer input. 2104 "Update `rfn-eshadow-overlay' to cover shadowed part of minibuffer input.
2101 This is intended to be used as a minibuffer `post-command-hook' for 2105 This is intended to be used as a minibuffer `post-command-hook' for
2102 `file-name-shadow-mode'; the minibuffer should have already 2106 `file-name-shadow-mode'; the minibuffer should have already
7216 (with-current-buffer (process-buffer proc) 7220 (with-current-buffer (process-buffer proc)
7217 (tramp-check-for-regexp proc tramp-password-prompt-regexp) 7221 (tramp-check-for-regexp proc tramp-password-prompt-regexp)
7218 (format "%s for %s " (capitalize (match-string 1)) key))))) 7222 (format "%s for %s " (capitalize (match-string 1)) key)))))
7219 7223
7220 (or 7224 (or
7221 ;; see if auth-sources contains something useful, if it's bound 7225 ;; See if auth-sources contains something useful, if it's bound.
7222 (when (boundp 'auth-sources) 7226 (when (boundp 'auth-sources)
7223 (or 7227 ;; Try with Tramp's current method.
7224 ;; 1. try with Tramp's current method 7228 (funcall (symbol-function 'auth-source-user-or-password)
7225 (auth-source-user-or-password 7229 "password" tramp-current-host tramp-current-method))
7226 "password" tramp-current-host tramp-current-method) 7230 ;; Else, get the password interactively.
7227 ;; 2. hard-code the method to be "tramp"
7228 (auth-source-user-or-password
7229 "password" tramp-current-host "tramp")))
7230 ;; 3. else, get the password interactively
7231 (if (functionp 'password-read) 7231 (if (functionp 'password-read)
7232 (let ((password (funcall (symbol-function 'password-read) 7232 (let ((password (funcall (symbol-function 'password-read)
7233 pw-prompt key))) 7233 pw-prompt key)))
7234 (funcall (symbol-function 'password-cache-add) key password) 7234 (funcall (symbol-function 'password-cache-add) key password)
7235 password) 7235 password)