[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: CORRECT VERSION: tramp (2.0.51); tramp and file-name-all-completion
From: |
Kim F. Storm |
Subject: |
Re: CORRECT VERSION: tramp (2.0.51); tramp and file-name-all-completions |
Date: |
Tue, 18 Oct 2005 01:05:37 +0200 |
User-agent: |
Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) |
Michael Albinus <address@hidden> writes:
> address@hidden (Kim F. Storm) writes:
>
>> I used it in ido, and it seems to work:
>>
>> ;; work around bug in ange-ftp.
>> ;; /ftp:address@hidden: => nil
>> ;; /ftp:address@hidden:./ => ok
>> (and
>> (not (string= "/ftp:" dir))
>> (or
>> (string-match "\\`/ftp:.*:\\'" dir)
>> (and (string= tramp-default-method "ftp")
>> (string-match "\\`/[^/:]+:\\'" dir)))
>> (file-name-all-completions "" (concat dir "./"))))))
>
> This works for Tramp 2.0. It will work for Tramp 2.1 too, but there
> are also other means to derive a default methold. For the time being
> you might use a comment for this.
What code will I need to be 2.1 compatible?
>>
>> (file-directory-p "/telnet:kfs@")
>> or
>> (file-directory-p "/telnet:kfs@:")
>>
>> tramp signals "Login failure" in both cases.
>
> I know. This problem has eaten most of the time yesterday. In fact I
> don't know a safe decision whether a file name shall be completed only
> or "applied". Therefore I've introduced a new variable
> tramp-completion-mode, which is set in
> file-name-all-completions. Sensible Tramp file name functions, which
> need to behave depending on the mode, check this variable (beside
> other checks). So you might use it as well (untested, I'm @work):
>
> (let ((tramp-completion-mode t))
> (file-directory-p "/telnet:kfs@"))
This still cause the "Login Failed" error...
In any case, I don't quite understand how to use this. How can ido
know whether it makes sense to set tramp-completion-mode or not?
I have this function in ido to identify filename which may be handled
by a tramp file name handler. Is there a better way?
(defun ido-is-tramp-root (&optional dir)
(and ido-enable-tramp-completion
(string-match "\\`/[^/]+[@:]\\'"
(or dir ido-current-directory))))
My best solution is to try to eliminate such calls.
--
Kim F. Storm <address@hidden> http://www.cua.dk