Subject: Re: bug#25607: 26.0.50; Ido does not work with tramp anymore

From: Dmitry Gutov <[email-masked]>
Date: Sat, 4 Feb 2017 02:41:06 +0200

Hi Michael,

On 03.02.2017 16:34, Michael Albinus wrote:
>> emacs -Q
>> M-x ido-mode
>> C-x C-f
>> (Here ido completion works)
>> Press backspace until you only have 'Find file: /' as prompt
>> (Here completion still works)
>> Type sudo:root@localhost:/
>> (No completion)
>>
>> It used to ask sudo password and then completion was working.
> 
> Likely, the changed behaviour comes from my commit
> 6653bb45d3697c9372cc77773c49f52399740b51, fixing bug#24947.

This commit may be going in the right direction, but do you know why 
even pressing TAB at the end of the offered scenario doesn't make Emacs 
ask for password?

The patch below makes Ido ask for password if I type TAB twice. But not 
after I do that once, which is puzzling. But maybe the function uses the 
completions already completed for the minibuffer, as a kind of optimization.

diff --git a/lisp/ido.el b/lisp/ido.el
index e18464d..2c773b0 100644
--- a/lisp/ido.el
+++ b/lisp/ido.el
@@ -2541,7 +2541,8 @@ ido-set-common-completion
  (defun ido-complete ()
    "Try and complete the current pattern amongst the file names."
    (interactive)
-  (let (res)
+  (let (non-essential
+        res)
      (cond
       (ido-incomplete-regexp
        ;; Do nothing