Commit c1253aad authored by Michael Albinus's avatar Michael Albinus
Browse files

* net/tramp.el (tramp-completion-mode): New defvar. Used in

`tramp-completion-mode' for checking if we are in completion mode.
(tramp-completion-handle-file-name-all-completions): Reorder code
in order to complete for file names only in case there are no
method/user/host completions.  This is necessary for cooperation
with ido.  Reported by Kim F. Storm  <storm@cua.dk>.
parent 7d6596b8
2005-10-17 Michael Albinus <michael.albinus@gmx.de>
* net/tramp.el (tramp-completion-mode): New defvar. Used in
`tramp-completion-mode' for checking if we are in completion mode.
(tramp-completion-handle-file-name-all-completions): Reorder code
in order to complete for file names only in case there are no
method/user/host completions. This is necessary for cooperation
with ido. Reported by Kim F. Storm <storm@cua.dk>.
2005-10-16 Chong Yidong <cyd@stupidchicken.com>
* longlines.el (longlines-search-forward)
......
......@@ -4384,6 +4384,7 @@ necessary anymore."
(defun tramp-completion-mode (file)
"Checks whether method / user name / host name completion is active."
(cond
(tramp-completion-mode t)
((not tramp-unified-filenames) t)
((string-match "^/.*:.*:$" file) nil)
((string-match
......@@ -4434,23 +4435,24 @@ necessary anymore."
(substring
file (length (tramp-completion-handle-file-name-directory file))))
(defvar tramp-completion-mode nil
"If non-nil, we are in file name completion mode.")
;; Method, host name and user name completion.
;; `tramp-completion-dissect-file-name' returns a list of
;; tramp-file-name structures. For all of them we return possible completions.
(defun tramp-completion-handle-file-name-all-completions (filename directory)
"Like `file-name-all-completions' for partial tramp files."
(unwind-protect
;; We need to reset `tramp-completion-mode'.
(progn
(setq tramp-completion-mode t)
(let*
((fullname (concat directory filename))
;; local files
(result
(if (tramp-completion-mode fullname)
(tramp-run-real-handler
'file-name-all-completions (list filename directory))
(tramp-completion-run-real-handler
'file-name-all-completions (list filename directory))))
;; possible completion structures
(v (tramp-completion-dissect-file-name fullname)))
(v (tramp-completion-dissect-file-name fullname))
result result1)
(while v
(let* ((car (car v))
......@@ -4488,16 +4490,28 @@ necessary anymore."
(setq result
(append result (tramp-get-completion-methods m)))))
(setq v (delq car v))))
(setq v (cdr v))))
;;; unify list, remove nil elements
(let (result1)
;; unify list, remove nil elements
(while result
(let ((car (car result)))
(when car (add-to-list 'result1 car))
(setq result (delq car result))))
(setq result (cdr result))))
result1)))
;; Complete local parts
(append
result1
(condition-case nil
(if result1
;; "/ssh:" does not need to be expanded as hostname.
(tramp-run-real-handler
'file-name-all-completions (list filename directory))
;; No method/user/host found to be expanded.
(tramp-completion-run-real-handler
'file-name-all-completions (list filename directory)))
(error nil)))))
;; unwindform
(setq tramp-completion-mode nil)))
;; Method, host name and user name completion for a file.
(defun tramp-completion-handle-file-name-completion (filename directory)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment