Subject: bug#10085: 24.0.91; completion-pcm--find-all-completions returns wrong remote file names

From: Michael Albinus <[email-masked]>
Date: Sat, 31 Mar 2012 14:36:15 +0200

Stefan Monnier <[email-masked]> writes:

> Still trying to figure out what's really going on inside Tramp.
> Something I bumped into along the way (still doesn't quite explain it) is:
>
>   (let ((non-essential t))   (file-name-nondirectory "/sudo:")) -> "sudo:"
>   (let ((non-essential nil)) (file-name-nondirectory "/sudo:")) -> ""
>
> I think it's wrong for those two to return different values.

That's an error, and must be fixed, for sure. The correct result must be "".

I could apply a simple fix in `tramp-find-foreign-file-name-handler',
but this breaks other functionality. Grrrr.

I fear it will take some days, until I have puzzled it out.

> `non-essential' should prevent connecting to the remote host, but here
> neither operation needs to contact the remote host.  And of course,
> things are made worse because it's not only `non-essential' that
> controls the behavior but also `last-input-event' which makes debugging
> that much more .... interesting.

Hmm, yes. This is a heuristic for older Emacsen, which don't give Tramp
a `non-essential' value. Maybe I shall change it, that in case
`non-essential' does exist, no other check is needed. But I don't know,
whether all completion packages outside core Emacs care about
`non-essential' already. We shall postpone this change to 24.2, at least.

>         Stefan

Best regards, Michael.