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

From: Michael Albinus <[email-masked]>
Date: Tue, 22 Nov 2011 23:13:11 +0100

Stefan Monnier <[email-masked]> writes:

>> Start "emacs -Q". Apply "C-x C-f /sudo:: TAB". This results in
>> "/sudo:sudo:root@". A correct expansion would be "/sudo:root@".
>
> I haven't tracked this down yet, but while trying to I bumped into the
> following problem:
>
>    emacs -Q
>    (completion-try-completion "/sudo::" 'completion-file-name-table nil t)

I get

Debugger entered--Lisp error: (wrong-type-argument integerp t)
  completion-try-completion("/sudo::" completion-file-name-table nil t)
  eval((completion-try-completion "/sudo::" (quote completion-file-name-table) nil t) nil)
  eval-last-sexp-1(nil)
  eval-last-sexp(nil)
  call-interactively(eval-last-sexp nil nil)

>    C-g at the prompt
>    C-x C-f /sudo:: TAB
>
> and at that point Emacs is frozen solid.  The backtrace (shown after my
> sig) shows that rfn-eshadow (run with inhibit-quit) ends up waiting for
> a process that never replies.
>
> Can you look into it, while I try to solve the other problem?

`expand-file-name' seems to access the remote host. This can be
suppressed by let-binding of `non-essential' to t.

Could you, please, try this patch:

--8<---------------cut here---------------start------------->8---
=== modified file 'lisp/net/tramp.el'
--- lisp/net/tramp.el	2011-11-17 09:09:20 +0000
+++ lisp/net/tramp.el	2011-11-22 22:04:16 +0000
@@ -1609,7 +1609,9 @@
   (ignore-errors
     (let ((end (or (tramp-compat-funcall
 		    'overlay-end (symbol-value 'rfn-eshadow-overlay))
-		   (tramp-compat-funcall 'minibuffer-prompt-end))))
+		   (tramp-compat-funcall 'minibuffer-prompt-end)))
+	  ;; We do not want to send any remote command.
+	  (non-essential t))
       (when
 	  (file-remote-p
 	   (tramp-compat-funcall
--8<---------------cut here---------------end--------------->8---

>         Stefan

Best regards, Michael.