[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] Changes to emacs/lisp/net/tramp.el
From: |
Michael Albinus |
Subject: |
[Emacs-diffs] Changes to emacs/lisp/net/tramp.el |
Date: |
Mon, 17 Oct 2005 00:46:47 -0400 |
Index: emacs/lisp/net/tramp.el
diff -c emacs/lisp/net/tramp.el:1.80 emacs/lisp/net/tramp.el:1.81
*** emacs/lisp/net/tramp.el:1.80 Sat Oct 8 18:25:56 2005
--- emacs/lisp/net/tramp.el Mon Oct 17 04:46:46 2005
***************
*** 4384,4389 ****
--- 4384,4390 ----
(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,4503 ****
(substring
file (length (tramp-completion-handle-file-name-directory file))))
;; 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."
! (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)))
!
! (while v
! (let* ((car (car v))
! (multi-method (tramp-file-name-multi-method car))
! (method (tramp-file-name-method car))
! (user (tramp-file-name-user car))
! (host (tramp-file-name-host car))
! (localname (tramp-file-name-localname car))
! (m (tramp-find-method multi-method method user host))
! (tramp-current-user user) ; see `tramp-parse-passwd'
! all-user-hosts)
!
! (unless (or multi-method ;; Not handled (yet).
! localname) ;; Nothing to complete
!
! (if (or user host)
!
! ;; Method dependent user / host combinations
! (progn
! (mapcar
! (lambda (x)
! (setq all-user-hosts
! (append all-user-hosts
! (funcall (nth 0 x) (nth 1 x)))))
! (tramp-get-completion-function m))
!
! (setq result (append result
! (mapcar
! (lambda (x)
! (tramp-get-completion-user-host
! method user host (nth 0 x) (nth 1 x)))
! (delq nil all-user-hosts)))))
!
! ;; Possible methods
! (setq result
! (append result (tramp-get-completion-methods m)))))
!
! (setq v (delq car v))))
!
! ;;; unify list, remove nil elements
! (let (result1)
! (while result
! (let ((car (car result)))
! (when car (add-to-list 'result1 car))
! (setq result (delq car result))))
!
! result1)))
;; Method, host name and user name completion for a file.
(defun tramp-completion-handle-file-name-completion (filename directory)
--- 4435,4517 ----
(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))
! ;; possible completion structures
! (v (tramp-completion-dissect-file-name fullname))
! result result1)
!
! (while v
! (let* ((car (car v))
! (multi-method (tramp-file-name-multi-method car))
! (method (tramp-file-name-method car))
! (user (tramp-file-name-user car))
! (host (tramp-file-name-host car))
! (localname (tramp-file-name-localname car))
! (m (tramp-find-method multi-method method user host))
! (tramp-current-user user) ; see `tramp-parse-passwd'
! all-user-hosts)
!
! (unless (or multi-method ;; Not handled (yet).
! localname) ;; Nothing to complete
!
! (if (or user host)
!
! ;; Method dependent user / host combinations
! (progn
! (mapcar
! (lambda (x)
! (setq all-user-hosts
! (append all-user-hosts
! (funcall (nth 0 x) (nth 1 x)))))
! (tramp-get-completion-function m))
!
! (setq result (append result
! (mapcar
! (lambda (x)
! (tramp-get-completion-user-host
! method user host (nth 0 x) (nth 1 x)))
! (delq nil all-user-hosts)))))
!
! ;; Possible methods
! (setq result
! (append result (tramp-get-completion-methods m)))))
!
! (setq v (cdr v))))
!
! ;; unify list, remove nil elements
! (while result
! (let ((car (car result)))
! (when car (add-to-list 'result1 car))
! (setq result (cdr result))))
!
! ;; 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)