comparison lisp/net/tramp.el @ 84739:ed643c57fe39

* rfn-eshadow.el (rfn-eshadow-setup-minibuffer-hook) (rfn-eshadow-update-overlay-hook): New defvars. (rfn-eshadow-setup-minibuffer, rfn-eshadow-update-overlay): Run the hooks. * net/tramp.el (tramp-rfn-eshadow-overlay): New defvar. (tramp-rfn-eshadow-setup-minibuffer) (tramp-rfn-eshadow-update-overlay): New defuns. Hook into rfn-eshadow.el. * net/tramp-smb.el (tramp-smb-errors): Add error message for call timeout.
author Michael Albinus <michael.albinus@gmx.de>
date Fri, 21 Sep 2007 05:24:06 +0000
parents 38bcf4ef30c3
children b8f420afb6df
comparison
equal deleted inserted replaced
84738:c98c5f510060 84739:ed643c57fe39
2085 ;; Hosts visited once shall be remembered. 2085 ;; Hosts visited once shall be remembered.
2086 `(tramp-parse-connection-properties ,method) 2086 `(tramp-parse-connection-properties ,method)
2087 ;; The method related defaults. 2087 ;; The method related defaults.
2088 (cdr (assoc method tramp-completion-function-alist)))) 2088 (cdr (assoc method tramp-completion-function-alist))))
2089 2089
2090
2091 ;;; Fontification of `read-file-name'.
2092
2093 ;; rfn-eshadow.el is part of Emacs 22. Its is autoloaded.
2094 (defvar tramp-rfn-eshadow-overlay)
2095 (make-variable-buffer-local 'tramp-rfn-eshadow-overlay)
2096
2097 (defun tramp-rfn-eshadow-setup-minibuffer ()
2098 "Set up a minibuffer for `file-name-shadow-mode'.
2099 Adds another overlay hiding filename parts according to Tramp's
2100 special handling of `substitute-in-file-name'."
2101 (when minibuffer-completing-file-name
2102 (setq tramp-rfn-eshadow-overlay
2103 (make-overlay (minibuffer-prompt-end) (minibuffer-prompt-end)))
2104 ;; Copy rfn-eshadow-overlay properties.
2105 (let ((props (overlay-properties rfn-eshadow-overlay)))
2106 (while props
2107 (overlay-put tramp-rfn-eshadow-overlay (pop props) (pop props))))))
2108
2109 (when (boundp 'rfn-eshadow-setup-minibuffer-hook)
2110 (add-hook 'rfn-eshadow-setup-minibuffer-hook
2111 'tramp-rfn-eshadow-setup-minibuffer))
2112
2113 (defun tramp-rfn-eshadow-update-overlay ()
2114 "Update `rfn-eshadow-overlay' to cover shadowed part of minibuffer input.
2115 This is intended to be used as a minibuffer `post-command-hook' for
2116 `file-name-shadow-mode'; the minibuffer should have already
2117 been set up by `rfn-eshadow-setup-minibuffer'."
2118 ;; In remote files name, there is a shadowing just for the local part.
2119 (let ((end (or (overlay-end rfn-eshadow-overlay) (minibuffer-prompt-end))))
2120 (when (file-remote-p (buffer-substring-no-properties end (point-max)))
2121 (narrow-to-region
2122 (1+ (or (string-match "/" (buffer-string) end) end)) (point-max))
2123 (let ((rfn-eshadow-overlay tramp-rfn-eshadow-overlay)
2124 (rfn-eshadow-update-overlay-hook nil))
2125 (rfn-eshadow-update-overlay))
2126 (widen))))
2127
2128 (when (boundp 'rfn-eshadow-update-overlay-hook)
2129 (add-hook 'rfn-eshadow-update-overlay-hook
2130 'tramp-rfn-eshadow-update-overlay))
2131
2132
2090 ;;; File Name Handler Functions: 2133 ;;; File Name Handler Functions:
2091 2134
2092 (defun tramp-handle-make-symbolic-link 2135 (defun tramp-handle-make-symbolic-link
2093 (filename linkname &optional ok-if-already-exists) 2136 (filename linkname &optional ok-if-already-exists)
2094 "Like `make-symbolic-link' for Tramp files. 2137 "Like `make-symbolic-link' for Tramp files.
7465 ;; * But it would probably be better to use with-local-quit at the 7508 ;; * But it would probably be better to use with-local-quit at the
7466 ;; place where it's actually needed: around any potentially 7509 ;; place where it's actually needed: around any potentially
7467 ;; indefinitely blocking piece of code. In this case it would be 7510 ;; indefinitely blocking piece of code. In this case it would be
7468 ;; within Tramp around one of its calls to accept-process-output (or 7511 ;; within Tramp around one of its calls to accept-process-output (or
7469 ;; around one of the loops that calls accept-process-output) 7512 ;; around one of the loops that calls accept-process-output)
7470 ;; (Stefann Monnier). 7513 ;; (Stefan Monnier).
7471 ;; * Autodetect if remote `ls' groks the "--dired" switch. 7514 ;; * Autodetect if remote `ls' groks the "--dired" switch.
7472 ;; * Add fallback for inline encodings. This should be used 7515 ;; * Add fallback for inline encodings. This should be used
7473 ;; if the remote end doesn't support mimencode or a similar program. 7516 ;; if the remote end doesn't support mimencode or a similar program.
7474 ;; For reading files from the remote host, we can just parse the output 7517 ;; For reading files from the remote host, we can just parse the output
7475 ;; of `od -b'. For writing files to the remote host, we construct 7518 ;; of `od -b'. For writing files to the remote host, we construct