Subject: bug#23006: 25.0.92; Loading Tramp breaks pcomplete in eshell-mode

From: Michael Albinus <[email-masked]>
Date: Mon, 21 Mar 2016 16:57:17 +0100

Stefan Monnier <[email-masked]> writes:

>>> But in that backtrace, it's OK for Tramp to open a new connection, since
>>> the user hit TAB.
>> Tramp does not know that the user hit TAB. It checks for `non-essential'.
>
> Exactly: pcomplete tells Tramp that it's OK to prompt for a password by
> *not* setting non-essential.  That's how Tramp can know.

But that's not the case in *this* bug. Opening a new connection is not
the only decision Tramp takes depending on the setting of
non-essential. The other decision is, whether a remote file name like
"/adb:" is intended by the user as complete file name, or whether the
completion machinery is still working, and Tramp could expext also a
hostname after the method "adb". That's the problem in this bug; Tramp
has not been informed that we are still in completion mode, and it takes
"/adb:" serious (allowed to perform essential operations).

>>>>> And why would it be called `non-essential' instead of `in-completion'?
>>>> I wanted to introduce `completion-only'.
>>> The crucial distinction to be made is not between "performing
>>> completion" and "not performing completion", but between "any normal
>>> operation, including completion in response to TAB" and "side-operations
>>> like on-the-fly completion à la icomplete or company or background data
>>> collection (like semantic might perform)".
>> I don't understand.  Tramp does not know where it has been called
>> from. It operates stateless.  `non-essential' provides some context,
>> that's all.
>
> That's right.  What I'm pointing out is that the context that Tramp
> needs is not "are we performing some kind of completion", but "are we
> allowed to prompt the user for a password" (admittedly, `non-essential'
> is not limited to "passwords" but more generally means that we should
> stay discrete.  E.g. it also means we shouldn't block Emacs for too
> long).

As said the other email, this decision doesn't make sense to Tramp. It
can only decide "are we allowed to open a new connection".

>> I do not care desktop.el just now, it is the case we were discussing 6
>> years ago. As of today, there is no other use case for `non-essential'
>> in the codebase but the Tramp case.
>
> Admittedly, the fact that the two sides (let-binder and var-reader)
> don't agree on what that variable means, reduces its
> usefulness significantly.
>
> In my view, Tramp should never prompt the user for a password (nor
> signal an error, tho emitting some warning message might be OK in some
> cases) when non-essential is non-nil.

Again, pls speak about opening a new connection. And also again, this
bug is *not* about Tramp prompting a password when it is not
ecxpected. This bug is about Tramp taking "/adb:" as the final remote file
name a user wants to be treated, because it wasn't informed that we are
still in file name completion.

>         Stefan

Best regards, Michael.